Exemplo n.º 1
0
    public string PrintAOBFillPDFValue(string EventID, string sz_CompanyID, string sz_CompanyName)
    {
        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());
        }
        string sz_CaseID = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID.ToString();

        PDFValueReplacement.PDFValueReplacement objValueReplacement = new PDFValueReplacement.PDFValueReplacement();

        string strGenFileName = "";

        try
        {
            Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();
            string xmlpath          = ConfigurationManager.AppSettings["HIPPA_XML_Path"].ToString();
            string pdfpath          = ConfigurationManager.AppSettings["HIPPA_PDF_Path"].ToString();
            string CompanyName      = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
            String szDefaultPath    = CompanyName + "/" + sz_CaseID + "/Packet Document/";
            String szDestinationDir = CompanyName + "/" + sz_CaseID + "/HIPPA/";

            strGenFileName = objValueReplacement.ReplacePDFvalues(xmlpath, pdfpath, sz_CaseID, CompanyName, sz_CaseID);

            if (File.Exists(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName))
            {
                if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                {
                    Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                }
                File.Copy(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName, objNF3Template.getPhysicalPath() + szDestinationDir + strGenFileName);
            }
            String szOpenFilePath = "";
            szOpenFilePath = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString() + szDestinationDir + strGenFileName;
            //Response.Redirect(szOpenFilePath, false);
            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath + "'); ", true);
        }
        catch (Exception ex)
        {
            Response.Write("Exp Msg= " + 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(strGenFileName);

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Exemplo n.º 2
0
    public string FillPDFValue(string EventID, string sz_CompanyID, string sz_CompanyName)
    {
        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());
        }
        string sz_CaseID = Session["PhysicalCaseID"].ToString();

        PDFValueReplacement.PDFValueReplacement objValueReplacement = new PDFValueReplacement.PDFValueReplacement();
        string pdffilepath;
        string strGenFileName = "";

        try
        {
            Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();
            string xmlpath = ConfigurationManager.AppSettings["Physical_Therapy_XML_Path"].ToString();
            string pdfpath = ConfigurationManager.AppSettings["Physical_Therapy_PDF_Path"].ToString();

            String szDefaultPath    = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + sz_CaseID + "/Packet Document/";
            String szDestinationDir = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + sz_CaseID + "/No Fault File/Medicals/TP/";

            strGenFileName = objValueReplacement.ReplacePDFvalues(xmlpath, pdfpath, EventID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, sz_CaseID);

            if (File.Exists(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName))
            {
                if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                {
                    Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                }
                File.Copy(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName, objNF3Template.getPhysicalPath() + szDestinationDir + strGenFileName);
            }

            Bill_Sys_CheckoutBO objCheckoutBO = new Bill_Sys_CheckoutBO();
            ArrayList           objAL         = new ArrayList();
            objAL.Add(sz_CaseID);
            objAL.Add(strGenFileName);
            objAL.Add(szDestinationDir);
            objAL.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME);
            objAL.Add(sz_CompanyID);
            objAL.Add(EventID);
            objCheckoutBO.save_IM_DocMang(objAL);
            // Open file
            String szOpenFilePath = "";
            szOpenFilePath = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString() + szDestinationDir + strGenFileName;
            Response.Redirect(szOpenFilePath, false);
            //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath + "'); ", true);
        }
        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(strGenFileName);

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    public ArrayList FillPDFValue(SpecialityPDFFill p_objSepcialityPDF)
    {
        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());
        }
        string sz_CompanyID    = "";
        string sz_ComapanyName = "";

        if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true && ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID != ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID)
        {
            sz_CompanyID = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID;
            Bill_Sys_NF3_Template obj = new Bill_Sys_NF3_Template();
            sz_ComapanyName = obj.GetCompanyName(sz_CompanyID);
        }
        else
        {
            sz_CompanyID    = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            sz_ComapanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
        }

        string sz_CaseID = p_objSepcialityPDF.sz_Session_Id;

        PDFValueReplacement.PDFValueReplacement objValueReplacement = new PDFValueReplacement.PDFValueReplacement();
        string pdffilepath;
        string strGenFileName   = "";
        String szOpenFilePath   = "";
        String szDestinationDir = "";

        try
        {
            Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();
            string xmlpath = ConfigurationManager.AppSettings[p_objSepcialityPDF.sz_XMLPath].ToString();
            string pdfpath = ConfigurationManager.AppSettings[p_objSepcialityPDF.sz_PDFPath].ToString();

            String szDefaultPath = p_objSepcialityPDF.sz_CompanyName + "/" + sz_CaseID + "/Packet Document/";
            szDestinationDir = p_objSepcialityPDF.sz_CompanyName + "/" + sz_CaseID + "/MRI/";

            strGenFileName = objValueReplacement.ReplacePDFvalues(xmlpath, pdfpath, txtId.Text, p_objSepcialityPDF.sz_CompanyName, sz_CaseID);

            if (File.Exists(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName))
            {
                if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                {
                    Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                }
                File.Copy(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName, objNF3Template.getPhysicalPath() + szDestinationDir + strGenFileName);
            }

            Bill_Sys_CheckoutBO objCheckoutBO = new Bill_Sys_CheckoutBO();
            ArrayList           objAL         = new ArrayList();
            objAL.Add(sz_CaseID);
            objAL.Add(strGenFileName);
            objAL.Add(szDestinationDir);
            objAL.Add(p_objSepcialityPDF.SZ_USER_NAME);
            objAL.Add(sz_CompanyID);
            objAL.Add(txtId.Text);


            szOpenFilePath = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString() + szDestinationDir + strGenFileName;
            ArrayList al = new ArrayList();
            al.Add(strGenFileName);
            al.Add(szOpenFilePath);
            al.Add(szDestinationDir);
            return(al);
        }
        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());
        }
    }
