protected void btnAdd_Click(object sender, EventArgs e) { if (ddlCategory.SelectedItem.Text == "--Select--") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Category !!')", true); } else if (ddlHead.SelectedItem.Text == "--Select--") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Bill Head !!')", true); } else if (txtId.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Patient ID !!')", true); } else if (txtCollectionDate.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Collection Date !!')", true); } else if (txtQty.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Quantity !!')", true); } else if (txtTotalAmt.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Total Amount !!')", true); } else { HMS_PatientBillInfo objBill = new HMS_PatientBillInfo(); objBill.OCODE = ((SessionUser)Session["SessionUser"]).OCode; objBill.PatientId = Convert.ToInt32(txtId.Text); objBill.Bill_Category_Id = Convert.ToInt32(ddlCategory.SelectedValue.ToString()); objBill.Bill_Head_Id = Convert.ToInt32(ddlHead.SelectedValue.ToString()); objBill.Amount = Convert.ToDecimal(txtPrice.Text); objBill.CollectionDate = Convert.ToDateTime(txtCollectionDate.Text); objBill.Qty = Convert.ToInt32(txtQty.Text); objBill.TotalAmount = Convert.ToDecimal(txtTotalAmt.Text); objBill.Create_User = ((SessionUser)Session["SessionUser"]).UserId; objBill.Create_Date = DateTime.Now; int result = obj_Bll.InsertPatientBill(objBill); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully !')", true); int id = Convert.ToInt32(txtId.Text); BillCalculation(id); ClearPatient_BillUi(); GetPatient_BillInfo(); } } }
internal int InsertPatientBill(HMS_PatientBillInfo objbill) { try { _context.HMS_PatientBillInfo.AddObject(objbill); _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (btnSubmit.Text == "Submit") { if (txtPatientName.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Patient Name !!')", true); } else if (ddlGender.SelectedItem.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Gender !!')", true); } else if (ddlBloodGrp.SelectedItem.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Blood Group !!')", true); } else if (txtAge.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Age!!')", true); } else if (txtMobile.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Mobile !!')", true); } else if (txtVisitDate.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Visit Date!!')", true); } else { HMS_PatientInfo objPatient = new HMS_PatientInfo(); objPatient.OCODE = ((SessionUser)Session["SessionUser"]).OCode; objPatient.PatientName = txtPatientName.Text; objPatient.Age = txtAge.Text; objPatient.M_Y_D = ddlAgeFormat.SelectedItem.Text; objPatient.Gender = ddlGender.SelectedItem.Text; objPatient.BloodGroup = ddlBloodGrp.SelectedItem.Text; objPatient.MaritalStatus = ddlMarital.SelectedItem.Text; objPatient.Mobile = txtMobile.Text; objPatient.Address = txtAddress.Text; objPatient.GuardianName = txtGuardian.Text; objPatient.GuardianContactNo = txtEmerContact.Text; objPatient.VisitDate = Convert.ToDateTime(txtVisitDate.Text); objPatient.BillCategoryId = Convert.ToInt32(ddlCategory.SelectedValue.ToString()); objPatient.BillHeadId = Convert.ToInt32(ddlHead.SelectedValue.ToString()); objPatient.Amount = Convert.ToDecimal(txtAmount.Text); objPatient.Bed_CabinNo = txtBedNo.Text; objPatient.RefdBy = txtRefdBy.Text; objPatient.Remarks = txtRemarks.Text; objPatient.Create_User = ((SessionUser)Session["SessionUser"]).UserId; objPatient.Create_Date = DateTime.Now; int result = objPatient_Bll.InsertPatient(objPatient); if (result == 1) { HMS_PatientCollectionSummary objSummary = new HMS_PatientCollectionSummary(); Session["Patient_Id"] = objPatient.PatientID; objSummary.PatientID = objPatient.PatientID; objSummary.CollectionDate = Convert.ToDateTime(txtVisitDate.Text); objSummary.CollectionAmount = Convert.ToDecimal(txtAmount.Text); objSummary.AdvanceAmount = Convert.ToDecimal(txtAmount.Text); objSummary.Discount_Percent = 0; objSummary.ServiceCharge_Percent = 0; objSummary.Create_User = ((SessionUser)Session["SessionUser"]).UserId; objSummary.Create_Date = DateTime.Now; objSummary.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int aResult = objPatient_Bll.InsertPatientSummary(objSummary); //---------------------------------------------------------- HMS_PatientBillInfo objBill = new HMS_PatientBillInfo(); objBill.PatientId = objPatient.PatientID; objBill.Bill_Category_Id = Convert.ToInt32(ddlCategory.SelectedValue.ToString());; objBill.Bill_Head_Id = Convert.ToInt32(ddlHead.SelectedValue.ToString()); objBill.CollectionDate = Convert.ToDateTime(txtVisitDate.Text); objBill.Amount = Convert.ToDecimal(txtAmount.Text); objBill.Qty = 1; objBill.TotalAmount = Convert.ToDecimal(txtAmount.Text); objBill.Create_User = ((SessionUser)Session["SessionUser"]).UserId; objBill.Create_Date = DateTime.Now; objBill.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int bResult = objPatient_Bll.InsertPatientBill(objBill); //--------------------------------------------------------------- if (bResult == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully !')", true); btnSubmit.Text = "Print"; } } } } else { gridPatient.Visible = false; string OCODE = ((SessionUser)Session["SessionUser"]).OCode; int _patientId = Convert.ToInt32(Session["Patient_Id"]); var Patient = objPatient_Bll.GetPatientInfoForReport(_patientId, OCODE).ToList(); if (Patient.Count > 0) { Session["rptDs"] = "ds_PatientInfo"; Session["rptDt"] = Patient; Session["rptFile"] = "/HMS/reports/HMS_Rpt_PatientInfo.rdlc"; // Session["rptTitle"] = "Patient Money Receipt"; string rptDs = Convert.ToString(Session["rptDs"]); var reportDataSource = new ReportDataSource { Name = rptDs, Value = Session["rptDt"] }; ReportViewer2.LocalReport.DataSources.Clear(); ReportViewer2.LocalReport.DataSources.Add(reportDataSource); ReportViewer2.LocalReport.ReportPath = Server.MapPath(Convert.ToString(Session["rptFile"])); //ReportParameter prm_1 = new ReportParameter("datePrint", Convert.ToString(DateTime.Now.Date)); //ReportParameter prm_2 = new ReportParameter("rptTitle", Convert.ToString(Session["rptTitle"])); //ReportViewer2.LocalReport.SetParameters(new ReportParameter[] { prm_1, prm_2 }); ReportViewer2.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); } } GetPatientInfo(); ClearPatientInfo(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
internal int InsertPatientBill(HMS_PatientBillInfo objBill) { return(objBill_DAL.InsertPatientBill(objBill)); }