private void TxtNoOfItems_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TxtNoOfItems.Text.ToString()) && IsAllowTextChange) { if (Convert.ToInt32(TxtNoOfItems.Text) > CurrentAvailableItems) { IsAllowTextChange = false; messageShow.singlemsgtext("Entered quantity not available."); TxtNoOfItems.Text = TxtNoOfItems.Text.Substring(0, (TxtNoOfItems.TextLength - 1)); IsAllowTextChange = true; TxtNoOfItems.SelectAll(); TxtNoOfItems.Focus(); return; } NoOfItemsSignle = Convert.ToInt32(TxtNoOfItems.Text.ToString()); SinglePrice = Convert.ToDouble(TxtRate.Text.ToString()); SingleCgstAmount = Convert.ToDouble(TxtCgstRs.Text.ToString()); SingleSgstAmount = Convert.ToDouble(TxtSgstRs.Text.ToString()); SingleCgstPer = Convert.ToDouble(TxtCgstPer.Text.ToString()); SingleSgstPer = Convert.ToDouble(TxtSgstPer.Text.ToString()); DiscountAmountHeader = Convert.ToDouble(TxtDiscountHeader.Text.ToString()); SingleCgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleCgstPer; SingleSgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleSgstPer; SingleTotalAmount = NoOfItemsSignle * SinglePrice + SingleCgstAmount + SingleSgstAmount; TxtCgstPer.Text = SingleCgstPer.ToString(); TxtCgstRs.Text = SingleCgstAmount.ToString(); TxtSgstPer.Text = SingleSgstPer.ToString(); TxtSgstRs.Text = SingleSgstAmount.ToString(); TxtTotaltaxHeader.Text = (SingleCgstAmount + SingleSgstAmount).ToString(); TxtSingleTotal.Text = (SingleTotalAmount - DiscountAmountHeader).ToString(); } }
private void SetAllCalculationsTextBox() { SingleCgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleCgstPer; SingleSgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleSgstPer; SingleTotalAmount = NoOfItemsSignle * SinglePrice + SingleCgstAmount + SingleSgstAmount; TxtRate.Text = SinglePrice.ToString(); TxtNoOfItems.Text = NoOfItemsSignle.ToString(); TxtCgstPer.Text = SingleCgstPer.ToString(); TxtCgstRs.Text = SingleCgstAmount.ToString(); TxtSgstPer.Text = SingleSgstPer.ToString(); TxtSgstRs.Text = SingleSgstAmount.ToString(); TxtTotaltaxHeader.Text = (SingleCgstAmount + SingleSgstAmount).ToString(); TxtSingleTotal.Text = SingleTotalAmount.ToString(); IsAllowTextChange = true; //To allow the text box change event }
private void TxtRate_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TxtRate.Text.ToString()) && IsAllowTextChange) { NoOfItemsSignle = Convert.ToInt32(TxtNoOfItems.Text.ToString()); SinglePrice = Convert.ToDouble(TxtRate.Text.ToString()); SingleCgstAmount = Convert.ToDouble(TxtCgstRs.Text.ToString()); SingleSgstAmount = Convert.ToDouble(TxtSgstRs.Text.ToString()); SingleCgstPer = Convert.ToDouble(TxtCgstPer.Text.ToString()); SingleSgstPer = Convert.ToDouble(TxtSgstPer.Text.ToString()); SingleCgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleCgstPer; SingleSgstAmount = NoOfItemsSignle * SinglePrice / 100 * SingleSgstPer; SingleTotalAmount = NoOfItemsSignle * SinglePrice + SingleCgstAmount + SingleSgstAmount; TxtCgstPer.Text = SingleCgstPer.ToString(); TxtCgstRs.Text = SingleCgstAmount.ToString(); TxtSgstPer.Text = SingleSgstPer.ToString(); TxtSgstRs.Text = SingleSgstAmount.ToString(); TxtSingleTotal.Text = SingleTotalAmount.ToString(); } }