Thursday, March 24, 2022

Update existing report logic in Process Record

 // <summary>

    ///  Post event handler for processReport method.

    /// </summary>

    /// <param name="args">The arguments</param>

    [PostHandlerFor(classStr(AssetInventoryWorkSheetDP), methodStr(AssetInventoryWorkSheetDP, processReport))]

    public static void AssetInventoryWorkSheetDP_Post_processReport(XppPrePostArgs args)

    {

//1. Get the DP class buffer using args.getThis(). 

//2. Get the temporary table variable using get method

        AssetInventoryWorkSheetDP   assetInventoryWorkSheetDP       = args.getThis() as AssetInventoryWorkSheetDP;

        AssetTmpInventoryWorkSheet  assetTmpInventoryWorkSheetLoc   = assetInventoryWorkSheetDP.getAssetTmpPhysicalInventory();

        AssetTable                  assetTable;


        ttsbegin;

        while select forupdate assetTmpInventoryWorkSheetLoc

            join Barcode, RecId from assetTable

                where assetTable.AssetId == assetTmpInventoryWorkSheetLoc.AssetId

        {

            AssetImage      assetImage      = AssetImage::findForAsset(assetTable.RecId);

            AssetSumCalc    assetSumCalc    = AssetSumCalc_Trans::newAssetYear(

                                            assetTmpInventoryWorkSheetLoc.AssetId,

                                            assetTmpInventoryWorkSheetLoc.BookId);


            assetTmpInventoryWorkSheetLoc.Barcode        = assetTable.Barcode;

            assetTmpInventoryWorkSheetLoc.NetBookValue   = assetSumCalc.netBookValue();

            assetTmpInventoryWorkSheetLoc.Image          = assetImage.Image;


            if (assetImage.RecId)

            {

                assetTmpInventoryWorkSheetLoc.ImageExists    = true;

            }

            else

            {

                assetTmpInventoryWorkSheetLoc.ImageExists    = false;

            }


            assetTmpInventoryWorkSheetLoc.update();

        }

        ttscommit;

    }

No comments:

Post a Comment

Sample Dialog Syntax - 1

 class AffiliationAutoAssignment extends RunBaseBatch {     // 1. Class Declaration and Pack variables     #define.CurrentVersion(1)     #de...