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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to modify standard report?

(0) ShareShare
ReportReport
Posted on by 932

Hello, I want to add modification to  standard report 'TaxReportInclAdjustment'

I want to add lookup parameter (DataArea from the table CompanyInfo):

I want to know if its possible to create  classes Contract, Controller and DP with the same logic of the standard  classs

1. I add new IUBuilder class : 

[
SrsReportNameAttribute(ssrsReportStr(TaxReportInclAdjustmentCopy, Report))
]
 
class TaxReportingUIBuilder extends SrsReportDataContractUIBuilder
{
    TaxReportContract                   contract;
    DialogField                         dialogTaxPeriod;
    DialogField                         dialogFromdate;
    DialogField                         dialogTodate;

    DialogField                         dialogIncludeDetails;
    DialogField                         dialogTransDate;
    DialogField                         dialogVoucher;

    DialogField                         dialogTaxReported;
    DialogField                         dialogCompanyId;

    AcxSysLookupMultiSelectGrid            sysMultiGridCompanyId;
    SysLookupMultiSelectCtrl               syMultiLookupCompanyId;
    container                             companyIdCon;
    DialogField   dlgCompanyId;
    List    companyIdList;
    public void build()
    {
        contract    = this.dataContractObject() as TaxReportContract;

        dialogFromdate  = this.addDialogField(methodStr(TaxReportContract, parmFromDate), contract);
        dialogTodate    = this.addDialogField(methodStr(TaxReportContract, parmToDate), contract);

        dialogIncludeDetails  = this.addDialogField(methodStr(TaxReportContract, parmIncludeDetails), contract);
        dialogTaxPeriod    = this.addDialogField(methodStr(TaxReportContract, parmTaxPeriod), contract);

        dialogTaxReported  = this.addDialogField(methodStr(TaxReportContract, parmTaxReported), contract);
        dialogTransDate    = this.addDialogField(methodStr(TaxReportContract, parmTransDate), contract);

        dialogVoucher  = this.addDialogField(methodStr(TaxReportContract, parmVoucher), contract);

    }

    public void postBuild()
    {
        super();

        contract = this.dataContractObject() as TaxReportContract;

        //binding dialogs with contract fields

        dlgCompanyId = this.bindInfo().getDialogField(this.dataContractObject(),
            methodStr(TaxReportContract, parmCompanyId));
       
    }

    public void postRun()
    {
        this.lookupCompanyId();
    }

    private void lookupCompanyId()
    {
        Query                   query = new Query();
        QueryBuildDataSource    qbd;

        TableId     multiSelectTableNum = tableNum(CompanyInfo);
        container   selectedFields      = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(CompanyInfo, DataArea))];
       
        qbd = query.addDataSource(tableNum(CompanyInfo));
        qbd.addSelectionField(fieldNum(CompanyInfo, DataArea));
        qbd.fields().dynamic(NoYes::No);
        qbd.fields().clearFieldList();
        qbd.fields().addField(fieldNum(CompanyInfo, DataArea));
        SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), dlgCompanyId.control(), query, false, selectedFields);

    }

    /*private Query CompanyIdQuery()

    {

        Query                           query;
        QueryBuildDataSource            queryBuildDataSource;

        query = new Query();

        queryBuildDataSource = query.addDataSource(tableNum(CompanyInfo));
        queryBuildDataSource.addSelectionField(fieldNum(CompanyInfo,DataArea));

        return query;

    }

    private void CustAccountLookup(FormStringControl CompanyIdLookup)
    {

        sysMultiGridCompanyId = AcxSysLookupMultiSelectGrid::construct(CompanyIdLookup, CompanyIdLookup);
        sysMultiGridCompanyId.parmQuery(this.CompanyIdQuery());
        sysMultiGridCompanyId.run();
        sysMultiGridCompanyId.setSelected();

    }

    public  void getFromDialog()
    {
        super();

        companyIdCon = syMultiLookupCompanyId.getSelectedFieldValues();

        if (companyIdCon)
        {
            contract.parmCompanyId(con2List(companyIdCon));
        }

    }*/

   /* public void postBuild()
    {

        
        super();

        contract = this.dataContractObject() as TaxReportContract;

        //binding dialogs with contract fields

        dlgCompanyId = this.bindInfo().getDialogField(this.dataContractObject(),
            methodStr(TaxReportContract, parmCompanyId));

    }

    public void postRun()
    {

        dialog.dialogForm().formRun().controlMethodOverload(false);

        dialogCompanyId = this.addDialogField(methodStr(TaxReportContract, parmCompanyId), contract);
        dialogCompanyId.lookupButton(3);

        dialogCompanyId              = this.bindInfo().getDialogField(contract,methodStr(TaxReportContract, parmCompanyId));
        syMultiLookupCompanyId       = SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().formRun(), dialogCompanyId.control(), this.CompanyIdQuery());

    }*/

}

