Example #1
0
        protected void ddlTablet_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                List <EntityPrescriptionDetails> lst = null;
                if (ddlTablet.SelectedIndex > 0)
                {
                    IssueMaterialBLL mobjDeptBLL = new IssueMaterialBLL();
                    EntityProduct    entProduct  = mobjDeptBLL.GetProductPrice(Convert.ToInt32(ddlTablet.SelectedValue));

                    List <tblStockDetail> lst1 = new CustomerTransactionBLL().GetProductTransByProductId(Convert.ToInt32(ddlTablet.SelectedValue));
                    if (lst1 != null)
                    {
                        lblBalQty.Text = Convert.ToString(Convert.ToInt32(lst1.Sum(p => p.InwardQty)) - Convert.ToInt32(lst1.Sum(p => p.OutwardQty)));
                    }
                    else
                    {
                        lblBalQty.Text = string.Empty;
                    }
                }
                else
                {
                    lst = new List <EntityPrescriptionDetails>();
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
        }
Example #2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Session["Status"] = "Edit";
                lblMessage.Text   = string.Empty;
                ImageButton imgEdit = (ImageButton)sender;
                GridViewRow cnt     = (GridViewRow)imgEdit.NamingContainer;
                Session["ReceiptNo"] = Convert.ToInt32(cnt.Cells[0].Text);

                if (cnt != null)
                {
                    ListItem item = ddlSupplier.Items.FindByText(Convert.ToString(cnt.Cells[2].Text));
                    ddlSupplier.SelectedValue = item.Value;
                    ddlSupplier_SelectedIndexChanged(sender, e);
                    txtTransactDate.Text = string.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(cnt.Cells[1].Text));
                    txtPayAmount.Text    = Convert.ToString(cnt.Cells[4].Text);
                    EntityCustomerTransaction transaction = new CustomerTransactionBLL().GetReceiptDetails(Convert.ToInt32(cnt.Cells[0].Text));
                    if (transaction != null)
                    {
                        if (Convert.ToBoolean(transaction.ISCheque))
                        {
                            IsCheque.Checked = Convert.ToBoolean(transaction.ISCheque);
                            IsCash_CheckedChanged(sender, e);
                            ListItem itemBank = ddlBank.Items.FindByText(transaction.PatientName);
                            ddlBank.SelectedValue = itemBank.Value;
                            txtBankName.Text      = transaction.BankName;
                            txtChequeNo.Text      = transaction.ChequeNo;
                            txtChequeDate.Text    = string.Format("{0:MM/dd/yyyy}", transaction.ChequeDate);
                        }
                        else
                        {
                            IsCheque.Checked = Convert.ToBoolean(transaction.ISCheque);
                            RdoCard.Checked  = true;
                            IsCash_CheckedChanged(sender, e);
                            ListItem itemBank = ddlBank.Items.FindByText(transaction.PatientName);
                            ddlBank.SelectedValue = itemBank.Value;
                            txtBankName.Text      = transaction.BankName;
                            txtChequeNo.Text      = transaction.ChequeNo;
                            txtChequeDate.Text    = string.Format("{0:MM/dd/yyyy}", transaction.ChequeDate);
                        }
                    }
                    else
                    {
                        IsCash.Checked   = true;
                        IsCheque.Checked = false;
                        RdoCard.Checked  = false;
                        IsCash_CheckedChanged(sender, e);
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            BtnUpdate.Visible = true;
            BtnSave.Visible   = false;
            MultiView1.SetActiveView(View1);
        }
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         lbl.Text        = "STOCK DETAIL REPORT";
         lblFrom.Text    = ddlProduct.SelectedItem.Text;
         lblTo.Text      = string.Format("{0:dd-MMM-yyyy}", DateTime.Now);
         lblMessage.Text = string.Empty;
         EntityProduct entPro = new CustomerTransactionBLL().GetUnitOfMeasurement(ddlProduct.SelectedValue);
         lblUoM.Text = "U.O.M" + "-" + entPro.UOM;
         List <tblStockDetail> lst = new CustomerTransactionBLL().GetProductTransByProductId(Convert.ToInt32(ddlProduct.SelectedValue));
         tblStockDetail        obj = new tblStockDetail()
         {
         };
         lst.Add(obj);
         tblStockDetail objReceived = new tblStockDetail()
         {
             TransactionType = "Total Inward Amount",
             InwardAmount    = Convert.ToDecimal(lst.Sum(p => p.InwardAmount))
         };
         lst.Add(objReceived);
         tblStockDetail objBills = new tblStockDetail()
         {
             TransactionType = "Total Outward Amount",
             OutwardAmount   = Convert.ToDecimal(lst.Sum(p => p.OutwardAmount))
         };
         lst.Add(objBills);
         tblStockDetail objIqty = new tblStockDetail()
         {
             TransactionType = "Total Inward Quntity",
             InwardQty       = Convert.ToInt32(lst.Sum(p => p.InwardQty))
         };
         lst.Add(objIqty);
         tblStockDetail objOqty = new tblStockDetail()
         {
             TransactionType = "Total Outward Quntity",
             OutwardQty      = Convert.ToInt32(lst.Sum(p => p.OutwardQty))
         };
         lst.Add(objOqty);
         tblStockDetail objFinal = new tblStockDetail()
         {
             TransactionType = "Balance Quntity",
             InwardQty       = objIqty.InwardQty - objOqty.OutwardQty
         };
         lst.Add(objFinal);
         dgvTestParameter.DataSource = lst;
         dgvTestParameter.DataBind();
         Session["StockDetailsRep"] = ListConverter.ToDataTable(lst);
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lbl.Text = "Patient Ledger";
                lblFrom.Text = ddlPatient.SelectedItem.Text;
                lblTo.Text = string.Format("{0:dd-MMM-yyyy}", DateTime.Now);
                lblMessage.Text = string.Empty;

                List<tblCustomerTransaction> lst = new CustomerTransactionBLL().GetPatientTransByPatientId(Convert.ToInt32(ddlPatient.SelectedValue));
                EntityPatientMaster objPatient = new PatientMasterBLL().GetPatientDetailsByPatientId(Convert.ToInt32(ddlPatient.SelectedValue));
                if (objPatient != null)
                {
                    lblAge.Text = Convert.ToString(objPatient.Age);
                    MRN.Text = Convert.ToString(objPatient.PatientCode);
                    lblSex.Text = Convert.ToString(objPatient.GenderDesc);
                    lblBloodGroup.Text = Convert.ToString(objPatient.BloodGroup);
                }
                tblCustomerTransaction obj = new tblCustomerTransaction() { };
                lst.Add(obj);
                tblCustomerTransaction objBills = new tblCustomerTransaction()
                {
                    TransactionType = "Total Invoices Amt",
                    BillAmount = Convert.ToDecimal(lst.Sum(p => p.BillAmount))
                };
                lst.Add(objBills);
                tblCustomerTransaction objReceived = new tblCustomerTransaction()
                {
                    TransactionType = "Total Received",
                    PayAmount = Convert.ToDecimal(lst.Sum(p => p.PayAmount)) + Convert.ToDecimal(lst.Sum(p => p.AdvanceAmount))
                };
                lst.Add(objReceived);

                tblCustomerTransaction objFinal = new tblCustomerTransaction()
                {
                    TransactionType = "Balance(+)/Refund(-) Amt",

                    BillAmount = objBills.BillAmount - objReceived.PayAmount
                };
                lst.Add(objFinal);

                dgvTestParameter.DataSource = lst;
                dgvTestParameter.DataBind();
                Session["PatientLedg"] = ListConverter.ToDataTable(lst);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Example #5
