In Nav when you hit "F9" on a "Customer Card", you get "Customer Statistics". This brings up Sales for "Current Month", "This Year", "Last Year" and "To Date". How do I get that in my JetReports for each customer on my list?
Thanks.
1 comment
-
Jet Reports Historic Posts Below is the code used by Navision to calculate the Customer Statistics form. As you can see, it appears to loop though calculating each column with a different date filter. You can see in the code what fields are being used from the customer table. You can do the same thing by setting up column headings with your date filters, and then referencing the date filter in each of your NF() functions. For eample. You set up an =NL("Rows","Customer") in cell C6 to get the customer record. Then in D6, put =NF(C6,"Sales (LCY)","Date Filter",D3), where D3 contains the date filter you want to use.
Hopefully this helps.FOR i := 1 TO 4 DO BEGIN SETFILTER("Date Filter",CustDateFilter[i]); 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)"); CustSalesLCY[i] := "Sales (LCY)"; CustProfit[i] := "Profit (LCY)" + NonInvtblCostAmt(i); IF "Sales (LCY)" <> 0 THEN ProfitPct[i] := ROUND(100 * CustProfit[i] / "Sales (LCY)",0.1) ELSE ProfitPct[i] := 0; InvAmountsLCY[i] := "Inv. Amounts (LCY)"; CustInvDiscAmountLCY[i] := "Inv. Discounts (LCY)"; CustPaymentDiscLCY[i] := "Pmt. Discounts (LCY)"; CustPaymentDiscTolLCY[i] := "Pmt. Disc. Tolerance (LCY)"; CustPaymentTolLCY[i] := "Pmt. Tolerance (LCY)"; CustReminderChargeAmtLCY[i] := "Reminder Amounts (LCY)"; CustFinChargeAmtLCY[i] := "Fin. Charge Memo Amounts (LCY)"; CustCrMemoAmountsLCY[i] := "Cr. Memo Amounts (LCY)"; CustPaymentsLCY[i] := "Payments (LCY)"; CustRefundsLCY[i] := "Refunds (LCY)"; CustOtherAmountsLCY[i] := "Other Amounts (LCY)"; END;