Hey Guys,
i'm trying to build a report to sum the invoiced quantities and revenues by customer PER YEAR.
I created this CAL Globals (for year 2016)
CAL CODE:
OnPreReport()
Date2016_Start := 010116D;
Date2016_End := 311216D;
//WP2.RESET;
//WP2.SETRANGE("Posting Date",Date2016_Start,Date2016_End);
//WP2.SETRANGE("Source No.", Customer."No.");
//WP2.CALCSUMS("Sales Amount (Actual)");
//WP2.CALCSUMS("Invoiced Quantity");
//Umsatz_2016 :=WP2."Sales Amount (Actual)";
//Menge_2016 :=WP2."Invoiced Quantity";
I don't get an errormessage when I compile the report, but the report shows the wrong values.
PAGE.RUNMODAL on value entry table shows, that the datefilter isn't set.
pls help
Answers
you set the Filter in the OnPreReport() section?
Set it in the OnPreDataItem section and it should work.
We changed from our old ERP-system to NAV in the middle of 2017.
No I'm trying to add up the sales qty from the old system (where quantities are positive) and the invoiced qty from the value entry. (qty is negative)
that causes that the old qty (f.e.40 pcs) and the new qty (f.e. -20pcs) brings a total qty of 20 instead of 60.
I've found this code piece, but it doesnt work:
WP2."Invoiced Quantity" := -WP2."Invoiced Quantity";
The '-' in your example does the following:
Example:
WP2."Invoiced Quantity" = 5;
WP2."Invoiced Quantity" := -WP2."Invoiced Quantity";
Result: -5
WP2."Invoiced Quantity" = -5;
WP2."Invoiced Quantity" := -WP2."Invoiced Quantity";
Result: 5