#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define orden 0 #define estac 43+posin // llamadas entrantes #define linea 28+posin #define durac 13+posin #define hor 7+posin #define fech posin #define tranf 54+posin #define numero 58+posin #define ccost 0 #define proye 49+posin #define cuenta 28+posin #define pulsos 38+posin #define ruta 0 #define prinum 0 #define ring 79+posin #define antran 0 // anexo transferido (pendiente) #define fofech europeo // formato de fecha extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ extern char rgua[]; // Procesos Iniciales (Inicializar Variables, Abrir // Archivos especiales, etc) void in_central() { rgua[0] = '\0'; } // Procesos de Finalización (Cerrar Archivos especiales, etc) void fi_central() { } // Driver Propiamente tal. Las posiciones de los campos se // ingresan como parámetros, lo que permite modificar desde // Aplicación de Tarificación la posición de estos en el // Registro de Llamados. void DatCentral(char *buf, char *tel, int vestac, int vlinea,int vdurac,int vhor, int vfech, int vtranf, int vnumero, int vccost,int vproye, int vcuenta, int vpulsos, int vruta, int vprinum, int vring, int vantran, int vfofech) { int i,k; char aux,haux,maux; char smin[5],shora[5]; aux = 0; i=strlen(buf); if (i>vring && buf[vfech+2]=='/' && buf[vhor+2]==':'&& buf[vdurac+3]==':' ) { k = 0 ; for (i = 0;(buf[vestac+i]!=' ' && buf[vestac+i]!=' ');i++) tel[k++] = buf[vestac+i]; tel[k++] = ' ' ; for (i = 0;(buf[vlinea+i]!=' ' && buf[vlinea+i]!=' ');i++) tel[k++] = buf[vlinea+i]; tel[k++] = ' ' ; smin[0] = buf[vdurac] ; smin[1] = buf[vdurac+1] ; smin[2] = buf[vdurac+2] ; smin[3] = '\0' ; haux = atoi(smin)/60; maux = atoi(smin)-(haux*60); itoa(haux,shora,10); itoa(maux,smin,10); if (haux<10) { tel[k++] = '0'; tel[k++] = shora[0]; } else { tel[k++] = shora[0]; tel[k++] = shora[1]; } tel[k++] = ':'; if (maux<10) { tel[k++] = '0'; tel[k++] = smin[0]; } else { tel[k++] = smin[0]; tel[k++] = smin[1]; } tel[k++] = ':'; tel[k++] = buf[vdurac+4]; tel[k++] = buf[vdurac+5]; tel[k++] = ' '; if (buf[vhor]==' ') tel[k++] = '0' ; else tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; if (vfofech == europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } tel[k++] = '/'; tel[k++] = buf[6] ; tel[k++] = buf[7] ; tel[k++] = ' ' ; if ( buf[vtranf]=='Y' ) { tel[k++] = 'I' ; tel[k++] = ' ' ; tel[k++] = '*' ; } else { tel[k++] = 'O' ; tel[k++] = ' ' ; for (i = 0;buf[vnumero+i]!=' ';i++) tel[k++] = buf[vnumero+i]; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; if (buf[vproye] =='-') tel[k++] = '*' ; else { for (i=0;buf[vproye+i] !=' ';i++) tel[k++] = buf[vproye+i] ; } tel[k++] = ' ' ; /* if (buf[vcuenta] =='.') tel[k++] = '*' ; else { for (i=0;buf[vcuenta+i] !='.';i++) tel[k++] = buf[vcuenta+i] ; } */ tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '0' ; /* tarifa o pulsos */ tel[k++] = '0' ; /* tarifa o pulsos */ tel[k++] = '0' ; /* tarifa o pulsos */ tel[k++] = '0' ; /* tarifa o pulsos */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ tel[k++] = ' ' ; tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }