Class:
class HTM_SalesInvoiceController extends SalesInvoiceController
{
public static HTM_SalesInvoiceController construct()
{
return new HTM_SalesInvoiceController();
}
public static void main(Args _args)
{
SrsReportRunController formLetterController = HTM_SalesInvoiceController::construct();
HTM_SalesInvoiceController controller = formLetterController;
controller.parmReportName(ssrsReportStr(HTM_SalesInvoice, Report));
controller.parmArgs(_args);
controller.startOperation();
}
}
-------------------------------------------------------
[ExtensionOf(classStr(SalesInvoiceDP))]
public final class HTM_SalesInvoiceDP_C_Extension
{
protected void populateSalesInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
{
next populateSalesInvoiceHeaderFooterTmp(_custInvoiceJour, _companyInfo);
LogisticsElectronicAddress electronicAddressPhone = DirParty::primaryElectronicAddress(CustTable::find(_custInvoiceJour.InvoiceAccount).Party, LogisticsElectronicAddressMethodType::Phone);
salesInvoiceHeaderFooterTmp.HTM_CustPhone = electronicAddressPhone ? electronicAddressPhone.Locator : '';
salesInvoiceHeaderFooterTmp.HTM_CustEmail = this.getinvoiceEmail(CustTable::find(_custInvoiceJour.InvoiceAccount).party);
salesInvoiceHeaderFooterTmp.HTM_Notes = SalesTable::find(_custInvoiceJour.SalesId).HTMInvoiceNotes;
salesInvoiceHeaderFooterTmp.HTM_Project = this.getDimensionDisplayValue(_custInvoiceJour.DefaultDimension, 'A7Project');
salesInvoiceHeaderFooterTmp.HTM_Vessel = SalesTable::find(_custInvoiceJour.SalesId).HTMVessel;
salesInvoiceHeaderFooterTmp.HTM_PaymentReference = _custInvoiceJour.payment;
salesInvoiceHeaderFooterTmp.CompanyEmail = _companyInfo.email();
SysDocuBrandImages sysDocuBrandImages = SysDocuBrandImages ::find(this.getDimensionDisplayValue(_custInvoiceJour.DefaultDimension, 'A2BusinessUnit'));
if (sysDocuBrandImages.Image)
{
SalesInvoiceHeaderFooterTmp.CompanyLogo = sysDocuBrandImages.Image ;
}
BankAccountTable bankAccountTable = BankAccountTable::find(sysDocuBrandImages.Description);
if (bankAccountTable.RecId)
{
salesInvoiceHeaderFooterTmp.CompanyBankAccount = bankAccountTable.AccountNum;
salesInvoiceHeaderFooterTmp.CompanyBankName = bankAccountTable.Name;
salesInvoiceHeaderFooterTmp.CompanyRegNum = bankAccountTable.RegistrationNum;
salesInvoiceHeaderFooterTmp.SwiftNumber = bankAccountTable.swiftNo;
}
else
{
salesInvoiceHeaderFooterTmp.CompanyBankAccount = BankAccountTable::find(_companyInfo.Bank).AccountNum;
salesInvoiceHeaderFooterTmp.CompanyBankName = BankAccountTable::find(_companyInfo.Bank).Name;
salesInvoiceHeaderFooterTmp.CompanyRegNum = BankAccountTable::find(_companyInfo.Bank).RegistrationNum;
salesInvoiceHeaderFooterTmp.SwiftNumber = BankAccountTable::find(_companyInfo.Bank).swiftNo;
}
if (SalesTable::find(_custInvoiceJour.SalesId).InterCompanyOrder)
{
salesInvoiceHeaderFooterTmp.CustomerRef = SalesTable::find(_custInvoiceJour.SalesId).InterCompanyPurchId;
}
}
/// <summary>
/// Get Invoice Advice Email
/// </summary>
/// <param name = "_refRecid">RefRecid Information</param>
/// <returns>Invoice Email Address</returns>
public Email getInvoiceEmail(RefRecId _refRecid)
{
DirPartyLocation dirPartyLocation;
LogisticsElectronicAddress logisticsElectronicAddress;
LogisticsElectronicAddressRole logisticsElectronicAddressRole;
LogisticsLocationRole logisticsLocationRole;
const str invoiceTo = 'Invoice';
Email invoiceEmail;
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 == invoiceTo
{
invoiceEmail = logisticsElectronicAddress.Locator;
}
}
}
return invoiceEmail;
}
public str getDimensionDisplayValue(RecId defaultDimension, Name dimName)
{
DimensionAttributeValueSetStorage dimStorage;
dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);
return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);
}
}
---------------------------
public class HTM_PrintMgmtDocTypeHandler
{
[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch(_docType)
{
case PrintMgmtDocumentType::SalesOrderInvoice:
_result.result(ssrsReportStr(HTM_SalesInvoice, Report));
break;
}
}
}
-------------------------------------------------------
Table extension:
SalesInvoiceHeaderFooterTmp.HTMships
-------------------------------------------------------
Report: Duplicate the standard report and modify
HTM_SalesInvoice
-------------------------------------------------------
Output Menu Item Extensions:
SalesInvoiceCopy.HTMship
SalesInvoiceOriginal.HTMship
------------------------------------------------------
No comments:
Post a Comment