Sales Invoice Sorting Issue
thetallbloke
Member Posts: 66
Hi All,
I have a very weird situation that probably has some sensible explaination...
I ran the Sales Invoice Report (206) and it came up with an invoice and 3 items sorted by the primary key of Document No. and Line No.
I have since added a new field to the Sales Invoice Line table (113) called "Warehouse Class Code". I did this so that I could add a new key to the table of:
SORTING(Document No.,Line No.) ORDER(Ascending)
To
SORTING(Document No.,Warehouse Class Code,Description) ORDER(Ascending)
The report now behaves stangely. My first invoice no longer has 3 items on it... it has 1, 1 of the other items has been shifted onto another invoice (different customer, 20 pages along) and the 3rd item has gone completely and doesn't show on any invoice.
There is a SETRANGE line in the following standard code that once commented makes my report run correctly. so I once again have the 3 expected items on my invoice.
I guess my questions are:
I've just done some more testing and found that if all the Warehouse Class Codes are the same or in ascending order in the table, the report works fine.. if I set them to be 3, 2, and 1 for a 3 item invoice, only the first one displays...
I hope this points to a solution from someone..
Many thanks..
I have a very weird situation that probably has some sensible explaination...
I ran the Sales Invoice Report (206) and it came up with an invoice and 3 items sorted by the primary key of Document No. and Line No.
I have since added a new field to the Sales Invoice Line table (113) called "Warehouse Class Code". I did this so that I could add a new key to the table of:
-
Document No.
Warehouse Class Code
Description
SORTING(Document No.,Line No.) ORDER(Ascending)
To
SORTING(Document No.,Warehouse Class Code,Description) ORDER(Ascending)
The report now behaves stangely. My first invoice no longer has 3 items on it... it has 1, 1 of the other items has been shifted onto another invoice (different customer, 20 pages along) and the 3rd item has gone completely and doesn't show on any invoice.
There is a SETRANGE line in the following standard code that once commented makes my report run correctly. so I once again have the 3 expected items on my invoice.
Sales Invoice Line - OnPreDataItem()
VATAmountLine.DELETEALL;
SalesShipmentBuffer.RESET;
SalesShipmentBuffer.DELETEALL;
FirstValueEntryNo := 0;
MoreLines := FIND('+');
WHILE MoreLines AND (Description = '') AND ("No." = '') AND (Quantity = 0) AND (Amount = 0) DO
MoreLines := NEXT(-1) <> 0;
IF NOT MoreLines THEN
CurrReport.BREAK;
{**********************************
THIS LINE
**********************************}
SETRANGE("Line No.",0,"Line No.");
{**********************************}
CurrReport.CREATETOTALS("Line Amount",Amount,"Amount Including VAT","Inv. Discount Amount");
I guess my questions are:
-
Can someone shed some light on why its there..??
Can I comment it out..?? What will that affect???
Is there a better way to get what I want..?? ie my report to sort by my chosen key fields.
I've just done some more testing and found that if all the Warehouse Class Codes are the same or in ascending order in the table, the report works fine.. if I set them to be 3, 2, and 1 for a 3 item invoice, only the first one displays...
I hope this points to a solution from someone..
Many thanks..
.
I'm not crazy !!! Just ask my toaster...
.
I'm not crazy !!! Just ask my toaster...
.
0
Comments
-
I've accidentally posted this in the Navision Exams & Certification forum....
Can someone please move it into the General Version >= 3.70 and <= 5.0 group...
Thanks
Sorry....
I'm not crazy !!! Just ask my toaster...
.0 -
[Topic moved from Navision Exams & Certification forum to Navision forum]
PS to report this (and other things) that require moderator- (or admin-) action, you can use the reporting-functionality (=the red ! at the right of the post).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi
Even i Face a similar Problem that is to sort the invoice lines by Item no rather than Lino no
so i added a new key on the Sales Invoice Line called "Document No.","Type","No."
and [My Code] is shown Below.
However it sorts all invoice lines according to the new key except doesnt Show invoice lines with type "G/L Account" on the Invoice(report).
Any Experts out there?Sales Invoice Line - OnPreDataItem() VATAmountLine.DELETEALL; SalesShipmentBuffer.RESET; SalesShipmentBuffer.DELETEALL; FirstValueEntryNo := 0; MoreLines := FIND('+'); WHILE MoreLines AND (Description = '') AND ("No." = '') AND (Quantity = 0) AND (Amount = 0) DO MoreLines := NEXT(-1) <> 0; IF NOT MoreLines THEN CurrReport.BREAK; SETRANGE("Line No.",0,"Line No."); [MY CODE>>>]TempSIL.COPY("Sales Invoice Line"); TempSIL.RESET; TempSIL.SETCURRENTKEY("Document No.","Type","No."); TempSIL.SETFILTER("Document No.","Document No."); TempSIL.SETFILTER("Type",'%1',"Type"::Item); if TempSIL.FIND('-') then "Sales Invoice Line".COPY(TempSIL); [<<<<<MY CODE] CurrReport.CREATETOTALS("Line Amount",Amount,"Amount Including VAT","Inv. Discount Amount");Regards,
GD0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions