1 | /** |
---|
2 | * Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
3 | * @file proyectos_operativos.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 | * @version 0.1 // (0.1) |
---|
24 | */ |
---|
25 | |
---|
26 | /* |
---|
27 | * Implementacion valores iniciales |
---|
28 | */ |
---|
29 | var proyectosOperativos = {}; |
---|
30 | Drupal.behaviors.proyectosOperativos = function (context) { |
---|
31 | //myplanner |
---|
32 | $("#edit-field-proyecto-fecha-i-0-value-datepicker-popup-0").attr('readonly', true); |
---|
33 | $("#edit-field-proyecto-fecha-f-0-value-datepicker-popup-0").attr('readonly', true); |
---|
34 | $("#edit-field-accion-esp-fechai-0-value-datepicker-popup-0").attr('readonly', true); |
---|
35 | $("#edit-field-accion-esp-fechaf-0-value-datepicker-popup-0").attr('readonly', true); |
---|
36 | $("#edit-field-accion-esp-fechai-0-value-datepicker-popup-0").val(); |
---|
37 | var date = $("#edit-field-accion-esp-fechai-0-value-datepicker-popup-0").val(); |
---|
38 | var n = date.split("/"); |
---|
39 | var month = parseInt(n[1], 10) - 1; |
---|
40 | var year_prev = parseInt(n[2], 10); |
---|
41 | var year_current = Drupal.settings.year_current; |
---|
42 | date1 = $("#edit-field-accion-esp-fechaf-0-value-datepicker-popup-0").val(); |
---|
43 | var n1 = date1.split("/"); |
---|
44 | month1 = parseInt(n1[1], 10) - 1; |
---|
45 | var year_next = parseInt(n1[2], 10); |
---|
46 | if (year_prev < year_current) { |
---|
47 | month = 0; |
---|
48 | } |
---|
49 | if (year_next > year_current) { |
---|
50 | month1 = 11; |
---|
51 | } |
---|
52 | for (var i = 0; i < 12;i++) { |
---|
53 | if (i < month || i > month1) { |
---|
54 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', true); |
---|
55 | $(".field_accion_esp_programacion_m" + i + "_field").val(0); |
---|
56 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', true); |
---|
57 | $(".field_accion_esp_metaf_m" + i + "_field").val(0); |
---|
58 | } |
---|
59 | else { |
---|
60 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', false); |
---|
61 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', false); |
---|
62 | } |
---|
63 | } |
---|
64 | suma('field_accion_esp_metaf_0_field'); |
---|
65 | for (i = 0; i < 12;i++) { |
---|
66 | suma('field_accion_esp_programacion_' + i + '_field'); |
---|
67 | } |
---|
68 | sumatexto('field_accion_esp_programacion_dato_field'); |
---|
69 | for (i = 0; i < 12;i++) { |
---|
70 | sumatexto('field_accion_esp_programacion_m' + i + '_field'); |
---|
71 | } |
---|
72 | $("#edit-field-accion-esp-fechai-0-value-datepicker-popup-0").datepicker({ |
---|
73 | onSelect: function(date) { |
---|
74 | var n = date.split("/"); |
---|
75 | var month = parseInt(n[1], 10) - 1; |
---|
76 | var year_prev = parseInt(n[2], 10); |
---|
77 | var year_current = Drupal.settings.year_current; |
---|
78 | var date1 = $("#edit-field-accion-esp-fechaf-0-value-datepicker-popup-0").val(); |
---|
79 | var n1 = date1.split("/"); |
---|
80 | var month1 = parseInt(n1[1], 10) - 1; |
---|
81 | var year_next = parseInt(n1[2], 10); |
---|
82 | var tamano = 0; |
---|
83 | //se obtiene el tamanho del campo |
---|
84 | $(".field_accion_esp_programacion_m0_field").each(function() { |
---|
85 | tamano++; |
---|
86 | }); |
---|
87 | if (year_prev < year_current) { |
---|
88 | month = 0; |
---|
89 | } |
---|
90 | if (year_next > year_current) { |
---|
91 | month1 = 11; |
---|
92 | } |
---|
93 | for (var i = 0; i <= 11;i++) { |
---|
94 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', true); |
---|
95 | $(".field_accion_esp_programacion_m" + i + "_field").val(0); |
---|
96 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', true); |
---|
97 | $(".field_accion_esp_metaf_m" + i + "_field").val(0); |
---|
98 | } |
---|
99 | if (year_prev <= year_current && year_next >= year_current) { |
---|
100 | for (var i = month; i <= month1;i++) { |
---|
101 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', false); |
---|
102 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', false); |
---|
103 | } |
---|
104 | } |
---|
105 | suma('field_accion_esp_metaf_0_field'); |
---|
106 | for (i = 0; i < 12;i++) { |
---|
107 | suma('field_accion_esp_programacion_' + i + '_field'); |
---|
108 | } |
---|
109 | sumatexto('field_accion_esp_programacion_dato_field'); |
---|
110 | for (i = 0; i < 12;i++) { |
---|
111 | sumatexto('field_accion_esp_programacion_m' + i + '_field'); |
---|
112 | } |
---|
113 | }, "dateFormat": "dd/mm/yy", |
---|
114 | }); |
---|
115 | $("#edit-field-accion-esp-fechaf-0-value-datepicker-popup-0").datepicker({ |
---|
116 | onSelect: function(date) { |
---|
117 | var n1 = date.split("/"); |
---|
118 | var month1 = parseInt(n1[1], 10) - 1; |
---|
119 | var year_next = parseInt(n1[2], 10); |
---|
120 | var year_current = Drupal.settings.year_current; |
---|
121 | var date1 = $("#edit-field-accion-esp-fechai-0-value-datepicker-popup-0").val(); |
---|
122 | var n = date1.split("/"); |
---|
123 | var month = parseInt(n[1], 10) - 1; |
---|
124 | var year_prev = parseInt(n[2], 10); |
---|
125 | var tamano = 0; |
---|
126 | //se obtiene el tamanho del campo |
---|
127 | $(".field_accion_esp_programacion_m0_field").each(function() { |
---|
128 | tamano++; |
---|
129 | }); |
---|
130 | if (year_prev < year_current) { |
---|
131 | month = 0; |
---|
132 | } |
---|
133 | if (year_next > year_current) { |
---|
134 | month1 = 11; |
---|
135 | } |
---|
136 | for (var i = 0; i <= 11;i++) { |
---|
137 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', true); |
---|
138 | $(".field_accion_esp_programacion_m" + i + "_field").val(0); |
---|
139 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', true); |
---|
140 | $(".field_accion_esp_metaf_m" + i + "_field").val(0); |
---|
141 | } |
---|
142 | if (year_prev <= year_current && year_next >= year_current) { |
---|
143 | for (var i = month; i <= month1;i++) { |
---|
144 | $(".field_accion_esp_programacion_m" + i + "_field").attr('readonly', false); |
---|
145 | $(".field_accion_esp_metaf_m" + i + "_field").attr('readonly', false); |
---|
146 | } |
---|
147 | } |
---|
148 | suma('field_accion_esp_metaf_0_field'); |
---|
149 | for (i = 0; i < 12;i++) { |
---|
150 | suma('field_accion_esp_programacion_' + i + '_field'); |
---|
151 | } |
---|
152 | sumatexto('field_accion_esp_programacion_dato_field'); |
---|
153 | for (i = 0; i < 12;i++) { |
---|
154 | sumatexto('field_accion_esp_programacion_m' + i + '_field'); |
---|
155 | } |
---|
156 | }, "dateFormat": "dd/mm/yy", |
---|
157 | }); |
---|
158 | } |
---|