Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Int32.Parse(cmbBillStatus.SelectedValue.ToString()) == 4 && bill_balance != 0)
                {
                    MessageBox.Show("The entire bill needs to be paid fully for 'Paid' Status");
                }
                else if (Int32.Parse(cmbBillStatus.SelectedValue.ToString()) != 4 && bill_balance == 0)
                {
                    MessageBox.Show("Please change the status to 'Paid'");
                }
                else if (Int32.Parse(cmbBillStatus.SelectedValue.ToString()) != 2 && Int32.Parse(cmbBillStatus.SelectedValue.ToString()) != 3 && bill_balance != 0)
                {
                    if (bill_balance != bill_total)
                    {
                        MessageBox.Show("Please change the status to 'Partial-Paid'");
                    }
                }
                else
                {
                    if (!(LoggedUser.id > 0))
                    {
                        LoggedUser.id = 1;
                    }
                    int res = bill.editBill(bill_id, Convert.ToDecimal(bill_total), Convert.ToDecimal(bill_paid), Convert.ToDecimal(bill_balance), Int32.Parse(cmbBillStatus.SelectedValue.ToString()), LoggedUser.id);
                    if (cmbBillStatus.SelectedValue.ToString() == "4")
                    {
                        txtPaid.ReadOnly = true;
                        dgvInv.ReadOnly  = true;
                        btnSave.Enabled  = false;
                    }

                    if (cell_modified == 1) //edit in patient_procedures table
                    {
                        res = objCD.editProceduresFees(dtProc);
                    }
                }
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }