Purch. Lines Combine based on No. And Type
kenjes
Member Posts: 76
Hi
Is there a function or a simple way to combine purchase lines based on "No." and "Type" values.
Thanks
Regards Kenneth
Is there a function or a simple way to combine purchase lines based on "No." and "Type" values.
Thanks
Regards Kenneth
0
Answers
-
in report or page itself?
There is no such function.0 -
On a page0
-
as I said, there is no such function0
-

Okay, can you send me in the right direction...
Some code ideas
Thanks
0 -
Hi,
purchase lines based on "No." and "Type"
Just a thought -
Create a Text Variable Say - NoandType on Purchase Order Subform.
Add That in Page Designer and remove No. and Type.
In OnAfterGetRecord you can write -
NoandType := Format(Type) + ' ' + Format("No.");
Hope this gives an Idea
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page0 -
Hi - and thanks for your feedback

I have done this code for the purpose :PurchaseLineOrg.SETCURRENTKEY("Document No.","Document Type","No."); PurchaseLineOrg.SETFILTER(PurchaseLineOrg."Document No.", Rec."No."); tmpItemNo := ''; tmpLineNo := 10000000; IF PurchaseLineOrg.FINDSET THEN BEGIN REPEAT IF PurchaseLineOrg.Type <> PurchaseLineOrg.Type::" " THEN BEGIN IF tmpItemNo <> PurchaseLineOrg."No." THEN BEGIN tmpItemNo := PurchaseLineOrg."No."; tmpLineNo := tmpLineNo + 10; PurchaseLineCombined := PurchaseLineOrg; PurchaseLineCombined."Line No." := tmpLineNo; PurchaseLineCombined.Quantity := 1; PurchaseLineCombined."Line Amount" := PurchaseLineOrg."Line Amount"; PurchaseLineCombined."Direct Unit Cost" := PurchaseLineOrg."Line Amount"; IF PurchaseLineCombined.INSERT THEN; END ELSE BEGIN PurchaseLineCombined."Direct Unit Cost" := PurchaseLineCombined."Direct Unit Cost" + (PurchaseLineOrg."Line Amount"); PurchaseLineCombined."Line Amount" := PurchaseLineCombined."Line Amount" + (PurchaseLineOrg."Line Amount"); PurchaseLineCombined.MODIFY; END; END; UNTIL PurchaseLineOrg.NEXT = 0 ; END; PurchaseLineOrg.SETFILTER(PurchaseLineOrg."Document No.", Rec."No."); IF PurchaseLineOrg.FINDSET(TRUE) THEN BEGIN REPEAT PurchaseLineOrg.DELETE; UNTIL PurchaseLineOrg.NEXT = 0; END; PurchaseLineCombined.SETFILTER(PurchaseLineCombined."Document No.", Rec."No."); IF PurchaseLineCombined.FINDSET(TRUE) THEN BEGIN REPEAT PurchaseLineOrg := PurchaseLineCombined; PurchaseLineOrg.VALIDATE(PurchaseLineOrg."Direct Unit Cost"); IF PurchaseLineOrg.INSERT THEN; UNTIL PurchaseLineCombined.NEXT = 0 ; END;
Local Variables :
PurchaseLineOrg Record Purchase Line
PurchaseLineCombined Record Purchase Line
tmpItemNo Text
tmpLineNo Integer
I am a little newbie into NAV C/al.
Does this code seem to be okay - or can it be compressed more, or done in another way ?
THANKS
0 -
PurchaseLineCombined."Direct Unit Cost" := PurchaseLineCombined."Direct Unit Cost" + (PurchaseLineOrg."Line Amount");
PurchaseLineCombined."Line Amount" := PurchaseLineCombined."Line Amount" + (PurchaseLineOrg."Line Amount");
PurchaseLineCombined.MODIFY;
It seems you have added only few fields and what about other fields like Quantity and discounts etc.?0 -
Quantity is set to 1.
Thats why adding Amount to lines with same ItemNo.
All other fields is not nessecarry for now - the purpose is to have 1 line per Item, that kan be modified manually with job no, job task and so on
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

