Tuesday, 28 December 2021

Cust Tax registration number x++ D365

 public str getCRNum(CustAccount   _custAccount)

    {

        CustTable           custTable   =   CustTable::find(_custAccount);

        DirPartyTable       dirPartyTable;

        DirPartyLocation    dirPartyLocation;

        TaxRegistration     taxRegistration;

        TaxRegistrationType taxRegistrationType;

        TaxRegistrationTypeApplicabilityRule    taxRegistrationTypeApplicabilityRule;


        select taxRegistration

            join taxRegistrationTypeApplicabilityRule

            join taxRegistrationType

            join dirPartyLocation

            join dirPartyTable

            join custTable

            where taxRegistration.DirPartyLocation  ==  dirPartyLocation.RecId

            && taxRegistration.TaxRegistrationTypeApplicabilityRule ==  taxRegistrationTypeApplicabilityRule.RecId

            && taxRegistrationTypeApplicabilityRule.TaxRegistrationType ==  taxRegistrationType.RecId

            && taxRegistrationType.TaxRegstrationType == "CR"

            && dirPartyLocation.Party   ==  dirPartyTable.RecId

            && dirPartyTable.RecId  ==  custTable.Party;

        

        return taxRegistration.RegistrationNumber;

    }

No comments:

Post a Comment