/** * Sistema Integral de Planificación y Presupuesto (SIPP) * @file proyectos_operativos2.js * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP) * Copyright 2011 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * @author Cenditel Merida - Msc. Juan Vizcarrondo * @date 2012-02-02 // (año-mes-dia) * @date 2015-02-06 // (año-mes-dia) * @version 0.2 // (0.1) */ /* * Implementacion valores iniciales */ var proyectosOperativos = {}; Drupal.behaviors.proyectosOperativos = function (context) { var plurianual = Drupal.settings.proyectos_operativos.plurianual; $("#edit-field-proyecto-fecha-i-0-value-datepicker-popup-0").attr('readonly', true); $("#edit-field-proyecto-fecha-f-0-value-datepicker-popup-0").attr('readonly', true); $("#edit-field-proyecto-fecha-i-0-value-datepicker-popup-0").attr('readonly', true); $("#edit-field-proyecto-fecha-f-0-value-datepicker-popup-0").attr('readonly', true); if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) { $('#edit-field-proyecto-total-0-value').attr('readonly', true); $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', true); $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', true); $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); $('#edit-field-proyecto-monto-ant-0-value').val(0); $('#edit-field-proyecto-monto-prox-0-value').val(0); } $(".number").each(function() { $(this).val($.number($(this).val(), Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); }); $(".number").keyup(function(evt) { $(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)); }); $("input[name=field_proyecto_plurianual[value]]").change(function() { if ($(this).val() == plurianual){ $('#edit-field-proyecto-total-0-value').attr('readonly', false); $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', false); $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', false); } else { $('#edit-field-proyecto-total-0-value').attr('readonly', true); $('#edit-field-proyecto-monto-ant-0-value').attr('readonly', true); $('#edit-field-proyecto-monto-prox-0-value').attr('readonly', true); $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); $('#edit-field-proyecto-monto-ant-0-value').val(0); $('#edit-field-proyecto-monto-prox-0-value').val(0); } }); $("#edit-field-proyecto-monto-anual-0-value").change(function() { if (!$("#edit-field-proyecto-plurianual-value-" + plurianual).is(':checked')) { $('#edit-field-proyecto-total-0-value').val($("#edit-field-proyecto-monto-anual-0-value").val()); } }); $("#proyectos-operativos-proyecto-basico-form").submit(function( event ) { $(".number").each(function() { $(this).val($(this).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); }); return ; }); }