Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guνa de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 06-06-2008
Paulao Paulao is offline
Miembro
 
Registrado: sep 2003
Ubicaciσn: Rua D 31 Casa 1 - Inhoaνba - Rio de Janeiro - RJ - Brasil
Posts: 637
Poder: 21
Paulao Va por buen camino
Trabajar con archivo text

Seρores(as), tengo un archivo text generado ena determinada condicion. Este archivo viene muchas cosas que no me sirve, entonces necesito hacer algunos comandos para que el quede como yo gustaria, asi. O que me interesa es:
Toda las informaciones que viene apos CCF:, COO: y CONSUMIDOR:
Estas palavras no puedo cargar, solo los valores que viene luego apos las palavras. Este archivo es generado mesualmente, que puede tener tamaρos diferentes, pero estas palavras siempre viene en sus posiciones, como abajo un ejemplo de tres faturas que nosotros emitimos aca:

Cita:
FITA-DETALHE
Emissγo: 06/06/2008 10:43:39V
DATAi=01/05/2008 DATAf=06/06/2008
—————————————————————————————————————————————————————————
02/05/2008 16:25:55V CCF:001444 COO:002126
CUPOM FISCAL
ITEM CΣDIGO ST DESCRIΗΓO VL ITEM(R$)
1 00044313020076 T4 [T:5 ] CAMISA M/L S/B LISTRADO ON
1 x 63,00 63,00
——————————————————
SUBTOTAL R$ 63,00
acrιscimo 10,50
——————————————————
TOTAL R$ 73,50
A VISTA 73,50
T4=18,00%
—————————————————————————————————————————————————————————
COMPRE MAIS E PAGUE MENOS
=========================
Visite nosso Site na Internet
————————————————————————————————————————————————
—————————————————————————————————————————————————————————
[ ?(?Vh3jGJrim(BydALmcc9@1p8MQZu8CXMBkjnqrdrnJIp ]
SWEDA IF ST100
ECF-IF VERSΓO: 01.00.04 ECF: 001 LJ: 0001




FITA-DETALHE
Emissγo: 06/06/2008 10:43:39V
DATAi=01/05/2008 DATAf=06/06/2008
—————————————————————————————————————————————————————————
02/05/2008 16:26:39V CCF:001445 COO:002127
CNPJ/CPF CONSUMIDOR: 112.141.418-46
NOME: Sergio Zabeu
CUPOM FISCAL
ITEM CΣDIGO ST DESCRIΗΓO VL ITEM(R$)
1 00043997110110 T4 [T:5 ] CAMISA M/L S/B POPELINE LI
1 x 54,00 54,00
——————————————————
SUBTOTAL R$ 54,00
DESCONTO ICMS: -0,40
——————————————————
TOTAL R$ 53,60
A VISTA 53,60
T4=18,00%
—————————————————————————————————————————————————————————
COMPRE MAIS E PAGUE MENOS
=========================
Visite nosso Site na Internet
————————————————————————————————————————————————
—————————————————————————————————————————————————————————
[ gG7zDPasuC4AdyB(mvAffedaRB#m(oBT2#JiS4NC(d1oR* ]




FITA-DETALHE
Emissγo: 06/06/2008 10:43:39V
DATAi=01/05/2008 DATAf=06/06/2008
—————————————————————————————————————————————————————————
02/05/2008 16:28:25V CCF:001446 COO:002128
CNPJ/CPF CONSUMIDOR: 112.141.418-46
NOME: Sergio Zabeu
CUPOM FISCAL
ITEM CΣDIGO ST DESCRIΗΓO VL ITEM(R$)
1 00104038100099 T4 [T:48 ] BERMUDA SARJA S/P B/FACA 7
1 x 48,00 48,00
2 00023413030185 T4 [T:46M] PALETO 3 BOTOES C/ 2 ABERT
1 x 249,00 249,00
item cancelado: 2 -249,00
3 00184278030191 T4 [T:GG ] MALHA GOLA V R/10182 DIANA
1 x 96,00 96,00
4 00034005030197 T4 [T:48L] CALCA S/ PREGA BOLSO FACA
1 x 87,00 87,00
item cancelado: 4 -87,00
5 00073912120070 T4 [T:48 ] CALCA JEANS RETA TRADICION
1 x 57,00 57,00
6 00133247040075 T4 [T:G ] CUECA SLIP LIGHT S/ABERT.R
1 x 13,50 13,50
——————————————————
SUBTOTAL R$ 214,50
acrιscimo 0,50
——————————————————
TOTAL R$ 215,00
A VISTA 215,00
T4=18,00%
—————————————————————————————————————————————————————————
COMPRE MAIS E PAGUE MENOS
=========================
Visite nosso Site na Internet
————————————————————————————————————————————————
—————————————————————————————————————————————————————————
[ sG7nUwu2aARD5LMJ9teU7SLWkbUhvQMwTK5PJYVwWzFm42 ]
Responder Con Cita
  #2  
Antiguo 06-06-2008
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicaciσn: Ciudad de Mιxico
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Hay algo que no entiendo. El texto que pones de ejemplo, ¿es de un sólo archivo o son tres? En el ejemplo que te pongo, presupongo que cada archivo tiene una sola factura:

Cσdigo Delphi [-]
procedure TForm1.LeerArchivo(Archivo: String);
var
  Lineas: TStringList;
  Linea: String;
  Token: String;
  I, N: Integer;

begin
  Lineas := TStringList.Create;

  try
    Lineas.LoadFromFile(Archivo);

    for I := 0 to Pred(Lineas.Count) do
    begin
      Linea := Lineas[i];

      N := Pos('CCF:', Linea);
      if N > 0 then
      begin
        Token := '';
        Inc(N, 4);

        while (N <= Length(Linea)) and (Linea[N] <> ' ') do
        begin
          Token := Token + Linea[N];
          Inc(N);
        end;

        txtCCF.Text := Token;
      end;

      N := Pos('COO:', Linea);
      if N > 0 then
      begin
        Token := '';
        Inc(N, 4);

        while (N <= Length(Linea)) and (Linea[N] <> ' ') do
        begin
          Token := Token + Linea[N];
          Inc(N);
        end;

        txtCOO.Text := Token;
      end;

      N := Pos('CONSUMIDOR: ', Linea);
      if N > 0 then
      begin
        Token := '';
        Inc(N, 12);

        while (N <= Length(Linea)) and (Linea[N] <> ' ') do
        begin
          Token := Token + Linea[N];
          Inc(N);
        end;

        txtConsumidor.Text := Token;
      end;
  end;
  finally
    Lineas.Free;
  end;
end;

Aquí, txtCCF, txtCOO y txtConsumidor son tres componentes TEdit.

Si un sólo archivo contiene varias facturas, habrá que hacer algunas modificaciones.

// Saludos
Responder Con Cita
  #3  
Antiguo 06-06-2008
Paulao Paulao is offline
Miembro
 
Registrado: sep 2003
Ubicaciσn: Rua D 31 Casa 1 - Inhoaνba - Rio de Janeiro - RJ - Brasil
Posts: 637
Poder: 21
Paulao Va por buen camino
Hola, roman, estu tu codigo solo viene un solo registro. Voy a intentar a hacerlo diferente, tenendo el como base.
Responder Con Cita
Respuesta



Normas de Publicaciσn
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El cσdigo vB estα habilitado
Las caritas estαn habilitado
Cσdigo [IMG] estα habilitado
Cσdigo HTML estα deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Ϊltimo mensaje
Buscar archivo text, sin ruta. Caral Varios 18 26-02-2008 18:25:06
Aρadir archivo .text a combobox (Nombre) Caral Varios 11 30-07-2007 22:25:28
ftFmtMemo to text johurgi Varios 1 20-10-2006 17:45:01
Text File...Aplicaciones Caral Varios 4 03-10-2006 18:01:52
Guardar lo que tengo en un Edit1.text y edit2.text en una base de datos firebird jorgeluisc Conexiσn con bases de datos 1 23-04-2006 18:29:28


La franja horaria es GMT +2. Ahora son las 04:33:38.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducciσn al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi