source: sipes/0.3-modules/proyectos_operativos/js/proyectos_operativos1.js @ a0cf94c

stableversion-3.0
Last change on this file since a0cf94c was 303fae2, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

se agregaron los modulos

  • Propiedad mode establecida a 100755
File size: 4.0 KB
Línea 
1 /**
2  * Sistema Integral de Planificación y Presupuesto (SIPP)
3  * @file proyectos_proyectos_operativos1.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 2015-02-06 // (a&#241;o-mes-dia)
23  * @version 0.2 // (0.1)
24  */
25
26/*
27 * Implementacion valores iniciales
28 */
29var proyectosOperativos = {};
30Drupal.behaviors.proyectosOperativos = function (context) {
31  var n = Drupal.settings.proyectos_operativos.fecha[0];
32  var personas = Drupal.settings.proyectos_operativos.unidadmpers;
33  var valorundm = $('#edit-field-proyecto-unidadm-value').val();
34  if (typeof personas[valorundm] == "undefined") {
35    $('#meta-unidm-pers').hide();
36  }
37  var month = parseInt(n, 10);
38  if (month > 0) {
39    for (var i = 0; i < month;i++) {
40      $(".field_proyecto_meta_fisica_m" + i + "_field").attr('readonly', true);
41    }
42  }
43  n = Drupal.settings.proyectos_operativos.fecha[1];
44  month = parseInt(n, 10);
45  if (month < 11) {
46    for (var i = month + 1; i < 12; i++) {
47      $(".field_proyecto_meta_fisica_m" + i + "_field").attr('readonly', true);
48    }
49  }
50  $("#edit-field-proyecto-unidadm-value").change(function() {
51    valorundm = $(this).val();
52    if (typeof personas[valorundm] == "undefined") {
53      $("#edit-field-proyecto-meta-m-0-value").val(0);
54      $("#edit-field-proyecto-meta-f-0-value").val(0);
55      $('#meta-unidm-pers').hide();
56    }
57    else {
58      $('#meta-unidm-pers').show();
59    }
60  });
61  $(".number").each(function() {
62    $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.'));
63  });
64  $(".number").each(function() {
65    $(this).val($.number($(this).val(), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep));
66  });
67  $(".number").keyup(function(evt) {
68    $(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));
69  });
70  $("#proyectos-operativos-proyecto-indicadores-form").submit(function( event ) {
71    $(".number").each(function() {
72      $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.'));
73    });
74    return ;
75  });
76}
77
78/*
79 * Implementacion of sumunidpersonas
80 */
81function sumunidpersonas(clase) {
82  var sum = 0;
83  var i = 0;
84  var valor = 0;
85  $('.' + clase).each(function() {
86    valor = parseFloat($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.'));
87    if (valor < 0 || isNaN(valor) || !isFinite(valor)) {
88      $(this).val(0);
89      valor = 0;
90    }
91    sum += valor;
92  });
93  $('.' + clase + '_total').text($.number(sum, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep));
94}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.