示例#1
0
        public override ReportDocument GenerateReport()
        {
            if (EmpList.Count > 0)
            {
                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();

                foreach (EEmpPersonalInfo empInfo in EmpList)
                {
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        if (empInfo.EmpDateOfJoin >= PeriodFrom && empInfo.EmpDateOfJoin <= PeriodTo)
                        {
                            EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, empInfo.EmpID, PeriodTo);
                        }
                    }
                }

                //System.Data.DataTable table = null;
                //foreach (int EmpID in EmpList)
                //{
                //    string select = "P.*,EmpPos.*,Pos.*,Comp.* ";
                //    string from = "from EmpPersonalInfo P LEFT JOIN EmpPositionInfo EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID LEFT JOIN Company Comp ON EmpPos.CompanyID=Comp.CompanyID";
                //    DBFilter filter = new DBFilter();
                //    OR or = new OR();
                //    filter.add(new Match("P.EmpID", EmpID));
                //    System.Data.DataTable resulttable = filter.loadData(null, select, from);
                //    if (table == null)
                //        table = resulttable;
                //    else
                //        table.Merge(resulttable);
                //}
                //DBAESEncryptStringFieldAttribute.decode(table, "EmpHKID", true);
                //DBAESEncryptStringFieldAttribute.decode(table, "EmpPassportNo", false);


                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_NewJoinList();
                }
                else
                {
                }
                reportDocument.SetDataSource(ds);
                if (reportDocument.ParameterFields["PeriodFrom"] != null)
                {
                    reportDocument.SetParameterValue("PeriodFrom", PeriodFrom);
                }
                if (reportDocument.ParameterFields["PeriodTo"] != null)
                {
                    reportDocument.SetParameterValue("PeriodTo", PeriodTo);
                }

                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        public override ReportDocument GenerateReport()
        {
            if (EmpList.Count > 0)
            {
                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();

                foreach (int EmpID in EmpList)
                {
                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AppUtils.ServerDateTime().Date);
                }

                //System.Data.DataTable table = null;
                //foreach (int EmpID in EmpList)
                //{
                //    string select = "P.*,EmpPos.*,Pos.*,Comp.* ";
                //    string from = "from EmpPersonalInfo P LEFT JOIN EmpPositionInfo EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID LEFT JOIN Company Comp ON EmpPos.CompanyID=Comp.CompanyID";
                //    DBFilter filter = new DBFilter();
                //    filter.add(new Match("P.EmpID", EmpID));
                //    System.Data.DataTable resulttable = filter.loadData(null, select, from);
                //    if (table == null)
                //        table = resulttable;
                //    else
                //        table.Merge(resulttable);
                //}

                //DBAESEncryptStringFieldAttribute.decode(table, "EmpResAddr", true);
                //DBAESEncryptStringFieldAttribute.decode(table, "EmpCorAddr", true);

                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_Contact();
                }
                else
                {
                }

                reportDocument.SetDataSource(ds);
                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
        public override ReportDocument GenerateReport()
        {
            string HierarchyLevel1 = string.Empty;
            string HierarchyLevel2 = string.Empty;
            string HierarchyLevel3 = string.Empty;
            string HierarchyLevel4 = string.Empty;

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

                DataSet.EmployeeDetail.HierarchyLevelDataTable HierarchyLevelTable = ds.HierarchyLevel;
                ArrayList HierarchyLevelList = EHierarchyLevel.db.select(dbConn, new DBFilter());
                foreach (EHierarchyLevel HierarchyLevel in HierarchyLevelList)
                {
                    DataSet.EmployeeDetail.HierarchyLevelRow row = HierarchyLevelTable.NewHierarchyLevelRow();
                    row.HLevelCode  = HierarchyLevel.HLevelCode;
                    row.HLevelDesc  = HierarchyLevel.HLevelDesc;
                    row.HLevelID    = HierarchyLevel.HLevelID;
                    row.HLevelSeqNo = HierarchyLevel.HLevelSeqNo;
                    HierarchyLevelTable.Rows.Add(row);
                }

                int currentDummyPosID       = 0;
                int currentDummyHierarchyID = 0;
                foreach (int EmpID in values)
                {
                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AsOfDate);


                    DBFilter empBasicSalaryfilter = new DBFilter();
                    DBFilter paymentCodeFilter    = new DBFilter();
                    paymentCodeFilter.add(new Match("PaymentTypeID", EPaymentType.SystemPaymentType.BasicSalaryPaymentType(dbConn).PaymentTypeID));
                    //empBasicSalaryfilter.add(new MatchField("erp.PayCodeID", "pc.PaymentCodeID"));
                    empBasicSalaryfilter.add(new IN("PayCodeID", "Select PaymentCodeID from PaymentCode", paymentCodeFilter));
                    empBasicSalaryfilter.add(new Match("EmpRPEffFr", "<=", AsOfDate));
                    OR orEffToFilter = new OR();
                    orEffToFilter.add(new Match("EmpRPEffTo", ">=", AsOfDate));
                    orEffToFilter.add(new NullTerm("EmpRPEffTo"));
                    empBasicSalaryfilter.add(orEffToFilter);

                    empBasicSalaryfilter.add(new Match("EmpID", EmpID));

                    DataSet.EmployeeDetail.EmpRecurringPaymentDataTable empRPTable = ds.EmpRecurringPayment;
                    ArrayList empRecurringPaymentList = EEmpRecurringPayment.db.select(dbConn, empBasicSalaryfilter);
                    foreach (EEmpRecurringPayment empRP in empRecurringPaymentList)
                    {
                        DataSet.EmployeeDetail.EmpRecurringPaymentRow row = empRPTable.NewEmpRecurringPaymentRow();

                        row.CurrencyID  = empRP.CurrencyID;
                        row.EmpAccID    = empRP.EmpAccID;
                        row.EmpID       = empRP.EmpID;
                        row.EmpRPAmount = Convert.ToDecimal(empRP.EmpRPAmount);
                        row.EmpRPEffFr  = empRP.EmpRPEffFr;
                        row.EmpRPEffTo  = empRP.EmpRPEffTo;
                        row.EmpRPID     = empRP.EmpRPID;
                        row.EmpRPMethod = empRP.EmpRPMethod;
                        row.EmpRPRemark = empRP.EmpRPRemark;
                        row.EmpRPUnit   = empRP.EmpRPUnit;

                        EPaymentCode paymentCode = new EPaymentCode();
                        paymentCode.PaymentCodeID = empRP.PayCodeID;
                        if (EPaymentCode.db.select(dbConn, paymentCode))
                        {
                            row.PayCodeID       = paymentCode.PaymentCodeID;
                            row.PaymentCode     = paymentCode.PaymentCode;
                            row.PaymentCodeDesc = paymentCode.PaymentCodeDesc;
                            row.PaymentCodeID   = paymentCode.PaymentCodeID;
                            //                            row.p
                        }

                        empRPTable.AddEmpRecurringPaymentRow(row);
                    }

                    {
                        DataSet.EmployeeDetail.EmpPositionInfoDataTable empPosTable = ds.EmpPositionInfo;
                        EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, AsOfDate, EmpID);

                        if (empPos == null)
                        {
                            currentDummyPosID--;
                            DataSet.EmployeeDetail.EmpPositionInfoRow row = empPosTable.NewEmpPositionInfoRow();
                            row.EmpPosID = currentDummyPosID;
                            row.EmpID    = EmpID;

                            empPosTable.AddEmpPositionInfoRow(row);

                            DataSet.EmployeeDetail.EmpHierarchyDataTable empHierarchyTable = ds.EmpHierarchy;
                            foreach (EHierarchyLevel hLevel in HierarchyLevelList)
                            {
                                currentDummyHierarchyID--;
                                DataSet.EmployeeDetail.EmpHierarchyRow empHierarchyRow = empHierarchyTable.NewEmpHierarchyRow();

                                empHierarchyRow.EmpHierarchyID = currentDummyHierarchyID;
                                empHierarchyRow.EmpID          = EmpID;
                                empHierarchyRow.EmpPosID       = currentDummyPosID;
                                empHierarchyRow.HLevelID       = hLevel.HLevelID;
                                empHierarchyRow.HLevelSeqNo    = hLevel.HLevelSeqNo;

                                empHierarchyTable.AddEmpHierarchyRow(empHierarchyRow);
                            }
                        }
                        else
                        {
                            DataSet.EmployeeDetail.EmpPositionInfoRow row = empPosTable.NewEmpPositionInfoRow();

                            row.CompanyID   = empPos.CompanyID;
                            row.EmpID       = empPos.EmpID;
                            row.EmpPosEffFr = empPos.EmpPosEffFr;
                            row.EmpPosEffTo = empPos.EmpPosEffTo;
                            row.EmpPosID    = empPos.EmpPosID;
                            row.LeavePlanID = empPos.LeavePlanID;
                            row.PayGroupID  = empPos.PayGroupID;

                            EPosition position = new EPosition();
                            position.PositionID = empPos.PositionID;
                            if (EPosition.db.select(dbConn, position))
                            {
                                row.PositionCode = position.PositionCode;
                                row.PositionDesc = position.PositionDesc;
                                row.PositionID   = position.PositionID;
                            }

                            ERank rank = new ERank();
                            rank.RankID = empPos.RankID;
                            if (ERank.db.select(dbConn, rank))
                            {
                                row.RankCode = rank.RankCode;
                                row.RankDesc = rank.RankDesc;
                                row.RankID   = rank.RankID;
                            }

                            row.StaffTypeID = empPos.StaffTypeID;

                            empPosTable.AddEmpPositionInfoRow(row);

                            DataSet.EmployeeDetail.EmpHierarchyDataTable empHierarchyTable = ds.EmpHierarchy;
                            foreach (EHierarchyLevel hLevel in HierarchyLevelList)
                            {
                                if (hLevel.HLevelSeqNo.Equals(1))
                                {
                                    HierarchyLevel1 = hLevel.HLevelDesc;
                                }
                                else if (hLevel.HLevelSeqNo.Equals(2))
                                {
                                    HierarchyLevel2 = hLevel.HLevelDesc;
                                }
                                else if (hLevel.HLevelSeqNo.Equals(3))
                                {
                                    HierarchyLevel3 = hLevel.HLevelDesc;
                                }
                                else if (hLevel.HLevelSeqNo.Equals(4))
                                {
                                    HierarchyLevel4 = hLevel.HLevelDesc;
                                }


                                DBFilter empHierarchyFilter = new DBFilter();
                                empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                                empHierarchyFilter.add(new Match("HLevelID", hLevel.HLevelID));

                                ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter);

                                DataSet.EmployeeDetail.EmpHierarchyRow empHierarchyRow = empHierarchyTable.NewEmpHierarchyRow();
                                empHierarchyRow.EmpID       = EmpID;
                                empHierarchyRow.EmpPosID    = empPos.EmpPosID;
                                empHierarchyRow.HLevelID    = hLevel.HLevelID;
                                empHierarchyRow.HLevelSeqNo = hLevel.HLevelSeqNo;

                                if (empHierarchyList.Count > 0)
                                {
                                    EEmpHierarchy empHierarchy = (EEmpHierarchy)empHierarchyList[0];
                                    empHierarchyRow.EmpHierarchyID = empHierarchy.EmpHierarchyID;

                                    EHierarchyElement hElement = new EHierarchyElement();
                                    hElement.HElementID = empHierarchy.HElementID;
                                    EHierarchyElement.db.select(dbConn, hElement);
                                    empHierarchyRow.HElementCode = hElement.HElementCode;
                                    empHierarchyRow.HElementDesc = hElement.HElementDesc;
                                    empHierarchyRow.HElementID   = hElement.HElementID;
                                }
                                else
                                {
                                    currentDummyHierarchyID--;
                                    empHierarchyRow.EmpHierarchyID = currentDummyHierarchyID;
                                }

                                empHierarchyTable.AddEmpHierarchyRow(empHierarchyRow);
                            }
                        }
                    }
                }

                DataSet.EmployeeDetail.PayrollGroupDataTable payrollGroupTable = ds.PayrollGroup;
                ArrayList payrollGroupList = EPayrollGroup.db.select(dbConn, new DBFilter());
                foreach (EPayrollGroup payrollGroup in payrollGroupList)
                {
                    DataSet.EmployeeDetail.PayrollGroupRow row = payrollGroupTable.NewPayrollGroupRow();
                    row.PayGroupCode = payrollGroup.PayGroupCode;
                    row.PayGroupDesc = payrollGroup.PayGroupDesc;
                    row.PayGroupID   = payrollGroup.PayGroupID;
                    payrollGroupTable.Rows.Add(row);
                }

                DataSet.EmployeeDetail.PositionDataTable PositionTable = ds.Position;
                ArrayList PositionList = EPosition.db.select(dbConn, new DBFilter());
                foreach (EPosition Position in PositionList)
                {
                    DataSet.EmployeeDetail.PositionRow row = PositionTable.NewPositionRow();
                    row.PositionCode = Position.PositionCode;
                    row.PositionDesc = Position.PositionDesc;
                    row.PositionID   = Position.PositionID;
                    PositionTable.Rows.Add(row);
                }

                DataSet.EmployeeDetail.BankListDataTable BankListTable = ds.BankList;
                ArrayList BankListList = EBankList.db.select(dbConn, new DBFilter());
                foreach (EBankList BankList in BankListList)
                {
                    DataSet.EmployeeDetail.BankListRow row = BankListTable.NewBankListRow();
                    row.BankCode = BankList.BankCode;
                    row.BankName = BankList.BankName;
                    BankListTable.Rows.Add(row);
                }


                //System.Data.DataSet ds = new System.Data.DataSet();

                //string select;
                //string from;
                //DBFilter filter;
                //OR or;

                //foreach (int EmpID in values)
                //{

                //from = "from EmpPersonalInfo e LEFT JOIN EmpTermination et ON et.EmpID=e.EmpID ";
                //select = " e.*, et.EmpTermLastDate";
                //filter = new DBFilter();
                //filter.add(new Match("e.EmpID", EmpID));
                //filter.loadData(ds, "employeedetail", null, select, from, null);

                //from = "from EmpPositionInfo ";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = "* ";
                //filter = new DBFilter();
                //filter.add(new Match("EmpPosEffFr", "<=", AsOfDate));
                //OR orEffToFilter = new OR();
                //orEffToFilter.add(new Match("EmpPosEffTo", ">=", AsOfDate));
                //orEffToFilter.add(new NullTerm("EmpPosEffTo"));
                //filter.add(orEffToFilter);
                //filter.add(new Match("EmpID", EmpID));
                //filter.loadData(ds, "EmpPositionInfo", null, select, from, null);


                //from = "from EmpRecurringPayment erp, PaymentCode pc";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = "* ";
                //filter = new DBFilter();
                //filter.add(new MatchField("erp.PayCodeID", "pc.PaymentCodeID"));
                //filter.add(new Match("pc.PaymentTypeID", EPaymentType.SystemPaymentType.BasicSalaryPaymentType(dbConn).PaymentTypeID));
                //filter.add(new Match("erp.EmpRPEffFr", "<=", AsOfDate));
                //orEffToFilter = new OR();
                //orEffToFilter.add(new Match("erp.EmpRPEffTo", ">=", AsOfDate));
                //orEffToFilter.add(new NullTerm("erp.EmpRPEffTo"));
                //filter.add(orEffToFilter);

                //filter.add(new Match("EmpID", EmpID));
                //filter.loadData(ds, "EmpRecurringPayment", null, select, from, null);
                //}
                //from = " from PayrollGroup ";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = "* ";
                //filter = new DBFilter();
                //filter.loadData(ds, "PayrollGroup", null, select, from, null);

                //from = " from Position ";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = "* ";
                //filter = new DBFilter();
                //filter.loadData(ds, "Position", null, select, from, null);

                //from = "from EmpHierarchy eh Left Join HierarchyElement he ON eh.HElementID=he.HElementID LEFT JOIN HierarchyLevel hl on hl.HLevelID=eh.HLevelID";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = " eh.*, he.HElementCode, he.HElementDesc, hl.HLevelSeqNo";
                //filter = new DBFilter();
                //filter.add("HLevelSeqNo", true);
                //filter.loadData(ds, "EmpHierarchy", null, select, from, null);

                foreach (System.Data.DataRow row in ds.Tables["EmpHierarchy"].Rows)
                {
                    if (row.IsNull("HElementDesc"))
                    {
                        row["HElementDesc"] = "-";
                    }
                    if (string.IsNullOrEmpty(row["HElementDesc"].ToString()))
                    {
                        row["HElementDesc"] = "-";
                    }
                }

                //from = "from HierarchyLevel hl ";//EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                //select = " hl.* ";
                //filter = new DBFilter();
                //filter.add("HLevelSeqNo", true);
                //filter.loadData(ds, "HierarchyLevel", null, select, from, null);


                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_SalaryList();
                }
                else
                {
                }



                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2);
                reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3);

                if (reportDocument.ParameterFields["HierarchyLevel4"] != null)
                {
                    reportDocument.SetParameterValue("HierarchyLevel4", HierarchyLevel4);
                }

                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
        public override ReportDocument GenerateReport()
        {
            if (EmpList.Count > 0)
            {
                string HierarchyLevel1 = " ";
                string HierarchyLevel2 = " ";
                string HierarchyLevel3 = " ";

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


                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();

                ArrayList empExtraFieldList = EEmpExtraField.db.select(dbConn, new DBFilter());
                DataSet.EmployeeDetail.EmpExtraFieldDataTable empExtraFieldTable = ds.EmpExtraField;
                foreach (EEmpExtraField empExtraField in empExtraFieldList)
                {
                    DataSet.EmployeeDetail.EmpExtraFieldRow empExtraFieldRow = empExtraFieldTable.NewEmpExtraFieldRow();
                    empExtraFieldRow.EmpExtraFieldGroupName = empExtraField.EmpExtraFieldGroupName;
                    empExtraFieldRow.EmpExtraFieldID        = empExtraField.EmpExtraFieldID;
                    empExtraFieldRow.EmpExtraFieldName      = empExtraField.EmpExtraFieldName;

                    if (empExtraFieldRow.IsEmpExtraFieldGroupNameNull())
                    {
                        empExtraFieldRow.EmpExtraFieldGroupName = "Extra Information";
                    }
                    empExtraFieldTable.Rows.Add(empExtraFieldRow);
                }

                foreach (int EmpID in EmpList)
                {
                    DataSet.EmployeeDetail.employeedetailRow empRow = ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AppUtils.ServerDateTime().Date);


                    EEmpDocument empDocument = EEmpDocument.GetProfilePhotoEmpDocument(dbConn, EmpID);
                    if (empDocument != null)
                    {
                        string documentFilePath = empDocument.GetDocumentPhysicalPath(dbConn);
                        string transferFilePath = documentFilePath;
                        string strTmpFolder     = string.Empty;
                        if (empDocument.EmpDocumentIsCompressed)
                        {
                            transferFilePath = empDocument.GetExtractedFilePath(dbConn);
                        }

                        empRow.PhotoByteArray = ThumbnailToByteArray(transferFilePath, 200, 200);

                        empDocument.RemoveExtractedFile();
                    }


                    DBFilter empFilter = new DBFilter();
                    empFilter.add(new Match("EmpID", EmpID));

                    DBFilter empPosFilter = new DBFilter();
                    empPosFilter.add(new Match("EmpID", EmpID));
                    empPosFilter.add("EmpPosEffFr", false);
                    ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter);
                    DataSet.EmployeeDetail.EmpPositionInfoDataTable empPosTable = ds.EmpPositionInfo;
                    foreach (EEmpPositionInfo empPos in empPosList)
                    {
                        DataSet.EmployeeDetail.EmpPositionInfoRow row = empPosTable.NewEmpPositionInfoRow();

                        row.CompanyID   = empPos.CompanyID;
                        row.EmpID       = empPos.EmpID;
                        row.EmpPosEffFr = empPos.EmpPosEffFr;
                        if (!empPos.EmpPosEffTo.Ticks.Equals(0))
                        {
                            row.EmpPosEffTo = empPos.EmpPosEffTo;
                        }
                        row.EmpPosID    = empPos.EmpPosID;
                        row.LeavePlanID = empPos.LeavePlanID;
                        row.PayGroupID  = empPos.PayGroupID;

                        EPosition position = new EPosition();
                        position.PositionID = empPos.PositionID;
                        if (EPosition.db.select(dbConn, position))
                        {
                            row.PositionCode = position.PositionCode;
                            row.PositionDesc = position.PositionDesc;
                            row.PositionID   = position.PositionID;
                        }

                        ERank rank = new ERank();
                        rank.RankID = empPos.RankID;
                        if (ERank.db.select(dbConn, rank))
                        {
                            row.RankCode = rank.RankCode;
                            row.RankDesc = rank.RankDesc;
                            row.RankID   = rank.RankID;
                        }

                        row.StaffTypeID = empPos.StaffTypeID;

                        foreach (EHierarchyLevel hLevel in HierarchyLevelList)
                        {
                            if (hLevel.HLevelSeqNo < 4 && hLevel.HLevelSeqNo > 0)
                            {
                                DBFilter empHierarchyFilter = new DBFilter();
                                empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                                empHierarchyFilter.add(new Match("HLevelID", hLevel.HLevelID));

                                ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter);

                                if (empHierarchyList.Count > 0)
                                {
                                    EEmpHierarchy empHierarchy = (EEmpHierarchy)empHierarchyList[0];

                                    EHierarchyElement hElement = new EHierarchyElement();
                                    hElement.HElementID = empHierarchy.HElementID;
                                    EHierarchyElement.db.select(dbConn, hElement);

                                    row["HierarchyCode" + hLevel.HLevelSeqNo] = hElement.HElementCode;
                                    row["HierarchyDesc" + hLevel.HLevelSeqNo] = hElement.HElementDesc;
                                }
                            }
                        }

                        empPosTable.AddEmpPositionInfoRow(row);
                    }

                    DBFilter empRPFilter = new DBFilter();
                    empRPFilter.add(new Match("EmpID", EmpID));
                    empRPFilter.add("empRPEffFr", false);

                    ArrayList empRPList = EEmpRecurringPayment.db.select(dbConn, empRPFilter);
                    DataSet.EmployeeDetail.EmpRecurringPaymentDataTable empRPTable = ds.EmpRecurringPayment;
                    foreach (EEmpRecurringPayment empRP in empRPList)
                    {
                        DataSet.EmployeeDetail.EmpRecurringPaymentRow row = empRPTable.NewEmpRecurringPaymentRow();

                        row.CurrencyID  = empRP.CurrencyID;
                        row.EmpAccID    = empRP.EmpAccID;
                        row.EmpID       = empRP.EmpID;
                        row.EmpRPAmount = Convert.ToDecimal(empRP.EmpRPAmount);
                        row.EmpRPEffFr  = empRP.EmpRPEffFr;
                        if (!empRP.EmpRPEffTo.Ticks.Equals(0))
                        {
                            row.EmpRPEffTo = empRP.EmpRPEffTo;
                        }
                        row.EmpRPID = empRP.EmpRPID;

                        if (empRP.EmpRPMethod.Equals("A"))
                        {
                            row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Autopay");
                        }
                        else if (empRP.EmpRPMethod.Equals("Q"))
                        {
                            row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Cheque");
                        }
                        else if (empRP.EmpRPMethod.Equals("C"))
                        {
                            row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Cash");
                        }
                        else if (empRP.EmpRPMethod.Equals("O"))
                        {
                            row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Others");
                        }


                        row.EmpRPRemark = empRP.EmpRPRemark;
                        row.EmpRPUnit   = empRP.EmpRPUnit;

                        EPaymentCode paymentCode = new EPaymentCode();
                        paymentCode.PaymentCodeID = empRP.PayCodeID;
                        if (EPaymentCode.db.select(dbConn, paymentCode))
                        {
                            row.PayCodeID       = paymentCode.PaymentCodeID;
                            row.PaymentCode     = paymentCode.PaymentCode;
                            row.PaymentCodeDesc = paymentCode.PaymentCodeDesc;
                            row.PaymentCodeID   = paymentCode.PaymentCodeID;
//                            row.p
                        }

                        empRPTable.AddEmpRecurringPaymentRow(row);
                    }

                    EmployeeBankAccountProcess.ImportEmpBankAccountRow(dbConn, ds.EmpBankAccount, EmpID);

                    ArrayList empSpouseList = EEmpSpouse.db.select(dbConn, empFilter);
                    DataSet.EmployeeDetail.EmpSpouseDataTable empSpouseTable = ds.EmpSpouse;
                    foreach (EEmpSpouse empSpouse in empSpouseList)
                    {
                        DataSet.EmployeeDetail.EmpSpouseRow row = empSpouseTable.NewEmpSpouseRow();

                        row.EmpID = empSpouse.EmpID;
                        row.EmpSpouseChineseName = empSpouse.EmpSpouseChineseName;
                        //empSpouse.EmpSpouseDateOfBirth;
                        row.EmpSpouseHKID                  = empSpouse.EmpSpouseHKID;
                        row.EmpSpouseID                    = empSpouse.EmpSpouseID;
                        row.EmpSpouseOtherName             = empSpouse.EmpSpouseOtherName;
                        row.EmpSpousePassportIssuedCountry = empSpouse.EmpSpousePassportIssuedCountry;
                        row.EmpSpousePassportNo            = empSpouse.EmpSpousePassportNo;
                        row.EmpSpouseSurname               = empSpouse.EmpSpouseSurname;
                        // Start 0000142, KuangWei, 2014-12-21
                        row.EmpGender = empSpouse.EmpGender;
                        if (empSpouse.EmpIsMedicalSchemaInsured)
                        {
                            row.EmpIsMedicalSchemaInsured = "Yes";
                        }
                        else
                        {
                            row.EmpIsMedicalSchemaInsured = "No";
                        }
                        row.EmpMedicalEffectiveDate = empSpouse.EmpMedicalEffectiveDate;
                        row.EmpMedicalExpiryDate    = empSpouse.EmpMedicalExpiryDate;
                        // End 0000142, KuangWei, 2014-12-21

                        empSpouseTable.AddEmpSpouseRow(row);
                    }

                    ArrayList empDependantList = EEmpDependant.db.select(dbConn, empFilter);
                    DataSet.EmployeeDetail.EmpDependantDataTable empDependantTable = ds.EmpDependant;
                    foreach (EEmpDependant empDependant in empDependantList)
                    {
                        DataSet.EmployeeDetail.EmpDependantRow row = empDependantTable.NewEmpDependantRow();

                        row.EmpID = empDependant.EmpID;
                        row.EmpDependantChineseName = empDependant.EmpDependantChineseName;
                        //empDependant.EmpDependantDateOfBirth;
                        row.EmpDependantGender                = empDependant.EmpDependantGender;
                        row.EmpDependantHKID                  = empDependant.EmpDependantHKID;
                        row.EmpDependantID                    = empDependant.EmpDependantID;
                        row.EmpDependantOtherName             = empDependant.EmpDependantOtherName;
                        row.EmpDependantPassportIssuedCountry = empDependant.EmpDependantPassportIssuedCountry;
                        row.EmpDependantPassportNo            = empDependant.EmpDependantPassportNo;
                        row.EmpDependantRelationship          = empDependant.EmpDependantRelationship;
                        row.EmpDependantSurname               = empDependant.EmpDependantSurname;

                        empDependantTable.AddEmpDependantRow(row);
                    }

                    DBFilter empQualificationFilter = new DBFilter();
                    empQualificationFilter.add(new Match("EmpID", EmpID));
                    empQualificationFilter.add("EmpQualificationFrom", false);

                    ArrayList empQualificationList = EEmpQualification.db.select(dbConn, empQualificationFilter);
                    DataSet.EmployeeDetail.EmpQualificationDataTable empQualificationTable = ds.EmpQualification;
                    foreach (EEmpQualification empQualification in empQualificationList)
                    {
                        DataSet.EmployeeDetail.EmpQualificationRow row = empQualificationTable.NewEmpQualificationRow();

                        row.EmpID = empQualification.EmpID;

                        if (!empQualification.EmpQualificationFrom.Ticks.Equals(0))
                        {
                            row.EmpQualificationFrom = empQualification.EmpQualificationFrom;
                        }
                        if (!empQualification.EmpQualificationTo.Ticks.Equals(0))
                        {
                            row.EmpQualificationTo = empQualification.EmpQualificationTo;
                        }
                        row.EmpQualificationID          = empQualification.EmpQualificationID;
                        row.EmpQualificationInstitution = empQualification.EmpQualificationInstitution;
                        row.EmpQualificationRemark      = empQualification.EmpQualificationRemark;

                        EQualification qualification = new EQualification();
                        qualification.QualificationID = empQualification.QualificationID;
                        if (EQualification.db.select(dbConn, qualification))
                        {
                            row.QualificationID   = qualification.QualificationID;
                            row.QualificationCode = qualification.QualificationCode;
                            row.QualificationDesc = qualification.QualificationDesc;
                        }

                        empQualificationTable.AddEmpQualificationRow(row);
                    }
                    ArrayList empSkillList = EEmpSkill.db.select(dbConn, empFilter);
                    DataSet.EmployeeDetail.EmpSkillDataTable empSkillTable = ds.EmpSkill;
                    foreach (EEmpSkill empSkill in empSkillList)
                    {
                        DataSet.EmployeeDetail.EmpSkillRow row = empSkillTable.NewEmpSkillRow();

                        row.EmpID = empSkill.EmpID;

                        row.EmpSkillID = empSkill.EmpSkillID;
                        ESkill skill = new ESkill();
                        skill.SkillID = empSkill.SkillID;
                        if (ESkill.db.select(dbConn, skill))
                        {
                            row.SkillID   = skill.SkillID;
                            row.SkillCode = skill.SkillCode;
                            row.SkillDesc = skill.SkillDesc;
                        }
                        ESkillLevel skillLevel = new ESkillLevel();
                        skillLevel.SkillLevelID = empSkill.SkillLevelID;
                        if (ESkillLevel.db.select(dbConn, skillLevel))
                        {
                            row.SkillLevelID   = skillLevel.SkillLevelID;
                            row.SkillLevelCode = skillLevel.SkillLevelCode;
                            row.SkillLevelDesc = skillLevel.SkillLevelDesc;
                        }
                        empSkillTable.AddEmpSkillRow(row);
                    }

                    ArrayList empWorkExpList = EEmpWorkExp.db.select(dbConn, empFilter);
                    DataSet.EmployeeDetail.EmpWorkExpDataTable empWorkExpTable = ds.EmpWorkExp;
                    foreach (EEmpWorkExp empWorkExp in empWorkExpList)
                    {
                        DataSet.EmployeeDetail.EmpWorkExpRow row = empWorkExpTable.NewEmpWorkExpRow();

                        row.EmpID = empWorkExp.EmpID;

                        row.EmpWorkExpID          = empWorkExp.EmpWorkExpID;
                        row.EmpWorkExpFromMonth   = empWorkExp.EmpWorkExpFromMonth;
                        row.EmpWorkExpFromYear    = empWorkExp.EmpWorkExpFromYear;
                        row.EmpWorkExpToYear      = empWorkExp.EmpWorkExpToYear;
                        row.EmpWorkExpToMonth     = empWorkExp.EmpWorkExpToMonth;
                        row.EmpWorkExpPosition    = empWorkExp.EmpWorkExpPosition;
                        row.EmpWorkExpCompanyName = empWorkExp.EmpWorkExpCompanyName;
                        row.EmpWorkExpRemark      = empWorkExp.EmpWorkExpRemark;

                        empWorkExpTable.AddEmpWorkExpRow(row);
                    }

                    ArrayList empExtraFieldValueList = EEmpExtraFieldValue.db.select(dbConn, empFilter);
                    DataSet.EmployeeDetail.EmpExtraFieldValueDataTable empExtraFieldValueTable = ds.EmpExtraFieldValue;
                    foreach (EEmpExtraFieldValue empExtraFieldValue in empExtraFieldValueList)
                    {
                        DataSet.EmployeeDetail.EmpExtraFieldValueRow row = empExtraFieldValueTable.NewEmpExtraFieldValueRow();

                        row.EmpID = empExtraFieldValue.EmpID;
                        row.EmpExtraFieldValueID = empExtraFieldValue.EmpExtraFieldValueID;
                        row.EmpExtraFieldID      = empExtraFieldValue.EmpExtraFieldID;
                        row.EmpExtraFieldValue   = empExtraFieldValue.EmpExtraFieldValue;

                        empExtraFieldValueTable.AddEmpExtraFieldValueRow(row);
                    }

                    //DBFilter filter = new DBFilter();
                    //filter.add(new Match("P.EmpID", EmpID));

                    //select = "P.*,EmpPos.*,Pos.*";
                    //from = "from EmpPersonalInfo P LEFT JOIN EmpPositionInfo EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                    //filter.loadData(ds, "employeedetail", null, select, from, null);
                    //select = "P.*,Pos.PositionCode,Pos.PositionDesc,R.RankCode, R.RankDesc";
                    //from = "from EmpPositionInfo P LEFT JOIN Position Pos ON P.PositionID=Pos.PositionID LEFT JOIN Rank R ON P.RankID=R.RankID";
                    //filter.loadData(ds, "EmpPositionInfo", null, select, from, null);


                    //select = "P.*,C.*";
                    //from = "from EmpRecurringPayment P LEFT JOIN PaymentCode C ON P.PayCodeID=C.PaymentCodeID ";
                    //filter.loadData(ds, "EmpRecurringPayment", null, select, from, null);

                    //select = "P.*";
                    //from = "from EmpBankAccount P ";
                    //filter.loadData(ds, "EmpBankAccount", null, select, from, null);


                    //select = "P.*";
                    //from = "from EmpSpouse P ";
                    //filter.loadData(ds, "EmpSpouse", null, select, from, null);


                    //select = "P.*";
                    //from = "from EmpDependant P ";
                    //filter.loadData(ds, "EmpDependant", null, select, from, null);


                    //select = "P.*, Q.*";
                    //from = "from EmpQualification P LEFT JOIN Qualification Q on P.QualificationID=Q.QualificationID";
                    //filter.loadData(ds, "EmpQualification", null, select, from, null);


                    //select = "P.*, S.*,L.*";
                    //from = "from EmpSkill P LEFT JOIN Skill S ON P.SkillID=S.SkillID LEFT JOIN SkillLevel L on P.SkillLevelID=L.SkillLevelID";
                    //filter.loadData(ds, "EmpSkill", null, select, from, null);
                }
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpHKID", true);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpPassportNo", false);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpResAddr", true);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpCorAddr", true);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpSpouse"], "EmpSpouseHKID", false);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpSpouse"], "EmpSpousePassportNo", false);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpDependant"], "EmpDependantHKID", false);
                //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpDependant"], "EmpDependantPassportNo", false);


                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_Detail();
                }
                else
                {
                }

                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2);
                reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3);

                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1, "PositionInfo");
                reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2, "PositionInfo");
                reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3, "PositionInfo");

                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
        public override ReportDocument GenerateReport()
        {
            string HierarchyLevel1 = string.Empty;
            string HierarchyLevel2 = string.Empty;
            string HierarchyLevel3 = string.Empty;

            ArrayList HierarchyLevelList = EHierarchyLevel.db.select(dbConn, new DBFilter());

            foreach (EHierarchyLevel hLevel in HierarchyLevelList)
            {
                if (hLevel.HLevelSeqNo.Equals(1))
                {
                    HierarchyLevel1 = hLevel.HLevelDesc;
                }
                else if (hLevel.HLevelSeqNo.Equals(2))
                {
                    HierarchyLevel2 = hLevel.HLevelDesc;
                }
                else if (hLevel.HLevelSeqNo.Equals(3))
                {
                    HierarchyLevel3 = hLevel.HLevelDesc;
                }
            }

            if (EmpList.Count > 0)
            {
                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();


                foreach (int EmpID in EmpList)
                {
                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AppUtils.ServerDateTime().Date);

                    DBFilter filter = new DBFilter();
                    //filter.add(new Match("LeaveAppDateFrom", ">=", startDate));
                    //filter.add(new Match("LeaveAppDateFrom", "<=", AsOfDate));
                    filter.add(new Match("EmpID", EmpID));
                    if (!DateFrom.Ticks.Equals(0))
                    {
                        filter.add(new Match("LeaveAppDateFrom", "<=", DateTo));
                    }
                    if (!DateTo.Ticks.Equals(0))
                    {
                        filter.add(new Match("LeaveAppDateTo", ">=", DateFrom));
                    }
                    ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, filter);
                    DataSet.EmployeeDetail.LeaveApplicationDataTable leaveApplicationTable = ds.LeaveApplication;
                    foreach (ELeaveApplication leaveApplication in leaveApplicationList)
                    {
                        DataSet.EmployeeDetail.LeaveApplicationRow row = leaveApplicationTable.NewLeaveApplicationRow();
                        row.EmpID            = leaveApplication.EmpID;
                        row.EmpPaymentID     = leaveApplication.EmpPaymentID;
                        row.LeaveAppDateFrom = leaveApplication.LeaveAppDateFrom;
                        row.LeaveAppDateTo   = leaveApplication.LeaveAppDateTo;
                        if (leaveApplication.LeaveAppUnit == "H")
                        {
                            row.LeaveAppDays = leaveApplication.LeaveAppHours;
                        }
                        else
                        {
                            row.LeaveAppDays = leaveApplication.LeaveAppDays;
                        }
                        row.LeaveAppID     = leaveApplication.LeaveAppID;
                        row.LeaveAppRemark = leaveApplication.LeaveAppRemark;
                        if (!leaveApplication.LeaveAppTimeFrom.Ticks.Equals(0))
                        {
                            row.LeaveAppTimeFrom = leaveApplication.LeaveAppTimeFrom;
                        }
                        if (!leaveApplication.LeaveAppTimeTo.Ticks.Equals(0))
                        {
                            row.LeaveAppTimeTo = leaveApplication.LeaveAppTimeTo;
                        }
                        row.LeaveAppUnit = leaveApplication.LeaveAppUnit;
                        row.LeaveCodeID  = leaveApplication.LeaveCodeID;
                        row.LeaveAppHasMedicalCertificate = leaveApplication.LeaveAppHasMedicalCertificate;
                        row.LeaveAppNoPayProcess          = leaveApplication.LeaveAppNoPayProcess;
                        ELeaveCode leaveCode = new ELeaveCode();
                        leaveCode.LeaveCodeID = leaveApplication.LeaveCodeID;
                        if (ELeaveCode.db.select(dbConn, leaveCode))
                        {
                            ELeaveType leaveType = new ELeaveType();
                            leaveType.LeaveTypeID = leaveCode.LeaveTypeID;
                            if (ELeaveType.db.select(dbConn, leaveType))
                            {
                                row.LeaveType     = leaveType.LeaveType;
                                row.LeaveTypeDesc = leaveType.LeaveTypeDesc;
                            }
                        }


                        leaveApplicationTable.AddLeaveApplicationRow(row);
                    }
                }
                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_LeaveApplicationList();
                }
                else
                {
                }

                reportDocument.SetDataSource(ds);
                for (int i = 0; i < reportDocument.ParameterFields.Count; i++)
                {
                    if (reportDocument.ParameterFields[i].Name == "HierarchyLevel1")
                    {
                        reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                    }

                    if (reportDocument.ParameterFields[i].Name == "HierarchyLevel2")
                    {
                        reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2);
                    }
                }
                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
        public override ReportDocument GenerateReport()
        {
            if (values.Count > 0)
            {
                string HierarchyLevel1 = string.Empty;
                string HierarchyLevel2 = string.Empty;
                string HierarchyLevel3 = string.Empty;

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

                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();

                foreach (int EmpID in values)
                {
                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AsOfDate);


                    //DBFilter filter = new DBFilter();
                    //filter.add(new Match("LeaveAppDateFrom", ">=", startDate));
                    //filter.add(new Match("LeaveAppDateFrom", "<=", AsOfDate));
                    //filter.add(new Match("EmpID", EmpID));
                    //ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, filter);
                    //DataSet.EmployeeDetail.LeaveApplicationDataTable leaveApplicationTable=ds.LeaveApplication;
                    //foreach (ELeaveApplication leaveApplication in leaveApplicationList)
                    //{
                    //    DataSet.EmployeeDetail.LeaveApplicationRow row = leaveApplicationTable.NewLeaveApplicationRow();
                    //    row.EmpID = leaveApplication.EmpID;
                    //    row.EmpPaymentID = leaveApplication.EmpPaymentID;
                    //    row.LeaveAppDateFrom = leaveApplication.LeaveAppDateFrom;
                    //    row.LeaveAppDateTo = leaveApplication.LeaveAppDateTo;
                    //    row.LeaveAppDays = leaveApplication.LeaveAppDays;
                    //    row.LeaveAppID = leaveApplication.LeaveAppID;
                    //    row.LeaveAppRemark = leaveApplication.LeaveAppRemark;
                    //    if (!leaveApplication.LeaveAppTimeFrom.Ticks.Equals(0))
                    //        row.LeaveAppTimeFrom = leaveApplication.LeaveAppTimeFrom;
                    //    if (!leaveApplication.LeaveAppTimeTo.Ticks.Equals(0))
                    //        row.LeaveAppTimeTo = leaveApplication.LeaveAppTimeTo;
                    //    row.LeaveAppUnit = leaveApplication.LeaveAppUnit;
                    //    row.LeaveCodeID = leaveApplication.LeaveCodeID;

                    //    ELeaveCode leaveCode = new ELeaveCode();
                    //    leaveCode.LeaveCodeID = leaveApplication.LeaveCodeID;
                    //    if (ELeaveCode.db.select(dbConn, leaveCode))
                    //    {
                    //        ELeaveType leaveType = new ELeaveType();
                    //        leaveType.LeaveTypeID = leaveCode.LeaveTypeID;
                    //        if (ELeaveType.db.select(dbConn, leaveType))
                    //        {
                    //            row.LeaveType = leaveType.LeaveType;
                    //            row.LeaveTypeDesc = leaveType.LeaveTypeDesc;
                    //        }
                    //    }
                    //    leaveApplicationTable.AddLeaveApplicationRow(row);
                    //}

                    //try
                    //{
                    LeaveBalanceCalc calc         = new LeaveBalanceCalc(dbConn, EmpID, AsOfDate);
                    ArrayList        balanceItems = calc.getCurrentBalanceList();
                    foreach (ELeaveBalance b in balanceItems)
                    {
                        foreach (ELeaveType leaveType in LeaveTypeList)
                        {
                            if (leaveType.LeaveTypeID.Equals(b.LeaveTypeID))
                            {
                                DataSet.EmployeeDetail.LeaveBalanceRow rr = ds.LeaveBalance.NewLeaveBalanceRow();
                                rr["LeaveBalanceID"]            = b.LeaveBalanceID;
                                rr["EmpID"]                     = EmpID;
                                rr["LeaveBalanceEffectiveDate"] = b.LeaveBalanceEffectiveDate;
                                rr["LeaveBalanceBF"]            = b.LeaveBalanceBF;
                                rr["LeaveBalanceEntitled"]      = b.LeaveBalanceEntitled;
                                rr["LeaveBalanceForfeiture"]    = b.LeaveBalanceForfeiture + b.ExpiryForfeit;
                                rr["Taken"]                     = b.Taken;
                                rr["Balance"]                   = b.getBalance();
                                rr["Adjust"]                    = b.Adjust;
                                rr["Reserved"]                  = b.Reserved;
                                rr["Name"]          = b.Name;
                                rr["Description"]   = b.Description;
                                rr["ExpiryForfeit"] = b.ExpiryForfeit;
                                if (!b.NextExpiryDate.Ticks.Equals(0))
                                {
                                    rr["NextExpiryDate"] = b.NextExpiryDate;
                                }
                                rr["NextExpiryForfeit"] = b.NextExpiryForfeit;
                                rr["StringFormat"]      = b.StringFormat;
                                ds.LeaveBalance.Rows.Add(rr);
                            }
                        }
                    }
                    //}
                    //catch (Exception)
                    //{
                    //    //  fail to create leave balance record by some reason
                    //    //  no handling so far
                    //}
                }

                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_LeaveBalance();
                }
                else
                {
                }

                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("AsOfDate", AsOfDate);
                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2);
                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
        public override ReportDocument GenerateReport()
        {
            DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();

            DBFilter empInfoFilter = new DBFilter();
            empInfoFilter.add(new Match("empDateOfJoin", "<=", BirthdayTo));

            DBFilter empTerminationFilter = new DBFilter();
            empTerminationFilter.add(new MatchField(EEmpPersonalInfo.db.dbclass.tableName + ".EmpID", "et.EmpID"));
            empTerminationFilter.add(new Match("et.EmpTermLastDate", "<", BirthdayFrom));
            empInfoFilter.add(new Exists(EEmpTermination.db.dbclass.tableName + " et", empTerminationFilter, true));



            foreach (EEmpPersonalInfo empInfo in empList)
            {
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    if (!empInfo.EmpDateOfBirth.Ticks.Equals(0))
                    {

                        int yearFrom = Convert.ToInt32(Utility.YearDifference(empInfo.EmpDateOfBirth, BirthdayFrom));
                        while (empInfo.EmpDateOfBirth.AddYears(yearFrom) < BirthdayFrom)
                            yearFrom++;





                        if (empInfo.EmpDateOfBirth.AddYears(yearFrom) <= BirthdayTo)
                        {
                            DataSet.EmployeeDetail.employeedetailRow row = ds.employeedetail.NewemployeedetailRow();
                            row.EmpID = empInfo.EmpID;
                            row.EmpAlias = empInfo.EmpAlias;
                            row.EmpChiFullName = empInfo.EmpChiFullName;
                            row.EmpDateOfBirth = empInfo.EmpDateOfBirth;
                            row.EmpDateOfJoin = empInfo.EmpDateOfJoin;
                            row.EmpEngOtherName = empInfo.EmpEngOtherName;
                            row.EmpEngSurname = empInfo.EmpEngSurname;
                            row.EmpEngFullName = empInfo.EmpEngFullName;
                            row.EmpGender = empInfo.EmpGender;
                            row.EmpNo = empInfo.EmpNo;
                            row.EmpServiceDate = empInfo.EmpServiceDate;
                            row.EmpStatus = empInfo.EmpStatus;
                            ds.employeedetail.Rows.Add(row);
                        }

                    }
            }




            if (reportDocument == null)
            {
                reportDocument = new ReportTemplate.Report_Employee_BirthdayList();
            }
            else
            {

            }

            reportDocument.SetDataSource(ds);
            reportDocument.SetParameterValue("BirthdayFrom", BirthdayFrom.ToString("yyyy-MM-dd"));
            reportDocument.SetParameterValue("BirthdayTo", BirthdayTo.ToString("yyyy-MM-dd"));
            reportDocument.SetParameterValue("ShowDisplayOfBirth", ShowDisplayYearOfBirth);
            
            return reportDocument;

        }
