Posting PO invoice for specific lines and quantity


I have some purchase order where I need to receive and invoice certain lines. I also have occasions where I will have three receipts for one line, but have an invoice for only a portion of them. For example, I have a PO where line one if for 25 of item 12345 and line two is for 100 of item 23456. I have three receipts against line one for 10, 10 and 5 over a month period. I receive and invoice for the first 10. By the time the invoice is there, all 25 have been received. If I use the normal invoicing call like this:

PurchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);

PurchFormLetter.update(PurchTable, strFmt(“Inv_%1”, purchTable.PurchId));

It posts the invoice for all 25. I receive the items using the PurchFormLetter_PackingSlip::newPackingSlipFromChooseLineQuery but do not see anything liek that for invoicing. What do I need to do to make this work?

Check the below thread.

Moved to developer forum.