public int ShiftToIPD(int AdmitId) { int i = 0; try { tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.AdmitId == AdmitId && tbl.IsDelete == false select tbl).FirstOrDefault(); if (admit != null) { admit.IsIPD = true; admit.IsOPD = false; admit.PatientType = "IPD"; objData.SubmitChanges(); i++; } } catch (Exception ex) { i = 0; throw ex; } return(i); }
protected void BtnSave_Click(object sender, EventArgs e) { tblOTMedicineBill tblins = new tblOTMedicineBill(); tblins.AdmitId = Convert.ToInt32(ddlPatient.SelectedValue); tblins.Bill_Date = Convert.ToDateTime(txtBillDate.Text); tblins.TotalAmount = Convert.ToDecimal(txtTotal.Text); tblPatientAdmitDetail objFac = MobjClaim.GetEmployee(Convert.ToInt32(ddlPatient.SelectedValue)); if (objFac != null) { List <EntityOTMedicineBillDetails> inslst = (List <EntityOTMedicineBillDetails>)Session["Charges"]; int ClaimId = Convert.ToInt32(MobjClaim.Save(tblins, inslst)); lblMessage.Text = "Record Saved Successfully....."; Session["Charges"] = null; Clear(); inslst = new List <EntityOTMedicineBillDetails>(); dgvChargeDetails.DataSource = inslst; dgvChargeDetails.DataBind(); lblMsg.Text = string.Empty; } else { lblMsg.Text = "Invalid Patient"; } Session["Charges"] = new List <EntityOTMedicineBillDetails>(); BindPrescription(); MultiView1.SetActiveView(View1); }
public decimal GetPatientBillAmount(int Pat_Id) { List <tblCustomerTransaction> lstTrans = new List <tblCustomerTransaction>(); decimal FinalAmount = 0; try { tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.AdmitId == Pat_Id select tbl).FirstOrDefault(); if (admit != null) { List <tblPatientAdmitDetail> lst = (from tbl in objData.tblPatientAdmitDetails where tbl.PatientId == admit.PatientId select tbl).ToList(); foreach (tblPatientAdmitDetail item in lst) { lstTrans.AddRange(from tbl in objData.tblCustomerTransactions where tbl.PatientId == item.PatientId select tbl); } FinalAmount = Convert.ToDecimal(lstTrans.Sum(p => p.BillAmount)); } } catch (Exception ex) { throw ex; } return(FinalAmount); }
protected void BtnSave_Click(object sender, EventArgs e) { try { tblInsuranceClaim tblins = new tblInsuranceClaim(); tblins.AdmitId = Convert.ToInt32(ddlPatient.SelectedValue); tblins.CompanyId = Convert.ToInt32(ddlInsuranceComName.SelectedValue); tblins.ClaimDate = Convert.ToDateTime(txtClaimDate.Text); tblins.Total = Convert.ToDecimal(txtClaimAmount.Text); tblPatientAdmitDetail objFac = MobjClaim.GetEmployee(Convert.ToInt32(ddlPatient.SelectedValue)); if (objFac != null) { tblInsuranceClaim objExist = MobjClaim.CheckExistRecord(objFac.AdmitId); if (objExist == null) { if (MobjClaim.ValidateAllocation(tblins)) { List <EntityinsuranceClaimDetails> inslst = (List <EntityinsuranceClaimDetails>)Session["Charges"]; int ClaimId = Convert.ToInt32(MobjClaim.Save(tblins, inslst)); lblMessage.Text = "Record Saved Successfully....."; Clear(); Session["Charges"] = null; } } else { Clear(); List <EntityinsuranceClaimDetails> lst = new List <EntityinsuranceClaimDetails>(); dgvChargeDetails.DataSource = lst; dgvChargeDetails.DataBind(); lblMsg.Text = string.Empty; MultiView1.SetActiveView(View1); lblMessage.Text = "Insurance Is Already Allocated To Patient!!"; } } else { lblMsg.Text = "Invalid Patient"; } Session["Charges"] = new List <EntityinsuranceClaimDetails>(); BindInsuranceClaim(); } catch (Exception ex) { lblMessage.Text = ex.Message; } MultiView1.SetActiveView(View1); }
protected void BtnSave_Click(object sender, EventArgs e) { tblPrescription tblins = new tblPrescription(); tblins.DeptCategory = Convert.ToInt32(ddlDeptCategory.SelectedValue); tblins.DeptDoctor = txtDeptCat.Text; tblins.AdmitId = Convert.ToInt32(ddlPatient.SelectedValue); tblins.Prescription_Date = Convert.ToDateTime(txtPrescriptionDate.Text); tblins.IsDressing = chkDress.Checked; tblins.IsInjection = chkInject.Checked; if (chkInject.Checked) { tblins.InjectionName = txtInjection.Text; } tblins.Investigation = Convert.ToString(txtInvestigation.Text); tblins.Impression = Convert.ToString(txtImpression.Text); tblins.AdviceNote = Convert.ToString(txtAdviceNote.Text); tblins.Remarks = Convert.ToString(txtRemarks.Text); tblPatientAdmitDetail objFac = MobjClaim.GetEmployee(Convert.ToInt32(ddlPatient.SelectedValue)); if (objFac != null) { List <EntityPrescriptionDetails> inslst = (List <EntityPrescriptionDetails>)Session["Charges"]; int ClaimId = Convert.ToInt32(MobjClaim.Save(tblins, inslst)); lblMessage.Text = "Record Saved Successfully....."; Session["Charges"] = null; chkDress.Checked = false; chkInject.Checked = false; txtInjection.Text = string.Empty; txtInvestigation.Text = string.Empty; txtImpression.Text = string.Empty; txtAdviceNote.Text = string.Empty; txtRemarks.Text = string.Empty; InjectionPara(chkInject.Checked); Clear(); inslst = new List <EntityPrescriptionDetails>(); dgvChargeDetails.DataSource = inslst; dgvChargeDetails.DataBind(); lblMsg.Text = string.Empty; InjectionPara(chkInject.Checked); } else { lblMsg.Text = "Invalid Patient"; } Session["Charges"] = new List <EntityPrescriptionDetails>(); BindPrescription(); MultiView1.SetActiveView(View1); }
public decimal GetPatientTrans(int Pat_Id) { List <tblCustomerTransaction> lstTrans = new List <tblCustomerTransaction>(); List <tblCustomerTransaction> lstRefund = new List <tblCustomerTransaction>(); decimal FinalAmount = 0; try { tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.AdmitId == Pat_Id select tbl).FirstOrDefault(); if (admit != null) { List <tblPatientAdmitDetail> lst = (from tbl in objData.tblPatientAdmitDetails where tbl.PatientId == admit.PatientId select tbl).ToList(); foreach (tblPatientAdmitDetail item in lst) { lstTrans.AddRange(from tbl in objData.tblCustomerTransactions where tbl.PatientId == item.PatientId && tbl.TransactionType != "Refund" select tbl); } foreach (tblPatientAdmitDetail item in lst) { lstRefund.AddRange(from tbl in objData.tblCustomerTransactions where tbl.PatientId == item.AdmitId && tbl.TransactionType.Equals("Refund") select tbl); } if (lstTrans.Sum(p => p.BillAmount) > 0) { FinalAmount = Convert.ToDecimal(lstTrans.Sum(p => p.BillAmount)) - Convert.ToDecimal(lstTrans.Sum(p => p.PayAmount)) - Convert.ToDecimal(lstRefund.Sum(p => p.PayAmount)); } else { FinalAmount = Convert.ToDecimal(lstTrans.Sum(p => p.PayAmount) - Convert.ToDecimal(lstRefund.Sum(p => p.PayAmount))); } } } catch (Exception ex) { throw ex; } return(FinalAmount); }
public int Save(EntityPatientAdmit admit) { int i = 0; try { tblPatientAdmitDetail objAdmit = new tblPatientAdmitDetail() { AdmitDate = admit.AdmitDate, AdmitTime = admit.PatientAdmitTime, CompanyId = admit.CompanyId, InsuranceComId = admit.InsuranceComId, CompanyName = admit.CompanyName, InsuranceName = admit.InsuName, IsCompany = admit.IsCompany, IsDelete = false, IsDischarge = false, IsInsured = admit.IsInsured, IsIPD = admit.IsIPD, IsOPD = admit.IsOPD, PatientType = admit.PatientType, PatientId = admit.PatientId, Dignosys = admit.Dignosys, Age = admit.Age, Weight = admit.Weight, AgeIn = admit.AgeIn, IPDNo = admit.IPDNo, OPDNo = admit.OPDNo, DeptCategory = admit.DeptCategory, DeptDoctorId = admit.DeptDoctorId }; objData.tblPatientAdmitDetails.InsertOnSubmit(objAdmit); objData.SubmitChanges(); i = 1; } catch (Exception ex) { throw ex; } return(i);; }
public int UpdatePatient(EntityPatientAdmit entAdmit) { int cnt = 0; try { tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.AdmitId == entAdmit.AdmitId && tbl.IsDischarge == false select tbl).FirstOrDefault(); if (admit != null) { admit.CompanyId = entAdmit.CompanyId; admit.IsCompany = entAdmit.IsCompany; admit.IsInsured = entAdmit.IsInsured; admit.IsIPD = entAdmit.IsIPD; admit.PatientType = entAdmit.PatientType; admit.IsOPD = entAdmit.IsOPD; admit.PatientId = entAdmit.PatientId; admit.InsuranceComId = entAdmit.InsuranceComId; admit.Age = entAdmit.Age; admit.Weight = entAdmit.Weight; admit.AgeIn = entAdmit.AgeIn; admit.IPDNo = entAdmit.IPDNo; admit.OPDNo = entAdmit.OPDNo; admit.Dignosys = entAdmit.Dignosys; admit.DeptCategory = entAdmit.DeptCategory; admit.DeptDoctorId = entAdmit.DeptDoctorId; admit.InsuranceName = entAdmit.InsuName; admit.CompanyName = entAdmit.CompanyName; } objData.SubmitChanges(); cnt++; } catch (Exception ex) { throw ex; } return(cnt); }
public int UpdateInvoice(EntityPatientInvoice entInvoice, List <EntityInvoiceDetails> lst) { int i = 0; try { tblPatientInvoice objTest = (from tbl in objData.tblPatientInvoices where tbl.IsDelete == false && tbl.BillNo == entInvoice.BillNo select tbl).FirstOrDefault(); if (objTest != null) { objTest.Amount = entInvoice.Amount; objTest.BillType = entInvoice.BillType; objTest.NetAmount = entInvoice.NetAmount; objTest.TotalAdvance = entInvoice.TotalAdvance; objTest.BalanceAmount = entInvoice.BalanceAmount; objTest.ReceivedAmount = entInvoice.ReceivedAmount; objTest.RefundAmount = entInvoice.RefundAmount; objTest.FixedDiscount = entInvoice.FixedDiscount; objTest.PreparedByName = entInvoice.PreparedByName; //objTest.Service = entInvoice.Service; //objTest.Vat = entInvoice.Vat; if (entInvoice.BillType != "Estimated") { int TransactionId = GetTransactionId(); if (entInvoice.IsCash) { tblCustomerTransaction objDebit = new tblCustomerTransaction() { TransactionId = TransactionId, IsCash = true, TransactionDocNo = entInvoice.BillNo, TransactionType = "Invoice", BillAmount = entInvoice.NetAmount, PayAmount = entInvoice.NetAmount, Discount = entInvoice.FixedDiscount, PatientId = entInvoice.PatientId, PreparedByName = entInvoice.PreparedByName, IsDelete = false, ReceiptDate = entInvoice.BillDate, }; objData.tblCustomerTransactions.InsertOnSubmit(objDebit); } else { tblCustomerTransaction objDebit = new tblCustomerTransaction() { TransactionId = TransactionId, IsCash = false, TransactionDocNo = entInvoice.BillNo, TransactionType = "Invoice", BillAmount = entInvoice.NetAmount, Discount = entInvoice.FixedDiscount, PatientId = entInvoice.PatientId, PreparedByName = entInvoice.PreparedByName, IsDelete = false, ReceiptDate = entInvoice.BillDate, }; objData.tblCustomerTransactions.InsertOnSubmit(objDebit); //objData.SubmitChanges(); } } else { List <tblCustomerTransaction> objCust = (from tbl in objData.tblCustomerTransactions where tbl.IsDelete == false && tbl.TransactionDocNo == entInvoice.BillNo && tbl.TransactionType == "Invoice" select tbl).ToList(); if (objCust != null) { if (objCust.Count == 1) { if (entInvoice.IsCash) { tblCustomerTransaction objC = new tblCustomerTransaction() { PayAmount = entInvoice.NetAmount, BillAmount = entInvoice.NetAmount, Discount = entInvoice.FixedDiscount, ReceiptDate = entInvoice.BillDate, IsCash = entInvoice.IsCash, IsDelete = false, TransactionDocNo = entInvoice.BillNo, TransactionId = objCust[0].TransactionId, TransactionType = "Invoice", PatientId = entInvoice.PatientId, PreparedByName = entInvoice.PreparedByName, }; objData.tblCustomerTransactions.InsertOnSubmit(objC); foreach (tblCustomerTransaction item in objCust) { item.BillAmount = entInvoice.NetAmount; item.ReceiptDate = entInvoice.BillDate; item.IsCash = entInvoice.IsCash; if (item.IsCash == false) { if (item.PayAmount > 0) { item.IsDelete = true; } } else { item.PayAmount = 0; } } } else { foreach (tblCustomerTransaction item in objCust) { item.BillAmount = entInvoice.NetAmount; item.ReceiptDate = entInvoice.BillDate; item.IsCash = entInvoice.IsCash; if (item.IsCash == false) { if (item.PayAmount > 0) { item.IsDelete = true; } } else { if (item.PayAmount > 0) { item.PayAmount = entInvoice.NetAmount; } else { item.PayAmount = 0; } } } } } else { foreach (tblCustomerTransaction item in objCust) { item.BillAmount = entInvoice.NetAmount; item.ReceiptDate = entInvoice.BillDate; item.IsCash = entInvoice.IsCash; if (item.IsCash == false) { if (item.PayAmount > 0) { item.IsDelete = true; } } else { if (item.PayAmount > 0) { item.PayAmount = entInvoice.NetAmount; } else { item.PayAmount = 0; } } } } } } foreach (EntityInvoiceDetails item in lst) { if (item.BillSRNo > 0) { tblPatientInvoiceDetail cnt = (from tbl in objData.tblPatientInvoiceDetails where tbl.BillNo == item.BillNo && tbl.BillSRNo == item.BillSRNo && tbl.IsDelete == false select tbl).FirstOrDefault(); if (cnt != null) { cnt.BillNo = entInvoice.BillNo; cnt.Quantity = item.Quantity; cnt.NoOfDays = item.NoOfDays; cnt.Remarks = item.Remarks; cnt.Amount = item.Amount; cnt.ChargePerDay = item.PerDayCharge; cnt.OtherChargesId = item.OtherChargesId; cnt.IsDelete = item.IsDelete; } } else { tblPatientInvoiceDetail objNewAdded = new tblPatientInvoiceDetail() { BillNo = entInvoice.BillNo, BedAllocId = item.BedAllocId, OTAllocId = item.OTBedAllocId, DocAllocId = item.DocAllocationId, OtherChargesId = item.OtherChargesId, Amount = item.Amount, ChargePerDay = item.PerDayCharge, NetAmount = item.NetAmount, Remarks = item.Remarks, NoOfDays = item.NoOfDays, Quantity = item.Quantity, IsDelete = false }; objData.tblPatientInvoiceDetails.InsertOnSubmit(objNewAdded); if (entInvoice.BillType == "Original") { if (objNewAdded.BedAllocId > 0) { int p = new BedStatusBLL().DischargePatient(entInvoice.PatientId, entInvoice.BillDate); } } } } tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.IsDelete == false && tbl.AdmitId == entInvoice.PatientId select tbl).FirstOrDefault(); if (entInvoice.BillType == "Estimated") { if (admit != null) { admit.IsDischarge = false; } } if (entInvoice.BillType == "Original") { if (admit != null) { admit.IsDischarge = true; } } objData.SubmitChanges(); } i++; } catch (Exception ex) { i = 0; throw ex; } return(i); }
public int InsertInvoice(EntityPatientInvoice entInvoice, List <EntityInvoiceDetails> lstInvoice, bool IsCash) { try { int?BillNo = 0; objData.STP_InsertInvoice(Convert.ToDateTime(entInvoice.BillDate), ref BillNo, Convert.ToString(entInvoice.BillType), Convert.ToInt32(entInvoice.PatientId), Convert.ToString(entInvoice.PreparedByName), Convert.ToDecimal(entInvoice.Amount), Convert.ToDecimal(entInvoice.Discount), //Convert.ToDecimal(entInvoice.Vat), Convert.ToDecimal(entInvoice.Service), Convert.ToDecimal(entInvoice.NetAmount), Convert.ToDecimal(entInvoice.TotalAdvance), Convert.ToDecimal(entInvoice.BalanceAmount), Convert.ToDecimal(entInvoice.ReceivedAmount), Convert.ToDecimal(entInvoice.RefundAmount), true, Convert.ToDecimal(entInvoice.FixedDiscount)); foreach (EntityInvoiceDetails entInvoiceDetails in lstInvoice) { tblPatientInvoiceDetail obj = new tblPatientInvoiceDetail() { BillNo = BillNo, BedAllocId = entInvoiceDetails.BedAllocId, OTAllocId = entInvoiceDetails.OTBedAllocId, DocAllocId = entInvoiceDetails.DocAllocationId, OtherChargesId = entInvoiceDetails.OtherChargesId, Amount = entInvoiceDetails.Amount, NetAmount = entInvoice.NetAmount, ChargePerDay = entInvoiceDetails.PerDayCharge, Remarks = entInvoiceDetails.Remarks, NoOfDays = entInvoiceDetails.NoOfDays, Quantity = entInvoiceDetails.Quantity, IsDelete = false }; objData.tblPatientInvoiceDetails.InsertOnSubmit(obj); if (entInvoice.BillType == "Original") { if (entInvoiceDetails.BedAllocId > 0) { int i = new BedStatusBLL().DischargePatient(entInvoice.PatientId, entInvoice.BillDate); } } } //int i = new BedStatusBLL().DischargePatient(entInvoiceDetails.PatientID, entInvoice.BillDate); if (entInvoice.BillType != "Estimated") { int TransactionId = GetTransactionId(); if (IsCash) { tblCustomerTransaction objDebit = new tblCustomerTransaction() { TransactionId = TransactionId, IsCash = true, TransactionDocNo = BillNo, TransactionType = "Invoice", BillAmount = entInvoice.NetAmount, PayAmount = entInvoice.NetAmount, Discount = entInvoice.FixedDiscount, PatientId = entInvoice.PatientId, PreparedByName = entInvoice.PreparedByName, IsDelete = false, ReceiptDate = entInvoice.BillDate, }; objData.tblCustomerTransactions.InsertOnSubmit(objDebit); //objData.SubmitChanges(); //tblCustomerTransaction objCrReceipt = new tblCustomerTransaction() //{ // TransactionId = TransactionId, // IsCash = true, // TransactionDocNo = BillNo, // TransactionType = "Invoice", // PayAmount = entInvoice.NetAmount, // BillAmount=0, // PatientId = entInvoice.PatientId, // IsDelete = false, // ReceiptDate = entInvoice.BillDate, //}; //objData.tblCustomerTransactions.InsertOnSubmit(objCrReceipt); //objData.SubmitChanges(); } else { tblCustomerTransaction objDebit = new tblCustomerTransaction() { TransactionId = TransactionId, IsCash = false, TransactionDocNo = BillNo, TransactionType = "Invoice", BillAmount = entInvoice.NetAmount, Discount = entInvoice.FixedDiscount, PatientId = entInvoice.PatientId, PreparedByName = entInvoice.PreparedByName, IsDelete = false, ReceiptDate = entInvoice.BillDate, }; objData.tblCustomerTransactions.InsertOnSubmit(objDebit); //objData.SubmitChanges(); } } tblPatientAdmitDetail admit = (from tbl in objData.tblPatientAdmitDetails where tbl.IsDelete == false && tbl.IsDischarge == false && tbl.AdmitId == entInvoice.PatientId select tbl).FirstOrDefault(); if (entInvoice.BillType == "Estimated") { if (admit != null) { admit.IsDischarge = false; } } if (entInvoice.BillType == "Original") { if (admit != null) { admit.IsDischarge = true; } //if (admit != null && entInvoice.PatientType == "OPD") //{ // admit.IsDischarge = false; //} } objData.SubmitChanges(); return(1); } catch (Exception ex) { throw ex; } }