示例#8
0
        public override ReportDocument GenerateReport()
        {
            string HierarchyLevel1 = string.Empty;
            string HierarchyLevel2 = string.Empty;
            string HierarchyLevel3 = string.Empty;

            ArrayList HierarchyLevelList = EHierarchyLevel.db.select(dbConn, new DBFilter());

            foreach (EHierarchyLevel hLevel in HierarchyLevelList)
            {
                if (hLevel.HLevelSeqNo.Equals(1))
                {
                    HierarchyLevel1 = hLevel.HLevelDesc;
                }
                else if (hLevel.HLevelSeqNo.Equals(2))
                {
                    HierarchyLevel2 = hLevel.HLevelDesc;
                }
                else if (hLevel.HLevelSeqNo.Equals(3))
                {
                    HierarchyLevel3 = hLevel.HLevelDesc;
                }
            }

            if (EmpList.Count > 0)
            {
                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();


                foreach (int EmpID in EmpList)
                {
                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AppUtils.ServerDateTime().Date);

                    DBFilter empRequestFilter = new DBFilter();
                    empRequestFilter.add(new Match("EmpID", EmpID));
                    //empRequestFilter.add(new Match("EmpRequestStatusCode", "<>", EEmpRequest.STATUS_APPROVED));
                    //empRequestFilter.add(new Match("EmpRequestStatusCode", "<>", EEmpRequest.STATUS_USRCANCEL));
                    //empRequestFilter.add(new Match("EmpRequestStatusCode", "<>", EEmpRequest.STATUS_FSTREJ));
                    //empRequestFilter.add(new Match("EmpRequestStatusCode", "<>", EEmpRequest.STATUS_SNDREJ));
                    empRequestFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_CANCELLED));
                    empRequestFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_REJECTED));
                    empRequestFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_APPROVED));

                    ArrayList empRequestList = EEmpRequest.db.select(dbConn, empRequestFilter);
                    DataSet.EmployeeDetail.EmpRequestDataTable empRequestTable = ds.EmpRequest;
                    foreach (EEmpRequest empRequest in empRequestList)
                    {
                        DataSet.EmployeeDetail.EmpRequestRow row = empRequestTable.NewEmpRequestRow();

                        row.EmpID                = empRequest.EmpID;
                        row.EmpRequestID         = empRequest.EmpRequestID;
                        row.EmpRequestCreateDate = empRequest.EmpRequestCreateDate;
                        row.EmpRequestModifyDate = empRequest.EmpRequestModifyDate;
                        row.EmpRequestRecordID   = empRequest.EmpRequestRecordID;
                        //row.EmpRequestStatusCode = HROne.Common.WebUtility.GetLocalizedString(empRequest.EmpRequestStatusCode);
                        row.EmpRequestStatus = HROne.Common.WebUtility.GetLocalizedString(empRequest.EmpRequestStatus);
                        row.EmpRequestLastAuthorizationWorkFlowIndex = empRequest.EmpRequestLastAuthorizationWorkFlowIndex;
                        row.EmpRequestLastActionBy = empRequest.EmpRequestLastActionBy;
                        row.EmpRequestType         = HROne.Common.WebUtility.GetLocalizedString(empRequest.EmpRequestType);

                        if (empRequest.EmpRequestType.Equals(EEmpRequest.TYPE_EELEAVEAPP))
                        {
                            ERequestLeaveApplication requestLeaveApplication = new ERequestLeaveApplication();
                            requestLeaveApplication.RequestLeaveAppID = empRequest.EmpRequestRecordID;
                            if (ERequestLeaveApplication.db.select(dbConn, requestLeaveApplication))
                            {
                                ELeaveCode leaveCode = new ELeaveCode();
                                leaveCode.LeaveCodeID = requestLeaveApplication.RequestLeaveCodeID;
                                if (ELeaveCode.db.select(dbConn, leaveCode))
                                {
                                    row.EmpRequestType = leaveCode.LeaveCodeDesc;
                                }

                                row.DateFrom   = requestLeaveApplication.RequestLeaveAppDateFrom;
                                row.DateFromAM = requestLeaveApplication.RequestLeaveAppDateFromAM;
                                row.DateTo     = requestLeaveApplication.RequestLeaveAppDateTo;
                                row.DateToAM   = requestLeaveApplication.RequestLeaveAppDateToAM;
                                row.Unit       = requestLeaveApplication.RequestLeaveDays;
                                row.Remark     = requestLeaveApplication.RequestLeaveAppRemark;
                            }
                        }
                        empRequestTable.AddEmpRequestRow(row);
                    }
                }
                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_ESSRequest();
                }
                else
                {
                }

                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1);
                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
