You've already forked lazarus-ccr
88 lines
1.8 KiB
ObjectPascal
88 lines
1.8 KiB
ObjectPascal
![]() |
unit tlMain;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||
|
Spin, PrintersDlgs, VpBaseDS, VpIniDs, VpDayView, VpPrtPrvDlg, VpPrtFmtCBox,
|
||
|
VpContactGrid, VpContactButtons, VpTaskList;
|
||
|
|
||
|
type
|
||
|
|
||
|
{ TForm1 }
|
||
|
|
||
|
TForm1 = class(TForm)
|
||
|
btnPrintPreview: TButton;
|
||
|
btnPrint: TButton;
|
||
|
Panel1: TPanel;
|
||
|
PrintDialog1: TPrintDialog;
|
||
|
VpControlLink1: TVpControlLink;
|
||
|
VpIniDatastore1: TVpIniDatastore;
|
||
|
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
|
||
|
VpPrintPreviewDialog1: TVpPrintPreviewDialog;
|
||
|
VpTaskList1: TVpTaskList;
|
||
|
procedure btnPrintPreviewClick(Sender: TObject);
|
||
|
procedure btnPrintClick(Sender: TObject);
|
||
|
procedure FormCreate(Sender: TObject);
|
||
|
private
|
||
|
|
||
|
public
|
||
|
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
Form1: TForm1;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{$R *.lfm}
|
||
|
|
||
|
uses
|
||
|
Printers, OSPrinters;
|
||
|
|
||
|
{ TForm1 }
|
||
|
|
||
|
procedure TForm1.btnPrintPreviewClick(Sender: TObject);
|
||
|
var
|
||
|
d1, d2: TDateTime;
|
||
|
begin
|
||
|
d1 := EncodeDate(2022, 10, 1);
|
||
|
d2 := EncodeDate(2022, 10, 31);
|
||
|
VpPrintPreviewDialog1.StartDate := d1;
|
||
|
VpPrintPreviewDialog1.EndDate := d2;
|
||
|
if VpPrintPreviewDialog1.Execute then
|
||
|
if PrintDialog1.Execute then begin
|
||
|
Printer.BeginDoc;
|
||
|
try
|
||
|
VpPrintPreviewDialog1.ControlLink.Printer.Print(Printer, d1, d2);
|
||
|
finally
|
||
|
Printer.EndDoc;
|
||
|
end;
|
||
|
end;
|
||
|
end;
|
||
|
|
||
|
procedure TForm1.btnPrintClick(Sender: TObject);
|
||
|
var
|
||
|
d1, d2: TDateTime;
|
||
|
begin
|
||
|
d1 := EncodeDate(2022, 10, 1);
|
||
|
d2 := EncodeDate(2022, 10, 31);
|
||
|
Printer.BeginDoc;
|
||
|
try
|
||
|
VpControlLink1.Printer.Print(Printer, d1, d2);
|
||
|
finally
|
||
|
Printer.EndDoc;
|
||
|
end;
|
||
|
end;
|
||
|
|
||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||
|
begin
|
||
|
if VpIniDatastore1.Resources.Count > 0 then
|
||
|
VpIniDatastore1.Resource := VpIniDatastore1.Resources.Items[0];
|
||
|
end;
|
||
|
|
||
|
end.
|
||
|
|