/// <summary>
        /// Get the data from data base
        /// </summary>
        private void LoadData()
        {
            CompensationFinancialBO oCompensationFinancial = new CompensationFinancialBO();

            //oCompensationFinancial.Cmp_FinancialID = "";
            oCompensationFinancial.HHID = Convert.ToInt32(Session["HH_ID"]);
            CompensationFinancialBLL oCompensationFinancialBLL = new CompensationFinancialBLL();

            oCompensationFinancial = oCompensationFinancialBLL.GetCompensationFinancial(Convert.ToInt32(Session["HH_ID"]));

            if (oCompensationFinancial != null)
            {
                //LAND SECTION
                #region Land Section
                txtLandValuation.Text = UtilBO.CurrencyFormat(oCompensationFinancial.LandValuation);//oCompensationFinancial.LandValuation.ToString();
                if (oCompensationFinancial.LandDA > 0)
                {
                    txtLandDAinPercentage.Text = oCompensationFinancial.LandDA.ToString();
                }
                txtAcreageDifferencePayment.Text = UtilBO.CurrencyFormat(oCompensationFinancial.LandDiffPayment); //oCompensationFinancial.LandDiffPayment.ToString();

                //if (!string.IsNullOrEmpty(txtLandValuation.Text) && !string.IsNullOrEmpty(txtLandDAinAmount.Text))
                //    oCompensationFinancial.LandTotalValuation = Convert.ToDecimal(txtLandValuation.Text.Trim()) + Convert.ToDecimal(txtLandDAinAmount.Text.Trim());

                txtLandTotal.Text      = UtilBO.CurrencyFormat(oCompensationFinancial.LandTotalValuation);                                        //oCompensationFinancial.LandTotalValuation.ToString();
                txtLandDAinAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.LandTotalValuation - oCompensationFinancial.LandValuation); //(oCompensationFinancial.LandTotalValuation - oCompensationFinancial.LandValuation).ToString();
                txtLandComments.Text   = oCompensationFinancial.LandValComments;
                #endregion

                //RESIDENTIAL STRUCTURE
                #region Residencial Structure
                txtRSDepreciatedValue.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResDepreciatedValue); //oCompensationFinancial.ResDepreciatedValue.ToString();
                txtRSReplacementValue.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResReplacementValue); //oCompensationFinancial.ResReplacementValue.ToString();
                if (oCompensationFinancial.ResDA > 0)
                {
                    txtRSDAinPercentage.Text = oCompensationFinancial.ResDA.ToString();
                }

                txtRSMovingAllowance.Text       = UtilBO.CurrencyFormat(oCompensationFinancial.ResMovingAllowance); //oCompensationFinancial.ResMovingAllowance.ToString();
                txtRSLabourCost.Text            = UtilBO.CurrencyFormat(oCompensationFinancial.ResLabourCost);      //oCompensationFinancial.ResLabourCost.ToString();
                txtRSPaymentHighHouseValue.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResPayment);         //oCompensationFinancial.ResPayment.ToString();

                //if (!string.IsNullOrEmpty(txtRSReplacementValue.Text) && !string.IsNullOrEmpty(txtResidentialDAinAmount.Text))//Calculated mannually
                //    oCompensationFinancial.ResTotalValuation = Convert.ToDecimal(txtRSReplacementValue.Text.Trim()) + Convert.ToDecimal(txtResidentialDAinAmount.Text.Trim());

                //txtResidentialDAinAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResTotalValuation - oCompensationFinancial.ResReplacementValue); //(oCompensationFinancial.ResTotalValuation - oCompensationFinancial.ResReplacementValue).ToString();

                txtResidentialStructureComments.Text = oCompensationFinancial.ResComments;
                #endregion

                //FIXTURES
                #region Fixture Section

                txtFixturesValuation.Text = UtilBO.CurrencyFormat(oCompensationFinancial.FixtureValuation); //oCompensationFinancial.FixtureValuation.ToString();
                if (oCompensationFinancial.FixtureDA > 0)
                {
                    txtFixturesDAinPercentage.Text = oCompensationFinancial.FixtureDA.ToString();
                }

                //if (!string.IsNullOrEmpty(txtFixturesDAinAmount.Text) && !string.IsNullOrEmpty(txtFixturesValuation.Text))
                //    oCompensationFinancial.FixtureTotalValuation = Convert.ToDecimal(txtFixturesDAinAmount.Text.Trim()) + Convert.ToDecimal(txtFixturesValuation.Text.Trim());

                txtFixturesDAinAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.FixtureTotalValuation - oCompensationFinancial.FixtureValuation); //(oCompensationFinancial.FixtureTotalValuation - oCompensationFinancial.FixtureValuation).ToString();

                txtRSDepreciatedValue.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResDepreciatedValue);                                             //oCompensationFinancial.ResDepreciatedValue.ToString();
                txtFixturesComments.Text   = oCompensationFinancial.FixtureComments;
                #endregion

                //CROPS
                #region Crops Section
                txtCropsValuation.Text = UtilBO.CurrencyFormat(oCompensationFinancial.CropValuation); //oCompensationFinancial.CropValuation.ToString();

                //CheckBox

                if (oCompensationFinancial.CropMaxCapCase != null)
                {
                    if (oCompensationFinancial.CropMaxCapCase.ToUpper() == "YES")
                    {
                        chkMaxCapCase.Checked = true;
                    }
                    else
                    {
                        chkMaxCapCase.Checked = false;
                    }
                }
                else
                {
                    chkMaxCapCase.Checked = false;
                }

                txtValuationAfterMaxCap.Text = UtilBO.CurrencyFormat(oCompensationFinancial.CropValAftMaxCap); //oCompensationFinancial.CropValAftMaxCap.ToString();

                if (oCompensationFinancial.CropDA > 0)
                {
                    txtCropsDAinPercentage.Text = oCompensationFinancial.CropDA.ToString();
                }

                //if (!string.IsNullOrEmpty(txtCropsValuation.Text) && !string.IsNullOrEmpty(txtCropsDAinAmount.Text))
                //    oCompensationFinancial.CropTotalValuation = Convert.ToDecimal(txtCropsValuation.Text.Trim()) + Convert.ToDecimal(txtCropsDAinAmount.Text.Trim());

                if (oCompensationFinancial.CropMaxCapCase.ToUpper() == "YES")
                {
                    if (!string.IsNullOrEmpty(txtValuationAfterMaxCap.Text) && !string.IsNullOrEmpty(txtCropsDAinAmount.Text))
                    {
                        oCompensationFinancial.CropTotalValuation = Convert.ToDecimal(txtValuationAfterMaxCap.Text.Trim()) + Convert.ToDecimal(txtCropsDAinAmount.Text.Trim());
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(txtCropsValuation.Text) && !string.IsNullOrEmpty(txtCropsDAinAmount.Text))
                    {
                        oCompensationFinancial.CropTotalValuation = Convert.ToDecimal(txtCropsValuation.Text.Trim()) + Convert.ToDecimal(txtCropsDAinAmount.Text.Trim());
                    }
                }

                txtCropsDAinAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.CropTotalValuation - oCompensationFinancial.CropValuation); //(oCompensationFinancial.CropTotalValuation - oCompensationFinancial.CropValuation).ToString();

                txtCropsComments.Text = oCompensationFinancial.CropComments;

                #endregion

                //OTHERS
                #region Others
                txtCompensationForCultureProperty.Text = UtilBO.CurrencyFormat(oCompensationFinancial.CulturePropValuation); //oCompensationFinancial.CulturePropValuation.ToString();

                txtOtherDamagedCrops.Text = UtilBO.CurrencyFormat(oCompensationFinancial.DamagedCropValuation);              //oCompensationFinancial.DamagedCropValuation.ToString();

                //if (!string.IsNullOrEmpty(txtCulturePropertyValue.Text) && !string.IsNullOrEmpty(txtOtherDamagedCrops.Text))
                //    oCompensationFinancial.TotalOtherValuation = Convert.ToDecimal(txtCulturePropertyValue.Text.Trim()) + Convert.ToDecimal(txtOtherDamagedCrops.Text.Trim());
                txtOthersTotal.Text = UtilBO.CurrencyFormat(oCompensationFinancial.CulturePropValuation + oCompensationFinancial.DamagedCropValuation); //(oCompensationFinancial.CulturePropValuation + oCompensationFinancial.DamagedCropValuation).ToString();
                #endregion

                //SUMMERY
                #region Summery Section
                txtNegotiatedAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.NegotiatedAmount);

                decimal RDAllowance          = (oCompensationFinancial.ResDepreciatedValue * oCompensationFinancial.FixtureDA) / 100;
                decimal SummeryFixturesValue = (((oCompensationFinancial.FixtureValuation * oCompensationFinancial.FixtureDA) / 100) + oCompensationFinancial.FixtureValuation);
                txtSummeryFixturesValue.Text = UtilBO.CurrencyFormat(SummeryFixturesValue); //SummeryFixturesValue.ToString();
                decimal DamagedCropsValue = (((oCompensationFinancial.CropValuation * oCompensationFinancial.CropDA) / 100) + oCompensationFinancial.CropValuation);
                txtDamagedCropsValue.Text    = UtilBO.CurrencyFormat(DamagedCropsValue);    // DamagedCropsValue.ToString();
                txtDamagedCropsValue.Text    = txtOtherDamagedCrops.Text;
                txtCulturePropertyValue.Text = txtCompensationForCultureProperty.Text;
                txtInKindLand.Text           = oCompensationFinancial.LandInKindCompensation.ToString().Trim();

                ddlResidentialStructure.ClearSelection();
                if (string.IsNullOrEmpty(oCompensationFinancial.ResInKindCompensation))
                {
                    ddlResidentialStructure.SelectedValue = "0";
                }
                else
                {
                    ddlResidentialStructure.SelectedValue = oCompensationFinancial.ResInKindCompensation.ToString();
                }

                txtFacilitationallowances.Text = UtilBO.CurrencyFormat(oCompensationFinancial.FacilitationAllowance);
                //if (!string.IsNullOrEmpty(txtRSDepreciatedValue.Text))
                //    oCompensationFinancial.ResDepreciatedValue = Convert.ToDecimal(txtRSDepreciatedValue.Text.Trim());
                #endregion

                //PACKAGE DELIVERY INFO
                #region Package Delivery Section
                CompensationFinancialBO ooCompensationFinancial = new CompensationFinancialBO();
                ooCompensationFinancial = oCompensationFinancialBLL.getPackageDeliveryInfo(SessionHHID);

                if (ooCompensationFinancial != null)
                {
                    if (ooCompensationFinancial.DeliveryDate != DateTime.MinValue)
                    {
                        dpDeliveryDate.Text = ooCompensationFinancial.DeliveryDate.ToString(UtilBO.DateFormat);
                    }
                    else
                    {
                        dpDeliveryDate.Text = "";
                    }

                    if (ooCompensationFinancial.PAPAction == "Y")
                    {
                        rdoActionAccepted.Checked = true;
                    }
                    else if (ooCompensationFinancial.PAPAction == "N")
                    {
                        rdoActionRejected.Checked = true;
                    }

                    ddlDeliveredBy.SelectedValue        = ooCompensationFinancial.DeliveredBy.ToString();
                    txtPackageDeliveryInfoComments.Text = ooCompensationFinancial.DeliveryComments;
                }
                #endregion Package Delivery Section

                hdnDoCalc.Value = "1";

                btnSave.Text = "Update";
            }
            else
            {
                FinalValuationBLL oFinalValuationBLL = new FinalValuationBLL();
                FinalValuationBO  oFinalValuationBO  = new FinalValuationBO();

                if (SessionHHID > 0)
                {
                    oFinalValuationBO = oFinalValuationBLL.getFinalValuatin(SessionHHID);

                    if (oFinalValuationBO != null)
                    {
                        txtLandValuation.Text         = UtilBO.CurrencyFormat(oFinalValuationBO.LandValue);                                              //oFinalValuationBO.LandValue.ToString();
                        txtCropsValuation.Text        = UtilBO.CurrencyFormat(oFinalValuationBO.CropValue);                                              //oFinalValuationBO.CropValue.ToString();
                        txtFixturesValuation.Text     = UtilBO.CurrencyFormat(oFinalValuationBO.FixtureValue);                                           //oFinalValuationBO.FixtureValue.ToString();
                        txtHouseValues.Text           = UtilBO.CurrencyFormat(oFinalValuationBO.HouseValue);                                             //oFinalValuationBO.HouseValue.ToString();
                        txtReplacementHouseValue.Text = UtilBO.CurrencyFormat(oFinalValuationBO.ReplacementValue);                                       //oFinalValuationBO.ReplacementValue.ToString();

                        txtCompensationForCultureProperty.Text = UtilBO.CurrencyFormat(oFinalValuationBO.CulturalpropertyValue);                         //oFinalValuationBO.CulturalpropertyValue.ToString();
                        txtOtherDamagedCrops.Text = UtilBO.CurrencyFormat(oFinalValuationBO.DamagedcropValue);                                           // oFinalValuationBO.DamagedcropValue.ToString();
                        txtOthersTotal.Text       = UtilBO.CurrencyFormat(oFinalValuationBO.CulturalpropertyValue + oFinalValuationBO.DamagedcropValue); //(oFinalValuationBO.CulturalpropertyValue + oFinalValuationBO.DamagedcropValue).ToString();

                        txtDamagedCropsValue.Text    = UtilBO.CurrencyFormat(oFinalValuationBO.DamagedcropValue);                                        //oFinalValuationBO.DamagedcropValue.ToString();
                        txtCulturePropertyValue.Text = UtilBO.CurrencyFormat(oFinalValuationBO.CulturalpropertyValue);                                   //oFinalValuationBO.CulturalpropertyValue.ToString();

                        txtRSDepreciatedValue.Text = UtilBO.CurrencyFormat(oFinalValuationBO.HouseValue);                                                //oFinalValuationBO.HouseValue.ToString();
                        txtRSReplacementValue.Text = UtilBO.CurrencyFormat(oFinalValuationBO.ReplacementValue);                                          //oFinalValuationBO.ReplacementValue.ToString();
                        txtNegotiatedAmount.Text   = UtilBO.CurrencyFormat(oFinalValuationBO.NegotiatedAmount);                                          //oFinalValuationBO.NegotiatedAmount.ToString();
                        txtRSLabourCost.Text       = UtilBO.CurrencyFormat(oFinalValuationBO.ResLabourCost);
                        //txtFacilitationallowances.Text = "0";
                        txtFacilitationallowances.Text = UtilBO.CurrencyFormat(oFinalValuationBO.GOUAllowance);

                        if (oFinalValuationBO.Crop_Max_Cap_Case.ToLower() == "yes")
                        {
                            chkMaxCapCase.Checked = true;
                        }
                        else
                        {
                            chkMaxCapCase.Checked = false;
                        }
                        txtValuationAfterMaxCap.Text = UtilBO.CurrencyFormat(oFinalValuationBO.Crop_Val_Aft_Max_Cap);

                        hdnDoCalc.Value = "1";

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "CalTotal", "CalcLandTotal();CalcResidenitalTotal();CalcFixtureTotal();CalcCropTotal();CalcOtherTotal();FindTotalAmount();", true);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Load Summery Details
        /// </summary>
        private void LoadSummery()
        {
            CompensationFinancialBLL oCompensationFinancialBLL = new CompensationFinancialBLL();
            CompensationFinancialBO  oCompensationFinancial    = oCompensationFinancialBLL.GetCompensationFinancial(Convert.ToInt32(Session["HH_ID"]));

            // Replaced on 08jan2013 ResPayment as ResTotalValuation
            if (oCompensationFinancial != null)
            {
                txtLandValuation.Text     = UtilBO.CurrencyFormat(oCompensationFinancial.LandTotalValuation);       //oCompensationFinancial.LandTotalValuation.ToString();
                txtFixturesValuation.Text = UtilBO.CurrencyFormat(oCompensationFinancial.FixtureTotalValuation);    //oCompensationFinancial.FixtureTotalValuation.ToString();
                txtCropsValuation.Text    = UtilBO.CurrencyFormat(oCompensationFinancial.CropTotalValuation);       //oCompensationFinancial.CropTotalValuation.ToString();
                //decimal ReplacementHouseValue = oCompensationFinancial.ResReplacementValue + (oCompensationFinancial.ResReplacementValue * oCompensationFinancial.ResDA) / 100;
                txtReplacementHouseValue.Text = UtilBO.CurrencyFormat(oCompensationFinancial.ResPayment);           //UtilBO.CurrencyFormat(oCompensationFinancial.ResTotalValuation);ResPayment //oCompensationFinancial.ResTotalValuation.ToString();//ReplacementHouseValue.ToString();
                txtDamagedCropValue.Text      = UtilBO.CurrencyFormat(oCompensationFinancial.DamagedCropValuation); //oCompensationFinancial.DamagedCropValuation.ToString();
                txtCultureProperty.Text       = UtilBO.CurrencyFormat(oCompensationFinancial.CulturePropValuation); //oCompensationFinancial.DamagedCropValuation.ToString();
                txtFacilitation.Text          = UtilBO.CurrencyFormat(oCompensationFinancial.FacilitationAllowance);
                txtFinalCompensation.Text     = UtilBO.CurrencyFormat(oCompensationFinancial.LandTotalValuation + oCompensationFinancial.FixtureTotalValuation +
                                                                      oCompensationFinancial.CropTotalValuation + oCompensationFinancial.ResPayment +
                                                                      oCompensationFinancial.DamagedCropValuation + oCompensationFinancial.CulturePropValuation + oCompensationFinancial.FacilitationAllowance); //oCompensationFinancial.TotalValuation.ToString();
                txtNegotiatedAmount.Text = UtilBO.CurrencyFormat(oCompensationFinancial.NegotiatedAmount);                                                                                                       //oCompensationFinancial.NegotiatedAmount.ToString();//Newly Added
                txtInKindLand.Text       = oCompensationFinancial.LandInKindCompensation.ToString().Trim();

                ddlResidentialStructure.ClearSelection();
                if (string.IsNullOrEmpty(oCompensationFinancial.ResInKindCompensation))
                {
                    ddlResidentialStructure.ClearSelection();
                }
                else
                {
                    if (ddlResidentialStructure.Items.FindByValue(oCompensationFinancial.ResInKindCompensation.ToString()) != null)
                    {
                        ddlResidentialStructure.ClearSelection();
                        ddlResidentialStructure.Items.FindByValue(oCompensationFinancial.ResInKindCompensation.ToString()).Selected = true;
                    }
                }
                txtResidentialStructure.Text = "";
                if (ddlResidentialStructure.SelectedIndex > 0)
                {
                    txtResidentialStructure.Text = ddlResidentialStructure.SelectedItem.Text;
                }
                //Displaying LABEL APPROVAL STATUS
                //--------------------------------------------LAND STATUS-----------------------------------------------------
                if (oCompensationFinancial.Land_Approval_Status != null && oCompensationFinancial.Land_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblLandValuationMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Land_Approval_Status + "</font>";
                }
                else
                {
                    lblLandValuationMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Land_Approval_Status + "</font>";
                }
                //--------------------------------------------FIXTURE STATUS-----------------------------------------------------
                if (oCompensationFinancial.Fixture_Approval_Status != null && oCompensationFinancial.Fixture_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblFixturesValuationMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Fixture_Approval_Status + "</font>";
                }
                else
                {
                    lblFixturesValuationMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Fixture_Approval_Status + "</font>";
                }
                //--------------------------------------------CROP STATUS-----------------------------------------------------
                if (oCompensationFinancial.Crop_Approval_Status != null && oCompensationFinancial.Crop_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblCropsValuationMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Crop_Approval_Status + "</font>";
                }
                else
                {
                    lblCropsValuationMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Crop_Approval_Status + "</font>";
                }
                //--------------------------------------------REPLACEMENT STATUS-----------------------------------------------------
                if (oCompensationFinancial.Replacment_Approval_Status != null && oCompensationFinancial.Replacment_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblReplacementHouseValueMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Replacment_Approval_Status + "</font>";
                }
                else
                {
                    lblReplacementHouseValueMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Replacment_Approval_Status + "</font>";
                }
                //--------------------------------------------DAMAGED STATUS-----------------------------------------------------
                if (oCompensationFinancial.Damaged_Approval_Status != null && oCompensationFinancial.Damaged_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblDamagedCropValueMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Damaged_Approval_Status + "</font>";
                }
                else
                {
                    lblDamagedCropValueMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Damaged_Approval_Status + "</font>";
                }
                //--------------------------------------------CULTURE PROPERTIES STATUS-----------------------------------------------------
                if (oCompensationFinancial.Culture_Approval_Status != null && oCompensationFinancial.Culture_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblCulturePropertyMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Culture_Approval_Status + "</font>";
                }
                else
                {
                    lblCulturePropertyMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Culture_Approval_Status + "</font>";
                }
                //--------------------------------------------FACILITATION PROPERTIES STATUS-----------------------------------------------------
                if (oCompensationFinancial.Facilitation_Approval_Status != null && oCompensationFinancial.Facilitation_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblFacilitationMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Facilitation_Approval_Status + "</font>";
                }
                else
                {
                    lblFacilitationMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Facilitation_Approval_Status + "</font>";
                }
                //--------------------------------------------FINAL STATUS-----------------------------------------------------
                if (oCompensationFinancial.Final_Approval_Status != null && oCompensationFinancial.Final_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblFinalCompensationMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Final_Approval_Status + "</font>";
                }
                else
                {
                    lblFinalCompensationMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Final_Approval_Status + "</font>";
                }
                //--------------------------------------------NEGOTIATED STATUS-----------------------------------------------------
                if (oCompensationFinancial.Nego_Amount_Approval_Status != null && oCompensationFinancial.Nego_Amount_Approval_Status.ToUpper() == "APPROVED")
                {
                    lblNegotiatedAmountMsg.Text = "<font class='StatusApproved'>" + oCompensationFinancial.Nego_Amount_Approval_Status + "</font>";
                }
                else
                {
                    lblNegotiatedAmountMsg.Text = "<font class='StatusPending'>" + oCompensationFinancial.Nego_Amount_Approval_Status + "</font>";
                }

                //Disabling Checkbox For Approved & Request Pending & Submitted
                string LAS = oCompensationFinancial.Land_Approval_Status;
                string FAS = oCompensationFinancial.Fixture_Approval_Status;
                string CAL = oCompensationFinancial.Crop_Approval_Status;

                string RAL = oCompensationFinancial.Replacment_Approval_Status;
                string DAL = oCompensationFinancial.Damaged_Approval_Status;
                string CPAL = oCompensationFinancial.Culture_Approval_Status;
                string OPAL = oCompensationFinancial.Facilitation_Approval_Status;
                string FCAL = oCompensationFinancial.Final_Approval_Status;
                string NAAS = oCompensationFinancial.Nego_Amount_Approval_Status;
                int    statusCount = 0;
                int    chkcount = 7;
                int    cl = 1, cf = 1, cc = 1, cd = 1, cr = 1, cneg = 0, ccu = 1, co = 1;
                // start
                if ((txtLandValuation.Text.Trim() == "" || oCompensationFinancial.LandTotalValuation == 0) &&
                    (txtInKindLand.Text.Trim() == "" || oCompensationFinancial.LandInKindCompensation == 0))
                {
                    chkLandValuation.Style.Add("display", "none");
                    chkcount--;
                    cl = 0;
                }

                if (txtFixturesValuation.Text.Trim() == "" || oCompensationFinancial.FixtureTotalValuation == 0)
                {
                    chkFixtureValuation.Style.Add("display", "none");
                    chkcount--;
                    cf = 0;
                }

                if (txtCropsValuation.Text.Trim() == "" || oCompensationFinancial.CropTotalValuation == 0)
                {
                    chkCropsValuation.Style.Add("display", "none");
                    chkcount--;
                    cc = 0;
                }

                if ((txtReplacementHouseValue.Text.Trim() == "" || oCompensationFinancial.ResPayment == 0) && (txtResidentialStructure.Text.Trim() == "" || txtResidentialStructure.Text.Trim().ToUpper() == "NA"))
                {
                    chkReplacementHouseValue.Style.Add("display", "none");
                    chkcount--;
                    cr = 0;
                }

                if (txtDamagedCropValue.Text.Trim() == "" || oCompensationFinancial.DamagedCropValuation == 0)
                {
                    chkDamagedCropValue.Style.Add("display", "none");
                    chkcount--;
                    cd = 0;
                }

                if (txtCultureProperty.Text.Trim() == "" || oCompensationFinancial.CulturePropValuation == 0)
                {
                    chkCulturePropertyValue.Style.Add("display", "none");
                    chkcount--;
                    ccu = 0;
                }

                if (txtFacilitation.Text.Trim() == "" || oCompensationFinancial.FacilitationAllowance == 0)
                {
                    chkFacilitationValue.Style.Add("display", "none");
                    chkcount--;
                    co = 0;
                }

                if ((cl + cf + cc + cd + cr + ccu + co) <= 0)
                {
                    ChkAll.Style.Add("display", "none");
                }
                chkcount = 7;
                //if (txtFinalCompensation.Text.Trim() == "" || oCompensationFinancial.TotalValuation == 0)
                //    chkFinalCompensation.Style.Add("display", "none");

                if (txtNegotiatedAmount.Text.Trim() == "" || oCompensationFinancial.NegotiatedAmount == 0)
                {
                    chkNegotiatedAmount.Style.Add("display", "none");
                }
                else
                {
                    cneg++;
                    chkLandValuation.Style.Add("display", "none");
                    chkFixtureValuation.Style.Add("display", "none");
                    chkCropsValuation.Style.Add("display", "none");
                    chkReplacementHouseValue.Style.Add("display", "none");
                    chkDamagedCropValue.Style.Add("display", "none");
                    chkCulturePropertyValue.Style.Add("display", "none");
                    chkFacilitationValue.Style.Add("display", "none");
                    ChkAll.Style.Add("display", "none");
                }
                //end

                if ((!string.IsNullOrEmpty(LAS) && LAS.Length > 3) && (LAS.Substring(0, 3).ToUpper() == "APP" || LAS.Substring(0, 3).ToUpper() == "SUB" || LAS.Substring(0, 3).ToUpper() == "REQ"))//LAS.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkLandValuation.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    cl = 0;
                }

                if ((!string.IsNullOrEmpty(FAS) && FAS.Length > 3) && (FAS.Substring(0, 3).ToUpper() == "APP" || FAS.Substring(0, 3).ToUpper() == "SUB" || FAS.Substring(0, 3).ToUpper() == "REQ"))//FAS.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkFixtureValuation.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    cf = 0;
                }

                if ((!string.IsNullOrEmpty(CAL) && CAL.Length > 3) && (CAL.Substring(0, 3).ToUpper() == "APP" || CAL.Substring(0, 3).ToUpper() == "SUB" || CAL.Substring(0, 3).ToUpper() == "REQ"))//CAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkCropsValuation.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    cc = 0;
                }

                if ((!string.IsNullOrEmpty(RAL) && RAL.Length > 3) && (RAL.Substring(0, 3).ToUpper() == "APP" || RAL.Substring(0, 3).ToUpper() == "SUB" || RAL.Substring(0, 3).ToUpper() == "REQ"))//RAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkReplacementHouseValue.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    cr = 0;
                }

                if ((!string.IsNullOrEmpty(DAL) && DAL.Length > 3) && (DAL.Substring(0, 3).ToUpper() == "APP" || DAL.Substring(0, 3).ToUpper() == "SUB" || DAL.Substring(0, 3).ToUpper() == "REQ"))//DAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkDamagedCropValue.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    cd = 0;
                }

                if ((!string.IsNullOrEmpty(CPAL) && CPAL.Length > 3) && (CPAL.Substring(0, 3).ToUpper() == "APP" || CPAL.Substring(0, 3).ToUpper() == "SUB" || CPAL.Substring(0, 3).ToUpper() == "REQ"))//CPAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkCulturePropertyValue.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    ccu = 0;
                }

                if ((!string.IsNullOrEmpty(OPAL) && OPAL.Length > 3) && (OPAL.Substring(0, 3).ToUpper() == "APP" || OPAL.Substring(0, 3).ToUpper() == "SUB" || OPAL.Substring(0, 3).ToUpper() == "REQ"))//CPAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    chkFacilitationValue.Style.Add("display", "none");
                    statusCount++;
                    chkcount--;
                    co = 0;
                }

                if ((cl + cf + cc + cd + cr + ccu + co) <= 0)
                {
                    ChkAll.Style.Add("display", "none");
                    pnlPaymentRequest.Visible = false;
                }

                if ((!string.IsNullOrEmpty(FCAL) && FCAL.Length > 3) && (FCAL.Substring(0, 3).ToUpper() == "APP" || FCAL.Substring(0, 3).ToUpper() == "SUB" || FCAL.Substring(0, 3).ToUpper() == "REQ"))//FCAL.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    DisableAllCheckBox();
                }

                if ((!string.IsNullOrEmpty(NAAS) && NAAS.Length > 3) && (NAAS.Substring(0, 3).ToUpper() == "APP" || NAAS.Substring(0, 3).ToUpper() == "SUB" || NAAS.Substring(0, 3).ToUpper() == "REQ"))//NAAS.Substring(0, 3).ToUpper() == "DEC" ||
                {
                    DisableAllCheckBox();
                }
                if (statusCount > 0)
                {
                    //chkFinalCompensation.Style.Add("display", "none");
                    chkNegotiatedAmount.Style.Add("display", "none");
                    cneg = 0;
                }
                if (cneg > 0)
                {
                    pnlPaymentRequest.Visible = true;
                }
                GetPAPValuationSummery_NegotiatedAmount((oCompensationFinancial.LandTotalValuation + oCompensationFinancial.FixtureTotalValuation +
                                                         oCompensationFinancial.CropTotalValuation + oCompensationFinancial.ResPayment +
                                                         oCompensationFinancial.DamagedCropValuation + oCompensationFinancial.CulturePropValuation + oCompensationFinancial.FacilitationAllowance), oCompensationFinancial.NegotiatedAmount);

                if ((!string.IsNullOrEmpty(LAS) && LAS.Length > 3) && (LAS.Substring(0, 3).ToUpper() == "SUB" || LAS.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(FAS) && FAS.Length > 3) && (FAS.Substring(0, 3).ToUpper() == "SUB" || FAS.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(CAL) && CAL.Length > 3) && (CAL.Substring(0, 3).ToUpper() == "SUB" || CAL.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(RAL) && RAL.Length > 3) && (RAL.Substring(0, 3).ToUpper() == "SUB" || RAL.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(DAL) && DAL.Length > 3) && (DAL.Substring(0, 3).ToUpper() == "SUB" || DAL.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(CPAL) && CPAL.Length > 3) && (CPAL.Substring(0, 3).ToUpper() == "SUB" || CPAL.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(OPAL) && OPAL.Length > 3) && (OPAL.Substring(0, 3).ToUpper() == "SUB" || OPAL.Substring(0, 3).ToUpper() == "REQ") ||
                    (!string.IsNullOrEmpty(NAAS) && NAAS.Length > 3) && (NAAS.Substring(0, 3).ToUpper() == "SUB" || NAAS.Substring(0, 3).ToUpper() == "REQ"))
                {
                    ViewState["Valuation_Status"] = "Request Pending";
                }
                else
                {
                    ViewState["Valuation_Status"] = "None";
                }
            }
            else
            {
                DisableAllCheckBox();
            }
        }
        /// <summary>
        /// to Add data to Datat base
        /// </summary>
        /// <returns></returns>
        private string AddData()
        {
            oCompensationFinancial = new WIS_BusinessObjects.CompensationFinancialBO();
            string strMax = string.Empty;

            //oCompensationFinancial.Cmp_FinancialID = "";
            if (Session["HH_ID"] != null)
            {
                oCompensationFinancial.HHID = Convert.ToInt32(Session["HH_ID"]);
            }
            oCompensationFinancialBLL = new CompensationFinancialBLL();

            oCompensationFinancial.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
            oCompensationFinancial.IsDeleted = "False";
            //LAND SECTION
            #region Land Section
            if (!string.IsNullOrEmpty(txtLandValuation.Text))
            {
                oCompensationFinancial.LandValuation = Convert.ToDecimal(txtLandValuation.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtLandDAinPercentage.Text))
            {
                oCompensationFinancial.LandDA = Convert.ToDecimal(txtLandDAinPercentage.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtAcreageDifferencePayment.Text))
            {
                oCompensationFinancial.LandDiffPayment = Convert.ToDecimal(txtAcreageDifferencePayment.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtLandValuation.Text) && !string.IsNullOrEmpty(txtLandDAinAmount.Text))
            {
                oCompensationFinancial.LandTotalValuation = Convert.ToDecimal(txtLandValuation.Text.Trim()) + Convert.ToDecimal(txtLandDAinAmount.Text.Trim());
            }

            strMax = txtLandComments.Text.Trim();
            if (strMax.Trim().Length > 1000)
            {
                strMax = txtLandComments.Text.Trim().Substring(0, 999);
            }

            oCompensationFinancial.LandValComments = strMax;
            #endregion

            //RESIDENTIAL STRUCTURE
            #region Residencial Structure
            if (!string.IsNullOrEmpty(txtRSDepreciatedValue.Text))
            {
                oCompensationFinancial.ResDepreciatedValue = Convert.ToDecimal(txtRSDepreciatedValue.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSReplacementValue.Text))
            {
                oCompensationFinancial.ResReplacementValue = Convert.ToDecimal(txtRSReplacementValue.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSDAinPercentage.Text))
            {
                oCompensationFinancial.ResDA = Convert.ToDecimal(txtRSDAinPercentage.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSMovingAllowance.Text))
            {
                oCompensationFinancial.ResMovingAllowance = Convert.ToDecimal(txtRSMovingAllowance.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSLabourCost.Text))
            {
                oCompensationFinancial.ResLabourCost = Convert.ToDecimal(txtRSLabourCost.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSPaymentHighHouseValue.Text))
            {
                oCompensationFinancial.ResPayment = Convert.ToDecimal(txtRSPaymentHighHouseValue.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSReplacementValue.Text))                                               // && !string.IsNullOrEmpty(txtResidentialDAinAmount.Text))//Calculated mannually
            {
                oCompensationFinancial.ResTotalValuation = Convert.ToDecimal(txtRSReplacementValue.Text.Trim()); // +Convert.ToDecimal(txtResidentialDAinAmount.Text.Trim());
            }
            strMax = txtResidentialStructureComments.Text.Trim();
            if (strMax.Trim().Length >= 1000)
            {
                strMax = txtLandComments.Text.Trim().Substring(0, 999);
            }
            oCompensationFinancial.ResComments = strMax;
            #endregion

            //FIXTURES
            #region Fixture Section
            if (!string.IsNullOrEmpty(txtFixturesValuation.Text))
            {
                oCompensationFinancial.FixtureValuation = Convert.ToDecimal(txtFixturesValuation.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtFixturesDAinPercentage.Text))
            {
                oCompensationFinancial.FixtureDA = Convert.ToDecimal(txtFixturesDAinPercentage.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtFixturesDAinAmount.Text) && !string.IsNullOrEmpty(txtFixturesValuation.Text))
            {
                oCompensationFinancial.FixtureTotalValuation = Convert.ToDecimal(txtFixturesDAinAmount.Text.Trim()) + Convert.ToDecimal(txtFixturesValuation.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtRSDepreciatedValue.Text))
            {
                oCompensationFinancial.ResDepreciatedValue = Convert.ToDecimal(txtRSDepreciatedValue.Text.Trim());
            }

            strMax = txtFixturesComments.Text.Trim();
            if (strMax.Trim().Length >= 1000)
            {
                strMax = txtLandComments.Text.Trim().Substring(0, 999);
            }
            oCompensationFinancial.FixtureComments = strMax;
            #endregion

            //CROPS
            #region Crops Section
            if (!string.IsNullOrEmpty(txtCropsValuation.Text))
            {
                oCompensationFinancial.CropValuation = Convert.ToDecimal(txtCropsValuation.Text.Trim());
            }

            //CheckBox
            if (chkMaxCapCase.Checked)
            {
                oCompensationFinancial.CropMaxCapCase = "Yes";
            }
            else
            {
                oCompensationFinancial.CropMaxCapCase = "No";
            }

            if (!string.IsNullOrEmpty(txtValuationAfterMaxCap.Text))
            {
                oCompensationFinancial.CropValAftMaxCap = Convert.ToDecimal(txtValuationAfterMaxCap.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtCropsDAinPercentage.Text))
            {
                oCompensationFinancial.CropDA = Convert.ToDecimal(txtCropsDAinPercentage.Text.Trim());
            }

            if (chkMaxCapCase.Checked)
            {
                if (!string.IsNullOrEmpty(txtValuationAfterMaxCap.Text) && !string.IsNullOrEmpty(txtCropsDAinAmount.Text))
                {
                    oCompensationFinancial.CropTotalValuation = Convert.ToDecimal(txtValuationAfterMaxCap.Text.Trim()) + Convert.ToDecimal(txtCropsDAinAmount.Text.Trim());
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(txtCropsValuation.Text) && !string.IsNullOrEmpty(txtCropsDAinAmount.Text))
                {
                    oCompensationFinancial.CropTotalValuation = Convert.ToDecimal(txtCropsValuation.Text.Trim()) + Convert.ToDecimal(txtCropsDAinAmount.Text.Trim());
                }
            }
            strMax = txtCropsComments.Text.Trim();
            if (strMax.Trim().Length >= 1000)
            {
                strMax = txtLandComments.Text.Trim().Substring(0, 999);
            }
            oCompensationFinancial.CropComments = strMax;

            #endregion

            //OTHERS
            #region Others
            if (!string.IsNullOrEmpty(txtCulturePropertyValue.Text))
            {
                oCompensationFinancial.CulturePropValuation = Convert.ToDecimal(txtCulturePropertyValue.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtOtherDamagedCrops.Text))
            {
                oCompensationFinancial.DamagedCropValuation = Convert.ToDecimal(txtOtherDamagedCrops.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtCulturePropertyValue.Text) && !string.IsNullOrEmpty(txtOtherDamagedCrops.Text))
            {
                oCompensationFinancial.TotalOtherValuation = Convert.ToDecimal(txtCulturePropertyValue.Text.Trim()) + Convert.ToDecimal(txtOtherDamagedCrops.Text.Trim());
            }
            #endregion

            //SUMMERY
            #region Summery Section
            if (!string.IsNullOrEmpty(txtNegotiatedAmount.Text))
            {
                oCompensationFinancial.NegotiatedAmount = Convert.ToDecimal(txtNegotiatedAmount.Text.Trim());
            }

            if (!string.IsNullOrEmpty(txtInKindLand.Text))
            {
                oCompensationFinancial.LandInKindCompensation = Convert.ToDecimal(txtInKindLand.Text.Trim());
            }

            if (ddlResidentialStructure.SelectedItem.ToString() == "0")
            {
                oCompensationFinancial.ResInKindCompensation = "-1";
            }
            else
            {
                oCompensationFinancial.ResInKindCompensation = ddlResidentialStructure.SelectedItem.ToString();
            }
            if (txtFacilitationallowances.Text.Trim() != "")
            {
                oCompensationFinancial.FacilitationAllowance = Convert.ToDecimal(txtFacilitationallowances.Text.Trim());
            }
            //if (!string.IsNullOrEmpty(txtRSDepreciatedValue.Text))
            //    oCompensationFinancial.ResDepreciatedValue = Convert.ToDecimal(txtRSDepreciatedValue.Text.Trim());
            #endregion
            string message = oCompensationFinancialBLL.AddCompensationFinancial(oCompensationFinancial);

            if (message == "null" || message == null || message == "")
            {
                CompensationFinancialBO objCompensationFinancialBO = new CompensationFinancialBO();
                if (dpDeliveryDate.Text != null)
                {
                    objCompensationFinancialBO.DeliveryDate = Convert.ToDateTime(dpDeliveryDate.Text);
                }

                if (Convert.ToInt32(ddlDeliveredBy.SelectedValue.ToString()) > 0)
                {
                    objCompensationFinancialBO.DeliveredBy = Convert.ToInt32(ddlDeliveredBy.SelectedValue.ToString());
                }
                objCompensationFinancialBO.HHID      = SessionHHID;
                objCompensationFinancialBO.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());

                if (rdoActionRejected.Checked)
                {
                    objCompensationFinancialBO.PAPAction = "N";
                }
                else
                {
                    objCompensationFinancialBO.PAPAction = "Y";
                }
                string sDeliveryComments = txtPackageDeliveryInfoComments.Text.Trim();
                if (sDeliveryComments.Trim().Length >= 1000)
                {
                    sDeliveryComments = sDeliveryComments.Trim().Substring(0, 999);
                }
                objCompensationFinancialBO.DeliveryComments = sDeliveryComments;

                oCompensationFinancialBLL.AddPackageDeliveryInfo(objCompensationFinancialBO);
            }

            return(message);
        }