Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Impresión
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 08-09-2011
jofebas jofebas is offline
Miembro
 
Registrado: nov 2010
Posts: 50
Poder: 16
jofebas Va por buen camino
Wink impresiones de tickets con excel y delphi

Buenas tardes.


[left]Miren lo que quiero hacer es un poco fuera de lo común, he intentado hacer un pequeño programa tipo puto de venta para un proyecto escolar, después de realizar todos los movimientos de venta, cambio y eso, quiero mandar imprimir un ticket, como no tengo impresora de ticket para probar lo mando a una imp. Normal laser.
El ticket sale tal y como lo configuro en Delphi 2010 con el componente de TExcelAplication sin problemas, el problema está que cuando lo probé en una impresora de tickets la hoja no deja de salir, y he buscado por todos lados, no encuentro como hacer para que pare al final de la impresión corte automáticamente la hoja o se detenga, probé con 2 miniprint una que corta y otra que no, pero con las dos hace lo mismo


podrian ayudarme.

Gracias de antemano.

el codigo es este:

Código Delphi [-]
procedure TFreportes.imprime();
var
  Format: OleVariant;
  Hoja : _WorkSheet;
  i, j : integer;
  con: string;
begin
    with ZQexcel do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from tiket ');
      Open;
    end;
// Abrimos excel
  Excel.Connect;
// Creamos un nuevo libro con tres hojas (predeterminado)
  //Excel.DisplayAlerts := False;
   Excel.WorkBooks.Add(NULL,0);
  //Excel.Workbooks.Add(1);
