Adding Mutiple Lines to a Sales Order Line Simultaneously?

Matt.Hill
Member Posts: 32
Our customer has the requirement that they should be able to select all items required from that screen before returning to the sales order screen. What I have done so far is to have a flag to indicate which items are to be added upon pressing ok, and the routine that picks up those items (onValidate of No.) is detecting each one sucessfully, but only ever adds the item for which the '->' was on when pressing OK! I realise that if the user selects multiple items by holding the shift key, all of the highlighted items are returned as members of the pointer to the record, but it can be frustrating to release the shift key to see all of the items selected dissapear!
Basically, what I ask is: how do cause a new sales line to be generated automatically for each of the items selected?
Thanks for any input!
Basically, what I ask is: how do cause a new sales line to be generated automatically for each of the items selected?
Thanks for any input!
0
Comments
-
Hi,
Let there be no doubt: you will need to write code to create the functionality you describe. I think *marking* the records (Ctrl+F1) offers users a comfortable way of selecting more than one item, while at the same time providing the developer with an efficient way to see which ones were selected.
Please note that MARK-ing a record takes place *only* on the client, so different users will not get "in each other's way".Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
Create a new form based on Item List, call this from the Order using the
DefDocument function below, and start the SelectMarkedItems() from a menu on the form after the items have been selected. This will then copy all the marked items to the document, inserting them after the last sales line.
DefDocument(NewDocType : 'Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order';NewDocNo : Code[20])
DocType := NewDocType;
DocNo := NewDocNo;
SelectMarkedItems()
Window.OPEN('Copying Item #1################### #2###################### to #3######### #4###########',
"No.",Description,DocType,DocNo);
CurrForm.SETSELECTIONFILTER(Rec);
MARKEDONLY(TRUE);
SalesLine2.SETRANGE("Document Type",DocType);
SalesLine2.SETRANGE("Document No.",DocNo);
IF SalesLine2.FIND('+') THEN
NextLineNo := SalesLine2."Line No."
ELSE
NextLineNo := 0;
IF FIND('-') THEN
REPEAT
NextLineNo += 10000;
SalesLine."Document Type" := DocType;
SalesLine."Document No." := DocNo;
SalesLine."Line No." := NextLineNo;
SalesLine.VALIDATE(SalesLine.Type,SalesLine.Type::Item);
SalesLine.VALIDATE(SalesLine."No.",Rec."No.");
SalesLine.INSERT(TRUE);
Window.UPDATE;
UNTIL NEXT = 0;
CLEARMARKS;
MARKEDONLY(FALSE);Kai Kowalewski0 -
Kowa wrote:Create a new form based on Item List, call this from the Order using the
DefDocument function below, and start the SelectMarkedItems() from a menu on the form after the items have been selected. This will then copy all the marked items to the document, inserting them after the last sales line.
OK, thanks - that makes perfect sense - except for one thing: how do I pass the 'DocType' and 'DocNo' parameters through to the subform? At the moment, I am calling the customer's specialised item list (based on the item table) as a 'Form.RUNMODAL(0,ItemList)' from the Sales Order Form? ](*,)
Thanks!0 -
Create a form variable "ItemListSelect" for the new form in Form 42, add a new menu item in "Function" of Form 42, then add this code for the menu item :
ItemListSelect.DefDocument("Document Type","No.");
ItemListSelect.RUN;
8)Kai Kowalewski0 -
Matt.Hill wrote:Thanks for that - all seems to be working now! =D> \:D/ 8)
Sorry to be a pain :oops: - just one thing, although the code to create the sales lines is working, per se, the user needs to do a 'View->Refresh' to see the changes. I've tried putting in CurrForm.UPDATE (with and without a 'FALSE' parameter) in various places (events) on the form, but it always comes up with errors along the lines of "you cannot perform that function here".
What would be the best way of updating the form to reflect the updates, thanks?0 -
Matt.Hill wrote:the user needs to do a 'View->Refresh' to see the changes.
My browser has 'View->Refresh', I haven't seen this in Navision. :?:
Actually it should work as stated without any Currform.Update. The user who performs the action should instantly see the new records appear in the sales subform. Only other users on the same sales order need to read the sales header again to see the changes.
Is your customer using SQL or native server ( which version) ? If it is a SQL Server problem I can't help you. The code works without problems on a 3.70B Client and native server.
Maybe this will help :
Clear(ItemListSelect);
ItemListSelect.DefDocument("Document Type","No.");
ItemListSelect.RUN;
Commit;
Currform.update(TRUE);Kai Kowalewski0 -
Kowa wrote:My browser has 'View->Refresh', I haven't seen this in Navision. :?:
We're running V4 on a SQL database. Tried doing commits, etc., and gave up. Instead the "Add Multiple Items" Function was added to the Functions menu, and it all works fine now. Thanks anyway.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