I am trying to get this report to use the date table and display all the end of month within a period. If the customer Ledger Entry posting date field does not have posting for a particular month the report should display the missing month+ year and display zero next to it. For example a customer has the following details in the cust. ledger…
Posting date Amount
01/01/09 200
0102/09 300
01/06/09 100
And supposting a filter was set to display between Jan 2009 and August 2009, i want the report to display
01/01/09 200
01/02/09 300
31/03/09 0
30/04/09 0
31/05/09 0
01/06/09 100
31/07/09 0
31/08/09 0
Even though there was no entry for the zero amounts but still the months that were skipped is being displayed on the report with entry amount of zero.
Below is the current report that i have and i want to do the modifications to reflect the above. Can someone please help me?
[code]OBJECT Report 50005 MortgageStatementfor Housing
{
OBJECT-PROPERTIES
{
Date=30/07/08;
Time=14:27:57;
Modified=Yes;
Version List=NCM/MLS;
}
PROPERTIES
{
OnPreReport=BEGIN
DateFilt:=Customer.GETFILTER(Customer.“Date Filter”);
CompanyInformation.GET;
CompanyInformation.CALCFIELDS(Picture);
END;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table18;
DataItemTableView=SORTING(No.)
ORDER(Ascending)
WHERE(Fin. Charge Terms Code=FILTER(<>’’));
NewPagePerRecord=Yes;
PrintOnlyIfDetail=Yes;
OnPreDataItem=BEGIN
IF “Cust. Ledger Entry”.GETFILTERS <> ‘’ THEN
FilterText := 'Filter: ’ + “Cust. Ledger Entry”.GETFILTERS;
//Customer.SETFILTER(“No.”,‘BAK/A11’);
END;
OnAfterGetRecord=BEGIN
FinChrgTerm.GET(“Fin. Charge Terms Code”);
IF NOT FinChrgTerm.GET(“Fin. Charge Terms Code”) THEN
FinChrgTerm.“Interest Rate” :=0;
END;
ReqFilterFields=No.,Date Filter;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
PrintOnEveryPage=Yes;
SectionWidth=19650;
SectionHeight=6768;
}
CONTROLS
{
{ 1000000002;TextBox;15000;0 ;3150 ;423 ;HorzAlign=Right;
SourceExpr=FORMAT(TODAY,0,4) }
{ 1000000003;TextBox;0 ;423 ;2850 ;423 ;Visible=No;
Enabled=No;
SourceExpr=COMPANYNAME }
{ 1000000004;TextBox;17700;423 ;450 ;423 ;CaptionML=ENU=Page;
SourceExpr=CurrReport.PAGENO }
{ 1000000005;Label ;16950;423 ;750 ;423 ;ParentControl=1000000004 }
{ 1000000042;Label ;4650 ;5499 ;9900 ;423 ;HorzAlign=Center;
FontSize=10;
FontBold=Yes;
CaptionML=ENU=MORTGAGE STATEMENT }
{ 1000000050;Label ;6600 ;5922 ;2250 ;423 ;Visible=No;
HorzAlign=Center;
FontSize=10;
FontBold=Yes;
CaptionML=ENU=AS AT }
{ 1000000027;TextBox;8400 ;5922 ;5400 ;423 ;Visible=No;
FontSize=9;
FontBold=Yes;
SourceExpr=GETFILTER(“Date Filter”) }
{ 1000000001;PictureBox;4500;0 ;9150 ;5076 ;SourceExpr=CompanyInformation.Picture }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=19650;
SectionHeight=3384;
}
CONTROLS
{
{ 1000000008;TextBox;3150 ;0 ;1500 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=“No.” }
{ 1000000009;Label ;0 ;0 ;3000 ;423 ;ParentControl=1000000008;
FontSize=8;
FontBold=Yes }
{ 1000000011;TextBox;3150 ;423 ;6150 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=Name }
{ 1000000012;Label ;0 ;423 ;3000 ;423 ;ParentControl=1000000011;
FontSize=8;
FontBold=Yes }
{ 1000000014;TextBox;12300;423 ;3000 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=“Monthly Install” }
{ 1000000015;Label ;9600 ;423 ;2250 ;423 ;ParentControl=1000000014;
FontSize=8;
FontBold=Yes }
{ 1000000017;TextBox;3150 ;1269 ;1800 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=“Loan Amount” }
{ 1000000018;Label ;0 ;1269 ;3000 ;423 ;ParentControl=1000000017;
FontSize=8;
FontBold=Yes;
CaptionML=ENU=Plot Cost }
{ 1000000020;TextBox;3150 ;1692 ;1800 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=“Down Payment” }
{ 1000000021;Label ;0 ;1692 ;3000 ;423 ;ParentControl=1000000020;
FontSize=8;
FontBold=Yes }
{ 1000000023;TextBox;3150 ;2115 ;1500 ;423 ;HorzAlign=Left;
FontSize=8;
SourceExpr=“Plot No.” }
{ 1000000024;Label ;0 ;2115 ;3000 ;423 ;ParentControl=1000000023;
FontSize=8;
FontBold=Yes }
{ 1000000036;TextBox;12300;1269 ;1800 ;423 ;HorzAlign=Left;
SourceExpr=FinChrgTerm.“Interest Rate” }
{ 1000000026;Label ;9600 ;1269 ;2100 ;423 ;FontSize=8;
FontBold=Yes;
CaptionML=ENU=Interest Rate }
}
}
}
}
{ PROPERTIES
{
DataItemIndent=1;
DataItemTable=Table21;
DataItemTableView=SORTING(Customer No.,Posting Date)
WHERE(Reversed=CONST(No));
OnPreDataItem=BEGIN
//“Cust. Ledger Entry”.SETFILTER(“Posting Date”,DateFilt);
FinchargeTotal:=0;
PrincipalTotal:=0;
ArreasVarTotal:=0;
CustBal1 := 0;
TotCustBal1:=0;
NumPayments:=0;
END;
OnAfterGetRecord=BEGIN
Fincharge:=0;
Principal:=0;
ArreasVar:=0;
//NumPayments:=0;
CustBal :=CustBal+“Cust. Ledger Entry”.Amount;
TotalCustBal := “Detailed Cust. Ledg. Entry”.“Amount (LCY)”;
CustBal1 := “Cust. Ledger Entry”. Amount;
//CustBal :=CustBal + “Cust. Ledger Entry”. Amount;
TotCustBal1 += CustBal1;
FromDate := 010107D;
ToDate := TODAY;
//Amount := 0;
CustLedEntryMonth := ‘’;
MonthsArrears := 0;
//Code to Count Months
IF (FromDate <> 0D) AND (ToDate > FromDate) THEN BEGIN
Calendar.RESET;
Calendar.SETRANGE(“Period Type”,Calendar.“Period Type”::Month);
Calendar.SETRANGE(“Period Start”,FromDate,ToDate);
Months := Calendar.COUNT - 1;
END ELSE
Months := 0;
//Code to count two or more Payments as one in a particular month.
IF (“Document Type” = “Document Type”::Payment) AND
(InitMonth <> DATE2DMY(“Posting Date”,2) ) THEN BEGIN
NumPayments := NumPayments +1;
InitMonth:= DATE2DMY(“Posting Date”,2);
END;
MonOwed:= Months - NumPayments;
OtherArrears := MonOwed * -Customer.“Monthly Install”;
TotArrs := OtherArrears + ArreasVarTotal;
IF “Document Type”=0 THEN BEGIN
Amount := CustBal1-CustBal1;
END;
IF “Document Type”=“Document Type”:: Invoice THEN BEGIN
Amount := CustBal1-CustBal1;
END;
IF “Document Type”=“Document Type”:: Refund THEN BEGIN
Amount := CustBal1-CustBal1;
END;
IF “Document Type”=“Document Type”:: Refund THEN BEGIN
CustBal1 := Amount;
END;
//TotCustBal1+=CustBal1;
IF “Document Type”=“Document Type”:: “Finance Charge Memo” THEN BEGIN
// Fincharge :=-ABS(Amount);
END;
IF “Document Type” = “Document Type”::Payment THEN BEGIN
Pay := Amount;
FinCharg := 0;
END;
IF “Document Type” = “Document Type”::“Finance Charge Memo” THEN BEGIN
FinCharg := Amount;
Pay := 0;
END;
IF “Document Type”=“Document Type”:: “Finance Charge Memo” THEN BEGIN
Amount :=ABS(Amount)-ABS(Amount);
END;
IF “Document Type”=“Document Type”::Payment THEN BEGIN
Principal:= “Closed by Amount”;
IF Principal=0 THEN
Fincharge :=0
ELSE
Fincharge :=ABS(Amount)-ABS(Principal);
// FinchargeTotal:=ABS(FinchargeTotal+ ABS(Fincharge));
PrincipalTotal :=PrincipalTotal+Principal;
IF Customer.“Monthly Install” = 0 THEN BEGIN
ArreasVar:=0;
END ELSE
ArreasVar:= -Customer.“Monthly Install” - “Cust. Ledger Entry”.Amount;
ArreasVarTotal:=ArreasVarTotal + ArreasVar;
END;
//ArreasVarTot:= ArreasVarTot + ArreasVar;
“var” := ArreasVarTot;
// …MLS…
//Code that does the monthly total of arrears
IF InitializeArreasVarTot THEN
ArreasVarTot := 0;
InitializeArreasVarTot := FALSE;
CLE.RESET;
CLE.COPY(“Cust. Ledger Entry”); //copying current rec with filters
IF CLE.NEXT = 0 THEN //checking next rec’s date…starts
MonthEnds := TRUE
ELSE BEGIN
IF ((DATE2DMY(“Posting Date”,3) * 1000 + DATE2DMY(“Posting Date”,2)) =
(DATE2DMY(CLE.“Posting Date”,3) * 1000 + DATE2DMY(CLE.“Posting Date”,2))) THEN
MonthEnds := FALSE
ELSE
MonthEnds := TRUE; //checking next rec’s date…end
END;
ArreasVarTot:= ArreasVarTot + ArreasVar;
P1:= FORMAT(Pay);
&nbs