Ver Mensaje Individual
  #4  
Antiguo 30-09-2005
Avatar de lucasarts_18
lucasarts_18 lucasarts_18 is offline
Miembro
 
Registrado: mar 2005
Ubicación: Villa Alemana,Chile
Posts: 1.087
Reputación: 23
lucasarts_18 Va por buen camino
Hola:

Olvidé escribir esto:

Código Delphi [-]
 procedure TfrmInterfaz.EscribirArchivo;
 begin
   writeln(Archivo,concatenacion);
   writeln(Archivo,' ');
   flush(Archivo);
 end;

y les dejo toda la rutina para que se comprenda mejor:

Código Delphi [-]
 procedure TFrmInterfaz.btnBolFechaClick(Sender: TObject);
 var
   tipo,boleta_id,rut,fecha,lote,codigo,monto,descuento,montomp,
   codigo_Doc,nro_documento,fecha_vcto,cod_articulo,cantidad,
   preciounitario : String;
   cantidad_doc : SmallInt;
   venta_id : String;
 begin
   chdir('C:\');
   if not FileExists('BOL_FECHA.txt') then
     FileCreate('BOL_FECHA.txt');
   AbrirArchivo('BOL_FECHA.txt');
   with DMServidores.OQryBoletaFecha do
   begin
     SQL.Clear;
     Close;
     SQL.Add('Select * from Out_Venta');
     Execute;
     while Eof = False do
     begin
       tipo := Uppercase(Field(0));
       boleta_id := UpperCase(Field(1));
       rut := QuitarGuion(UpperCase(Field(2)));
       fecha := FormatDateTime('ddmmyyyy', StrToDate(Field(3)));
       lote := UpperCase(Field(4));
       codigo := UpperCase(Field(5));
       monto := UpperCase(Field(6));
       descuento := UpperCase(Field(7));
       venta_id := UpperCase(Field(8));
       concatenar(tipo,boleta_id,rut,fecha,lote,codigo,
                  monto,descuento);
       With DMServidores.OQryMedioPago do
       begin
         SQL.Clear;
         Close;
         SQL.Add('Select * From Out_Venta_Medio_Pago');
         SQL.Add(' Where Venta_Id =' + venta_id );
         Execute;
         while EOF = False do
         begin
           cantidad_doc := RowsProcessed;
           montomp := UpperCase(Field(1));
           codigo_Doc := UpperCase(Field(2));
           //dateseparator := #0;
           if varisnull(Field(3)) or VarIsEmpty(Field(3)) then nro_documento := FormatDateTime('ddmmyyyy', date)
           else nro_documento := UpperCase(Field(3));
           //dateseparator := #0;
           fecha_vcto := FormatDateTime('ddmmyyyy', StrToDate(Field(4)));
           Concatenar(cantidad_doc,montomp,codigo_doc,nro_documento,fecha_vcto);
           Next;
         end;
 
       end;
       With DMServidores.OQryVentaDet do
       begin
         SQL.Clear;
         Close;
         SQL.Add('Select * from Out_Venta_Detalle');
         SQL.Add(' Where Venta_Id =' + venta_id );
         Execute;
         while EOF = False do
         begin
           cod_articulo := UpperCase(Field(1));
           cantidad := UpperCase(Field(2));
           preciounitario := UpperCase(Field(3));
           concatenar(cod_articulo,cantidad,preciounitario);
           Next;
         end;
       end;
       EscribirArchivo();
       next;
     end;
     Free;
     CerrarArchivo('bol_fecha.txt');
     Showmessage('Datos traspasados con exito');
     concatenacion := '';
   end;
 end;

insisto el problema solo sucede cuando el archivo TXT no existe

Saludos..
__________________
No todo es como parece ser...
Responder Con Cita