예제 #1
0
        private void btnApplyPayment_Click(object sender, EventArgs e)
        {
            if (dgvTransactions.SelectedRows.Count < 1)
            {
                return;
            }
            tBLL = tdal.DisplayTransactionByInvoice(Convert.ToInt32(dgvTransactions.SelectedRows[0].Cells[1].Value.ToString()));
            // customersDAL cDAL = new customersDAL();
            // int taxable = cDAL.GetTaxableFromName(tBLL.customer_id.ToString());
            if (ctxtPayment.TextNoFormatting != "" && decimal.Parse(ctxtPayment.TextNoFormatting) > 0)
            {
                tBLL.amtPaid = decimal.Parse(ctxtPayment.TextNoFormatting);
            }
            else
            {
                return;
            }
            if (tBLL.amtPaid > 0)
            {
                tBLL.datePaid = tBLL.due_date; // DateTime.Today.Ticks;
                tBLL.status   = (tBLL.grandTotal.Equals(tBLL.amtPaid) ? (int)status.paidinfull : (int)status.partialpayment);
            }

            tdal.Update(tBLL);
            DataTable dt = tdal.DisplayAllTransactions();

            dgvTransactions.DataSource = dt;
        }