Get Customer Account Intercompany

Get Customer Account Intercompany
Song Nghia - Technical Consultant



private CustAccount getCustAccountInterCompany(RetailStoreTable retailStoreTable)
    {
        CustAccount  custAccount;
        InterCompanyTradingPartner interCompanyTradingPartner;
        RecId tradingPartnerVendRecId, tradingPartnerCustRecId;
        CustTable  custTbl;
        changecompany(retailStoreTable.inventLocationDataAreaId)
        {
            VendTable vendTable =  VendTable::find(retailStoreTable.LAW_DefaultVendor);
            RecId partyId = vendTable.Party;
            tradingPartnerVendRecId = InterCompanyTradingPartner::findVendor(partyId,retailStoreTable.inventLocationDataAreaId).RecId;
        }

        select interCompanyTradingPartner
            where interCompanyTradingPartner.RecId == tradingPartnerVendRecId;

        tradingPartnerCustRecId = InterCompanyTradingRelation::getRelatedTradingPartner(interCompanyTradingPartner).RecId;

        custAccount= InterCompanyTradingRelation::getRelatedTradingPartner(interCompanyTradingPartner).custTable().AccountNum;
        
        return custAccount;
    }

Previous Post
Next Post

post written by: