Totalling issue

yuppicideyuppicide Member Posts: 410
edited 2014-01-02 in Navision Attain
Re-visiting an issue I have with Navision 3.10 totaling.

When I go to print multiple copies of a Sales Order things are fine. If I go to Posted Invoices, not fine. Let's say an order is $200 and I want 3 copies. The second copy comes out as $400, third copy as $600. This issue has been here since they bought the software.

I see this code:
//CurrReport.SHOWOUTPUT(OnLineNumber = NumberOfLines);
IF (OnLineNumber = NumberOfLines) THEN BEGIN
  text1 := 'Subtotal:';
  Text2 :=  'Shipping:';
  Text3 :=  'Total:';
  //SubTotal := AmountExclInvDisc;
  SubTotal := Total1;
  Frt := Freight;
  Total := TempSalesLine."Amount Including Tax";
  text1 := '';
  Text2 :=  '';
  Text3 :=  'Subtotal';
  SubTotal := 0;
  Frt := 0;
  Total := 0;

.. and on my report I have the following:

This shows a Subtotal, Shipping cost, and Total amount the customer has to pay. If the order runs into multiple pages, the only thing shown on page 1 is a Subtotal. The second page shows all three.

Now, if I add in Total1 := 0; on the bottom portion, after the END ELSE BEGIN that will fix my problem on orders that run into multiple pages.. because it skips the top portion of that code and goes to the END ELSE BEGIN, but then if the order is multiple pages it won't print a SubTotal on page 1. On orders that are single pages, my numbers still come out wrong on the 2nd and 3rd copy.

I can't wrap my head around how to fix it and it's probably something simple/close to my reach since I've got this far.


  • whitaker_timwhitaker_tim Member Posts: 23
    By default NAV uses the CurrReport.CREATETOTALS function to reset and track totals properly. If you look in the SalesInvLine - OnPreDataItem() you will see the function being called and the fields being used. Instead of using the total fields that were created outside of using this function you need to setup the variables to be included in the CREATETOTALS.

    I am looking at a newer version but my line reads:
    CurrReport.CREATETOTALS(TaxLiable,AmountExclInvDisc,TempSalesInvoiceLine.Amount,TempSalesInvoiceLine."Amount Including VAT");

    These are generally the variables that are used to present the totals, a developer has changed how this works to try to use different variables but have not used the default NAV functionality. The total section would generally use the variables included in the statement above to provide the subtotal, invoice discount amount, tax amount and total.

    Here is a link to the MSDN details for the function being used, I hope this can provide clarity
    Tim Whitaker | Senior NAV Consultant/Developer | The Software Workshop Ltd. |
Sign In or Register to comment.