/// <summary>
 /// Clears the controls.
 /// </summary>
 public void Clear()
 {
     base.Session.Remove("paymentInformation");
     btnFinish.Enabled             = false;
     this.labelAmountDue.InnerText = AmountDue.ToString();
     lblChange.InnerText           = lblPaid.InnerText = "";
     //lblAmountToPay.Text = textAmountToPay.Text = AmountDue.ToString();
     lblAmountToPay.Text  = textAmountToPay.Text = NetAmountToPay.ToString();
     textReferenceNo.Text = "";
     //ddlPaymentMode.SelectedIndex = -1;
     textTenderedAmount.Text     = "0.0";
     panelCompute.Visible        = true;
     panelDeposit.Visible        = false;
     panelTenderedAmount.Visible = true;
     panelFinish.Visible         = false;
     base.Session.Remove("ItemsToPay");
 }
        /// <summary>
        /// Validates the nhif.
        /// </summary>
        void ValidateOthers()
        {
            panelDeposit.Visible            = false;
            CompareValidator1.Enabled       = false;
            this.textTenderedAmount.Enabled = false;

            // labelAvailableDeposit.Text = availableDeposit.ToString();
            // labelAmountTendered.InnerText = "Available Deposit";
            buttonCompute.Text = "Validate";
            if (this.AllowPartialPayment)
            {
                lblAmountToPay.Visible  = false;
                textAmountToPay.Visible = true;
                //this.rgAmountToPay.MaximumValue = AmountToPay.ToString();
                this.rgAmountToPay.MaximumValue = NetAmountToPay.ToString("F");
                this.rgAmountToPay.MinimumValue = "0";
                //this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay);
                this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", NetAmountToPay);
                //lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString();
                lblAmountToPay.Text           = this.textAmountToPay.Text = NetAmountToPay.ToString("F");
                this.textAmountToPay.ReadOnly = false;
            }
            else
            {
                //cannot pay partial. availableDeposit must be greate or equal to amounttopay

                /*  lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString();
                 * this.rgAmountToPay.MaximumValue = AmountToPay.ToString();
                 * this.rgAmountToPay.MinimumValue = "0";
                 * this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay);
                 * lblAmountToPay.Visible = true;
                 * textAmountToPay.Visible = false;           */
                lblAmountToPay.Text             = this.textAmountToPay.Text = NetAmountToPay.ToString("F");
                this.rgAmountToPay.MaximumValue = NetAmountToPay.ToString();
                this.rgAmountToPay.MinimumValue = "0";
                this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", NetAmountToPay);
                lblAmountToPay.Visible          = true;
                textAmountToPay.Visible         = false;
            }
        }
        /// <summary>
        /// Validates the deposit.
        /// </summary>
        /// <param name="availableDeposit">The available deposit.</param>
        /// <returns></returns>
        void ValidateDeposit(decimal availableDeposit)
        {
            panelDeposit.Visible            = true;
            CompareValidator1.Enabled       = false;
            this.textTenderedAmount.Enabled = false;

            labelAvailableDeposit.Text    = availableDeposit.ToString("F");
            labelAmountTendered.InnerText = "Available Deposit";
            buttonCompute.Text            = "Compute";
            if (this.AllowPartialPayment)
            {
                lblAmountToPay.Visible  = false;
                textAmountToPay.Visible = true;

                //if (availableDeposit <= this.AmountToPay)
                if (availableDeposit <= this.NetAmountToPay)
                {
                    this.rgAmountToPay.MaximumValue = availableDeposit.ToString("F");
                    this.rgAmountToPay.MinimumValue = "0";
                    this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", availableDeposit);
                    lblAmountToPay.Text             = this.textAmountToPay.Text = availableDeposit.ToString("F");
                    this.textAmountToPay.ReadOnly   = true;
                }
                else
                {
                    // this.rgAmountToPay.MaximumValue = AmountToPay.ToString();
                    this.rgAmountToPay.MaximumValue = NetAmountToPay.ToString("F");
                    this.rgAmountToPay.MinimumValue = "0";
                    //this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay);
                    this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", NetAmountToPay);
                    //lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString();
                    lblAmountToPay.Text           = this.textAmountToPay.Text = NetAmountToPay.ToString("F");
                    this.textAmountToPay.ReadOnly = false;
                }
            }
            else
            {
                /*
                 *  ///cannot pay partial. availableDeposit must be greate or equal to amounttopay
                 * ///
                 */
                //lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString();
                //this.rgAmountToPay.MaximumValue = AmountToPay.ToString();

                lblAmountToPay.Text             = this.textAmountToPay.Text = NetAmountToPay.ToString("F");
                this.rgAmountToPay.MaximumValue = NetAmountToPay.ToString();
                this.rgAmountToPay.MinimumValue = "0";
                //this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay);
                this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", NetAmountToPay);
                lblAmountToPay.Visible          = true;
                textAmountToPay.Visible         = false;
                //if (availableDeposit < this.AmountToPay)
                if (availableDeposit < this.NetAmountToPay)
                {
                    panelDeposit.Visible = false;
                    //  NotifyAction(string.Format("Available deposit of{0} is not enough to cover the amount required of {1}", availableDeposit, this.AmountToPay), "Patient Deposits", true);
                    NotifyAction(string.Format("Available deposit of{0} is not enough to cover the amount required of {1}", availableDeposit, this.NetAmountToPay), "Patient Deposits", true);
                    buttonCompute.Visible = btnFinish.Visible = false;
                }
            }
        }