Sales Report

Navi_LearnerNavi_Learner Member Posts: 356
I created a Customer Sales Report, but when I retrieve the report, one of the item whose quantity are negative(-200), but the contribution margin are positive(+200). I create the report based on three tables, Customer, Value Entry, Cus. Ledger Entry. Here is part of my code. Can any expert find the bugs? Thanks!


Value Entry - OnPreDataItem()

CurrReport.CREATETOTALS("Invoiced Quantity","Sales Amount (Actual)",Profit,"Discount Amount");
SETFILTER("Invoiced Quantity",'<>0');

Value Entry - OnAfterGetRecord()

Profit := "Sales Amount (Actual)" + "Cost Amount (Actual)";
"Discount Amount" := -"Discount Amount";



Res. Ledger Entry - OnAfterGetRecord()

TotalSales := TotalSales + -"Res. Ledger Entry"."Total Price";
ResourceProfit := (-"Res. Ledger Entry"."Total Price") - (-"Res. Ledger Entry"."Total Cost");
ContribMargin := ContribMargin + (-"Res. Ledger Entry"."Total Price") - (-"Res. Ledger Entry"."Total Cost");



Customer, Footer (8) - OnPreSection()
"CalcProf%"(("Value Entry"."Sales Amount (Actual)" + -"Res. Ledger Entry"."Total Price"),(Profit + ResourceProfit));

Comments

  • ara3nara3n Member Posts: 9,257
    for that item find the filter the records, and manually add them up and see if you get the same result. If yes, then the report works correctly. If not, then you have a bug in report.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.