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 | Drupal.behaviors.segumientoProyectos = function (context) { |
---|
29 | calculaporc_metafisica();//mostrar los valores por defecto si se presenta un form_set_error |
---|
30 | $("#edit-cantidad-metafisica-ejecutado").keyup(function() { |
---|
31 | calculaporc_metafisica(); |
---|
32 | }); |
---|
33 | } |
---|
34 | |
---|
35 | /* |
---|
36 | * Implementation of calculaporc() |
---|
37 | */ |
---|
38 | function calculaporc_metafisica() { |
---|
39 | //partida=1 |
---|
40 | 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, '.')); |
---|
41 | 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, '.')); |
---|
42 | if (!(causado >= 0)) { |
---|
43 | causado=0; |
---|
44 | } |
---|
45 | |
---|
46 | var porc = asignado; |
---|
47 | if (asignado > 0) { |
---|
48 | porc = (100 * causado) / asignado; |
---|
49 | $('#edit-cantidad-metafisica-porcen').val(porc.toFixed(2) + '%'); |
---|
50 | //alert(porc); |
---|
51 | var estilo = 'font-weight: bold;'; |
---|
52 | if (porc < 11){ |
---|
53 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['texto']); |
---|
54 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[1]['tcolor']; |
---|
55 | } |
---|
56 | else if (porc < 51){ |
---|
57 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['texto']); |
---|
58 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[2]['tcolor']; |
---|
59 | } |
---|
60 | else if (porc < 80){ |
---|
61 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['texto']); |
---|
62 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[3]['tcolor']; |
---|
63 | } |
---|
64 | else if (porc <= 100){ |
---|
65 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['texto']); |
---|
66 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[4]['tcolor']; |
---|
67 | } |
---|
68 | else { |
---|
69 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['texto']); |
---|
70 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['tcolor']; |
---|
71 | } |
---|
72 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
73 | |
---|
74 | |
---|
75 | } |
---|
76 | else { |
---|
77 | |
---|
78 | if (causado > 0){ |
---|
79 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['texto']); |
---|
80 | $('#edit-cantidad-metafisica-porcen').val('N/D'); |
---|
81 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
82 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[5]['tcolor']; |
---|
83 | } |
---|
84 | else{ |
---|
85 | $('#edit-cantidad-metafisica-porcen').val('N/A'); |
---|
86 | $('#metafisica-inversion-form').html(Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['texto']); |
---|
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 | } |
---|
90 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
91 | |
---|
92 | /* |
---|
93 | $('#edit-cantidad-metafisica-porcen').val('N/A'); |
---|
94 | var estilo = $('#metafisica-inversion-form'). attr('style'); |
---|
95 | estilo += ';background:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['color'] + ';color:' + Drupal.settings.accion_especifica_de_proyecto_seguimiento[0]['tcolor']; |
---|
96 | $('#metafisica-inversion-form'). attr('style', estilo); |
---|
97 | */ |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | function valenterometafisica(elemento){ |
---|
102 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
103 | if (valor >= 0) { |
---|
104 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
105 | }else{ |
---|
106 | $('#edit-' + elemento).val(0); |
---|
107 | } |
---|
108 | } |
---|
109 | |
---|
110 | function valentero(elemento){ |
---|
111 | var valor = parseInt($('#edit-' + elemento).val().replace(/[Drupal.settings.format_number.thousands_sep\s]/g, '').replace(/[Drupal.settings.format_number.dec_point\s]/g, '.')); |
---|
112 | if (valor >= 0) { |
---|
113 | $('#edit-' + elemento).val($.number(valor, Drupal.settings.format_number.decimals, Drupal.settings.format_number.dec_point, Drupal.settings.format_number.thousands_sep)); |
---|
114 | }else{ |
---|
115 | $('#edit-' + elemento).val(0); |
---|
116 | } |
---|
117 | } |
---|
118 | |
---|
119 | function asignado_desabilitado(elemento){ |
---|
120 | $('#edit-' + elemento).disabled = true; |
---|
121 | } |
---|