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);
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;
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);
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"));
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, "");
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;
/* 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;
}
}
werase(win);
wrefresh(win);
delwin(items);
+ delwin(subnota);
+ delwin(nota);
delwin(win);
}