protected void BtnEdit_Click(object sender, EventArgs e) { try { List <TestAllocation> lst = new List <TestAllocation>(); tblTestInvoice obj = new tblTestInvoice(); obj.Amount = Convert.ToDecimal(txtNetAmount.Text); obj.TestInvoiceNo = Convert.ToInt32(Session["TestInvoiceId"]); obj.Discount = Convert.ToDecimal(txtDiscountAmt.Text); obj.PatientId = Convert.ToInt32(ddlPatient.SelectedValue); string[] arr = txtAllocDate.Text.Split('/'); obj.TestInvoiceDate = new DateTime(Convert.ToInt32(arr[arr.Length - 1]), Convert.ToInt32(arr[0]), Convert.ToInt32(arr[1])); foreach (GridViewRow item in dgvAllTests.Rows) { CheckBox chk = (CheckBox)item.FindControl("chkSelect"); if (chk.Checked) { lst.Add(new TestAllocation() { IsTestDone = false, TestId = Convert.ToInt32(dgvAllTests.DataKeys[item.RowIndex].Value), Charges = Convert.ToDecimal(item.Cells[2].Text) }); } } bool IsCash = chkIsCash.Checked ? true : false; int i = new clsTestAllocation().Update(lst, obj, IsCash); GetInvoiceList(); } catch (Exception ex) { lblMessage.Text = ex.Message; } MultiView1.SetActiveView(View2); }
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["TestInvoiceId"] = Convert.ToInt32(cnt.Cells[0].Text); EntityPatientAdmit entPat = mobjDeptBLL.ChechDischargeDone(Convert.ToInt32(cnt.Cells[0].Text)); if (entPat != null) { List <TestAllocation> lst = new clsTestAllocation().GetTestInvoiceDetails(Convert.ToInt32(cnt.Cells[0].Text)); if (cnt != null) { ListItem item = ddlPatient.Items.FindByText(Convert.ToString(cnt.Cells[2].Text)); ddlPatient.SelectedValue = item.Value; txtAllocDate.Text = string.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(cnt.Cells[1].Text)); txtNetAmount.Text = Convert.ToString(cnt.Cells[4].Text); if (lst.Count > 0) { txtDiscountAmt.Text = Convert.ToString(lst[0].DiscountAmount); txtTotal.Text = Convert.ToString(Convert.ToDecimal(txtNetAmount.Text) + Convert.ToDecimal(txtDiscountAmt.Text)); txtDiscount.Text = string.Format("{0:}", Convert.ToDecimal(txtDiscountAmt.Text) / Convert.ToDecimal(txtTotal.Text) * 100); } EntityCustomerTransaction transactionStatus = mobjDeptBLL.GetTransactionStatus(Convert.ToInt32(Session["TestInvoiceId"])); if (transactionStatus != null) { chkIsCash.Checked = Convert.ToBoolean(transactionStatus.IsCash); } foreach (TestAllocation objTest in lst) { foreach (GridViewRow row in dgvAllTests.Rows) { if (Convert.ToInt32(dgvAllTests.DataKeys[row.RowIndex].Value) == objTest.TestId) { CheckBox chk = (CheckBox)row.FindControl("chkSelect"); chk.Checked = true; break; } } } } BtnUpdate.Visible = true; BtnSave.Visible = false; MultiView1.SetActiveView(View1); } else { lblMsg.Text = "Patient Is Already Discharged"; } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
protected void btnSearch_Click(object sender, EventArgs e) { try { List <EntityTestInvoice> tblPatient = new clsTestAllocation().GetTestInvoiceList(txtSearch.Text); Session["TestInvoice"] = tblPatient; dgvTestInvoice.DataSource = tblPatient; dgvTestInvoice.DataBind(); } catch (Exception ex) { lblMsg.Text = ex.Message; } }
private void GetInvoiceList() { try { List <EntityTestInvoice> tblPatient = new clsTestAllocation().GetTestInvoiceList(); dgvTestInvoice.DataSource = tblPatient; Session["TestInvoice"] = tblPatient; dgvTestInvoice.DataBind(); } catch (Exception ex) { lblMessage.Text = ex.Message; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (dgvAllTests.Rows.Count == 0) { lblMessage.Text = "Please Add Test before Allocate to Patient."; ddlPatient.Focus(); return; } List <TestAllocation> lst = new List <TestAllocation>(); tblTestInvoice obj = new tblTestInvoice(); obj.Amount = Convert.ToDecimal(txtNetAmount.Text); obj.Discount = Convert.ToDecimal(txtDiscountAmt.Text); obj.PatientId = Convert.ToInt32(ddlPatient.SelectedValue); obj.TestInvoiceDate = Convert.ToDateTime(txtAllocDate.Text); foreach (GridViewRow item in dgvAllTests.Rows) { CheckBox chk = (CheckBox)item.FindControl("chkSelect"); if (chk.Checked) { lst.Add(new TestAllocation() { IsTestDone = false, TestId = Convert.ToInt32(dgvAllTests.DataKeys[item.RowIndex].Value), Charges = Convert.ToDecimal(item.Cells[2].Text), TestInvoiceNo = Convert.ToInt32(Session["TestInvoiceId"]) }); } } bool IsCash = chkIsCash.Checked ? true : false; int i = new clsTestAllocation().Save(lst, obj, IsCash); lblMsg.Text = "Record Saved Successfully"; BindTests(); GetInvoiceList(); //Response.Redirect("frmNewIPDPatient.aspx", false); } catch (Exception ex) { lblMsg.Text = ex.Message; } MultiView1.SetActiveView(View2); }
private void BindPatients() { try { List <EntityPatientMaster> tblPatient = new clsTestAllocation().GetPatientListForDischarge(); 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; } }