[a0b4327] | 1 | /** |
---|
| 2 | * Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
| 3 | * @file acciones_centralizadas.js |
---|
| 4 | * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
| 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-02-02 // (año-mes-dia) |
---|
| 23 | * @version 0.1 // (0.1) |
---|
| 24 | * @author Cenditel Merida - Ing Diego Uzcátegui (adaptacion a meta fisica) |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | /* |
---|
| 29 | * Implementation of calculaporc() |
---|
| 30 | */ |
---|
| 31 | function calculaporc_metafisica() { |
---|
| 32 | //partida=1 |
---|
| 33 | var asignado = parseInt($('#edit-cantidad-metafisica-planificado').val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
| 34 | var causado = parseInt($('#edit-cantidad-metafisica-ejecutado').val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
| 35 | if (!(causado >= 0)) { |
---|
| 36 | causado=0; |
---|
| 37 | } |
---|
[1890ad4] | 38 | if (asignado = 0 && causado >= 0) { |
---|
| 39 | asignado++; |
---|
| 40 | causado++; |
---|
| 41 | } |
---|
[a0b4327] | 42 | var porc = asignado; |
---|
| 43 | if (asignado > 0) { |
---|
| 44 | porc = (100 * causado) / asignado; |
---|
| 45 | $('#edit-cantidad-metafisica-porcen').val(porc.toFixed(2) + '%'); |
---|
| 46 | //alert(porc); |
---|
| 47 | var estilo = 'font-weight: bold;'; |
---|
| 48 | if (porc < 11){ |
---|
| 49 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['texto']); |
---|
| 50 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['tcolor']; |
---|
| 51 | } |
---|
| 52 | else if (porc < 51){ |
---|
| 53 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['texto']); |
---|
| 54 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['tcolor']; |
---|
| 55 | } |
---|
| 56 | else if (porc < 80){ |
---|
| 57 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['texto']); |
---|
| 58 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['tcolor']; |
---|
| 59 | } |
---|
| 60 | else if (porc <= 100){ |
---|
| 61 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['texto']); |
---|
| 62 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['tcolor']; |
---|
| 63 | } |
---|
[1890ad4] | 64 | else{ |
---|
[a0b4327] | 65 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['texto']); |
---|
| 66 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['tcolor']; |
---|
| 67 | } |
---|
| 68 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
| 69 | } |
---|
| 70 | else { |
---|
[1890ad4] | 71 | if (causado > 0) { |
---|
[a0b4327] | 72 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['texto']); |
---|
| 73 | $('#edit-cantidad-metafisica-porcen').val('N/D'); |
---|
| 74 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
| 75 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['tcolor']; |
---|
[1890ad4] | 76 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
[a0b4327] | 77 | } |
---|
[1890ad4] | 78 | else { |
---|
[a0b4327] | 79 | $('#edit-cantidad-metafisica-porcen').val('N/A'); |
---|
| 80 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['texto']); |
---|
| 81 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
| 82 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['tcolor']; |
---|
[1890ad4] | 83 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
[a0b4327] | 84 | } |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | function valenterometafisica(elemento){ |
---|
| 89 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
| 90 | if (valor >= 0) { |
---|
| 91 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
| 92 | }else{ |
---|
| 93 | $('#edit-' + elemento).val(0); |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | function valentero(elemento){ |
---|
| 98 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
| 99 | if (valor >= 0) { |
---|
| 100 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
| 101 | }else{ |
---|
| 102 | $('#edit-' + elemento).val(0); |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | function asignado_desabilitado(elemento){ |
---|
| 107 | $('#edit-' + elemento).disabled = true; |
---|
| 108 | } |
---|