Update Sales Line Qty with PO Qty

Savatage
Member Posts: 7,142
I was thinking about this when I read another post about updating a PO Qty when you updates a sales line qty.
http://www.mibuso.com/forum/viewtopic.php?t=17518
I want to do the reverse.
We receive orders and the merch is not currently instock.
I altered the Req worksheet to pull just the OUT items and create a po for them.
Now when the PO is received I manually drill into each po line to it's corresponding Sales order and manually update the quanity. (yes one at a time)
I would like to have a Command Button On the PO header "Update Sales Lines". Each Po line does have a "Special Order Sales No" & "Special Order Sales line No" filled in.
On push of the button or function It should update the sales line with the po's "Qty received" for it's matching line. (or quanitity)
I tried some code but I seem to be off base.
Any suggestions welcome.
http://www.mibuso.com/forum/viewtopic.php?t=17518
I want to do the reverse.
We receive orders and the merch is not currently instock.
I altered the Req worksheet to pull just the OUT items and create a po for them.
Now when the PO is received I manually drill into each po line to it's corresponding Sales order and manually update the quanity. (yes one at a time)
I would like to have a Command Button On the PO header "Update Sales Lines". Each Po line does have a "Special Order Sales No" & "Special Order Sales line No" filled in.
On push of the button or function It should update the sales line with the po's "Qty received" for it's matching line. (or quanitity)
I tried some code but I seem to be off base.
IF NOT DIALOG.CONFIRM(Question,TRUE) THEN EXIT ELSE Salesline.LOCKTABLE; Salesline.RESET; Salesline.SETRANGE(Salesline."Document Type",Purchline."Document Type"); Salesline.SETRANGE(Salesline."Document No.",Purchline."Special Order Sales No."); Salesline.SETRANGE(Salesline."Line No.",Purchline."Special Order Sales Line No."); IF Salesline.FIND('-') THEN REPEAT IF Salesline."Special Order Purchase No." <> '' THEN Salesline.Quantity := Purchline.Quantity; Salesline.MODIFY(TRUE); UNTIL Salesline.NEXT = 0;
Any suggestions welcome.
0
Comments
-
Ok I'm trying a new idea - using a simple update report
I'm currently testing
Puchase Line is the dataitem..Salesline.GET("Document Type","Special Order Sales No.","Special Order Sales Line No."); Salesline.Quantity := Purchline.Quantity; Salesline.VALIDATE(Quantity); Salesline.MODIFY;
It appears to be geting the correct sales line but it's not updating.
What am I doing wrong?0 -
Never mind.
I added Sales Line as a dataitem (indented) linked with code below to Purchase Line.Document Type=FIELD(Document Type),Special Order Purchase No.=FIELD(Document No.),Special Order Purch. Line No.=FIELD(Line No.)
and added in the sales line dataitemOnAfterGetRecord() Purchline.GET("Document Type","Special Order Purchase No.","Special Order Purch. Line No."); Salesline.Quantity := Purchline.Quantity / Salesline."Qty. per Unit of Measure"; //We always Purch in pieces but not always sell it that way - so the division puts it all back propertly. Salesline.VALIDATE(Quantity); Salesline.MODIFY;
So I can still choose the PO# using the Purchase Line table and it updates all the orders (multiple) that have sales lines linked.
Add a command button to the purch header "Update Special Order Lines" & Happy Time!0 -
Just to keep adding to, apparently, my own post & replies
By adding
Salesheader.GET("Document Type",Salesline."Document No.");
.
**Do sales Header Stuff too if needed**
.
Salesheader.MODIFY;
Believe it or not this whole update thing will save us tons of man hours. \:D/0
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
- 320 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