#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 37+posin #define linea 71+posin #define durac 21+posin #define hor 14+posin #define fech 4+posin #define tranf 0 #define numero 46+posin #define ccost 0 #define proye 93+posin #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 0 #define antran 74+posin // anexo transferido (pendiente) #define fofech americano // formato de fecha extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ extern char rgua[]; // Procesos Inicialiales (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) { char shora[3]; int i=strlen(buf),it,k,ka,iseg; if (i>vlinea && buf[vfech+2]=='/' && buf[vfech+5]=='/' && buf[vhor+2]==':' && buf[vdurac+1]==':' && buf[vdurac+4]=='.' && (buf[vlinea-1]=='T' || buf[vestac]=='T')) { k = 0 ; if(buf[vlinea-1]=='T') { tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; tel[k++] = buf[vestac+4] ; tel[k++] = buf[vestac+5] ; tel[k++] = ' ' ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; tel[k++] = buf[vlinea+3] ; } else { tel[k++] = buf[vlinea-1] ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; tel[k++] = buf[vlinea+3] ; tel[k++] = buf[vlinea+4] ; tel[k++] = ' ' ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; tel[k++] = buf[vestac+4] ; } tel[k++] = ' ' ; tel[k++]='0' ; tel[k++]=buf[vdurac+0] ; tel[k++] = ':' ; tel[k++]=buf[vdurac+2] ; tel[k++]=buf[vdurac+3] ; tel[k++] = ':' ; shora[0] = buf[vdurac+5] ; shora[1] ='\0' ; iseg = atoi(shora)*6 ; itoa(iseg,shora,10) ; if (iseg<10) { tel[k++]='0' ; tel[k++]=shora[0] ; } else { tel[k++]=shora[0] ; tel[k++]=shora[1] ; } tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; if (tel[ka]==' ') tel[ka]='0' ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; if (vfofech == americano) { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } else { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; } tel[k++] = '/'; tel[k++] = buf[vfech+6] ; tel[k++] = buf[vfech+7] ; tel[k++] = ' ' ; if(buf[vlinea-1]=='T') tel[k++] = 'O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; if (buf[vnumero]==' ' && buf[vnumero+1]==' ') buf[vnumero]='*' ; for (it=vnumero; it<(vnumero+17) && buf[it]!=' ' ; it++) tel[k++] = buf[it] ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // centro de costo tel[k++] = ' ' ; if (buf[vproye+0]==' ' && buf[vproye+1]==' ' && buf[vproye+2]==' ' && buf[vproye+3]==' ') { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // proyecto } else { tel[k++]=buf[vproye] ; tel[k++]=buf[vproye+1] ; tel[k++]=buf[vproye+2] ; tel[k++]=buf[vproye+3] ; tel[k++]=buf[vproye+4] ; } tel[k++] = ' ' ; tel[k++] = '*' ; // Código de Cuenta tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]='0' ; // tarifa tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // ruta tel[k++] = ' ' ; tel[k++] = '*' ; // pri num 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' ; } }