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 | } |
---|
38 | |
---|
39 | var porc = asignado; |
---|
40 | if (asignado > 0) { |
---|
41 | porc = (100 * causado) / asignado; |
---|
42 | $('#edit-cantidad-metafisica-porcen').val(porc.toFixed(2) + '%'); |
---|
43 | //alert(porc); |
---|
44 | var estilo = 'font-weight: bold;'; |
---|
45 | if (porc < 11){ |
---|
46 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['texto']); |
---|
47 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['tcolor']; |
---|
48 | } |
---|
49 | else if (porc < 51){ |
---|
50 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['texto']); |
---|
51 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['tcolor']; |
---|
52 | } |
---|
53 | else if (porc < 80){ |
---|
54 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['texto']); |
---|
55 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['tcolor']; |
---|
56 | } |
---|
57 | else if (porc <= 100){ |
---|
58 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['texto']); |
---|
59 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['tcolor']; |
---|
60 | } |
---|
61 | else { |
---|
62 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['texto']); |
---|
63 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['tcolor']; |
---|
64 | } |
---|
65 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
66 | |
---|
67 | |
---|
68 | } |
---|
69 | else { |
---|
70 | |
---|
71 | if (causado > 0){ |
---|
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']; |
---|
76 | } |
---|
77 | else{ |
---|
78 | $('#edit-cantidad-metafisica-porcen').val('N/A'); |
---|
79 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['texto']); |
---|
80 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
81 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['tcolor']; |
---|
82 | } |
---|
83 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
84 | |
---|
85 | /* |
---|
86 | $('#edit-cantidad-metafisica-porcen').val('N/A'); |
---|
87 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
88 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['tcolor']; |
---|
89 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
90 | */ |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | function valenterometafisica(elemento){ |
---|
95 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
96 | if (valor >= 0) { |
---|
97 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
98 | }else{ |
---|
99 | $('#edit-' + elemento).val(0); |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | function valentero(elemento){ |
---|
104 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
105 | if (valor >= 0) { |
---|
106 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
107 | }else{ |
---|
108 | $('#edit-' + elemento).val(0); |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | function asignado_desabilitado(elemento){ |
---|
113 | $('#edit-' + elemento).disabled = true; |
---|
114 | } |
---|