Example #1
0
        private DataTable totalizeBiWeeklyResults(DataTable dt)
        {
            //Validate if Columns type are decimal, if not, will be switched
            PMCommon.FormatColumnTypes(dt);

            dt.Columns.Add("Id", typeof(string));

            dt = dt.AsEnumerable()
                 .Where(x => x.Field <string>("Trainer") != "") //Remove white rows
                 .GroupBy(x => x.Field <string>("Id"))
                 .Select
                 (
                n => new
            {
                CheckDate  = "",
                Trainer    = "Total",
                Manager    = "",
                Role       = "",
                Salary     = n.Sum(z => z.Field <decimal?>("Salary") == null ? 0 : z.Field <decimal?>("Salary")),
                Override   = n.Sum(z => z.Field <decimal?>("Override") == null ? 0 : z.Field <decimal?>("Override")),
                Commission = n.Sum(z => z.Field <decimal?>("Commission") == null ? 0 : z.Field <decimal?>("Commission")),
                OverPay    = n.Sum(z => z.Field <decimal?>("Over Pay") == null ? 0 : z.Field <decimal?>("Over Pay")),
                UnderPay   = n.Sum(z => z.Field <decimal?>("Under Pay") == null ? 0 : z.Field <decimal?>("Under Pay"))
            }
                 )
                 .ToList().ToDataTable();

            return(dt);
        }
Example #2
0
        private DataTable SummaryYearly(int yearDate)
        {
            string ParamStartDate = null;
            string ParamEndDate   = null;

            GetWEYearDates(ref ParamStartDate, ref ParamEndDate, yearDate);

            DataTable dt = PMCommon.SummaryBiweekly(ParamStartDate, ParamEndDate);


            dt.Columns.Add("Year-End Balance", typeof(double));
            dt.Columns.Add("Quarterly True-Up Bonus", typeof(double));
            dt.Columns.Add("Remaining Balance", typeof(double));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i < dt.Rows.Count - 1)
                {
                    dt.Rows[i][0] = yearDate;

                    dt.Rows[i]["Year-End Balance"] =
                        (dt.Rows[i]["Over Pay"].ToString() == "" ? 0 : double.Parse(dt.Rows[i]["Over Pay"].ToString())) +
                        (dt.Rows[i]["Under Pay"].ToString() == "" ? 0 : double.Parse(dt.Rows[i]["Under Pay"].ToString()));


                    if ((double)dt.Rows[i]["Year-End Balance"] >= 0)
                    {
                        dt.Rows[i]["Quarterly True-Up Bonus"] = dt.Rows[i]["Year-End Balance"];
                    }
                    else
                    {
                        dt.Rows[i]["Remaining Balance"] = dt.Rows[i]["Year-End Balance"];
                    }
                }
            }

            dt.Columns.Remove("Salary");
            dt.Columns.Remove("Override");
            dt.Columns.Remove("Commission");
            dt.Columns.Remove("Over Pay");
            dt.Columns.Remove("Under Pay");

            return(dt);
        }
        private void FillControls()
        {
            MessageAlert.Visible = false;
            if (!IsPostBack)
            {
                Session["DDLShow"]            = "Open";
                Session["DateExistInPayroll"] = false;


                //Session is only empty at this point if this page is reloaded and is not bringing values from previous page PMCumulativeSummary
                //Or new CheckDate was created and is attemping to refresh data
                if (Session["BiweekTable"] == null)
                {
                    string paramStartDate = "", paramEndDate = "";

                    List <DataTable> lstResults = PMCommon.GetPMPayrollresults(ref paramStartDate, ref paramEndDate);

                    if (lstResults != null && lstResults.Count > 0)
                    {
                        Session["BiweekTable"] = lstResults;
                    }
                }


                if (Session["BiweekTable"] != null)
                {
                    FirstLoadPaycheckList(UnionAllDatatables((List <DataTable>)Session["BiweekTable"]));
                    LoadDDL();
                    SetSession_PeriodIsOpenOrClosed();
                    CheckPeriodResults(ddlCheckPeriod.SelectedItem.Text);

                    FindOpenCheckDates();
                }
                else
                {
                    Response.Redirect("/");
                }
            }
        }
Example #4
0
        private void FillControls()
        {
            Session["Trainer"]         = null;
            Session["ddlYear"]         = null;
            Session["StartDate"]       = null;
            Session["EndDate"]         = null;
            Session["BiweekTable"]     = null;
            Session["YearTable"]       = null;
            Session["lstResultTables"] = new List <DataTable>();

            string paramStartDate = "", paramEndDate = "";
            //List<weekending> lstWE = GetWeekendingList(ref paramStartDate, ref paramEndDate);
            List <DataTable> LstDT = new List <DataTable>();

            Session["BiweekTable"] = PMCommon.GetPMPayrollresults(ref paramStartDate, ref paramEndDate);
            Session["StartDate"]   = paramStartDate;
            Session["EndDate"]     = paramEndDate;

            BiweeklyGridResults();
            LoadDDL();
            YearlyGridResults();
        }