0
 protected void BtnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         tblCustomerTransaction entcust = new tblCustomerTransaction();
         entcust.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
         entcust.ReceiptNo   = Convert.ToInt32(Session["ReceiptNo"]);
         entcust.BillAmount  = 0;
         entcust.IsCash      = true;
         entcust.ReceiptDate = Convert.ToDateTime(txtTransactDate.Text);
         entcust.SupplierId  = Convert.ToInt32(ddlSupplier.SelectedValue);
         EntityCustomerTransaction transact = null;
         if (IsCheque.Checked)
         {
             entcust.IsCash       = false;
             entcust.ISCheque     = true;
             entcust.ReceiptDate  = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeDate   = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeNo     = Convert.ToString(txtChequeNo.Text);
             entcust.BankName     = Convert.ToString(txtBankName.Text);
             transact             = new EntityCustomerTransaction();
             transact.BankId      = Convert.ToInt32(ddlBank.SelectedValue);
             transact.ReceiptDate = Convert.ToDateTime(txtChequeDate.Text);
             transact.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
             transact.ISCheque    = true;
             transact.BillAmount  = 0;
             transact.ChequeDate  = Convert.ToDateTime(txtChequeDate.Text);
             transact.ChequeNo    = Convert.ToString(txtChequeNo.Text);
             transact.BankName    = Convert.ToString(txtBankName.Text);
         }
         else if (RdoCard.Checked)
         {
             entcust.IsCash       = false;
             entcust.ISCheque     = false;
             transact             = new EntityCustomerTransaction();
             transact.BankId      = Convert.ToInt32(ddlBank.SelectedValue);
             transact.ReceiptDate = Convert.ToDateTime(txtTransactDate.Text);
             transact.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
             transact.BillAmount  = 0;
         }
         int i = new CustomerTransactionBLL().UpdateSupplierTransaction(entcust, transact, IsCash.Checked);
         GetSupplierTransactionList();
         MultiView1.SetActiveView(View2);
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
 private void BindPatients()
 {
     try
     {
         List<EntityPatientMaster> tblpatient = new CustomerTransactionBLL().GetAllocatedPatient();
         tblpatient.Insert(0, new EntityPatientMaster() { PatientId = 0, FullName = "----Select----" });
         ddlPatient.DataSource = tblpatient;
         ddlPatient.DataTextField = "FullName";
         ddlPatient.DataValueField = "PatientId";
         ddlPatient.DataBind();
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }
Example #7
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime Curr = Convert.ToDateTime(DateTime.Now);
                DateTime Next = Curr.AddYears(1);
                lbl.Text = "SUPPLIER LEDGER REPORT" + " " + string.Format("{0:yyyy}", Curr) + "-" + string.Format("{0:yyyy}", Next);

                lblFrom.Text    = ddlSupplier.SelectedItem.Text;
                lblTo.Text      = string.Format("{0:dd-MMM-yyyy}", DateTime.Now);
                lblMessage.Text = string.Empty;
                List <tblCustomerTransaction> lst = new CustomerTransactionBLL().GetSupplierTransBySupplierId(Convert.ToInt32(ddlSupplier.SelectedValue));
                tblCustomerTransaction        obj = new tblCustomerTransaction()
                {
                };
                lst.Add(obj);
                tblCustomerTransaction objReceived = new tblCustomerTransaction()
                {
                    TransactionType = "Total Received",
                    PayAmount       = Convert.ToDecimal(lst.Sum(p => p.PayAmount))
                };
                lst.Add(objReceived);
                tblCustomerTransaction objBills = new tblCustomerTransaction()
                {
                    TransactionType = "Total Bills",
                    BillAmount      = Convert.ToDecimal(lst.Sum(p => p.BillAmount))
                };
                lst.Add(objBills);
                tblCustomerTransaction objFinal = new tblCustomerTransaction()
                {
                    TransactionType = "Total Bills",
                    BillAmount      = objBills.BillAmount - objReceived.PayAmount
                };
                lst.Add(objFinal);
                dgvTestParameter.DataSource = lst;
                dgvTestParameter.DataBind();
                Session["SuppLedg"] = ListConverter.ToDataTable(lst);
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Example #8
0
 private void GetSupplierTransactionList()
 {
     try
     {
         List <EntityCustomerTransaction> tblPatient = new CustomerTransactionBLL().GetSupplierTransactionList();
         if (tblPatient.Count > 0)
         {
             dgvCustTransaction.DataSource = tblPatient;
             dgvCustTransaction.DataBind();
             Session["DepartmentDetail"] = tblPatient;
             int lintRowcount = tblPatient.Count;
             lblRowCount1.Text = "<b>Total Records:</b> " + lintRowcount.ToString();
         }
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }
Example #9
0
 protected void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlProduct.SelectedIndex > 0)
     {
         Session["Prod_ID"] = ddlProduct.SelectedIndex;
         EntityProduct entProduct = mobjDeptBLL.GetProductPrice(Convert.ToInt32(Session["Prod_ID"]));
         txtItemCharge.Text = Convert.ToString(entProduct.Price);
         txtQuantity.Text   = Convert.ToString(1);
         List <tblStockDetail> lst1 = new CustomerTransactionBLL().GetProductTransByProductId(Convert.ToInt32(ddlProduct.SelectedValue));
         if (lst1 != null)
         {
             lblBalQty.Text = Convert.ToString(Convert.ToInt32(lst1.Sum(p => p.InwardQty)) - Convert.ToInt32(lst1.Sum(p => p.OutwardQty)));
         }
         else
         {
             lblBalQty.Text = string.Empty;
         }
     }
 }
 protected void ddlPatient_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ddlPatient.SelectedIndex > 0)
         {
             List <tblCustomerTransaction> lst = new CustomerTransactionBLL().GetPatientTransByPatientAdmitId(Convert.ToInt32(ddlPatient.SelectedValue));
             decimal DR = Convert.ToDecimal(lst.Sum(p => p.BillAmount));
             decimal CR = Convert.ToDecimal(lst.Sum(p => p.PayAmount)) + Convert.ToDecimal(lst.Sum(p => p.AdvanceAmount));
             if (CR > DR)
             {
                 txtTotal.Text = Convert.ToString(CR - DR);
             }
             else
             {
                 txtTotal.Text = Convert.ToString(DR - CR);
             }
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Example #11
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlSupplier.SelectedIndex == 0)
                {
                    lblMsg.Text = "Please Select Patient Name";
                    ddlSupplier.Focus();
                    return;
                }
                else
                {
                    if (IsCheque.Checked)
                    {
                        if (string.IsNullOrEmpty(txtChequeNo.Text))
                        {
                            lblMsg.Text = "Please Enter Cheque Number";
                            txtChequeNo.Focus();
                            return;
                        }
                        else if (string.IsNullOrEmpty(txtChequeDate.Text))
                        {
                            lblMsg.Text = "Please Enter Cheque Date";
                            txtChequeDate.Focus();
                            return;
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(txtBankName.Text))
                            {
                                lblMsg.Text = "Please Enter Bank Name";
                                txtBankName.Focus();
                                return;
                            }
                        }
                    }
                    EntityCustomerTransaction entcust  = new EntityCustomerTransaction();
                    EntityCustomerTransaction transact = null;
                    entcust.SupplierId  = Convert.ToInt32(ddlSupplier.SelectedValue);
                    entcust.ReceiptDate = Convert.ToDateTime(txtTransactDate.Text);
                    entcust.BillAmount  = 0;
                    entcust.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
                    entcust.IsCash      = true;
                    if (IsCheque.Checked)
                    {
                        entcust.IsCash       = false;
                        entcust.ISCheque     = true;
                        entcust.ReceiptDate  = Convert.ToDateTime(txtChequeDate.Text);
                        entcust.ChequeDate   = Convert.ToDateTime(txtChequeDate.Text);
                        entcust.ChequeNo     = Convert.ToString(txtChequeNo.Text);
                        entcust.BankName     = Convert.ToString(txtBankName.Text);
                        transact             = new EntityCustomerTransaction();
                        transact.BankId      = Convert.ToInt32(ddlBank.SelectedValue);
                        transact.ReceiptDate = Convert.ToDateTime(txtChequeDate.Text);
                        transact.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
                        transact.ISCheque    = true;
                        transact.BillAmount  = 0;
                        transact.ChequeDate  = Convert.ToDateTime(txtChequeDate.Text);
                        transact.ChequeNo    = Convert.ToString(txtChequeNo.Text);
                        transact.BankName    = Convert.ToString(txtBankName.Text);
                    }
                    else if (RdoCard.Checked)
                    {
                        entcust.IsCash       = false;
                        entcust.ISCheque     = false;
                        transact             = new EntityCustomerTransaction();
                        transact.BankId      = Convert.ToInt32(ddlBank.SelectedValue);
                        transact.ReceiptDate = Convert.ToDateTime(txtTransactDate.Text);
                        transact.PayAmount   = Convert.ToDecimal(txtPayAmount.Text);
                        transact.IsCash      = false;
                        transact.ISCheque    = false;
                        transact.BillAmount  = 0;
                    }
                    int i = new CustomerTransactionBLL().SaveSupplierTransaction(entcust, transact, IsCash.Checked);

                    if (i > 0)
                    {
                        lblMessage.Text = "Record Saved Successfully";
                    }
                    else
                    {
                        lblMessage.Text = "Record Not Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            GetSupplierTransactionList();
            MultiView1.SetActiveView(View2);
        }
