示例#1
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        ArrayList        EmpList = new ArrayList();
        EEmpPersonalInfo empInfo = new EEmpPersonalInfo();

        empInfo.EmpID = CurID;
        EmpList.Add(empInfo);

        if (!string.IsNullOrEmpty(PayPeriodID.SelectedValue))
        {
            string   hLevelIDListString = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIERARCHY_DISPLAY_SEQUENCE);
            string[] hlevelIDList       = hLevelIDListString.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);

            DBFilter payBatchFilter   = new DBFilter();
            DBFilter empPayrollFilter = new DBFilter();
            empPayrollFilter.add(new Match("ep.PayPeriodID", PayPeriodID.SelectedValue));
            payBatchFilter.add(new IN("PayBatchID", "SELECT DISTINCT ep.PayBatchID FROM " + EEmpPayroll.db.dbclass.tableName + " ep", empPayrollFilter));
            if (ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_PAYSLIP_AUTO_RELEASE).Equals("N", StringComparison.CurrentCultureIgnoreCase))
            {
                payBatchFilter.add(new Match("PayBatchIsESSPaySlipRelease", true));
            }


            HROne.Reports.Payroll.PayrollDetailProcess rpt = new HROne.Reports.Payroll.PayrollDetailProcess(dbConn, EmpList, HROne.Reports.Payroll.PayrollDetailProcess.ReportType.PaySlip, null, EPayrollBatch.db.select(dbConn, payBatchFilter), new ArrayList(hlevelIDList));
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_PaySlip.rpt"));
            WebUtils.ReportExport(Response, rpt, reportFileName, "PDF", "PaySlip");
        }
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(EPayrollPeriod.db, Page.Master);

        errors.clear();

        ArrayList empList      = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect");
        ArrayList payBatchList = this.Payroll_PeriodSelectionList1.GetPayBatchList();



        //string strEmpList = string.Empty;
        //string strPayBatchList = string.Empty;
        if (empList.Count > 0 && payBatchList.Count > 0)
        {
            //foreach (EEmpPersonalInfo o in empList)
            //{
            //    if (strEmpList == string.Empty)
            //        strEmpList = ((EEmpPersonalInfo)o).EmpID.ToString();
            //    else
            //        strEmpList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString();

            //}
            //foreach (EPayrollBatch o in payBatchList)
            //{
            //    if (strPayBatchList == string.Empty)
            //        strPayBatchList = ((EPayrollBatch)o).PayBatchID.ToString();
            //    else
            //        strPayBatchList += "_" + ((EPayrollBatch)o).PayBatchID.ToString();

            //}

            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();
            }

            HROne.Reports.Payroll.PayrollDetailProcess rpt = new HROne.Reports.Payroll.PayrollDetailProcess(dbConn, empList, HROne.Reports.Payroll.PayrollDetailProcess.ReportType.PaySlip, null, payBatchList, hLevelIDList);

            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_PaySlip.rpt"));

            ESystemParameter.setParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIERARCHY_DISPLAY_SEQUENCE, hLevelIDListString);
            //WebUtils.RegisterReportExport(this, rpt, reportFileName, ((Button)sender).CommandArgument, "PaySlip", true);
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PaySlip", true);
        }
        else
        {
            errors.addError("Employee or Payroll Batch not selected");
        }

//        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList empList = 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);
                empList.Add(o);
            }
        }



        if (empList.Count > 0)
        {
            //EPayrollPeriod payPeriod = new EPayrollPeriod();
            //payPeriod.PayPeriodID = CurPayPeriodID;
            //EPayrollPeriod.db.select(dbConn, payPeriod);

            //string strEmpPayrollIDList = string.Empty;
            //foreach (EEmpPayroll o in list)
            //{
            //    if (strEmpPayrollIDList == string.Empty)
            //        strEmpPayrollIDList = ((EEmpPayroll)o).EmpPayrollID.ToString();
            //    else
            //        strEmpPayrollIDList += "_" + ((EEmpPayroll)o).EmpPayrollID.ToString();

            //}

            if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T"))
            {
                HROne.Reports.Payroll.PayrollDetailProcess rpt = new HROne.Reports.Payroll.PayrollDetailProcess(dbConn, empList, HROne.Reports.Payroll.PayrollDetailProcess.ReportType.TrialRun, Payroll_PeriodSelectionList1.GetTrialRunPayPeriodList(), null, null);
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_TrialDetail.rpt"));
                WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PayTrialRunDetail", true);
            }
            else
            {
                HROne.Reports.Payroll.PayrollDetailProcess rpt = new HROne.Reports.Payroll.PayrollDetailProcess(dbConn, empList, HROne.Reports.Payroll.PayrollDetailProcess.ReportType.History, null, Payroll_PeriodSelectionList1.GetPayBatchList(), null);
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_HistoryDetail.rpt"));
                WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PayHistoryDetail", true);
            }


            //Server.Transfer("Report_Payroll_TrialRunDetail_View.aspx?"
            //    + "PayPeriodID=" + DecryptedRequest["PayPeriodID"]
            //    + "&EmpPayrollID=" + strEmpPayrollIDList);
            //            errors.addError("Complete");
            //Response.Write("<script>alert('Completed'); </script>");
        }
        else
        {
            errors.addError("Employee not selected");
        }
    }