Exemplo n.º 4
0
    protected void drpSelectBill_SelectedIndexChanged(object sender, EventArgs e)
    {
        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());
        }
        _bill_Sys_NF3_Template = new Bill_Sys_NF3_Template();
        try
        {
            String szURLDocumentManager = "";
            szURLDocumentManager = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString();
            String szDefaultPhysicalPath = _bill_Sys_NF3_Template.getPhysicalPath() + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/";

            if (drpSelectBill.SelectedValue == "01")
            {
                string strGenFileName = "";
                PDFValueReplacement.PDFValueReplacement _pDFValueReplacement = new PDFValueReplacement.PDFValueReplacement();
                string xmlFilePath = ConfigurationManager.AppSettings["PDF_FILE_PATH_C4"].ToString();//"http://localhost/BILLINGSYSTEM/c4.2.pdf";
                strGenFileName = _pDFValueReplacement.ReplacePDFvalues(ConfigurationManager.AppSettings["TEMPLATE_VARIABLES_FILE_FOR_C4"].ToString(), xmlFilePath, Session["TM_SZ_BILL_ID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, Session["TM_SZ_CASE_ID"].ToString());
                strGenFileName = lfnMergeDiagCodePage(szDefaultPhysicalPath, strGenFileName, 4);
                ArrayList objAL = new ArrayList();
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName);
                objAL.Add(Session["TM_SZ_BILL_ID"].ToString());
                objAL.Add(Session["TM_SZ_CASE_ID"].ToString());
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                _bill_Sys_NF3_Template.saveGeneratedNF3File(objAL);
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szURLDocumentManager + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName + "'); ", true);
            }

            if (drpSelectBill.SelectedValue == "02")
            {
                string strGenFileName = "";
                PDFValueReplacement.PDFValueReplacement _pDFValueReplacement = new PDFValueReplacement.PDFValueReplacement();
                string xmlFilePath = ConfigurationManager.AppSettings["PDF_FILE_PATH_C42"].ToString();//"http://localhost/BILLINGSYSTEM/c4.2.pdf";
                strGenFileName = _pDFValueReplacement.ReplacePDFvalues(ConfigurationManager.AppSettings["TEMPLATE_VARIABLES_FILE_FOR_C42"].ToString(), xmlFilePath, Session["TM_SZ_BILL_ID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, Session["TM_SZ_CASE_ID"].ToString());
                strGenFileName = lfnMergeDiagCodePage(szDefaultPhysicalPath, strGenFileName, 4);
                ArrayList objAL = new ArrayList();
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName);
                objAL.Add(Session["TM_SZ_BILL_ID"].ToString());
                objAL.Add(Session["TM_SZ_CASE_ID"].ToString());
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                _bill_Sys_NF3_Template.saveGeneratedNF3File(objAL);
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szURLDocumentManager + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName + "'); ", true);
            }

            if (drpSelectBill.SelectedValue == "03")
            {
                string strGenFileName = "";
                PDFValueReplacement.PDFValueReplacement _pDFValueReplacement = new PDFValueReplacement.PDFValueReplacement();
                string xmlFilePath = ConfigurationManager.AppSettings["PDF_FILE_PATH_C43"].ToString();//"http://localhost/BILLINGSYSTEM/c4.2.pdf";
                strGenFileName = _pDFValueReplacement.ReplacePDFvalues(ConfigurationManager.AppSettings["TEMPLATE_VARIABLES_FILE_FOR_C43"].ToString(), xmlFilePath, Session["TM_SZ_BILL_ID"].ToString(), ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, Session["TM_SZ_CASE_ID"].ToString());
                strGenFileName = lfnMergeDiagCodePageForC43(szDefaultPhysicalPath, strGenFileName, 2);
                ArrayList objAL = new ArrayList();
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName);
                objAL.Add(Session["TM_SZ_BILL_ID"].ToString());
                objAL.Add(Session["TM_SZ_CASE_ID"].ToString());
                objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                _bill_Sys_NF3_Template.saveGeneratedNF3File(objAL);
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szURLDocumentManager + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["TM_SZ_CASE_ID"].ToString() + "/Packet Document/" + strGenFileName + "'); ", true);
            }
        }
        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());
        }
    }
    public string FillPDFValue(string EventID, string sz_CompanyID, string sz_CompanyName)
    {
        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());
        }
        string sz_CaseID = Session["PATIENT_INTEK_CASE_ID"].ToString();

        PDFValueReplacement.PDFValueReplacement objValueReplacement = new PDFValueReplacement.PDFValueReplacement();

        string strGenFileName = "";

        try
        {
            Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();
            string xmlpath          = ConfigurationManager.AppSettings["PatientIntake_XML_Path"].ToString();
            string pdfpath          = ConfigurationManager.AppSettings["PatientIntake_PDF_Path"].ToString();
            string CompanyName      = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
            String szDefaultPath    = CompanyName + "/" + sz_CaseID + "/Packet Document/";
            String szDestinationDir = CompanyName + "/" + sz_CaseID + "/Intake Sheet/";

            strGenFileName = objValueReplacement.ReplacePDFvalues(xmlpath, pdfpath, sz_CaseID, CompanyName, sz_CaseID);

            if (File.Exists(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName))
            {
                if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                {
                    Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                }
                File.Copy(objNF3Template.getPhysicalPath() + szDefaultPath + strGenFileName, objNF3Template.getPhysicalPath() + szDestinationDir + strGenFileName);
            }

            Bill_Sys_CheckoutBO objCheckoutBO = new Bill_Sys_CheckoutBO();
            ArrayList           objAL         = new ArrayList();
            objAL.Add(sz_CaseID);
            objAL.Add(strGenFileName);
            objAL.Add(szDestinationDir);
            objAL.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]) + sz_CaseID);
            objAL.Add(sz_CompanyID);
            objAL.Add(EventID);
            SpecialityPDFFill spf = new SpecialityPDFFill();
            spf.sz_Session_Id = Session["PATIENT_INTEK_CASE_ID"].ToString();
            spf.sz_CompanyID  = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            //spf.sz_EventID = Session["AOB_EVENT_ID"].ToString();
            spf.SZ_PT_FILE_NAME    = strGenFileName;
            spf.SZ_PT_FILE_PATH    = szDestinationDir;
            spf.SZ_SPECIALITY_CODE = "ININT";
            spf.SZ_SPECIALITY_NAME = "Intek Sheet";
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.savePDFForminDocMang(spf);
            spf.SZ_SPECIALITY_CODE = "ININT";
            spf.SZ_SPECIALITY_NAME = "Intek Sheet";
            //  objCheckoutBO.savePDFForminDocMang(objAL);
            // Open file
            String szOpenFilePath = "";
            szOpenFilePath = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString() + szDestinationDir + strGenFileName;
            //  Response.Redirect(szOpenFilePath, false);
            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath + "'); ", true);
        }
        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(strGenFileName);

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Exemplo n.º 6
0
    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());
        }
    }