📄 financialstmtreport.pas
字号:
end else if tblGLBudgetGLYear.value = frmGLReports.GLYear then begin
//Showmessage(AccountFrom + '/' + AccountTo + ' This yr ' + tblGLBudgetGLAccount.value + ' ' + tblGLBudgetGLYear.AsString);
BudgetAmountsThisYr[0] := BudgetAmountsThisYr[0] + tblGLBudgetOpeningBal.AsCurrency;
BudgetAmountsThisYr[1] := BudgetAmountsThisYr[1] + tblGLBudgetAmount1.AsCurrency;
BudgetAmountsThisYr[2] := BudgetAmountsThisYr[2] + tblGLBudgetAmount2.AsCurrency;
BudgetAmountsThisYr[3] := BudgetAmountsThisYr[3] + tblGLBudgetAmount3.AsCurrency;
BudgetAmountsThisYr[4] := BudgetAmountsThisYr[4] + tblGLBudgetAmount4.AsCurrency;
BudgetAmountsThisYr[5] := BudgetAmountsThisYr[5] + tblGLBudgetAmount5.AsCurrency;
BudgetAmountsThisYr[6] := BudgetAmountsThisYr[6] + tblGLBudgetAmount6.AsCurrency;
BudgetAmountsThisYr[7] := BudgetAmountsThisYr[7] + tblGLBudgetAmount7.AsCurrency;
BudgetAmountsThisYr[8] := BudgetAmountsThisYr[8] + tblGLBudgetAmount8.AsCurrency;
BudgetAmountsThisYr[9] := BudgetAmountsThisYr[9] + tblGLBudgetAmount9.AsCurrency;
BudgetAmountsThisYr[10] := BudgetAmountsThisYr[10] + tblGLBudgetAmount10.AsCurrency;
BudgetAmountsThisYr[11] := BudgetAmountsThisYr[11] + tblGLBudgetAmount11.AsCurrency;
BudgetAmountsThisYr[12] := BudgetAmountsThisYr[12] + tblGLBudgetAmount12.AsCurrency;
end;
tblGLBudget.next;
end;
end;
end;
procedure TrptFinancialStmt.FormCreate(Sender: TObject);
var
PeriodColumnHeading: string;
begin
qryFStmtLin.DatabaseName := strDatabaseName;
tblFStmtLAc.DatabaseName := strDatabaseName;
tblGLActual.DatabaseName := strDatabaseName;
tblGLBudget.DatabaseName := strDatabaseName;
tblFStmtLTo.DatabaseName := strDatabaseName;
qryFStmtLin.Params[0].AsInteger := frmGLReports.tblFStmtStmtID.value;
qryFStmtLin.Active := true;
tblFStmtLAc.Active := true;
tblFStmtLTo.Active := true;
tblGLActual.Active := true;
if (frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare budget') or (frmGLReports.tblFStmtColumnFormat.value = 'Balance: Compare budget') then tblGLBudget.Active := true;
QuickReport.ReportTitle := frmGLReports.tblFStmtStmtTitle.value;
lblCompanyName.caption := frmBS1.tblCompanyCompanyName.value;
if frmGLReports.GLPeriod <10 then lblPeriod.caption := 'Period: 0' + IntToStr(frmGLReports.GLPeriod) + '/' + IntToStr(frmGLReports.GLYear)
else lblPeriod.caption := 'Period: ' + IntToStr(frmGLReports.GLPeriod) + '/' + IntToStr(frmGLReports.GLYear);
if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Simple' then begin
txtColumn1.DataField := 'ActChgThisMon'; lblColumn1.caption := 'This Period'; lblColumn1.enabled := true;
txtColumn2.DataField := 'ActChgYTD'; lblColumn2.caption := 'Year to Date'; lblColumn2.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare month' then begin
txtColumn1.DataField := 'ActChgThisMon'; lblColumn1.caption := 'This Period'; lblColumn1.enabled := true;
txtColumn2.DataField := 'ActChgLastMon'; lblColumn2.caption := 'Last Period'; lblColumn2.enabled := true;
txtColumn3.DataField := 'Variance1'; lblColumn3.caption := 'Variance'; lblColumn3.enabled := true;
txtColumn4.DataField := 'ActChgYTD'; lblColumn4.caption := 'Year to Date'; lblColumn4.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare year' then begin
txtColumn1.DataField := 'ActChgThisMon'; lblColumn1.caption := 'This Year'; lblColumn1.enabled := true;
txtColumn2.DataField := 'ActChgThisMonLastYr'; lblColumn2.caption := 'Last Year'; lblColumn2.enabled := true;
txtColumn3.DataField := 'Variance1'; lblColumn3.caption := 'Variance'; lblColumn3.enabled := true;
txtColumn4.DataField := 'ActChgYTD'; lblColumn4.caption := 'This YTD'; lblColumn4.enabled := true;
txtColumn5.DataField := 'ActChgYTDLastYr'; lblColumn5.caption := 'Last YTD'; lblColumn5.enabled := true;
txtColumn6.DataField := 'Variance2'; lblColumn6.caption := 'Variance'; lblColumn6.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare budget' then begin
txtColumn1.DataField := 'ActChgThisMon'; lblColumn1.caption := 'Actual'; lblColumn1.enabled := true;
txtColumn2.DataField := 'BudChgThisMon'; lblColumn2.caption := 'Budget'; lblColumn2.enabled := true;
txtColumn3.DataField := 'Variance1'; lblColumn3.caption := 'Variance'; lblColumn3.enabled := true;
txtColumn4.DataField := 'ActChgYTD'; lblColumn4.caption := 'Actual YTD'; lblColumn4.enabled := true;
txtColumn5.DataField := 'BudChgYTD'; lblColumn5.caption := 'Budget YTD'; lblColumn5.enabled := true;
txtColumn6.DataField := 'Variance2'; lblColumn6.caption := 'Variance'; lblColumn6.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Balance: Simple' then begin
txtColumn1.DataField := 'ActBalThisMon'; lblColumn1.caption := 'Balance'; lblColumn1.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Balance: Compare year' then begin
txtColumn1.DataField := 'ActBalThisMon'; lblColumn1.caption := 'This Year'; lblColumn1.enabled := true;
txtColumn2.DataField := 'ActBalThisMonLastYr'; lblColumn2.caption := 'Last Year'; lblColumn2.enabled := true;
txtColumn3.DataField := 'Variance1'; lblColumn3.caption := 'Variance'; lblColumn3.enabled := true;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Balance: Compare budget' then begin
txtColumn1.DataField := 'ActBalThisMon'; lblColumn1.caption := 'Actual'; lblColumn1.enabled := true;
txtColumn2.DataField := 'BudBalThisMon'; lblColumn2.caption := 'Budget'; lblColumn2.enabled := true;
txtColumn3.DataField := 'Variance1'; lblColumn3.caption := 'Variance'; lblColumn3.enabled := true;
end;
end;
procedure TrptFinancialStmt.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TrptFinancialStmt.qryFStmtLinCalcFields(DataSet: TDataSet);
begin
if qryFStmtLinLineType.value = 'Heading' then exit;
for x := 0 to 12 do ActualAmountsThisYr[x] := 0;
for x := 0 to 12 do ActualAmountsLastYr[x] := 0;
for x := 0 to 12 do BudgetAmountsThisYr[x] := 0;
for x := 0 to 12 do BudgetAmountsLastYr[x] := 0;
if qryFStmtLinLineType.value = 'Detail' then GetLineAmounts(qryFStmtLinStmtID.value, qryFStmtLinSeq.value)
else if qryFStmtLinLineType.value = 'Total' then begin
if tblFStmtLTo.locate('StmtID;TotalLineSeq',VarArrayOf([qryFStmtLinStmtID.value,qryFStmtLinSeq.value]), []) = true then begin //Get lines to add to this total line.
while (tblFStmtLToStmtID.value = qryFStmtLinStmtID.value) and (tblFStmtLToTotalLineSeq.value = qryFStmtLinSeq.value) and (not tblFStmtLTo.eof) do begin
//showmessage(qryFStmtLinStmtID.AsString + '/' + qryFStmtLinSeq.AsString + ' ' + tblFStmtLToStmtID.AsString + '/' + tblFStmtLToTotalLineSeq.AsString + ' ' + tblFStmtLToSeq.AsString);
GetLineAmounts(qryFStmtLinStmtID.value, tblFStmtLToSeq.value);
tblFStmtLTo.next;
end;
end;
end;
qryFStmtLinActChgThisMon.AsCurrency := ActualAmountsThisYr[frmGLReports.GLPeriod];
if frmGLReports.GLPeriod >1 then qryFStmtLinActChgLastMon.AsCurrency := ActualAmountsThisYr[(frmGLReports.GLPeriod -1)]
else qryFStmtLinActChgLastMon.AsCurrency := ActualAmountsLastYr[12];
qryFStmtLinActChgThisMonLastYr.AsCurrency := ActualAmountsLastYr[frmGLReports.GLPeriod];
qryFStmtLinActChgYTD.AsCurrency := 0; for x := 1 to frmGLReports.GLPeriod do qryFStmtLinActChgYTD.AsCurrency := qryFStmtLinActChgYTD.AsCurrency + ActualAmountsThisYr[x];
qryFStmtLinActChgYTDLastYr.AsCurrency := 0; for x := 1 to frmGLReports.GLPeriod do qryFStmtLinActChgYTDLastYr.AsCurrency := qryFStmtLinActChgYTDLastYr.AsCurrency + ActualAmountsLastYr[x];
qryFStmtLinActBalThisMon.AsCurrency := 0; for x := 0 to frmGLReports.GLPeriod do qryFStmtLinActBalThisMon.AsCurrency := qryFStmtLinActBalThisMon.AsCurrency + ActualAmountsThisYr[x];
qryFStmtLinActBalThisMonLastYr.AsCurrency := 0; for x := 0 to frmGLReports.GLPeriod do qryFStmtLinActBalThisMonLastYr.AsCurrency := qryFStmtLinActBalThisMonLastYr.AsCurrency + ActualAmountsLastYr[x];
qryFStmtLinBudChgThisMon.AsCurrency := BudgetAmountsThisYr[frmGLReports.GLPeriod];
qryFStmtLinBudChgYTD.AsCurrency := 0; for x := 1 to frmGLReports.GLPeriod do qryFStmtLinBudChgYTD.AsCurrency := qryFStmtLinBudChgYTD.AsCurrency + BudgetAmountsThisYr[x];
qryFStmtLinBudBalThisMon.AsCurrency := 0; for x := 0 to frmGLReports.GLPeriod do qryFStmtLinBudBalThisMon.AsCurrency := qryFStmtLinBudBalThisMon.AsCurrency + BudgetAmountsThisYr[x];
if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare month' then begin
qryFStmtLinVariance1.AsCurrency := qryFStmtLinActChgThisMon.AsCurrency - qryFStmtLinActChgLastMon.AsCurrency;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare year' then begin
qryFStmtLinVariance1.AsCurrency := qryFStmtLinActChgThisMon.AsCurrency - qryFStmtLinActChgThisMonLastYr.AsCurrency;
qryFStmtLinVariance2.AsCurrency := qryFStmtLinActChgYTD.AsCurrency - qryFStmtLinActChgYTDLastYr.AsCurrency;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Net Change: Compare budget' then begin
qryFStmtLinVariance1.AsCurrency := qryFStmtLinActChgThisMon.AsCurrency - qryFStmtLinBudChgThisMon.AsCurrency;
qryFStmtLinVariance2.AsCurrency := qryFStmtLinActChgYTD.AsCurrency - qryFStmtLinBudChgYTD.AsCurrency;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Balance: Compare year' then begin
qryFStmtLinVariance1.AsCurrency := qryFStmtLinActBalThisMon.AsCurrency - qryFStmtLinActBalThisMonLastYr.AsCurrency;
end else if frmGLReports.tblFStmtColumnFormat.value = 'Balance: Compare budget' then begin
qryFStmtLinVariance1.AsCurrency := qryFStmtLinActBalThisMon.AsCurrency - qryFStmtLinBudBalThisMon.AsCurrency;
end;
end;
procedure TrptFinancialStmt.DetailBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
if qryFStmtLinLineType.value = 'Heading' then begin
txtLineHeading.Font.Style := [fsBold];
txtLineHeading.left := 12;
Detail.height := 18;
txtLineHeading.top := 0;
txtColumn1.top := 0;
txtColumn2.top := 0;
txtColumn3.top := 0;
txtColumn4.top := 0;
txtColumn5.top := 0;
txtColumn6.top := 0;
lineColumn1.enabled := false;
lineColumn2.enabled := false;
lineColumn3.enabled := false;
lineColumn4.enabled := false;
lineColumn5.enabled := false;
lineColumn6.enabled := false;
end else if qryFStmtLinLineType.value = 'Detail' then begin
txtLineHeading.Font.Style := [];
txtLineHeading.left := 36;
Detail.height := 16;
txtLineHeading.top := 0;
txtColumn1.top := 0;
txtColumn2.top := 0;
txtColumn3.top := 0;
txtColumn4.top := 0;
txtColumn5.top := 0;
txtColumn6.top := 0;
lineColumn1.enabled := false;
lineColumn2.enabled := false;
lineColumn3.enabled := false;
lineColumn4.enabled := false;
lineColumn5.enabled := false;
lineColumn6.enabled := false;
end else if qryFStmtLinLineType.value = 'Total' then begin
txtLineHeading.Font.Style := [];
txtLineHeading.left := 24;
Detail.height := 20;
txtLineHeading.top := 4;
txtColumn1.top := 4;
txtColumn2.top := 4;
txtColumn3.top := 4;
txtColumn4.top := 4;
txtColumn5.top := 4;
txtColumn6.top := 4;
if lblColumn1.enabled = true then lineColumn1.enabled := true;
if lblColumn2.enabled = true then lineColumn2.enabled := true;
if lblColumn3.enabled = true then lineColumn3.enabled := true;
if lblColumn4.enabled = true then lineColumn4.enabled := true;
if lblColumn5.enabled = true then lineColumn5.enabled := true;
if lblColumn6.enabled = true then lineColumn6.enabled := true;
end;
end;
procedure TrptFinancialStmt.QuickReportPreview(Sender: TObject);
begin
frmPreview := TfrmPreview.Create(Application);
frmPreview.QRPreview1.QRPrinter := TQRPrinter(sender);
frmPreview.QuickReport := QuickReport; //Set dummy quickreport so as to be able to apply selected printer and from/to page.
frmPreview.show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -