X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/e12f7e6ef14af28c89e08f570e24c61493558731..774da16a7fe143971dddecd52bd88133e0d88155:/emufs_gui/facturas.c?ds=sidebyside diff --git a/emufs_gui/facturas.c b/emufs_gui/facturas.c index 00b5276..bbfcf20 100644 --- a/emufs_gui/facturas.c +++ b/emufs_gui/facturas.c @@ -215,12 +215,18 @@ t_LstFacturas *fact_cargar(const char *filename, int tipo, int tam_bloque) fact.procdoi = atof(prop); xmlFree(prop); prop = xml_get_prop(node, "NroRemito"); fact.numero_remito = atoi(prop); xmlFree(prop); - strcpy(fact.emision, prop = xml_get_prop(node, "FechaEmisión")); xmlFree(prop); - strcpy(fact.vencimiento, prop = xml_get_prop(node, "FechaVto")); xmlFree(prop); - strcpy(fact.estado, prop = xml_get_prop(node, "Estado")); xmlFree(prop); - strcpy(fact.fp, prop = xml_get_prop(node, "FP")); xmlFree(prop); - strcpy(fact.ctacte, prop = xml_get_prop(node, "NroCtaCte")); xmlFree(prop); - strcpy(fact.cheque, prop = xml_get_prop(node, "NroCheque")); xmlFree(prop); + strncpy(fact.emision, prop = xml_get_prop(node, "FechaEmisión"), 8); xmlFree(prop); + fact.emision[8] = '\0'; + strncpy(fact.vencimiento, prop = xml_get_prop(node, "FechaVto"), 8); xmlFree(prop); + fact.vencimiento[8] = '\0'; + strncpy(fact.estado, prop = xml_get_prop(node, "Estado"), 2); xmlFree(prop); + fact.estado[2] = '\0'; + strncpy(fact.fp, prop = xml_get_prop(node, "FP"), 2); xmlFree(prop); + fact.fp[2] = '\0'; + strncpy(fact.ctacte, prop = xml_get_prop(node, "NroCtaCte"), 5); xmlFree(prop); + fact.ctacte[5] = '\0'; + strncpy(fact.cheque, prop = xml_get_prop(node, "NroCheque"), 18); xmlFree(prop); + fact.cheque[18] = '\0'; fact.nota = leer_nota(node); fact.items = leer_items(node, &fact.cant_items, ((tipo-1)==T3)?10:-1); @@ -472,8 +478,8 @@ void fact_modificar(char *s) void fact_agregar(char *s) { - WINDOW *win, *items; - t_Form *form; + WINDOW *win, *items, *nota, *subnota; + t_Form *form, *form_nota; t_Item *its = NULL; t_Factura fact; EMUFS_REG_SIZE size; @@ -489,6 +495,11 @@ void fact_agregar(char *s) wrefresh(win); items = derwin(win, LINES-20, COLS-4, 15, 1); + nota = derwin(win, 9, COLS-62, 1, 56); + subnota = derwin(nota, 7, COLS-64, 1, 1); + box(nota, 0, 0); + mvwaddstr(nota, 0, 1, "Nota :"); + wrefresh(nota); wrefresh(items); form = form_crear(win); @@ -504,6 +515,10 @@ void fact_agregar(char *s) form_ejecutar(form, 1,1); + form_nota = form_crear(subnota); + form_agregar_widget(form_nota, INPUT, "", 255, ""); + form_ejecutar(form_nota, 0, 0); + fact.numero = form_obtener_valor_int(form, "Numero de Factura"); strcpy(fact.emision, form_obtener_valor_char(form, "Fecha Emision")); strcpy(fact.vencimiento, form_obtener_valor_char(form, "Fecha Vto")); @@ -515,6 +530,7 @@ void fact_agregar(char *s) strcpy(fact.cheque, form_obtener_valor_char(form, "Cheque Nro")); form_destruir(form); + form_destruir(form_nota); form = form_crear(win); form_agregar_widget(form, INPUT, "Nro de Articulo (* == fin)", 8, ""); @@ -533,7 +549,7 @@ void fact_agregar(char *s) entrada = form_obtener_valor_char(form, "Nro de Articulo (* == fin)"); - if (entrada[0] != '\0') { + if ((entrada[0] != '\0') && (entrada[0] != '*')){ y_actual++; if (y_actual > LINES-22) { y_actual = LINES-22; @@ -546,16 +562,20 @@ void fact_agregar(char *s) /* Agrego el Item */ cant++; its = (t_Item *)realloc(its, cant*sizeof(t_Item)); - its[cant-1].numero = form_obtener_valor_int(form, entrada); + its[cant-1].numero = atoi(entrada); strcpy(its[cant-1].cv, form_obtener_valor_char(form, "CV")); strcpy(its[cant-1].pvu, form_obtener_valor_char(form, "PVU")); } - } while (strcmp(entrada, "*") != 0); + } while (entrada[0] != '*'); if (lst_facturas->fp->tipo == 3) { if (cant != 10) { /* TODO Limitar en la GUI en lugar de truncar! */ + fprintf(stderr, "Tengo %d\n", cant); its = (t_Item *)realloc(its, 10*sizeof(t_Item)); + fprintf(stderr, "Realoque ok\n"); + memset(its+sizeof(t_Item)*cant, 0, (10-cant)*sizeof(t_Item)); + fprintf(stderr, "Seteo a 0 sin priblemas\n"); cant = 10; } } @@ -578,6 +598,8 @@ void fact_agregar(char *s) werase(win); wrefresh(win); delwin(items); + delwin(subnota); + delwin(nota); delwin(win); }