Adding Balance Brought Forward to Contributions

kolaboykolaboy Member Posts: 446
Hi Exerts,
I have a report that i created. There are balances that are imported into a table Called Balances. This balances were the total contributions for each employee before computerization that in 1990. Now i want this balance brought forward to be added to the total contributions for a particulars years say 1991. This result should now show as the balance brought forward for the year 1992. This balance brought for should also be added to the total contributions of 1992 and the answer show as balance brought forward for in the 1993 statement. Also if a user runs the report from say 1990 to 2007, the balance brought forward which is imported into the balances table should be added to the total contributions of an employee from 1990 to 2007 and the sum be taken as balance brought forward for the 2008 statement.

Any ideas on how to go about this. Have a look at the report and please help me solve this.


OBJECT Report 75023 EmployeeStatementByEmployer
{
  OBJECT-PROPERTIES
  {
    Date=12/02/08;
    Time=17:12:37;
    Modified=Yes;
    Version List=SSMS1.5.6;
  }
  PROPERTIES
  {
    Orientation=Portrait;
  }
  DATAITEMS
  {
    { PROPERTIES
      {
        DataItemTable=Table18;
        ReqFilterFields=No.;
      }
      SECTIONS
      {
      }
       }
    { PROPERTIES
      {
        DataItemIndent=1;
        DataItemTable=Table5200;
        DataItemTableView=SORTING(No.)
                          ORDER(Ascending);
        OnAfterGetRecord=BEGIN
                           //Employee.GET(Empid);
                           //EmployeeName := Employee."First Name" + Space + Employee."Middle Name" + Space + Employee."Last Name";
                         END;

        ReqFilterFields=No.;
        DataItemLink=Employer No.=FIELD(No.);
      }
      SECTIONS
      {
      }
       }
    { PROPERTIES
      {
        DataItemIndent=2;
        DataItemTable=Table5207;
        DataItemTableView=SORTING(Employee No.,From Date)
                          ORDER(Ascending);
        PrintOnlyIfDetail=No;
        OnAfterGetRecord=BEGIN

                                             CompanyInfo.GET;
                                             CompanyInfo.CALCFIELDS(Picture);

                                                     // Initialize variables
                                                      FromDate := 010190D;
                                                      ToDate := 311205D;
                                                      Amount := 0; TotalAmount := 0; CurrAccTotal := 0;
                                                      ContMonth := '';
                                                      MonthContAmount := 0;
                                                      // Variable initialization ends above.

                                                      // Setting Range and Filters.
                                                     { Contributions.SETCURRENTKEY("Employee No.","From Date");
                                                      Contributions.SETRANGE("Employee No.",Employee."No.");
                                                      Contributions.SETRANGE("From Date",FromDate,ToDate);
                                                      Contributions.SETFILTER("From Date",'>=%1',FromDate);
                                                      Contributions.SETFILTER("To Date",'<=%1',ToDate); }
                                                      // Range and filter settings end.

                                                      // Getting RetireDate
                                                      IF EVALUATE(NewBirthDate, Employee."Birth Date") THEN BEGIN
                                                        RetireDate1 := CALCDATE('<+60Y>',NewBirthDate);
                                                        RetireDate := FORMAT(RetireDate1,0,'<Day>/<Month>/<Year4>');
                                                      END ELSE
                                                        RetireDate := '';
                                                      // RetireDate Ends above.

                                                      // Getting Bal. Br/FWD from Balances table.
                                                      IF Balances.GET("Employee No.") =TRUE
                                                       THEN  BEGIN
                                                        BalBrFwd := Balances.BalBrFwd;
                                                        END ELSE
                                                        BalBrFwd := 0.00;
                                                      // Getting Bal. Br/FWD ends above.













                                                      // Getting User's Full Name begins.
                                                      User.GET(USERID);
                                                      UserName := User.Name;
                                                      // Getting User's Full Name ends.


                                                      // Code to get Rate from Benefits
                                                      BenefitsKey.SETCURRENTKEY("Period Start");
                                                      BenefitsKey.SETRANGE("Period Start",FromDate,ToDate);
                                                      BenefitsKey.SETFILTER("Period Start",'<=%1',FromDate);
                                                      BenefitsKey.SETFILTER("Period End",'>=%1',ToDate);
                                                      // Code Ends above.


                                                      IF BenefitsKey.FIND('-') THEN
                                                        Rate := BenefitsKey.Rate;


                                                      //Code to Count Months
                                                      IF (FromDate <> 0D) AND (ToDate > FromDate) THEN BEGIN
                                                        Calendar.RESET;
                                                        Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
                                                        Calendar.SETRANGE("Period Start",FromDate,ToDate);
                                                        Months := Calendar.COUNT;
                                                      END ELSE
                                                        Months := 0;
                                                      // Code Ends above.

                                                      //First Code brought down here
                                                      Cont.SETCURRENTKEY("Employee No.","From Date");
                                                      Cont.SETRANGE("Employee No.",Employee."No.");
                                                      Cont.SETRANGE("From Date",FromDate,ToDate);
                                                      Cont.SETFILTER("From Date",'>=%1',FromDate);
                                                      Cont.SETFILTER("To Date",'<=%1',ToDate);

                                                      IF Cont.FIND('-') THEN BEGIN
                                                        TotalAmount := Cont.Quantity;
                                                        IF Cont.NEXT <> 0 THEN
                                                          REPEAT
                                                            TotalAmount := TotalAmount + Cont.Quantity;
                                                          UNTIL Cont.NEXT = 0;
                                                      END;

                                                        Cont.SETRANGE("Employee No.",Empid);

                                                        IF Cont.FIND('-') THEN BEGIN
                                                        TBalBrFwd := Balances.BalBrFwd + Cont.Quantity;
                                                        IF Cont.NEXT <> 0 THEN
                                                          REPEAT
                                                            TBalBrFwd := TBalBrFwd + Cont.Quantity;
                                                          UNTIL Cont.NEXT = 0;
                                                      END;



                                                      Amount := (TotalAmount * Rate * Months)/24;
                                                      CurrAccTotal := Amount + TotalAmount;

                                                      BalInt := BalBrFwd * Rate * Months/12;
                                                      GrandTotal := BalBrFwd + CurrAccTotal + BalInt;


                                                      //Formatting Months Below
                                                      ContMonth := FORMAT(Contributions."To Date",0,'<Month Text>, <Year4>');
                                                      CurrContYear := FORMAT(Contributions."To Date",0,'<Year4>');
                                                      MonthContAmount := Contributions.Quantity;
                                                      EndDate := FORMAT(ToDate,0,'<Day> <Month Text>, <Year4>');
                                                      BeginDate := FORMAT(FromDate,0,'<Day> <Month Text>, <Year4>');
                                                      // Formatting Ends above line.

                           //Employee Contribution
                           ContMonth := FORMAT(Contributions."To Date",0,'<Month Text>, <Year4>');
                           MonthContAmountEmployee := Contributions.Quantity/3;
                           EndDate := FORMAT(ToDate,0,'<Day> <Month Text>,  <Year4>');
                           BeginDate := FORMAT(FromDate,0,'<Day> <Month Text>,  <Year4>');

                           //Employer Contribution
                           ContMonth := FORMAT(Contributions."To Date",0,'<Month Text>, <Year4>');
                           MonthContAmountEmployer := Contributions.Quantity*2/3;
                           EndDate := FORMAT(ToDate,0,'<Day> <Month Text>,  <Year4>');
                           BeginDate := FORMAT(FromDate,0,'<Day> <Month Text>,  <Year4>');


                                                      IF (ContMonth = '' ) OR (MonthContAmount = 0.00)
                                                      OR (CurrContYear <>  FORMAT(ToDate,0,'<Year4>'))
                                                       THEN CurrReport.SKIP;

                                                      RateDisplay := Rate * 100;
                         END;

        DataItemLinkReference=Employee;
        DataItemLink=Employee No.=FIELD(No.);
      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Header;
            SectionWidth=21150;
            SectionHeight=10575;
          }
          CONTROLS
          {
            { 1000000000;TextBox;0    ;0    ;2250 ;1692 ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=TODAY }
            { 1000000001;Label  ;3900 ;3807 ;8250 ;423  ;HorzAlign=Center;
                                                         VertAlign=Center;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=SOCIAL SECURITY AND HOUSING FINANCE CORPORATION }
            { 1000000002;Label  ;4500 ;4230 ;5850 ;423  ;HorzAlign=Center;
                                                         VertAlign=Center;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=NATIONAL PROVIDENT FUND SCHEME }
            { 1000000003;Label  ;3900 ;4653 ;6450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU="EMPLOYEE STATEMENT OF ACCOUNT AS AT " }
            { 1000000004;TextBox;10350;4653 ;4650 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EndDate }
            { 1000000005;PictureBox;3900;0  ;8550 ;3384 ;Border=Yes;
                                                         SourceExpr=CompanyInfo.Picture }
            { 1000000006;Label  ;0    ;6345 ;4200 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=SOCIAL SECURITY NUMBER: }
            { 1000000007;Label  ;0    ;6768 ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=EMPLOYEE NAME: }
            { 1000000008;Label  ;10950;6345 ;3300 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=CURRENT EMPLOYER: }
            { 1000000009;TextBox;4050 ;6345 ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Contributions."Employee No." }
            { 1000000010;TextBox;2550 ;6768 ;2850 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."First Name" }
            { 1000000011;TextBox;14250;6345 ;4800 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employer.Name }
            { 1000000012;Label  ;0    ;7191 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF BIRTH            : }
            { 1000000013;Label  ;0    ;7614 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF ADMISSION  : }
            { 1000000014;Label  ;0    ;8037 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF RETIREMENT: }
            { 1000000015;TextBox;3600 ;7191 ;2100 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Birth Date" }
            { 1000000016;TextBox;3600 ;7614 ;2100 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Admission Date" }
            { 1000000017;Label  ;0    ;9306 ;6750 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=CONTRIBUTIONS FOR THE CURRENT PERIOD: }
            { 1000000018;TextBox;3600 ;8037 ;2100 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=RetireDate }
            { 1000000042;TextBox;6750 ;9306 ;3150 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BeginDate }
            { 1000000043;Label  ;9900 ;9306 ;600  ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=TO: }
            { 1000000044;TextBox;11100;9306 ;3000 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EndDate }
            { 1000000061;Label  ;4500 ;10152;1050 ;423  ;HorzAlign=General;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Total }
            { 1000000062;Label  ;7350 ;10152;1650 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Employee }
            { 1000000063;Label  ;9900 ;10152;1500 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Employer }
            { 1000000064;Label  ;0    ;10152;1800 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Month(S) }
            { 1000000067;TextBox;5400 ;6768 ;1650 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Middle Name" }
            { 1000000068;TextBox;7050 ;6768 ;2250 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Last Name" }
            { 1000000069;Label  ;13350;423  ;1800 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Printed By: }
            { 1000000070;TextBox;15150;423  ;4800 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=User.Name }
          }
           }
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=21150;
            SectionHeight=423;
          }
          CONTROLS
          {
            { 1000000019;TextBox;0    ;0    ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=ContMonth }
            { 1000000020;TextBox;4200 ;0    ;1200 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Contributions.Quantity }
            { 1000000065;TextBox;6900 ;0    ;1650 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=MonthContAmountEmployee }
            { 1000000066;TextBox;9600 ;0    ;1500 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=MonthContAmountEmployer }
          }
           }
        { PROPERTIES
          {
            SectionType=Footer;
            SectionWidth=21150;
            SectionHeight=6768;
          }
          CONTROLS
          {
            { 1000000021;Label  ;0    ;846  ;3600 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU="BAL. B/FWD (CONTR.) " }
            { 1000000022;TextBox;3750 ;846  ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BeginDate }
            { 1000000023;TextBox;8100 ;846  ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BalBrFwd }
            { 1000000024;Label  ;0    ;2538 ;5250 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=TOTAL CONTRIBUTIIONS: }
            { 1000000025;TextBox;8100 ;2538 ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=TotalAmount }
            { 1000000026;Label  ;0    ;3384 ;5100 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=INTEREST ON CONTRIBUTIONS: }
            { 1000000027;TextBox;8100 ;3384 ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Amount }
            { 1000000028;Label  ;0    ;4230 ;2850 ;423  ;FontSize=10;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=GRAND TOTAL }
            { 1000000029;TextBox;8100 ;4230 ;2550 ;423  ;FontSize=10;
                                                         FontBold=Yes;
                                                         SourceExpr=GrandTotal }
            { 1000000030;TextBox;2850 ;4230 ;3600 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EndDate }
            { 1000000031;TextBox;4650 ;3384 ;750  ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         DecimalPlaces=2:2;
                                                         SourceExpr=RateDisplay }
            { 1000000032;Label  ;4500 ;3384 ;300  ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=( }
            { 1000000033;Label  ;5400 ;3384 ;600  ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=" % )" }
            { 1000000034;Label  ;0    ;1692 ;3600 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=ACCRUED INTEREST: }
            { 1000000035;TextBox;8100 ;1692 ;2550 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BalInt }
            { 1000000036;TextBox;4800 ;1692 ;3000 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EndDate }
            { 1000000037;Label  ;3300 ;1692 ;300  ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=( }
            { 1000000038;TextBox;3450 ;1692 ;750  ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         DecimalPlaces=2:2;
                                                         SourceExpr=RateDisplay }
            { 1000000039;Label  ;4050 ;1692 ;600  ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=" % )" }
            { 1000000045;Label  ;5100 ;6345 ;1500 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE }
            { 1000000046;Label  ;7500 ;6345 ;1800 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=AMOUNT }
            { 1000000047;Label  ;10050;6345 ;1500 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=PV No. }
            { 1000000048;Label  ;5700 ;5499 ;5100 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=***PAYMENTS ALREADY MADE *** }
            { 1000000071;TextBox;13800;1692 ;3900 ;423  ;SourceExpr=TBalBrFwd }
          }
           }
      }
       }
    { PROPERTIES
      {
        DataItemIndent=2;
        DataItemTable=Table5203;
        DataItemTableView=SORTING(Qualification Code)
                          ORDER(Ascending);
        OnAfterGetRecord=BEGIN
                           //OBJECT Report 80100 Emp Contr
                           {
                             OBJECT-PROPERTIES
                             {
                               Date=23/05/07;
                               Time=07:42:40;
                               Modified=Yes;
                               Version List=;
                             }
                             PROPERTIES
                             {
                               OnPreReport=BEGIN
                                            // CompanyInfo.GET;
                                            // CompanyInfo.CALCFIELDS(Picture);
                                           END;

                             }
                             DATAITEMS
                             {
                               { PROPERTIES
                                 {
                                   DataItemTable=Table18;
                                   DataItemTableView=SORTING(No.);
                                   ReqFilterFields=No.;
                                   GroupTotalFields=No.;
                                 }
                                 SECTIONS
                                 {
                                   { PROPERTIES
                                     {
                                       SectionType=Header;
                                       PrintOnEveryPage=Yes;
                                       SectionWidth=18150;
                                       SectionHeight=1692;
                                     }
                                     CONTROLS
                                     {
                                       { 1000000001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;
                                                                                    FontBold=Yes;
                                                                                    CaptionML=ENU=Customer }
                                       { 1000000002;TextBox;15000;0    ;3150 ;423  ;HorzAlign=Right;
                                                                                    SourceExpr=FORMAT(TODAY,0,4) }
                                       { 1000000003;TextBox;0    ;423  ;7500 ;423  ;SourceExpr=COMPANYNAME }
                                       { 1000000004;TextBox;17700;423  ;450  ;423  ;CaptionML=ENU=Page;
                                                                                    SourceExpr=CurrReport.PAGENO }
                                       { 1000000005;Label  ;16950;423  ;750  ;423  ;ParentControl=1000000004 }
                                       { 1000000006;TextBox;15900;846  ;2250 ;423  ;HorzAlign=Right;
                                                                                    SourceExpr=USERID }
                                     }
                                      }
                                   { PROPERTIES
                                     {
                                       SectionType=Header;
                                       PrintOnEveryPage=Yes;
                                       SectionWidth=18150;
                                       SectionHeight=1269;
                                     }
                                     CONTROLS
                                     {
                                       { 1000000012;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1000000011;
                                                                                    VertAlign=Bottom;
                                                                                    FontBold=Yes;
                                                                                    MultiLine=Yes }
                                       { 1000000015;Label  ;1650 ;0    ;4500 ;846  ;ParentControl=1000000014;
                                                                                    VertAlign=Bottom;
                                                                                    FontBold=Yes;
                                                                                    MultiLine=Yes }
                                     }
                                      }
                                   { PROPERTIES
                                     {
                                       SectionType=GroupHeader;
                                       SectionWidth=18150;
                                       SectionHeight=820;
                                       OnPreSection=BEGIN
                                                      CurrReport.SHOWOUTPUT :=
                                                        CurrReport.TOTALSCAUSEDBY = Customer.FIELDNO("No.");
                                                    END;

                                     }
                                     CONTROLS
                                     {
                                       { 1000000008;TextBox;3150 ;0    ;1500 ;423  ;HorzAlign=Left;
                                                                                    SourceExpr="No." }
                                       { 1000000009;Label  ;0    ;0    ;3000 ;423  ;ParentControl=1000000008 }
                                       { 1000000000;TextBox;4789 ;0    ;4500 ;423  ;HorzAlign=Left;
                                                                                    SourceExpr=Name }
                                     }
                                      }
                                   { PROPERTIES
                                     {
                                       SectionType=GroupFooter;
                                       SectionWidth=18150;
                                       SectionHeight=556;
                                       OnPreSection=BEGIN
                                                      CurrReport.SHOWOUTPUT :=
                                                        CurrReport.TOTALSCAUSEDBY = Customer.FIELDNO("No.");
                                                    END;

                                     }
                                     CONTROLS
                                     {
                                     }
                                      }
                                 }
                                  }
                               { PROPERTIES
                                 {
                                   DataItemIndent=1;
                                   DataItemTable=Table5200;
                                   DataItemTableView=SORTING(No.);
                                   DataItemLink=Employer No.=FIELD(No.);
                                 }
                                 SECTIONS
                                 {
                                 }
                                  }
                               { PROPERTIES
                                 {
                                   DataItemIndent=2;
                                   DataItemTable=Table5207;
                                   DataItemTableView=SORTING(From Date,ToDate);
                                   DataItemVarName=Contributions;
                                   OnPreDataItem=BEGIN
                                                 END;

                                   OnAfterGetRecord=BEGIN


                                   DataItemLink=Employee No.=FIELD(No.);
                                 }
                                 SECTIONS
                                 {
                                   { PROPERTIES
                                     {
                                       SectionType=Body;
                                       SectionWidth=18150;
                                       SectionHeight=423;
                                     }
                                     CONTROLS
                                     {
                                       { 1000000011;TextBox;0    ;0    ;1500 ;423  ;HorzAlign=Left;
                                                                                    //SourceExpr=To Date }
                                       { 1000000014;TextBox;1624 ;0    ;4500 ;423  ;HorzAlign=Left;
                                                                                   // CaptionML=ENU=Name;
                                                                                   // SourceExpr=Quantity }
                                     }
                                      }
                                 }
                                  }
                                  // My Code Starts below.
                               { PROPERTIES
                                 {
                                   DataItemIndent=2;
                                   DataItemTable=Table5203;
                                   DataItemTableView=SORTING(No.);
                                   DataItemLink=Employee No.=FIELD(Employee No.);
                                 }
                                 SECTIONS
                                 {
                                 }
                                  }
                               // My Code ends.
                             }
                             REQUESTFORM
                             {
                               PROPERTIES
                               {
                                 Width=9020;
                                 Height=3410;
                               }
                               CONTROLS
                               {
                               }
                             }
                             CODE
                             {
                               BEGIN
                               END.
                             }
                           }

                           BEGIN
                           EmpQuali.SETCURRENTKEY("Employee No.","From Date");
                           EmpQuali.SETRANGE("Employee No.",Contributions."Employee No.");
                           EmpQuali.SETFILTER("Employee No.",Contributions."Employee No.");
                           END;

                           //Less Payment for the year
                           IF EmpQuali.FIND('-')
                           THEN  BEGIN
                           TotalAmounts := EmpQuali.Amounts;
                           IF EmpQuali.NEXT <> 0
                           THEN REPEAT
                           TotalAmounts := TotalAmounts + EmpQuali.Amounts;
                           UNTIL EmpQuali.NEXT = 0;
                           END;

                           FinalAmount := GrandTotal - TotalAmounts;
                         END;

        DataItemLinkReference=Employee;
        DataItemLink=Employee No.=FIELD(No.);
      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=21150;
            SectionHeight=423;
          }
          CONTROLS
          {
            { 1000000049;TextBox;4650 ;0    ;1800 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr="Benefit Payments"."Payment Date" }
            { 1000000050;TextBox;6600 ;0    ;1950 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr="Benefit Payments".Amounts }
            { 1000000051;TextBox;9900 ;0    ;1500 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr="Benefit Payments"."PV No." }
          }
           }
        { PROPERTIES
          {
            SectionType=Footer;
            SectionWidth=21150;
            SectionHeight=4653;
          }
          CONTROLS
          {
            { 1000000052;Label  ;2700 ;1692 ;5700 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=LESS PAYMENTS FOR THE PERIOD }
            { 1000000053;TextBox;8700 ;1692 ;3600 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EndDate }
            { 1000000054;Label  ;3300 ;846  ;3450 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DISCRIPTION }
            { 1000000055;Label  ;9150 ;846  ;2550 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=PERIOD }
            { 1000000056;TextBox;12750;1692 ;2700 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=TotalAmounts }
            { 1000000057;Label  ;12750;846  ;3150 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=TOTAL DEDUCTIONS }
            { 1000000058;Label  ;8400 ;0    ;4350 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=***DEDUCTIONS*** }
            { 1000000059;TextBox;12750;2538 ;2850 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr=FinalAmount }
            { 1000000060;Label  ;2700 ;2538 ;7350 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=GRAND TOTAL AFTER DED. OF PREV. PAYMENTS: }
            { 1000000040;Label  ;3900 ;3807 ;9900 ;423  ;Border=Yes;
                                                         FontName=<Verdana>;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         FontItalic=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=SOCIAL SECURITY AND HOUSING FINANCE CORPORATION }
            { 1000000041;Label  ;4350 ;4230 ;9000 ;423  ;FontName=<Verdana>;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         FontItalic=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=SECURING AND HOUSING YOU ALL THE WAY }
          }
           }
      }
       }
  }
  REQUESTFORM
  {
    PROPERTIES
    {
      Width=9900;
      Height=6490;
    }
    CONTROLS
    {
    }
  }
  CODE
  {
    VAR
      BenefitsPayable@1000000001 : Decimal;
      TotalAmount@1000000003 : Decimal;
      Amount@1000000004 : Decimal;
      ClosingBalance@1000000005 : Decimal;
      Calendar@1000000006 : Record 2000000007;
      Months@1000000007 : Integer;
      OpeningBalance@1000000008 : Decimal;
      CurrAccTotal@1000000009 : Decimal;
      BenefitsKey@1000000010 : Record 75012;
      FromDate@1000000022 : Date;
      ToDate@1000000023 : Date;
      CompanyInfo@1000000011 : Record 79;
      BalBrFwd@1000000012 : Decimal;
      BalInt@1000000013 : Decimal;
      Space@1000000020 : TextConst 'ENU=" "';
      BirthDate@1000000019 : Text[30];
      AdmissionDate@1000000021 : Text[30];
      OldAmount@1000000025 : Decimal;
      GrandTotal@1000000026 : Decimal;
      ContMonth@1000000027 : Text[250];
      MonthContAmount@1000000028 : Decimal;
      Rate@1000000029 : Decimal;
      ContributionsOld@1000000002 : Record 5207;
      Cont@1000000024 : Record 5207;
      EmpidNull@1000000030 : TextConst 'ENU=You must enter Employee #';
      DateBlank@1000000031 : TextConst 'ENU=You must enter Date From and Date To';
      DateError@1000000032 : TextConst 'ENU=Date From must be earlier than Date To';
      msg@1000000033 : TextConst 'ENU=You did not enter Bal. B/FWD. System will automatically calculate it if contributions exist prior to specified date.';
      BeginDate@1000000035 : Text[30];
      EndDate@1000000034 : Text[30];
      Balances@1000000036 : Record 75020;
      RateDisplay@1000000037 : Decimal;
      UserName@1000000038 : Text[100];
      User@1000000039 : Record 2000000002;
      NewBirthDate@1000000040 : Date;
      RetireDate1@1000000041 : Date;
      RetireDate@1000000000 : Text[30];
      CurrContYear@1000000014 : Text[30];
      EmpQuali@1000000015 : Record 5203;
      TotalAmounts@1000000016 : Decimal;
      FinalAmount@1000000017 : Decimal;
      MonthContAmountEmployee@1000000018 : Decimal;
      MonthContAmountEmployer@1000000042 : Decimal;
      "Posting Date"@1000000043 : Date;
      EmployeeName@1000000044 : Text[100];
      Customer@1000000045 : Record 18;
      EmployerName@1000000046 : Text[100];
      EmployerCode@1000000047 : Code[20];
      Empid@1000000048 : Code[20];
      CBalBrFwd@1000000049 : Decimal;
      BF@1000000050 : Decimal;
      CB@1000000051 : Decimal;
      TBalBrFwd@1000000052 : Decimal;

    PROCEDURE @1000000000();
    BEGIN
    END;

    BEGIN
    END.
  }
}

Thanks

Comments

  • kolaboykolaboy Member Posts: 446
    Does anybody have any idea. I am still struggling but to no avail. I need you helps urgently please.
    Thanks
  • kolaboykolaboy Member Posts: 446
    Hi Can somebody help me out with this problem. I still could not find the solution.

    Right now the report filters only contribution for the end date. It should filter contributions from the From date to the end date and all these contributions should be added to the balance brought forward and the result should be the closing balance. This closing balance should be added to the total contributions for the next year and so on.

    Any ideas please?
    Thanks
Sign In or Register to comment.