Esempio n. 1
0
    protected void SaveData()
    {
        dsPayroll_SalaryPackage  objDs     = new dsPayroll_SalaryPackage();
        Payroll_PaySlipOptionMgr objOptMgr = new Payroll_PaySlipOptionMgr();

        string  strEntryDate      = "";
        string  strConfirmDueDate = "";
        string  strExtensionDate  = "";
        string  strConfirmDate    = "";
        decimal dclNewBasicSal    = 0;

        if (string.IsNullOrEmpty(txtEntryDate.Text.Trim()) == false)
        {
            strEntryDate = Common.ReturnDate(txtEntryDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtConfirmDueDate.Text.Trim()) == false)
        {
            strConfirmDueDate = Common.ReturnDate(txtConfirmDueDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtExtensionDate.Text.Trim()) == false)
        {
            strExtensionDate = Common.ReturnDate(txtExtensionDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtConfirmDate.Text.Trim()) == false)
        {
            strConfirmDate = Common.ReturnDate(txtConfirmDate.Text.Trim());
        }

        DataTable dtBfPlc = objOptMgr.SelectPayrollBenefitsPolicyData("0", "1");

        DataRow[] foundPlcRow;
        foundPlcRow = null;

        //Basic
        foundPlcRow = dtBfPlc.Select("SHEADID=1");
        if (foundPlcRow.Length > 0)
        {
            DataRow nRow1 = objDs.dtSalPackUpdate.NewRow();
            nRow1["SHEADID"] = 1;
            nRow1["PAYAMT"]  = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtNewGrossSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 2));
            dclNewBasicSal   = Convert.ToDecimal(nRow1["PAYAMT"].ToString());
            objDs.dtSalPackUpdate.Rows.Add(nRow1);
        }
        //House Rent
        foundPlcRow = dtBfPlc.Select("SHEADID=2");
        if (foundPlcRow.Length > 0)
        {
            DataRow nRow2 = objDs.dtSalPackUpdate.NewRow();
            nRow2["SHEADID"] = 2;
            nRow2["PAYAMT"]  = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtNewGrossSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 2));
            objDs.dtSalPackUpdate.Rows.Add(nRow2);
        }

        //Medical
        foundPlcRow = dtBfPlc.Select("SHEADID=3");
        if (foundPlcRow.Length > 0)
        {
            DataRow nRow3 = objDs.dtSalPackUpdate.NewRow();
            nRow3["SHEADID"] = 3;
            nRow3["PAYAMT"]  = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtNewGrossSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 2));
            objDs.dtSalPackUpdate.Rows.Add(nRow3);
        }
        if (ddlEmpType.SelectedValue.ToString() == "1")
        {
            //PF Allowance
            foundPlcRow = dtBfPlc.Select("SHEADID=8");
            if (dtBfPlc.Rows.Count > 0)
            {
                DataRow nRow4 = objDs.dtSalPackUpdate.NewRow();
                nRow4["SHEADID"] = 8;
                nRow4["PAYAMT"]  = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(dclNewBasicSal.ToString(), 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 2));
                objDs.dtSalPackUpdate.Rows.Add(nRow4);
            }

            objDs.dtSalPackUpdate.AcceptChanges();
        }

        if (hfIsUpdate.Value == "Y")
        {
            hfId.Value = hfId.Value;
        }
        else
        {
            hfId.Value = Common.getMaxId("EmpConfirmationLog", "ConfirmId");
        }
        objEmpInfoMgr.InsertConfirmation(hfId.Value.ToString(), txtEmpID.Text.Trim(), ddlAction.SelectedValue.ToString(), strEntryDate, txtProbationPeriod.Text.Trim(), strConfirmDueDate, strExtensionDate,
                                         strConfirmDate, txtExtensionMonth.Text.Trim(), txtRemarks.Text.Trim(), Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString()), hfIsUpdate.Value.ToString(), lblBasicSalary.ToolTip.ToString(),
                                         objDs.dtSalPackUpdate, "Y", lblJoinDate.Text.Trim(), lblJoinDate.ToolTip.Trim(), ddlEmpType.SelectedValue.ToString(), txtNewGrossSalary.Text, dclNewBasicSal.ToString());

        if (hfIsUpdate.Value == "N")
        {
            lblMsg.Text = "Record Saved Successfully";
        }
        else
        {
            lblMsg.Text = "Record Updated Successfully";
        }
        this.OpenRecord();
        this.EntryMode(false);
    }
Esempio n. 2
0
    protected void SaveData()
    {
        dsPayroll_SalaryPackage  objDs     = new dsPayroll_SalaryPackage();
        Payroll_PaySlipOptionMgr objOptMgr = new Payroll_PaySlipOptionMgr();

        string strEntryDate      = "";
        string strConfirmDate    = "";
        string strNewConfirmDate = "";
        string strExtensionDate  = "";

        if (string.IsNullOrEmpty(txtEntryDate.Text.Trim()) == false)
        {
            strEntryDate = Common.ReturnDate(txtEntryDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtConfirmDate.Text.Trim()) == false)
        {
            strConfirmDate = Common.ReturnDate(txtConfirmDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtNewConfirmDate.Text.Trim()) == false)
        {
            strNewConfirmDate = Common.ReturnDate(txtNewConfirmDate.Text.Trim());
        }

        if (string.IsNullOrEmpty(txtExtensionDate.Text.Trim()) == false)
        {
            strExtensionDate = Common.ReturnDate(txtExtensionDate.Text.Trim());
        }

        //PF Allowance
        DataTable dtBfPlc = objOptMgr.SelectPayrollBenefitsPolicyData("0");

        DataRow[] foundPlcRow;
        foundPlcRow = null;

        foundPlcRow = dtBfPlc.Select("SHEADID=13");
        if (foundPlcRow.Length > 0)
        {
            DataRow nRow3 = objDs.dtSalPackUpdate.NewRow();

            nRow3["SHEADID"] = 13;
            nRow3["PAYAMT"]  = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(lblBasicSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 0));

            objDs.dtSalPackUpdate.Rows.Add(nRow3);
        }

        objDs.dtSalPackUpdate.AcceptChanges();

        if (hfIsUpdate.Value == "Y")
        {
            hfId.Value = hfId.Value;
        }
        else
        {
            hfId.Value = Common.getMaxId("EmpConfirmationLog", "ConfirmId");
        }
        objEmpInfoMgr.InsertConfirmation(hfId.Value.ToString(), txtEmpID.Text.Trim(), ddlAction.SelectedValue.ToString(), strEntryDate, strConfirmDate, txtExtensionMonth.Text.Trim(), strNewConfirmDate, strExtensionDate,
                                         txtRemarks.Text.Trim(), Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString()), hfIsUpdate.Value.ToString(), lblBasicSalary.ToolTip.ToString(), objDs.dtSalPackUpdate);

        if (hfIsUpdate.Value == "N")
        {
            lblMsg.Text = "Record Saved Successfully";
        }
        else
        {
            lblMsg.Text = "Record Updated Successfully";
        }

        this.OpenRecord();
        this.EntryMode(false);
    }