示例#9
0
        public override ReportDocument GenerateReport()
        {
            if (values.Count > 0)
            {
                DateTime startDate = new DateTime(AsOfDate.Year, 1, 1);

                //System.Data.DataSet ds = new System.Data.DataSet();

                //System.Data.DataTable sum = ds.Tables.Add("LeaveBalance");
                //sum.Columns.Add("LeaveBalanceID", typeof(int));
                //sum.Columns.Add("EmpID", typeof(int));
                //sum.Columns.Add("LeaveBalanceEffectiveDate", typeof(DateTime));
                //sum.Columns.Add("LeaveBalanceBF", typeof(double));
                //sum.Columns.Add("LeaveBalanceEntitled", typeof(double));
                //sum.Columns.Add("LeaveBalanceForfeiture", typeof(double));
                //sum.Columns.Add("Taken", typeof(double));
                //sum.Columns.Add("Balance", typeof(double));
                //sum.Columns.Add("Adjust", typeof(double));
                //sum.Columns.Add("Reserved", typeof(double));
                //sum.Columns.Add("Name", typeof(string));
                //sum.Columns.Add("Description", typeof(string));
                //sum.Columns.Add("StringFormat", typeof(string));

                DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail();
                //string select;
                //string from;
                //DBFilter filter;

                foreach (int EmpID in values)
                {
                    //from = "from EmpPersonalInfo P LEFT JOIN EmpPositionInfo EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID";
                    //select = "P.*,EmpPos.*,Pos.*";
                    //filter = new DBFilter();
                    //filter.add(new Match("P.EmpID", EmpID));

                    //filter.loadData(ds, "employeedetail", null, select, from, null);

                    EmployeeDetailProcess.ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AsOfDate);


                    //from = "from LeaveApplication P LEFT JOIN LeaveCode C ON P.LeaveCodeID=C.LeaveCodeID LEFT JOIN LeaveType T ON T.LeaveTypeID=C.LeaveTypeID";
                    //select = "P.*, T.LeaveType, T.LeaveTypeDesc";
                    //filter = new DBFilter();
                    //filter.add(new Match("LeaveAppDateFrom", ">=", startDate));
                    //filter.add(new Match("LeaveAppDateFrom", "<=", AsOfDate));
                    //filter.add(new Match("P.EmpID", EmpID));
                    //filter.loadData(ds, "LeaveApplication", null, select, from, null);
                    //try
                    //{
                    //    LeaveBalanceCalc calc = new LeaveBalanceCalc(EmpID, AsOfDate);
                    //    ArrayList balanceItems = calc.getCurrentBalanceList();
                    //    foreach (ELeaveBalance b in balanceItems)
                    //    {
                    //        System.Data.DataRow rr = sum.NewRow();
                    //        rr["LeaveBalanceID"] = b.LeaveBalanceID;
                    //        rr["EmpID"] = EmpID;
                    //        rr["LeaveBalanceEffectiveDate"] = b.LeaveBalanceEffectiveDate;
                    //        rr["LeaveBalanceBF"] = b.LeaveBalanceBF;
                    //        rr["LeaveBalanceEntitled"] = b.LeaveBalanceEntitled;
                    //        rr["LeaveBalanceForfeiture"] = b.LeaveBalanceForfeiture;
                    //        rr["Taken"] = b.Taken;
                    //        rr["Balance"] = b.Balance;
                    //        rr["Adjust"] = b.Adjust;
                    //        rr["Reserved"] = b.Reserved;
                    //        rr["Name"] = b.Name;
                    //        rr["Description"] = b.Description;
                    //        rr["StringFormat"] = b.StringFormat;


                    //        sum.Rows.Add(rr);


                    //    }
                    //}
                    //catch (Exception ex)
                    //{
                    //}

                    DBFilter filter = new DBFilter();
                    filter.add(new Match("LeaveAppDateFrom", ">=", startDate));
                    filter.add(new Match("LeaveAppDateFrom", "<=", AsOfDate));
                    filter.add(new Match("EmpID", EmpID));
                    ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, filter);
                    DataSet.EmployeeDetail.LeaveApplicationDataTable leaveApplicationTable = ds.LeaveApplication;
                    foreach (ELeaveApplication leaveApplication in leaveApplicationList)
                    {
                        DataSet.EmployeeDetail.LeaveApplicationRow row = leaveApplicationTable.NewLeaveApplicationRow();
                        row.EmpID            = leaveApplication.EmpID;
                        row.EmpPaymentID     = leaveApplication.EmpPaymentID;
                        row.LeaveAppDateFrom = leaveApplication.LeaveAppDateFrom;
                        row.LeaveAppDateTo   = leaveApplication.LeaveAppDateTo;
                        row.LeaveAppDays     = leaveApplication.LeaveAppDays;
                        row.LeaveAppID       = leaveApplication.LeaveAppID;
                        row.LeaveAppRemark   = leaveApplication.LeaveAppRemark;
                        if (!leaveApplication.LeaveAppTimeFrom.Ticks.Equals(0))
                        {
                            row.LeaveAppTimeFrom = leaveApplication.LeaveAppTimeFrom;
                        }
                        if (!leaveApplication.LeaveAppTimeTo.Ticks.Equals(0))
                        {
                            row.LeaveAppTimeTo = leaveApplication.LeaveAppTimeTo;
                        }
                        row.LeaveAppUnit = leaveApplication.LeaveAppUnit;
                        row.LeaveCodeID  = leaveApplication.LeaveCodeID;

                        ELeaveCode leaveCode = new ELeaveCode();
                        leaveCode.LeaveCodeID = leaveApplication.LeaveCodeID;
                        if (ELeaveCode.db.select(dbConn, leaveCode))
                        {
                            ELeaveType leaveType = new ELeaveType();
                            leaveType.LeaveTypeID = leaveCode.LeaveTypeID;
                            if (ELeaveType.db.select(dbConn, leaveType))
                            {
                                row.LeaveType     = leaveType.LeaveType;
                                row.LeaveTypeDesc = leaveType.LeaveTypeDesc;
                            }
                        }
                        leaveApplicationTable.AddLeaveApplicationRow(row);
                    }

                    //try
                    //{
                    LeaveBalanceCalc calc         = new LeaveBalanceCalc(dbConn, EmpID, AsOfDate);
                    ArrayList        balanceItems = calc.getCurrentBalanceList();
                    foreach (ELeaveBalance b in balanceItems)
                    {
                        DataSet.EmployeeDetail.LeaveBalanceRow rr = ds.LeaveBalance.NewLeaveBalanceRow();
                        rr["LeaveBalanceID"]            = b.LeaveBalanceID;
                        rr["EmpID"]                     = EmpID;
                        rr["LeaveBalanceEffectiveDate"] = b.LeaveBalanceEffectiveDate;
                        rr["LeaveBalanceBF"]            = b.LeaveBalanceBF;
                        rr["LeaveBalanceEntitled"]      = b.LeaveBalanceEntitled;
                        rr["LeaveBalanceForfeiture"]    = b.LeaveBalanceForfeiture + b.ExpiryForfeit;
                        rr["Taken"]                     = b.Taken;
                        rr["Balance"]                   = b.getBalance();
                        rr["Adjust"]                    = b.Adjust;
                        rr["Reserved"]                  = b.Reserved;
                        rr["Name"]          = b.Name;
                        rr["Description"]   = b.Description;
                        rr["ExpiryForfeit"] = b.ExpiryForfeit;
                        if (!b.NextExpiryDate.Ticks.Equals(0))
                        {
                            rr["NextExpiryDate"] = b.NextExpiryDate;
                        }
                        rr["NextExpiryForfeit"] = b.NextExpiryForfeit;
                        rr["StringFormat"]      = b.StringFormat;


                        ds.LeaveBalance.Rows.Add(rr);
                    }
                    //}
                    //catch (Exception)
                    //{
                    //    //  fail to create leave balance record by some reason
                    //    //  no handling so far
                    //}
                }


                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Employee_LeaveSummary();
                }
                else
                {
                }



                reportDocument.SetDataSource(ds);
                reportDocument.SetParameterValue("AsOfDate", AsOfDate);

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