web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

SalesInvoice Extension in D365FnO

(0) ShareShare
ReportReport
Posted on by 1,215
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







I have the same question (0)
  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Do you have some question here?

  • Blue Wang Profile Picture
    Microsoft Employee on at

    Hi Riyas,

    Is this knowledge sharing?

    If so, thank you very much, but you'd better apply for a blog to post and manage it.

    community.dynamics.com/.../request-blog-submission

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 681 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 551 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 471

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans