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.
185 lines
4.3 KiB
185 lines
4.3 KiB
unit urelRelacaoAcordo;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, RLReport, Data.DB, ZAbstractRODataset,
|
|
ZDataset, RLFilters, RLPDFFilter;
|
|
|
|
type
|
|
TrelRelacaoAcordo = class(TForm)
|
|
frrelRelacaoAcordo: TRLReport;
|
|
dts1: TDataSource;
|
|
zroqry1: TZReadOnlyQuery;
|
|
dts2: TDataSource;
|
|
zroqry2: TZReadOnlyQuery;
|
|
RLGroup1: TRLGroup;
|
|
RLBand2: TRLBand;
|
|
RLDBText2: TRLDBText;
|
|
dts3: TDataSource;
|
|
zroqry3: TZReadOnlyQuery;
|
|
zroqry1ID_ACORDO: TIntegerField;
|
|
zroqry1TX_NOME: TWideStringField;
|
|
RLSubDetail1: TRLSubDetail;
|
|
RLSubDetail2: TRLSubDetail;
|
|
RLBand1: TRLBand;
|
|
RLDBText1: TRLDBText;
|
|
RLBand3: TRLBand;
|
|
RLDBText3: TRLDBText;
|
|
RLBand4: TRLBand;
|
|
RLMemo1: TRLMemo;
|
|
frpnl_logo: TRLPanel;
|
|
frdbimg_logo: TRLDBImage;
|
|
RLBand5: TRLBand;
|
|
RLLabel1: TRLLabel;
|
|
RLLabel2: TRLLabel;
|
|
zroqry2ID_ACORDO: TIntegerField;
|
|
zroqry2ID_ORIGINAL: TIntegerField;
|
|
zroqry2TX_PRODUTO: TWideStringField;
|
|
zroqry2DT_VENCIMENTO: TDateTimeField;
|
|
zroqry2VL_TITULO: TFloatField;
|
|
zroqry2COUNT: TIntegerField;
|
|
RLLabel3: TRLLabel;
|
|
RLLabel4: TRLLabel;
|
|
RLDBText4: TRLDBText;
|
|
RLDBText5: TRLDBText;
|
|
RLBand6: TRLBand;
|
|
RLBand7: TRLBand;
|
|
RLDBResult1: TRLDBResult;
|
|
RLLabel5: TRLLabel;
|
|
RLLabel6: TRLLabel;
|
|
RLLabel7: TRLLabel;
|
|
RLLabel8: TRLLabel;
|
|
zroqry3ID_ACORDO: TIntegerField;
|
|
zroqry3ID_PARCELA: TIntegerField;
|
|
zroqry3TX_PRODUTO: TWideStringField;
|
|
zroqry3DT_VENCIMENTO: TDateTimeField;
|
|
zroqry3VL_TITULO: TFloatField;
|
|
zroqry3COUNT: TIntegerField;
|
|
RLBand8: TRLBand;
|
|
RLDBResult2: TRLDBResult;
|
|
RLDBText6: TRLDBText;
|
|
RLDBText7: TRLDBText;
|
|
dtsAcordo: TDataSource;
|
|
zroqryAcordos: TZReadOnlyQuery;
|
|
fr_filterpdf: TRLPDFFilter;
|
|
RLBand9: TRLBand;
|
|
RLSystemInfo1: TRLSystemInfo;
|
|
procedure frrelRelacaoAcordoAfterPrint(Sender: TObject);
|
|
procedure RLBand2BeforePrint(Sender: TObject; var PrintIt: Boolean);
|
|
procedure FormCreate(Sender: TObject);
|
|
private
|
|
print_it: integer;
|
|
procedure SalvarReciboPDF;
|
|
{ Private declarations }
|
|
public
|
|
rel_acordo: boolean;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
relRelacaoAcordo: TrelRelacaoAcordo;
|
|
|
|
meses: array [1 .. 12] of string = (
|
|
'JANEIRO',
|
|
'FEVEREIRO',
|
|
'MARCO',
|
|
'ABRIL',
|
|
'MAIO',
|
|
'JUNHO',
|
|
'JULHO',
|
|
'AGOSTO',
|
|
'SETEMBRO',
|
|
'OUTUBRO',
|
|
'NOVEMBRO',
|
|
'DEZEMBRO'
|
|
);
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem;
|
|
|
|
{ TrelRelacaoAcordo }
|
|
|
|
procedure TrelRelacaoAcordo.FormCreate(Sender: TObject);
|
|
begin
|
|
print_it := -1;
|
|
end;
|
|
|
|
procedure TrelRelacaoAcordo.frrelRelacaoAcordoAfterPrint(Sender: TObject);
|
|
begin
|
|
if rel_acordo = false then
|
|
begin
|
|
SalvarReciboPDF;
|
|
end;
|
|
end;
|
|
|
|
procedure TrelRelacaoAcordo.RLBand2BeforePrint(Sender: TObject;
|
|
var PrintIt: Boolean);
|
|
begin
|
|
if print_it <> dts1.DataSet.RecNo then
|
|
begin
|
|
PrintIt := true;
|
|
print_it := dts1.DataSet.RecNo;
|
|
end
|
|
else
|
|
begin
|
|
PrintIt := false;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TrelRelacaoAcordo.SalvarReciboPDF;
|
|
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
|
|
CreateDir(path);
|
|
end;
|
|
path := path + '\PRESTACAO_CONTAS';
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
CreateDir(path);
|
|
end;
|
|
path := path + '\' + dtmSystem.tblCHGEmpresaTX_NOME.AsString;
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
CreateDir(path);
|
|
end;
|
|
path := TrimRight(path);
|
|
path := path + '\' + FormatDateTime('YYYY', Date);
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
CreateDir(path);
|
|
end;
|
|
path := path + '\' + FormatDateTime('mmmm', Date, Fmt);
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
CreateDir(path);
|
|
end;
|
|
path := path + '\' + FormatDateTime('dd', Date);
|
|
if not DirectoryExists(path) then
|
|
begin
|
|
CreateDir(path);
|
|
end;
|
|
file_name := path + '\RELATORIO_PRESTACAO_CONTAS-RELACAO-ACORDOS-' +
|
|
FormatDateTime('HH-mm', Time) + '.pdf';
|
|
fr_filterpdf.FileName := file_name;
|
|
frrelRelacaoAcordo.SaveToFile(file_name);
|
|
end;
|
|
|
|
end.
|