[303fae2] | 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-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); |
---|
| 40 | } |
---|
| 41 | $(".number").each(function() { |
---|
| 42 | $(this).val($.number($(this).val(), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
| 43 | }); |
---|
| 44 | $(".number").keyup(function(evt) { |
---|
| 45 | $(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)); |
---|
| 46 | }); |
---|
| 47 | $("input[name=field_proyecto_plurianual[value]]").change(function() { |
---|
| 48 | if ($(this).val() == plurianual){ |
---|
| 49 | $('#edit-field-proyecto-total-0-value').attr('readonly', false); |
---|
| 50 | } |
---|
| 51 | else { |
---|
| 52 | $('#edit-field-proyecto-total-0-value').attr('readonly', true); |
---|
| 53 | $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); |
---|
| 54 | } |
---|
| 55 | }); |
---|
| 56 | $("#edit-field-proyecto-monto-anual-0-value").change(function() { |
---|
| 57 | if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) { |
---|
| 58 | $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); |
---|
| 59 | } |
---|
| 60 | }); |
---|
| 61 | $("#proyectos-operativos-proyecto-basico-form").submit(function( event ) { |
---|
| 62 | $(".number").each(function() { |
---|
| 63 | $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
| 64 | }); |
---|
| 65 | return ; |
---|
| 66 | }); |
---|
| 67 | } |
---|