Added fields to
Table Extensions:
CustAccountStatementExtTmp.HTMShip
Fields:
HTM_CustomerPhone
HTM_CustomerEmail
HTM_CompanyEmail
Reports:
HTM_CustAccountStatementExt
Classes:
public class HTM_PrintMgmtDocTypeHandler
{
[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch(_docType)
{
case PrintMgmtDocumentType::CustAccountStatement:
_result.result(ssrsReportStr(HTM_CustAccountStatementExt, Report));
break;
}
}
}
------------------------------
[ExtensionOf(classStr(CustAccountStatementExtDP))]
final class HTM_CustAccountStatementExtDP_Extension
{
protected void mapCustAccountStatementExtTmpToNewTempTableInstance(CustAccountStatementExtDPTmpTableCopyMapBuilder _copyMapBuilder)
{
next mapCustAccountStatementExtTmpToNewTempTableInstance(_copyMapBuilder);
_copyMapBuilder.addFieldToMap(fieldNum(CustAccountStatementExtTmp, HTM_CompanyEmail));
_copyMapBuilder.addFieldToMap(fieldNum(CustAccountStatementExtTmp, HTM_CustomerEmail));
_copyMapBuilder.addFieldToMap(fieldNum(CustAccountStatementExtTmp, HTM_CustomerPhone));
}
}
--------------------------------------------------
[ExtensionOf(classstr(CustAccountStatementExtController))]
final Class HTM_CustAccountStatementExtController_Extension
{
protected void populateCustAccountStatementExtTmp(int _custCurrencyIndex)
{
next populateCustAccountStatementExtTmp(_custCurrencyIndex);
custAccountStatementExtTmp.HTMCompanyEmail = CompanyInfo::find().email();
LogisticsElectronicAddress electronicAddressPhone;
custAccountStatementExtTmp.HTMCustomerEmail = this.getCustomerEmail(currentCust.party);
electronicAddressPhone = DirParty::primaryElectronicAddress(currentCust.Party, LogisticsElectronicAddressMethodType::Phone);
custAccountStatementExtTmp.HTMCustomerPhone = electronicAddressPhone.Locator ? electronicAddressPhone.Locator : '' ;
}
public Email getCustomerEmail(RefRecId _refRecid)
{
DirPartyLocation dirPartyLocation;
LogisticsElectronicAddress logisticsElectronicAddress;
LogisticsElectronicAddressRole logisticsElectronicAddressRole;
LogisticsLocationRole logisticsLocationRole;
const str statement = 'Statement';
Email remittanceEmail;
while select dirPartyLocation
where dirPartyLocation.party == _refRecid
{
while select logisticsElectronicAddress
where logisticsElectronicAddress.Location == dirPartyLocation.Location
&& logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Email
{
while select logisticsElectronicAddressRole
where logisticsElectronicAddressRole.ElectronicAddress == logisticsElectronicAddress.RecId
join logisticsLocationRole
where logisticsLocationRole.RecId == logisticsElectronicAddressRole.LocationRole
&& logisticsLocationRole.Name == statement
{
remittanceEmail = logisticsElectronicAddress.Locator;
}
}
}
return remittanceEmail;
}
}
No comments:
Post a Comment