protected void Page_Load(object sender, EventArgs e) {//Logging Start string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { if (Request.QueryString["caseid"] != null && Request.QueryString["cmpid"] != null) { string szCaseID = Request.QueryString["caseid"].ToString(); string szCompanyID = Request.QueryString["cmpid"].ToString(); DataSet ds = new DataSet(); MUVGenerateFunction objSettings = new MUVGenerateFunction(); ds = GetPatienView(szCaseID, szCompanyID); string szfirstname = ""; string szlastname = ""; if (ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString() != "") { szfirstname = ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString(); szfirstname = szfirstname.Replace(" ", string.Empty); szfirstname = szfirstname.Replace(".", string.Empty); szfirstname = szfirstname.Replace(",", string.Empty); } if (ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString() != "") { szlastname = ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString(); szlastname = szlastname.Replace(" ", string.Empty); szlastname = szlastname.Replace(".", string.Empty); szlastname = szlastname.Replace(",", string.Empty); } string path = ApplicationSettings.GetParameterValue("PatientInfoSaveFilePath"); string OpenFilepath = ApplicationSettings.GetParameterValue("PatientInfoOpenFilePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = szfirstname.Trim() + "_" + szlastname.Trim() + "_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; string pdfPath = path + newPdfFilename; MemoryStream m = new MemoryStream(); iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20); float[] wBase = { 4f }; PdfPTable tblBase = new PdfPTable(wBase); tblBase.DefaultCell.Border = Rectangle.NO_BORDER; tblBase.WidthPercentage = 100; PdfWriter writer = PdfWriter.GetInstance(document, m); document.Open(); #region "for printed by" float[] width = { 4f, 4f }; PdfPTable tblprintby = new PdfPTable(width); tblprintby.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblprintby.DefaultCell.Border = Rectangle.NO_BORDER; tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblprintby.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_TOP; tblprintby.AddCell(new Phrase("Printed By : " + ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblprintby); #endregion tblBase.AddCell(" "); #region "for patient information" float[] wdh = { 4f }; PdfPTable tblheading = new PdfPTable(wdh); tblheading.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblheading.DefaultCell.Border = Rectangle.NO_BORDER; tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER; tblheading.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE; tblheading.AddCell(new Phrase("Patient Information", iTextSharp.text.FontFactory.GetFont("Arial", 14, Font.BOLD, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblheading); #endregion #region for Personal Information float[] w11 = { 3f, 3f, 3f, 3f }; PdfPTable table = new PdfPTable(w11); table.WidthPercentage = 100; table.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell1 = new PdfPCell(new Phrase("Personal Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell1.Colspan = 4; cell1.BackgroundColor = Color.LIGHT_GRAY; cell1.BorderColor = Color.BLACK; table.AddCell(cell1); table.AddCell(new Phrase("First Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Middle Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["MI"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["MI"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Last Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("D.O.B", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DOB"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DOB"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Gender", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_GENDER"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_GENDER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_ADDRESS"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("City", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_CITY"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_CITY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("State", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_STATE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_STATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Cell Phone #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["sz_patient_cellno"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["sz_patient_cellno"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Home Phone", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_PHONE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Work", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_WORK_PHONE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_WORK_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Zip", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_ZIP"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_ZIP"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Email", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_EMAIL"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_EMAIL"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Extn.", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_WORK_PHONE_EXTENSION"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_WORK_PHONE_EXTENSION"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Attorney", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ATTORNEY"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ATTORNEY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Case Type", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CASE_TYPE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CASE_TYPE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Attorney Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ATTORNEY_ADDRESS"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ATTORNEY_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Attorney Phone", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["sz_attorney_phone"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["sz_attorney_phone"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Case Status", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CASE_STATUS"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CASE_STATUS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("SSN", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_SOCIAL_SECURITY_NO"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_SOCIAL_SECURITY_NO"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } PdfPCell cell2 = new PdfPCell(new Phrase("")); cell2.Colspan = 2; cell2.BorderColor = Color.BLACK; table.AddCell(cell2); tblBase.AddCell(table); #endregion tblBase.AddCell(" "); #region for Insurance Information float[] wd1 = { 3f, 3f, 3f, 3f }; PdfPTable tblInsurance = new PdfPTable(wd1); tblInsurance.WidthPercentage = 100; tblInsurance.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell3 = new PdfPCell(new Phrase("Insurance Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell3.Colspan = 4; cell3.BorderColor = Color.BLACK; cell3.BackgroundColor = Color.LIGHT_GRAY; tblInsurance.AddCell(cell3); tblInsurance.AddCell(new Phrase("Policy Holder", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_POLICY_HOLDER"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_POLICY_HOLDER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_ADDRESS"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("City", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_CITY"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_CITY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("State", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_STATE"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_STATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Zip", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_ZIP"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_ZIP"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Phone", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_PHONE"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Fax", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_FAX_NUMBER"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_FAX_NUMBER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Contact Person", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CONTACT_PERSON"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CONTACT_PERSON"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Claim File #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CLAIM_NUMBER"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CLAIM_NUMBER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblInsurance.AddCell(new Phrase("Policy #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_POLICY_NUMBER"].ToString() != "") { tblInsurance.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_POLICY_NUMBER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } PdfPCell cell14 = new PdfPCell(new Phrase("")); cell14.Colspan = 2; cell14.BorderColor = Color.BLACK; tblInsurance.AddCell(cell14); tblBase.AddCell(tblInsurance); #endregion tblBase.AddCell(" "); #region for Accident Information float[] wd2 = { 3f, 3f, 3f, 3f }; PdfPTable tblAccident = new PdfPTable(wd2); tblAccident.WidthPercentage = 100; tblAccident.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell4 = new PdfPCell(new Phrase("Accident Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell4.Colspan = 4; cell4.BorderColor = Color.BLACK; cell4.BackgroundColor = Color.LIGHT_GRAY; tblAccident.AddCell(cell4); tblAccident.AddCell(new Phrase("Accident Date", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DT_ACCIDENT_DATE"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DT_ACCIDENT_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Plate Number", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PLATE_NO"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PLATE_NO"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Report Number", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_REPORT_NO"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_REPORT_NO"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ACCIDENT_ADDRESS"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ACCIDENT_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("City", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ACCIDENT_CITY"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ACCIDENT_CITY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("State", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ACCIDENT_INSURANCE_STATE"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ACCIDENT_INSURANCE_STATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Hospital Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_HOSPITAL_NAME"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_HOSPITAL_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Hospital Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_HOSPITAL_ADDRESS"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_HOSPITAL_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Date of Admission", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DT_ADMISSION_DATE"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DT_ADMISSION_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Additional Patient", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_FROM_CAR"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_FROM_CAR"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Describe Injury", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_DESCRIBE_INJURY"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_DESCRIBE_INJURY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAccident.AddCell(new Phrase("Patient Type", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_TYPE"].ToString() != "") { tblAccident.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_TYPE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAccident.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblBase.AddCell(tblAccident); #endregion tblBase.AddCell(" "); #region for Employer Information float[] wd3 = { 3f, 3f, 3f, 3f }; PdfPTable tblEmployer = new PdfPTable(wd3); tblEmployer.WidthPercentage = 100; tblEmployer.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell5 = new PdfPCell(new Phrase("Employer Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell5.Colspan = 4; cell5.BorderColor = Color.BLACK; cell5.BackgroundColor = Color.LIGHT_GRAY; tblEmployer.AddCell(cell5); tblEmployer.AddCell(new Phrase("Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_NAME"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_ADDRESS"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("City", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_CITY"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_CITY"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("State", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_STATE"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_STATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("Zip", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_ZIP"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_ZIP"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("Phone", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMPLOYER_PHONE"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMPLOYER_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("Date of First Treatment", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DT_FIRST_TREATMENT"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DT_FIRST_TREATMENT"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblEmployer.AddCell(new Phrase("Chart #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CHART_NO"].ToString() != "") { tblEmployer.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CHART_NO"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblEmployer.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblBase.AddCell(tblEmployer); #endregion tblBase.AddCell(" "); #region for Adjuster Information float[] wd4 = { 3f, 3f, 3f, 3f }; PdfPTable tblAdjuster = new PdfPTable(wd4); tblAdjuster.WidthPercentage = 100; tblAdjuster.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell6 = new PdfPCell(new Phrase("Adjuster Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell6.Colspan = 4; cell6.BorderColor = Color.BLACK; cell6.BackgroundColor = Color.LIGHT_GRAY; tblAdjuster.AddCell(cell6); tblAdjuster.AddCell(new Phrase("Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_ADJUSTER_NAME"].ToString() != "") { tblAdjuster.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_ADJUSTER_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAdjuster.AddCell(new Phrase("Phone", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PHONE"].ToString() != "") { tblAdjuster.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAdjuster.AddCell(new Phrase("Extension", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EXTENSION"].ToString() != "") { tblAdjuster.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EXTENSION"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAdjuster.AddCell(new Phrase("Fax", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_FAX"].ToString() != "") { tblAdjuster.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_FAX"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblAdjuster.AddCell(new Phrase("Email", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_EMAIL"].ToString() != "") { tblAdjuster.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_EMAIL"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } PdfPCell cell7 = new PdfPCell(new Phrase("")); cell7.Colspan = 2; cell7.BorderColor = Color.BLACK; tblAdjuster.AddCell(cell7); tblBase.AddCell(tblAdjuster); #endregion tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); #region "for websource information" float[] wd5 = { 4f }; PdfPTable tblSource = new PdfPTable(wd5); tblSource.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblSource.DefaultCell.Border = Rectangle.NO_BORDER; tblSource.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblSource.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM; if (ds.Tables[0].Rows[0]["SZ_WEBSOURCE"].ToString() != "") { tblSource.AddCell(new Phrase("Source : " + ds.Tables[0].Rows[0]["SZ_WEBSOURCE"].ToString(), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblAdjuster.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } tblBase.AddCell(tblSource); #endregion document.Add(tblBase); document.Close(); System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer()); string OpenPdfFilepath = OpenFilepath + newPdfFilename; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "sandeep", "<script type='text/javascript'>window.location.href='" + OpenPdfFilepath + "'</script>"); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void btnPrint_Click(object sender, EventArgs e) { string patientname = ""; ArrayList arr = new ArrayList(); DataSet dt = new DataSet(); // DataSet dtorderlist = new DataSet(); DrugDAO obj = new DrugDAO(); DrugDAO drgobj = new DrugDAO(); //drugrs drgobj = new drugrs(); DrugReport objdrugreport = new DrugReport(); SrvDrugrs srvobj = new SrvDrugrs(); dt = (DataSet)srvobj.GetDrugReports(((Bill_Sys_CaseObject)(Session["CASE_OBJECT"])).SZ_CASE_ID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); if (dt.Tables[0].Rows.Count > 0) { //dtorderlist = (DataSet)srvobj.GetDeliveryOrderList(); //if (dtorderlist.Tables[0].Rows.Count > 0) //{ drgobj.sz_company_name = dt.Tables[0].Rows[0]["SZ_COMPANY_NAME"].ToString(); drgobj.sz_company_name_address = dt.Tables[0].Rows[0]["SZ_ADDRESS_STREET"].ToString(); drgobj.sz_city = dt.Tables[0].Rows[0]["SZ_ADDRESS_CITY"].ToString(); drgobj.sz_state = dt.Tables[0].Rows[0]["SZ_ADDRESS_STATE"].ToString(); drgobj.sz_zip = dt.Tables[0].Rows[0]["SZ_ADDRESS_ZIP"].ToString(); drgobj.sz_tel = "718 299 4400"; drgobj.sz_fax = "718 299 4700"; drgobj.sz_patient_name = dt.Tables[0].Rows[0]["PATIENT FIRSTNAME"].ToString() + " " + dt.Tables[0].Rows[0]["PATIENT LASTNAME"].ToString(); patientname = dt.Tables[0].Rows[0]["PATIENT FIRSTNAME"].ToString() + "_" + dt.Tables[0].Rows[0]["PATIENT LASTNAME"].ToString(); drgobj.sz_patient_address = dt.Tables[0].Rows[0]["ADDRESS OF PATIENT"].ToString(); //for (int i = 0; i < dtorderlist.Tables[0].Rows.Count; i++) //{ // drugorderlist drgorderlist = new drugorderlist(); // drgorderlist.ordernumber = dtorderlist.Tables[0].Rows[i]["SZ_PROCEDURE_CODE"].ToString(); // drgorderlist.ordereddrug = dtorderlist.Tables[0].Rows[i]["SZ_CODE_DESCRIPTION"].ToString(); // arr.Add(drgorderlist); //} string dateofacc = String.Format("{0:mm/dd/yyyy}", dt.Tables[0].Rows[0]["DT_DATE_OF_ACCIDENT"].ToString()); drgobj.date_of_accident = dateofacc; drgobj.sz_Ins_Co = dt.Tables[0].Rows[0]["INSURANCE CARRIER"].ToString(); // string sFilePath = "D:\\LawAllies\\Drug.pdf"; MUVGenerateFunction objSettings = new MUVGenerateFunction(); string path = objSettings.getApplicationSetting("PatientInfoSaveFilePath"); string OpenFilepath = objSettings.getApplicationSetting("PatientInfoOpenFilePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = patientname + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; //string newPdfFilename ="DrugReport.pdf"; string pdfPath = path + newPdfFilename; DataTable dtFinalPrint = (DataTable)Session["printtable"]; objdrugreport.GenerateDrugReport(pdfPath, drgobj, txtFromDate.Text, dtFinalPrint); //objdrugreport.GenerateDrugReport(pdfPath, drgobj, arr, txtFromDate.Text,dtFinalPrint); // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "mm", "<script language='javascript'>alert('ok done');</script>"); string OpenPdfFilepath = OpenFilepath + newPdfFilename; //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "sandeep", "<script type='text/javascript'>window.location.href='" + OpenPdfFilepath + "'</script>"); ScriptManager.RegisterClientScriptBlock(this, GetType(), "kk", "window.open('" + OpenPdfFilepath + "')", true); //objdrugreport.GenerateDrugReport(sFilePath, drgobj, arr); //// MessageBox.Show("PDF Generated"); //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "mm", "<script language='javascript'>alert('ok done');</script>"); //} } }
public string GeneratePVTBill(bool isReferingFacility, string szCompanyId, string szCaseId, string szSpecility, string szCompanyName, string szBillId, string szUserName, string szUserId, ServerConnection conn) { string szDefaultPath = ""; string szReturnPath = ""; try { log.Debug("in GeneratePVTBill"); objNF3Template = new Bill_Sys_NF3_Template(); _bill_Sys_BillTransaction = new Bill_Sys_BillTransaction_BO(); #region Generate Bill For Private cases String szLastPDFFileName = ""; String szDestinationDir = ""; //changes for Doc manager for new Bill path -- pravin objVerification_Desc = new Bill_Sys_Verification_Desc(); log.Debug("create Bill_Sys_Verification_Desc object"); objVerification_Desc.sz_bill_no = szBillId; objVerification_Desc.sz_company_id = szCompanyId; objVerification_Desc.sz_flag = "BILL"; ArrayList arrNf_Para = new ArrayList(); ArrayList arrNf_NodeType = new ArrayList(); objCaseDetailsBO = new CaseDetailsBO(); DataSet ds1500from = new DataSet(); string sz_Type = ""; string bt_1500_Form = ""; arrNf_Para.Add(objVerification_Desc); arrNf_NodeType = _bill_Sys_BillTransaction.Get_Node_Type(arrNf_Para, conn); log.Debug("called _bill_Sys_BillTransaction "); log.Debug("arrNf_NodeType =" + arrNf_NodeType); if (arrNf_NodeType.Contains("NFVER")) { sz_Type = "OLD"; szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Bills/" + szSpecility + "/"; } else { sz_Type = "NEW"; szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Medicals/" + szSpecility + "/" + "Bills/"; } //szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Bills/" + szSpecility + "/"; String szSourceDir = ""; szSourceDir = szCompanyName + "/" + szCaseId + "/Packet Document/"; log.Debug("szSourceDir =" + szSourceDir); //changes for Add only 1500 Form For Insurance Company -- pravin ds1500from = objCaseDetailsBO.Get1500FormBitForInsurance(szCompanyId, szBillId, conn); if (ds1500from.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1500from.Tables[0].Rows.Count; i++) { bt_1500_Form = ds1500from.Tables[0].Rows[i]["BT_1500_FORM"].ToString(); } } if (bt_1500_Form == "1") { string str_1500 = ""; _MUVGenerateFunction = new MUVGenerateFunction(); //str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString()); string szOriginalTemplatePDFFileName = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString(); Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace(); str_1500 = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId, szCompanyId, conn); if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + str_1500)) { if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir)) { Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir); } File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500); } szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + str_1500; ArrayList objAL = new ArrayList(); if (sz_Type == "OLD") { objAL.Add(szBillId); objAL.Add(szDestinationDir + str_1500); objAL.Add(szCompanyId); objAL.Add(szCaseId); objAL.Add(str_1500); objAL.Add(szDestinationDir); objAL.Add(szUserName); objAL.Add(szSpecility); //objAL.Add(""); objAL.Add("PVT"); objAL.Add(szCaseId); //objAL.Add(txtCaseNo.Text); objNF3Template.saveGeneratedBillPath(objAL, conn); } else { objAL.Add(szBillId); objAL.Add(szDestinationDir + str_1500); objAL.Add(szCompanyId); objAL.Add(szCaseId); objAL.Add(str_1500); objAL.Add(szDestinationDir); objAL.Add(szUserName); objAL.Add(szSpecility); //objAL.Add(""); objAL.Add("PVT"); objAL.Add(szCaseId); objAL.Add(arrNf_NodeType[0].ToString()); objNF3Template.saveGeneratedBillPath_New(objAL, conn); } // Start : Save Notes for Bill. _DAO_NOTES_EO = new DAO_NOTES_EO(); _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; _DAO_NOTES_EO.SZ_ACTIVITY_DESC = str_1500; _DAO_NOTES_BO = new DAO_NOTES_BO(); _DAO_NOTES_EO.SZ_USER_ID = szUserId; _DAO_NOTES_EO.SZ_CASE_ID = szCaseId; _DAO_NOTES_EO.SZ_COMPANY_ID = szCompanyId; _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO); } else { String szGenereatedFileName = ""; objPDFReplacement = new PDFValueReplacement.PDFValueReplacement(); string szXMLFileName; string szOriginalPDFFileName; szXMLFileName = ConfigurationManager.AppSettings["HCFA1500_XML_FILE"].ToString(); string path = GetPdfFilePath() + szCompanyId + "/HCFA -1500.pdf"; log.Debug("szXMLFileName =" + szXMLFileName); log.Debug("path =" + path); if (File.Exists(path)) { szOriginalPDFFileName = path; } else { szOriginalPDFFileName = ConfigurationManager.AppSettings["HCFA1500_PDF_FILE"].ToString(); } String szPDFPage = ""; log.Debug("Before PdfValue ReplacePDFvalues"); string szOriginalTemplatePDFFileName = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString(); Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace(); szPDFPage = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId, szCompanyId, conn); //szPDFPage = objPDFReplacement.ReplacePDFvalues(szXMLFileName, szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId); log.Debug("after PdfValue ReplacePDFvalues"); log.Debug("szPDFPage" + szPDFPage); #region File saving logic String szOpenFilePath = ""; szGenereatedFileName = szDestinationDir + szPDFPage; log.Debug("szGenereatedFileName" + szGenereatedFileName); szOpenFilePath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szGenereatedFileName; log.Debug("szOpenFilePath" + szOpenFilePath); string szFileNameWithFullPath = objNF3Template.getPhysicalPath() + "/" + szGenereatedFileName; log.Debug("szFileNameWithFullPath" + szFileNameWithFullPath); string szFileNameForSaving = ""; szReturnPath = szOpenFilePath; log.Debug("szReturnPath" + szReturnPath); // Save Entry in Table if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString())) { szGenereatedFileName = szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString(); } log.Debug("szGenereatedFileName" + szGenereatedFileName); // End if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_NewMerge.pdf").ToString())) { szFileNameForSaving = szOpenFilePath.Replace(".pdf", "_NewMerge.pdf").ToString(); //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.Replace(".pdf", "_NewMerge.pdf").ToString() + "'); ", true); } else { if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString())) { szFileNameForSaving = szOpenFilePath.Replace(".pdf", "_New.pdf").ToString(); //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.Replace(".pdf", "_New.pdf").ToString() + "'); ", true); } else { szFileNameForSaving = szOpenFilePath.ToString(); //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.ToString() + "'); ", true); } } log.Debug("szFileNameForSaving" + szFileNameForSaving); String[] szTemp; string szBillName = ""; szTemp = szFileNameForSaving.Split('/'); log.Debug("szTemp" + szTemp); ArrayList objAL = new ArrayList(); szFileNameForSaving = szFileNameForSaving.Remove(0, ApplicationSettings.GetParameterValue("DocumentManagerURL").Length); log.Debug("szFileNameForSaving" + szFileNameForSaving); szBillName = szTemp[szTemp.Length - 1].ToString(); log.Debug("szBillName" + szBillName); string bt_CaseType, bt_include, str_1500; string strComp = szCompanyId.ToString(); _MUVGenerateFunction = new MUVGenerateFunction(); if (System.Configuration.ConfigurationManager.AppSettings["Only_1500_in_PVT_Bill"].ToString() == "true") { str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString(), conn); log.Debug("str_1500" + str_1500); if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + str_1500)) { if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir)) { Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir); } File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500); } szBillName = str_1500; //szBillName = str_1500.Replace(".pdf", "_MER.pdf"); szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + szBillName; log.Debug("szReturnPath" + szReturnPath); } else { log.Debug("bjNF3Template.getPhysicalPath() + szSourceDir + szBillName" + objNF3Template.getPhysicalPath() + szSourceDir + szBillName); if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + szBillName)) { if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir)) { Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir); } File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + szBillName, objNF3Template.getPhysicalPath() + szDestinationDir + szBillName); } //Tushar bt_include = _MUVGenerateFunction.get_bt_include(strComp, szSpecility, "", "Speciality"); log.Debug("bt_include" + bt_include); bt_CaseType = _MUVGenerateFunction.get_bt_include(strComp, "", "WC000000000000000003", "CaseType"); log.Debug("bt_CaseType" + bt_CaseType); if (bt_include == "True" && bt_CaseType == "True") { str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString(), conn); MergePDF.MergePDFFiles(objNF3Template.getPhysicalPath() + szDestinationDir + szBillName, objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500.Replace(".pdf", "_MER.pdf")); szBillName = str_1500.Replace(".pdf", "_MER.pdf"); szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + szBillName; } log.Debug("szReturnPath" + szReturnPath); } //changes for Doc manager for new Bill path -- pravin if (sz_Type == "OLD") { objAL.Add(szBillId); objAL.Add(szDestinationDir + szBillName); objAL.Add(szCompanyId); objAL.Add(szCaseId); objAL.Add(szBillName); objAL.Add(szDestinationDir); objAL.Add(szUserName); objAL.Add(szSpecility); //objAL.Add(""); objAL.Add("PVT"); objAL.Add(szCaseId); //objAL.Add(txtCaseNo.Text); objNF3Template.saveGeneratedBillPath(objAL, conn); } else { objAL.Add(szBillId); objAL.Add(szDestinationDir + szBillName); objAL.Add(szCompanyId); objAL.Add(szCaseId); objAL.Add(szBillName); objAL.Add(szDestinationDir); objAL.Add(szUserName); objAL.Add(szSpecility); //objAL.Add(""); objAL.Add("PVT"); objAL.Add(szCaseId); objAL.Add(arrNf_NodeType[0].ToString()); objNF3Template.saveGeneratedBillPath_New(objAL, conn); } // Start : Save Notes for Bill. _DAO_NOTES_EO = new DAO_NOTES_EO(); _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; _DAO_NOTES_EO.SZ_ACTIVITY_DESC = szBillName; _DAO_NOTES_BO = new DAO_NOTES_BO(); _DAO_NOTES_EO.SZ_USER_ID = szUserId; _DAO_NOTES_EO.SZ_CASE_ID = szCaseId; _DAO_NOTES_EO.SZ_COMPANY_ID = szCompanyId; _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO); #endregion //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + ApplicationSettings.GetParameterValue("DocumentManagerURL") + szPDFPage + "'); ", true); #endregion } } catch (Exception ex) { throw new Exception(ex.Message, ex); } return(szReturnPath); }
protected void Page_Load(object sender, EventArgs e) {//Logging Start string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { if (Request.QueryString["caseid"] != null && Request.QueryString["cmpid"] != null) { string szCaseID = Request.QueryString["caseid"].ToString(); string szCompanyID = Request.QueryString["cmpid"].ToString(); DataSet ds = new DataSet(); MUVGenerateFunction objSettings = new MUVGenerateFunction(); ds = GetPatienView(szCaseID, szCompanyID); string szfirstname = ""; string szlastname = ""; if (ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString() != "") { szfirstname = ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString(); szfirstname = szfirstname.Replace(" ", string.Empty); szfirstname = szfirstname.Replace(".", string.Empty); szfirstname = szfirstname.Replace(",", string.Empty); } if (ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString() != "") { szlastname = ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString(); szlastname = szlastname.Replace(" ", string.Empty); szlastname = szlastname.Replace(".", string.Empty); szlastname = szlastname.Replace(",", string.Empty); } string path = objSettings.getApplicationSetting("PatientInfoSaveFilePath"); string OpenFilepath = objSettings.getApplicationSetting("PatientInfoOpenFilePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = szfirstname.Trim() + "_" + szlastname.Trim() + "_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; string pdfPath = path + newPdfFilename; MemoryStream m = new MemoryStream(); iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20); float[] wBase = { 4f }; PdfPTable tblBase = new PdfPTable(wBase); tblBase.DefaultCell.Border = Rectangle.NO_BORDER; tblBase.WidthPercentage = 100; tblBase.AddCell(" "); PdfWriter writer = PdfWriter.GetInstance(document, m); document.Open(); #region "for printed by" float[] width = { 4f, 4f }; PdfPTable tblprintby = new PdfPTable(width); tblprintby.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblprintby.DefaultCell.Border = Rectangle.NO_BORDER; tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblprintby.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_TOP; tblprintby.AddCell(new Phrase("Printed By : " + ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblprintby); #endregion tblBase.AddCell(" "); #region "for patient information" float[] wdh = { 4f }; PdfPTable tblheading = new PdfPTable(wdh); tblheading.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblheading.DefaultCell.Border = Rectangle.NO_BORDER; tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER; tblheading.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE; tblheading.AddCell(new Phrase("Visit Details", iTextSharp.text.FontFactory.GetFont("Arial", 14, Font.BOLD, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblheading); #endregion #region for Patient Information float[] w11 = { 3f, 3f, 3f, 3f }; PdfPTable table = new PdfPTable(w11); table.WidthPercentage = 100; table.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell1 = new PdfPCell(new Phrase("Patient Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell1.Colspan = 4; cell1.BackgroundColor = Color.LIGHT_GRAY; cell1.BorderColor = Color.BLACK; table.AddCell(cell1); table.AddCell(new Phrase("First Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_FIRST_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Middle Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["MI"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["MI"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Last Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("D.O.B", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DOB"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DOB"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Address", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_ADDRESS"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_ADDRESS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Phone No", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_PATIENT_PHONE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_PATIENT_PHONE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("SSN", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_SOCIAL_SECURITY_NO"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_SOCIAL_SECURITY_NO"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Location", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_LOCATION_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_LOCATION_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Policy Holder", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_POLICY_HOLDER"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_POLICY_HOLDER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Insurance Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Claim No", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_CLAIM_NUMBER"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_CLAIM_NUMBER"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Accident Date", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["DT_ADMISSION_DATE"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["DT_ADMISSION_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } PdfPCell cell2 = new PdfPCell(new Phrase("")); cell2.Colspan = 2; cell2.BorderColor = Color.BLACK; table.AddCell(cell2); tblBase.AddCell(table); #endregion tblBase.AddCell(" "); #region for Visit Information DataSet ds3 = new DataSet(); ds3 = GetPatienVisitInfo(szCaseID, szCompanyID); int flag = 0; int checkstart = 0; int count = 0; int fix = 25; int start = 0; int end = 0; count = ds3.Tables[0].Rows.Count; while (flag == 0) { if (start == 0) { end = 25; if (count <= 25) { end = count; flag = 1; } } else { start = end; end = end + 30; if (end >= count) { end = count; flag = 1; } } float[] wd1 = { 1.5f, 4f, 1.5f, 1.5f, 4f, 3f, 1.2f }; PdfPTable tblVisit = new PdfPTable(wd1); tblVisit.WidthPercentage = 100; tblVisit.DefaultCell.BorderColor = Color.BLACK; tblVisit = genratesVisitTable(start, end, ds3); tblBase.AddCell(tblVisit); if (checkstart == 0) { checkstart = 1; start = 1; } } #endregion tblBase.AddCell(" "); document.Add(tblBase); document.Close(); System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer()); string OpenPdfFilepath = OpenFilepath + newPdfFilename; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "sandeep", "<script type='text/javascript'>window.location.href='" + OpenPdfFilepath + "'</script>"); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void Page_Load(object sender, EventArgs e) { string billNo = Request.QueryString["billNo"]; string companyId = Request.QueryString["companyId"]; string caseType = Request.QueryString["caseType"]; string caseId = Request.QueryString["caseId"]; string caseNo = Request.QueryString["caseNo"]; string userId = Request.QueryString["userId"]; string userName = Request.QueryString["userName"]; string pdfType = Request.QueryString["pdfType"]; string compName = ""; this._bill_Sys_BillingCompanyDetails_BO = new Bill_Sys_BillingCompanyDetails_BO(); try { DataSet ds = this._bill_Sys_BillingCompanyDetails_BO.GetBillingCompanyInfo(companyId); compName = ds.Tables[0].Rows[0]["SZ_COMPANY_NAME"].ToString(); } catch { } this._bill_Sys_BillTransaction = new Bill_Sys_BillTransaction_BO(); ServerConnection currentConnection = BeginBillTranaction(); if (caseType == "WC000000000000000002") { this.GenerateAddedBillPDF(billNo, caseId, caseNo, companyId, compName, userId, userName, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection), currentConnection); } if (caseType == "WC000000000000000003") { this.GenerateAddedBillPDF(billNo, caseId, caseNo, companyId, compName, userId, userName, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection), currentConnection); } else if (caseType == "WC000000000000000001") { WC_Bill_Generation generation = new WC_Bill_Generation(); this._bill_Sys_BillTransaction = new Bill_Sys_BillTransaction_BO(); generation.GeneratePDFForWorkerComp(billNo, caseId, pdfType, companyId, compName, userId, userName, caseNo, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId), 0); } if (caseType == "WC000000000000000004") { string str5; this.objNF3Template = new Bill_Sys_NF3_Template(); Lien lien = new Lien(); this._MUVGenerateFunction = new MUVGenerateFunction(); string doctorSpeciality = this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection); string str7 = companyId; billNo = billNo; this.objVerification_Desc = new Bill_Sys_Verification_Desc(); this.objVerification_Desc.sz_bill_no = billNo; this.objVerification_Desc.sz_company_id = companyId; this.objVerification_Desc.sz_flag = "BILL"; ArrayList list5 = new ArrayList(); ArrayList list6 = new ArrayList(); string str8 = ""; string str9 = ""; list5.Add(this.objVerification_Desc); list6 = this._bill_Sys_BillTransaction.Get_Node_Type(list5, currentConnection); if (list6.Contains("NFVER")) { str8 = "OLD"; str9 = compName + "/" + caseId + "/No Fault File/Bills/" + doctorSpeciality + "/"; } else { str8 = "NEW"; str9 = compName + "/" + caseId + "/No Fault File/Medicals/" + doctorSpeciality + "/Bills/"; } string str10 = compName + "/" + caseId + "/Packet Document/"; this.objCaseDetailsBO = new CaseDetailsBO(); DataSet set = new DataSet(); string str11 = ""; set = this.objCaseDetailsBO.Get1500FormBitForInsurance(companyId, billNo, currentConnection); if (set.Tables[0].Rows.Count > 0) { for (int k = 0; k < set.Tables[0].Rows.Count; k++) { str11 = set.Tables[0].Rows[k]["BT_1500_FORM"].ToString(); } } if (str11 == "1") { string szOriginalTemplatePDFFileName = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString(); Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace(); this.str_1500 = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, billNo, compName, caseId, companyId, currentConnection); if (File.Exists(this.objNF3Template.getPhysicalPath() + str10 + this.str_1500)) { if (!Directory.Exists(this.objNF3Template.getPhysicalPath() + str9)) { Directory.CreateDirectory(this.objNF3Template.getPhysicalPath() + str9); } File.Copy(this.objNF3Template.getPhysicalPath() + str10 + this.str_1500, this.objNF3Template.getPhysicalPath() + str9 + this.str_1500); } str5 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str9 + this.str_1500; ArrayList list7 = new ArrayList(); if (str8 == "OLD") { list7.Add(billNo); list7.Add(str9 + this.str_1500); list7.Add(companyId); list7.Add(caseId); list7.Add(this.str_1500); list7.Add(str9); list7.Add(userName); list7.Add(doctorSpeciality); list7.Add("LN"); list7.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list7, currentConnection); } else { list7.Add(billNo); list7.Add(str9 + this.str_1500); list7.Add(companyId); list7.Add(caseId); list7.Add(this.str_1500); list7.Add(str9); list7.Add(userName); list7.Add(doctorSpeciality); list7.Add("LN"); list7.Add(caseNo); list7.Add(list6[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list7, currentConnection); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = this.str_1500; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); } else { string str12 = this._MUVGenerateFunction.get_bt_include(str7, doctorSpeciality, "", "Speciality"); string str13 = this._MUVGenerateFunction.get_bt_include(str7, "", "WC000000000000000004", "CaseType"); if ((str12 == "True") && (str13 == "True")) { string str14 = compName + "/" + caseId + "/Packet Document/"; string str15 = userId; string str16 = userName; this.str_1500 = this._MUVGenerateFunction.FillPdf(billNo, currentConnection); MergePDF.MergePDFFiles(this.objNF3Template.getPhysicalPath() + str9 + lien.GenratePdfForLienWithMuv(str7, billNo, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId), caseId, str16, caseNo, str15, currentConnection), this.objNF3Template.getPhysicalPath() + str14 + this.str_1500, this.objNF3Template.getPhysicalPath() + str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); str5 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str9 + this.str_1500.Replace(".pdf", "_MER.pdf"); ArrayList list8 = new ArrayList(); if (str8 == "OLD") { list8.Add(billNo); list8.Add(str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(companyId); list8.Add(caseId); list8.Add(this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(str9); list8.Add(userName); list8.Add(doctorSpeciality); list8.Add("LN"); list8.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list8, currentConnection); } else { list8.Add(billNo); list8.Add(str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(companyId); list8.Add(caseId); list8.Add(this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(str9); list8.Add(userName); list8.Add(doctorSpeciality); list8.Add("LN"); list8.Add(caseNo); list8.Add(list6[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list8, currentConnection); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = this.str_1500; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); } else { str5 = lien.GenratePdfForLien(companyId, billNo, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection), caseId, userName, caseNo, userId, currentConnection); } } //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Done", "window.open('" + str5 + "');", true); //ScriptManager.RegisterClientScriptBlock((Page)this, base.GetType(), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } else if (caseType == "WC000000000000000007") { string str5; this.objNF3Template = new Bill_Sys_NF3_Template(); Employer lien = new Employer(); this._MUVGenerateFunction = new MUVGenerateFunction(); string doctorSpeciality = this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection); string str7 = companyId; this.objVerification_Desc = new Bill_Sys_Verification_Desc(); this.objVerification_Desc.sz_bill_no = billNo; this.objVerification_Desc.sz_company_id = companyId; this.objVerification_Desc.sz_flag = "BILL"; ArrayList list5 = new ArrayList(); ArrayList list6 = new ArrayList(); string str8 = ""; string str9 = ""; list5.Add(this.objVerification_Desc); list6 = this._bill_Sys_BillTransaction.Get_Node_Type(list5, currentConnection); if (list6.Contains("NFVER")) { str8 = "OLD"; str9 = compName + "/" + caseId + "/No Fault File/Bills/" + doctorSpeciality + "/"; } else { str8 = "NEW"; str9 = compName + "/" + caseId + "/No Fault File/Medicals/" + doctorSpeciality + "/Bills/"; } string str10 = compName + "/" + caseId + "/Packet Document/"; this.objCaseDetailsBO = new CaseDetailsBO(); DataSet set = new DataSet(); string str11 = ""; set = this.objCaseDetailsBO.Get1500FormBitForInsurance(companyId, caseId, currentConnection); if (set.Tables[0].Rows.Count > 0) { for (int k = 0; k < set.Tables[0].Rows.Count; k++) { str11 = set.Tables[0].Rows[k]["BT_1500_FORM"].ToString(); } } if (str11 == "1") { string szOriginalTemplatePDFFileName = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString(); Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace(); this.str_1500 = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, caseId, compName, caseId, companyId, currentConnection); if (File.Exists(this.objNF3Template.getPhysicalPath() + str10 + this.str_1500)) { if (!Directory.Exists(this.objNF3Template.getPhysicalPath() + str9)) { Directory.CreateDirectory(this.objNF3Template.getPhysicalPath() + str9); } File.Copy(this.objNF3Template.getPhysicalPath() + str10 + this.str_1500, this.objNF3Template.getPhysicalPath() + str9 + this.str_1500); } str5 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str9 + this.str_1500; ArrayList list7 = new ArrayList(); if (str8 == "OLD") { list7.Add(caseId); list7.Add(str9 + this.str_1500); list7.Add(companyId); list7.Add(caseId); list7.Add(this.str_1500); list7.Add(str9); list7.Add(userName); list7.Add(doctorSpeciality); list7.Add("LN"); list7.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list7, currentConnection); } else { list7.Add(caseId); list7.Add(str9 + this.str_1500); list7.Add(companyId); list7.Add(caseId); list7.Add(this.str_1500); list7.Add(str9); list7.Add(userName); list7.Add(doctorSpeciality); list7.Add("LN"); list7.Add(caseNo); list7.Add(list6[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list7, currentConnection); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = this.str_1500; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); } else { string str12 = this._MUVGenerateFunction.get_bt_include(str7, doctorSpeciality, "", "Speciality"); string str13 = this._MUVGenerateFunction.get_bt_include(str7, "", "WC000000000000000007", "CaseType"); if ((str12 == "True") && (str13 == "True")) { string str14 = compName + "/" + caseId + "/Packet Document/"; string str15 = userId; string str16 = userName; this.str_1500 = this._MUVGenerateFunction.FillPdf(caseId, currentConnection); MergePDF.MergePDFFiles(this.objNF3Template.getPhysicalPath() + str9 + lien.GenratePdfForEmployerWithMuv(str7, billNo, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId), caseId, str16, caseNo, str15), this.objNF3Template.getPhysicalPath() + str14 + this.str_1500, this.objNF3Template.getPhysicalPath() + str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); str5 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str9 + this.str_1500.Replace(".pdf", "_MER.pdf"); ArrayList list8 = new ArrayList(); if (str8 == "OLD") { list8.Add(caseId); list8.Add(str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(companyId); list8.Add(caseId); list8.Add(this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(str9); list8.Add(userName); list8.Add(doctorSpeciality); list8.Add("LN"); list8.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list8, currentConnection); } else { list8.Add(caseId); list8.Add(str9 + this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(companyId); list8.Add(caseId); list8.Add(this.str_1500.Replace(".pdf", "_MER.pdf")); list8.Add(str9); list8.Add(userName); list8.Add(doctorSpeciality); list8.Add("LN"); list8.Add(caseNo); list8.Add(list6[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list8, currentConnection); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = this.str_1500; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); } else { str5 = lien.GenratePdfForEmployer(companyId, billNo, this._bill_Sys_BillTransaction.GetDoctorSpeciality(billNo, companyId, currentConnection), caseId, userName, caseNo, userId, currentConnection); } } //ScriptManager.RegisterClientScriptBlock((Page)this, base.GetType(), "Done", "window.open('" + str5 + "');", true); //ScriptManager.RegisterClientScriptBlock((Page)this, base.GetType(), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } }
private void GenerateAddedBillPDF(string p_szBillNumber, string caseId, string caseNo, string companyId, string compName, string userId, string userName, string p_szSpeciality, ServerConnection conn) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { this._MUVGenerateFunction = new MUVGenerateFunction(); string str = p_szSpeciality; // caseId = caseId; string billNo = p_szBillNumber; this.objNF3Template = new Bill_Sys_NF3_Template(); this.objVerification_Desc = new Bill_Sys_Verification_Desc(); this.objVerification_Desc.sz_bill_no = p_szBillNumber; this.objVerification_Desc.sz_company_id = companyId; this.objVerification_Desc.sz_flag = "BILL"; ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); string str2 = ""; string str3 = ""; string str4 = ""; list.Add(this.objVerification_Desc); list2 = this._bill_Sys_BillTransaction.Get_Node_Type(list, conn); if (list2.Contains("NFVER")) { str2 = "OLD"; str4 = compName + "/" + caseId + "/No Fault File/Bills/" + str + "/"; } else { str2 = "NEW"; str4 = compName + "/" + caseId + "/No Fault File/Medicals/" + str + "/Bills/"; } CaseDetailsBO sbo = new CaseDetailsBO(); string str5 = companyId; if (sbo.GetCaseType(billNo, conn) == "WC000000000000000002") { string str6 = compName + "/" + caseId + "/Packet Document/"; string str7 = compName + "/" + caseId + "/Packet Document/"; this.objCaseDetailsBO = new CaseDetailsBO(); DataSet set = new DataSet(); string str8 = ""; set = this.objCaseDetailsBO.Get1500FormBitForInsurance(companyId, p_szBillNumber, conn); if (set.Tables[0].Rows.Count > 0) { for (int i = 0; i < set.Tables[0].Rows.Count; i++) { str8 = set.Tables[0].Rows[i]["BT_1500_FORM"].ToString(); } } if (str8 == "1") { string szOriginalTemplatePDFFileName = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString(); Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace(); this.str_1500 = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, p_szBillNumber, compName, caseId, companyId, conn); ArrayList list3 = new ArrayList(); if (File.Exists(this.objNF3Template.getPhysicalPath() + str7 + this.str_1500)) { if (!Directory.Exists(this.objNF3Template.getPhysicalPath() + str4)) { Directory.CreateDirectory(this.objNF3Template.getPhysicalPath() + str4); } File.Copy(this.objNF3Template.getPhysicalPath() + str7 + this.str_1500, this.objNF3Template.getPhysicalPath() + str4 + this.str_1500); } str3 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str4 + this.str_1500; if (str2 == "OLD") { list3.Add(p_szBillNumber); list3.Add(str4 + this.str_1500); list3.Add(companyId); list3.Add(caseId); list3.Add(this.str_1500); list3.Add(str4); list3.Add(userName); list3.Add(str); list3.Add("NF"); list3.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list3, conn); } else { list3.Add(p_szBillNumber); list3.Add(str4 + this.str_1500); list3.Add(companyId); list3.Add(caseId); list3.Add(this.str_1500); list3.Add(str4); list3.Add(userName); list3.Add(str); list3.Add("NF"); list3.Add(caseNo); list3.Add(list2[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list3, conn); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = this.str_1500; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + str3.ToString() + "'); ", true); //ScriptManager.RegisterClientScriptBlock((Page)this, base.GetType(), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } else { string str9 = ConfigurationManager.AppSettings["DefaultTemplateName"].ToString(); ConfigurationManager.AppSettings["NextDiagnosisTemplate"].ToString(); ConfigurationSettings.AppSettings["NF3_PAGE3"].ToString(); ConfigurationSettings.AppSettings["NF3_PAGE4"].ToString(); Bill_Sys_Configuration configuration = new Bill_Sys_Configuration(); string str10 = configuration.getConfigurationSettings(str5, "GET_DIAG_PAGE_POSITION"); string str11 = configuration.getConfigurationSettings(str5, "DIAG_PAGE"); string str12 = ConfigurationManager.AppSettings["NF3_XML_FILE"].ToString(); string str13 = ConfigurationManager.AppSettings["NF3_PDF_FILE"].ToString(); string str14 = ConfigurationManager.AppSettings["NF33_XML_FILE"].ToString(); string str15 = ConfigurationManager.AppSettings["NF3_PAGE3"].ToString(); GenerateNF3PDF enfpdf = new GenerateNF3PDF(); this.objPDFReplacement = new PDFValueReplacement.PDFValueReplacement(); string str16 = enfpdf.GeneratePDF(companyId, compName, userId, userName, caseId, p_szBillNumber, "", str9, conn); log.Debug("Bill Details PDF File : " + str16); string str17 = this.objPDFReplacement.ReplacePDFvalues(str12, str13, p_szBillNumber, compName, caseId, conn); log.Debug("Page1 : " + str17); string str18 = this.objPDFReplacement.MergePDFFiles(companyId, compName, caseId, p_szBillNumber, str17, str16); string str19 = this.objPDFReplacement.ReplacePDFvalues(str14, str15, p_szBillNumber, compName, caseId, conn); string str20 = companyId; this.bt_include = this._MUVGenerateFunction.get_bt_include(str20, str, "", "Speciality"); string str21 = this._MUVGenerateFunction.get_bt_include(str20, "", "WC000000000000000002", "CaseType"); if ((this.bt_include == "True") && (str21 == "True")) { this.str_1500 = this._MUVGenerateFunction.FillPdf(p_szBillNumber, conn); } log.Debug(str18 + "merge : " + str19); MergePDF.MergePDFFiles(this.objNF3Template.getPhysicalPath() + str6 + str18, this.objNF3Template.getPhysicalPath() + str6 + str19, this.objNF3Template.getPhysicalPath() + str6 + str19.Replace(".pdf", "_MER.pdf")); string str22 = str19.Replace(".pdf", "_MER.pdf"); if ((this.bt_include == "True") && (str21 == "True")) { MergePDF.MergePDFFiles(this.objNF3Template.getPhysicalPath() + str6 + str22, this.objNF3Template.getPhysicalPath() + str6 + this.str_1500, this.objNF3Template.getPhysicalPath() + str6 + this.str_1500.Replace(".pdf", "_MER.pdf")); str22 = this.str_1500.Replace(".pdf", "_MER.pdf"); } string str23 = ""; str23 = str6 + str22; log.Debug("GenereatedFileName : " + str23); string str24 = ""; str24 = ApplicationSettings.GetParameterValue("DocumentManagerURL") + str23; string path = this.objNF3Template.getPhysicalPath() + "/" + str23; CutePDFDocumentClass class2 = new CutePDFDocumentClass(); string str26 = ConfigurationSettings.AppSettings["CutePDFSerialKey"].ToString(); class2.initialize(str26); if ((((class2 != null) && File.Exists(path)) && ((str11 != "CI_0000003") && (this.objNF3Template.getDiagnosisCodeCount(p_szBillNumber, conn) >= 5))) && ((str10 == "CK_0000003") && ((str11 != "CI_0000004") || (this.objNF3Template.getDiagnosisCodeCount(p_szBillNumber, conn) != 5)))) { str16 = path.Replace(".pdf", "_NewMerge.pdf"); } string str27 = ""; if (File.Exists(path) && File.Exists(path.Replace(".pdf", "_New.pdf").ToString())) { str23 = path.Replace(".pdf", "_New.pdf").ToString(); } if (File.Exists(path) && File.Exists(path.Replace(".pdf", "_NewMerge.pdf").ToString())) { str27 = str24.Replace(".pdf", "_NewMerge.pdf").ToString(); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + str24.Replace(".pdf", "_NewMerge.pdf").ToString() + "'); ", true); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } else if (File.Exists(path) && File.Exists(path.Replace(".pdf", "_New.pdf").ToString())) { str27 = str24.Replace(".pdf", "_New.pdf").ToString(); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + str24.Replace(".pdf", "_New.pdf").ToString() + "'); ", true); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } else { str27 = str24.ToString(); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + str24.ToString() + "'); ", true); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } this.pdfpath = str27; string str28 = ""; string[] strArray = str27.Split(new char[] { '/' }); ArrayList list4 = new ArrayList(); str27 = str27.Remove(0, ApplicationSettings.GetParameterValue("DocumentManagerURL").Length); str28 = strArray[strArray.Length - 1].ToString(); if (File.Exists(this.objNF3Template.getPhysicalPath() + str7 + str28)) { if (!Directory.Exists(this.objNF3Template.getPhysicalPath() + str4)) { Directory.CreateDirectory(this.objNF3Template.getPhysicalPath() + str4); } File.Copy(this.objNF3Template.getPhysicalPath() + str7 + str28, this.objNF3Template.getPhysicalPath() + str4 + str28); } if (str2 == "OLD") { list4.Add(p_szBillNumber); list4.Add(str4 + str28); list4.Add(companyId); list4.Add(caseId); list4.Add(strArray[strArray.Length - 1].ToString()); list4.Add(str4); list4.Add(userName); list4.Add(str); list4.Add("NF"); list4.Add(caseNo); this.objNF3Template.saveGeneratedBillPath(list4, conn); } else { list4.Add(p_szBillNumber); list4.Add(str4 + str28); list4.Add(companyId); list4.Add(caseId); list4.Add(strArray[strArray.Length - 1].ToString()); list4.Add(str4); list4.Add(userName); list4.Add(str); list4.Add("NF"); list4.Add(caseNo); list4.Add(list2[0].ToString()); this.objNF3Template.saveGeneratedBillPath_New(list4, conn); } this._DAO_NOTES_EO = new DAO_NOTES_EO(); this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED"; this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = str28; this._DAO_NOTES_BO = new DAO_NOTES_BO(); this._DAO_NOTES_EO.SZ_USER_ID = userId; this._DAO_NOTES_EO.SZ_CASE_ID = caseId; this._DAO_NOTES_EO.SZ_COMPANY_ID = companyId; this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO); //this.BindLatestTransaction(); } } else if (sbo.GetCaseType(billNo, conn) == "WC000000000000000003") { string str29; string companyName; Bill_Sys_PVT_Template template = new Bill_Sys_PVT_Template(); bool flag = false; string str31 = caseId; string str32 = p_szBillNumber; string str33 = userName; string str34 = userId; //if (((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY && (((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_COMAPNY_ID != companyId)) //{ // companyName = new Bill_Sys_NF3_Template().GetCompanyName(companyId); // str29 = companyId; //} // else { companyName = compName; str29 = companyId; } template.GeneratePVTBill(flag, str29, str31, str, companyName, str32, str33, str34, conn); //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Done", "window.location='/AJAX%20Pages/Bill_Sys_BillTransaction.aspx?Message=" + message + "';", true); } else { //this.Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('Bill_Sys_SelectBillType.aspx'); ", true); } new Bill_Sys_BillTransaction_BO(); } catch (Exception ex) { throw ex; //Elmah.ErrorSignal.FromCurrentContext().Raise(ex); //using (Utils utility = new Utils()) //{ // utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); //} //string str2 = "Error Request=" + id + ".Please share with Technical support."; //base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void Page_Load(object sender, EventArgs e) {//Logging Start string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { if (Request.QueryString["caseid"] != null) { string szCaseID = Request.QueryString["caseid"].ToString(); string szCompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID.ToString(); DataSet ds = new DataSet(); MUVGenerateFunction objSettings = new MUVGenerateFunction(); ds = GetVisitInfo(szCaseID, szCompanyID); string szfirstname = ""; string szlastname = ""; if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { szfirstname = ds.Tables[0].Rows[0]["PatientName"].ToString(); szfirstname = szfirstname.Replace(" ", string.Empty); szfirstname = szfirstname.Replace(".", string.Empty); szfirstname = szfirstname.Replace(",", string.Empty); } //if (ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString() != "") //{ // szlastname = ds.Tables[0].Rows[0]["SZ_PATIENT_LAST_NAME"].ToString(); // szlastname = szlastname.Replace(" ", string.Empty); // szlastname = szlastname.Replace(".", string.Empty); // szlastname = szlastname.Replace(",", string.Empty); //} string path = ConfigurationManager.AppSettings["VisitInfoPDFPATH"].ToString();// objSettings.getApplicationSetting("PatientInfoSaveFilePath"); string OpenFilepath = objSettings.getApplicationSetting("PatientInfoOpenFilePath"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = szfirstname.Trim() + "_Visit_Information_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; string pdfPath = path + newPdfFilename; MemoryStream m = new MemoryStream(); iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20); float[] wBase = { 4f }; PdfPTable tblBase = new PdfPTable(wBase); tblBase.DefaultCell.Border = Rectangle.NO_BORDER; tblBase.WidthPercentage = 100; PdfWriter writer = PdfWriter.GetInstance(document, m); document.Open(); #region "for printed by" float[] width = { 4f, 4f }; PdfPTable tblprintby = new PdfPTable(width); tblprintby.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblprintby.DefaultCell.Border = Rectangle.NO_BORDER; tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblprintby.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_TOP; tblprintby.AddCell(new Phrase("Printed By : " + ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblprintby); #endregion tblBase.AddCell(" "); #region "for patient information" float[] wdh = { 4f }; PdfPTable tblheading = new PdfPTable(wdh); tblheading.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblheading.DefaultCell.Border = Rectangle.NO_BORDER; tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER; tblheading.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE; //tblheading.AddCell(new Phrase("Patient Information", iTextSharp.text.FontFactory.GetFont("Arial", 14, Font.BOLD, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblheading); #endregion #region for Personal Information float[] w11 = { 3f, 3f, 3f, 3f }; PdfPTable table = new PdfPTable(w11); table.WidthPercentage = 100; table.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell1 = new PdfPCell(new Phrase("Personal Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell1.Colspan = 4; cell1.BackgroundColor = Color.LIGHT_GRAY; cell1.BorderColor = Color.BLACK; table.AddCell(cell1); table.AddCell(new Phrase("Patient Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["PatientName"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Case #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["CaseNo"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["CaseNo"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Insurance Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } PdfPCell cell2 = new PdfPCell(new Phrase("")); cell2.Colspan = 2; cell2.BorderColor = Color.BLACK; table.AddCell(cell2); tblBase.AddCell(table); #endregion tblBase.AddCell(" "); #region for Visit Information float[] wd1 = { 3f, 3f, 3f, 3f, 3f, 3f }; PdfPTable tblVisit = new PdfPTable(wd1); tblVisit.WidthPercentage = 100; tblVisit.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell3 = new PdfPCell(new Phrase("Visit Information", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Color.BLACK))); cell3.Colspan = 6; cell3.BorderColor = Color.BLACK; cell3.BackgroundColor = Color.LIGHT_GRAY; tblVisit.AddCell(cell3); tblVisit.AddCell(new Phrase("Doctor Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblVisit.AddCell(new Phrase("Provider", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblVisit.AddCell(new Phrase("Visit Type", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblVisit.AddCell(new Phrase("Status", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblVisit.AddCell(new Phrase("Procedure Code", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblVisit.AddCell(new Phrase("Bill Status", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); int j = 0; for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { if (j <= 5) { if (ds.Tables[1].Rows[i]["DctorName"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["DctorName"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } if (ds.Tables[1].Rows[i]["Provider"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["Provider"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } if (ds.Tables[1].Rows[i]["VisitType"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["VisitType"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } if (ds.Tables[1].Rows[i]["STATUS"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["STATUS"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } if (ds.Tables[1].Rows[i]["ProcedureCode"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["ProcedureCode"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } if (ds.Tables[1].Rows[i]["BillStatus"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(ds.Tables[1].Rows[i]["BillStatus"]), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); } j++; } else { document.NewPage(); j = 0; } } PdfPCell cell14 = new PdfPCell(new Phrase("")); cell14.Colspan = 2; cell14.BorderColor = Color.BLACK; tblVisit.AddCell(cell14); tblBase.AddCell(tblVisit); #endregion tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); tblBase.AddCell(" "); //#region "for websource information" //float[] wd5 = { 4f }; //PdfPTable tblSource = new PdfPTable(wd5); //tblSource.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; //tblSource.DefaultCell.Border = Rectangle.NO_BORDER; //tblSource.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; //tblSource.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM; //if (ds.Tables[0].Rows[0]["SZ_WEBSOURCE"].ToString() != "") //{ // tblSource.AddCell(new Phrase("Source : " + ds.Tables[0].Rows[0]["SZ_WEBSOURCE"].ToString(), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); //} //else //{ // tblInsurance.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); //} //tblBase.AddCell(tblSource); //#endregion document.Add(tblBase); document.Close(); System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer()); string OpenPdfFilepath = OpenFilepath + newPdfFilename; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "sandeep", "<script type='text/javascript'>window.location.href='" + OpenPdfFilepath + "'</script>"); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }