Logistics address, postal address, address phone fax contact information

// Find primary address by roles

 LogisticsPostalAddress postalAddr; 

postalAddr = DirParty::findPostalAddressByRole(DirPartyTable::find(companyInfo::find().PartyNumber).RecId,LogisticsLocationRoleType::Invoice);


Get Description/ name of location

LogisticsLocation::find(postalAddrInvoice.Location).Description


// Find contact information (Generic one)

DirPartyContactInfoView contactInfoView;

contactInfoView = DirPartyContactInfoView::find(partyRecId, _location);


// Find primary address by roles regardless primary or not

public  LogisticsPostalAddress getPostalAddressByType(DirPartyRecId _party, LogisticsLocationRoleType _type)

    {

        DirPartyLocation        partyLocation;

        DirPartyLocationRole    partyLocationRole;

        LogisticsLocation       location;

        LogisticsLocationRole   locationRole;

        LogisticsPostalAddress  postalAddress;


        select firstonly postalAddress

        exists join location

            where location.RecId == postalAddress.Location

        exists join locationRole

            where locationRole.Type  == _type

        exists join partyLocation

            where partyLocation.Location == location.RecId &&

                partyLocation.Party == _party

        exists join partyLocationRole

            where partyLocationRole.PartyLocation == partyLocation.RecId &&

                partyLocationRole.LocationRole == locationRole.RecId;


        return postalAddress;


    }


// Get contact information on Address (advanced )

public Description1000 contactOnAddress(LogisticsPostalAddress  postalAddress)

    {

        Description                 phone,fax,Url;

        LogisticsLocation           parentLocation, childLocation;

        DirPartyLocation            dirPartyLocation;

        LogisticsElectronicAddress  electronicAddress;


        while select childLocation

        where childLocation.ParentLocation == postalAddress.Location

        join electronicAddress

        where electronicAddress.Location == childLocation.RecId

        {

            if(electronicAddress.Type == LogisticsElectronicAddressMethodType::Phone )

            {

                phone =  electronicAddress.Locator;

            }

            if(electronicAddress.Type == LogisticsElectronicAddressMethodType::Fax )

            {

                fax =  electronicAddress.Locator;

            }

            if(electronicAddress.Type == LogisticsElectronicAddressMethodType::URL )

            {

                Url =  electronicAddress.Locator;

            }

            

        }

        return "Phone :"+phone+ " Fax :" +fax+"\n"+Url;

    }

Comments

Popular posts from this blog

Get voucher transactions,settlement , and other details from customer , invocie other posted transactions via GJentry and subledger entry

Get Ledger journal transactions payment marked invoices for posted and non posted