X++ Code to check the Invoice marked for settlement

Settlement feature allows you to select the open transactions(Vendor / customer)  and then you can post the payment journal for the same. I mean whenever you post PO or SO , all the payment details  will be sitting in Open transactions.
And these open transaction will be used latter for settlement , when you pay to the Vendor or receive the amount from customer.
Following Job illustrates how to check whether invoice is marked for settlement or not. The reason is if invoice is marked for settlement than those invoices cannot be used for posting in other journals.

For illustration i am using vendor invoices , second parameter (_buffer) should be ledgerJournalTrans , custTable or vendTable record for which you will be going to use the specified invoice.

boolean checkRecordMarked(InvoiceId _invoiceId, Common _buffer)
{

        boolean ret;
        ;
        select vendTransOpen
        join   vendTrans
        where  vendTransOpen.AccountNum == vendTrans.AccountNum &&
               vendTransOpen.RefRecId   == vendTrans.RecId      &&
               vendTrans.Invoice        == _invoiceId;


        specTransManager = SpecTransManager::construct(_buffer);
        ret = specTransManager.existForOtherSpec(vendTransOpen.company(), vendTransOpen.TableId, vendTransOpen.RecId);

        return ret;

}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.