2. I add new data Contract  wihich contains the standard code and I add the parameter of companyId  :  

[DataContractAttribute,SysOperationContractProcessingAttribute(classStr(TaxReportingUIBuilder))
]
public class TaxReportContract implements SysOperationValidatable
{
    boolean   includeDetails;
    TaxPeriod taxPeriod;
    TransDate fromDate;
    TransDate toDate;
    TransDate transDate;
    Voucher   voucher;
    NoYes     taxReported;
    List      companyId;
    /// 
    /// Gets or sets the value of the datacontract parameter FromDate.
    /// 
    /// 
    /// The new value of the datacontract parameter FromDate; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter FromDate
    /// 

    [
        DataMemberAttribute('FromDate')
    ]
    public TransDate parmFromDate(TransDate _fromDate = fromDate)
    {
        fromDate = _fromDate;
        return fromDate;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter IncludeDetails.
    /// 
    /// 
    /// The new value of the datacontract parameter IncludeDetails; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter IncludeDetails
    /// 
    [
        DataMemberAttribute('IncludeDetails'),
        SysOperationLabelAttribute(literalstr("@SYS316360"))
    ]
    public boolean parmIncludeDetails(boolean _includeDetails = includeDetails)
    {
        includeDetails = _includeDetails;
        return includeDetails;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter TaxPeriod.
    /// 
    /// 
    /// The new value of the datacontract parameter TaxPeriod; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter TaxPeriod
    /// 
    [
        DataMemberAttribute('TaxPeriod')
    ]
    public TaxPeriod parmTaxPeriod(TaxPeriod _taxPeriod = taxPeriod)
    {
        taxPeriod = _taxPeriod;
        return taxPeriod;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter TaxReported.
    /// 
    /// 
    /// The new value of the datacontract parameter TaxReported; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter TaxReported
    /// 
    [
        DataMemberAttribute('TaxReported')
    ]
    public NoYes parmTaxReported(NoYes _taxReported = taxReported)
    {
        taxReported = _taxReported;
        return taxReported;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter ToDate.
    /// 
    /// 
    /// The new value of the datacontract parameter ToDate; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter ToDate
    /// 
    [
        DataMemberAttribute('ToDate')
    ]
    public TransDate parmToDate(TransDate _toDate = toDate)
    {
        toDate = _toDate;
        return toDate;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter TransDate.
    /// 
    /// 
    /// The new value of the datacontract parameter TransDate; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter TransDate
    /// 
    [
        DataMemberAttribute('TransDate')
    ]
    public TransDate parmTransDate(TransDate _transDate = transDate)
    {
        transDate = _transDate;
        return transDate;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter Voucher.
    /// 
    /// 
    /// The new value of the datacontract parameter Voucher; optional.
    /// 
    /// 
    ///  The current value of datacontract parameter Voucher
    /// 
    [
        DataMemberAttribute('Voucher')
    ]
    public Voucher parmVoucher(Voucher _voucher = voucher)
    {
        voucher = _voucher;
        return voucher;
    }

    /// 
    /// Gets or sets the value of the datacontract parameter companyId.
    /// 
    /// 
    /// 
    ///  The current value of datacontract parameter companyId
    /// 
    [
        DataMemberAttribute('CompanyId')
    ]
    public list parmCompanyId(list _companyId = companyId)
    {
        companyId = _companyId;
        return companyId;
    }

    /// 
    ///    Validates the SSRS report parameters.
    /// 
    /// 
    ///    true if successful; otherwise, false.
    /// 
    public boolean validate()
    {
        boolean ret = true;
        if (!fromDate)
        {
            fromDate = systemdateget();
        }

        if (!toDate)
        {
            toDate = systemdateget();
        }

        if (toDate < fromDate)
        {
            ret = checkFailed("@SYS16982");
        }

        return ret;
    }

}

3. I add new DP class  which contains the same code standard 

4. I duplicate the standard report 'TaxReportInclAdjustment' and I change the DP 

pastedimage1614075861302v1.png

5. I change the properties of menItem and I set the new controller class.

But I don't get any result

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi BASMA,

    Please share the code for your DP class.

    You could have extended the existing classes as well to add the new parameter. You can check this thread for details regarding the same.

  • BASMA Profile Picture
    932 on at

    Hello, 

    I can't do extension for these classes : 

    pastedimage1614079571915v1.png

    This is the  the code of DP class : 

    [
    SRSReportParameterAttribute(classstr(TaxReportContract))
    ]
    class TaxReportDP extends SrsReportDataProviderPreProcessTempDB
    {
        TaxReportInclAdjustmentTmp taxReportInclAdjustmentTmp;
        TransTxt transTxt;
        TaxTrans taxTrans;
        TaxPeriod taxPeriod;
        TransDate fromDate;
        TransDate toDate;
        TransDate transDate;
        boolean flagDetailed;
        boolean reported;
        TaxReportPeriod taxReportPeriod;
        Voucher voucher;
        TmpTaxTrans tmpTaxTrans;
        CompanyInfo companyInfo;
        TaxParameters taxParameters;
        
        Addressing address;
        Addressing companyAddress;
        Name companyName;
        Phone companyPhone;
        VATNum vatNum;
        CompanyName taxAuthName;
        Name taxPeriodName;
    
        ListEnumerator                    companyIdListIterator;
        CompanyId                         companyId;
        List                              parmCompanyId;
        List       list                 = new List(Types::String);
    
        #define.emptyString('')
        /// 
        /// Calculates the Sum transactions and adjustments.
        /// 
    
        private void calc()
        {
            TaxCalcReportInclAdjustment taxCalcReportInclAdjustment;
            #ISOCountryRegionCodes
    
            if (voucher)
            {
                taxCalcReportInclAdjustment = new TaxCalcReportInclAdjustment(taxPeriod,
                                                                              fromDate,
                                                                              true,
                                                                              voucher,
                                                                              transDate);
                reported = true;
            }
            else
            {
                taxCalcReportInclAdjustment = new TaxCalcReportInclAdjustment(taxPeriod,
                                                                              fromDate,
                                                                              false);
                reported = false;
            }
    
            taxCalcReportInclAdjustment.calc();
            tmpTaxTrans = taxCalcReportInclAdjustment.tmpTaxTrans();
        }
    
        /// 
        ///    Inserts the details transaction into TaxReportInclAdjustmentTmp temporary table.
        /// 
        /// 
        ///    The taxPeriod value to use to filter the TaxTrans table data.
        /// 
        /// 
        ///    The fromDate value to use to filter the TaxTrans table data.
        /// 
        /// 
        ///    The toDate value to use to filter the TaxTrans table data.
        /// 
        /// 
        ///    The taxVersion value to use to filter the TaxTrans table data.
        /// 
    
        private void detailedTransactions(TaxPeriod _taxPeriod,
                                            FromDate _fromDate,
                                            ToDate _toDate,
                                            TaxVersion _taxVersion)
        {
            while select taxTrans
            where taxTrans.TaxPeriod == _taxPeriod &&
                    taxTrans.TransDate >= _fromDate  &&
                    taxTrans.TransDate <= _toDate    &&
                    taxTrans.TaxRepCounter == _taxVersion &&
                    taxTrans.Source != TaxModuleType::Tax
            {
                this.insertTaxReportInclAdjustmentTmp(flagDetailed);
    
                if (!taxParameters.PurchTaxOnOperations && taxTrans.TaxDirection == TaxDirection::UseTax)
                {
                    taxTrans.TaxAmountCur = (taxTrans.TaxAmountCur - taxTrans.TaxInCostPriceCur) * -1;
                    taxTrans.TaxAmount = (taxTrans.TaxAmount - taxTrans.TaxInCostPriceMST) * -1;
                    transTxt = "@SYS58906";
                    this.insertTaxReportInclAdjustmentTmp(flagDetailed);
                }
            }
        }
    
        /// 
        /// Retrieves the actual data for the report from the TaxReportInclAdjustmentTmp temporary table.
        /// 
        /// 
        /// The TaxReportInclAdjustmentTmp temporary table.
        /// 
        [
            SRSReportDataSetAttribute('TaxReportInclAdjustmentTmp')
        ]
        public TaxReportInclAdjustmentTmp getTaxReportInclAdjustmentTmp()
        {
            select taxReportInclAdjustmentTmp;
            return taxReportInclAdjustmentTmp;
        }
    
        /// 
        ///    Inserts records into the TaxReportInclAdjustmentTmp temporary table.
        /// 
        /// 
        ///    true if data gets assigned from the TaxReportPeriod table; false if data gets assigned from
        ///    the dialog.
        /// 
    
        protected  void insertTaxReportInclAdjustmentTmp(boolean _flag)
        {
            taxReportInclAdjustmentTmp.Address = address;
            taxReportInclAdjustmentTmp.CompanyAddress = companyAddress;
            taxReportInclAdjustmentTmp.CompanyName = companyName;
            taxReportInclAdjustmentTmp.CompanyPhone = companyPhone;
            if (_flag)
            {
                taxReportInclAdjustmentTmp.FromTaxPeriod = taxReportPeriod.FromDate;
                taxReportInclAdjustmentTmp.ToTaxPeriod = taxReportPeriod.ToDate;
                taxReportInclAdjustmentTmp.Flag = 1;
            }
            else
            {
                taxReportInclAdjustmentTmp.FromDate = fromDate;
                taxReportInclAdjustmentTmp.ToDate = toDate;
                taxReportInclAdjustmentTmp.Flag = 0;
            }
    
            taxReportInclAdjustmentTmp.vatNum = vatNum;
            taxReportInclAdjustmentTmp.TransTxt = transTxt;
            taxReportInclAdjustmentTmp.TaxAuthorityName = taxAuthName;
            taxReportInclAdjustmentTmp.TaxPeriodName = taxPeriodName;
    
            if (_flag)
            {
                taxReportInclAdjustmentTmp.TaxBaseAmountCur = taxTrans.TaxBaseAmountCur;
                taxReportInclAdjustmentTmp.TaxBaseQty = taxTrans.TaxBaseQty;
                taxReportInclAdjustmentTmp.TaxCode = taxTrans.TaxCode;
                taxReportInclAdjustmentTmp.TaxDirection = taxTrans.TaxDirection;
                taxReportInclAdjustmentTmp.TaxCodeName = TaxTable::find(taxTrans.TaxCode).TaxName;
                taxReportInclAdjustmentTmp.TaxPeriod = taxTrans.TaxPeriod;
                taxReportInclAdjustmentTmp.Voucher = taxTrans.Voucher;
                taxReportInclAdjustmentTmp.Source = taxTrans.Source;
                taxReportInclAdjustmentTmp.TransDate = taxTrans.TransDate;
                taxReportInclAdjustmentTmp.TaxAmount = taxTrans.TaxAmount;
                taxReportInclAdjustmentTmp.CurencyCode = taxTrans.CurrencyCode;
                taxReportInclAdjustmentTmp.TaxAmountCur = this.taxTransAmountCur();
                taxReportInclAdjustmentTmp.TaxInCostPrice = taxTrans.TaxInCostPriceCur;
            }
            else
            {
                taxReportInclAdjustmentTmp.TaxBaseAmountCur = this.taxBaseAmountCur();
                taxReportInclAdjustmentTmp.TaxBaseQty = tmpTaxTrans.TaxBaseQty;
                taxReportInclAdjustmentTmp.TaxCode = tmpTaxTrans.TaxCode;
                taxReportInclAdjustmentTmp.TaxDirection = tmpTaxTrans.TaxDirection;
                taxReportInclAdjustmentTmp.TaxCodeName = TaxTable::find(tmpTaxTrans.TaxCode).TaxName;
                taxReportInclAdjustmentTmp.CurencyCode = tmpTaxTrans.CurrencyCode;
                taxReportInclAdjustmentTmp.TaxAmountCur = this.taxAmountCur();
                taxReportInclAdjustmentTmp.TaxInCostPrice = this.taxInCostPrice();
            }
            transTxt = #emptyString;
            taxReportInclAdjustmentTmp.insert();
        }
    
        /// 
        /// Retrieves the records based on the parameters entered.
        /// 
        public void processReport()
        {
            #ISOCountryRegionCodes
            boolean flagCounter;
            boolean includeDetails;
            TaxReportAdjustmentTrans taxReportAdjustmentTrans;
            TaxReportPeriod taxReportPeriodPrevious;
            TaxReportContract contract = this.parmDataContract() as TaxReportContract;
    
            flagDetailed = false;
            flagCounter=false;
    
            Microsoft.Dynamics.Tax.Instrumentation.TaxEventSource taxEventSourceLog = Microsoft.Dynamics.Tax.Instrumentation.TaxEventSource::Log;
            System.Diagnostics.Stopwatch stopWatch;
            guid identifier;
            NoYes isSuccessfulReport;
    
            try
            {
                stopWatch = new System.Diagnostics.Stopwatch();
                identifier = newGuid();
                taxEventSourceLog.TaxReportStart(identifier);
                stopWatch.Start();
    
                companyInfo = CompanyInfo::find();
                taxParameters = TaxParameters::find();
    
                fromDate = contract.parmFromDate();
                toDate = contract.parmToDate();
                transDate = contract.parmTransDate();
                taxPeriod = contract.parmTaxPeriod();
                voucher = contract.parmVoucher();
                includeDetails = contract.parmIncludeDetails();
                parmCompanyId  = contract.parmCompanyId();
                address = TaxAuthorityAddress::address(TaxPeriodHead::find(taxPeriod).TaxAuthority);
                companyAddress = companyInfo.postalAddress().Address;
                companyName = companyInfo.name();
                companyPhone = companyInfo.phone();
    
                vatNum = companyInfo.getPrimaryRegistrationNumber(TaxRegistrationTypesList::TAXID, taxReportInclAdjustmentTmp.ToDate);
                taxAuthName = TaxAuthorityAddress::taxAuthorityName(TaxPeriodHead::find(taxPeriod).TaxAuthority);
                taxPeriodName = TaxPeriodHead::find(taxPeriod).Name;
    
                this.calc();
                if (taxParameters.PurchTaxOnOperations)
                {
                    select tmpTaxTrans where tmpTaxTrans.TaxDirection != TaxDirection::IncomingTax;
                }
    
                while select tmpTaxTrans
                {
                    this.insertTaxReportInclAdjustmentTmp(flagDetailed);
                    if (!taxParameters.PurchTaxOnOperations && tmpTaxTrans.TaxDirection == TaxDirection::UseTax)
                    {
                        tmpTaxTrans.TaxAmountCur = (tmpTaxTrans.TaxAmountCur - tmpTaxTrans.TaxInCostPriceCur) * -1;
                        tmpTaxTrans.TaxAmountMST = (tmpTaxTrans.TaxAmountMST - tmpTaxTrans.TaxInCostPriceMST) * -1;
                        transTxt = "@SYS58906";
                        this.insertTaxReportInclAdjustmentTmp(flagDetailed);
                    }
    
                    flagCounter=true;
                }
    
                // If Include details is checked, then the detailed transactions will get inserted into
                // the temp table TaxReportInclAdjustmentTmp.
                if (includeDetails && flagCounter)
                {
                    flagDetailed = true;
    
                    // Detailed summation of transactions
                    taxReportPeriod = TaxReportPeriod::find(taxPeriod,fromDate);
                    this.detailedTransactions(taxPeriod,
                                                taxReportPeriod.FromDate,
                                                taxReportPeriod.ToDate,
                                                0);
    
                    // Detailed calculation of adjustments
                    if (reported)
                    {
                        while select FromDate,ToDate,TaxVersion from taxReportAdjustmentTrans
                        where taxReportAdjustmentTrans.Voucher   == voucher &&
                              taxReportAdjustmentTrans.TransDate == transDate &&
                              taxReportAdjustmentTrans.TaxPeriod == taxPeriod
                        {
                            this.detailedTransactions(taxPeriod,
                                                taxReportAdjustmentTrans.FromDate,
                                                taxReportAdjustmentTrans.ToDate,
                                                taxReportAdjustmentTrans.TaxVersion);
                        }
                    }
                    else
                    {
                        while select FromDate,ToDate,VersionNum from taxReportPeriodPrevious
                        where taxReportPeriodPrevious.TaxPeriod == taxPeriod &&
                              taxReportPeriodPrevious.FromDate  < fromDate   &&
                              taxReportPeriodPrevious.VersionNum > 0
                        {
                            this.detailedTransactions(taxPeriod,
                                                taxReportPeriodPrevious.FromDate,
                                                taxReportPeriodPrevious.ToDate,
                                                taxReportPeriodPrevious.VersionNum);
                        }
                    }
                }
                isSuccessfulReport = NoYes::Yes;
            }
            catch(Exception::Error)
            {
                isSuccessfulReport = NoYes::No;
                throw Exception::Error;
            }
            finally
            {
                stopWatch.Stop();
                taxEventSourceLog.TaxReportStop(identifier, SysCountryRegionCode::countryInfo(), new MenuFunction(menuItemOutputStr(TaxReportInclAdjustment), menuItemType::Output).label(), 'TaxReportInclAdjustment', isSuccessfulReport, stopWatch.ElapsedMilliseconds);
            }
    
        }
    
        /// 
        ///    Retrieves the TaxAmountCur value for the current record in the TmpTaxTrans table.
        /// 
        /// 
        ///    The TaxAmountCur value of the current record.
        /// 
        private TaxAmountCur taxAmountCur()
        {
            if (taxParameters.PurchTaxOnOperations && tmpTaxTrans.TaxDirection == TaxDirection::UseTax)
            {
                tmpTaxTrans.TaxAmountCur = tmpTaxTrans.TaxAmountCur * -1;
                tmpTaxTrans.TaxAmountMST = tmpTaxTrans.TaxAmountMST * -1;
                tmpTaxTrans.TaxInCostPriceCur = 0;
                tmpTaxTrans.TaxInCostPriceMST = 0;
            }
    
            if (!tmpTaxTrans.CurrencyCode || tmpTaxTrans.CurrencyCode == CompanyInfoHelper::standardCurrency())
            {
                return tmpTaxTrans.TaxAmountMST - tmpTaxTrans.TaxInCostPriceMST;
            }
            else
            {
                return tmpTaxTrans.TaxAmountCur - tmpTaxTrans.TaxInCostPriceCur;
            }
        }
    
        /// 
        ///    Retrieves the TaxBaseAmountCur value for the current record in the TmpTaxTrans table.
        /// 
        /// 
        ///    The TaxBaseAmountCur value of the current record.
        /// 
    
        private TaxBaseCur taxBaseAmountCur()
        {
            if (taxParameters.PurchTaxOnOperations && tmpTaxTrans.TaxDirection == TaxDirection::UseTax)
            {
                tmpTaxTrans.TaxBaseAmountCur = tmpTaxTrans.TaxBaseAmountCur * -1;
                tmpTaxTrans.TaxBaseAmountMST = tmpTaxTrans.TaxBaseAmountMST * -1;
            }
    
            if (!tmpTaxTrans.CurrencyCode || tmpTaxTrans.CurrencyCode == CompanyInfoHelper::standardCurrency())
            {
                return tmpTaxTrans.TaxBaseAmountMST;
            }
            else
            {
                return tmpTaxTrans.TaxBaseAmountCur;
            }
        }
    
        /// 
        ///    Retrieves the TaxInCostPrice value for the current record in the TmpTaxTrans table.
        /// 
        /// 
        ///    The TaxInCostPrice value of the current record.
        /// 
    
        private TaxAmountCur taxInCostPrice()
        {
            if (!tmpTaxTrans.CurrencyCode || tmpTaxTrans.CurrencyCode == CompanyInfoHelper::standardCurrency())
            {
                return tmpTaxTrans.TaxInCostPriceMST;
            }
            else
            {
                return tmpTaxTrans.TaxInCostPriceCur;
            }
        }
    
        /// 
        ///    Retrieves the TaxAmountCur value for the current record in the TaxTrans table.
        /// 
        /// 
        ///    The TaxAmountCur value of the current record.
        /// 
    
        private TaxAmountCur taxTransAmountCur()
        {
            if (taxParameters.PurchTaxOnOperations && taxTrans.TaxDirection == TaxDirection::UseTax)
            {
                taxTrans.TaxAmountCur = taxTrans.TaxAmountCur * -1;
                taxTrans.TaxAmount = taxTrans.TaxAmount * -1;
                taxTrans.TaxInCostPriceCur = 0;
                taxTrans.TaxInCostPriceMST = 0;
            }
    
            if (!taxTrans.CurrencyCode || taxTrans.CurrencyCode == Ledger::accountingCurrency(CompanyInfo::find().RecId))
            {
                return taxTrans.TaxAmount - taxTrans.TaxInCostPriceMST;
            }
            else
            {
                return taxTrans.TaxAmountCur - taxTrans.TaxInCostPriceCur;
            }
        }
    
    }

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    HI BASMA,

    You will need to use Chain of command (CoC) for extending a class. Please check the MS documentation for creating a CoC here.

  • BASMA Profile Picture
    932 on at

    Have any example , because I don't understand the difference between the normal extension and CoC

  • BASMA Profile Picture
    932 on at

    Have you any idea about this post?

  • ToddB Profile Picture
    Microsoft Employee on at

    Hi BASMA,

    Did the examples in the Class extension documentation provide the information needed?

    Class extension - Method wrapping and Chain of Command - Finance & Operations | Dynamics 365 | Microsoft Docs

    If not, you could try posting what you have and others may be able to assist with troubleshooting.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 311

#3
Diego Mancassola Profile Picture

Diego Mancassola 271

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans