Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

Asset Summary Report

(1) ShareShare
ReportReport
Posted on by 1,883
Hi Expert,
 
I have added assetDepreciationSummaryTmp.Reference = assetTable.Reference in Asset Summary report. But Reference is coming empty.
 
 
  while (queryRun.next())
        {
            assetTable = queryRun.get(tableNum(AssetTable)) as AssetTable;

            assetIdRange = queryValue(assetTable.AssetId);
            select assetBook where assetBook.AssetId == assetTable.AssetId;
            bookIdRange = queryValue(assetBook.BookId);

            select * from assettableLoc where assettableLoc.AssetId == assetTable.AssetId;

            acquisitionDate = assetTable.book().AcquisitionDate;
            //AssetTrans::findFirstType_W(assetTable.AssetId, assetBook.BookId, AssetTransType::Acquisition).TransDate;

            if (acquisitionDate <= toDate)
            {
                prev = AssetSumCalc_Trans::newAssetPeriod(assetIdRange, bookIdRange, dateNull(), fromDate - 1);

                if (!prev.isScrapped())
                {
                    curr = AssetSumCalc_Trans::newAssetPeriod(assetIdRange, bookIdRange, fromDate, toDate);

                    assetDepreciationSummaryTmp.clear();

                    assetDepreciationSummaryTmp.AssetGroup = assetTable.AssetGroup;
                    assetDepreciationSummaryTmp.AssetId = assetTable.AssetId;
                    //SFA added 9-Dec-2024
                    assetDepreciationSummaryTmp.Reference = assetTable.Reference;

                    //SFA ended 9-Dec-2024
                   
                    assetDepreciationSummaryTmp.CategoryId = assetTable.CategoryId_LV;
                    assetDepreciationSummaryTmp.Name = assetTable.Name;
 
 
 
Thanks,
Faiz
  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    Asset Summary Report
    I can only repeat that you should use the debugger to see that your code works. For example, that you have the value in database doesn't necessarily mean that it's included in the query.
  • faiz7049 Profile Picture
    faiz7049 1,883 on at
    Asset Summary Report
    Thank you Martin,
     
    This is custom report based on Asset summary report. I just added 
     assetDepreciationSummaryTmp.Reference = assetTable.Reference;
     
    /// <summary>
    /// The <c>AT_NewAssetDepreciationSummaryDP</c> class is the data provider for the <c>AT_NewAssetSummaryDepreciationReport</c> report.
    /// </summary>
    [
        SRSReportQueryAttribute(queryStr(AT_NewAssetDepreciationSummary)),
        SRSReportParameterAttribute(classStr(AT_NewAssetDepreciationSummaryContract))
    ]
    public class AT_NewAssetDepreciationSummaryDP extends SrsReportDataProviderPreProcessTempDB
    {
        AT_NewAssetDepreciationSummaryTmp assetDepreciationSummaryTmp;
        /// <summary>
        /// Gets a <c>AT_NewAssetDepreciationSummaryTmp</c> record.
        /// </summary>
        /// <returns>
        /// The <c>AT_NewAssetDepreciationSummaryTmp</c> record.
        /// </returns>
        [
            SRSReportDataSetAttribute(tableStr(AT_NewAssetDepreciationSummaryTmp))
        ]
        public AT_NewAssetDepreciationSummaryTmp getAssetDepreciationSummaryTmp()
        {
            select assetDepreciationSummaryTmp;
            return assetDepreciationSummaryTmp;
        }
    
        /// <summary>
        /// Fetches the results returned by the query and uses <c>AssetSumCalc</c> class to perform calculations.
        /// The results are populated in the <c>AT_NewAssetDepreciationSummaryTmp</c> table and provided to the report.
        /// </summary>
        public void processReport()
        {
            AssetBook assetBook;
            AssetTable assetTable, assettableLoc;
            AssetSumCalc_Trans prev, curr;
            AT_NewAssetDepreciationSummaryContract contract;
            Range assetIdRange, bookIdRange;
            AssetTrans astr;
            QueryRun queryRun;
            FromDate fromDate;
            ToDate toDate;
            TransDate acquisitionDate;
            DefaultDimensionView ddfvw;
    
            contract = this.parmDataContract() as AT_NewAssetDepreciationSummaryContract;
            fromDate = contract.parmFromDate();
            toDate = contract.parmToDate();
    
            queryRun = new QueryRun(this.parmQuery());
    
            while (queryRun.next())
            {
                assetTable = queryRun.get(tableNum(AssetTable)) as AssetTable;
    
                assetIdRange = queryValue(assetTable.AssetId);
                select assetBook where assetBook.AssetId == assetTable.AssetId;
                bookIdRange = queryValue(assetBook.BookId);
    
                select * from assettableLoc where assettableLoc.AssetId == assetTable.AssetId;
    
                acquisitionDate = assetTable.book().AcquisitionDate;
                //AssetTrans::findFirstType_W(assetTable.AssetId, assetBook.BookId, AssetTransType::Acquisition).TransDate;
    
                if (acquisitionDate <= toDate)
                {
                    prev = AssetSumCalc_Trans::newAssetPeriod(assetIdRange, bookIdRange, dateNull(), fromDate - 1);
    
                    if (!prev.isScrapped())
                    {
                        curr = AssetSumCalc_Trans::newAssetPeriod(assetIdRange, bookIdRange, fromDate, toDate);
    
                        assetDepreciationSummaryTmp.clear();
    
                        assetDepreciationSummaryTmp.AssetGroup = assetTable.AssetGroup;
                        assetDepreciationSummaryTmp.AssetId = assetTable.AssetId;
                        //SFA added 9-Dec-2024
                        assetDepreciationSummaryTmp.Reference = assetTable.Reference;
    
                        //SFA ended 9-Dec-2024
                       
                        assetDepreciationSummaryTmp.CategoryId = assetTable.CategoryId_LV;
                        assetDepreciationSummaryTmp.Name = assetTable.Name;
                        select ddfvw where ddfvw.DefaultDimension==assetTable.assetBookCurrent().DefaultDimension && ddfvw.Name=='BusinessUnit';
                        assetDepreciationSummaryTmp.AT_BusinessUnit=ddfvw.dimensionDiscription();
                        select ddfvw where ddfvw.DefaultDimension==assetTable.assetBookCurrent().DefaultDimension && ddfvw.Name=='CostCenter';
                        assetDepreciationSummaryTmp.AT_CostCenter=ddfvw.dimensionDiscription();
                        select ddfvw where ddfvw.DefaultDimension==assetTable.assetBookCurrent().DefaultDimension && ddfvw.Name=='Department';
                        assetDepreciationSummaryTmp.AT_Department=ddfvw.dimensionDiscription();
    
                        assetDepreciationSummaryTmp.AcquisitionDate = acquisitionDate;
                        assetDepreciationSummaryTmp.BookId = assetBook.BookId;
    
                        assetDepreciationSummaryTmp.FinancialValuePrev = prev.financialValue();
    
                        if (curr.isScrapped())
                        {
                            assetDepreciationSummaryTmp.FinancialValueCurr = -assetDepreciationSummaryTmp.FinancialValuePrev;
                            assetDepreciationSummaryTmp.FinancialValueEndb = 0;
                            assetDepreciationSummaryTmp.NetBookValue = 0;
                        }
                        else
                        {
                            assetDepreciationSummaryTmp.FinancialValueCurr = curr.financialValue();
                            assetDepreciationSummaryTmp.FinancialValueEndb = assetDepreciationSummaryTmp.FinancialValuePrev +
                                                                            assetDepreciationSummaryTmp.FinancialValueCurr;
                            assetDepreciationSummaryTmp.NetBookValue = prev.netBookValue() + curr.netBookValue();
                        }
    
                        assetDepreciationSummaryTmp.AT_AssetLife=assetBook.ServiceLife;
                        assetDepreciationSummaryTmp.DepreciationStart   = -prev.depreciation();
                        assetDepreciationSummaryTmp.DepreciationPeriod  = -curr.depreciation();
                        assetDepreciationSummaryTmp.DepreciationEnd     = assetDepreciationSummaryTmp.DepreciationStart + assetDepreciationSummaryTmp.DepreciationPeriod;
                        assetDepreciationSummaryTmp.AT_AssetStatus      = assetBook.Status;
                        assetDepreciationSummaryTmp.AT_DisposalDate     = assetBook.DisposalDate;
                       // assetDepreciationSummaryTmp.AT_ResidualValue    = assetBook.ScrapValue; // CM by Muk
                        assetDepreciationSummaryTmp.AT_ResidualValue    = assettableLoc.ResidualValue;
                        assetDepreciationSummaryTmp.AT_DepreciableValue = (prev.acquisitionValue()+curr.acquisitionValue()+prev.acquisitionAdjValue()+curr.acquisitionAdjValue())-assetBook.ScrapValue;
                        assetDepreciationSummaryTmp.AT_AcquisitionValue = prev.acquisitionValue()+curr.acquisitionValue()+prev.acquisitionAdjValue()+curr.acquisitionAdjValue();
                        assetDepreciationSummaryTmp.AT_DepStartDate     = assetBook.DepreciationStartDate;
                        assetDepreciationSummaryTmp.AT_DepEndDate       = assetBook.LastDepreciationDate;
                        assetDepreciationSummaryTmp.AT_FinvalPeriodStart    = prev.financialValue();
                        assetDepreciationSummaryTmp.AT_FinvalPeriodStart    =curr.acquisitionAdjValue();
                        assetDepreciationSummaryTmp.AT_ValDelinPeriod       =curr.disposalValue();
                        assetDepreciationSummaryTmp.AT_FinvalPeriodEnd      =prev.financialValue()+curr.acquisitionAdjValue()-curr.disposalValue();
                        assetDepreciationSummaryTmp.AT_NetbookValPeriodEnd  =prev.netBookValue() + curr.netBookValue();
                        select sum(AmountMST) from astr where astr.AssetId==assetBook.AssetId && astr.TransDate==assetBook.DisposalDate;
                        if(astr.AmountMST)
                        {
                            assetDepreciationSummaryTmp.AT_DepreciationonDeletion = astr.AmountMST;
                        }
                        else
                        {
                            assetDepreciationSummaryTmp.AT_DepreciationonDeletion=0;
                        }
    
                        //CS added by ATG Harsha 24 Jun 24
                        assetDepreciationSummaryTmp.AssetLocationName = AssetLocation::find(AssetTable::find(assetDepreciationSummaryTmp.AssetId).Location).Name;
                        //CE added by ATG Harsha 24 Jun 24
    
    
                       
                        assetDepreciationSummaryTmp.insert();
                    }
                }
            }
        }
    
    }
     
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    Asset Summary Report
    First of all, make sure that the line (where you're assigning Reference) is called at all and that assetTable.Reference has a value. Use the debugger to find it out.
     
    If you need more help from us, don't forget to tell us where you have your code. I see you didn't use an extension of standard code; you modified some code directly, therefore even the previous solution must have been a customization.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans