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 ?
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
Answers
There is no such function.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Okay, can you send me in the right direction...
Some code ideas
Thanks
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 + Page
I have done this code for the purpose :
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
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.?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
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