public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            Report_Payroll_LongServicePaymentSeverancePayment_List rpt = new Report_Payroll_LongServicePaymentSeverancePayment_List();

            rpt.Site = this.Site;
            return(rpt);
        }
        public override ReportDocument GenerateReport()
        {
            string HierarchyLevel1 = string.Empty;
            string HierarchyLevel2 = string.Empty;
            string HierarchyLevel3 = string.Empty;

            if (values.Count > 0)
            {
                DataSet.Payroll_LongServicePaymentSeverancePayment_List ds = new DataSet.Payroll_LongServicePaymentSeverancePayment_List();

                ArrayList HierarchyLevelList = EHierarchyLevel.db.select(dbConn, new DBFilter());
                foreach (EHierarchyLevel HierarchyLevel in HierarchyLevelList)
                {
                    if (HierarchyLevel.HLevelSeqNo.Equals(1))
                    {
                        HierarchyLevel1 = HierarchyLevel.HLevelDesc;
                    }
                    else if (HierarchyLevel.HLevelSeqNo.Equals(2))
                    {
                        HierarchyLevel2 = HierarchyLevel.HLevelDesc;
                    }
                    else if (HierarchyLevel.HLevelSeqNo.Equals(3))
                    {
                        HierarchyLevel3 = HierarchyLevel.HLevelDesc;
                    }
                }


                foreach (object obj in values)
                {
                    int EmpID = -1;
                    if (obj is int)
                    {
                        EmpID = (int)obj;
                    }
                    else if (obj is EEmpPersonalInfo)
                    {
                        EmpID = ((EEmpPersonalInfo)obj).EmpID;
                    }

                    ImportEmployeeDetailRow(ds.employeedetail, EmpID, AsOfDate);
                    DataSet.Payroll_LongServicePaymentSeverancePayment_List.LongServicePaymentSeverancePaymentRow row = ds.LongServicePaymentSeverancePayment.NewLongServicePaymentSeverancePaymentRow();
                    row.EmpID = EmpID;

                    HROne.Payroll.FinalPaymentProcess finalPaymentProcess = new HROne.Payroll.FinalPaymentProcess(dbConn, EmpID, AsOfDate, string.Empty);
                    string remark;
                    row.LongServicePayment = finalPaymentProcess.GetLongServicePaymentSeverancePaymentAmount(true, out remark);
                    row.SeverancePayment   = finalPaymentProcess.GetLongServicePaymentSeverancePaymentAmount(false, out remark);

                    DBFilter mpfRecordFilter  = new DBFilter();
                    DBFilter empPayrollFilter = new DBFilter();
                    empPayrollFilter.add(new Match("ep.EmpID", EmpID));
                    empPayrollFilter.add(new MatchField("ep.EmpPayrollID", "MPFRecord.EmpPayrollID"));
                    mpfRecordFilter.add(new Exists("EmpPayroll ep", empPayrollFilter));
                    ArrayList mpfRecordList = EMPFRecord.db.select(dbConn, mpfRecordFilter);

                    double mpfEmployerContribution = 0;
                    foreach (EMPFRecord mpfRecord in mpfRecordList)
                    {
                        mpfEmployerContribution += mpfRecord.MPFRecActMCER;
                    }
                    row.EmployerContribution = mpfEmployerContribution;

                    ds.LongServicePaymentSeverancePayment.Rows.Add(row);
                }
                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Payroll_LongServicePaymentSeverancePayment_List();
                }
                else
                {
                }



                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2);
                reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3);
                if (reportDocument.ParameterFields["AsOfDate"] != null)
                {
                    reportDocument.SetParameterValue("AsOfDate", this.AsOfDate);
                }

                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }