Esempio n. 1
0
    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);
        }
    }