static void primaryAddresssTRN(Args _args)
{
CompanyInfo companyInfo;
LogisticsPostalAddress postalAddress;
DirPartyLocation partyLocation;
LogisticsLocationRole locationRole;
DirPartyLocationRole partyLocationRole;
TaxRegistration taxRegistration;
TaxRegistrationType taxRegistrationType;
TaxRegistrationTypeApplicabilityRule taxRegRule;
select companyInfo
join partyLocation
join postalAddress
join partyLocationRole
join locationRole
where companyInfo.DataArea == curext()
&& partyLocation.Party == companyInfo.RecId
&& postalAddress.Location == partyLocation.Location
&& partyLocationRole.PartyLocation == partyLocation.RecId
&& partyLocationRole.LocationRole == locationRole.RecId
&& locationRole.Type == LogisticsLocationRoleType::Business
&& partyLocation.IsPrimary == true;
if(partyLocation)
{
select taxRegistration
join taxRegRule
join taxRegistrationType
where taxRegistration.DirPartyLocation == partyLocation.RecId
&& taxRegistration.TaxRegistrationTypeApplicabilityRule == taxRegRule.RecId
&& taxRegRule.CountryRegionId == LogisticsAddressCountryRegion::findByISOCode(SysCountryRegionCode::countryInfo(curext())).CountryRegionId
&& taxRegRule.TaxRegistrationType == taxRegistrationType.RecId
&& taxRegistrationType.TaxRegstrationType == 'TRN';
}
info(strFmt("%1---%2---%3---%4",locationRole.Type, partyLocation.IsPrimary, postalAddress.Address, taxRegistration.RegistrationNumber));
}
No comments:
Post a Comment