private string lfnMergeDiagCodePageForC43(string p_szDefaultPath, string p_szGeneratedFileName, int i_NumberOfRecords) { 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 { _bill_Sys_NF3_Template = new Bill_Sys_NF3_Template(); Bill_Sys_Configuration objConfiguration = new Bill_Sys_Configuration(); string strNextDiagFileName = ConfigurationManager.AppSettings["NextDiagnosisTemplate"].ToString(); String szGenerateNextDiagPage = objConfiguration.getConfigurationSettings(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "DIAG_PAGE"); String szNextDiagPDFFileName = ""; GeneratePDFFile.GenerateC43PDF objGeneratePDF = new GeneratePDFFile.GenerateC43PDF(); if (szGenerateNextDiagPage == "CI_0000005" && _bill_Sys_NF3_Template.getDiagnosisCodeCount(Session["TM_SZ_BILL_ID"].ToString()) >= i_NumberOfRecords) { szNextDiagPDFFileName = objGeneratePDF.GeneratePDF(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME, Session["TM_SZ_CASE_ID"].ToString(), Session["TM_SZ_BILL_ID"].ToString(), "", strNextDiagFileName); } if (szGenerateNextDiagPage == "CI_0000004" && _bill_Sys_NF3_Template.getDiagnosisCodeCount(Session["TM_SZ_BILL_ID"].ToString()) >= i_NumberOfRecords) { szNextDiagPDFFileName = objGeneratePDF.GeneratePDF(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME, Session["TM_SZ_CASE_ID"].ToString(), Session["TM_SZ_BILL_ID"].ToString(), "", strNextDiagFileName); } if (szNextDiagPDFFileName == "") { return(p_szGeneratedFileName); } else { MergePDF.MergePDFFiles(p_szDefaultPath + p_szGeneratedFileName, p_szDefaultPath + szNextDiagPDFFileName, p_szDefaultPath + szNextDiagPDFFileName.Replace(".pdf", "_Merge.pdf")); return(szNextDiagPDFFileName.Replace(".pdf", "_Merge.pdf")); } } 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); return(null); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
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()); } }