Example #12
0
 protected void BtnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         tblCustomerTransaction entcust = new tblCustomerTransaction();
         entcust.PayAmount      = Convert.ToDecimal(txtPayAmount.Text);
         entcust.AdvanceAmount  = Convert.ToDecimal(txtAdvanceAmount.Text);
         entcust.ReceiptNo      = Convert.ToInt32(Session["ReceiptNo"]);
         entcust.BillAmount     = 0;
         entcust.IsCash         = true;
         entcust.ReceiptDate    = Convert.ToDateTime(txtTransactDate.Text);
         entcust.PatientId      = Convert.ToInt32(ddlPatient.SelectedValue);
         entcust.PreparedByName = Convert.ToString(Session["AdminName"]);
         EntityCustomerTransaction transact = null;
         if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Self")
         {
             entcust.IsCash          = false;
             entcust.ISCheque        = true;
             entcust.IsCard          = false;
             entcust.IsRTGS          = false;
             entcust.ReceiptDate     = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
             entcust.BankName        = Convert.ToString(txtBankName.Text);
             entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
             transact               = new EntityCustomerTransaction();
             transact.InsuranceId   = 0;
             transact.CompanyId     = 0;
             transact.CompanyName   = "";
             transact.InsuranceName = "";
             transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
             transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
             transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
             transact.ISCheque      = true;
             transact.PayAmount     = 0;
             transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
             transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
             transact.BankName      = Convert.ToString(txtBankName.Text);
         }
         else if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Company")
         {
             entcust.IsCash          = false;
             entcust.ISCheque        = true;
             entcust.IsCard          = false;
             entcust.IsRTGS          = false;
             entcust.ReceiptDate     = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
             entcust.BankName        = Convert.ToString(txtBankName.Text);
             entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
             transact               = new EntityCustomerTransaction();
             transact.InsuranceId   = 0;
             transact.CompanyId     = Convert.ToInt32(ddlCompany.SelectedValue);
             transact.CompanyName   = Convert.ToString(ddlCompany.SelectedItem.Text);
             transact.InsuranceName = "";
             transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
             transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
             transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
             transact.ISCheque      = true;
             transact.PayAmount     = 0;
             transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
             transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
             transact.BankName      = Convert.ToString(txtBankName.Text);
         }
         else if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Insurance")
         {
             entcust.IsCash          = false;
             entcust.ISCheque        = false;
             entcust.IsCard          = false;
             entcust.IsRTGS          = false;
             entcust.ReceiptDate     = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
             entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
             entcust.BankName        = Convert.ToString(txtBankName.Text);
             entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
             transact               = new EntityCustomerTransaction();
             transact.InsuranceId   = Convert.ToInt32(ddlCompany.SelectedValue);
             transact.CompanyId     = 0;
             transact.InsuranceName = Convert.ToString(ddlCompany.SelectedItem.Text);
             transact.CompanyName   = "";
             transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
             transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
             transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
             transact.ISCheque      = true;
             transact.PayAmount     = 0;
             transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
             transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
             transact.BankName      = Convert.ToString(txtBankName.Text);
         }
         int i = new CustomerTransactionBLL().Update(entcust, transact, IsCash.Checked);
         GetCustTransactionList();
         MultiView1.SetActiveView(View2);
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Example #13
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlPatient.SelectedIndex == 0)
                {
                    lblMsg.Text = "Please Select Patient Name";
                    ddlPatient.Focus();
                    return;
                }
                else
                {
                    if (IsCheque.Checked)
                    {
                        if (string.IsNullOrEmpty(txtChequeNo.Text))
                        {
                            lblMsg.Text = "Please Enter Cheque Number";
                            txtChequeNo.Focus();
                            return;
                        }
                        else if (string.IsNullOrEmpty(txtChequeDate.Text))
                        {
                            lblMsg.Text = "Please Enter Cheque Date";
                            txtChequeDate.Focus();
                            return;
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(txtBankName.Text))
                            {
                                lblMsg.Text = "Please Enter Bank Name";
                                txtBankName.Focus();
                                return;
                            }
                        }
                    }
                    EntityCustomerTransaction entcust  = new EntityCustomerTransaction();
                    EntityCustomerTransaction transact = null;
                    entcust.PatientId     = Convert.ToInt32(ddlPatient.SelectedValue);
                    entcust.EmpName       = Convert.ToString(Session["AdminName"]);
                    entcust.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                    entcust.BillRefNo     = Convert.ToString(txtBillRefNo.Text);
                    entcust.BillAmount    = 0;
                    entcust.PayAmount     = Convert.ToDecimal(txtPayAmount.Text);
                    entcust.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                    entcust.IsCash        = true;
                    if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Self")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = true;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = false;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
                        entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
                        entcust.BankName        = Convert.ToString(txtBankName.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = 0;
                        transact.CompanyName   = "";
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.ISCheque      = true;
                        transact.PayAmount     = 0;
                        transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
                        transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
                        transact.BankName      = Convert.ToString(txtBankName.Text);
                    }
                    else if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Company")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = true;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = false;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
                        entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
                        entcust.BankName        = Convert.ToString(txtBankName.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyName   = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.ISCheque      = true;
                        transact.PayAmount     = 0;
                        transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
                        transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
                        transact.BankName      = Convert.ToString(txtBankName.Text);
                    }
                    else if (IsCheque.Checked && ddlPatientCategory.SelectedItem.Text == "Insurance")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = true;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.ChequeDate      = Convert.ToDateTime(txtChequeDate.Text);
                        entcust.ChequeNo        = Convert.ToString(txtChequeNo.Text);
                        entcust.BankName        = Convert.ToString(txtBankName.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyId     = 0;
                        transact.InsuranceName = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.CompanyName   = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtChequeDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.ISCheque      = true;
                        transact.PayAmount     = 0;
                        transact.ChequeDate    = Convert.ToDateTime(txtChequeDate.Text);
                        transact.ChequeNo      = Convert.ToString(txtChequeNo.Text);
                        transact.BankName      = Convert.ToString(txtBankName.Text);
                    }
                    else if (IsCard.Checked && ddlPatientCategory.SelectedItem.Text == "Self")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = true;
                        entcust.IsRTGS          = false;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = 0;
                        transact.CompanyName   = "";
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsCard        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }
                    else if (IsCard.Checked && ddlPatientCategory.SelectedItem.Text == "Company")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = true;
                        entcust.IsRTGS          = false;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyName   = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsCard        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }
                    else if (IsCard.Checked && ddlPatientCategory.SelectedItem.Text == "Insurance")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = true;
                        entcust.IsRTGS          = false;
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyId     = 0;
                        transact.InsuranceName = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.CompanyName   = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsCard        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }

                    else if (IsRTGS.Checked && ddlPatientCategory.SelectedItem.Text == "Self")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = true;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = 0;
                        transact.CompanyName   = "";
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsRTGS        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }
                    else if (IsRTGS.Checked && ddlPatientCategory.SelectedItem.Text == "Company")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = true;
                        entcust.ReceiptDate     = Convert.ToDateTime(txtTransactDate.Text);
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = 0;
                        transact.CompanyId     = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyName   = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.InsuranceName = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsRTGS        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }
                    else if (IsRTGS.Checked && ddlPatientCategory.SelectedItem.Text == "Insurance")
                    {
                        entcust.IsCash          = false;
                        entcust.ISCheque        = false;
                        entcust.IsCard          = false;
                        entcust.IsRTGS          = true;
                        entcust.BankRefNo       = Convert.ToString(txtBankRefNo.Text);
                        entcust.BillRefNo       = Convert.ToString(txtBillRefNo.Text);
                        entcust.PatientCategory = Convert.ToString(ddlPatientCategory.SelectedItem.Text);
                        transact               = new EntityCustomerTransaction();
                        transact.InsuranceId   = Convert.ToInt32(ddlCompany.SelectedValue);
                        transact.CompanyId     = 0;
                        transact.InsuranceName = Convert.ToString(ddlCompany.SelectedItem.Text);
                        transact.CompanyName   = "";
                        transact.ReceiptDate   = Convert.ToDateTime(txtTransactDate.Text);
                        transact.BillAmount    = Convert.ToDecimal(txtPayAmount.Text);
                        transact.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text);
                        transact.IsCard        = true;
                        transact.PayAmount     = 0;
                        transact.BankRefNo     = Convert.ToString(txtBankRefNo.Text);
                    }
                    int i = new CustomerTransactionBLL().Save(entcust, transact, IsCash.Checked);

                    if (i > 0)
                    {
                        lblMessage.Text = "Record Saved Successfully";
                    }
                    else
                    {
                        lblMessage.Text = "Record Not Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            GetCustTransactionList();
            MultiView1.SetActiveView(View2);
        }