コード例 #1
0
    protected void SetBasicAndGross()
    {
        DataTable dtBasic  = objEmpInfoMgr.GetGradeWiseSalaryMatrix(Convert.ToDecimal(ddlGrade.SelectedValue.Trim()), Convert.ToDecimal(ddlGradeLevel.SelectedValue.Trim()));
        decimal   decGross = 0;

        if (dtBasic.Rows.Count > 0)
        {
            txtBasicSalary.Text = dtBasic.Rows[0]["BasicSal"].ToString();
            if (ddlOffice.SelectedValue.Trim() != "1")
            {
                decGross = Convert.ToDecimal(dtBasic.Rows[0]["BasicSal"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["Housing"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["Conveyance"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["Medical"].ToString());
            }
            else
            {
                decGross = Convert.ToDecimal(dtBasic.Rows[0]["BasicSal"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["HOHousing"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["HOConveyance"].ToString()) +
                           Convert.ToDecimal(dtBasic.Rows[0]["Medical"].ToString());
            }
            txtGross.Text = decGross.ToString();
        }
        else
        {
            txtBasicSalary.Text = "0";
            txtGross.Text       = "0";
        }
    }
コード例 #2
0
    protected void AddToSalaryPakDetailsDataSet(DataTable dtSalHead, DataTable dtBenefitsPolicy, DataTable dtBasic)
    {
        Decimal dclBasic    = 0;
        decimal dclGross    = 0;
        decimal dclHrent    = 0;
        decimal dclMedical  = 0;
        decimal dclConv     = 0;
        Decimal dclTransAmt = 0;

        Decimal   dclAmount     = 0;
        Decimal   dclNetAmt     = 0;
        DataTable dtGradeMatrix = objEmpInfoMgr.GetGradeWiseSalaryMatrix(Convert.ToDecimal(dtBasic.Rows[0]["GradeID"].ToString()), Convert.ToDecimal(Convert.ToDecimal(dtBasic.Rows[0]["GradeLevelID"].ToString())));

        if (dtGradeMatrix.Rows.Count > 0)
        {
            if (dtBasic.Rows[0]["OfficeId"].ToString() != "1")
            {
                dclHrent    = Convert.ToDecimal(dtGradeMatrix.Rows[0]["Housing"].ToString());
                dclMedical  = Convert.ToDecimal(dtGradeMatrix.Rows[0]["Medical"].ToString());
                dclTransAmt = Convert.ToDecimal(dtGradeMatrix.Rows[0]["Conveyance"].ToString());
                // decGross = Convert.ToDecimal(dtBasic.Rows[0]["BasicSal"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["Housing"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["Conveyance"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["Medical"].ToString());
            }
            else
            {
                dclHrent    = Convert.ToDecimal(dtGradeMatrix.Rows[0]["HOHousing"].ToString());
                dclMedical  = Convert.ToDecimal(dtGradeMatrix.Rows[0]["Medical"].ToString());
                dclTransAmt = Convert.ToDecimal(dtGradeMatrix.Rows[0]["HOConveyance"].ToString());
                //decGross = Convert.ToDecimal(dtBasic.Rows[0]["BasicSal"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["HOHousing"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["HOConveyance"].ToString()) +
                //Convert.ToDecimal(dtBasic.Rows[0]["Medical"].ToString());
            }
        }
        else
        {
            dclHrent    = 0;
            dclMedical  = 0;
            dclTransAmt = 0;
        }


        if (string.IsNullOrEmpty(dtBasic.Rows[0]["BasicSalary"].ToString().Trim()) == false)
        {
            dclBasic = Common.RoundDecimal(dtBasic.Rows[0]["BasicSalary"].ToString().Trim(), 2);
        }

        if (string.IsNullOrEmpty(dtBasic.Rows[0]["GrossSalary"].ToString().Trim()) == false)
        {
            dclGross = Common.RoundDecimal(dtBasic.Rows[0]["GrossSalary"].ToString().Trim(), 2);
        }

        foreach (DataRow dRow in dtSalHead.Rows)
        {
            DataRow nRow = objDS.dtSalaryPakDtls.NewRow();
            nRow["SHEADID"]     = dRow["SHEADID"].ToString().Trim();
            nRow["HEADNAME"]    = dRow["HEADNAME"].ToString().Trim();
            nRow["ISBASICSAL"]  = dRow["ISBASIC"].ToString().Trim();
            nRow["ISINPERCENT"] = dRow["DISPLAYTYPE"].ToString().Trim();
            nRow["PERCNTFIELD"] = "";
            if (dRow["ISBASIC"].ToString().Trim() == "Y")
            {
                dclNetAmt       = dclNetAmt + dclBasic;
                dclGross        = dclGross + dclBasic;
                nRow["TOTAMNT"] = dclBasic.ToString();
                nRow["PAYAMT"]  = dclBasic.ToString();
            }
            else if (dRow["IsHouseRent"].ToString().Trim() == "Y")
            {
                //dclAmount = this.CalculateHeadAmount(dclGross, dtBenefitsPolicy, dtBasic.Rows[0]["EMPTYPEID"].ToString().Trim(), dRow["SHEADID"].ToString().Trim());
                nRow["TOTAMNT"] = dclHrent.ToString();
                nRow["PAYAMT"]  = dclHrent.ToString();
                dclNetAmt       = dclNetAmt + dclHrent;
                dclGross        = dclGross + dclHrent;
            }
            else if (dRow["IsMedical"].ToString().Trim() == "Y")
            {
                //dclAmount = this.CalculateHeadAmount(dclGross, dtBenefitsPolicy, dtBasic.Rows[0]["EMPTYPEID"].ToString().Trim(), dRow["SHEADID"].ToString().Trim());
                nRow["TOTAMNT"] = dclMedical.ToString();
                nRow["PAYAMT"]  = dclMedical.ToString();
                dclNetAmt       = dclNetAmt + dclMedical;
                dclGross        = dclGross + dclMedical;
            }
            else if (dRow["ISCONVEYANCE"].ToString().Trim() == "Y")
            {
                dclNetAmt       = dclNetAmt + dclTransAmt;
                dclGross        = dclGross + dclTransAmt;
                nRow["TOTAMNT"] = dclTransAmt.ToString();
                nRow["PAYAMT"]  = dclTransAmt.ToString();
            }
            else if (dRow["ISPF"].ToString().Trim() == "Y")
            {
                dclAmount       = this.CalculateHeadAmount(dclBasic, dtBenefitsPolicy, dtBasic.Rows[0]["EMPTYPEID"].ToString().Trim(), dRow["SHEADID"].ToString().Trim());
                nRow["TOTAMNT"] = dclAmount.ToString();
                nRow["PAYAMT"]  = dclAmount.ToString();
                dclNetAmt       = dclNetAmt + dclAmount;
            }
            else if (dRow["SHEADID"].ToString().ToUpper().Trim() == "17")
            {
                dclAmount       = this.CalculateHeadAmount(dclBasic, dtBenefitsPolicy, dtBasic.Rows[0]["EMPTYPEID"].ToString().Trim(), dRow["SHEADID"].ToString().Trim());
                nRow["TOTAMNT"] = dclAmount.ToString();
                nRow["PAYAMT"]  = dclAmount.ToString();
                dclNetAmt       = dclNetAmt + dclAmount;
            }
            else if (dRow["SHEADID"].ToString().ToUpper().Trim() == "7")
            {
                dclAmount       = this.CalculateHeadAmount(dclBasic, dtBenefitsPolicy, dtBasic.Rows[0]["EMPTYPEID"].ToString().Trim(), dRow["SHEADID"].ToString().Trim());
                nRow["TOTAMNT"] = dclAmount.ToString();
                nRow["PAYAMT"]  = dclAmount.ToString();
                dclNetAmt       = dclNetAmt + dclAmount;
            }
            else
            {
                nRow["TOTAMNT"] = dRow["VALUE"].ToString().Trim();
                nRow["PAYAMT"]  = dRow["VALUE"].ToString().Trim();
            }
            nRow["CONVTOTALAMNT"] = dRow["VALUE"].ToString().Trim();
            nRow["ISPFUND"]       = dRow["ISPF"].ToString().Trim();
            nRow["AMTCOMPAY"]     = "0";
            objDS.dtSalaryPakDtls.Rows.Add(nRow);
        }
        objDS.dtSalaryPakDtls.AcceptChanges();
        grSalHead.DataSource = objDS.dtSalaryPakDtls;
        grSalHead.DataBind();
        txtNetPayableAmt.Text = dclNetAmt.ToString();
        txtGrossSal.Text      = dclGross.ToString();
    }