How to get Customer,Vendor VAT Registration Number by code in Axapta
Views (2993)
To get Customer,Vendor VAT Registration Number by code in Axapta in 2012 version you can try below code in data method on table label then you can use the method in string control on form .
This code will work perfectly .
display name Get_TaxRegistration()
{
TransDate _transDate = systemDateGet();
DirPartyLocation dirPartyLocation;
TaxRegistration taxRegistration;
TaxRegistrationTypeApplicabilityRule taxRegistrationTypeApplicabilityRule;
if (_transDate)
{
dirPartyLocation = DirPartyLocation::findByPartyLocation(
this.Party,
this.invoiceAddress().Location);
if (dirPartyLocation)
{
select firstonly validTimeState(_transDate) taxRegistration
where taxRegistration.DirPartyLocation == dirPartyLocation.RecId
join RecId from taxRegistrationTypeApplicabilityRule
order by taxRegistrationTypeApplicabilityRule.IsPrimaryAddressRestricted desc
where taxRegistration.TaxRegistrationTypeApplicabilityRule == taxRegistrationTypeApplicabilityRule.RecId;
}
}
return taxRegistration.RegistrationNumber;
}
This was originally posted here.
*This post is locked for comments