All pastes #412935 Raw Edit

Someone

public text v1 · immutable
#412935 ·published 2007-03-28 01:11 UTC
rendered paste body
//******************************************************************
// VENDEDOR 000179
//******************************************************************
//------------------------------------------------------------------
//Insere na tabela de Pedidos
//------------------------------------------------------------------
if FileExists('P:\000179\dbPedidoPalm.txt') Then
begin
dm.TBPALMPEDIDO.Open;
Str := TStringList.Create;
Str.LoadFromFile('P:\000179\dbPedidoPalm.txt');
for i := 0 to Str.Count -1 do
  begin
    S := Str[i];
  dm.TBPALMPEDIDO.Insert;
  for X := 1 to 10 do
  begin
    dm.TBPALMPEDIDO.FieldByName(Campo[X]).AsString := StringReplace(Copy(S,1,Pos(#9,S)-1),'.' , ',',[RfReplaceAll]);
    Delete(S, 1, Pos(#9,S));
  end;
  dm.TBPALMPEDIDO.FieldByName(Campo[11]).AsString := StringReplace(Copy(S,1,Length(S)),'.' , ',',[RfReplaceAll]);

  dm.TBPALMPEDIDO.Post;
end;
//Limpa a tabela Pedido
//Str.Clear;
//Str.SaveToFile('P:\000179\dbPedidoPalm.txt');
Str.Free;
DeleteFile('P:\000179\dbPedidoPalm.txt');
DeleteFile('P:\000179\dbPedidoPalm.pdb');
lblResultadoPEDIDO.Caption := 'Foram importados: '+ IntToStr(dm.TBPALMPEDIDO.RecordCount)+' registros da tabela PEDIDO.';
End;

//******************************************************************
// VENDEDOR 000211
//******************************************************************
//------------------------------------------------------------------
//Insere na tabela de Pedidos
//------------------------------------------------------------------
if FileExists('P:\000211\dbPedidoPalm.txt') Then
begin
dm.TBPALMPEDIDO.Open;
Str := TStringList.Create;
Str.LoadFromFile('P:\000211\dbPedidoPalm.txt');
for i := 0 to Str.Count -1 do
  begin
    S := Str[i];
  dm.TBPALMPEDIDO.Insert;
  for X := 1 to 10 do
  begin
    dm.TBPALMPEDIDO.FieldByName(Campo[X]).AsString := StringReplace(Copy(S,1,Pos(#9,S)-1),'.' , ',',[RfReplaceAll]);
    Delete(S, 1, Pos(#9,S));
  end;
  dm.TBPALMPEDIDO.FieldByName(Campo[11]).AsString := StringReplace(Copy(S,1,Length(S)),'.' , ',',[RfReplaceAll]);

  dm.TBPALMPEDIDO.Post;
end;
//Limpa a tabela Pedido
//Str.Clear;
//Str.SaveToFile('P:\000211\dbPedidoPalm.txt');
Str.Free;
DeleteFile('P:\000211\dbPedidoPalm.txt');
DeleteFile('P:\000211\dbPedidoPalm.pdb');
lblResultadoPEDIDO.Caption := 'Foram importados: '+ IntToStr(dm.TBPALMPEDIDO.RecordCount)+' registros da tabela PEDIDO.';
End;