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

Community site session details

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

Custom RDP Proforma Invoice Report Missing Markup Charges When Status Is Invoiced

(0) ShareShare
ReportReport
Posted on by 134

Hello,

I have created a custom SSRS RDP-based Proforma Invoice report. The report works correctly for most cases, but when the status is Invoiced, the markup charges are not appear on the report.

Below is my DP class code:

I shared line data code only
 
//For Sales Order
while select * from projProposalJour where projProposalJour.ProposalId == proposalId
join projProposalItem where projProposalItem.ProposalId == projProposalJour.ProposalId
join projProposalItemDetail where projProposalItemDetail.ProposalRefRecId == projProposalItem.RecId
{
    LineTmp.clear();
    LineTmp.Sunb_Description = projProposalItem.Txt;
    LineTmp.LineAmount       = projProposalItemDetail.LineAmount;
    TotalLineAmt            += LineTmp.LineAmount;
    LineTmp.QTY              = projProposalItem.Qty();
    LineTmp.SalesPrice       = projProposalItemDetail.SalesPrice;
    // Find SalesLine to get HSN/SAC
    select firstonly salesLine
where salesLine.ProjTransId == projProposalItem.ProjTransId;
    transTaxInformation = TransTaxInformationHelper::findOrCreateTransTaxInformation(salesLine.TableId, salesLine.RecId);
    select firstonly hsnCodeTable
where hsnCodeTable.RecId == transTaxInformation.HSNCodeTable;
    if (hsnCodeTable)
    {
        hsn = hsnCodeTable.Code;
    }
    else
    {
        hsn = HSNCodeTable_IN::find(inventTable.HSNCodeTable_IN).Code;
    }
    select firstonly serviceAccountingCodeTable_IN
where serviceAccountingCodeTable_IN.RecId == transTaxInformation.ServiceAccountingCodeTable;
    if (serviceAccountingCodeTable_IN)
    {
        sac = serviceAccountingCodeTable_IN.SAC;
    }
    else
    {
        sac = ServiceAccountingCodeTable_IN::find(inventTable.ServiceAccountingCodeTable_IN).SAC;
    }
    LineTmp.Sunb_HSN_SAC = hsn + sac;
    // ---------------- TAX CALCULATION ----------------
    if (projProposalJour.CurrencyId == 'INR')
    {
        projProposalTotals = new ProjProposalTotals(projProposalJour);
        taxableDocument    = TaxableDocumentObject::construct(projProposalTotals.parmTaxableDocDescriptorItemSOTrans());
        taxDocumentObject  = TaxBusinessService::calculateTax(taxableDocument);
        if (taxDocumentObject)
        {
            // IGST
            lineEnumerator = taxDocumentObject.componentLines("GST","IGST");
            while (lineEnumerator.moveNext())
            {
                componentLineObject = lineEnumerator.current();
                real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                if (TaxableAmount == LineTmp.LineAmount)
                {
                    LineTmp.IGST      = abs(TaxAmount);
                    IGST             += LineTmp.IGST;
                    LineTmp.Sunb_TaxRate = TaxValue;
                }
            }
            // SGST
            lineEnumerator = taxDocumentObject.componentLines("GST","SGST");
            while (lineEnumerator.moveNext())
            {
                componentLineObject = lineEnumerator.current();
                real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                if (TaxableAmount == LineTmp.LineAmount)
                {
                    LineTmp.SGST      = abs(TaxAmount);
                    SGST             += LineTmp.SGST;
                    LineTmp.Sunb_TaxRate = TaxValue;
                }
            }
            // CGST
            lineEnumerator = taxDocumentObject.componentLines("GST","CGST");
            while (lineEnumerator.moveNext())
            {
                componentLineObject = lineEnumerator.current();
                real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                if (TaxableAmount == LineTmp.LineAmount)
                {
                    LineTmp.CGST      = abs(TaxAmount);
                    CGST             += LineTmp.CGST;
                    LineTmp.Sunb_TaxRate = TaxValue;
                }
            }
        }
    }
    TotalGst    = SGST + CGST + IGST;
   
    
    // ---------------- MARKUP CHARGES START----------------
    while select markuptranspro
    where markuptranspro.TransRecId == salesLine.RecId
    {
        ChargesTmp.clear();
        ChargesTmp.Charges_Description   = markuptranspro.Txt;
        ChargesTmp.Charges_TaxableAmount = markuptranspro.Value;                    //markuptranspro.Value;
        TotalChrgesTaxAmt               += ChargesTmp.Charges_TaxableAmount;
        //hsn charges code
        // Find SalesLine to get HSN/SAC
        select firstonly salesLine
         where salesLine.ProjTransId == projProposalItem.ProjTransId;
        transTaxInformation = TransTaxInformationHelper::findOrCreateTransTaxInformation(salesLine.TableId, salesLine.RecId);
        select firstonly hsnCodeTable
    where hsnCodeTable.RecId == transTaxInformation.HSNCodeTable;
        if (hsnCodeTable)
        {
            hsn = hsnCodeTable.Code;
        }
        else
        {
            hsn = HSNCodeTable_IN::find(inventTable.HSNCodeTable_IN).Code;
        }
        select firstonly serviceAccountingCodeTable_IN
    where serviceAccountingCodeTable_IN.RecId == transTaxInformation.ServiceAccountingCodeTable;
        if (serviceAccountingCodeTable_IN)
        {
            sac = serviceAccountingCodeTable_IN.SAC;
        }
        else
        {
            sac = ServiceAccountingCodeTable_IN::find(inventTable.ServiceAccountingCodeTable_IN).SAC;
        }
        ChargesTmp.Sunb_HSN_SAC = hsn + sac;

        // ---------------- CHARGES TAX CALCULATION ----------------
        if (projProposalJour.CurrencyId == 'INR')
        {
            projProposalTotals = new ProjProposalTotals(projProposalJour);
            taxableDocument    = TaxableDocumentObject::construct(projProposalTotals.parmTaxableDocDescriptorItemSOTrans());
            taxDocumentObject  = TaxBusinessService::calculateTax(taxableDocument);
            if (taxDocumentObject)
            {
                // IGST
                lineEnumerator = taxDocumentObject.componentLines("GST","IGST");
                while (lineEnumerator.moveNext())
                {
                    componentLineObject = lineEnumerator.current();
                    real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                    real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                    real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                    if (TaxableAmount == ChargesTmp.Charges_TaxableAmount)
                    {
                        ChargesTmp.Charges_IGST    = abs(TaxAmount);
                        ChargesIGST               += ChargesTmp.Charges_IGST;
                        ChargesTmp.Charges_TaxRate = TaxValue;
                    }
                }
                // SGST
                lineEnumerator = taxDocumentObject.componentLines("GST","SGST");
                while (lineEnumerator.moveNext())
                {
                    componentLineObject = lineEnumerator.current();
                    real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                    real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                    real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                    if (TaxableAmount == ChargesTmp.Charges_TaxableAmount)
                    {
                        ChargesTmp.Charges_SGST    = abs(TaxAmount);
                        ChargesSGST               += ChargesTmp.Charges_SGST;
                        ChargesTmp.Charges_TaxRate = TaxValue;
                    }
                }
                // CGST
                lineEnumerator = taxDocumentObject.componentLines("GST","CGST");
                while (lineEnumerator.moveNext())
                {
                    componentLineObject = lineEnumerator.current();
                    real TaxValue       = componentLineObject.getMeasure("Rate").value().value();
                    real TaxableAmount  = componentLineObject.getMeasure("Base Amount").value().value();
                    real TaxAmount      = (TaxableAmount * TaxValue * 100) / 100;
                    if (TaxableAmount == ChargesTmp.Charges_TaxableAmount)
                    {
                        ChargesTmp.Charges_CGST    = abs(TaxAmount);
                        ChargesCGST               += ChargesTmp.Charges_CGST;
                        ChargesTmp.Charges_TaxRate = TaxValue;
                    }
                }
            }

            TotalCharges = ChargesIGST + ChargesCGST + ChargesSGST + TotalChrgesTaxAmt;
            ChargesTmp.insert();
     
        }
    }
    
    // ---------------- MARKUP CHARGES END ----------------
       
    TotalAmount = TotalGst + TotalLineAmt + TotalCharges;

    if (projProposalJour.CurrencyId == 'INR')
    {
        //LineTmp.Sunb_TotalInWords = Sunb_NumToWord1::numeralsToTxt_IN(TotalAmount);
        LineTmp.Sunb_TotalInWords = Sunb_NumToWord1::numeralsToTxt_MultiCurrency(TotalAmount, 'INR');
    }
 
         LineTmp.insert();
        LineTmp.clear();
      }
 
 

