/// <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.MinimumValue = "0"; this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay); lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString(); 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; } }
/// <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(); labelAmountTendered.InnerText = "Available Deposit"; buttonCompute.Text = "Compute"; if (this.AllowPartialPayment) { lblAmountToPay.Visible = false; textAmountToPay.Visible = true; if (availableDeposit <= this.AmountToPay) { this.rgAmountToPay.MaximumValue = availableDeposit.ToString(); 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(); this.textAmountToPay.ReadOnly = true; } else { this.rgAmountToPay.MaximumValue = AmountToPay.ToString(); this.rgAmountToPay.MinimumValue = "0"; this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", AmountToPay); lblAmountToPay.Text = this.textAmountToPay.Text = AmountToPay.ToString(); 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; if (availableDeposit < this.AmountToPay) { 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); buttonCompute.Visible = btnFinish.Visible = false; } } }
private void btnSave_Click(object sender, EventArgs e) { double cash; double.TryParse(txtCash.Text, out cash); if (cash <= 0) { MessageBox.Show("Invalid Cash Input", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (AmountToPay > cash) { MessageBox.Show("Not enough cash\nPlease Pay P" + AmountToPay.ToString(), "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } IsSubmit = true; isClosing = true; Close(); }
private void frmPaymentEntry_Load(object sender, EventArgs e) { txtAmount.Text = AmountToPay.ToString("#,##0.00"); txtChange.Text = "0.00"; }