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;
Excel.Connect;
Excel.WorkBooks.Add(NULL,0);
Hoja := Excel.Worksheets.Item[1] as _WorkSheet;
Hoja.Name := 'REPORTE';
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);
Excel.Visible[1]:=False;
Excel.Worksheets.PrintOut(null, null, 1, null, null, null, null, null, 0);
Excel.Quit;
end;