Could you please help me understand why markup charges are missing when the status is Invoiced, and how I can fix this issue?

Thank you!

I have the same question (0)
  • Martin Dráb Profile Picture
    237,628 Most Valuable Professional on at
    Custom RDP Proforma Invoice Report Missing Markup Charges When Status Is Invoiced
    Status of which record do you have in mind? It sounds strange to me if you want a proforma invoice of something that have already been invoiced for real.
     
    What did you find when you debugger your code? What's the place that doesn't behave as expected?
     
    By the way, you'll make your life (and life of anyone else reading your code) much easier if you start using methods to split the code to smaller, named pieces. Also note that you can declare variables where needed, not just at the top of the method as in AX 2012 and before. It'll again make your code easier and to read and refactor (e.g. when you decide to extract a piece of code to a separate method).
  • Priya_K Profile Picture
    134 on at
    Custom RDP Proforma Invoice Report Missing Markup Charges When Status Is Invoiced
     
     
    Thank you for your reply and guidance.
     

     In my requirement, when the Invoice proposal status is Invoiced, I also need to display the markup charges on the report. Right now, the  markup charges are visible only when the status is Open Order, but they do not appear once the status becomes Invoiced.
     While debugging, I noticed that the code does not enter the markup charges section at all. The debugger directly jumps outside that logic,  so the markup records are never picked.
     
    Just to clarify, the code I shared is only for the Sales Order transaction. I have similar code written for Hour, On-account, Fee, and Journal transactions as well. Because of this, many tables and variables are declared in the DP class.
     
    I really appreciate your advice about improving the code structure. I will definitely follow it and try to write cleaner code. I have been working on D365 F&O (X++) for around eight months, and I am still learning and improving every day.
     
    Thank you again for your help and suggestions.
     
  • Martin Dráb Profile Picture
    237,628 Most Valuable Professional on at
    Custom RDP Proforma Invoice Report Missing Markup Charges When Status Is Invoiced
    Okay, continue debugging to find why exactly "the code does not enter the markup charges section". There may be a condition, or an exception. You need to find the problem before you can address it.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 758 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 607 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 402 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans