source: sipes/0.3-modules/cck_plan_fields/js/cck_plan_fields.js @ 1e031fe

stable
Last change on this file since 1e031fe was 1e031fe, checked in by Sipes Apn <root@…>, 7 años ago

se realizo la correción en lo referente al nombre del campo

  • Propiedad mode establecida a 100755
File size: 1.7 KB
Línea 
1 /**
2  * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana
3  * @file cck_plan_fields.js
4  * Drupal part Module to code ente planificador module
5  * Copyright 2013 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 2013-08-03 // (a&#241;o-mes-dia)
23  * @version 0.2 // (0.2)
24  *
25  */
26
27Drupal.behaviors.cckPlanFields = function (context) {
28  $('.' + 'totales').attr('readonly', true);
29}
30
31function suma(clase) {
32  var sum = 0;
33  var i = 0;
34  var valor = 0;
35  $('.' + clase).each(function() {
36        valor = parseFloat($(this).val().replace(/[.\s]/g, ''));
37        if (valor < 0 || isNaN(valor) || !isFinite(valor)) {
38          $(this).val(0);
39          valor = 0;
40        }
41        sum += valor;
42    });
43  if (jQuery.isFunction($.number)) {
44    sum = $.number(sum, 0, ',', '.');
45  }
46  $('.' + clase + '_total').val(sum);
47}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.