Conjunto a2ba7a6 en seiven
- Fecha y hora:
- 09/06/2017 13:44:16 (hace 7 años)
- Branches:
- master
- Children:
- 6d02466
- Parents:
- a4b9db7
- Ficheros:
-
- 2 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
economico/models.py
ra4b9db7 ra2ba7a6 24 24 from base.constant import ( 25 25 DOMINIO, PERIODICIDAD, TRIMESTRES, MESES, ECONOMICO_SUB_AREA, CONVERT_MES, EMAIL_SUBJECT_LOAD_DATA, 26 TIPO_BALANZA_COMERCIAL, DOMINIO_BALANZA_COMERCIAL, BALANZA_DATOS 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 … … 2973 2973 fields.append(header) 2974 2974 sub_header = [ 2975 {'tag': str(_(" Trimestre")), 'color': 'white', 'text_color': 'black','cabecera': True},2976 {'tag': str(_(" Año")), 'color': 'white', 'text_color': 'black', 'cabecera': True},2975 {'tag': str(_("Año")), 'color': 'white', 'text_color': 'black','cabecera': True}, 2976 {'tag': str(_("Trimestre")), 'color': 'white', 'text_color': 'black', 'cabecera': True}, 2977 2977 {'tag': str(_(CuentaCapitalSaldos._meta.get_field('transporte').verbose_name)), 'color': 'sky_blue', 'text_color': 'white', 'cabecera': True}, 2978 2978 {'tag': str(_(CuentaCapitalSaldos._meta.get_field('viajes').verbose_name)), 'color': 'sky_blue', 'text_color': 'white', 'cabecera': True}, … … 3038 3038 fields.append(header) 3039 3039 sub_header = [ 3040 {'tag': str(_(" Trimestre")), 'color': 'white', 'text_color': 'black','cabecera': True},3041 {'tag': str(_(" Año")), 'color': 'white', 'text_color': 'black', 'cabecera': True},3040 {'tag': str(_("Año")), 'color': 'white', 'text_color': 'black','cabecera': True}, 3041 {'tag': str(_("Trimestre")), 'color': 'white', 'text_color': 'black', 'cabecera': True}, 3042 3042 {'tag': str(_(CuentaCapitalDeudaCapital._meta.get_field('bono_pagare').verbose_name)), 'color': 'green', 'text_color': 'white', 'cabecera': True}, 3043 3043 {'tag': str(_(CuentaCapitalDeudaCapital._meta.get_field('credito_comercial').verbose_name)), 'color': 'green', 'text_color': 'white', 'cabecera': True}, … … 3079 3079 3080 3080 return {'fields': fields, 'output': nombre_archivo} 3081 3082 def gestion_process(self, file, user, *args, **kwargs): 3083 """! 3084 Método que permite cargar y gestionar datos 3085 3086 @author Rodrigo boet (rboet at cenditel.gob.ve) 3087 @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a> 3088 @date 09-06-2017 3089 @param self <b>{object}</b> Objeto que instancia la clase 3090 @param file <b>{string}</b> Ruta y nombre del archivo a gestionar 3091 @param user <b>{object}</b> Objeto que contiene los datos del usuario que realiza la acción 3092 @param args <b>{tupla}</b> Tupla con argumentos opcionales 3093 @param kwargs <b>{dic}</b> Diccionario con filtros opcionales 3094 @return Devuelve el resultado de la acción con su correspondiente mensaje 3095 """ 3096 3097 load_file = pyexcel.get_sheet(file_name=file) 3098 anho_base, errors, result, message = '', '', True, '' 3099 load_data_msg = str(_("Datos Cargados")) 3100 3101 ## Se asigna un valor al dominio 3102 dominio = kwargs['dominio'] 3103 3104 for row in load_file.row[2:]: 3105 try: 3106 if(dominio=='BP'): 3107 pass 3108 """ 3109 cuenta_capital_base, created = CuentaCapitalBalanzaBase.objects.update_or_create( 3110 anho=row[1], 3111 trimestre=row[0])""" 3112 elif(dominio=='DE'): 3113 cuenta_capital_base, created = CuentaCapitalDeudaBase.objects.update_or_create( 3114 anho=row[0], 3115 trimestre=row[1]) 3116 3117 ## Se crean o actulizan los objetos de deuda capital e intereses del sector público 3118 CuentaCapitalDeudaCapital.objects.update_or_create(deuda=cuenta_capital_base,tipo="SPu",defaults={ 3119 'bono_pagare':row[2], 3120 'credito_comercial':row[3], 3121 'prestamo':row[4], 3122 'otros':row[5], 3123 }) 3124 3125 CuentaCapitalDeudaIntereses.objects.update_or_create(deuda=cuenta_capital_base,tipo="SPu",defaults={ 3126 'bono_pagare':row[6], 3127 'instrumento_mercado':row[7], 3128 'credito_comercial':row[8], 3129 'prestamo':row[9], 3130 'otros':row[10], 3131 }) 3132 3133 ## Se crean o actulizan los objetos de deuda capital e intereses del sector privado 3134 CuentaCapitalDeudaCapital.objects.update_or_create(deuda=cuenta_capital_base,tipo="SPr",defaults={ 3135 'bono_pagare':row[11], 3136 'credito_comercial':row[12], 3137 'prestamo':row[13], 3138 'otros':row[14], 3139 }) 3140 3141 CuentaCapitalDeudaIntereses.objects.update_or_create(deuda=cuenta_capital_base,tipo="SPr",defaults={ 3142 'bono_pagare':row[15], 3143 'instrumento_mercado':row[16], 3144 'credito_comercial':row[17], 3145 'prestamo':row[18], 3146 'otros':row[19], 3147 }) 3148 3149 except Exception as e: 3150 errors += "- %s\n" % str(e) 3151 3152 if errors: 3153 message = str(_("Error procesando datos. Verifique su correo para detalles del error")) 3154 load_data_msg = str(_("Error al procesar datos del área Económica - Externo")) 3155 3156 3157 # Envia correo electronico al usuario indicando el estatus de la carga de datos 3158 enviar_correo(user.email, 'gestion.informacion.load.mail', EMAIL_SUBJECT_LOAD_DATA, { 3159 'load_data_msg': load_data_msg, 'administrador': administrador, 'admin_email': admin_email, 3160 'errors': errors 3161 }) 3162 3163 return {'result': result, 'message': message} 3081 3164 3082 3165 @python_2_unicode_compatible … … 3196 3279 3197 3280 ## Tipo de dato de la inversión de cartera 3198 tipo = models.CharField(max_length= 2, choices=INVERSION_CARTERA)3281 tipo = models.CharField(max_length=4, choices=INVERSION_CARTERA) 3199 3282 3200 3283 ## Relación con el registro base de la cuenta capital … … 3255 3338 3256 3339 ## Tipo de dato de la inversión de cartera 3257 tipo = models.CharField(max_length= 2, choices=INVERSION_CARTERA)3340 tipo = models.CharField(max_length=4, choices=INVERSION_CARTERA) 3258 3341 3259 3342 ## Relación con el registro base de la cuenta capital … … 3312 3395 3313 3396 ## Tipo de dato de la deuda 3314 tipo = models.CharField(max_length= 2, choices=SECTOR_DEUDA)3397 tipo = models.CharField(max_length=3, choices=SECTOR_DEUDA) 3315 3398 3316 3399 ## Relación con el registro base de la cuenta capital (deuda) … … 3354 3437 3355 3438 ## Tipo de dato de la deuda 3356 tipo = models.CharField(max_length= 2, choices=SECTOR_DEUDA)3439 tipo = models.CharField(max_length=3, choices=SECTOR_DEUDA) 3357 3440 3358 3441 ## Relación con el registro base de la cuenta capital (deuda) -
static/js/functions.js
ra4b9db7 ra2ba7a6 81 81 82 82 /** 83 * @brief Funcion que permite mostrar los dominios indicados en84 * Balanza comercial85 * @param value Booleano para activar/desactivar el periodo86 */87 function enable_periodo_bc(value) {88 if (value) {89 disable('id_periodo_trimestre_ini',false);90 disable('id_periodo_trimestre_fin',false);91 disable('id_periodo_anho_ini',false);92 disable('id_periodo_anho_fin',false);93 }94 else{95 disable('id_periodo_trimestre_ini');96 disable('id_periodo_trimestre_fin');97 disable('id_periodo_anho_ini');98 disable('id_periodo_anho_fin');99 }100 }101 102 /**103 83 * @brief Funcion que permite habilitar/deshabilitar elementos con su id 104 84 * @param element_id Cadena de texto con el id del elemento a mostrar u ocultar … … 137 117 138 118 /** 119 * @brief Funcion que permite mostrar los dominios indicados en 120 * Balanza comercial 121 * @param value Booleano para activar/desactivar el periodo 122 */ 123 function enable_periodo_bc(value) { 124 if (value) { 125 disable('id_periodo_trimestre_ini'); 126 disable('id_periodo_trimestre_fin'); 127 disable('id_periodo_anho_ini'); 128 disable('id_periodo_anho_fin'); 129 } 130 else{ 131 disable('id_periodo_trimestre_ini',true); 132 disable('id_periodo_trimestre_fin',true); 133 disable('id_periodo_anho_ini',true); 134 disable('id_periodo_anho_fin',true); 135 } 136 } 137 138 /** 139 139 * @brief Funcion que permite mostrar/ocultar y deshabilitar/habilitar 140 140 * los campos necesarios para la cuenta capital … … 169 169 } 170 170 } 171
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.