Merging 2 items  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Merging 2 items

Postby perry » Wed Aug 31, 2016 5:14 pm

Hi,

Jiwa 7.0.157

The task is to merge 2 items into 1.
We built SQL script that updates all inventory ID field on transactional tables (soh, so_lines, po_lines etc etc) from A to B.
Then user can delete the item A from inventory maintenance screen.

Currently I'm having issue with "PO_Lines.IN_SupplierWarehouse_RecID". Ideally I will need to update that with item B's IN_SupplierWarehouse_RecID, however, I'm not sure what logic should I use or it even matters if I just set it to Null...

The logic I'm thinking is (from Item B)
- find region the PO is in,
- find creditor on PO
- find the default supplier warehouse record

I can think of all sorts of exceptions from logic above, e.g. region order not enabled, no default supplier setup etc etc. In those case, I would just have use NULL.

My question how PO is using that ID and what if, the field value is NULL on open POs.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Merging 2 items  Topic is solved

Postby Mike.Sheen » Sat Nov 12, 2016 4:07 pm

perry wrote:My question how PO is using that ID and what if, the field value is NULL on open POs.


When items are added to a PO we use the IN_SupplierWarehouse record to work out the cost to use and the order units. Also some reports may rely on that being a valid (non-null). Modifying an order quantity on a saved PO will refer back to the IN_SupplierWarehouse_RecID.

In your case, I'd update it to be the IN_SupplierWarehouse.RecID of the new item where the creditor (IN_Creditor.CreditorID) matches that of the old item - if none match, then use the default IN_SupplierWarehouse record for the default IN_Creditor record of the new item.

I advise against NULLs. I believe we allow NULLs on that column of PO_Lines to cater for Warehouse PO's - Supplier PO's probably need that, however.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Merging 2 items

Postby perry » Mon Nov 14, 2016 3:59 pm

Great!! I knew I raised this issue somewhere but just couldn't remember where.

We had an error on activation of a purchase invoice recently and the issue is caused by IN_SupplierWarehouse_RecID being NULL.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 8 guests