Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Sales Invoice report extension

(0) ShareShare
ReportReport
Posted on by 404

Hello everyone, i want to add some missing fields to the sales invoice report.

In the sales invoice report, we have 3 datasets:SalesInvoiceHeaderFooterTmp, SalesInvoiceLocalizationTmp and SalesInvoiceDS


1.tables that i have added the missing fields: SalesInvoiceHeaderFooterTmp and SalesInvoiceLocalizationTmp (Extension)
2. i added the fields Ex_PreparedBy, Ex_ReceivedBy, Ex_Salesperson, Ex_BankAddress and Ex_Beneficary to the table SalesInvoiceHeaderFooterTmp and the fields        Ex_TaxRate and Ex_VAT to the table SalesInvoiceLocalizationTmp
3. Data type of fields: Ex_TaxRate (String), Ex_VAT(String),Ex_Beneficiary(String),Ex_BankAddress(String),Ex_PreparedBy(String),Ex_ReceivedBy(String),               Ex_SalesPerson(Int64),


Now i need to do extension of the original data provider class which is SalesInvoiceDP (use extension of ) to add these fields.

 but im facing some issue with coding this class. Is there some missing step i forgot to configure?

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Sales Invoice report extension

    Hi, I just checked your query and have replied in new thread. Please Mark the answer/s that helped you in this thread for other fields and lets discuss TaxAmount in new thread.

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Sales Invoice report extension

    Hello mohit, as u can see in the screenshot, im facing an issue with the selected fields, the calculation is coming wrong for my sales invoice report. also the tax rate is coming blank even after i did the class for it. i will share it with u.

    This class is related to showing the tax rate which i am mapping from the taxtrans table and the taxvalue field.

    pastedimage1683292398957v2.pngpastedimage1683292556615v6.pngpastedimage1683292568383v7.png

    please i am facing challenges with the calculation of the fields also. hope u can help .

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Sales Invoice report extension

    But im facing an issue, im trying to read the packing slip id from custpackingslipjour table into my table and field, what i did is :

    CustPackingSlipJour custpackingslipjourLocal = custpackingslipjour::findRecId(_packingSlipJourRecId);

    headerFooterTmp.Ex_PackingSlip = custpackingslipjour.PackingSlipId;

    i think my problem is with the method , can u help?

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Sales Invoice report extension

    actually regarding these fields, i was able to fix it. here's how i did it:

    BankAccountTable bankAccountTableLocal = BankAccountTable::find(companyinfoLocal.Bank);

    LogisticsPostalAddress bankAddress = bankAccountTableLocal.postalAddress();

    headerFooterTmp.SwiftNumber = bankAccountTableLocal.SWIFTNo; // Swift

    headerFooterTmp.Iban = bankAccountTableLocal.IBAN; // Iban

    headerFooterTmp.CompanyBankName = bankAccountTableLocal.Name; // bank name

    headerFooterTmp.CompanyBankAccount = bankAccountTableLocal.AccountID; // bank account

    headerFooterTmp.Ex_BankAddress = bankAddress.Street; // bank address

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Sales Invoice report extension

    Hi Mounir, As mentioned before, I have written the code for reference. IBAN, Swift and bank name fields are already in BankAccountTable. Please use below code and if faced any issue then let us know what steps you have done to fix it.

    Note: Please change YourSwiftNoField and YourIBANField to actual field names.

    headerFooterTmp.Ex_BankAddress = bankAccountTableLocal.postalAddress().Address;
    headerFooterTmp.YourIBANFIeld = bankAccountTableLocal.IBAN;
    headerFooterTmp.YourSwiftNoField = bankAccountTableLocal.SWIFTNo;
    headerFooterTmp.CompanyBankName = bankAccountTableLocal.Name;

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Sales Invoice report extension

    Then first check what is there in expression of those fields in report. Because sometimes those expressions may get removed. If expression is correct then check, if data is coming to temp table via SSMS because mostly for standard temp tables, they will have regular tables only.

    If above doesn't give you progress then find reference on this fields from temp table and check where the code is getting overridden.

    Please let us know an update on this.

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Sales Invoice report extension

    for the other 3 fields, these fields are already found in the table and are created by microsoft, but for some reasons they are reading data while the field in the bank account has data.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Sales Invoice report extension

    For type conversion error, you can check what to map or how to convert.

    For other 3 fields which are empty, have you given the same SQL query and tried that in SSMS? If yes, is it showing data? If not then first try getting data in SSMS and replicate the same in vs.

    Please let us know if you face any issues.

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Sales Invoice report extension

    after i pasted the same logic of ur code, only the bank account field is getting data, for the bank address, i got this error : "Cannot implicitly convert from type 'LogisticsPostalAddress' to type 'str'."

    while for bank name, iban and swift code they still empty.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Sales Invoice report extension

    [DataEventHandler(tableStr(SalesInvoiceHeaderFooterTmp), DataEventType::Inserting)]
    public static void SalesInvoiceHeaderFooterTmp_onInserting(Common sender, DataEventArgs e)
    {
    
        SalesInvoiceHeaderFooterTmp headerFooterTmp = sender as SalesInvoiceHeaderFooterTmp;
        
        CompanyInfo companyinfoLocal = CompanyInfo::find();
        
        BankAccountTable bankAccountTableLocal = BankAccountTable::find(companyinfoLocal.Bank);
        
        headerFooterTmp.CompanyBankAccount = bankAccountTableLocal.AccountID; // bank acount
        
        headerFooterTmp.Ex_BankAddress = bankAccountTableLocal.postalAddress(); // bank address
    }

    You can try leveraging below code. Please note that I have not compiled the code and written it for your reference.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans