#include #include #include #include #include #include #include #include #include "..\libs\make_bot\make_bot.h" #include "sv_graph.h" #include "sv_util.h" #include "sv_ref_x.h" #define Texto_Normal setcolor(63); #define Letra_Boton setcolor(1); #define Texto_Negrita setcolor(0); #define LIBRE 1 #define OCUPADO 0 #define NO_ENCONTRADO 0 #define ENCONTRADO 1 extern int x_raton, y_raton, raton; extern int boton_izq, boton_der; extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py); extern void textxy(int x, int y, char *text); extern int Espera_Tecla_o_Raton(void); extern void desactiva_raton(void); extern void activa_raton(void); extern void Anclar_Raton(void); extern void BEEP(void); extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo); extern int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row); extern int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row); void PutLineClientes(void); void GetLineClientes(void); void AddRecordClientes(void); void Menu_de_Clientes (void); void Imprimir_Clientes(void); void Edit_Item_Clientes(void); void Abre_Ficha_Clientes(void); void DeleteRecordClientes(void); void Mueva_Abajo_CClientes(void); void Mueva_Ariba_CClientes(void); void Anula_Compras_Cliente(void); //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ void Imprime_Ficha_Clientes(void); void Imprime_Extracto_Anual(void); //ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß void GetLineClientes_Compras(void); void CompruebaLineasClientes(void); void Coloca_Nombres_a_botones(void); void PrintWholeScreenClientes(void); void EditCursorClientes(int ShowHide); void Carga_Todos_los_Vendedores(void); void Abre_Ficha_Clientes_Compras(void); void Obten_Nombre_Vendedor( int Nvend ); void Abre_Ficha_Clientes_Ncontrato(void); void Current_Struct_to_Zero_Clientes(void); void PrintLineClientes(int Rapida_Completa); void Suma_Contrato_Activo_Vendedor( int Nvend ); void Borra_Contrato_Activo_Vendedor( int Nvend ); extern void Buscar_Cliente_Seccion_Compras(void); extern int Sigue_Buscando_CB(struct Clientes Clientes1_Buscar); extern int Comprueba_Impresora(void); extern void Abre_Ficha_Vendedores(void); extern void Abre_Ficha_Stock(void); struct Clientes_inx_NContrato { unsigned long Inicio; unsigned int Records; unsigned char Libre; }; struct Clientes_inx { char Ncontrato_ocupado_SN[10000]; unsigned int Fin; }; struct Clientes { int Address; char Nombre[15+1]; char Apellido1[15+1]; char Apellido2[15+1]; char DNI[15+1]; unsigned long Telefono1; char Calle1[30+1]; char Num1[5+1]; char Local[30+1]; unsigned long Telefono2; char Calle2[30+1]; char Num2[5+1]; char Poblacion[18+1]; char Provincia[16+1]; unsigned long CP; unsigned char GC; unsigned char MR; unsigned char SP; unsigned char DP; unsigned int MA; struct date Fecha; int Vend; int NContrato; }; // Se almacenan 1000 registros por archivo // En un caso extremo son: 9 bit ---> Espacio por Dato // 31 ---> Dias por mes // 2 ---> Productos por d¡a // 12 ---> 12 meses // 1000 ---> Clientes // struct Clientes_compras { // C UU VEN REF struct date Fecha; // 1 99 999 9999 unsigned long Cod_Und_Vend_Ref; }; /*extern*/ struct Vend_inx { unsigned int Fin; }; /*extern*/ struct Vendedores { int Num_V; char Nombre[15+1]; char Apellido1[15+1]; char Apellido2[15+1]; char DNI[15+1]; unsigned long Telefono1; unsigned long Telefono2; char Calle[30+1]; char Num[3+1]; char Piso[3+1]; char Poblacion[18+1]; char Provincia[16+1]; unsigned long CP; unsigned long CC; unsigned int PP; unsigned int Cr; }; extern struct JD cabecera; struct Clientes Clientes1; extern struct Clientes Clientes1_Buscar; struct Clientes_inx Clientes1_inx; struct Clientes_compras Clientes2; //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ struct Clientes_inx_NContrato Clientes1_inx_NContrato; //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ //ÛÛÛÛÛÛÛÛ extern struct Vendedores Vend1; extern struct Vend_inx Vend1_inx; struct boton *PATLD; struct boton *PATLD_c; extern struct boton Comunes[9]; int oldCNI = -1; int *Vend_Dir; extern FILE *Vend; // Fichero Vendedores extern FILE *Stock; FILE *Clientes; // Fichero Clientes FILE *Clientes_C; // Fichero Clientes con las Compras. FILE *Clientes_NC; // Fichero Clientes con los n£meros de contrato activos. int CurrRow1_Clien, CurrRow2_Clien; int CurrCol1_Clien, CurrCol2_Clien; int CurrTopLine_Clien, CurrTopLine_Clien1; int SWAP_CLIEN = 1; extern int Comienzo_Busqueda; extern char Se_Puede_Buscar; extern int Buscador; //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û Ü Ü ÜÜÜ Ü Ü Ü Ü Ü ÜÜÜ Ü ÜÜÜ ÜÜÜ Ü Ü ÜÜÜÜÜ ÜÜÜ ÜÜÜ Û //Û ÛßÜßÛ Û ÛÛ Û Û Û Û ÜÜÜÜ Û Û Û Û ÛÛ Û Û Û Û Û //Û Û Û Ûß Û ÛÛ Û Û ÛßÛ ÛÜÜÛ Û Û Û Ûß Û ÛÛ Û Ûß ßßÜ Û //Û Û Û ÛÜÜ Û Û ÛÜÜÛ ÛÜÛ ÛÜÜÜ ÛÜÜ ÛÜÜ ÜÛÜ ÛÜÜ Û Û Û ÛÜÜ ÜÜÜß Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void Menu_de_Clientes (void) { int finished = 0, key, bpush; CurrRow1_Clien = 1; CurrCol1_Clien = 1; CurrRow2_Clien = 1; CurrCol2_Clien = 1; CurrTopLine_Clien = 1; CurrTopLine_Clien1 = 1; Buscador = 1; if( ( Vend_Dir = (int *) malloc( sizeof(int)*1024 ) ) == NULL ) { Confirma("Memoria insuficiente", "para crear tablas para", "Vend_Dir"); return ; } if( ( PATLD = (struct boton *) malloc( sizeof(struct boton)*24 ) ) == NULL ) { Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PATLD."); free(Vend_Dir); return ; } if( ( PATLD_c = (struct boton *) malloc( sizeof(struct boton)*7 ) ) == NULL ) { Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PATLD_c."); free(PATLD); free(Vend_Dir); return ; } //ÛÛÛÛÛÛÛÛ inicializa_raton_grafico(0, 0, 624, 464, 320, 240); //ÛÛÛÛÛÛÛÛ if(raton!=0) desactiva_raton(); cleardevice(); Dibuja_Pantalla_Altas_Todos_los_Datos(PATLD, PATLD_c); Fuente(SMALL_FONT, 5); Coloca_Nombres_a_botones(); Abre_Ficha_Clientes_Ncontrato(); Abre_Ficha_Clientes(); Abre_Ficha_Referencias(); Carga_Referencias(); Abre_Ficha_Vendedores(); Carga_Todos_los_Vendedores(); Abre_Ficha_Stock(); GetLineClientes(); Abre_Ficha_Clientes_Compras(); PrintLineClientes(0); Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); int oldCR1=0, oldCR2=0, oldCC1=0, oldCC2=0; do{ if(oldCR1!=CurrRow1_Clien || oldCC1!=CurrCol1_Clien || oldCR2!=CurrRow2_Clien || oldCC2!=CurrCol2_Clien ) EditCursorClientes(0); oldCR1 = CurrRow1_Clien; oldCC1 = CurrCol1_Clien; oldCR2 = CurrRow2_Clien; oldCC2 = CurrCol2_Clien; if(raton!=0) activa_raton(); Espera_Tecla_o_Raton(); if(raton!=0) desactiva_raton(); if(kbhit()){ EditCursorClientes(1); key = getch(); if( isprint(key) || isspace(key) ) { EditCursorClientes(0); if(key!=13) ungetch(key); Edit_Item_Clientes(); EditCursorClientes(0); } else if( key == 0 ) { switch( (key=getch()) ){ // Flecha Arriba case 72: if(!SWAP_CLIEN) Mueva_Ariba_CClientes(); else { if ( CurrTopLine_Clien1 + CurrRow1_Clien - 1 > 1 ){CurrRow1_Clien--; GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } } break; // Flecha Izquierda case 75: case 15: if(SWAP_CLIEN) { CurrCol1_Clien--; if ( CurrCol1_Clien<1 ) CurrCol1_Clien=22; } else { CurrCol2_Clien--; if ( CurrCol2_Clien < 1 ) CurrCol2_Clien=6; } break; // Flecha Derecha case 77: case 9: if(SWAP_CLIEN) { CurrCol1_Clien++; if ( CurrCol1_Clien>22 ) CurrCol1_Clien=1; } else { CurrCol2_Clien++; if ( CurrCol2_Clien > 6 ) CurrCol2_Clien=1; } break; // Flecha Abajo case 80: if(!SWAP_CLIEN) { Mueva_Abajo_CClientes(); } else { if ( CurrTopLine_Clien1 + CurrRow1_Clien - 2 < Clientes1_inx.Fin ){ CurrRow1_Clien++; GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } } break; // Buscar F2 case 60: Buscar_Cliente_Seccion_Compras(); //BuscarClientes(); break; // Buscar otra vez --> F3 case 61: if(Se_Puede_Buscar) { CurrTopLine_Clien1++; Comienzo_Busqueda = 1; if( Sigue_Buscando_CB(Clientes1_Buscar) == ENCONTRADO ) { GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } else { CurrTopLine_Clien1--; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, Comunes[7]); GetLineClientes(); } } break; // Imprimir Clientes (incluye men£ desplegable) F5 case 63: Imprimir_Clientes(); break; // SWAP_CLIEN (la parte de edici¢n) F6 case 64: if(SWAP_CLIEN){ SWAP_CLIEN=0; Fuente(SMALL_FONT, 4); GetLineClientes_Compras(); } else { SWAP_CLIEN=1; Fuente(SMALL_FONT, 5); } EditCursorClientes(0); break; // F9 --> A¥ADIR case 67: if(SWAP_CLIEN) if( Confirma("¨ Dar de ALTA a un", "nuevo CLIENTE ?", "") ){ AddRecordClientes(); for(int i=0; i<6; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD_c[i]); PrintLineClientes(0); } break; // F10 -> BORRAR case 68: if(SWAP_CLIEN) if( Confirma("Desea eliminar al", "Cliente Actual", "") ) { DeleteRecordClientes(); PrintLineClientes(0); for(int i=0; i<6; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD_c[i]); } break; // INICIO case 71: if(SWAP_CLIEN) CurrCol1_Clien = 1; else CurrCol2_Clien = 1; break; // FIN case 79: if(SWAP_CLIEN) CurrCol1_Clien = 4; else CurrCol2_Clien = 14; break; // ReP g case 73: // CurrRow = 1; if(SWAP_CLIEN) { if( CurrTopLine_Clien1 + CurrRow1_Clien > 11 ) { CurrTopLine_Clien1 -= 11; } else { CurrTopLine_Clien1 = 1; CurrRow1_Clien = 1;} if( CurrTopLine_Clien1 + CurrRow1_Clien< 1 ) { CurrTopLine_Clien1 = 1; CurrRow1_Clien = 1;} PrintWholeScreenClientes(); GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } break; // AvP g case 81: // CurrRow = 1; if(SWAP_CLIEN) { CurrTopLine_Clien1 += 11; if ( (CurrTopLine_Clien1+CurrRow1_Clien-1) > Clientes1_inx.Fin) { CurrTopLine_Clien1 = Clientes1_inx.Fin; CurrRow1_Clien = 1; } if (CurrTopLine_Clien1==0) CurrTopLine_Clien1 = 1; PrintWholeScreenClientes(); GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } break; // Salir F1 case 59: finished = 1; break; default: break; } EditCursorClientes(0); } } else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) ) if( (bpush = CheckButon( 9, Comunes))>0 ) { EditCursorClientes(1); switch(bpush){ // Flecha Arriba case 1: if(!SWAP_CLIEN) Mueva_Ariba_CClientes(); else { if ( CurrTopLine_Clien1 + CurrRow1_Clien > 1 ){CurrRow1_Clien--; GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } } break; // Buscar case 2: Buscar_Cliente_Seccion_Compras(); //BuscarClientes(); break; // Flecha Abajo case 3: if(!SWAP_CLIEN) Mueva_Abajo_CClientes(); else { if ( CurrTopLine_Clien1 + CurrRow1_Clien - 1 < Clientes1_inx.Fin ){ CurrRow1_Clien++; GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } } break; case 4: if(SWAP_CLIEN){ SWAP_CLIEN=0; Fuente(SMALL_FONT, 4); GetLineClientes_Compras();} else { SWAP_CLIEN=1; Fuente(SMALL_FONT, 5); } EditCursorClientes(0); break; // Imprimir case 5: Imprimir_Clientes(); break; // A¤adir case 6: if(SWAP_CLIEN) if( Confirma("¨ Dar de ALTA a un", "nuevo CLIENTE ?", "") ) { AddRecordClientes(); for(int i=0; i<6; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD_c[i]); PrintLineClientes(0); } break; // Borrar case 7: if(SWAP_CLIEN) if( Confirma("Desea eliminar al", "Cliente Actual", "") ) { DeleteRecordClientes(); for(int i=0; i<6; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD_c[i]); PrintLineClientes(0); } break; // Buscar otra vez --> F3 case 8: if(Se_Puede_Buscar) { CurrTopLine_Clien1++; Comienzo_Busqueda = 1; if( Sigue_Buscando_CB(Clientes1_Buscar) == ENCONTRADO ) { GetLineClientes(); if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){ oldCNI = ( (Clientes1.Address) / 100/*0*/ ); fclose(Clientes_C); Abre_Ficha_Clientes_Compras(); } Fuente(SMALL_FONT, 4); PrintWholeScreenClientes(); Fuente(SMALL_FONT, 5); PrintLineClientes(0); } else { CurrTopLine_Clien1--; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, Comunes[7]); GetLineClientes(); } } break; // Salir case 9: finished = 1; break; default: break; } EditCursorClientes(0); } else CompruebaLineasClientes(); }while(!finished); rewind(Clientes); fseek(Clientes, (long)sizeof(struct JD), SEEK_SET); fwrite(&Clientes1_inx, sizeof(struct Clientes_inx), 1, Clientes); // Acualiza n§ de registros fclose(Clientes); // Fichero Clientes fclose(Clientes_NC); // Fichero Clientes Indice fclose(Clientes_C); // Fichero Clientes Compras fclose(Stock); /*//þþþþþþ*/ fclose(Vend); // Fichero Clientes fclose(Ref); // Fichero Vendedores if(Memory_ok==1) farfree(Addr); else free(Ref_inx_addr); free(PATLD); free(PATLD_c); free(Vend_Dir); } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û ÜÜÜ ÜÜ Ü Ü ÜÜÜÜÜ ÜÜ Ü Ü ÜÜ Û //Û Û Û Û Û ÛÛ Û Û Û Û Û Û Û Û Û //Û Ûßß ÛßßÛ Û ÛÛ Û ÛßßÛ Û Û ÛßßÛ Û //Û Û Û Û Û Û Û Û Û ÛÜÜ ÛÜÜ Û Û Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void Mueva_Abajo_CClientes(void){ int CurrRecord = CurrTopLine_Clien + CurrRow2_Clien - 1; if (CurrRow2_Clien==15) { if ( (CurrRecord - 1) >= Clientes1_inx_NContrato/*[Clientes1.NContrato]*/.Records - 1) BEEP(); else { CurrTopLine_Clien++; PrintWholeScreenClientes(); GetLineClientes_Compras(); PrintLineClientes(1); } } else { if( (CurrRecord - 1) >= Clientes1_inx_NContrato/*[Clientes1.NContrato]*/.Records-1) BEEP(); else { CurrRow2_Clien++; GetLineClientes_Compras(); PrintLineClientes(1); } } } void Mueva_Ariba_CClientes(void){ int CurrRecord = CurrTopLine_Clien + CurrRow2_Clien - 1; if (CurrRow2_Clien==1) { if ((CurrRecord - 1) <= 0) BEEP(); else { CurrTopLine_Clien--; PrintWholeScreenClientes(); GetLineClientes_Compras(); PrintLineClientes(1); } } else { if( (CurrRecord - 1) <= 0) BEEP(); else { CurrRow2_Clien--; GetLineClientes_Compras(); PrintLineClientes(1); } } } void EditCursorClientes(int ShowHide) { char Buffer[80]; int MR; setcolor(GRIS_C); setfillstyle(SOLID_FILL, GRIS_C); bar(10, 455, 545, 473); if(SWAP_CLIEN==1) { if (!ShowHide) { ImprimeBoton (0, GRIS_C, ROJO, ROJO, PATLD[CurrCol1_Clien-1]); setcolor(63); setfillstyle(SOLID_FILL, 63); bar(PATLD[CurrCol1_Clien-1].left+2, PATLD[CurrCol1_Clien-1].up+2, PATLD[CurrCol1_Clien-1].right-2, PATLD[CurrCol1_Clien-1].down-2); setcolor(0); } else { ImprimeBoton (0, GRIS_C, GRIS_O, BLANCO, PATLD[CurrCol1_Clien-1]); setcolor(0); setfillstyle(SOLID_FILL, 0); bar(PATLD[CurrCol1_Clien-1].left+2, PATLD[CurrCol1_Clien-1].up+2, PATLD[CurrCol1_Clien-1].right-2, PATLD[CurrCol1_Clien-1].down-2); Texto_Normal } Fuente(SMALL_FONT, 5); switch(CurrCol1_Clien) { case 1: outtextxy( PATLD[0].left+2, PATLD[0].up+2, Clientes1.Nombre ); outtextxy( 15, 455, "Nombre del Cliente. 15 digitos maximo."); break; case 2: outtextxy( PATLD[1].left+2, PATLD[1].up+2, Clientes1.Apellido1 ); outtextxy( 15, 455, "1er. Apellido. 15 digitos m ximo."); break; case 3: outtextxy( PATLD[2].left+2, PATLD[2].up+2, Clientes1.Apellido2 ); outtextxy( 15, 455, "2§ Apellido. 15 digitos m ximo."); break; case 4: outtextxy( PATLD[3].left+2, PATLD[3].up+2, Clientes1.DNI ); outtextxy( 15, 455, "D.N.I. del Cliente. 15 digitos m ximo."); break; case 5: sprintf(Buffer, "%ld", Clientes1.Telefono1); outtextxy( PATLD[4].left+2, PATLD[4].up+2, Buffer ); outtextxy( 15, 455, "Telefono Particular. 12 digitos m ximo."); break; case 6: outtextxy( PATLD[5].left+2, PATLD[5].up+2, Clientes1.Calle1 ); outtextxy( 15, 455, "Calle. (del Cliente). 30 digitos m ximo."); break; case 7: outtextxy( PATLD[6].left+2, PATLD[6].up+2, Clientes1.Num1 ); outtextxy( 15, 455, "N£mero. 5 digitos m ximo."); break; case 8: outtextxy( PATLD[7].left+2, PATLD[7].up+2, Clientes1.Local ); outtextxy( 15, 455, "Nombre del Local. 30 digitos m ximo."); break; case 9: sprintf(Buffer, "%ld", Clientes1.Telefono2); outtextxy( PATLD[8].left+2, PATLD[8].up+2, Buffer ); outtextxy( 15, 455, "Tel‚fono del Local. 12 digitos m ximo."); break; case 10:outtextxy( PATLD[9].left+2, PATLD[9].up+2, Clientes1.Calle2 ); outtextxy( 15, 455, "Calle del Local. 30 digitos m ximo."); break; case 11:outtextxy( PATLD[10].left+2, PATLD[10].up+2, Clientes1.Num2 ); outtextxy( 15, 455, "N£mero. 5 digitos m ximo."); break; case 12:outtextxy( PATLD[11].left+2, PATLD[11].up+2, Clientes1.Poblacion); outtextxy( 15, 455, "Poblaci¢n. 18 digitos m ximo."); break; case 13:outtextxy( PATLD[12].left+2, PATLD[12].up+2, Clientes1.Provincia); outtextxy( 15, 455, "Provincia. 16 digitos m ximo."); break; case 14:sprintf(Buffer, "%lu", Clientes1.CP); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ // sprintf(Buffer, "%d", Clientes1.Address); // int Libre = Clientes1_inx_NContrato.Libre; // sprintf(Buffer, "%d", Libre); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ outtextxy( PATLD[13].left+2, PATLD[13].up+2, Buffer ); outtextxy( 15, 455, "C¢digo Postal. 5 digitos maximo."); break; case 15:int GC = Clientes1.GC; Fuente(SMALL_FONT, 4); sprintf(Buffer, "% 2d", GC); outtextxy( PATLD[14].left+2, PATLD[14].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Grifos / Columnas. 2 digitos maximo."); break; case 16: MR = Clientes1.MR; Fuente(SMALL_FONT, 4); sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[15].left+2, PATLD[15].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Manoreductor/es. 2 digitos maximo."); break; case 17: MR = Clientes1.SP; Fuente(SMALL_FONT, 4); sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[16].left+2, PATLD[16].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Serpent¡n/es. 2 digitos maximo."); break; case 18: MR = Clientes1.DP; Fuente(SMALL_FONT, 4); sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[17].left+2, PATLD[17].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Dispensadores. 2 digitos maximo."); break; case 19: MR = Clientes1.MA; Fuente(SMALL_FONT, 4); sprintf(Buffer, "% 5d", MR); outtextxy( PATLD[18].left+2, PATLD[18].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Material Auxiliar. 5 digitos maximo."); break; case 20:int day, mon; Fuente(SMALL_FONT, 4); day= Clientes1.Fecha.da_day; mon= Clientes1.Fecha.da_mon; sprintf(Buffer, "%02d/%02d/%02d", day, mon, Clientes1.Fecha.da_year ); outtextxy( PATLD[19].left+2, PATLD[19].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "Fecha 6 digitos maximo."); break; case 21:sprintf(Buffer, "% 3d", Clientes1.NContrato); outtextxy( PATLD[20].left+2, PATLD[20].up+2, Buffer ); outtextxy( 15, 455, "N£mero de Contrato. 4 digitos maximo."); break; case 22:sprintf(Buffer, "% 3d", Clientes1.Vend); Fuente(SMALL_FONT, 4); outtextxy( PATLD[21].left+2, PATLD[21].up+2, Buffer ); Fuente(SMALL_FONT, 5); outtextxy( 15, 455, "N£mero de Vendedor. 3 digitos maximo."); break; } } else { if (!ShowHide) { setcolor(63); setfillstyle(SOLID_FILL, 63); if( Clientes2.Fecha.da_day == 0 ) CurrCol2_Clien = 1; bar((PATLD_c[(CurrCol2_Clien)-1].left+2), PATLD_c[(CurrCol2_Clien)-1].up+(CurrRow2_Clien-1)*12+2, PATLD_c[(CurrCol2_Clien)-1].right-2, PATLD_c[(CurrCol2_Clien)-1].up+4+((CurrRow2_Clien)-1)*12+10); setcolor(0); } else { setcolor(0); setfillstyle(SOLID_FILL, 0); if( Clientes2.Fecha.da_day == 0 ) CurrCol2_Clien = 1; bar((PATLD_c[(CurrCol2_Clien)-1].left+2), PATLD_c[(CurrCol2_Clien)-1].up+(CurrRow2_Clien-1)*12+2, PATLD_c[(CurrCol2_Clien)-1].right-2, PATLD_c[(CurrCol2_Clien)-1].up+4+((CurrRow2_Clien)-1)*12+10); Texto_Normal } Fuente(SMALL_FONT, 4); int Ref; if( Clientes2.Fecha.da_day != 0 ){ switch(CurrCol2_Clien){ case 1: int day, mon; day= Clientes2.Fecha.da_day; mon= Clientes2.Fecha.da_mon; sprintf(Buffer, "%02d/%02d/%02d", day, mon, Clientes2.Fecha.da_year ); outtextxy( PATLD_c[0].left+2, (PATLD_c[0].up+3)+(CurrRow2_Clien-1)*12, Buffer ); outtextxy( 15, 455, "Fecha. 6 digitos m ximo."); break; case 2: // 1 99 999 XXXX Ref = ( Clientes2.Cod_Und_Vend_Ref - ((Clientes2.Cod_Und_Vend_Ref/10000)*10000) ); sprintf(Buffer, " %04d", Ref); outtextxy( PATLD_c[1].left+2, (PATLD_c[1].up+2)+(CurrRow2_Clien-1)*12, Buffer ); outtextxy( 15, 455, "Referencia del Producto. 4 digitos m ximo."); break; case 3: outtextxy( PATLD_c[2].left+2, (PATLD_c[2].up+2)+(CurrRow2_Clien-1)*12, Ref1.Concepto ); outtextxy( 15, 455, "Concepto. 15 digitos m ximo."); break; case 4: // 1 XX 999 9999 Ref = ( ( Clientes2.Cod_Und_Vend_Ref/10000000L ) - ( ( (Clientes2.Cod_Und_Vend_Ref/10000000L)/100)*100 ) ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[3].left+2, (PATLD_c[3].up+2)+(CurrRow2_Clien-1)*12,Buffer ); outtextxy( 15, 455, "Unidades. 2 digitos m ximo."); break; case 5: // 1 99 XXX 9999 Ref = ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) - ( ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) / 1000) * 1000 ) ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[4].left+2, (PATLD_c[4].up+2)+(CurrRow2_Clien-1)*12,Buffer ); outtextxy( 15, 455, "Vendedor. 3 digitos m ximo."); break; case 6: // X 99 999 9999 Ref = ( Clientes2.Cod_Und_Vend_Ref/1000000000L ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[5].left+2, (PATLD_c[5].up+2)+(CurrRow2_Clien-1)*12,Buffer ); outtextxy( 15, 455, "C¢digo. 1 digitos m ximo."); break; } } else { if (ShowHide) setcolor(EGA_YELLOW); int mon; mon= Clientes2.Fecha.da_mon; sprintf(Buffer, "%02d -- %02d", mon, Clientes2.Fecha.da_year ); outtextxy( PATLD_c[0].left+2, (PATLD_c[0].up+3)+(CurrRow2_Clien-1)*12, Buffer ); } } } void PrintLineClientes(int Rapida_Completa){ char Buffer[80]; if(!Rapida_Completa) { // Completa for(int i=0; i<23; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD[i]); Texto_Normal Fuente(SMALL_FONT, 5); outtextxy( PATLD[0].left+2, PATLD[0].up+2, Clientes1.Nombre ); outtextxy( PATLD[1].left+2, PATLD[1].up+2, Clientes1.Apellido1 ); outtextxy( PATLD[2].left+2, PATLD[2].up+2, Clientes1.Apellido2 ); outtextxy( PATLD[3].left+2, PATLD[3].up+2, Clientes1.DNI ); sprintf(Buffer, "%ld", Clientes1.Telefono1); outtextxy( PATLD[4].left+2, PATLD[4].up+2, Buffer ); outtextxy( PATLD[5].left+2, PATLD[5].up+2, Clientes1.Calle1 ); outtextxy( PATLD[6].left+2, PATLD[6].up+2, Clientes1.Num1 ); outtextxy( PATLD[7].left+2, PATLD[7].up+2, Clientes1.Local ); sprintf(Buffer, "%ld", Clientes1.Telefono2); outtextxy( PATLD[8].left+2, PATLD[8].up+2, Buffer ); outtextxy( PATLD[9].left+2, PATLD[9].up+2, Clientes1.Calle2 ); outtextxy( PATLD[10].left+2, PATLD[10].up+2, Clientes1.Num2 ); outtextxy( PATLD[11].left+2, PATLD[11].up+2, Clientes1.Poblacion); outtextxy( PATLD[12].left+2, PATLD[12].up+2, Clientes1.Provincia); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ // sprintf(Buffer, "%d", Clientes1.Address); // int Libre = Clientes1_inx_NContrato.Libre; // sprintf(Buffer, "%d", Libre); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ sprintf(Buffer, "%lu", Clientes1.CP); outtextxy( PATLD[13].left+2, PATLD[13].up+2, Buffer ); Fuente(SMALL_FONT, 4); int GC = Clientes1.GC; sprintf(Buffer, "% 2d", GC); outtextxy( PATLD[14].left+2, PATLD[14].up+2, Buffer ); int MR = Clientes1.MR; sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[15].left+2, PATLD[15].up+2, Buffer ); MR = Clientes1.SP; sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[16].left+2, PATLD[16].up+2, Buffer ); MR = Clientes1.DP; sprintf(Buffer, "% 2d", MR); outtextxy( PATLD[17].left+2, PATLD[17].up+2, Buffer ); MR = Clientes1.MA; sprintf(Buffer, "% 5d", MR); outtextxy( PATLD[18].left+2, PATLD[18].up+2, Buffer ); int day, mon; day= Clientes1.Fecha.da_day; mon= Clientes1.Fecha.da_mon; sprintf(Buffer, "%02d/%02d/%02d", day, mon, Clientes1.Fecha.da_year ); outtextxy( PATLD[19].left+2, PATLD[19].up+2, Buffer ); sprintf(Buffer, "% 3d", Clientes1.Vend); outtextxy( PATLD[21].left+2, PATLD[21].up+2, Buffer ); sprintf(Buffer, " %15s", Vend1.Nombre); outtextxy( PATLD[22].left+2, PATLD[22].up+2, Buffer ); Fuente(SMALL_FONT, 5); sprintf(Buffer, "% 3d", Clientes1.NContrato); outtextxy( PATLD[20].left+2, PATLD[20].up+2, Buffer ); } else { // Rapida Texto_Normal Fuente(SMALL_FONT, 4); if( Clientes2.Fecha.da_day != 0 ){ int day, mon; day= Clientes2.Fecha.da_day; mon= Clientes2.Fecha.da_mon; sprintf(Buffer, "%02d/%02d/%02d", day, mon, Clientes2.Fecha.da_year ); outtextxy( PATLD_c[0].left+2, (PATLD_c[0].up+3)+(CurrRow2_Clien-1)*12, Buffer ); // 1 99 999 XXXX int Ref = ( Clientes2.Cod_Und_Vend_Ref - ((Clientes2.Cod_Und_Vend_Ref/10000)*10000) ); sprintf(Buffer, " %04d", Ref); outtextxy( PATLD_c[1].left+2, (PATLD_c[1].up+2)+(CurrRow2_Clien-1)*12, Buffer ); outtextxy( PATLD_c[2].left+2, (PATLD_c[2].up+2)+(CurrRow2_Clien-1)*12, Ref1.Concepto ); // 1 XX 999 9999 Ref = ( ( Clientes2.Cod_Und_Vend_Ref/10000000L ) - ( ( (Clientes2.Cod_Und_Vend_Ref/10000000L)/100)*100 ) ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[3].left+2, (PATLD_c[3].up+2)+(CurrRow2_Clien-1)*12,Buffer ); // 1 99 XXX 9999 Ref = ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) - ( ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) / 1000) * 1000 ) ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[4].left+2, (PATLD_c[4].up+2)+(CurrRow2_Clien-1)*12,Buffer ); // X 99 999 9999 Ref = ( Clientes2.Cod_Und_Vend_Ref/1000000000L ); sprintf(Buffer, "% 2d", Ref); outtextxy( PATLD_c[5].left+2, (PATLD_c[5].up+2)+(CurrRow2_Clien-1)*12,Buffer ); }else{ setcolor(EGA_YELLOW); int mon; mon= Clientes2.Fecha.da_mon; sprintf(Buffer, "%02d -- %02d", mon, Clientes2.Fecha.da_year ); outtextxy( PATLD_c[0].left+2, (PATLD_c[0].up+3)+(CurrRow2_Clien-1)*12, Buffer ); } } } void PrintWholeScreenClientes(void){ int tmp = CurrRow2_Clien; for(int i=0; i<6; i++) ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD_c[i]); for(CurrRow2_Clien = 1; CurrRow2_Clien < (15+1); CurrRow2_Clien++) if ( (CurrTopLine_Clien + CurrRow2_Clien - 1) <= Clientes1_inx_NContrato.Records){ GetLineClientes_Compras(); PrintLineClientes(1); } CurrRow2_Clien = tmp; } void Edit_Item_Clientes(void){ char Buffer[80]; int MR; long Fecha; if(SWAP_CLIEN){ Fuente(SMALL_FONT, 5); switch (CurrCol1_Clien) { case 1: InputCadenaG( Clientes1.Nombre, 0, 15, 63, 57, PATLD[0]/*, CurrRow1_Clien-1*/); break; case 2: InputCadenaG( Clientes1.Apellido1, 0, 15, 63, 57, PATLD[1]/*, CurrRow1_Clien-1*/); break; case 3: InputCadenaG( Clientes1.Apellido2, 0, 15, 63, 57, PATLD[2]/*, CurrRow1_Clien-1*/); break; case 4: InputCadenaG( Clientes1.DNI, 0, 15, 63, 57, PATLD[3]/*, CurrRow1_Clien-1*/); break; case 5: sprintf(Buffer, "%ld", Clientes1.Telefono1); InputCadenaG( Buffer, 1, 9, 63, 57, PATLD[4]/*, CurrRow1_Clien-1*/); Clientes1.Telefono1 = atol(Buffer); break; case 6: InputCadenaG( Clientes1.Calle1, 0, 30, 63, 57, PATLD[5]/*, CurrRow1_Clien-1*/); break; case 7: InputCadenaG( Clientes1.Num1, 0, 5, 63, 57, PATLD[6]/*, CurrRow1_Clien-1*/); break; case 8: InputCadenaG( Clientes1.Local, 0, 30, 63, 57, PATLD[7]/*, CurrRow1_Clien-1*/); break; case 9: sprintf(Buffer, "%ld", Clientes1.Telefono2); InputCadenaG( Buffer, 1, 9, 63, 57, PATLD[8]/*, CurrRow1_Clien-1*/); Clientes1.Telefono2 = atol(Buffer); break; case 10:InputCadenaG( Clientes1.Calle2, 0, 30, 63, 57, PATLD[9]/*, CurrRow1_Clien-1*/); break; case 11:InputCadenaG( Clientes1.Num2, 0, 5, 63, 57, PATLD[10]/*, CurrRow1_Clien-1*/); break; case 12:InputCadenaG( Clientes1.Poblacion, 0, 18, 63, 57, PATLD[11]/*, CurrRow1_Clien-1*/); break; case 13:InputCadenaG( Clientes1.Provincia, 0, 16, 63, 57, PATLD[12]/*, CurrRow1_Clien-1*/); break; case 14: //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ // sprintf(Buffer, "%d", Clientes1.Address); // int Libre = Clientes1_inx_NContrato.Libre; // sprintf(Buffer, "%d", Libre); //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ sprintf(Buffer, "%lu", Clientes1.CP); InputCadenaG( Buffer, 1, 5, 63, 57, PATLD[13]/*, CurrRow1_Clien-1*/); Clientes1.CP = atol(Buffer); // Clientes1.Address = atol(Buffer); // Libre =atol(Buffer); // Clientes1_inx_NContrato.Libre = Libre; // fseek(Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*(Clientes1.Address), SEEK_SET); // fwrite( &Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); break; case 15:int GC = Clientes1.GC; Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", GC); InputCadenaG( Buffer, 1, 2, 63, 57, PATLD[14]/*, 0*/); Clientes1.GC = atoi(Buffer); if(GC != Clientes1.GC) Actualizar_Stock( 9996, (-1)*((Clientes1.GC)-GC), 1); Fuente(SMALL_FONT, 5); break; case 16:MR = Clientes1.MR; Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", MR); InputCadenaG( Buffer, 1, 2, 63, 57, PATLD[15]/*, CurrRow1_Clien-1*/); Clientes1.MR = atoi(Buffer); if(MR != Clientes1.MR) Actualizar_Stock( 9997, (-1)*((Clientes1.MR)-MR), 1); Fuente(SMALL_FONT, 5); break; case 17:MR = Clientes1.SP;Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", MR); InputCadenaG( Buffer, 1, 2, 63, 57, PATLD[16]/*, CurrRow1_Clien-1*/); Clientes1.SP = atoi(Buffer); if(MR != Clientes1.SP) Actualizar_Stock( 9998, (-1)*((Clientes1.SP)-MR), 1); Fuente(SMALL_FONT, 5); break; case 18:MR = Clientes1.DP;Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", MR); InputCadenaG( Buffer, 1, 2, 63, 57, PATLD[17]/*, CurrRow1_Clien-1*/); Clientes1.DP = atoi(Buffer); if(MR != Clientes1.SP) Actualizar_Stock( 9999, (-1)*((Clientes1.DP)-MR), 1); Fuente(SMALL_FONT, 5); break; case 19:MR = Clientes1.MA;Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", MR); InputCadenaG( Buffer, 1, 4, 63, 57, PATLD[18]/*, CurrRow1_Clien-1*/); Clientes1.MA = atoi(Buffer); Fuente(SMALL_FONT, 5); break; case 20:int day, mon; Fuente(SMALL_FONT, 4); day= Clientes1.Fecha.da_day; mon= Clientes1.Fecha.da_mon; sprintf(Buffer, "%02d%02d%02d", day, mon, Clientes1.Fecha.da_year ); do{ InputCadenaG( Buffer, 1, 6, 63, 57, PATLD[19]/*, CurrRow1_Clien-1*/); Fecha = atol(Buffer); Clientes1.Fecha.da_day = (Fecha/10000); Clientes1.Fecha.da_mon = (Fecha/100) - ((Clientes1.Fecha.da_day) * 100); Clientes1.Fecha.da_year = Fecha - ( (Clientes1.Fecha.da_day*10000) + (Clientes1.Fecha.da_mon*100) ); }while( ( Clientes1.Fecha.da_day<1 || Clientes1.Fecha.da_day>31 ) || (Clientes1.Fecha.da_mon<1 || Clientes1.Fecha.da_mon > 12) || strlen(Buffer)!=6 ); Fuente(SMALL_FONT, 5); break; case 21:sprintf(Buffer, "%d", Clientes1.NContrato); Clientes1_inx.Ncontrato_ocupado_SN[atoi(Buffer)]=0; do{ InputCadenaG( Buffer, 1, 4, 63, 57, PATLD[20]/*, CurrRow1_Clien-1*/); }while( Clientes1_inx.Ncontrato_ocupado_SN[atoi(Buffer)]==1 || atoi(Buffer) == 0); Clientes1_inx.Ncontrato_ocupado_SN[atoi(Buffer)]=1; Clientes1.NContrato = atoi(Buffer); break; case 22:int old_Vend = Clientes1.Vend; Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", Clientes1.Vend); do{ InputCadenaG( Buffer, 1, 3, 63, 57, PATLD[21]/*, CurrRow1_Clien-1*/); }while( Vend_Dir[atoi(Buffer)]==-1 ); Clientes1.Vend = atoi(Buffer); if( Clientes1.Vend != old_Vend ) { Borra_Contrato_Activo_Vendedor( old_Vend ); Suma_Contrato_Activo_Vendedor( Clientes1.Vend ); Obten_Nombre_Vendedor( Clientes1.Vend ); ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD[22]); setcolor(BLANCO); sprintf(Buffer, " %15s", Vend1.Nombre/*, Vend1.Apellido1*/); outtextxy( PATLD[22].left+2, PATLD[22].up+2, Buffer ); } Fuente(SMALL_FONT, 5); break; default: return; } PutLineClientes(); /*ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/ /*Û*/ GetLineClientes(); /*Û*/ /*ßßßßßßßßßßßßßßßßßßßßßßßßßß*/ } else { switch (CurrCol2_Clien) { case 1: while( kbhit() ) getch(); break; case 2: while( kbhit() ) getch(); break; case 3: while( kbhit() ) getch(); break; case 4: while( kbhit() ) getch(); break; case 5: while( kbhit() ) getch(); break; case 6: while( kbhit() ) getch(); break; default: while( kbhit() ) getch(); return; } PutLineClientes(); /*ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/ /*Û*/ GetLineClientes(); /*Û*/ /*ßßßßßßßßßßßßßßßßßßßßßßßßßß*/ PrintLineClientes(1); } } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û ÜÜ ÜÜÜ ÜÜÜ ÜÜÜ ÜÜÜÜÜ Ü Ü ÜÜÜ ÜÜ ÜÜÜ Û //Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û //Û ÛßßÛ Ûßß Ûß ÛßÛ Û Û Û ÛßÛ ÛßßÛ ßßÜ Û //Û Û Û Û ÛÜÜ Û Û Û ÛÜÜÛ Û Û Û Û ÜÜÜß Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void Abre_Ficha_Clientes(void){ char ArchivoDatos[]="Clientes.DAT"; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ// //Û Comprueba apertura correcta de Indice, y Datos y creaci¢n... Û// //ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß// int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); if ( (Clientes = fopen( ArchivoDatos, "r+b"))==NULL) { FILE *fa; int i; if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) { Current_Struct_to_Zero_Clientes(); Clientes1.Address = 0; Clientes1_inx.Fin = 0; for(i = 0; i<10000; i++) Clientes1_inx.Ncontrato_ocupado_SN[i] = 0; ///////////////////////////////////// ///////////////////////////////////// /*****/ Clientes1.Address = 0; /*****/ Clientes1_inx_NContrato.Libre = OCUPADO; /* 0 */ /*****/ fseek( Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*0, SEEK_SET); /*****/ fwrite( &Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); ///////////////////////////////////// ///////////////////////////////////// rewind(fa); fwrite(&cabecera, LSJ, 1, fa); fseek(fa, (long)LSJ, SEEK_SET); fwrite(&Clientes1_inx, LSI, 1, fa); fseek(fa, (long)LSJ+LSI, SEEK_SET); fwrite(&Clientes1, LSC, 1, fa); if (fclose(fa) == EOF ) exit(1); } if ( (Clientes = fopen( ArchivoDatos, "r+b"))==NULL) { restorecrtmode(); printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA"); printf("Clientes.dat"); exit(1); } } fseek(Clientes, (long)LSJ, SEEK_SET); if ( fread(&Clientes1_inx, LSI, 1, Clientes) != 1 ) { restorecrtmode(); printf("NO SE PUDO LEER EN EL FICHERO: INDICE"); exit(1); } fseek(Clientes, (long)LSJ+LSI, SEEK_SET); if ( fread(&Clientes1, LSC, 1, Clientes) != 1 ) { restorecrtmode(); printf("NO SE PUDO LEER EN EL FICHERO: DATOS"); exit(1); } } //ÛßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÛ// //Û Aqui es donde se guardan los contratos l¢gicos: 1,0 Ocupado, Libre Û// //ÛÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÛ// void Abre_Ficha_Clientes_Ncontrato(void){ char ArchivoDatos[]="C_INDICE.DAT"; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ// //Û Comprueba apertura correcta de Indice, y Datos y creaci¢n... Û// //ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß// int LSC = sizeof(struct Clientes_inx_NContrato), i; if ( (Clientes_NC = fopen( ArchivoDatos, "r+b"))==NULL) { FILE *fa; if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) { rewind(fa); int Td; Clientes1_inx_NContrato.Records = 12; for( Td = 0; Td < 100/*0*/; Td++) for(i = 0; i<100/*0*/; i++) { Clientes1_inx_NContrato.Inicio = i*12; Clientes1_inx_NContrato.Libre = LIBRE; /*1*/ fseek(fa, (long)LSC*(i+(100*Td)), SEEK_SET); fwrite(&Clientes1_inx_NContrato, LSC, 1, fa); } if (fclose(fa) == EOF ) exit(1); } if ( (Clientes_NC = fopen( ArchivoDatos, "r+b"))==NULL) { restorecrtmode(); printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA"); printf("C_indice.dat"); exit(1); } } rewind(Clientes_NC); if (fread(&Clientes1_inx_NContrato, LSC, 1, Clientes_NC) !=1 ){ restorecrtmode(); printf("NO SE PUDO LEER EN EL FICHERO: DATOS"); exit(1); } } //ÛßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÛ// //Û Aqui es donde estar n las compras realizadas por los clientes. Û// //ÛÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÛ// void Abre_Ficha_Clientes_Compras(void){ char ArchivoDatos[]="12345678.1237"; struct date Fecha; int mes; getdate(&Fecha); //þþþþþþþþþþþþþþþþþþ He decidido modificar el n£mero de clientes soportados //þþþþþþþþþþþþþþþþþþ en un solo archivo de 1000 a 100, para acelerar el //þþþþþþþþþþþþþþþþþþ proceso de actualizaciones... sprintf( ArchivoDatos, "SV_C%02d%02d.dat", ( (Clientes1.Address) / 100/*0*/ ), (Fecha.da_year - (Fecha.da_year/100)*100) ); //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ// //Û Comprueba apertura correcta de Indice, y Datos y creaci¢n... Û// //ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß// int LSC = sizeof(struct Clientes_compras), i; if ( (Clientes_C = fopen( ArchivoDatos, "r+b"))==NULL) { FILE *fa; if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) { Clientes2.Fecha.da_day = 0; Clientes2.Fecha.da_mon = 0; Clientes2.Fecha.da_year = (Fecha.da_year - (Fecha.da_year/100)*100); Clientes2.Cod_Und_Vend_Ref = 0; auto int suma = 0; //þþþþþþþþþþþþþþþþþþ for(i = 0; i<100/*0*/; i++) for(mes = 1; mes <= 12; mes++) { Clientes2.Fecha.da_mon = mes; fseek(fa, (long)LSC * suma, SEEK_SET); fwrite(&Clientes2, LSC, 1, fa); suma++; } if (fclose(fa) == EOF ) exit(1); } if ( (Clientes_C = fopen( ArchivoDatos, "r+b"))==NULL) { restorecrtmode(); printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA"); printf("%s", ArchivoDatos); exit(1); } } rewind(Clientes_C); if ( fread(&Clientes2, LSC, 1, Clientes_C) != 1 ) { restorecrtmode(); printf("NO SE PUDO LEER EN EL FICHERO: DATOS"); exit(1); } } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û ÜÜ ÜÜÜ ÜÜÜ Ü Ü ÜÜÜ Ü Ü ÜÜÜÜ Û //Û Û Û Û Û Û Û Û Û Û Û Û Û Û //Û ÛßßÛ ÛßÛ Û ÛßßÛ Û Û Û Û Û Û //Û Û Û Û Û ÛÜÜ Û Û ÜÛÜ ßÜß ÛÜÜÛ Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void DeleteRecordClientes(void) { unsigned int CurrRecord; int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); CurrRecord = CurrTopLine_Clien1 + CurrRow1_Clien - 1; if ( Clientes1_inx.Fin == 0 ) { Clientes1_inx.Ncontrato_ocupado_SN[Clientes1.NContrato] = 0; fseek(Clientes, (long)LSJ + LSI + ( LSC * ( CurrTopLine_Clien1 + CurrRow1_Clien - 1) ), SEEK_SET); // Se coloca fwrite(&Clientes1, LSC, 1, Clientes); // Y escribe Clientes1_inx_NContrato.Records = 12; Clientes1_inx_NContrato.Libre = OCUPADO;/*1*/ fseek( Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*Clientes1.Address, SEEK_SET); fwrite(&Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); Anula_Compras_Cliente(); Borra_Contrato_Activo_Vendedor( Clientes1.Vend ); Actualizar_Stock( 9996, (1)*(Clientes1.GC), 1); Actualizar_Stock( 9997, (1)*(Clientes1.MR), 1); Actualizar_Stock( 9998, (1)*(Clientes1.SP), 1); Actualizar_Stock( 9999, (1)*(Clientes1.DP), 1); Current_Struct_to_Zero_Clientes(); PutLineClientes(); PrintLineClientes(1); BEEP(); } else { Clientes1_inx.Fin -= 1; Clientes1_inx_NContrato.Records = 12; Clientes1_inx_NContrato.Libre = LIBRE;/*1*/ fseek( Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*Clientes1.Address, SEEK_SET); fwrite( &Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); Clientes1_inx.Ncontrato_ocupado_SN[Clientes1.NContrato] = 0; fseek(Clientes, (long)LSJ, SEEK_SET); // Se coloca fwrite(&Clientes1, LSI, 1, Clientes); // Y escribe Anula_Compras_Cliente(); Borra_Contrato_Activo_Vendedor( Clientes1.Vend ); Actualizar_Stock( 9996, (1)*(Clientes1.GC), 1); Actualizar_Stock( 9997, (1)*(Clientes1.MR), 1); Actualizar_Stock( 9998, (1)*(Clientes1.SP), 1); Actualizar_Stock( 9999, (1)*(Clientes1.DP), 1); CurrRecord = CurrTopLine_Clien1 + CurrRow1_Clien - 1; unsigned int p = CurrRecord - 1; while( p <= Clientes1_inx.Fin ) { fseek(Clientes, (long)LSJ + LSI + ( LSC * ( p + 1 ) ), SEEK_SET); // Se coloca fread(&Clientes1, LSC, 1, Clientes); // Y lee fseek(Clientes, (long)LSJ + LSI + ( LSC * p ), SEEK_SET); // Se coloca fwrite(&Clientes1, LSC, 1, Clientes); // Y escribe p++; }; fseek(Clientes, (long)LSJ, SEEK_SET); fwrite(&Clientes1_inx, LSI, 1, Clientes); // Acualiza n§ de registros // PrintWholeScreenClientes(); /* if ((CurrRecord - 1) == Clientes1_inx.Fin + 1)*/ CurrRow1_Clien--; if( Clientes1_inx.Fin == 0 ) CurrRow1_Clien = 1; while( CurrRow1_Clien + CurrTopLine_Clien1 < 1 ) CurrRow1_Clien ++; GetLineClientes(); PrintLineClientes(1); } } void AddRecordClientes(void){ unsigned int CurrRecord= CurrTopLine_Clien1 + CurrRow1_Clien - 1; int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); int ok = 0, i=0; if(CurrRecord < 10000 ) { long avance = Clientes1_inx.Fin; while( avance >= (CurrRecord-1) ) { fseek(Clientes, (long)LSJ + LSI + ( LSC * avance ), SEEK_SET); fread(&Clientes1, LSC, 1, Clientes); fseek(Clientes, (long)LSJ + LSI + ( LSC * (avance + 1) ), SEEK_SET); // Se coloca fwrite(&Clientes1, LSC, 1, Clientes); // Y escribe avance--; }; Clientes1_inx.Fin++; fseek(Clientes, (long)LSJ, SEEK_SET); fwrite(&Clientes1_inx, LSI, 1, Clientes); // Acualiza n§ de registros Current_Struct_to_Zero_Clientes(); avance = 0; ok =0; do{ fseek( Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*avance, SEEK_SET); fread( &Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); if( Clientes1_inx_NContrato.Libre == LIBRE) { ok = 1; Clientes1.Address = avance; Clientes1_inx_NContrato.Libre = OCUPADO; /* 0 */ fseek( Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*avance, SEEK_SET); fwrite( &Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato), 1, Clientes_NC); } avance++; }while( (avance<10000) && !ok); if( ok==0 ) Confirma("Error buscando un", "hueco para indexar la", "posisi¢n de COMPRAS."); ok = 0; do{ i++; if( Clientes1_inx.Ncontrato_ocupado_SN[i]==0 ) { Clientes1.NContrato = i; Clientes1_inx.Ncontrato_ocupado_SN[i]=1; ok = 1; } } while(!ok && i < 10000); fseek(Clientes, (long)LSJ, SEEK_SET); fwrite(&Clientes1_inx, LSI, 1, Clientes); // Acualiza n§ de registros fseek(Clientes, (long)LSJ + LSI + ( LSC * ( CurrTopLine_Clien1 + CurrRow1_Clien - 1) ), SEEK_SET); // Se coloca fwrite(&Clientes1, LSC, 1, Clientes); // Y escribe CurrRow1_Clien++; // if (CurrRow1_Clien>11) { CurrTopLine_Clien1++; CurrRow1_Clien--; } // PrintWholeScreenClientes(); GetLineClientes(); PrintLineClientes(1); } } void PutLineClientes(void){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); int CurrRecord = CurrTopLine_Clien1 + CurrRow1_Clien - 1; fseek(Clientes, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); fwrite(&Clientes1, LSC, 1, Clientes); } void GetLineClientes(void){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); int CurrRecord = CurrTopLine_Clien1 + CurrRow1_Clien - 1; fseek(Clientes, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); fread(&Clientes1, LSC, 1, Clientes); fseek(Clientes_NC, (long)sizeof(struct Clientes_inx_NContrato)*(Clientes1.Address), SEEK_SET); fread(&Clientes1_inx_NContrato, sizeof(struct Clientes_inx_NContrato),1, Clientes_NC); Obten_Nombre_Vendedor( Clientes1.Vend ); } void GetLineClientes_Compras(void){ int LSC = sizeof(struct Clientes_compras); long CurrRecord = CurrTopLine_Clien + CurrRow2_Clien - 1 + Clientes1_inx_NContrato.Inicio; fseek(Clientes_C, (long)( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca fread(&Clientes2, LSC, 1, Clientes_C); // Y lee BuscaReferencia(( Clientes2.Cod_Und_Vend_Ref - ((Clientes2.Cod_Und_Vend_Ref/10000)*10000) )); } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û Ü Ü ÜÜÜÜÜ ÜÜÜ Ü ÜÜÜ ÜÜ ÜÜ ÜÜ ÜÜÜ ÜÜÜ Û //Û Û Û Û Û Û Û Û ßÜ Û Û Û ßÜ Û Û Û //Û Û Û Û Û Û Û Û Û ÛßßÛ Û Û Ûß ßßÜ Û //Û ÛÜÜÛ Û ÜÛÜ ÛÜÜ ÜÛÜ ÛÜß Û Û ÛÜß ÛÜÜ ÜÜÜß Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void Current_Struct_to_Zero_Clientes(void){ cabecera.esc = 27; strcpy(cabecera.color, "[31;40m"); strcpy(cabecera.prog, "Jos‚ David Guill‚n Dominguez"); cabecera.nl = 13; cabecera.rt = 10; strcpy(cabecera.autor, " 31 / Abril / 1995 "); cabecera.pt = 7; cabecera.ef = 26; strcpy(Clientes1.Nombre, "\0"); strcpy(Clientes1.Apellido1, "\0"); strcpy(Clientes1.Apellido2, "\0"); strcpy(Clientes1.DNI, "\0"); Clientes1.Telefono1 = 0; strcpy(Clientes1.Calle1, "\0"); strcpy(Clientes1.Num1, "\0"); strcpy(Clientes1.Local, "\0"); Clientes1.Telefono2 = 0; strcpy(Clientes1.Calle2, "\0"); strcpy(Clientes1.Num2, "\0"); strcpy(Clientes1.Poblacion, "\0"); strcpy(Clientes1.Provincia, "\0"); Clientes1.CP =41; Clientes1.GC = 0; Clientes1.MR = 0; Clientes1.SP = 0; Clientes1.DP = 0; Clientes1.MA = 0; getdate(&Clientes1.Fecha); Clientes1.Fecha.da_year = ( Clientes1.Fecha.da_year - ( Clientes1.Fecha.da_year / 100 )* 100 ) ; Clientes1.Vend = 0; Clientes1.NContrato = 0; } void CompruebaLineasClientes(void){ // Check una pulsacion sobre un campo, y se situa, si es posible int inc=0; if( (inc = CheckButon_S( 23, 4, PATLD))>0 && (inc <=23) ) { EditCursorClientes(1); CurrCol1_Clien = (inc); } } //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ // // Esta Funci¢n cargar  todas las direcciones de los Vendedores. //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ void Carga_Todos_los_Vendedores(void){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Vend_inx); int LSC = sizeof(struct Vendedores); int i, Curr_Vend = 0; for (i=0; i<1000; i++) Vend_Dir[i]=-1; while(Curr_Vend <= Vend1_inx.Fin ){ fseek(Vend, (long)LSJ + LSI + ( LSC * Curr_Vend ), SEEK_SET); fread(&Vend1, LSC, 1, Vend); if(Vend1.Num_V>999) { Confirma("Error.", "Archivo Vendedores CORRUPTO", "Error."); exit(1); } Vend_Dir[Vend1.Num_V] = Curr_Vend; Curr_Vend++; } } void Borra_Contrato_Activo_Vendedor( int Nvend ){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Vend_inx); int LSC = sizeof(struct Vendedores); if( Vend_Dir[Nvend] != -1 ) { fseek(Vend, (long)LSJ + LSI + ( LSC * Vend_Dir[Nvend] ), SEEK_SET); // Se coloca fread(&Vend1, LSC, 1, Vend); Vend1.Cr--; fseek(Vend, (long)LSJ + LSI + ( LSC * Vend_Dir[Nvend] ), SEEK_SET); // Se coloca fwrite(&Vend1, LSC, 1, Vend); } } void Suma_Contrato_Activo_Vendedor( int Nvend ){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Vend_inx); int LSC = sizeof(struct Vendedores); if( Vend_Dir[Nvend] != -1 ) { fseek(Vend, (long)LSJ + LSI + ( LSC * Vend_Dir[Nvend] ), SEEK_SET); // Se coloca fread(&Vend1, LSC, 1, Vend); Vend1.Cr++; fseek(Vend, (long)LSJ + LSI + ( LSC * Vend_Dir[Nvend] ), SEEK_SET); // Se coloca fwrite(&Vend1, LSC, 1, Vend); } } void Obten_Nombre_Vendedor( int Nvend ){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Vend_inx); int LSC = sizeof(struct Vendedores); if( Vend_Dir[Nvend] != -1 ) { fseek(Vend, (long)LSJ + LSI + ( LSC * Vend_Dir[Nvend] ), SEEK_SET); // Se coloca fread(&Vend1, LSC, 1, Vend); } } //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //Û Û //Û ÜÜÜ Ü Ü ÜÜÜ ÜÜÜ ÜÜÜ ÜÜÜ ÜÜÜÜ ÜÜÜ ÜÜ Û //Û Û ÛßÜßÛ Û Û Û Û Û Û Û Û Û Û Û Û Û //Û Û Û Û Ûßß ÛßÛ Ûß ßßÜ Û Û ÛßÛ ÛßßÛ Û //Û ÜÛÜ Û Û Û Û Û ÛÜÜ ÜÜÜß ÛÜÜÛ Û Û Û Û Û //Û Û //ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ void Imprimir_Clientes(void){ int Where_Ask = 1; int fins_print= 0, key_print, bpush; void far *ptr; unsigned size; struct boton pregunta[3]; size = imagesize(198, 138, 372, 257); /* get byte size of image */ if ( (ptr = farmalloc(size)) != NULL) { getimage(198, 138, 372, 257, ptr); pregunta[0].up = 140; pregunta[0].down = 255; pregunta[0].left= 200; pregunta[0].right= 370; ImprimeBoton (1, ROJO, GRIS_C, BLANCO, pregunta[0]); pregunta[0].up = 150; pregunta[0].down = 175; pregunta[0].left= 210; pregunta[0].right= 360; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[0]); pregunta[1].up = 185; pregunta[1].down = 210; pregunta[1].left= 210; pregunta[1].right= 360; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[1]); pregunta[2].up = 220; pregunta[2].down = 245; pregunta[2].left= 210; pregunta[2].right= 360; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[2]); Fuente(SMALL_FONT, 4); } else { Where_Ask = 0; pregunta[0].up = 450; pregunta[0].down = 475; pregunta[0].left= 5; pregunta[0].right= 152; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[0]); pregunta[1].up = 450; pregunta[1].down = 475; pregunta[1].left= 155; pregunta[1].right= 309; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[1]); pregunta[2].up = 450; pregunta[2].down = 475; pregunta[2].left= 312; pregunta[2].right= 549; ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[2]); Fuente(SMALL_FONT, 4); } Letra_Boton outtextxy(pregunta[0].left+2, pregunta[0].up+2, "F3 Imprimir Ficha Actual"); outtextxy(pregunta[1].left+2, pregunta[1].up+2, "F2 Informe hasta la Fecha"); outtextxy(pregunta[2].left+2, pregunta[2].up+2, "F1 CANCELAR IMPRESION"); //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ do{ if(raton!=0) activa_raton(); Espera_Tecla_o_Raton(); if(raton!=0) desactiva_raton(); if(kbhit()){ key_print = getch(); if( key_print == 0 ) { switch( (key_print=getch()) ){ // F1 Cancelar case 59: fins_print = 1; break; // F3 Imprimir Ficha case 61: if(Where_Ask){ pregunta[0].up = 140; pregunta[0].down = 255; pregunta[0].left= 200; pregunta[0].right= 370; } else { pregunta[0].up = 450; pregunta[0].down = 475; pregunta[0].left= 5; pregunta[0].right= 549; } ImprimeBoton (1, GRIS_O, GRIS_C, BLANCO, pregunta[0]); //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ if( Comprueba_Impresora() ) { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Imprimiendo."); outtextxy(210,170, "Por Favor, espere..."); } else outtextxy(10,452, "Imprimiendo. Por Favor, espere..."); Imprime_Ficha_Clientes(); } else { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Impresora no preparada."); outtextxy(210,170, "Impresion Cancelada"); } else { outtextxy(10,452, "Impresora no preparada. Impresi¢n Cancelada."); } Espera_Tecla_o_Raton(); } fins_print = 1; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ break; // F2 Imprimir lista r pida case 60: if(Where_Ask){ pregunta[0].up = 140; pregunta[0].down = 255; pregunta[0].left= 200; pregunta[0].right= 370; } else { pregunta[0].up = 450; pregunta[0].down = 475; pregunta[0].left= 5; pregunta[0].right= 549; } ImprimeBoton (1, GRIS_O, GRIS_C, BLANCO, pregunta[0]); //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ if(Comprueba_Impresora()) { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Imprimiendo."); outtextxy(210,170, "Por Favor, espere..."); } else outtextxy(10,452, "Imprimiendo. Por Favor, espere..."); // Imprime_Lista_Rapida(); } else { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Impresora no preparada."); outtextxy(210,170, "Impresion Cancelada"); } else { outtextxy(10,452, "Impresora no preparada. Impresi¢n Cancelada."); } Espera_Tecla_o_Raton(); } fins_print = 1; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ break; default: fins_print = 1; } } } else if(raton!=0 && boton_izq==1 || boton_der==1) { if( (bpush = CheckButon( 3, pregunta))>0 ) { if(Where_Ask){ pregunta[0].up = 140; pregunta[0].down = 255; pregunta[0].left= 200; pregunta[0].right= 370; } else { pregunta[0].up = 450; pregunta[0].down = 475; pregunta[0].left= 5; pregunta[0].right= 549; } ImprimeBoton (1, GRIS_O, GRIS_C, BLANCO, pregunta[0]); switch(bpush){ // Imprimir Ficha case 1: //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ if(Comprueba_Impresora()) { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Imprimiendo."); outtextxy(210,170, "Por Favor, espere..."); } else outtextxy(10,452, "Imprimiendo. Por Favor, espere..."); Imprime_Ficha_Clientes(); } else { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Impresora no preparada."); outtextxy(210,170, "Impresion Cancelada"); } else { outtextxy(10,452, "Impresora no preparada. Impresi¢n Cancelada."); } Espera_Tecla_o_Raton(); } fins_print = 1; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ break; // Imprime Lista R pida case 2: //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ if(Comprueba_Impresora()) { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Imprimiendo."); outtextxy(210,170, "Por Favor, espere..."); } else outtextxy(10,452, "Imprimiendo. Por Favor, espere..."); // Imprime_Lista_Rapida(); } else { Letra_Boton if(Where_Ask){ outtextxy(210,150, "Impresora no preparada."); outtextxy(210,170, "Impresion Cancelada"); } else { outtextxy(10,452, "Impresora no preparada. Impresi¢n Cancelada."); } Espera_Tecla_o_Raton(); } fins_print = 1; //ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ break; // Cancelar case 3: fins_print=1; break; default: fins_print = 1; } } } }while(!fins_print); //ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß if(Where_Ask == 1) { putimage(198, 138, ptr, COPY_PUT); farfree(ptr); } else { struct boton help; help.up = 450; help.down = 475; help.left = 5; help.right = 549; ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, help); } } void Imprime_Ficha_Clientes(void){ int Buff; fprintf( stdprn, "\n\r"); fprintf( stdprn, "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n\r"); fprintf( stdprn, "³ N£mero de Contrato: % 4d ³\n\r", Clientes1.NContrato); fprintf( stdprn, "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Establecimiento: %-30s, Tlf. % 12ld\n\r", Clientes1.Local, Clientes1.Telefono2); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Calle, %s, %s\n\r", Clientes1.Calle2, Clientes1.Num2); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Poblacion: %18s Provincia: %16s C.P.: %ld\n\r", Clientes1.Poblacion, Clientes1.Provincia, Clientes1.CP); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Cliente: %s %s, %s \n\r", Clientes1.Apellido1, Clientes1.Apellido2, Clientes1.Nombre); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Tlf.: %12ld D.N.I: %15s \n\r", Clientes1.Telefono1, Clientes1.DNI); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Calle: %s, %s\n\r", Clientes1.Calle1, Clientes1.Num1); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); int Dia, Mes; Dia = Clientes1.Fecha.da_day; Mes = Clientes1.Fecha.da_mon; fprintf( stdprn, "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ Contrato Realizado el %2d/%2d/%2d \n\r", Dia, Mes, Clientes1.Fecha.da_year); fprintf( stdprn, "³ Materiales ³\n\r"); fprintf( stdprn, "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ por el Vendedor n§ % 3d\n\r", Clientes1.Vend); fprintf( stdprn, "³ ³\n\r"); Buff = Clientes1.GC ; fprintf( stdprn, "³ Grifo(s) / Columna(s) %02d ³ %s %s\n\r", Buff, Vend1.Nombre, Vend1.Apellido1); fprintf( stdprn, "³ ³\n\r"); Buff = Clientes1.MR; fprintf( stdprn, "³ Manoreductor(es) %02d ³\n\r", Buff); fprintf( stdprn, "³ ³\n\r"); Buff = Clientes1.SP; fprintf( stdprn, "³ Serpent¡n(es) %02d ³\n\r", Buff); fprintf( stdprn, "³ ³\n\r"); Buff = Clientes1.DP; fprintf( stdprn, "³ Dispensador(es) %02d ³\n\r", Buff); fprintf( stdprn, "³ ³\n\r"); fprintf( stdprn, "³ ³\n\r"); fprintf( stdprn, "³ ³\n\r"); fprintf( stdprn, "³ MATERIAL AUXILIAR % 5d ³\n\r", Clientes1.MA); fprintf( stdprn, "³ ³\n\r"); fprintf( stdprn, "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "Notas: _______________________________________________________________________________\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "________________________________________________________________________________________\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "________________________________________________________________________________________\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "________________________________________________________________________________________\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "________________________________________________________________________________________\n\r"); fprintf( stdprn, "\n\r"); fprintf( stdprn, "________________________________________________________________________________________\n\r"); fputc(12, stdprn); } /* void Imprime_Lista_Rapida(void){ int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); int lprint = 3; // 1 2 3 4 5 6 7 8 // 123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ int Curr_Clientes = 0; fprintf( stdprn, "\n\r"); fprintf( stdprn, " Num_V Nombre Apellido Tel‚fono Contratos Activos\n\r"); fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r"); while(Curr_Clientes <= Clientes1_inx.Fin ){ fseek(Clientes, (long)LSJ + LSI + ( LSC * Curr_Clientes ), SEEK_SET); // Se coloca fread(&Clientes1, LSC, 1, Clientes); // Y lee fprintf( stdprn, " %03d %-15s %-15s % 12ld % 12ld %04d\n\r", Clientes1.Vend, Clientes1.Nombre, Clientes1.Apellido1, Clientes1.Telefono1, Clientes1.Telefono2, Clientes1.CR); lprint++; if (lprint==55) { lprint = 3; fputc(12, stdprn); fprintf( stdprn, " Num_V Nombre Apellido Tel‚fono Contratos Activos\n\r"); fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r"); } Curr_Clientes++; } fputc(12, stdprn); } */ void Anula_Compras_Cliente(void){ int LSC = sizeof(struct Clientes_compras); struct date Fecha; getdate(&Fecha); long CurrRecord; Clientes2.Fecha.da_day = 0; Clientes2.Fecha.da_mon = 0; Clientes2.Fecha.da_year = (Fecha.da_year - (Fecha.da_year/100)*100); Clientes2.Cod_Und_Vend_Ref = 0; //þþþþþþþþþþþþþþþþþþ for ( int i=0; i<12; i++ ){ CurrRecord = 1 + Clientes1_inx_NContrato.Inicio + i; Clientes2.Fecha.da_mon = i+1; fseek(Clientes_C, (long)( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca fwrite(&Clientes2, LSC, 1, Clientes_C); // Y lee } } /* void Menu_Buscar_Clientes(void){ Clientes1_Buscar = Clientes1; Current_Struct_to_Zero_Clientes(); do{ EditCursorClientes(0); if(raton!=0) activa_raton(); Espera_Tecla_o_Raton(); if(raton!=0) desactiva_raton(); if(kbhit()){ EditCursorClientes(1); key = getch(); if(key!=27) finished = 1; else if( isprint(key) || isspace(key) ) { EditCursorClientes(0); if(key!=13) ungetch(key); Edit_Item_Clientes_B(); EditCursorClientes(0); } else if( key == 0 ) { switch( (key=getch()) ){ // Flecha Izquierda case 75: case 15: { CurrCol1_Clien--; if ( CurrCol1_Clien<1 ) CurrCol1_Clien=22; } break; // Flecha Derecha case 77: case 9: { CurrCol1_Clien++; if ( CurrCol1_Clien>22 ) CurrCol1_Clien=1; } break; // INICIO case 71: CurrCol1_Clien = 1; else CurrCol2_Clien = 1; break; // FIN case 79: CurrCol1_Clien = 4; else CurrCol2_Clien = 14; break; // Salir F1 case 59: finished = 1; break; default: break; } EditCursorClientes(0); } } else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) ) if( (bpush = CheckButon( 9, Comunes))>0 ) { EditCursorClientes(1); switch(bpush){ // Salir case 9: finished = 1; break; default: break; } EditCursorClientes(0); } }while(!finished); Clientes1_Buscar = Clientes1; Comienzo_Busqueda = 0; if( !Sigue_Buscando_Ficha() ) GetLineClientes(); } int Sigue_Buscando_Ficha(void){ ///////// int LSJ = sizeof(struct JD); int LSI = sizeof(struct Clientes_inx); int LSC = sizeof(struct Clientes); int ok = 0, CurrRecord; char Buffer[80], Buffer2[80], Buffer3[80]; int oldCTL= CurrTopLine_Clien1; int oldCR= CurrRow1_Clien; if( Comienzo_Busqueda == 0 ) { CurrTopLine_Clien1 = 1; CurrRow1_Clien = 1; } do{ CurrRecord = CurrTopLine_Clien1 + CurrRow1_Clien - 1; fseek(Clientes, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); fread(&Clientes1, LSC, 1, Clientes); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// if ( Clientes1_Buscar.NContrato != -1 ) { // Compara el n§ de contrato if ( Clientes1_Buscar.NContrato == Clientes1.NContrato ) ok = 1; CurrCol1_Clien = 1; } else if ( strlen(Clientes1_Buscar.Local) != 0 ) { // Compara la cadena de Local ( MAYUSCULAS = minusculas ) strncpy( Buffer, Clientes1.Local, strlen(Clientes1_Buscar.Local) ); Buffer[strlen(Clientes1_Buscar.Local)] = '\0'; if ( strcmpi(Clientes1_Buscar.Local, Buffer ) == 0 ) ok = 1; CurrCol1_Clien = 1; } else if ( strlen(Clientes1_Buscar.Nombre) != 0 ) { // Compara la cadena de Nombre ( MAYUSCULAS = minusculas ) strncpy( Buffer, Clientes1.Nombre, strlen(Clientes1_Buscar.Nombre) ); Buffer[strlen(Clientes1_Buscar.Nombre)] = '\0'; if ( strcmpi(Clientes1_Buscar.Nombre, Buffer ) == 0 ) ok = 1; CurrCol1_Clien = 2; } else if ( Clientes1_Buscar.Telefono2 != -1 ) { // Compara el tel‚fono sprintf(Buffer2, "%ld", Clientes1_Buscar.Telefono2); sprintf(Buffer3, "%ld", Clientes1.Telefono2); strncpy( Buffer, Buffer3, strlen(Buffer2) ); Buffer[strlen(Buffer2)] = '\0'; if ( strcmpi(Buffer2, Buffer ) == 0 ) ok = 1; CurrCol1_Clien = 3; } ////////////////////////////////////////////////////////////////////////////// if( Clientes1_Buscar.NContrato!=-1) { } else { if( strlen(Clientes1_Buscar.Nombre)!=0) if( strlen(Clientes1_Buscar.Apellido1)!=0) if( strlen(Clientes1_Buscar.Apellido2)!=0) if( strlen(Clientes1_Buscar.DNI)!=0) if( Clientes1_Buscar.Telefono1!=0) if( strlen(Clientes1_Buscar.Calle1)!=0) if( strlen(Clientes1_Buscar.Num1)!=0) if( strlen(Clientes1_Buscar.Local)!=0) if( Clientes1_Buscar.Telefono2!=0) if( strlen(Clientes1_Buscar.Calle2)!=0) if( strlen(Clientes1_Buscar.Num2)!=0) if( strlen(Clientes1_Buscar.Poblacion)!=0) if( strlen(Clientes1_Buscar.Provincia)!=0) if( Clientes1_Buscar.Vend!=0) } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// if( ok != 1 ) CurrTopLine_Clien1++ ; }while(!ok && (CurrRecord-1)<= Clientes1_inx.Fin ); if ( ok == 0 ) { CurrTopLine_Clien1 = oldCTL; CurrRow1_Clien = oldCR; Se_Puede_Buscar = 0; Confirma("No se encontr¢", "equivalencia...", ""); Comienzo_Busqueda = 0; return NO_ENCONTRADO; } else { Se_Puede_Buscar = 1; return ENCONTRADO; } ///////// } void Edit_Item_Clientes_B(void){ char Buffer[80]; int MR; long Fecha; Clientes1.NContrato = -1; switch (CurrCol1_Clien) { case 1: InputCadenaG( Clientes1.Nombre, 0, 15, 63, 57, PATLD[0]); break; case 2: InputCadenaG( Clientes1.Apellido1, 0, 15, 63, 57, PATLD[1]); break; case 3: InputCadenaG( Clientes1.Apellido2, 0, 15, 63, 57, PATLD[2]); break; case 4: InputCadenaG( Clientes1.DNI, 0, 15, 63, 57, PATLD[3]); break; case 5: sprintf(Buffer, "%ld", Clientes1.Telefono1); InputCadenaG( Buffer, 1, 9, 63, 57, PATLD[4]); Clientes1.Telefono1 = atol(Buffer); break; case 6: InputCadenaG( Clientes1.Calle1, 0, 30, 63, 57, PATLD[5]); break; case 7: InputCadenaG( Clientes1.Num1, 0, 5, 63, 57, PATLD[6]); break; case 8: InputCadenaG( Clientes1.Local, 0, 30, 63, 57, PATLD[7]); break; case 9: sprintf(Buffer, "%ld", Clientes1.Telefono2); InputCadenaG( Buffer, 1, 9, 63, 57, PATLD[8]); Clientes1.Telefono2 = atol(Buffer); break; case 10:InputCadenaG( Clientes1.Calle2, 0, 30, 63, 57, PATLD[9]); break; case 11:InputCadenaG( Clientes1.Num2, 0, 5, 63, 57, PATLD[10]); break; case 12:InputCadenaG( Clientes1.Poblacion, 0, 18, 63, 57, PATLD[11]); break; case 13:InputCadenaG( Clientes1.Provincia, 0, 16, 63, 57, PATLD[12]); break; case 14: while( kbhit() ) getch(); break; case 15: while( kbhit() ) getch(); break; case 16: while( kbhit() ) getch(); break; case 17: while( kbhit() ) getch(); break; case 18: while( kbhit() ) getch(); break; case 19: while( kbhit() ) getch(); break; case 20: while( kbhit() ) getch(); break; case 21:sprintf(Buffer, "%d", Clientes1.NContrato); InputCadenaG( Buffer, 1, 4, 63, 57, PATLD[20]); Clientes1.NContrato = atoi(Buffer); break; case 22:int old_Vend = Clientes1.Vend; Fuente(SMALL_FONT, 4); sprintf(Buffer, "%d", Clientes1.Vend); do{ InputCadenaG( Buffer, 1, 3, 63, 57, PATLD[21]); }while( Vend_Dir[atoi(Buffer)]==-1 ); Clientes1.Vend = atoi(Buffer); if( Clientes1.Vend != old_Vend ) { Obten_Nombre_Vendedor( Clientes1.Vend ); ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PATLD[22]); setcolor(BLANCO); sprintf(Buffer, " %15s", Vend1.Nombre); outtextxy( PATLD[22].left+2, PATLD[22].up+2, Buffer ); } Fuente(SMALL_FONT, 5); break; default: return; } } */