Esempio n. 1
0
 internal int InsertPatientSummary(HMS_PatientCollectionSummary objSummary)
 {
     try
     {
         _context.HMS_PatientCollectionSummary.AddObject(objSummary);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        protected void btnBillAdd_Click(object sender, EventArgs e)
        {
            if (txtReceiveAmt.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Receive Amount !!')", true);
            }
            else if (txtCollectionDate.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please input Collection Date !!')", true);
            }
            else
            {
                int patId = Convert.ToInt32(txtId.Text);

                var visDate = (from date in _context.HMS_PatientInfo
                               where date.PatientID == patId
                               select date).First();


                HMS_PatientCollectionSummary objBill = new HMS_PatientCollectionSummary();

                objBill.OCODE = ((SessionUser)Session["SessionUser"]).OCode;

                objBill.PatientID             = Convert.ToInt32(txtId.Text);
                objBill.CollectionDate        = Convert.ToDateTime(txtCollectionDate.Text);
                objBill.CollectionAmount      = Convert.ToDecimal(txtReceiveAmt.Text);
                objBill.ServiceCharge_Percent = Convert.ToDecimal(txtServiceAmt.Text);
                objBill.Discount_Percent      = Convert.ToDecimal(txtDiscountAmt.Text);

                if (txtDischargDate.Text != "")
                {
                    DateTime dischrg = Convert.ToDateTime(txtDischargDate.Text);
                    objBill.DisChargeDate = dischrg;
                    TimeSpan difference = dischrg - Convert.ToDateTime(visDate.VisitDate);
                    var      days       = difference.TotalDays;
                    objBill.Duration = days.ToString();
                }

                objBill.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                objBill.Create_Date = DateTime.Now;
                int result = obj_Bll.InsertCollectionBill(objBill);

                if (result == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully !')", true);
                    int pat_Id = Convert.ToInt32(txtId.Text);
                    BillCalculation(pat_Id);
                    ClearBillUi();
                }
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 internal int InsertCollectionBill(HMS_PatientCollectionSummary objColBill)
 {
     return(objBill_DAL.InsertCollectionBill(objColBill));
 }
Esempio n. 5
0
 internal int InsertPatientSummary(HMS_PatientCollectionSummary objSummary)
 {
     return(objPatient_DAL.InsertPatientSummary(objSummary));
 }