Posting Down Payments AX 2012
AX 2012 introduces a new Vendor Prepayments feature. It basically allows a company to prepay a supplier before receiving any goods. This was not in AX 2009. So the user can basically connect a Prepayment record to a purchase order and then send something called a Prepayment invoice. When the item finally arrives, this prepayment invoice is then applied to the "Real" invoice of the seller and set up. It's pretty simple, and I think it's logical.
My requirement is to do this prepaid posting using code in X ++.
If I try to use the BuyFormLetter class as shown below, it outputs a real invoice which is not correct like prepayment, no inventory transactions.
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTable,
'8001',
systemDateGet(),
PurchUpdate::All,
AccountOrder::None,
NoYes::No,
NoYes::Yes);
I have looked at AX Dev Guides, Google, Blogs but no help.
Does anyone know this?
source to share
I believe you should learn the logic behind the BuyPrepayTable and the BuyPrepayTable form. If you are using a single prepayment for a single purchase order, you can link the prepayment to the purchase using BuyPrepayTable.PurchTable. If you want to accomplish this by calling X ++ code, I would recommend:
- Check if any BuyPrepayTable exists for the purchase order;
- If so, update it (before starting, make sure you have completed all the checks);
- If this is not the case, create a new prepayment (see also the methods of the BuyPrepayTable to make sure that your prepaid values pass all checks).
source to share