You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
4.0 KiB
160 lines
4.0 KiB
unit urelRecibosEmitidos;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, RLReport, RLFilters, RLPDFFilter,
|
|
Data.DB, ZAbstractRODataset, ZAbstractDataset, ZDataset;
|
|
|
|
type
|
|
TrelRecibosEmitidos = class(TForm)
|
|
fr_recibosemitidos: TRLReport;
|
|
dtsqryReport: TDataSource;
|
|
qryReport: TZQuery;
|
|
fr_filterpdf: TRLPDFFilter;
|
|
frbnd_header: TRLBand;
|
|
frpnl_logo: TRLPanel;
|
|
frdbimg_logo: TRLDBImage;
|
|
frlbl_titulorel: TRLLabel;
|
|
frbnd_columnheader: TRLBand;
|
|
frbnd_details: TRLBand;
|
|
qryReportNR_RECIBO: TWideStringField;
|
|
qryReportTX_NOME: TWideStringField;
|
|
qryReportTX_CPF: TWideStringField;
|
|
qryReportDT_IMPRESSAO: TDateTimeField;
|
|
frlbl_nrrecibo: TRLLabel;
|
|
frlbl_nomerecibo: TRLLabel;
|
|
frlbl_cpf: TRLLabel;
|
|
frlbl_vltotal: TRLLabel;
|
|
frlbl_dtimpressao: TRLLabel;
|
|
frdblbl_nrrecibo: TRLDBText;
|
|
frdblbl_nomerecibo: TRLDBText;
|
|
frdblbl_cpf: TRLDBText;
|
|
frdblbl_vltotal: TRLDBText;
|
|
frdblbl_dtimpressao: TRLDBText;
|
|
RLBand1: TRLBand;
|
|
frdbresult_sumvalor: TRLDBResult;
|
|
frbnd_footerrel: TRLBand;
|
|
RLSystemInfo2: TRLSystemInfo;
|
|
RLSystemInfo1: TRLSystemInfo;
|
|
frlbl_datas: TRLLabel;
|
|
dtsEmpresa: TDataSource;
|
|
qryReportID_USUARIO: TIntegerField;
|
|
qryReportTX_CAIXA: TStringField;
|
|
RLLabel1: TRLLabel;
|
|
RLDBText1: TRLDBText;
|
|
qryReportVL_CORRIGIDO: TFloatField;
|
|
frlbl_total: TRLLabel;
|
|
qryReportTP_CANCELADO: TWideStringField;
|
|
RLLabel2: TRLLabel;
|
|
RLDBText2: TRLDBText;
|
|
qryReportTX_CNPJ: TWideStringField;
|
|
qryReportTX_DOCUMENTO: TWideStringField;
|
|
procedure fr_recibosemitidosAfterPrint(Sender: TObject);
|
|
procedure fr_recibosemitidosBeforePrint(Sender: TObject;
|
|
var PrintIt: Boolean);
|
|
private
|
|
procedure SalvarRelPDF;
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
relRecibosEmitidos: TrelRecibosEmitidos;
|
|
|
|
meses: array [1 .. 12] of string = (
|
|
'JANEIRO',
|
|
'FEVEREIRO',
|
|
'MARCO',
|
|
'ABRIL',
|
|
'MAIO',
|
|
'JUNHO',
|
|
'JULHO',
|
|
'AGOSTO',
|
|
'SETEMBRO',
|
|
'OUTUBRO',
|
|
'NOVEMBRO',
|
|
'DEZEMBRO'
|
|
);
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem;
|
|
|
|
procedure TrelRecibosEmitidos.fr_recibosemitidosAfterPrint(Sender: TObject);
|
|
begin
|
|
SalvarRelPDF;
|
|
end;
|
|
|
|
procedure TrelRecibosEmitidos.fr_recibosemitidosBeforePrint(Sender: TObject;
|
|
var PrintIt: Boolean);
|
|
begin
|
|
if not dtsEmpresa.DataSet.Active then
|
|
begin
|
|
dtsEmpresa.DataSet.Open;
|
|
end;
|
|
if frdbimg_logo.Picture.Height > frdbimg_logo.Picture.Width then
|
|
begin
|
|
frdbimg_logo.Height := 170;
|
|
frdbimg_logo.Width := 133;
|
|
end;
|
|
if frdbimg_logo.Picture.Height < frdbimg_logo.Picture.Width then
|
|
begin
|
|
frdbimg_logo.Height := 133;
|
|
frdbimg_logo.Width := 170;
|
|
end;
|
|
if frdbimg_logo.Picture.Height = frdbimg_logo.Picture.Width then
|
|
begin
|
|
frdbimg_logo.Height := 133;
|
|
frdbimg_logo.Width := 133;
|
|
end;
|
|
end;
|
|
|
|
procedure TrelRecibosEmitidos.SalvarRelPDF;
|
|
var
|
|
path, file_name: string;
|
|
Fmt: TFormatSettings;
|
|
i: Integer;
|
|
begin
|
|
Fmt := TFormatSettings.Create;
|
|
for i := 0 to High(meses) do
|
|
begin
|
|
Fmt.LongMonthNames[i] := meses[i];
|
|
end;
|
|
// path := ExtractFilePath(Application.ExeName) + 'RELATORIOS';
|
|
path := dtmSystem.path_executavel + '\RELATORIOS';
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
ForceDirectories(path);
|
|
end;
|
|
path := path + '\RECIBOS_EMITIDOS';
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
ForceDirectories(path);
|
|
end;
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
ForceDirectories(path);
|
|
end;
|
|
path := path + '\' + FormatDateTime('mmmm', Date, Fmt);
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
ForceDirectories(path);
|
|
end;
|
|
path := path + '\' + FormatDateTime('dd', Date);
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
ForceDirectories(path);
|
|
end;
|
|
file_name := path + '\RECIBOS_EMITIDOS-' + FormatDateTime('HH-mm',
|
|
Time) + '.pdf';
|
|
fr_filterpdf.FileName := file_name;
|
|
fr_recibosemitidos.SaveToFile(file_name);
|
|
end;
|
|
|
|
end.
|