Hi guys,
SalesInvoice report in extension
1.Duplicate the standard report, change the name as required and design the report as required.
2.Extend the Standard tables to add necessary fields in SalesInvoiceTmp.TankitCustomization and SalesInvoiceHeaderFooterTmp.TankitCustomization.
3.create a class for printmanagement document type.
Usually this reports are openning only call the report name and design in PrintMgmtDocType_getDefaultReportFormatDelegate in my case the customer country
region(in legal entity address tab) code is AE in standard the AE country region have the induvidual design that called in controller class.
4.create a class and extends base class SalesInvoiceController, change class name in code and the necessary methods to open the our customized report.
[ExtensionOf(classStr(SalesInvoiceDP))]
public final class SalesInvoiceDP_Extension
{
protected void populateSalesInvoiceTmp(CustInvoiceJour _custInvoiceJour,
CustInvoiceTrans _custInvoiceTrans,
TaxSpec _taxSpec,
CustPaymSchedLine _custPaymSchedLine,
CustTrans _prepaymentCustTrans,
TaxTrans _prepaymentTaxTrans)
{
SalesTable salesTable = _custInvoiceJour.salesTable();
SalesLine salesLine = _custInvoiceTrans.salesLine();
TaxTable taxTable;
UnitOfMeasureTranslation translation;
CustTable custTable =CustTable::find(_custInvoiceJour.InvoiceAccount);
next populateSalesInvoiceTmp(_custInvoiceJour,_custInvoiceTrans,_taxSpec,_custPaymSchedLine,
_prepaymentCustTrans,_prepaymentTaxTrans);
salesInvoiceTmp.Description = salesLine.Name;
salesInvoiceTmp.InvoiceDate = DateTimeUtil::date(_custInvoiceJour.InvoiceDate);
salesInvoiceTmp.InvoiceDueDate = _custInvoiceJour.DueDate;
taxTable = TaxTable::find(_prepaymentTaxTrans.TaxCode);
salesInvoiceTmp.VATPercentage = taxTable.showTaxValue();
salesInvoiceTmp.SalesTaxAmount =_custInvoiceJour.SumTax; //this.displaySourceRegulateAmountCur(_prepaymentTaxTrans);
salesInvoiceTmp.RegistrationNumber = TaxRegistration::getTaxRegistrationFromCust(custTable.AccountNum,DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone()) , 5637145326).RegistrationNumber;
salesInvoiceTmp.CustomerRef = salestable.CustomerRef;
salesInvoiceTmp.PurchOrderFormNum = salestable.PurchOrderFormNum;
salesInvoiceTmp.SalesName = salestable.SalesName;
salesInvoiceTmp.Address = CustTable::find(_custInvoiceJour.InvoiceAccount).postalAddress().Address;
salesInvoiceTmp.Payment = PaymTerm::find(_custInvoiceJour.Payment).Description;
select firstonly Description from translation where translation.UnitOfMeasure == UnitOfMeasure::findBySymbol(salesLine.SalesUnit).RecId;
salesInvoiceTmp.SalesUnit = translation.Description;
salesInvoiceTmp.AmountInWords = this.numeralsToTxt_US(custInvoiceJour.InvoiceAmount);
}
protected void populateSalesInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
{
CompanyImage companyImage;
LogisticsPostalAddress _postalAddress;
LogisticsLocation _location;
BankAccountTable bankAccountTable =BankAccountTable::findByCompany(_companyInfo.DataArea,_companyInfo.Bank);
next populateSalesInvoiceHeaderFooterTmp(_custInvoiceJour, _companyInfo);
companyImage = CompanyImage::find(_companyInfo.DataAreaId, _companyInfo.TableId, _companyInfo.RecId, true, CompanyImageType::CompanyLogo);
salesInvoiceHeaderFooterTmp.CompanyLogoImage = companyImage.Image;
salesInvoiceHeaderFooterTmp.FooterImage = companyImage.LeftFooter;
salesInvoiceHeaderFooterTmp.FooterImageFaceBook = companyImage.RightFooterFaceBook;
salesInvoiceHeaderFooterTmp.FooterImageInsta = companyImage.RightFooterInsta;
salesInvoiceHeaderFooterTmp.FooterImageLinkedIn = companyImage.RightFooterLinkedIn;
salesInvoiceHeaderFooterTmp.ContactEmail = companyInfo.primaryEmail();
salesInvoiceHeaderFooterTmp.ContactTelephone = companyInfo.primaryPhone();
salesInvoiceHeaderFooterTmp.ContactUrl = companyInfo.PrimaryURL();
salesInvoiceHeaderFooterTmp.ContactFax = companyInfo.primaryFax();
select * from _location
join _postalAddress where _location.RecId == _postalAddress.Location
join * from bankAccountTable where bankAccountTable.Location == _location.RecId;
salesInvoiceHeaderFooterTmp.CompanyPaymId = _location.Description;
// salesInvoiceHeaderFooterTmp.CompanyPaymId = LogisticsLocation::find(bankAccountTable.Location).Description;//LogisticsLocation::find(dirPartyLocation.Location).Description;//bankAccountTable.CompanyPaymId;//this.parmCompanyBankAccountTable().CompanyPaymId;//
salesInvoiceHeaderFooterTmp.Bank = bankAccountTable.Name;//this.parmCompanyBankAccountTable().Name;//
salesInvoiceHeaderFooterTmp.BankAccountNum = bankAccountTable.AccountNum;//this.parmCompanyBankAccountTable()
salesInvoiceHeaderFooterTmp.CompanyIBAN = bankAccountTable.IBAN;
}
Thanks