hi all...
i have a scenario like this
i have 2 no series for posted invoices... S-INV and S-INV-C
in sales line , I add field named consignment (boolean type)
I made sales order there are several items with non consigment (without tickmark in consignment field) and consigment (with tickmark in consignment field)
so for the items that non consignment if i post, it should be goes to document with S-INV no series
and for the items that consignment if i post, it should be goes to document with S-INV-C no series
does anybody could help me?
thanks
0
Comments
you can handal it first before invoice posting(like update posting no. series) and
at the time of posting where you will check all items are consignment or not(in codeunit 90) based on you could be update Posting No. Series.
i hope all items in a invoice must be same type either consignment or not.
You can:
-before posting, check if there's a at least one sales line with consignement and one without consignment: if so, you have to create 2 posted invoices; if not, just set the posting no. series depending on the boolean value of the lines
-if you have to create 2 invoices, create one with only consignment lines, and one with only non-consignment lines, then set the relative posting no. series and post the invoices. (be aware that because of the commits, if the second invoice fails, the first is already posted)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
there must be two different invoice for consignment item or Non-consignment item
item code consignment
item 1 yes
item 2 no
item 3 no
item 4 yes
item 5 no
it can be like this
Test it, you will probably get a runtime error...in that case, you can't use "IF codeunit.RUN then" construction, but you have to do a simple CODEUNIT.run without the IF clause
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
IF CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",Rec) THEN
IF ApprovalMgt.PrePostApprovalCheck(Rec,PurchaseHeader) THEN
CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",MyNewInvoiceDocument);
PurchaseHeader?
I Thought this is sales order ...
so I should make new code unit?
that purchase header it's a dummy record in order to call the same function both for sales and purchases...it's an arguable design, but not so bad...at a first glance, i would have created 2 functions...anyway...just don't care about it
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
specifictly... after this code
am I right?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
anybody can help me?