Ver Mensaje Individual
  #6  
Antiguo 10-06-2008
Avatar de Caro
*Caro* Caro is offline
Moderadora
 
Registrado: jul 2004
Ubicación: Cochabamba, Bolivia
Posts: 2.544
Reputación: 22
Caro Va por buen camino
Hola de nuevo Paulao, la primera función no he cambiado nada, lo que esta dentro del boton si, te pongo el codigo, no se si te he entendido bien, pero de hecho tienes que seguir haciendo mas controles.

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 Archivo  : TextFile;
 Linea    : String;
 BandItem,
 BandCabecera : Boolean;
 PosInicio, PosItem, PosIt  : Integer;
 CadItem,
 Cadena   : String;
begin
 AssignFile(Archivo, 'pru.txt');
 Reset(Archivo);
 BandItem := False;
 BandCabecera := False;
 Cadena := '';
 While not Eof(Archivo) do
  begin
   Readln(Archivo, Linea);
   PosItem := Pos('ITEM', Linea);
   if (PosItem<>0) or (BandItem) then
    begin
     BandItem := True;
     if BandCabecera=False then
      begin
       Memo1.Lines.Add(Cadena);
       BandCabecera := True;
      end;
     CadItem := Copy(Linea, 3, Length(Linea));
     PosIt := Pos(' ',CadItem);
     if PosIt>0 then
      CadItem := Copy(CadItem, 1, PosIt-1);
     Memo1.Lines.Add(CadItem);
     if Pos('SUBTOTAL', Linea)>0 then
      BandItem := False;
    end
   else
    begin
     PosInicio := Pos('CCF:', Linea);
     if PosInicio>0 then
      begin
       Cadena := Cadena + Contenido(Linea, 'CCF:',PosInicio);
       PosInicio := 0;
      end;
     PosInicio := Pos('COO:', Linea);
     if PosInicio>0 then
      begin
       Cadena := Cadena + Contenido(Linea, 'COO:',PosInicio);
       PosInicio := 0;
      end;
     PosInicio := Pos('CNPJ/CPF CONSUMIDOR:', Linea);
     if PosInicio>0 then
      begin
       Cadena := Cadena + Contenido(Linea, 'CNPJ/CPF CONSUMIDOR:',PosInicio);
       PosInicio := 0;
      end;
     PosInicio := Pos('NOME:', Linea);
     if PosInicio>0 then
      begin
       Cadena := Cadena + Contenido(Linea, 'NOME:',PosInicio);
       PosInicio := 0;
      end;
    end;
  end;
end;

Saluditos
__________________
Disfruten cada minuto de su vida a lado de sus seres queridos como si fuese el ultimo, uno nunca sabe lo que puede pasar.
Responder Con Cita