Estimado Neftali.
El Procedimiento Principal es
Código Delphi
[-]
procedure TFormTasasRet_Perc.CargarPadron;
VAR Tipo,S:String;
aux:Real;
posicion:Integer;
begin
inherited;
if MemoText.Lines.Count<=0 Then
Raise Exception.Create('No hay datos para procesar...');
if chbBorrarDatos.Checked then
begin
Borrar.Execute;
end;
btBorrar.Enabled:=False;
CDSTasas.Close;
CDSTasas.Open;
btCancelar.Enabled:=True;
btSalir.Enabled :=False;
if ComboBox1.ItemIndex=0 Then
DecimalSeparator:=','
else
if ComboBox1.ItemIndex=1 Then
DecimalSeparator:='.';
Cancelado:=False;
TotalReg:=0;
TotalProcesado:=0;
Minutos:=0;
lbinicio.Caption:=TimeToStr(Now);
pgProceso.Min:=0;
pgProceso.Max:=MemoText.Lines.Count-1;
pgProceso.Position:=0;
TotalReg:=MemoText.Lines.Count-1;
Timer1.Enabled:=True;
for posicion:=0 to MemoText.Lines.Count-1 do
begin
TotalxMinuto := TotalxMinuto+1; TotalProcesado := posicion;
lbNroReg.Caption := IntToStr(posicion);
lbRestan.Caption := FormatDateTime('hh:mm',Tiempo);
lbMinutos.Caption:= FormatDateTime('ss',Now);
s:=MemoText.Lines[posicion];
pgProceso.Position:=posicion;
if cancelado=False Then
begin
spGravar_2.close;
Tipo:=copy(s,1,1);
spGravar_2.ParamByName('TIPO_PERCECPION').Value := copy(s,1,1);
delete(s,1,2);
spGravar_2.ParamByName('desde').AsDate := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,10,2) +'/'+ Copy(s,12,2) +'/'+ Copy(s,14,4) ))));
spGravar_2.ParamByName('hasta').AsDate := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,19,2) +'/'+ Copy(s,21,2) +'/'+ Copy(s,23,4) ))));
spGravar_2.ParamByName('fecha').AsDate := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,1,2) +'/'+ Copy(s,3,2) +'/'+ Copy(s,5,4) ))));
spGravar_2.ParamByName('cuit').Value := Copy(s,28,2)+'-'+Copy(s,30,8)+'-'+copy(s,38,1);
spGravar_2.ParamByName('tipo').Value := Copy(s,40,1); spGravar_2.ParamByName('estado').Value := Copy(S,42,1); spGravar_2.ParamByName('cambio').Value := Copy(s,44,1); if Tipo='P' then
spGravar_2.ParamByName('tasa_perc').AsFloat := StrToFloat(copy(s,46,4))
else
if Tipo='R' then
spGravar_2.ParamByName('tasa_ret').AsFloat := StrToFloat(copy(s,46,4));
spGravar_2.ParamByName('g_per').Value := StrToInt(Copy(s,51,2));
spGravar_2.ParamByName('g_ret').Value := StrToInt(Copy(s,51,2));
spGravar_2.ExecProc;
spGravar_2.close;
end
else
if MessageDlg('continua ?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
btCancelar.Enabled:=True;
btSalir.Enabled :=False;
btBorrar.Enabled:=False;
cancelado:=False;
end
else
begin
DecimalSeparator :='.';
pgProceso.Position:=0;
lbfin.Caption :=TimeToStr(now);
btCancelar.Enabled:=False;
btBorrar.Enabled :=True;
btSalir.Enabled :=True;
Timer1.Enabled:=False;
exit;
end;
end;
DecimalSeparator :='.';
lbfin.Caption :=TimeToStr(now);
btCancelar.Enabled:=False;
btBorrar.Enabled :=True;
btSalir.Enabled :=True;
Timer1.Enabled:=False;
end;
previeamente hago leer el tx para cargarlo al memo.
que hace a la cargar del padron, lo puse dentro de un trhead por que si no se me congelaba la maquina.
Lo q nunca hice es leer desde el disco el txt....????? se puede hacer eso?