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ño-mes-dia) |
---|
23 | * @date 2015-02-06 // (año-mes-dia) |
---|
24 | * @version 0.2 // (0.1) |
---|
25 | */ |
---|
26 | |
---|
27 | /* |
---|
28 | * Implementacion valores iniciales |
---|
29 | */ |
---|
30 | var proyectosOperativos = {}; |
---|
31 | Drupal.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($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
47 | $(this).val($.number($(this).val(), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
48 | }); |
---|
49 | $(".number").keyup(function(evt) { |
---|
50 | $(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)); |
---|
51 | }); |
---|
52 | $("input[name=field_proyecto_plurianual[value]]").change(function() { |
---|
53 | if ($(this).val() == plurianual){ |
---|
54 | $('#edit-field-proyecto-total-0-value').attr('readonly', false); |
---|
55 | $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', false); |
---|
56 | $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', false); |
---|
57 | } |
---|
58 | else { |
---|
59 | $('#edit-field-proyecto-total-0-value').attr('readonly', true); |
---|
60 | $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', true); |
---|
61 | $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', true); |
---|
62 | $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); |
---|
63 | $('#edit-field-proyecto-monto-ant-0-value').val(0); |
---|
64 | $('#edit-field-proyecto-monto-prox-0-value').val(0); |
---|
65 | } |
---|
66 | }); |
---|
67 | $("#edit-field-proyecto-monto-anual-0-value").change(function() { |
---|
68 | if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) { |
---|
69 | $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); |
---|
70 | } |
---|
71 | }); |
---|
72 | $("#proyectos-operativos-proyecto-basico-form").submit(function( event ) { |
---|
73 | $(".number").each(function() { |
---|
74 | $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
75 | }); |
---|
76 | return ; |
---|
77 | }); |
---|
78 | } |
---|