public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = binding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);
        filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));

        // only staffs with commission calculation is configured through latest Recurring Payment
        DBTerm m_inCondition = CreateFilterByProcess(gProcessName, gPID);

        if (m_inCondition != null)
        {
            filter.add(m_inCondition);
        }

        string select = "e.* ";
        string from   = "from [" + db.dbclass.tableName + "] e ";

        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = filter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);
        view  = new DataView(table);

        ListFooter.Refresh();
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
Example #2
0
 public void add(DBTerm term)
 {
     dbTermsList.Add(term);
 }
Example #3
0
 public void add(DBTerm term)
 {
     terms.Add(term);
 }
    public DBFilter GetEmpInfoFilter(DateTime FromDate, DateTime ToDate)
    {
        FromDate = FromDate.Date;
        ToDate   = ToDate.Date;
        DBFilter filter = binding.createFilter();

        DateTime dtPeriodFr, dtPeriodTo;

        if (DateTime.TryParse(JoinDateFrom.Value, out dtPeriodFr))
        {
            filter.add(new Match("ee.EmpDateOfJoin", ">=", dtPeriodFr));
        }
        if (DateTime.TryParse(JoinDateTo.Value, out dtPeriodTo))
        {
            filter.add(new Match("ee.EmpDateOfJoin", "<=", dtPeriodTo));
        }

        //if (EmpStatus.SelectedValue.Equals("A") || EmpStatus.SelectedValue.Equals("T") || EmpStatus.SelectedValue.Equals("TERMINATED"))
        //    filter.add(new Match("EmpDateOfJoin", "<=", ToDate.Date));

        filter.add(WebUtils.AddRankFilter(Session, "ee.EmpID", true));


        DateTime dtLastDateFr, dtLastDateTo;
        DBFilter empTerminationFilter = new DBFilter();

        if (DateTime.TryParse(LastDateFrom.Value, out dtLastDateFr))
        {
            empTerminationFilter.add(new Match("searchet.EmpTermLastDate", ">=", dtLastDateFr));
        }
        if (DateTime.TryParse(LastDateTo.Value, out dtLastDateTo))
        {
            empTerminationFilter.add(new Match("searchet.EmpTermLastDate", "<=", dtLastDateTo));
        }

        if (EmpStatus.SelectedValue.Equals("TERMINATED"))
        {
            empTerminationFilter.add(new Match("searchet.EmpTermLastDate", "<", FromDate.Date));
        }
        if (empTerminationFilter.terms().Count > 0 || EmpStatus.SelectedValue.Equals("T"))
        {
            empTerminationFilter.add(new MatchField("ee.EmpID", "searchet.EmpID"));
            filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchet ", empTerminationFilter));
        }
        if (EmpStatus.SelectedValue.Equals("AT"))
        {
            DBFilter notExistsEmpTerminationFilter = new DBFilter();
            notExistsEmpTerminationFilter.add(new Match("searchnoet.EmpTermLastDate", "<", FromDate.Date));
            notExistsEmpTerminationFilter.add(new MatchField("ee.EmpID", "searchnoet.EmpID"));
            filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchnoet ", notExistsEmpTerminationFilter, true));
        }
        if (EmpStatus.SelectedValue.Equals("A"))
        {
            DBFilter notExistsEmpTerminationFilter = new DBFilter();
            notExistsEmpTerminationFilter.add(new MatchField("ee.EmpID", "searchnoet.EmpID"));
            filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchnoet ", notExistsEmpTerminationFilter, true));
        }
        DBFilter empPosFilter = new DBFilter();

        //{
        //    OR orPositionTerm = null;
        //    foreach (ListItem item in PositionList.Items)
        //        if (item.Selected)
        //        {
        //            if (orPositionTerm == null)
        //                orPositionTerm = new OR();
        //            orPositionTerm.add(new Match("searchepi.PositionID", item.Value));
        //        }
        //    if (orPositionTerm != null)
        //        empPosFilter.add(orPositionTerm);
        //}

        DBTerm positionDBTerm = CreateDBTermsFromListControl("searchepi.PositionID", EPosition.db.dbclass.tableName + " pos", "pos.PositionID", PositionList.ListControl);

        if (positionDBTerm != null)
        {
            empPosFilter.add(positionDBTerm);
        }

        DBTerm rankDBTerms = CreateDBTermsFromListControl("searchepi.RankID", ERank.db.dbclass.tableName + " rank", "rank.RankID", RankList.ListControl);

        if (rankDBTerms != null)
        {
            empPosFilter.add(rankDBTerms);
        }

        DBTerm employmentTypeDBTerms = CreateDBTermsFromListControl("searchepi.EmploymentTypeID", EEmploymentType.db.dbclass.tableName + " empType", "empType.EmploymentTypeID", EmploymentTypeList.ListControl);

        if (employmentTypeDBTerms != null)
        {
            empPosFilter.add(employmentTypeDBTerms);
        }

        DBTerm staffTypeDBTerms = CreateDBTermsFromListControl("searchepi.StaffTypeID", EStaffType.db.dbclass.tableName + " staffType", "staffType.StaffTypeID", StaffTypeList.ListControl);

        if (staffTypeDBTerms != null)
        {
            empPosFilter.add(staffTypeDBTerms);
        }

        DBTerm payrollGroupDBTerms = CreateDBTermsFromListControl("searchepi.PayGroupID", EPayrollGroup.db.dbclass.tableName + " payGroup", "payGroup.PayGroupID", PayrollGroupList.ListControl);

        if (payrollGroupDBTerms != null)
        {
            empPosFilter.add(payrollGroupDBTerms);
        }

        DBTerm companyAndHierarchyTerm = HierarchyCheckBoxList1.GetFilters("searchepi", "EmpPosID");

        if (companyAndHierarchyTerm != null)
        {
            empPosFilter.add(companyAndHierarchyTerm);
        }
        if (empPosFilter.terms().Count > 0)
        {
            empPosFilter.add(new MatchField("ee.EmpID", "searchepi.EmpID"));

            EEmpPositionInfo.DBFilterAddDateRange(empPosFilter, "searchepi", FromDate, ToDate);

            OR orEmpPosTerm = new OR();
            orEmpPosTerm.add(new Exists(EEmpPositionInfo.db.dbclass.tableName + " searchepi ", empPosFilter));
            filter.add(orEmpPosTerm);
        }


        //DBFilter empPosNotExistsFilter = new DBFilter();
        //empPosNotExistsFilter.add(new MatchField("ee.EmpID", "np.EmpID"));
        //orEmpPosTerm.add(new Exists(EEmpPositionInfo.db.dbclass.tableName + " np", empPosNotExistsFilter, true));


        return(filter);
    }
