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 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>"); //} } }
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()); } }