// Apuntamos a la primera hoja y le cambiamos el nombre
  Hoja := Excel.Worksheets.Item[1] as _WorkSheet;
  Hoja.Name := 'REPORTE';
  // Títulos de los datos
  //Hoja.Cells.AutoFormat(10, 'arial', 'center', 1, NULL, NULL, NULL);
  with Hoja.range['A1','D8'] do
  begin
    Font.Size:=7;
    Font.FontStyle := 'Bold';
    HorizontalAlignment := xlCenter;
    VerticalAlignment := xlCenter;
    WrapText:= true;
  end;
  Hoja.Range['A1','D1'].MergeCells := true;
  Hoja.Range['A1','D1'].Value2 := Label15.Caption;
  Hoja.Range['A2','D2'].MergeCells := true;
  Hoja.Range['A2','D2'].Value2 := Label13.Caption;
  Hoja.Range['A3','D3'].MergeCells := true;
  Hoja.Range['A3','D3'].Value2 := Label14.Caption;
  Hoja.Range['A4','D4'].MergeCells := true;
  Hoja.Range['A4','D4'].Value2 := Label4.Caption;
  Hoja.Range['A5','D5'].MergeCells := true;
  Hoja.Range['A5','D5'].Value2 := Label16.Caption+': '+Label7.Caption;
  Hoja.Range['A6','D6'].MergeCells := true;
  Hoja.Range['A6','D6'].Value2 := 'ticket No.'+ Label12.Caption;
  Hoja.Range['A7','D7'].MergeCells := true;
  Hoja.Range['A7','D7'].Value2 := IntToStr(ZQexcel.RecordCount) +' Articulos';
  Hoja.Range['A8','A8'].Value2 := 'CANT';
  Hoja.Range['A8','A8'].ColumnWidth  := 4;
  Hoja.Range['B8','B8'].Value2 := 'DESCRIPCION';
  Hoja.Range['C8','C8'].Value2 := 'PRECIO';
  Hoja.Range['C8','C8'].ColumnWidth := 6;
  Hoja.Range['D8','D8'].Value2 := 'TOTAL';
  Hoja.Range['D8','D8'].ColumnWidth  := 6;
  with ZQExcel do
  begin
    i:=9;
    if not IsEmpty then
      begin
        while not Eof do
        begin
        Hoja.Range['A'+IntToStr(i),'A'+IntToStr(i)].Value2 := ZQExcel.FieldByName('cantidad').AsString;
        Hoja.Range['B'+IntToStr(i),'B'+IntToStr(i)].Value2 := ZQExcel.FieldByName('descripcion').AsString;
        Hoja.Range['C'+IntToStr(i),'C'+IntToStr(i)].Value2 := ZQExcel.FieldByName('precio').AsString;
        Hoja.Range['D'+IntToStr(i),'D'+IntToStr(i)].Value2 := ZQExcel.FieldByName('total').AsString;
        Hoja.Range['A'+inttostr(i),'D'+inttostr(i)].HorizontalAlignment := xlLeft;
        Hoja.Range['A'+inttostr(i),'D'+inttostr(i)].VerticalAlignment := xlCenter;
        Hoja.Range['A'+inttostr(i),'D'+inttostr(i)].Font.Size:=7;
        Hoja.Range['A'+inttostr(i),'D'+inttostr(i)].WrapText:= true;
        next;
        i:=i+1;
      end;
      Format := '$#,##0.00_)';
      i:=i+1;
      j:=i;

      Hoja.Range['B'+IntToStr(i),'B'+IntToStr(i)].Value2 := 'EFECTIVO';
      Hoja.Range['D'+IntToStr(i),'D'+IntToStr(i)].Value2 := Edit3.Text;
      i:=i+1;
      Hoja.Range['B'+IntToStr(i),'B'+IntToStr(i)].Value2 := 'CAMBIO';
      Hoja.Range['D'+IntToStr(i),'D'+IntToStr(i)].Value2 := Edit5.Text;
      i:=i+1;
      Hoja.Range['B'+IntToStr(i),'B'+IntToStr(i)].Value2 := 'TOTAL';
      Hoja.Range['D'+IntToStr(i),'D'+IntToStr(i)].Value2 := Edit4.Text;

      with Hoja.Range['B'+inttostr(j),'B'+inttostr(i)] do
      begin
        Font.Size:=7;
        HorizontalAlignment := xlLeft;
        VerticalAlignment := xlCenter;
        Font.FontStyle := 'Bold';
        WrapText:= true;
      end;

      with Hoja.Range['C'+inttostr(j),'D'+inttostr(i)] do
      begin
        Font.Size:=7;
        HorizontalAlignment := xlLeft;
        VerticalAlignment := xlCenter;
        EntireColumn.NumberFormat := Format;
        WrapText:= true;
      end;
      i:=i+2;
      Hoja.Range['B'+IntToStr(i),'B'+IntToStr(i)].Value2 := 'GRACIAS POR SU PREFERENCIA';
      Hoja.Range['A'+inttostr(i),'D'+inttostr(i)].MergeCells := true;
    end;
  end;
  if not DirectoryExists('C:\SSM\Ticket\') then CreateDir('C:\SSM\Ticket\');
  Excel.ActiveWorkbook.SaveAs( ExtractFilePath( 'C:\SSM\Ticket\' ) + 'ticket No.'+ Label12.Caption +'.xlsx ',EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, xlNoChange, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 0);
  //ShowMessage( 'ticket No.'+ Label12.Caption+' Guardado en C:\SSM\Ticket\');
  Excel.Visible[1]:=False;
//aqui imprimo
  Excel.Worksheets.PrintOut(null, null, 1, null, null, null, null, null, 0);
  Excel.Quit;
end;

Última edición por jofebas fecha: 08-09-2011 a las 21:32:50.
Responder Con Cita
 



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
¿como imprimir a impresora (tickets)en delphi 2010 win32? JXJ Varios 5 22-09-2010 19:13:22
mis impresiones de Delphi 2007 droguerman Debates 16 13-11-2007 19:16:22
excel a delphi, como mostrar columnas de excel Vyckso Servers 2 13-08-2007 12:38:08
Log de impresiones? Ezecool Varios 0 21-04-2005 22:23:11
Log de impresiones? Ezecool Impresión 0 21-04-2005 22:12:13


La franja horaria es GMT +2. Ahora son las 20:20:06.


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