📄 ap250report.~pas
字号:
unit AP250Report;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BaseReport, DB, DBTables, QRCtrls, QuickRpt, ExtCtrls;
type
TqrAP250 = class(TQuickReport)
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel13: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRBand1: TQRBand;
QRExpr1: TQRExpr;
QRExpr2: TQRExpr;
QRExpr3: TQRExpr;
QRExpr4: TQRExpr;
QRExpr5: TQRExpr;
QRExpr6: TQRExpr;
QRLabel14: TQRLabel;
QRLabel15: TQRLabel;
UpdateSQL1: TUpdateSQL;
qyReportSupplierID: TStringField;
qyReportSupplierAttribName: TStringField;
qyReportAP0030: TIntegerField;
qyReportAP3160: TIntegerField;
qyReportAP6190: TIntegerField;
qyReportAP9120: TIntegerField;
qyReportAP1200: TIntegerField;
qyReportAPTOTL: TIntegerField;
procedure qyReportBeforeOpen(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
procedure PrepareReport; override;
end;
var
qrAP250: TqrAP250;
implementation
uses DataModule, Main, PublicFunction;
{$R *.dfm}
{ TqrAP250 }
procedure TqrAP250.PrepareReport;
var
sTempDate, sYearMonth : String;
M0030, M3160, M6190, M9120, M1200 : String;
begin
inherited;
M0030 := DM.tbInput.FieldByName('BeginYear').AsString +
DM.tbInput.FieldByName('BeginMonth').AsString;
sTempDate := DecMonth(DM.tbInput.FieldByName('BeginYear').AsString + '-' +
DM.tbInput.FieldByName('BeginMonth').AsString + '-01', 1);
M3160 := LeftStr(sTempDate, 2) + SubStr(sTempDate, 4, 2);
sTempDate := DecMonth(DM.tbInput.FieldByName('BeginYear').AsString + '-' +
DM.tbInput.FieldByName('BeginMonth').AsString + '-01', 2);
M6190 := LeftStr(sTempDate, 2) + SubStr(sTempDate, 4, 2);
sTempDate := DecMonth(DM.tbInput.FieldByName('BeginYear').AsString + '-' +
DM.tbInput.FieldByName('BeginMonth').AsString + '-01', 3);
M9120 := LeftStr(sTempDate, 2) + SubStr(sTempDate, 4, 2);
sTempDate := DecMonth(DM.tbInput.FieldByName('BeginYear').AsString + '-' +
DM.tbInput.FieldByName('BeginMonth').AsString + '-01', 4);
M1200 := LeftStr(sTempDate, 2) + SubStr(sTempDate, 4, 2);
with DM.qyTemp1 do
begin
Close;
SQL.Clear;
SQL.Add('SELECT SupplierID, PurchaseDate, ');
SQL.Add('(AccountPayable - Paid) AS UnAccountPayable ');
SQL.Add('FROM PurchaseMaster ');
SQL.Add('WHERE CompanyID = :CompanyID ');
SQL.Add('AND PurchaseDate <= :PurchaseDate ');
SQL.Add('AND SupplierID >= :BeginSupplierID AND SupplierID <= :EndSupplierID ');
SQL.Add('AND PurchaseProperty IN (''5'', ''6'') ');
SQL.Add('AND AccountPayable <> Paid ');
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('PurchaseDate').AsString := DM.tbInput.FieldByName('BeginYear').AsString + '-' +
DM.tbInput.FieldByName('BeginMonth').AsString + '-31';
ParamByName('BeginSupplierID').AsString := DM.tbInput.FieldByName('BeginSupplierID').AsString;
ParamByName('EndSupplierID').AsString := DM.tbInput.FieldByName('EndSupplierID').AsString;
Open;
end;
DM.qyTemp1.First;
while not DM.qyTemp1.Eof do
begin
sYearMonth := LeftStr(DM.qyTemp1.FieldByName('PurchaseDate').AsString, 2) +
SubStr(DM.qyTemp1.FieldByName('PurchaseDate').AsString, 4, 2);
if qyReport.Locate('SupplierID', DM.qyTemp1.FieldByName('SupplierID').AsString, []) then
begin
qyReport.Edit;
if sYearMonth = M0030 then
qyReport.FieldByName('AP0030').AsFloat :=
qyReport.FieldByName('AP0030').AsFloat +
DM.qyTemp1.FieldByName('UnAccountPayable').AsFloat;
if sYearMonth = M3160 then
qyReport.FieldByName('AP3160').AsFloat :=
qyReport.FieldByName('AP3160').AsFloat +
DM.qyTemp1.FieldByName('UnAccountPayable').AsFloat;
if sYearMonth = M6190 then
qyReport.FieldByName('AP6190').AsFloat :=
qyReport.FieldByName('AP6190').AsFloat +
DM.qyTemp1.FieldByName('UnAccountPayable').AsFloat;
if sYearMonth = M9120 then
qyReport.FieldByName('AP9120').AsFloat :=
qyReport.FieldByName('AP9120').AsFloat +
DM.qyTemp1.FieldByName('UnAccountPayable').AsFloat;
if sYearMonth <= M1200 then
qyReport.FieldByName('AP1200').AsFloat :=
qyReport.FieldByName('AP1200').AsFloat +
DM.qyTemp1.FieldByName('UnAccountPayable').AsFloat;
qyReport.Post;
end;
DM.qyTemp1.Next;
end;
qyReport.First;
while not qyReport.Eof do
begin
qyReport.Edit;
qyReport.FieldByName('APTOTL').AsFloat :=
qyReport.FieldByName('AP0030').AsFloat +
qyReport.FieldByName('AP3160').AsFloat +
qyReport.FieldByName('AP6190').AsFloat +
qyReport.FieldByName('AP9120').AsFloat +
qyReport.FieldByName('AP1200').AsFloat;
qyReport.Post;
if (qyReport.FieldByName('AP0030').AsFloat = 0) and
(qyReport.FieldByName('AP3160').AsFloat = 0) and
(qyReport.FieldByName('AP6190').AsFloat = 0) and
(qyReport.FieldByName('AP9120').AsFloat = 0) and
(qyReport.FieldByName('AP1200').AsFloat = 0) and
(qyReport.FieldByName('APTOTL').AsFloat = 0) then
begin
qyReport.Delete;
Continue;
end;
qyReport.Next;
end;
end;
procedure TqrAP250.qyReportBeforeOpen(DataSet: TDataSet);
begin
inherited;
with qyReport do
begin
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('BeginSupplierID').AsString := DM.tbInput.FieldByName('BeginSupplierID').AsString;
ParamByName('EndSupplierID').AsString := DM.tbInput.FieldByName('EndSupplierID').AsString;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -