source: sipes/0.3-modules/proyectos_operativos/js/proyectos_operativos2.js @ dba7f09

stableversion-3.0
Last change on this file since dba7f09 was dba7f09, checked in by lhernandez <lhernandez@…>, 8 años ago

se actualizaron las funciones referentes al monto total

  • Propiedad mode establecida a 100755
File size: 4.1 KB
Línea 
1 /**
2  * Sistema Integral de Planificación y Presupuesto (SIPP)
3  * @file proyectos_operativos2.js
4  * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP)
5  * Copyright 2011 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL)
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  *
21  * @author Cenditel Merida - Msc. Juan Vizcarrondo
22  * @date 2012-02-02 // (a&#241;o-mes-dia)
23  * @date 2015-02-06 // (a&#241;o-mes-dia)
24  * @version 0.2 // (0.1)
25  */
26
27/*
28 * Implementacion valores iniciales
29 */
30var proyectosOperativos = {};
31Drupal.behaviors.proyectosOperativos = function (context) {
32  var plurianual = Drupal.settings.proyectos_operativos.plurianual;
33  $("#edit-field-proyecto-fecha-i-0-value-datepicker-popup-0").attr('readonly', true);
34  $("#edit-field-proyecto-fecha-f-0-value-datepicker-popup-0").attr('readonly', true);
35  $("#edit-field-proyecto-fecha-i-0-value-datepicker-popup-0").attr('readonly', true);
36  $("#edit-field-proyecto-fecha-f-0-value-datepicker-popup-0").attr('readonly', true);
37  if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) {
38    $('#edit-field-proyecto-total-0-value').attr('readonly', true);
39    $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', true);
40    $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', true);
41    $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val());
42    $('#edit-field-proyecto-monto-ant-0-value').val(0);
43    $('#edit-field-proyecto-monto-prox-0-value').val(0);
44  }
45  $(".number").each(function() {
46    $(this).val($.number($(this).val(), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep));
47  });
48  $(".number").keyup(function(evt) {
49    $(this).val($.number($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.'), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep));
50  });
51  $("input[name=field_proyecto_plurianual[value]]").change(function() {
52    if ($(this).val() == plurianual){
53      $('#edit-field-proyecto-total-0-value').attr('readonly', false);
54      $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', false);
55      $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', false);
56    }
57    else {
58      $('#edit-field-proyecto-total-0-value').attr('readonly', true);
59      $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', true);
60      $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', true);
61      $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val());
62      $('#edit-field-proyecto-monto-ant-0-value').val(0);
63      $('#edit-field-proyecto-monto-prox-0-value').val(0);
64    }
65  });
66  $("#edit-field-proyecto-monto-anual-0-value").change(function() {
67    if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) {
68      $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val());
69    }
70  });
71  $("#proyectos-operativos-proyecto-basico-form").submit(function( event ) {
72    $(".number").each(function() {
73      $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.'));
74    });
75    return ;
76  });
77}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.