Options

Failing to reset variable for group totals for each FA subclass.

The problem I am facing is that the variable FASubclasstot is not resetting after the FA Subclass changes. It keeps accumulating from the prior class and its now acting as a running total.Help me how do I use the ONPRE DATA ITEM, ON AFTER GET Record and ON POST DATA

ON PREDATA ITEM - I put this code**********************

FA_Appreciation_Tot:=0;
FA_Acquistion_Tot:=0;
FA_Depreciation_Tot:=0;
FA_Disposal_Tot:=0;
FA_Writedown_Tot:=0;
FA_NBV_Tot:=0;
FASubclassNum:="Fixed Asset"."FA Class Code";

ON After GETRECORD************************************

IF FASubclassNum="Fixed Asset"."FA Class Code" THEN
"FA Depreciation Book".RESET;
"FA Depreciation Book".SETFILTER("FA No.","Fixed Asset"."No.");
"FA Depreciation Book".SETRANGE("FA No.","Fixed Asset"."No.");

BEGIN
FA_Acquistion_Tot:="Acquisition Cost"+FA_Acquistion_Tot ;
FA_Appreciation_Tot:=Appreciation+FA_Appreciation_Tot;
FA_Depreciation_Tot:=Depreciation+FA_Depreciation_Tot;
FA_Writedown_Tot:="FA Depreciation Book"."Write-Down"+FA_Writedown_Tot;
FA_Disposal_Tot:= "Proceeds on Disposal"+FA_Disposal_Tot;
// FA_NBV_Tot:= "Book Value" + FA_NBV_Tot;
FA_NBV_Tot:=FA_Acquistion_Tot+FA_Appreciation_Tot+FA_Disposal_Tot+FA_Depreciation_Tot+FA_Writedown_Tot
END;

IF FASubclassNum <>"Fixed Asset"."FA Class Code" THEN
BEGIN
FASubclassGrpTot:=0;
FA_Appreciation_Tot:=0;
FA_Acquistion_Tot:=0;
FA_Depreciation_Tot:=0;
FA_Disposal_Tot:=0;
FA_NBV_Tot:=0;
FASubclassNum:="Fixed Asset"."FA Class Code"
END;


ON POST DATA----no code

Answers

  • Options
    SH2010SH2010 Member Posts: 21
    So the totals for acquisition, appreciation, depreciation etc are not resseting after the subclass code changes
  • Options
    vijay_gvijay_g Member Posts: 884
    edited 2017-02-06
    your code for resetting should come before the value is assigned at onafterget trigger.
  • Options
    KishormKishorm Member Posts: 921
    Are you sure you have posted the code correctly here? The reason I ask is that there is no variable called FASubclasstot and although there is one called FASubclassGrpTot this never gets assigned a value.
Sign In or Register to comment.