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.
173 lines
4.6 KiB
173 lines
4.6 KiB
unit urelAcordos;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, ZAbstractRODataset, ZDataset,
|
|
RLReport, RLFilters, RLPDFFilter;
|
|
|
|
type
|
|
TrelAcordos = class(TForm)
|
|
frrelAcordo: TRLReport;
|
|
dtsAcordo: TDataSource;
|
|
dtsOriginal: TDataSource;
|
|
zroqryAcordos: TZReadOnlyQuery;
|
|
zroqryOriginais: TZReadOnlyQuery;
|
|
RLBand1: TRLBand;
|
|
zroqryAcordosTX_NOME: TWideStringField;
|
|
zroqryAcordosTX_PRODUTO: TWideStringField;
|
|
zroqryAcordosID_TITULO: TIntegerField;
|
|
zroqryAcordosVL_TITULO: TFloatField;
|
|
zroqryOriginaisTX_NOME: TWideStringField;
|
|
zroqryOriginaisTX_PRODUTO: TWideStringField;
|
|
zroqryOriginaisID_TITULO: TIntegerField;
|
|
zroqryOriginaisVL_TITULO: TFloatField;
|
|
zroqryOriginaisID_PARCELA: TIntegerField;
|
|
RLDBText1: TRLDBText;
|
|
RLSubDetail1: TRLSubDetail;
|
|
RLBand2: TRLBand;
|
|
RLDBText2: TRLDBText;
|
|
RLBand3: TRLBand;
|
|
RLMemo1: TRLMemo;
|
|
RLDBText3: TRLDBText;
|
|
RLDBText4: TRLDBText;
|
|
RLBand5: TRLBand;
|
|
RLLabel5: TRLLabel;
|
|
RLDBText5: TRLDBText;
|
|
RLDBText6: TRLDBText;
|
|
zroqryAcordosDT_VENCIMENTO: TDateTimeField;
|
|
fr_filterpdf: TRLPDFFilter;
|
|
zroqryOriginaisID_DEVEDOR: TIntegerField;
|
|
zroqryOriginaisID_EMPRESA: TIntegerField;
|
|
zroqryOriginaisDT_ENTRADA: TDateTimeField;
|
|
zroqryOriginaisDT_VENCIMENTO: TDateTimeField;
|
|
zroqryOriginaisTP_SITUACAO: TWideStringField;
|
|
zroqryOriginaisCD_DEVEDOR: TWideStringField;
|
|
zroqryOriginaisTP_CHEQUE: TWideStringField;
|
|
zroqryOriginaisID_BANCO: TIntegerField;
|
|
zroqryOriginaisTX_NRCHEQUE: TWideStringField;
|
|
zroqryOriginaisTP_MOTIVO: TWideStringField;
|
|
zroqryOriginaisVL_DESPESA: TFloatField;
|
|
zroqryOriginaisTP_DESPESA: TWideStringField;
|
|
zroqryOriginaisVL_MULTA: TFloatField;
|
|
zroqryOriginaisVL_JUROS: TFloatField;
|
|
zroqryOriginaisVL_ENCARGOS: TFloatField;
|
|
zroqryOriginaisVL_CORRIGIDO: TFloatField;
|
|
zroqryOriginaisDT_PAGAMENTO: TDateTimeField;
|
|
zroqryOriginaisTX_OBS: TWideMemoField;
|
|
zroqryOriginaisID_ULTIMO_USUARIO: TIntegerField;
|
|
zroqryOriginaisDT_HORA_ULTIMA_ATT: TDateTimeField;
|
|
RLDBText10: TRLDBText;
|
|
frpnl_logo: TRLPanel;
|
|
frdbimg_logo: TRLDBImage;
|
|
RLLabel6: TRLLabel;
|
|
RLLabel3: TRLLabel;
|
|
RLLabel7: TRLLabel;
|
|
RLLabel11: TRLLabel;
|
|
zroqryAcordosQTDE_PARCELAS: TIntegerField;
|
|
RLDBText11: TRLDBText;
|
|
RLLabel1: TRLLabel;
|
|
RLDBText7: TRLDBText;
|
|
RLBand4: TRLBand;
|
|
RLDBResult1: TRLDBResult;
|
|
RLLabel4: TRLLabel;
|
|
procedure frrelAcordoAfterPrint(Sender: TObject);
|
|
procedure frdbimg_logoBeforePrint(Sender: TObject; var PrintIt: Boolean);
|
|
private
|
|
procedure SalvarReciboPDF;
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
relAcordos: TrelAcordos;
|
|
|
|
meses: array [1 .. 12] of string = (
|
|
'JANEIRO',
|
|
'FEVEREIRO',
|
|
'MARCO',
|
|
'ABRIL',
|
|
'MAIO',
|
|
'JUNHO',
|
|
'JULHO',
|
|
'AGOSTO',
|
|
'SETEMBRO',
|
|
'OUTUBRO',
|
|
'NOVEMBRO',
|
|
'DEZEMBRO'
|
|
);
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem;
|
|
|
|
{ TrelAcordos }
|
|
|
|
procedure TrelAcordos.frdbimg_logoBeforePrint(Sender: TObject;
|
|
var PrintIt: Boolean);
|
|
begin
|
|
if not dtmSystem.tblEmpresa.Active then
|
|
begin
|
|
dtmSystem.tblEmpresa.Open;
|
|
end;
|
|
end;
|
|
|
|
procedure TrelAcordos.frrelAcordoAfterPrint(Sender: TObject);
|
|
begin
|
|
SalvarReciboPDF;
|
|
end;
|
|
|
|
procedure TrelAcordos.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-ACORDOS-' + FormatDateTime('HH-mm',
|
|
Time) + '.pdf';
|
|
fr_filterpdf.FileName := file_name;
|
|
frrelAcordo.SaveToFile(file_name);
|
|
end;
|
|
|
|
end.
|