ayuda urgente por favor para modificar rutina
Publicado por deysi laura (14 intervenciones) el 06/12/2005 21:07:24
hola necesito su ayuda requiero que en lugar de leer la fecha al final del archivo la cual siempre esta en la misma posicion.
ahora quiero que leea la fecha pero esta fecha esta al principio pero no en la misma posición como la anterior.
estoy modificando esta rutina pero no me ha quedado les envio la rutina original de primer caso de les mensiono hogalay alguien me pueda ayudar
atten deysi laura
if pase then begin
ArchivoCM:=OpenDialog1.filename;
Stop:=false;
intentosfecha:=0;
AssignFile(fCM,ArchivoCM);
//PRIMERO OBTENDRA LA FECHA
Reset(fCM);
While (Not Eof(fCM))and(Not Stop) do Begin
Application.ProcessMessages;
readln(fCM,cmLine); //lee la linea
Longitudcadena:=Length(cmLine);
CMFechaF :=Copy(cmLine,19,6);
intentosfecha:=intentosfecha+1;
try
fechainicial:=strtoDate('01'+'/'+Copy(CMFechaF,5,2)+'/'+Copy(CMFechaF,1,4));
break;
except
intentosfecha:=intentosfecha+1;
end;
if intentosfecha >50 then break;
end;
Closefile(fCM);
try
fechainicial:=strtoDate('01'+'/'+Copy(CMFechaF,5,2)+'/'+Copy(CMFechaF,1,4));
except
SendLogMsg('Cuenta Nueva: Error para detectar período de fecha',LML_LOG);
exit;
end;
fechainicial:=IncMonth(fechainicial,-1);
fechainicial:=StartOftheMonth(fechainicial);
fechafinal :=EndOftheMonth(fechainicial);
mesr :=strtoint(FormatDateTime('mm',fechainicial));
cadanio:=FormatDateTime('yy',fechainicial);
if mesr=1 then cad1:='Ene';
if mesr=2 then cad1:='Feb';
if mesr=3 then cad1:='Mar';
if mesr=4 then cad1:='Abr';
if mesr=5 then cad1:='May';
if mesr=6 then cad1:='Jun';
if mesr=7 then cad1:='Jul';
if mesr=8 then cad1:='Ago';
if mesr=9 then cad1:='Sep';
if mesr=10 then cad1:='Oct';
if mesr=11 then cad1:='Nov';
if mesr=12 then cad1:='Dic';
TempArchivoCM:=Pathllams+'CM'+cad1+cadanio+'.dbf';
if FileExists(TempArchivoCM) then
if Not Pregunta('Ya existe!','"Esta cuenta ya fue procesada,',
'desea procesarla nuevamente?"','')
then begin
exit;
end;
SendLogMsg('Cuenta Nueva: Iniciando Decodificación...',LML_LOG);
frmNCuenta:=TfrmNCuenta.Create(self);
frmNCuenta.Showmodal;
frmNCuenta.free;
SendLogMsg('Cuenta Nueva: Fin de Decodificación ('+inttostr(CuentaregistrosCM)+' regs).',LML_LOG);
SendLogMsg('La cuenta de "'+FormatDateTime('mmmm',fechainicial)+' del '+
FormatDateTime('yyyy',fechainicial)+
'" esta lista para Reportar.',LML_LOG);
end;
end;
end;
ahora quiero que leea la fecha pero esta fecha esta al principio pero no en la misma posición como la anterior.
estoy modificando esta rutina pero no me ha quedado les envio la rutina original de primer caso de les mensiono hogalay alguien me pueda ayudar
atten deysi laura
if pase then begin
ArchivoCM:=OpenDialog1.filename;
Stop:=false;
intentosfecha:=0;
AssignFile(fCM,ArchivoCM);
//PRIMERO OBTENDRA LA FECHA
Reset(fCM);
While (Not Eof(fCM))and(Not Stop) do Begin
Application.ProcessMessages;
readln(fCM,cmLine); //lee la linea
Longitudcadena:=Length(cmLine);
CMFechaF :=Copy(cmLine,19,6);
intentosfecha:=intentosfecha+1;
try
fechainicial:=strtoDate('01'+'/'+Copy(CMFechaF,5,2)+'/'+Copy(CMFechaF,1,4));
break;
except
intentosfecha:=intentosfecha+1;
end;
if intentosfecha >50 then break;
end;
Closefile(fCM);
try
fechainicial:=strtoDate('01'+'/'+Copy(CMFechaF,5,2)+'/'+Copy(CMFechaF,1,4));
except
SendLogMsg('Cuenta Nueva: Error para detectar período de fecha',LML_LOG);
exit;
end;
fechainicial:=IncMonth(fechainicial,-1);
fechainicial:=StartOftheMonth(fechainicial);
fechafinal :=EndOftheMonth(fechainicial);
mesr :=strtoint(FormatDateTime('mm',fechainicial));
cadanio:=FormatDateTime('yy',fechainicial);
if mesr=1 then cad1:='Ene';
if mesr=2 then cad1:='Feb';
if mesr=3 then cad1:='Mar';
if mesr=4 then cad1:='Abr';
if mesr=5 then cad1:='May';
if mesr=6 then cad1:='Jun';
if mesr=7 then cad1:='Jul';
if mesr=8 then cad1:='Ago';
if mesr=9 then cad1:='Sep';
if mesr=10 then cad1:='Oct';
if mesr=11 then cad1:='Nov';
if mesr=12 then cad1:='Dic';
TempArchivoCM:=Pathllams+'CM'+cad1+cadanio+'.dbf';
if FileExists(TempArchivoCM) then
if Not Pregunta('Ya existe!','"Esta cuenta ya fue procesada,',
'desea procesarla nuevamente?"','')
then begin
exit;
end;
SendLogMsg('Cuenta Nueva: Iniciando Decodificación...',LML_LOG);
frmNCuenta:=TfrmNCuenta.Create(self);
frmNCuenta.Showmodal;
frmNCuenta.free;
SendLogMsg('Cuenta Nueva: Fin de Decodificación ('+inttostr(CuentaregistrosCM)+' regs).',LML_LOG);
SendLogMsg('La cuenta de "'+FormatDateTime('mmmm',fechainicial)+' del '+
FormatDateTime('yyyy',fechainicial)+
'" esta lista para Reportar.',LML_LOG);
end;
end;
end;
Valora esta pregunta


0