protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EEmpPersonalInfo p      = new EEmpPersonalInfo();
        ArrayList        values = new ArrayList();

        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            if (cb.Checked)
            {
                WebFormUtils.GetKeys(db, p, cb);
                values.Add(p.EmpID);
            }
        }
        if (values.Count <= 0)
        {
            errors.addError("Employee not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Employee.EmployeeDetailProcess rpt = new HROne.Reports.Employee.EmployeeDetailProcess(dbConn, values);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_Detail.rpt"));
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "EmployeeDetail", true);
        }
        //Session["Report_EmployeeList"] = values;
        //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_EmployeeDetail_View.aspx");
    }
예제 #2
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);
            }
        }
예제 #3
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);
            }
        }
예제 #4
0
        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()
        {
            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);
            }
        }
예제 #6
0
        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);
            }
        }
예제 #7
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);
            }
        }
예제 #8
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);
            }
        }