Invoice of Purchase order/Sales order based on Product receipt/Packing slip

Hi All,

I have created one purchase order with two purchase lines. Now I have generated one product receipt for only 1st Line of purchase order.

Now I want to generate invoice for that product receipt of purchase order only.

We are having this functionality in ax 2012 on Vendor Invoice form. But I don’t know how to achieve this functionality through the code.

I have tried with PurchFormLetter.update method, In that one i have pass source argument as VendPackingSlipJour which product receipt i have generated for purchase order. But it didn’t work and it tries to generated invoice for all the records which we are having in purch table.

Please give me some suggestions, In which way i have to proceed to achieve this task.

Thanks in advance.

Vijay Solanki.