Sunday, May 28, 2017

Vendor and Customer Invoice Settlement Number Marked Transaction

static void SettelementInvoiceNum(Args _args)
{
    LedgerJournalTrans  ledgerJournalTrans;
    CustVendFindSettlements custVendFindSettlements;
    TmpCustVendTrans            tmpCustVendTrans;
        str invoice;
    ;
    ledgerJournalTrans = LedgerJournalTrans::findRecId(5637161826,false);
    custVendFindSettlements = new CustVendFindSettlements(ModuleCustVend::Vend, ledgerJournalTrans);
    if (ledgerJournalTrans.ledgerJournalTable().JournalType == LedgerJournalType::VendPromissoryNoteRedraw ||
        ledgerJournalTrans.ledgerJournalTable().JournalType == LedgerJournalType::BankChequeReversal)
    {
        custVendFindSettlements.findSettledSettlements();
    }
    else
    {
        custVendFindSettlements.findSettlements();
    }
    tmpCustVendTrans.setTmpData(custVendFindSettlements.tmpCustVendTrans());
    while select tmpCustVendTrans
    {
        invoice += strFmt("%1,", tmpCustVendTrans.Invoice);
    }
    info(invoice);
}

VendSettlement      vendSettlement;
    VendTrans           vendTrans;
    VendTransOpen       vendTransOpen;
    CustVendOpenTransManager    manager;
    LedgerJournalTrans  ledgerJournalTrans;
    ;
    //If it is posted
    info("PMT00002749");
    while select vendSettlement
        where vendSettlement.AccountNum      == "V00566"
            && vendSettlement.OffsetTransVoucher == "PMT00002749"
    {
        select vendTrans
        where vendTrans.dataAreaId  == vendSettlement.TransCompany
        && vendTrans.RecId          == vendSettlement.TransRecId
        && vendTrans.AccountNum     == vendSettlement.AccountNum;
        info(vendTrans.Invoice);
    }
   
    //if it is open
    vendTrans.clear();
    info("PMT00002750");
    while select vendTransOpen
        where vendTransOpen.AccountNum      == "V00530"
    {
        if(SpecTrans::findByRef(vendTransOpen.dataAreaId,vendTransOpen.TableId,vendTransOpen.RecId))
        {
             select * from ledgerJournalTrans where ledgerJournalTrans.Voucher == "PMT00002750";
            manager = CustVendOpenTransManager::construct(ledgerJournalTrans);
            select vendTrans
                where vendTrans.AccountNum == vendTransOpen.AccountNum
                    && vendTrans.RecId  == vendTransOpen.RefRecId;
            manager.getTransMarked(vendtransopen);
            if(manager.getTransMarked(vendtransopen) == true)
            {
                info(vendTrans.Invoice);
            }
        }
    }

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...