Example #5
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(EEmpPayroll.db, Page.Master);

        errors.clear();

        ArrayList hLevelIDList       = new ArrayList();
        string    hLevelIDListString = string.Empty;
        int       tmpHLevelID        = 0;

        if (int.TryParse(HLevel1.SelectedValue, out tmpHLevelID))
        {
            if (tmpHLevelID > 0)
            {
                hLevelIDList.Add(tmpHLevelID);
                if (string.IsNullOrEmpty(hLevelIDListString))
                {
                    hLevelIDListString = tmpHLevelID.ToString();
                }
                else
                {
                    hLevelIDListString += "|" + tmpHLevelID.ToString();
                }
            }
        }

        if (int.TryParse(HLevel2.SelectedValue, out tmpHLevelID))
        {
            if (tmpHLevelID > 0)
            {
                hLevelIDList.Add(tmpHLevelID);
            }
        }
        if (string.IsNullOrEmpty(hLevelIDListString))
        {
            hLevelIDListString = tmpHLevelID.ToString();
        }
        else
        {
            hLevelIDListString += "|" + tmpHLevelID.ToString();
        }

        DBTerm payrollPeriodTerm = Payroll_PeriodSelectionList1.GetEmpPayrollDBTerm();

        //OR orEmpIDTerms = null;

        ArrayList empPayrollList = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPersonalInfo o = (EEmpPersonalInfo)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);

                DBFilter empPayrollFilter = new DBFilter();
                empPayrollFilter.add(payrollPeriodTerm);
                empPayrollFilter.add(new Match("EmpID", o.EmpID));
                ArrayList list = EEmpPayroll.db.select(dbConn, empPayrollFilter);
                if (list != null)
                {
                    empPayrollList.AddRange(list);
                }
                //if (orEmpIDTerms == null)
                //    orEmpIDTerms = new OR();
                //orEmpIDTerms.add(new Match("EmpID", o.EmpID));
            }
        }


        if (empPayrollList.Count > 0)
        {
            //empPayrollFilter.add(orEmpIDTerms);
            //ArrayList list = EEmpPayroll.db.select(dbConn, empPayrollFilter);

            ESystemParameter.setParameter(dbConn, ESystemParameter.PARAM_CODE_PAYROLL_SUMMARY_HIERARCHY_DISPLAY_SEQUENCE, hLevelIDListString);
            if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T"))
            {
                HROne.Reports.Payroll.PayrollSummaryProcess rpt = new HROne.Reports.Payroll.PayrollSummaryProcess(dbConn, empPayrollList, HROne.Reports.Payroll.PayrollSummaryProcess.ReportType.TrialRun, hLevelIDList);
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_TrialRunSummary.rpt"));
                WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PayTrialRunSummary", true);
            }
            else
            {
                HROne.Reports.Payroll.PayrollSummaryProcess rpt = new HROne.Reports.Payroll.PayrollSummaryProcess(dbConn, empPayrollList, HROne.Reports.Payroll.PayrollSummaryProcess.ReportType.History, hLevelIDList);
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_HistorySummary.rpt"));
                WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PayHistorySummary", true);
            }
        }
        else
        {
            errors.addError("Employee not selected");
        }
    }
Example #6
0
 public void addFilter(DBTerm term)
 {
     filterTerms.Add(term);
 }