protected void FillSalaryData(string strEmpID)
    {
        PayrollReportManager objPayRptMgr = new PayrollReportManager();
        DataTable            dtSalary     = objITMgr.GetSalaryDataForITCalculation(ddlFiscalYear.SelectedValue.Trim(), strEmpID);
        // Bonus
        // DataTable dtEmpFA = objPayRptMgr.GetBonusAllowanceMonthly(strMonth, strFisYr);
        DataTable dtEmpFAYr = objPayRptMgr.GetBonusAllowanceYearly(ddlFiscalYear.SelectedValue.Trim());

        //  DataRow[] fEmpFARows;
        DataRow[] fEmpFAYrRows;

        DataTable dtITDeposit = objITMgr.GetITDepositedData(strEmpID, ddlFiscalYear.SelectedValue.Trim());
        //Comment Date:16-7-2013. Introduce Refund Faclity.  DataTable dtLastYrITCalData = objITMgr.GetITCalculationReportData("0","6", Convert.ToString(Convert.ToInt32(ddlFiscalYear.SelectedValue.Trim())-1));
        DataTable dtLastYrITCalData = objITMgr.GetITRefundData("", ddlFiscalYear.SelectedValue.Trim());

        // IT Policy Data
        DataTable dtITPolicy = objOptMgr.GetITPolicyData();

        DataRow[] foundLastYrRow;
        DataRow[] foundSalRows;
        DataRow[] foundDepoRows;

        // Policy Variable
        decimal dclYHAPlc       = 0;
        decimal dclMHAPlc       = 0;
        decimal dclYTAPlc       = 0;
        decimal dclYMAPlc       = 0;//Yearly Medical Exeption
        decimal dclSlot0Plc     = 0;
        decimal dclSlot10Plc    = 0;
        decimal dclSlot15Plc    = 0;
        decimal dclSlot20Plc    = 0;
        decimal dclSlot25Plc    = 0;
        decimal dclMinTaxPlc    = 0;
        decimal dclInvAllowPlc  = 0;
        decimal dclInvRebatePlc = 0;
        // End of Policy Variable

        decimal dclYBasic              = 0;
        decimal dclYHouse              = 0;
        decimal dclYMedical            = 0;
        decimal dclYConveyance         = 0;
        decimal dclYField              = 0;
        decimal dclYTransport          = 0;
        decimal dclYFestival           = 0;
        decimal dclYOther              = 0;
        decimal dclYPF                 = 0;
        decimal dclMonthDur            = 0;
        decimal dclMonthDurFromJoining = 0;
        decimal dclRebate              = 0;
        decimal dclITDepo              = 0;
        decimal dclDemand              = 0;
        decimal dclRefund              = 0;
        decimal dclTaxDiff             = 0;
        decimal dclYChgAllow           = 0;
        decimal dclYPerfAllow          = 0;
        decimal dclYArrear             = 0;
        decimal dclYOverTime           = 0;

        DateTime dtFisStartDate = new DateTime();
        DateTime dtJoinDate     = new DateTime();

        int     inJoinMonth = 0;
        decimal dclYHRebate = 0;
        int     i           = 1;

        // Assign Fiscal Start Date
        if (string.IsNullOrEmpty(Session["FISCALSTARTDATE"].ToString().Trim()) == false)
        {
            dtFisStartDate = Convert.ToDateTime(Common.SetDate(Session["FISCALSTARTDATE"].ToString().Trim()));
            //Convert.ToDateTime(Common.SetDate(Session["FISCALSTARTDATE"].ToString().Trim()));
        }

        foreach (GridViewRow gRow in grEmployee.Rows)
        {
            dclYBasic     = 0;
            dclYHouse     = 0;
            dclYMedical   = 0;
            dclYField     = 0;
            dclYTransport = 0;
            dclYFestival  = 0;
            dclYOther     = 0;
            dclYOverTime  = 0;
            dclYPF        = 0;
            dclMonthDur   = 0;
            dclRebate     = 0;
            dclITDepo     = 0;
            dclDemand     = 0;
            dclRefund     = 0;
            dclTaxDiff    = 0;
            dclYChgAllow  = 0;
            dclYPerfAllow = 0;
            dclYArrear    = 0;

            // Policy Variable & Value Assign
            dclYHAPlc       = 0;
            dclMHAPlc       = 0;
            dclYTAPlc       = 0;
            dclSlot0Plc     = 0;
            dclSlot10Plc    = 0;
            dclSlot15Plc    = 0;
            dclSlot20Plc    = 0;
            dclMinTaxPlc    = 0;
            dclInvAllowPlc  = 0;
            dclInvRebatePlc = 0;

            gRow.Cells[1].Text = i.ToString();
            foreach (DataRow dRow in dtITPolicy.Rows)
            {
                switch (dRow["POLICYID"].ToString().Trim())
                {
                case "YHA":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclYHAPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclYHAPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "MHA":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclMHAPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclMHAPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "YTA":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclYTAPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclYTAPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "YMA":    //Early Medical Exemption
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclYMAPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclYMAPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "SL0":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclSlot0Plc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclSlot0Plc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "SL10":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclSlot10Plc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclSlot10Plc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "SL15":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclSlot15Plc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclSlot15Plc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "SL20":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclSlot20Plc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclSlot20Plc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "SL25":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclSlot25Plc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclSlot25Plc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "MNT":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclMinTaxPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclMinTaxPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "INVA":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclInvAllowPlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclInvAllowPlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;

                case "INVR":
                    if (gRow.Cells[6].Text.Trim() == "M")
                    {
                        dclInvRebatePlc = Common.RoundDecimal(dRow["MAMT"].ToString().Trim(), 0);
                    }
                    else if (gRow.Cells[6].Text.Trim() == "F")
                    {
                        dclInvRebatePlc = Common.RoundDecimal(dRow["FAMT"].ToString().Trim(), 0);
                    }
                    break;
                }
            }

            // End of Policy Variable

            dtJoinDate  = Convert.ToDateTime(Common.SetDate(gRow.Cells[8].Text.Trim()));
            inJoinMonth = dtJoinDate.Month;

            foundSalRows  = dtSalary.Select("EMPID='" + gRow.Cells[2].Text.Trim() + "'");
            foundDepoRows = dtITDeposit.Select("EMPID='" + gRow.Cells[2].Text.Trim() + "'");
            // Bonus
            fEmpFAYrRows = dtEmpFAYr.Select("EMPID ='" + gRow.Cells[2].Text.Trim() + "'");
            // Last Year IT 108 Data
            foundLastYrRow = dtLastYrITCalData.Select("EmpID ='" + gRow.Cells[2].Text.Trim() + "'");

            DataTable dtSalPak = objPayrollMgr.SelectSalaryPakDetls(Convert.ToInt32(grEmployee.DataKeys[gRow.DataItemIndex].Values[1].ToString().Trim()));

            foreach (DataRow dRow in foundSalRows)
            {
                switch (dRow["SHEADID"].ToString().Trim())
                {
                case "1":    //Basic
                    dclYBasic = dclYBasic + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);

                    dclYHouse = dclYHouse + ((Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0) * 50) / 100);

                    dclYMedical = dclYMedical + ((Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0) * 10) / 100);

                    dclYConveyance = dclYConveyance + ((Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0) * 5) / 100);
                    break;

                case "19":    //Festival Allow
                    Decimal dclYFA = 0;
                    dclYFA = Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);
                    if (dclYFA == 0)
                    {
                        if (fEmpFAYrRows.Length > 0)
                        {
                            dclYFA = Common.RoundDecimal(fEmpFAYrRows[0]["PAYAMT"].ToString(), 0);
                        }
                        else
                        {
                            dclYFA = 0;
                        }
                    }
                    else
                    {
                        if (fEmpFAYrRows.Length > 0)
                        {
                            if (dclYFA != Common.RoundDecimal(fEmpFAYrRows[0]["PAYAMT"].ToString(), 0))
                            {
                                dclYFA = Common.RoundDecimal(fEmpFAYrRows[0]["PAYAMT"].ToString(), 0);
                            }
                        }
                    }
                    dclYFestival = dclYFA;
                    //nRow["YFestivalBonus"] = dclYFA.ToString();
                    break;

                case "8":
                    dclYOverTime = dclYOverTime + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);
                    break;

                ////case "13":
                ////    dclYOther = dclYOther + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);
                ////    break;

                case "13":    //PF
                case "23":
                    dclYPF = dclYPF + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);

                    dclYPF = Math.Abs(dclYPF);
                    break;

                case "11":    // Charge Allow
                    dclYChgAllow = dclYOther + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);
                    break;

                case "12":     //Performance Allow
                    dclYPerfAllow = dclYOther + Common.RoundDecimal(dRow["PayAmt"].ToString().Trim(), 0);
                    break;
                }
            }

            //Forcasting Salary from Salary Package
            if ((Convert.ToInt32(ddlMonth.SelectedValue.Trim()) >= 7) && (Convert.ToInt32(ddlMonth.SelectedValue.Trim()) <= 12))
            {
                if (dtSalary.Rows.Count > 0)
                {
                    dclMonthDur = 6 - (Convert.ToDecimal(ddlMonth.SelectedValue.Trim())) + 12;
                }
                else
                {
                    dclMonthDur = 6 - (Convert.ToDecimal(ddlMonth.SelectedValue.Trim())) + 13;
                }
            }
            else
            {
                dclMonthDur = 6 - (Convert.ToDecimal(ddlMonth.SelectedValue.Trim()));
            }

            //Calculate Joining to Fiscal Year end duration
            if (dtJoinDate >= dtFisStartDate)
            {
                if ((inJoinMonth >= 7) && (inJoinMonth <= 12))
                {
                    dclMonthDurFromJoining = 12 - inJoinMonth + 7;
                }
                else
                {
                    dclMonthDurFromJoining = 6 - inJoinMonth + 1;
                }
            }
            else
            {
                dclMonthDurFromJoining = 12;
            }

            if (dtSalPak.Rows.Count > 0)
            {
                dclYBasic     = dclYBasic + this.GetSalHeadAmt("1", grEmployee.DataKeys[gRow.DataItemIndex].Values[1].ToString().Trim(), dtSalPak) * dclMonthDur;
                dclYHouse     = (dclYBasic * 50) / 100;
                dclYMedical   = (dclYBasic * 10) / 100;
                dclYTransport = (dclYBasic * 5) / 100;
                dclYOverTime  = dclYOverTime + this.GetSalHeadAmt("8", grEmployee.DataKeys[gRow.DataItemIndex].Values[1].ToString().Trim(), dtSalPak) * dclMonthDur;
                dclYPF        = dclYPF + this.GetSalHeadAmt("13", grEmployee.DataKeys[gRow.DataItemIndex].Values[1].ToString().Trim(), dtSalPak) * dclMonthDur;

                // Edited By: Amit & Sulata
                if (fEmpFAYrRows.Length > 0)
                {
                    dclYFestival = Common.RoundDecimal(fEmpFAYrRows[0]["PAYAMT"].ToString(), 0);
                }
            }

            //If Arrear Exist
            dclYArrear = SalaryPayslipDetTaxFiscalYrWs(gRow.Cells[2].Text.Trim());
            if (dclYArrear > 0)
            {
                dclYArrear = Math.Round((dclYArrear / Convert.ToDecimal(1.65)), 2);
                dclYBasic  = Math.Round(dclYBasic + dclYArrear, 0);

                dclYHouse = Math.Round(dclYHouse + ((dclYArrear * 50) / 100), 0);

                dclYMedical = Math.Round(dclYMedical + ((dclYArrear * 10) / 100), 0);

                dclYTransport = Math.Round(dclYTransport + ((dclYArrear * 5) / 100), 0);

                dclYPF = Math.Round(dclYPF + ((dclYArrear * 10) / 100), 0);
            }

            // Fill value
            gRow.Cells[9].Text  = dclYBasic.ToString();
            gRow.Cells[10].Text = dclYHouse.ToString();
            gRow.Cells[12].Text = dclYTransport.ToString();
            gRow.Cells[14].Text = dclYFestival.ToString();
            gRow.Cells[15].Text = dclYOverTime.ToString(); //Convert.ToString(dclYOther + dclYChgAllow + dclYPerfAllow + dclYArrear);
            gRow.Cells[18].Text = dclYPF.ToString();
            gRow.Cells[33].Text = dclYMedical.ToString();

            // T_HA (dclYHAPlc=180000)
            if (dclMonthDurFromJoining == 12)
            {
                if (dclYHouse > dclYHAPlc)
                {
                    gRow.Cells[11].Text = Convert.ToString(dclYHouse - dclYHAPlc);
                }
                else
                {
                    gRow.Cells[11].Text = "0";
                }
            }
            else
            {
                // If Join Date is From August Onward then Yearly Rebate = No of Month From Join * 15000
                // dclMHAPlc=15000
                dclYHRebate = dclMonthDurFromJoining * dclMHAPlc;
                if (dclYHouse > dclYHRebate)
                {
                    gRow.Cells[11].Text = Convert.ToString(dclYHouse - dclYHRebate);
                }
                else
                {
                    gRow.Cells[11].Text = "0";
                }
            }

            // T_TA (dclYTAPlc=24000)
            if (dclYTransport > dclYTAPlc)
            {
                gRow.Cells[13].Text = Convert.ToString(dclYTransport - dclYTAPlc);
            }
            else
            {
                gRow.Cells[13].Text = "0";
            }

            // T_MA (dclYMAPlc=120000) Medical Tax Exemption
            if (dclMonthDurFromJoining == 12)
            {
                if (dclYMedical > dclYMAPlc)
                {
                    gRow.Cells[34].Text = Convert.ToString(dclYMedical - dclYMAPlc);
                }
                else
                {
                    gRow.Cells[34].Text = "0";
                }
            }
            // TTI_1
            gRow.Cells[16].Text = Convert.ToString(Math.Round(dclYBasic + Common.RoundDecimal(gRow.Cells[11].Text, 0) + Common.RoundDecimal(gRow.Cells[13].Text, 0) +
                                                              Common.RoundDecimal(gRow.Cells[34].Text, 0) + dclYFestival + dclYField + dclYOther, 0));


            // TTI_2
            gRow.Cells[19].Text = Convert.ToString(Common.RoundDecimal(gRow.Cells[16].Text, 0) + dclYPF);

            // Rebate dclInvAllowPlc=30%; dclInvRebatePlc=15%
            dclRebate           = (Common.RoundDecimal(gRow.Cells[19].Text, 0) - dclYPF) * dclInvAllowPlc / 100;
            dclRebate           = dclRebate * dclInvRebatePlc / 100;
            gRow.Cells[17].Text = Common.RoundDecimal(dclRebate.ToString(), 0).ToString();

            // Z_M_F (dclSlot0Plc[M]=200000// dclSlot0Plc[F]=225000)
            if (gRow.Cells[6].Text.Trim() == "M")
            {
                if (Common.RoundDecimal(gRow.Cells[19].Text, 0) > dclSlot0Plc)
                {
                    gRow.Cells[20].Text = Convert.ToString(Common.RoundDecimal(gRow.Cells[19].Text, 0) - dclSlot0Plc);
                }
                else
                {
                    gRow.Cells[20].Text = "0";
                }
            }
            else if (gRow.Cells[6].Text.Trim() == "F")
            {
                if (Common.RoundDecimal(gRow.Cells[19].Text, 0) > dclSlot0Plc)
                {
                    gRow.Cells[20].Text = Convert.ToString(Common.RoundDecimal(gRow.Cells[19].Text, 0) - dclSlot0Plc);
                }
                else
                {
                    gRow.Cells[20].Text = "0";
                }
            }

            // Income tax Assessment and IT Deposoted Data, Demand, Refund
            decimal[] dclTax = this.GetITAssessAmount(Common.RoundDecimal(gRow.Cells[20].Text, 0),
                                                      Common.RoundDecimal(gRow.Cells[17].Text, 0),
                                                      dclSlot10Plc,
                                                      dclSlot15Plc,
                                                      dclSlot20Plc,
                                                      dclSlot25Plc,
                                                      dclMinTaxPlc);

            gRow.Cells[21].Text = Common.RoundDecimal(dclTax[0].ToString(), 0).ToString();
            gRow.Cells[22].Text = Common.RoundDecimal(dclTax[1].ToString(), 0).ToString();
            gRow.Cells[23].Text = Common.RoundDecimal(dclTax[2].ToString(), 0).ToString();
            gRow.Cells[24].Text = Common.RoundDecimal(dclTax[3].ToString(), 0).ToString();
            gRow.Cells[25].Text = Common.RoundDecimal(dclTax[4].ToString(), 0).ToString();

            //G-Tax
            gRow.Cells[26].Text = Common.RoundDecimal(dclTax[5].ToString(), 0).ToString();

            //Net Tax
            gRow.Cells[27].Text = Common.RoundDecimal(dclTax[6].ToString(), 0).ToString();

            // Last Year Refund and New Year Monthly Tax
            decimal dclMonthlyTax = 0;
            decimal dclActTax     = 0;
            int     inMon         = Convert.ToInt32(ddlMonth.SelectedValue.Trim());
            inMon = Common.GetMonthDiffTillJune(ddlMonth.SelectedValue.Trim());

            if (foundLastYrRow.Length > 0)
            {
                gRow.Cells[28].Text = Common.ReturnZeroForNull(foundLastYrRow[0]["REFUNDAMT"].ToString().Trim());
            }
            else
            {
                gRow.Cells[28].Text = "0";
            }

            dclActTax = Common.RoundDecimal(gRow.Cells[27].Text, 0) - Common.RoundDecimal(gRow.Cells[28].Text, 0);

            // IT Deposoted Data, Demand, Refund
            if (foundDepoRows.Length > 0)
            {
                dclITDepo = Common.RoundDecimal(foundDepoRows[0]["PAYAMT"].ToString().Trim(), 0);
                //dclTaxDiff = Common.RoundDecimal(gRow.Cells[28].Text, 0) - dclITDepo;
                dclTaxDiff = dclActTax - dclITDepo;
                if (dclTaxDiff > 0)
                {
                    dclDemand = dclTaxDiff;
                }
                else if (dclTaxDiff < 0)
                {
                    dclRefund = dclTaxDiff;
                }

                gRow.Cells[30].Text = dclITDepo.ToString();
                gRow.Cells[31].Text = dclDemand.ToString();
                gRow.Cells[32].Text = dclRefund.ToString();
            }

            if (ddlMonth.SelectedValue.Trim() != "6")
            {
                if (ddlMonth.SelectedValue.Trim() == "7")
                {
                    inMon = inMon + 1;
                }
                dclMonthlyTax = (dclActTax - dclITDepo) / inMon;
                dclMonthlyTax = Math.Round(dclMonthlyTax, 0);
                if (dclMonthlyTax > 0)
                {
                    gRow.Cells[29].Text = dclMonthlyTax.ToString();
                }
                else
                {
                    gRow.Cells[29].Text = "0";
                }
            }
            else
            {
                dclActTax           = Common.RoundDecimal(gRow.Cells[26].Text, 0);
                gRow.Cells[29].Text = "0";
            }

            // Clear
            foundSalRows  = null;
            foundDepoRows = null;

            // Date Format
            if (Common.CheckNullString(gRow.Cells[7].Text) != "")
            {
                gRow.Cells[7].Text = Common.DisplayDate(gRow.Cells[7].Text.Trim());
            }

            if (Common.CheckNullString(gRow.Cells[8].Text) != "")
            {
                gRow.Cells[8].Text = Common.DisplayDate(gRow.Cells[8].Text.Trim());
            }

            i++;
        }
    }