Customer Statistics FactBox

The Page 9082 is not displaying correct information.  One of the fact boxes for sales is the Customer Statistics factbox page 9082.

origpage9082

The last amount, “Sales YTD (LCY):” is in fact the total sales for the customer.  I wanted to change this and use 12 months sales instead of YTD sales.  I changed the caption according to that and changed the code.

[code]
OnAfterGetRecord()

IF CurrentDate <> WORKDATE THEN BEGIN
CurrentDate := WORKDATE;
END;

SETRANGE("Date Filter",0D,CurrentDate);
CALCFIELDS(
Balance,"Balance (LCY)","Balance Due","Balance Due (LCY)",
"Outstanding Orders (LCY)","Shipped Not Invoiced (LCY)");

TotalAmountLCY := "Balance (LCY)" + "Outstanding Orders (LCY)" + "Shipped Not Invoiced (LCY)" + "Outstanding Invoices (LCY)";

SETRANGE("Date Filter",CALCDATE(”,CurrentDate),CurrentDate); //#01-

CALCFIELDS(
"Sales (LCY)","Profit (LCY)","Inv. Discounts (LCY)","Inv. Amounts (LCY)","Pmt. Discounts (LCY)",
"Pmt. Disc. Tolerance (LCY)","Pmt. Tolerance (LCY)",
"Fin. Charge Memo Amounts (LCY)","Cr. Memo Amounts (LCY)","Payments (LCY)",
"Reminder Amounts (LCY)","Refunds (LCY)","Other Amounts (LCY)");
SETRANGE("Date Filter",0D,CurrentDate);[/code]

where the line

SETRANGE(“Date Filter”,CALCDATE(‘<-12M>’,CurrentDate),CurrentDate); //#01-

is added.

Leave a Reply