Beispiel #1
0
        protected void ddlCreditMemo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            var Credit = new CCreditMemo();

            if (!string.IsNullOrEmpty(ddlCreditMemo.SelectedValue))
            {
                tbCreditAmount.Text = Convert.ToString(Credit.GetAvailableCreditAmount(Convert.ToInt32(ddlCreditMemo.SelectedValue)));

                var payAmount    = (tbPaymentAmount.Text == null || tbPaymentAmount.Text == "") ? 0 : Convert.ToDecimal(tbPaymentAmount.Text);
                var creditAmount = (tbCreditAmount.Text == null || tbCreditAmount.Text == "") ? 0 : Convert.ToDecimal(tbCreditAmount.Text);
                tbTotalPayAmount.Text = (payAmount + creditAmount).ToString();
            }
        }
Beispiel #2
0
        protected void tbCreditAmount_TextChanged(object sender, EventArgs e)
        {
            var Credit = new CCreditMemo();

            var payAmount    = (tbPaymentAmount.Text == null || tbPaymentAmount.Text == "") ? 0 : Convert.ToDecimal(tbPaymentAmount.Text);
            var creditAmount = (tbCreditAmount.Text == null || tbCreditAmount.Text == "") ? 0 : Convert.ToDecimal(tbCreditAmount.Text);

            var availableCredit = (ddlCreditMemo.SelectedValue == null || ddlCreditMemo.SelectedValue == "") ? 0 : Credit.GetAvailableCreditAmount(Convert.ToInt32(ddlCreditMemo.SelectedValue));

            if (creditAmount > availableCredit)
            {
                tbCreditAmount.Text = availableCredit.ToString();
                creditAmount        = availableCredit;
            }

            tbTotalPayAmount.Text = (payAmount + creditAmount).ToString();
        }