Thursday, January 21, 2016

Marked Transaction in Payment Journal Invoice Posted /Not Posted

Markeed Transaction in Payment Journal Invoice
Not posted
:
    ledgerJournalTransLocal = LedgerJournalTrans::findRecId(_ledgerJournalTrans.RecId,false);
    if(_ledgerJournalTrans.AccountType == LedgerJournalACType::Vend)
    {
        custVendFindSettlements = new CustVendFindSettlements(ModuleCustVend::Vend, ledgerJournalTransLocal);
        if (ledgerJournalTransLocal.ledgerJournalTable().JournalType == LedgerJournalType::VendPromissoryNoteRedraw ||
            ledgerJournalTransLocal.ledgerJournalTable().JournalType == LedgerJournalType::BankChequeReversal)
        {
            custVendFindSettlements.findSettledSettlements();
        }
        else
        {
            custVendFindSettlements.findSettlements();
        }
        tmpCustVendTrans.setTmpData(custVendFindSettlements.tmpCustVendTrans());
        while select tmpCustVendTrans
        {
            InvoiceNumber += strFmt("%1,", tmpCustVendTrans.Invoice);
        }
    }
    else if(_ledgerJournalTrans.AccountType == LedgerJournalACType::Cust)
    {
         custVendFindSettlements = new CustVendFindSettlements(ModuleCustVend::Cust, ledgerJournalTransLocal);
        if (ledgerJournalTransLocal.ledgerJournalTable().ProtestSettledBill == NoYes::Yes ||
            ledgerJournalTransLocal.ledgerJournalTable().JournalType == LedgerJournalType::BankChequeReversal ||
            ledgerJournalTransLocal.ledgerJournalTable().JournalType == LedgerJournalType::BankDepositPaymCancel)
        {
            custVendFindSettlements.findSettledSettlements();
        }
        else
        {
            custVendFindSettlements.findSettlements();
        }
        tmpCustVendTrans.setTmpData(custVendFindSettlements.tmpCustVendTrans());
        while select tmpCustVendTrans
        {
            InvoiceNumber += strFmt("%1,", tmpCustVendTrans.Invoice);
        }
    }
Posted :
Public void settlementCustAftPosting(LedgerJournalTrans _ledgerJournalTrans)
{
    CustSettlement  set, set2;
    CustTrans   custTrans, custTrans1;
    boolean _old = true;
     #ISOCountryRegionCodes

     select set
        join custTrans where set.TransCompany ==  custTrans.dataAreaId
        &&  set.TransRecId          ==  custTrans.RecId
        &&  set.AccountNum          ==  custTrans.AccountNum
        &&  custTrans.AccountNum    == _ledgerJournalTrans.accountDisplay()
        &&  custTrans.Voucher       == _ledgerJournalTrans.Voucher
        &&  custTrans.TransDate     == _ledgerJournalTrans.TransDate ;

    while select set2
        where ((set.OffsetCompany   == set2.TransCompany    && set.OffsetRecId  == set2.TransRecId)     &&
               (set.TransCompany    == set2.OffsetCompany   && set.TransRecId   == set2.OffsetRecId))   ||
              ((set.TransCompany    == set2.TransCompany    && set.TransRecId   == set2.TransRecId)     &&
               (set.OffsetCompany   == set2.OffsetCompany   && set.OffsetRecId  == set2.OffsetRecId))   &&
               (set2.CanBeReversed  == true || _old)                                                    &&
               (set2.TransDate      == set.TransDate || ! SysCountryRegionCode::isLegalEntityInCountryRegion([ #isoRU ]))
    join custTrans1
        where set2.TransCompany     ==  custTrans1.dataAreaId
               &&  set2.TransRecId  ==  custTrans1.RecId
               &&  set2.AccountNum  ==  custTrans1.AccountNum
               &&  custTrans1.Invoice != ""
    {
            jvSettleTmp.Name  = "Settlement";
            jvSettleTmp.Invoice = custTrans1.Invoice;
            jvSettleTmp.InvoiceDate = custTrans1.TransDate;
            jvSettleTmp.Txt = custTrans1.txt;
            jvSettleTmp.CurrencyCode = custTrans1.CurrencyCode;
            jvSettleTmp.Amount = custTrans1.SettleAmountCur;
            jvSettleTmp.insert();
    }

}

Public void settlementVendAftPosting(LedgerJournalTrans _ledgerJournalTrans)
{
    VendSettlement  set, set2;
    VendTrans       vendTrans, vendTrans1;
    boolean         _old = true;
    #ISOCountryRegionCodes

     select set
        join vendTrans where set.TransCompany ==  vendTrans.dataAreaId
        &&  set.TransRecId          ==  vendTrans.RecId
        &&  set.AccountNum          ==  vendTrans.AccountNum
        &&  vendTrans.AccountNum    == _ledgerJournalTrans.accountDisplay()
        &&  vendTrans.Voucher       == _ledgerJournalTrans.Voucher
        &&  vendTrans.TransDate     == _ledgerJournalTrans.TransDate ;

    while select set2
        where ((set.OffsetCompany   == set2.TransCompany    && set.OffsetRecId  == set2.TransRecId)     &&
               (set.TransCompany    == set2.OffsetCompany   && set.TransRecId   == set2.OffsetRecId))   ||
              ((set.TransCompany    == set2.TransCompany    && set.TransRecId   == set2.TransRecId)     &&
               (set.OffsetCompany   == set2.OffsetCompany   && set.OffsetRecId  == set2.OffsetRecId))   &&
               (set2.CanBeReversed  == true || _old)                                                    &&
               (set2.TransDate      == set.TransDate || ! SysCountryRegionCode::isLegalEntityInCountryRegion([ #isoRU ]))
    join vendTrans1
        where set2.TransCompany     ==  vendTrans1.dataAreaId
               &&  set2.TransRecId  ==  vendTrans1.RecId
               &&  set2.AccountNum  ==  vendTrans1.AccountNum
               &&  vendTrans1.Invoice != ""
    {
            jvSettleTmp.Name  = "Settlement";
            jvSettleTmp.Invoice = vendTrans1.Invoice;
            jvSettleTmp.InvoiceDate = vendTrans1.TransDate;
            jvSettleTmp.Txt = vendTrans1.txt;
            jvSettleTmp.CurrencyCode = vendTrans1.CurrencyCode;
            jvSettleTmp.Amount = vendTrans1.SettleAmountCur;
            jvSettleTmp.insert();
    }
}

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...