Running a batch process on a report

asemberengasembereng Member Posts: 220
I have customize a report for a client that will select and employee from the employee table and generate a contribution profile for that employee but what the client wants now is to be able to select more than one employee and generate a profile for them. How can i achieve this. Below is the report i have initially written for them.
OBJECT Report 50003 Employee Profile
{
  OBJECT-PROPERTIES
  {
    Date=05/24/09;
    Time=11:55:49 AM;
    Modified=Yes;
    Version List=SSMS1.5.4;
  }
  PROPERTIES
  {
    OnPreReport=BEGIN
                  IF (Empid = '')
                  THEN ERROR(EmpidNull);
                  //IF (FromDate = 0D) OR (ToDate = 0D) THEN
                     // ERROR(DateBlank);
                  //IF (FromDate > ToDate) THEN
                     // ERROR(DateError);

                  //IF (BenefitsPayable = 0.00)
                  //THEN MESSAGE(bepaynull);

                  CompanyInfo.GET;
                  CompanyInfo.CALCFIELDS(Picture);
                END;

    Orientation=Landscape;
  }
  DATAITEMS
  {
    { PROPERTIES
      {
        DataItemTable=Table2000000007;
        DataItemTableView=SORTING(Period Type,Period Start)
                          ORDER(Ascending);
        OnPreDataItem=BEGIN

                        y := 0;
                        Months := 0;
                         monthCount := 0;
                      END;

        OnAfterGetRecord=BEGIN

                           User.GET(USERID);
                           UserName := User.Name;


                           Employee.GET(Empid);
                           EmployeeName := Employee."First Name" + Space + Employee."Middle Name" + Space + Employee."Last Name";
                           BirthDate:=FORMAT(Employee."Birth Date");


                           IF Employee."Birth Date" <> 0D THEN BEGIN
                             //RetireDate1 := CALCDATE('<60Y>',Employee."Birth Date");
                             RetireDate := FORMAT(CALCDATE('<60Y>',Employee."Birth Date"),0,'<Day>/<Month>/<Year4>');
                           END ELSE BEGIN
                             RetireDate := 'N/A';
                           END;


                           AdmissionDate := FORMAT(Employee."Admission Date",0,'<Day>/<Month>/<Year4>');

                           EmployerCode := Employee."Employer No.";
                           Address := Employee.Address + Employee."Address 2";
                           Customer.GET(EmployerCode);
                           EmployerName := Customer.Name;



                           Date.RESET;
                           Date.SETRANGE("Period Type",Calendar."Period Type"::Month);
                           Date.SETRANGE("Period Start",StartDate,FinalDate);


                           FOR i := 1  TO 12 DO
                           BEGIN
                             contrArr[i] := 0;
                           END;

                           i := 1;
                           REPEAT


                           IF (y = 0 ) OR (i > 1) THEN
                           Date.NEXT;

                           MonthContAmount := 0;

                           Cont.SETCURRENTKEY("Employee No.","From Date");
                           Cont.SETRANGE("Employee No.",Empid);
                           Cont.SETRANGE("From Date",Date."Period Start",Date."Period Start");

                           DisplayYear := FORMAT(Date."Period Start",0,'<Year4>');
                           CurrentMonth := FORMAT(Date."Period Start",0,'<Month Text>');
                           currentDate[i] := FORMAT(Date."Period Start",0,'<month><year>');


                           IF Cont.FIND('-') THEN REPEAT
                             MonthContAmount := MonthContAmount + Cont.Quantity;
                           UNTIL Cont.NEXT = 0;

                           IF MonthContAmount > 0 THEN
                             monthCount := monthCount + 1;

                           CASE CurrentMonth OF
                           'January': contrArr[1] := MonthContAmount;
                           'February': contrArr[2] := MonthContAmount;
                           'March': contrArr[3] := MonthContAmount;
                           'April': contrArr[4] := MonthContAmount;
                           'May': contrArr[5] := MonthContAmount;
                           'June': contrArr[6] := MonthContAmount;
                           'July': contrArr[7] := MonthContAmount;
                           'August': contrArr[8] := MonthContAmount;
                           'September': contrArr[9] := MonthContAmount;
                           'October': contrArr[10] := MonthContAmount;
                           'November': contrArr[11] := MonthContAmount;
                           'December': contrArr[12] := MonthContAmount;
                           END;

                           i := i + 1;
                           y := y + 1;

                           UNTIL (i > 12) OR (CurrentMonth = 'December');


                           // Code added by akjallow to skip year "0000".
                           IF FORMAT("Period Start",0,'<Year4>') = '0000'
                           THEN CurrReport.SKIP;
                         END;

      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Header;
            SectionWidth=25650;
            SectionHeight=9729;
          }
          CONTROLS
          {
            { 1000000003;TextBox;2400 ;423  ;1800 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=TODAY }
            { 1000000004;PictureBox;5550;0  ;8550 ;3384 ;Border=Yes;
                                                         SourceExpr=CompanyInfo.Picture }
            { 1000000005;Label  ;5700 ;3807 ;8250 ;423  ;HorzAlign=Center;
                                                         VertAlign=Center;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=SOCIAL SECURITY AND HOUSING FINANCE CORPORATION }
            { 1000000006;Label  ;5700 ;4230 ;8250 ;423  ;HorzAlign=Center;
                                                         VertAlign=Center;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENU=NATIONAL PROVIDENT FUND SCHEME }
            { 1000000007;Label  ;5700 ;4653 ;8250 ;423  ;HorzAlign=Center;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=EMPLOYEE MEMBERSHIP PROFILE }
            { 1000000008;Label  ;0    ;5922 ;4050 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=SOCIAL SECURITY NUMBER: }
            { 1000000009;Label  ;0    ;7614 ;4050 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=CURRENT EMPLOYER           : }
            { 1000000010;TextBox;4050 ;5922 ;2550 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Empid }
            { 1000000011;Label  ;0    ;8460 ;4050 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=EMPLOYEE NAME                 : }
            { 1000000012;TextBox;4050 ;8460 ;8700 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EmployeeName }
            { 1000000013;Label  ;13050;7614 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF BIRTH            : }
            { 1000000014;TextBox;17100;7614 ;2100 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Birth Date" }
            { 1000000016;Label  ;13050;5922 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF ADMISSION  : }
            { 1000000033;TextBox;17100;5922 ;2100 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=AdmissionDate }
            { 1000000034;Label  ;13050;8460 ;3450 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=DATE OF RETIREMENT: }
            { 1000000035;TextBox;17100;8460 ;2100 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=RetireDate }
            { 1000000036;TextBox;4050 ;7614 ;8700 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=EmployerName }
            { 1000000038;Label  ;900  ;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Jan     " }
            { 1000000048;Label  ;3000 ;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Feb     " }
            { 1000000049;Label  ;4950 ;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Mar     " }
            { 1000000050;Label  ;11250;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Jun     " }
            { 1000000051;Label  ;9150 ;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     May     " }
            { 1000000052;Label  ;7050 ;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Apr     " }
            { 1000000053;Label  ;21750;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Nov     " }
            { 1000000054;Label  ;19650;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Oct     " }
            { 1000000055;Label  ;17550;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Sep     " }
            { 1000000056;Label  ;15450;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Aug     " }
            { 1000000057;Label  ;13500;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Jul     " }
            { 1000000058;Label  ;23700;9306 ;1500 ;423  ;HorzAlign=Right;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         FontUnderline=Yes;
                                                         CaptionML=ENU="     Dec     " }
            { 1000000061;Label  ;300  ;423  ;2100 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=PRINTED ON: }
            { 1000000063;TextBox;1050 ;846  ;4075 ;1269 ;VertAlign=Top;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         SourceExpr=UserName }
            { 1000000064;Label  ;300  ;846  ;750  ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=BY: }
            { 1000000029;Label  ;0    ;6768 ;4050 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=Old Social Security Number: }
            { 1000000031;TextBox;4200 ;6768 ;2250 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee.Old_SS_No }
            { 1000000062;Label  ;13050;6768 ;3900 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=CURRENT EMPLOYER NO: }
            { 1000000065;TextBox;17100;6768 ;2100 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Employer No." }
            { 1000000066;Label  ;13050;7191 ;3900 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=CURRENT EMP. OLD NO: }
            { 1000000067;TextBox;17100;7191 ;2100 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=Employee."Old Employer No." }
          }
           }
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=25650;
            SectionHeight=500;
          }
          CONTROLS
          {
            { 1000000001;TextBox;0    ;0    ;750  ;423  ;HorzAlign=Left;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=DisplayYear }
            { 1000000000;TextBox;750  ;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[1] }
            { 1000000002;TextBox;2550 ;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[2] }
            { 1000000037;TextBox;4500 ;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[3] }
            { 1000000039;TextBox;10800;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[6] }
            { 1000000040;TextBox;8700 ;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[5] }
            { 1000000041;TextBox;6750 ;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[4] }
            { 1000000042;TextBox;17400;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[9] }
            { 1000000043;TextBox;15300;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[8] }
            { 1000000044;TextBox;13050;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[7] }
            { 1000000045;TextBox;23400;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[12] }
            { 1000000046;TextBox;21450;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[11] }
            { 1000000047;TextBox;19350;0    ;1500 ;423  ;HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontSize=8;
                                                         FontBold=No;
                                                         SourceExpr=contrArr[10] }
          }
           }
      }
       }
    { PROPERTIES
      {
        DataItemTable=Table50001;
        DataItemTableView=SORTING(From Date,To Date)
                          ORDER(Ascending);
        PrintOnlyIfDetail=No;
        OnAfterGetRecord=BEGIN


                           // Check if balances exist or not.
                           IF (Balances.GET(Empid) = TRUE) THEN BEGIN
                           BalBrFwd := Balances.BalBrFwd;
                           END ELSE BEGIN
                           BalBrFwd := 0.00;
                           END;
                           // Balance checking ends here.

                           // Get Name ends above.


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

                           // Code to get Rate from Benefits
                           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 BEGIN
                           Rate := BenefitsKey.Rate;
                           END;


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


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

                           //First Code brought down here
                           Cont.SETCURRENTKEY("Employee No.");
                           Cont.SETRANGE("Employee No.",Empid);
                           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;
                           //Months := Cont.COUNT;
                           IF Cont.NEXT <> 0
                           THEN REPEAT
                           TotalAmount := TotalAmount + Cont.Quantity;
                           UNTIL Cont.NEXT = 0;
                           END;


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


                           CompanyInfo.GET;
                           CompanyInfo.CALCFIELDS(Picture);

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


                            RateDisplay := Rate * 100;
                            AmountPayable := (BenefitsPayable * GrandTotal)/100;
                         END;

      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Footer;
            SectionWidth=25650;
            SectionHeight=3303;
          }
          CONTROLS
          {
            { 1000000027;Label  ;0    ;846  ;7950 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=ACCUMULATED MONTHS OF CONTRIBUTIONS BETWEEN [ }
            { 1000000018;TextBox;7950 ;846  ;1350 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr=StartDate }
            { 1000000020;Label  ;11850;846  ;450  ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=] : }
            { 1000000024;TextBox;12300;846  ;2400 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr=monthCount }
            { 1000000021;Label  ;0    ;1692 ;2700 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=BALANCE  B/FWD [ }
            { 1000000022;TextBox;2700 ;1692 ;2700 ;423  ;FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BeginDate }
            { 1000000025;Label  ;5400 ;1692 ;450  ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=] : }
            { 1000000023;TextBox;5850 ;1692 ;2550 ;423  ;HorzAlign=Left;
                                                         FontSize=8;
                                                         FontBold=Yes;
                                                         SourceExpr=BalBrFwd }
            { 1000000015;Label  ;0    ;2538 ;8850 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=PREVIOUS EMPLOYER (S) : }
            { 1000000030;Label  ;11700;2538 ;2250 ;423  ;HorzAlign=Right;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=From Date }
            { 1000000032;Label  ;14700;2538 ;2100 ;423  ;HorzAlign=Right;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=To Date }
            { 1000000059;TextBox;10500;846  ;1350 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr=FinalDate }
            { 1000000060;Label  ;9300 ;846  ;1200 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         CaptionML=ENU=]  AND [ }
          }
           }
      }
       }
    { PROPERTIES
      {
        DataItemTable=Table50007;
        DataItemTableView=SORTING(Line No.,Employee No.);
        OnPreDataItem=BEGIN
                        SETRANGE("Employee No.",Empid);
                        SETFILTER("Employee No.",Empid);
                      END;

        OnAfterGetRecord=BEGIN
                           IF Customer.GET("Employer No.") THEN
                           OldemployerName  := Customer.Name
                           ELSE CurrReport.SKIP;
                         END;

      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=25650;
            SectionHeight=846;
          }
          CONTROLS
          {
            { 1000000017;TextBox;3900 ;0    ;7650 ;423  ;HorzAlign=Left;
                                                         FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr=OldemployerName }
            { 1000000019;TextBox;11550;0    ;2400 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr="Employer Record"."From Date" }
            { 1000000026;TextBox;14700;0    ;2250 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr="Employer Record"."To Date" }
            { 1000000028;TextBox;0    ;0    ;3900 ;423  ;FontSize=9;
                                                         FontBold=Yes;
                                                         SourceExpr="Employer Record"."Employer No." }
          }
           }
      }
       }
  }
  REQUESTFORM
  {
    PROPERTIES
    {
      Width=10450;
      Height=6050;
    }
    CONTROLS
    {
      { 1000000000;Label  ;550  ;880  ;3300 ;440  ;FontBold=Yes;
                                                   CaptionML=ENU=Employee ID }
      { 1000000001;Label  ;550  ;3190 ;3300 ;440  ;Visible=No;
                                                   FontBold=Yes;
                                                   CaptionML=ENU=Total Benefit Payable }
      { 1000000002;TextBox;5060 ;880  ;2420 ;440  ;SourceExpr=Empid;
                                                   TableRelation=Employee }
      { 1000000003;TextBox;5060 ;3190 ;2420 ;440  ;Visible=No;
                                                   SourceExpr=BenefitsPayable }
      { 1000000004;Label  ;550  ;1650 ;3300 ;440  ;Visible=Yes;
                                                   FontBold=Yes;
                                                   CaptionML=ENU=Begin Date: }
      { 1000000005;Label  ;550  ;2420 ;3300 ;440  ;Visible=Yes;
                                                   FontBold=Yes;
                                                   CaptionML=ENU=End Date: }
      { 1000000006;TextBox;5060 ;1650 ;2420 ;440  ;Visible=Yes;
                                                   SourceExpr=StartDate }
      { 1000000007;TextBox;5060 ;2420 ;2420 ;440  ;Visible=Yes;
                                                   SourceExpr=FinalDate }
    }
  }
  CODE
  {
    VAR
      Empid@1000000000 : Code[20];
      BenefitsPayable@1000000001 : Decimal;
      TotalAmount@1000000003 : Decimal;
      Amount@1000000004 : Decimal;
      Calendar@1000000006 : Record 2000000007;
      Months@1000000007 : Integer;
      CurrAccTotal@1000000009 : Decimal;
      BenefitsKey@1000000010 : Record 50004;
      FromDate@1000000022 : Date;
      ToDate@1000000023 : Date;
      CompanyInfo@1000000011 : Record 79;
      BalBrFwd@1000000012 : Decimal;
      Employee@1000000014 : Record 50008;
      EmployeeName@1000000015 : Text[500];
      EmployerCode@1000000016 : Code[20];
      EmployerName@1000000017 : Text[500];
      Customer@1000000018 : Record 18;
      Space@1000000020 : TextConst 'ENU=" "';
      BirthDate@1000000019 : Text[30];
      AdmissionDate@1000000021 : Text[30];
      OldAmount@1000000025 : Decimal;
      GrandTotal@1000000026 : Decimal;
      ContMonth@1000000027 : Text[30];
      MonthContAmount@1000000028 : Decimal;
      Rate@1000000029 : Decimal;
      Cont@1000000024 : Record 50001;
      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 50005;
      RateDisplay@1000000037 : Decimal;
      AmountPayable@1000000038 : Decimal;
      bepaynull@1000000039 : TextConst 'ENU=You did not provide percentage of  Benefits payable';
      Address@1000000040 : Text[250];
      User@1000000041 : Record 2000000002;
      UserName@1000000042 : Text[100];
      RetireDate@1000000043 : Text[30];
      NewBirthDate@1000000044 : Date;
      BirthText@1000000045 : Text[30];
      RetireDate1@1000000046 : Date;
      AdmissionDate1@1000000047 : Date;
      EmploymentDate@1000000048 : Date;
      ApplicationDate@1000000049 : Date;
      StartDate@1000000005 : Date;
      FinalDate@1000000002 : Date;
      DisplayYear@1000000008 : Text[30];
      Current@1000000013 : Integer;
      contrArr@1000000050 : ARRAY [12] OF Decimal;
      i@1000000051 : Integer;
      currentDate@1000000053 : ARRAY [12] OF Text[30];
      CurrentMonth@1000000052 : Text[30];
      y@1000000054 : Integer;
      monthCount@1000000055 : Integer;
      OldemployerName@1000000056 : Text[500];

    BEGIN
    END.
  }
}

Comments

  • bbrownbbrown Member Posts: 3,268
    Use the Employee table as the report's primary table.
    There are no bugs - only undocumented features.
  • bbrownbbrown Member Posts: 3,268
    Maybe I'm not seeing it, but I don't see you setting any filters on the Date table. This would mean you are running thru the entire Date table (Year 0000 to Year 9999) each time.
    There are no bugs - only undocumented features.
  • asemberengasembereng Member Posts: 220
    If i have to use the employee table as the main table how does it help to run a batch printing??
  • bbrownbbrown Member Posts: 3,268
    User.GET(USERID);
    UserName := User.Name;


    Employee.GET(Empid);
    EmployeeName := Employee."First Name" + Space + Employee."Middle Name" + Space + Employee."Last Name";
    BirthDate:=FORMAT(Employee."Birth Date");


    IF Employee."Birth Date" <> 0D THEN BEGIN
    //RetireDate1 := CALCDATE('<60Y>',Employee."Birth Date");
    RetireDate := FORMAT(CALCDATE('<60Y>',Employee."Birth Date"),0,'<Day>/<Month>/<Year4>');
    END ELSE BEGIN
    RetireDate := 'N/A';
    END;


    AdmissionDate := FORMAT(Employee."Admission Date",0,'<Day>/<Month>/<Year4>');

    EmployerCode := Employee."Employer No.";
    Address := Employee.Address + Employee."Address 2";
    Customer.GET(EmployerCode);
    EmployerName := Customer.Name;

    If this information is related to the employee, why keep setting it on every date record. Set it once prior to process the Date table.
    There are no bugs - only undocumented features.
  • bbrownbbrown Member Posts: 3,268
    asembereng wrote:
    If i have to use the employee table as the main table how does it help to run a batch printing??

    It allows the user to specify a filtered set of employees. Then you run thru your batch logic for each employee record in the filtered set.
    There are no bugs - only undocumented features.
  • asemberengasembereng Member Posts: 220
    Ok then meaning each employee will be separated by what?
  • bbrownbbrown Member Posts: 3,268
    Date.RESET;
    Date.SETRANGE("Period Type",Calendar."Period Type"::Month);
    Date.SETRANGE("Period Start",StartDate,FinalDate);

    I see your filter, but you should set this in the OnPreDataItem trigger.
    There are no bugs - only undocumented features.
  • bbrownbbrown Member Posts: 3,268
    asembereng wrote:
    Ok then meaning each employee will be separated by what?

    Not sure I follow your question here. The employee table would be the first sourcetable in the report. The reprot logic would repeat for each employee. What they are separated by depends on how you lay out the report.
    There are no bugs - only undocumented features.
  • bbrownbbrown Member Posts: 3,268
    If I'm following this correctly, Cont (Table 50001) should be the second datasource (after employee) and not DATE. Or you could do the entire report from Cont unless you want to be able to filter on other fields in the employee table besides No.
    There are no bugs - only undocumented features.
  • asemberengasembereng Member Posts: 220
    I have three data item as follows, Date, Contribution and employer record. I am using Request form to get the employee from the employee table then loop through the contribution table to get his contributions based on the date filtered. Now i what i want is, instead of using the lookup function to look into the employee i just i want to type in the numbers separated by maybe a comma or semi-colon, for each of the numbers i want their profile printed in order. Is this possible?
    Thanks
  • bbrownbbrown Member Posts: 3,268
    My terminology may have been confusing. I should have said DataItem. You have only one DateItem (Date). Contribution and Employer are global variables. What I am suggesting is to have 2 DataItems (Employer and Contribution).
    There are no bugs - only undocumented features.
  • zulqzulq Member Posts: 204
    Hi bbrown am posting on behalf of my colleague. I now have a for loop which extracts each employee number from the string given. Here's the code for the for loop:
    nEl := CountSubString(StringNos,',');
    FOR nStr := 1 TO nEl DO BEGIN
    Empid := SELECTSTR(nStr,StringNos);
    END;
    
    I added this for loop on the 3 data items opening it at the top and ending it at the bottom.
    However after doing this only the last employee number in the for loop is picked. For example if I enter in the string empid1,empid2,empid3 the report runs only for empid3 and the other two are skipped. Any ideas how to achieve this.

    Thanks.
    Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
  • bbrownbbrown Member Posts: 3,268
    Why is this code needed? The user should just set the desired filter on the employee table before running the report. Use the Employee table as the primary (first) dataitem in the report. Put the "No." in the ReqFilterFields list.
    There are no bugs - only undocumented features.
  • zulqzulq Member Posts: 204
    bbrown I know I can add the employee table and set employee no. as the required filter field. But how can I filter for multiple employees i.e. enter multiple employee numbers on the number. For example empNo1,empNo2,empNo3 etc?
    Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
  • bbrownbbrown Member Posts: 3,268
    empNo1|empNo2|empNo3
    There are no bugs - only undocumented features.
Sign In or Register to comment.