Hola eldioni, gracias por tu tiempo, te pido disculpa, soy medio atolondrado para escribir. te paso el codigo.
con esto leo el txt:
Código Delphi
[-]
procedure TFormTasasRet_Perc.SpeedButton1Click(Sender: TObject);
var Inicio:TDateTime;
begin
inherited;
if OpenDialog.Execute Then
if OpenDialog.FileName<>'' Then
begin
Inicio:=Now;
GifCarga.Visible:=True;
GifCarga.Active :=True;
edPath.Text:=OpenDialog.FileName;
AssignFile(ArchiTxt, OpenDialog.FileName);
Reset(ArchiTxt);
MemoText.Lines.LoadFromFile(OpenDialog.FileName);
lbReg.Caption:=IntToStr(MemoText.Lines.Count-1);
lbTiempoLectua.Caption:=TimetoStr(inicio-now)
end
else
ShowMessage('No hay archivo Seleccionado');
GifCarga.Visible:=False;
GifCarga.Active :=False;
end;
y con este hago el proceso de carga
Código Delphi
[-]
procedure TFormTasasRet_Perc.LeerTxtExecute(Sender: TObject);
VAR S:String;
aux:Real;
posicion:Integer;
begin
inherited;
if MemoText.Lines.Count<=0 Then
Raise Exception.Create('No hay datos para procesar...');
GifProceso.Visible:=True;
GifProceso.Animate:=True;
if chbBorrarDatos.Checked then
begin
Borrar.Execute;
end;
CDSTasas.Close;
CDSTasas.Open;
btCancelar.Enabled:=True;
btSalir.Enabled :=False;
if ComboBox1.ItemIndex=0 Then
DecimalSeparator:=','
else
if ComboBox1.ItemIndex=1 Then
DecimalSeparator:='.';
lbinicio.Caption:=TimeToStr(Now);
for posicion:=0 to MemoText.Lines.Count-1 do
begin
Application.ProcessMessages;
lbNroReg.Caption:=IntToStr(posicion);
Sleep(1);
s:=MemoText.Lines[posicion];
if cancelado=False Then
begin
CDSTasas.Append;
CDSTasasFECHA.AsDateTime :=StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,1,2) +'/'+ Copy(s,3,2) +'/'+ Copy(s,5,4) ))));
CDSTasasDESDE.AsDateTime :=StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,10,2) +'/'+ Copy(s,12,2) +'/'+ Copy(s,14,4) ))));
CDSTasasHASTA.AsDateTime :=StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,19,2) +'/'+ Copy(s,21,2) +'/'+ Copy(s,23,4) ))));
CDSTasasCUIT.Value :=Copy(s,28,2)+'-'+Copy(s,30,8)+'-'+copy(s,38,1);
CDSTasasTIPO_CONVENIO.Value := Copy(s,40,1);
CDSTasasESTADO.Value := Copy(S,42,1);
CDSTasasCAMBIO_ALICUOTA.Value:= Copy(s,44,1);
CDSTasasTASA_PERCEPCION.AsFloat := StrToFloat(copy(s,46,4));
CDSTasasTASA_RETENCION.AsFloat := StrToFloat(Copy(s,51,3));
CDSTasasGRUPO_PERCEPCION.AsFloat:= StrToInt(Copy(s,56,2));
CDSTasasGRUPO_RETENCION.AsFloat := StrToInt(Copy(s,59,2));
CDSTasas.Post;
spGravar.close;
spGravar.ParamByName('cuit').Value := CDSTasasCUIT.Value;
spGravar.ParamByName('fecha').AsDate := CDSTasasFECHA.AsDateTime;
spGravar.ParamByName('desde').AsDate := CDSTasasDESDE.AsDateTime;
spGravar.ParamByName('hasta').AsDate := CDSTasasHASTA.AsDateTime;
spGravar.ParamByName('tipo').Value := CDSTasasTIPO_CONVENIO.Value;
spGravar.ParamByName('estado').Value := CDSTasasESTADO.Value;
spGravar.ParamByName('cambio').Value := CDSTasasCAMBIO_ALICUOTA.Value;
spGravar.ParamByName('tasa_perc').AsFloat := CDSTasasTASA_PERCEPCION.AsFloat;
spGravar.ParamByName('tasa_ret').AsFloat := CDSTasasTASA_RETENCION.AsFloat;
spGravar.ParamByName('g_per').Value := CDSTasasGRUPO_PERCEPCION.Value;
spGravar.ParamByName('g_ret').Value := CDSTasasGRUPO_RETENCION.Value;
spGravar.ExecProc;
end
else
if MessageDlg('cotinua ?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
btCancelar.Enabled:=True;
btSalir.Enabled :=False;
GifProceso.Visible:=True;
GifProceso.Animate:=True;
cancelado:=False;
end
else
exit;
end;
DecimalSeparator:='.';
GifProceso.Visible:=False;
GifProceso.Animate:=False;
lbfin.Caption:=TimeToStr(now);
btCancelar.Enabled:=False;
btSalir.Enabled :=True;
end;
gracias