public void SetPatientBillingInfo(PatientBilling Pat_BillInfo) { objNLog.Info("Function Started with Pat_BillInfo"); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); try { SqlCommand cmd = new SqlCommand("sp_set_PatientBillingInfo", sqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter Pat_ID = cmd.Parameters.Add("@Pat_ID", SqlDbType.Int); Pat_ID.Value = Pat_BillInfo.PatID; SqlParameter Trans_Date = cmd.Parameters.Add("@TransDate", SqlDbType.DateTime); Trans_Date.Value = DateTime.Parse(Pat_BillInfo.TransactionDate); SqlParameter Trans_Type = cmd.Parameters.Add("@TransType", SqlDbType.Char,1); Trans_Type.Value = Pat_BillInfo.TransactionType; SqlParameter Trans_Mode = cmd.Parameters.Add("@TransMode", SqlDbType.Char, 1); Trans_Mode.Value = Pat_BillInfo.TransactionMode; SqlParameter Trans_Amt = cmd.Parameters.Add("@TransAmt", SqlDbType.VarChar); Trans_Amt.Value = Pat_BillInfo.TransactionAmount; SqlParameter Trans_Det = cmd.Parameters.Add("@TransDet", SqlDbType.VarChar); Trans_Det.Value = Pat_BillInfo.TransactionDetails; SqlParameter Last_ModifiedBy = cmd.Parameters.Add("@LastModifiedBy", SqlDbType.VarChar); Last_ModifiedBy.Value = Pat_BillInfo.User; SqlParameter Trans_SysFlag = cmd.Parameters.Add("@Trans_SysFlag", SqlDbType.VarChar,50); Trans_SysFlag.Value = Pat_BillInfo.TransSysFlag; sqlCon.Open(); cmd.ExecuteNonQuery(); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Inserting Patient Billing Info.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Inserting Patient Med Info.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); }
protected void imgBtnSaveBilling_Click(object sender, ImageClickEventArgs e) { objNLog.Info("Function Started..."); try { string userID = (string)Session["User"]; PatientBilling objPatBill = new PatientBilling(); PatientInfoDAL objPatInfo = new PatientInfoDAL(); objPatBill.PatID = int.Parse(hidPatID.Value); objPatBill.TransactionDate = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"); if(rbtnPAPFilling.Checked==true) objPatBill.TransactionType= 'P'; else objPatBill.TransactionType='S'; if(chkTimeBilling.Checked==true) objPatBill.TransactionMode='Y'; else objPatBill.TransactionMode = 'N'; objPatBill.TransactionAmount=txtTransAmt.Text; objPatBill.TransactionDetails=txtTransDetails.Text; objPatBill.User = userID; if (chkRx30Patient.Checked) objPatBill.TransSysFlag = "P"; else objPatBill.TransSysFlag = "R"; objPatInfo.SetPatientBillingInfo(objPatBill); FillPatientBillingGrid(); ClearBillingPanel(); } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function completed..."); }
protected void btnSaveAdjBill_Click(object sender, ImageClickEventArgs e) { objNLog.Info("Function Started..."); try { string userID = (string)Session["User"]; PatientBilling objPatBill = new PatientBilling(); PatientInfoDAL objPatInfo = new PatientInfoDAL(); objPatBill.PatID = int.Parse(hidPatID.Value); objPatBill.TransactionDate = lblTransAdjDate.Text; if (rbtnCredit.Checked == true) objPatBill.TransactionType = 'C'; else objPatBill.TransactionType = 'D'; objPatBill.TransactionFlag='A'; objPatBill.TransactionAmount = txtAdjBillAmt.Text; objPatBill.TransactionDetails = txtAdjBillDetails.Text; objPatBill.User = userID; if (chkRx30Patient.Checked) objPatBill.TransSysFlag = "P"; else objPatBill.TransSysFlag = "R"; objPatInfo.SetPatientAdjustBillingInfo(objPatBill); FillPatientBillingGrid(); ClearBillingAdjustmentPanel(); } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function completed..."); }
public ActionResult BillingLog(BillingModel billingModel) { if (ModelState.IsValid) { var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]); // check captcha code is valid or not bool isCaptchaCodeValid = false; string ReCaptchaMessage = ""; if (billingModel.BillingID == 0)// Code for Add Billing details { if (UserId > 0) { isCaptchaCodeValid = true; } else { isCaptchaCodeValid = CommonFunctions.GetCaptchaResponse(Request.Form["recaptcha_challenge_field"], Request.Form["recaptcha_response_field"], billingModel.CaptchaSecretkey.ToString(), out ReCaptchaMessage); } if (isCaptchaCodeValid) { int patientBillingID = 0; using (MbprosEntities mbprosEntities = new MbprosEntities()) { patientBillingID = Common.CommonFunctions.GetNextPatientBillingID(); for (int i = 1; i <= 15; i++) { if (!string.IsNullOrEmpty(Request.Form["PatientName" + i])) { PatientBilling patientBilling = new PatientBilling(); patientBilling.PatientBillingID = patientBillingID; patientBilling.OfficeName = billingModel.OfficeName; patientBilling.PatientName = Request.Form["PatientName" + i]; if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i])) { patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture); } patientBilling.CoPayType = Request.Form["CopayType" + i]; if (!string.IsNullOrEmpty(patientBilling.CoPayType)) { patientBilling.ChequeNo = Request.Form["ChequeNo" + i]; patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]); } patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i]; patientBilling.DXCode = Request.Form["NewDXCodes" + i]; patientBilling.SrNo = i; patientBilling.CreatedDate = DateTime.Now.Date; patientBilling.CreatedBy = UserId; patientBilling.Active = true; patientBilling.IsArchived = false; patientBilling.Note = billingModel.AdditionalComments; mbprosEntities.PatientBillings.Add(patientBilling); } } mbprosEntities.SaveChanges(); } ViewBag.ReCaptchaMessage = ""; return(RedirectToAction("Confirmation", "Billing", new { billingFormID = patientBillingID, officeName = billingModel.OfficeName })); } else { ViewBag.ReCaptchaMessage = ReCaptchaMessage; } } else// Code for edit Billing details { // here we will have to add 3 codes first for edit existing , other for add new if not exist in DB and one for for deleting if user deletes exisitng record. MbprosEntities mbprosEntities = new MbprosEntities(); var billDetails = mbprosEntities.PatientBillings.Where(x => x.PatientBillingID == billingModel.BillingID); int patientBillingID = 0; for (int i = 1; i <= 15; i++) { PatientBilling objBilling = billDetails.Where(x => x.SrNo == i).FirstOrDefault(); if (!string.IsNullOrEmpty(Request.Form["PatientName" + i])) { if (objBilling != null) // it means update the record. { if (i == 1) { patientBillingID = objBilling.PatientBillingID; } objBilling.OfficeName = billingModel.OfficeName; objBilling.PatientName = Request.Form["PatientName" + i]; if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i])) { objBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture); } objBilling.CoPayType = Request.Form["CopayType" + i]; if (!string.IsNullOrEmpty(objBilling.CoPayType)) { objBilling.ChequeNo = Request.Form["ChequeNo" + i]; objBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]); } objBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i]; objBilling.DXCode = Request.Form["NewDXCodes" + i]; objBilling.SrNo = i; objBilling.Active = true; objBilling.Note = billingModel.AdditionalComments; objBilling.BillingFormID = objBilling.BillingFormID; objBilling.UpdatedDate = DateTime.Now; objBilling.UpdatedBy = UserId; mbprosEntities.Entry(objBilling).State = System.Data.Entity.EntityState.Modified; mbprosEntities.SaveChanges(); } else { // 2 conditions add PatientBilling patientBilling = new PatientBilling(); patientBilling.PatientBillingID = patientBillingID; patientBilling.OfficeName = billingModel.OfficeName; patientBilling.PatientName = Request.Form["PatientName" + i]; if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i])) { patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture); } patientBilling.CoPayType = Request.Form["CopayType" + i]; if (!string.IsNullOrEmpty(patientBilling.CoPayType)) { patientBilling.ChequeNo = Request.Form["ChequeNo" + i]; patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]); } patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i]; patientBilling.DXCode = Request.Form["NewDXCodes" + i]; patientBilling.SrNo = i; patientBilling.Active = true; patientBilling.Note = billingModel.AdditionalComments; patientBilling.CreatedDate = DateTime.Now.Date; patientBilling.CreatedBy = UserId; patientBilling.IsArchived = false; mbprosEntities.PatientBillings.Add(patientBilling); mbprosEntities.SaveChanges(); } } else { if (objBilling != null) // it means delete the record. { mbprosEntities.PatientBillings.Attach(objBilling); mbprosEntities.PatientBillings.Remove(objBilling); mbprosEntities.SaveChanges(); } } } TempData["EditMessage"] = "Y"; return(RedirectToAction(billingModel.CallFrom, "Search", new { editMessage = "Patient billing details updated successfully", IsBack = true })); } } return(View(billingModel)); }