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

        errors.clear();

        ArrayList empList       = new ArrayList();
        ArrayList payBatchList  = new ArrayList();
        DateTime  dtPayPeriodFr = new DateTime();

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

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

            //}
            ////DateTime dtPayPeriodTo;
            if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("PayPeriodFr")).Value, out dtPayPeriodFr))
            {
                //strPayPeriodRequest = "&PayPeriodFr=" + dtPayPeriodFr.Ticks;
            }
            else
            {
                errors.addError("Invalid Date Format");
            }


            //            errors.addError("Complete");
            //Response.Write("<script>alert('Completed'); </script>");
        }
        else
        {
            errors.addError("Employee not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Payroll.EEOverallPaymentSummaryProcess rpt = new HROne.Reports.Payroll.EEOverallPaymentSummaryProcess(dbConn, empList, dtPayPeriodFr);

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

            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "EEOverallPaymentSummary", true);

            //Server.Transfer("Report_Payroll_EEOverallPaymentSummary_View.aspx?"
            //+ "EmpID=" + strEmpList
            //+ strPayPeriodRequest
            //);
        }
        //        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        DateTime dtPayPeriodFr = new DateTime();

        if (!DateTime.TryParse(PayrollPeriodFrom.Value, out dtPayPeriodFr))
        {
            errors.addError("Invalid Date Format");
        }
        else
        {
            if (dtPayPeriodFr.Day != 1)     // 2013-05-23 => 2013-05-01
            {
                dtPayPeriodFr = new DateTime(dtPayPeriodFr.Year, dtPayPeriodFr.Month, 1);
            }

            ArrayList empList = new ArrayList();

            EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
            empInfo.EmpID = CurID;

            if (EEmpPersonalInfo.db.select(dbConn, empInfo) && errors.isEmpty())    // employee found !
            {
                empList.Add(empInfo);

                HROne.Reports.Payroll.EEOverallPaymentSummaryProcess rpt = new HROne.Reports.Payroll.EEOverallPaymentSummaryProcess(dbConn, empList, dtPayPeriodFr);
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_EEOverallPaymentSummary.rpt"));
                WebUtils.ReportExport(Response, rpt, reportFileName, "PDF", "OverallPaymentSummary");
            }
        }


/////////////////////////////////////////////////////

        //PageErrors errors = PageErrors.getErrors(db, Page.Master);
        //errors.clear();

        //ArrayList empList = new ArrayList();
        //ArrayList payBatchList = new ArrayList();
        //DateTime dtPayPeriodFr = new DateTime();

        //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)
        //{

        //    if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("PayPeriodFr")).Value, out dtPayPeriodFr))
        //    {
        //    }
        //    else
        //        errors.addError("Invalid Date Format");
        //}
        //else
        //    errors.addError("Employee not selected");

        //if (errors.isEmpty())
        //{
        //    HROne.Reports.Payroll.EEOverallPaymentSummaryProcess rpt = new HROne.Reports.Payroll.EEOverallPaymentSummaryProcess(dbConn, empList, dtPayPeriodFr);

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

        //    WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "EEOverallPaymentSummary", true);
        //}
    }