Conjunto c079de3 en seiven
- Fecha y hora:
- 08/08/2017 13:58:38 (hace 7 años)
- Branches:
- master
- Children:
- e214583
- Parents:
- 40567da
- Ficheros:
-
- 1 añadido
- 7 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
base/constant.py
r29bb1e1 rc079de3 36 36 37 37 ## Asunto del mensaje de información sobre la carga de datos 38 EMAIL_SUBJECT_LOAD_DATA = "Gesti ón de Datos - SEIVEN"38 EMAIL_SUBJECT_LOAD_DATA = "Gestion de Datos - SEIVEN" 39 39 40 40 ## Asunto del mensaje de información sobre la carga de datos -
economico/forms.py
r40567da rc079de3 189 189 def __init__(self, *args, **kwargs): 190 190 super(AnhoIniForm, self).__init__(*args, **kwargs) 191 self.fields['periodo_anho_ini'].choices = cargar_anho_base(anho_inicial=' 2007')191 self.fields['periodo_anho_ini'].choices = cargar_anho_base(anho_inicial='1970') 192 192 193 193 … … 214 214 def __init__(self, *args, **kwargs): 215 215 super(AnhoFinForm, self).__init__(*args, **kwargs) 216 self.fields['periodo_anho_fin'].choices = cargar_anho_base(anho_inicial=' 2007')216 self.fields['periodo_anho_fin'].choices = cargar_anho_base(anho_inicial='1970') 217 217 218 218 -
economico/models.py
r40567da rc079de3 19 19 from django.utils.translation import ugettext_lazy as _ 20 20 from django.db.models import Q 21 from datetime import datetime, timedelta21 from datetime import datetime, date, time, timedelta 22 22 from itertools import islice , cycle 23 23 24 24 from base.constant import ( 25 DOMINIO, PERIODICIDAD, TRIMESTRES, MESES, ECONOMICO_SUB_AREA, CONVERT_MES, EMAIL_SUBJECT_LOAD_DATA, 25 DOMINIO, PERIODICIDAD, TRIMESTRES, MESES, ECONOMICO_SUB_AREA, CONVERT_MES, EMAIL_SUBJECT_LOAD_DATA,EMAIL_SUBJECT_CM_RESULT, 26 26 TIPO_BALANZA_COMERCIAL, DOMINIO_BALANZA_COMERCIAL, BALANZA_DATOS, INVERSION_CARTERA, SECTOR_DEUDA 27 27 ) 28 28 from base.functions import enviar_correo, check_val_data 29 29 from base.models import AnhoBase 30 31 import calendar 30 32 31 33 import pyexcel … … 91 93 [ 92 94 {'tag': str(_('Año')), 'cabecera': True}, {'tag': str(_('Mes')), 'cabecera': True}, {'tag': str(_('INPC')), 'cabecera': True}, 95 93 96 {'tag': str(_('(1) Alimentos y Bebidas no Alcoholicas')), 'cabecera': True}, 94 97 {'tag': str(_('(2) Bebidas Alcoholicas y Tabaco')), 'cabecera': True}, … … 104 107 {'tag': str(_('(12) Restaurant y Hotel')), 'cabecera': True}, 105 108 {'tag': str(_('(13) Bienes y Servicios Diversos')), 'cabecera': True}, 109 106 110 {'tag': str(_('Bienes durables')), 'cabecera': True}, 107 111 {'tag': str(_('Bienes semidurables')), 'cabecera': True}, 108 112 {'tag': str(_('Bienes no durables')), 'cabecera': True}, 113 109 114 {'tag': str(_('Bienes')), 'cabecera': True}, 110 115 {'tag': str(_('Agrícolas')), 'cabecera': True}, … … 112 117 {'tag': str(_('Agroindustrial')), 'cabecera': True}, 113 118 {'tag': str(_('Otros manufacturados')), 'cabecera': True}, 119 114 120 {'tag': str(_('Total Servicios')), 'cabecera': True}, 115 121 {'tag': str(_('Servicios Básicos')), 'cabecera': True}, 116 122 {'tag': str(_('Otros Servicios')), 'cabecera': True}, 123 117 124 {'tag': str(_('Núcleo Inflacionario (NI)')), 'cabecera': True}, 118 125 {'tag': str(_('Alimentos Elaborados')), 'cabecera': True}, … … 120 127 {'tag': str(_('Bienes industriales excepto alimentos y textiles')), 'cabecera': True}, 121 128 {'tag': str(_('Servicios no administrados')), 'cabecera': True}, 129 122 130 {'tag': str(_('Controlados')), 'cabecera': True}, 123 131 {'tag': str(_('No Controlados')), 'cabecera': True} … … 133 141 kwargs['dominio'] = None 134 142 kwargs['ciudad'] = kwargs.pop('dominio') 143 lst=['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'] 144 x = int (kwargs['fecha__month__lte']) - int (kwargs['fecha__month__gte']) + 1 + 12 * (int(kwargs['fecha__year__lte']) - int(kwargs['fecha__year__gte'])) 145 for i, val in enumerate(lst): 146 if lst[int(kwargs['fecha__month__gte'])-1] in val: 147 desired = list( islice( cycle( lst), i, i+x)) 148 tmp=0 149 lolo=int (kwargs['fecha__year__gte']) 150 aux=1 151 for a in desired: 152 aux1='' 153 if a == 'Diciembre': 154 aux1=lolo+tmp 155 tmp=tmp+1 156 else: 157 aux1=lolo+tmp 158 aux=aux+1 159 fields.append([ {'tag': str(_(str(aux1)))}, {'tag': str(_(str(a)))}]) 160 135 161 else: 136 162 dominio, data_type = str(_('Ciudad')), 'C' … … 140 166 fields[0].insert(2, {'tag': '', 'cabecera': True}) 141 167 fields[1].insert(2, {'tag': dominio, 'cabecera': True}) 168 169 lst=['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'] 170 lst1=['Caracas','Maracay','Ciudad Guayana','Barcelona -Pto la Cruz','Valencia','Barquisimeto','Maracaibo','Mérida','Maturín','San Cristóbal','Resto Nacional'] 171 172 x = int (kwargs['fecha__month__lte']) - int (kwargs['fecha__month__gte']) + 1 + 12 * (int(kwargs['fecha__year__lte']) - int(kwargs['fecha__year__gte'])) 173 for i, val in enumerate(lst): 174 if lst[int(kwargs['fecha__month__gte'])-1] in val: 175 desired = list( islice( cycle( lst), i, i+x)) 176 tmp=0 177 lolo=int (kwargs['fecha__year__gte']) 178 aux,aux2=1,0 179 for a in desired: 180 aux1='' 181 if a == 'Diciembre': 182 aux1=lolo+tmp 183 tmp=tmp+1 184 else: 185 aux1=lolo+tmp 186 aux=aux+1 187 for q in range(0,11): 188 if lst1[q] == 'Caracas': 189 fields.append([ {'tag': str(_(str(aux1))),'combine_row':11 }, {'tag': str(_(str(a))), 'combine_row1':11},{'tag': str(_(str(lst1[q])))}]) 190 else: 191 fields.append([{'tag':''},{'tag':''},{'tag': str(_(str(lst1[q])))}]) 192 193 142 194 143 195 elif not 'dominio' in kwargs or not kwargs['dominio'] == 'C': … … 1171 1223 anho_base, errors, result, message = '', '', True, '' 1172 1224 load_data_msg = str(_("Datos Cargados")) 1225 1226 self.anho_base=AnhoBase.objects.get(id=kwargs['anho_base']) 1227 1173 1228 for row in range(1,len(load_file.row_range())): 1174 1229 1175 1230 try: 1176 real_demanda , created = DemandaGlobal.objects.update_or_create(anho=load_file[row,0], anho_base= kwargs['anho_base'], trimestre=load_file[row,1], demanda_global= load_file[row,2]+load_file[row,7])1231 real_demanda , created = DemandaGlobal.objects.update_or_create(anho=load_file[row,0], anho_base=self.anho_base, trimestre=load_file[row,1], demanda_global= load_file[row,2]+load_file[row,7]) 1177 1232 ## Se crea o actualiza el objeto de Demanda Agregada Interna luego de validar el valor en la hoja de calculo 1178 1233 … … 1200 1255 1201 1256 ## Envia correo electronico al usuario indicando el estatus de la carga de datos 1202 enviar_correo(user.email, 'gestion.informacion.load.mail', EMAIL_SUBJECT_ CM_RESULT, {1257 enviar_correo(user.email, 'gestion.informacion.load.mail', EMAIL_SUBJECT_LOAD_DATA, { 1203 1258 'load_data_msg': load_data_msg, 'administrador': administrador, 'admin_email': admin_email, 1204 1259 'errors': errors -
economico/templates/economico.precios.html
rfddad90 rc079de3 111 111 periodo_anho_ini.on('change', function() { set_filters() }); 112 112 periodo_anho_fin.on('change', function() { set_filters() }); 113 114 $('.fileinput-upload-button').click(function(event){ 115 event.preventDefault(); 116 var fdata = new FormData(); 117 fdata.append('file',file.files[0]); 118 $.ajax({ 119 url: URL_CARGAR_ARCHIVO_CM+models, 120 data: fdata, 121 contentType: false, 122 processData: false, 123 type: 'POST', 124 dataType: 'json', 125 success: function(data){ 126 var msg = data.message ? data.result : data.error; 127 bootbox.alert(msg); 128 }, 129 error: function(error){ 130 console.log(error); 131 } 132 }); 133 }); 113 134 }); 114 135 </script> -
economico/templates/economico.reservas.tipo.cambio.html
r0dd4577 rc079de3 50 50 </div> 51 51 <div id='TipoCambio' style='display:none;'> 52 {% include 'base.down.up.files.html' with url_down='/gestion-informacion/ajax/descargar_archivo' url_up='/gestion-informacion/ajax/cargar_archivo' app='economico' mod='TipoCambio' %}52 {% include 'base.down.up.files.html' with app='economico' mod='TipoCambio'%} 53 53 </div> 54 54 <div id='ReservasInternacionales' style='display:none;'> 55 {% include 'base.down.up.files.html' with url_down='/gestion-informacion/ajax/descargar_archivo' url_up='/gestion-informacion/ajax/cargar_archivo' app='economico' mod='ReservasInternacionales' %}55 {% include 'base.down.up.files.html' with app='economico' mod='ReservasInternacionales'%} 56 56 </div> 57 57 … … 135 135 */ 136 136 $(document).ready(function() { 137 dominio.on('change', function() {set_filters()});138 start_date.on('change', function() { set_filters() });139 end_date.on('change', function() { set_filters() });140 end_date.on('keyup', function() { set_filters() });137 dominio.on('change', function() {set_filters()}); 138 start_date.on('change', function() { set_filters() }); 139 end_date.on('change', function() { set_filters() }); 140 end_date.on('keyup', function() { set_filters() }); 141 141 142 }); 142 $('.fileinput-upload-button').click(function(event){ 143 event.preventDefault(); 144 var fdata = new FormData(); 145 fdata.append('file',file.files[0]); 146 $.ajax({ 147 url: URL_CARGAR_ARCHIVO_CM+models, 148 data: fdata, 149 contentType: false, 150 processData: false, 151 type: 'POST', 152 dataType: 'json', 153 success: function(data){ 154 var msg = data.message ? data.result : data.error; 155 bootbox.alert(msg); 156 }, 157 error: function(error){ 158 console.log(error); 159 } 160 }); 161 }); 162 }); 143 163 </script> 144 164 {% endblock %} -
gestion_informacion/ajax.py
r2037da0 rc079de3 73 73 modelo = apps.get_model(app, mod) 74 74 workbook = xlwt.Workbook() 75 sheet = workbook.add_sheet("Datos" )75 sheet = workbook.add_sheet("Datos",cell_overwrite_ok=True) 76 76 instance = modelo() 77 77 datos = instance.gestion_init(**filter) 78 78 i = 0 79 79 for con in datos['fields']: 80 index_col 81 style='align: horiz center; '80 index_col= 0 81 style='align: horiz center; align: vert center;' 82 82 for cabecera in con: 83 83 if 'color' in cabecera: … … 87 87 font_bold = xlwt.easyxf(style) 88 88 sheet.write(i, index_col, cabecera['tag'], font_bold) 89 sheet.set_shrink() 90 89 91 if 'cabecera' in cabecera: 90 92 sheet.col(i).width = int (333 * (len(cabecera['tag']) + 1)) 91 index_col += 1 93 94 if 'combine' in cabecera and cabecera['combine'] > 0: 95 sheet.merge(i, i, index_col, (index_col + (cabecera['combine']-1)), font_bold) 96 index_col = cabecera['combine'] + index_col 97 98 if 'dominio'in cabecera: 99 sheet.write(i, 2, cabecera['tag'], font_bold) 100 if 'combine_row' in cabecera: 101 sheet.write_merge(i, i+10, 0,0, cabecera['tag'],font_bold) 102 if 'combine_row1' in cabecera: 103 sheet.write_merge(i, i+10, 1,1, cabecera['tag'],font_bold) 104 else: 105 index_col += 1 92 106 i += 1 93 107 -
seiven/database_config.py
re4d3930 rc079de3 4 4 'ENGINE': 'django.db.backends.postgresql', 5 5 'NAME': 'seiven', 6 'USER': ' postgres',6 'USER': 'admin', 7 7 'PASSWORD': '123456', 8 8 'HOST': 'localhost',
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.