Exemple #1
0
        /// <summary>
        /// 报告批准时,excel转pdf,封面和首页只取第一页
        /// </summary>
        /// <param name="workBook">工作簿对象</param>
        /// <param name="toPath">输出路径</param>
        /// <returns>成功或失败</returns>
        public static bool ApproveExcelToPdf(EXCEL.Workbook workBook, string toPath)
        {
            bool   flag    = false;
            object missing = Type.Missing;

            try
            {
                if (toPath.Length == 0)
                {
                    flag = false;
                    throw new Exception("需要转换的目标文件路径不能为空。");
                }

                List <string> listSheetPdf = new List <string>();
                string        toSheetPdf   = "";
                for (int i = 1; i <= workBook.Sheets.Count; i++)//循环遍历sheet,
                {
                    toSheetPdf = "C:\\Windowd\\Temp\\" + Guid.NewGuid().ToString() + ".pdf";
                    SaveExcelWorkSheetAsPDFWithPage(workBook, i, toSheetPdf, 1);//转化sheet页为pdf,只转一页
                    listSheetPdf.Add(toSheetPdf);
                }
                MergePDF mp = new MergePDF();
                mp.Merge(listSheetPdf.ToString(), toPath);
                flag = true;
            }
            catch (Exception exception)
            {
                classLims_NPOI.WriteLog(exception, "");
                flag = false;
            }
            return(flag);
        }
        public HttpResponseMessage MergeDocuments([FromBody] MergePDF data)
        {
            HttpResponseMessage res = new HttpResponseMessage();

            res = requestHandler1.GetGbObjects(Request, data);

            string blobPath = ((ObjectContent)requestHandler1.GetObject(Request, data.CaseId, "mergepdfs").Content).Value.ToString();

            HttpResponseMessage serviceProvider = requestHandler.GetObject(Request, data.CompanyId);

            if (serviceProvider == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorObject {
                    ErrorMessage = "Blob storage provider not found for this company", errorObject = "", ErrorLevel = ErrorLevel.Error
                }));
            }

            if (res == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, res));
            }
            else
            {
                HttpResponseMessage res1 = blobhandler.MergeDocuments(Request, data.CompanyId, ((ObjectContent)res.Content).Value, blobPath + "/" + data.MergedDocumentName, ((ObjectContent)serviceProvider.Content).Value.ToString());
                if (res1.StatusCode.Equals(HttpStatusCode.Created) || res1.StatusCode.Equals(HttpStatusCode.OK))
                {
                    uploadObject            = new UploadInfo();
                    uploadObject.BlobPath   = ((ObjectContent)res1.Content).Value.ToString();
                    uploadObject.ObjectId   = data.CaseId;
                    uploadObject.ObjectType = EN.Constants.CaseType;
                    documentList.Add((Document)((ObjectContent)requestHandler.CreateGbObject(Request, uploadObject).Content).Value);
                }
                else if (res1.StatusCode.Equals(HttpStatusCode.NotFound))
                {
                    return(res1);
                }
                else
                {
                    documentList.Add(new Document {
                        Status = "Failed", DocumentName = data.MergedDocumentName
                    });
                }
            }

            var restest = (object)documentList;

            if (restest != null)
            {
                return(Request.CreateResponse(HttpStatusCode.Created, restest));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, restest));
            }
        }
Exemple #3
0
    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());
        }
    }
Exemple #4
0
        private void MergePDFs(object sender, RoutedEventArgs e)
        {
            MergePDF merge = new MergePDF();

            merge.Show();
        }
    protected void btnPrintEnvelop_Click(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 _objTemp = new Bill_Sys_NF3_Template();

        try
        {
            String szPDFPhysicalpath = ConfigurationManager.AppSettings["NF2_ENVELOPE_PDF_FILE"];
            // String szXMLPhysicalpath = ConfigurationManager.AppSettings["NF2_ENVELOPE_XML_FILE"];
            String szXMLPhysicalpath      = ConfigurationManager.AppSettings["PROVIDERNAME"];
            String szBasePhysicalPath     = _objTemp.getPhysicalPath();
            String szSourceFile1          = "";
            String szSourceFile1_FullPath = "";
            String szSourceFile2          = "";
            String szSourceFile2_FullPath = "";
            String szOpenFilePath         = "";

            for (int i = 0; i < grdUnsentNF2.Items.Count; i++)
            {
                String   szCaseID   = grdUnsentNF2.Items[i].Cells[10].Text;
                CheckBox chkDelete1 = (CheckBox)grdUnsentNF2.Items[i].FindControl("ChkSent");
                if (chkDelete1.Checked)
                {
                    string InsCompanyName = ((TextBox)grdUnsentNF2.Items[i].FindControl("txtInsDetails")).Text;
                    string Insdescription = ((TextBox)grdUnsentNF2.Items[i].FindControl("txtInsAddress")).Text;
                    string InsDetials     = ((TextBox)grdUnsentNF2.Items[i].FindControl("txtInsState")).Text;
                    String szDefaultPath  = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + szCaseID + "/Packet Document/";
                    // PDFValueReplacement.PDFValueReplacement objPDFReplacement = new PDFValueReplacement.PDFValueReplacement();
                    ReplacePdfValues objReplacePdf = new ReplacePdfValues();
                    //string szGeneratedPDFName = objPDFReplacement.ReplacePDFvalues(szXMLPhysicalpath, szPDFPhysicalpath, szCaseID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, szCaseID);

                    // string szGeneratedPDFName = objPDFReplacement.ReplacePDFvalues(szXMLPhysicalpath, szPDFPhysicalpath, extddlOffice.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, szCaseID);

                    // Use Function           string szGeneratedPDFName = objReplacePdf.PrintEnvelope(szXMLPhysicalpath, szPDFPhysicalpath, extddlOffice.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, szCaseID);
                    string szGeneratedPDFName = objReplacePdf.PrintEnvelope1(szXMLPhysicalpath, szPDFPhysicalpath, extddlOffice.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME, szCaseID, InsCompanyName, Insdescription, InsDetials);

                    if (szSourceFile1 == "")
                    {
                        szSourceFile1          = szGeneratedPDFName;
                        szSourceFile1_FullPath = szBasePhysicalPath + szDefaultPath + szSourceFile1;
                        szOpenFilePath         = szDefaultPath + szSourceFile1;
                    }
                    else
                    {
                        szSourceFile2          = szGeneratedPDFName;
                        szSourceFile2_FullPath = szBasePhysicalPath + szDefaultPath + szSourceFile2;
                        MergePDF.MergePDFFiles(szSourceFile1_FullPath, szSourceFile2_FullPath, szBasePhysicalPath + szDefaultPath + "_" + szSourceFile1);
                        szSourceFile1          = "_" + szSourceFile1;
                        szSourceFile1_FullPath = szBasePhysicalPath + szDefaultPath + szSourceFile1;
                        szOpenFilePath         = szDefaultPath + szSourceFile1;
                    }
                }
            }
            szOpenFilePath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szOpenFilePath;
            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.ToString() + "'); ", 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());
        }
    }
Exemple #6
0
    //private void BindGrid()
    //{
    //    _reportBO = new Bill_Sys_ReportBO();
    //    try
    //    {

    //            grdAllReports.DataSource = _reportBO.GetProcedureReports("SP_REPORT_PROCEDURE_REPORT", txtFromDate.Text, txtToDate.Text, extddlOffice.Text, ddlStatus.SelectedValue, txtCompanyID.Text,"", null);
    //            grdAllReports.DataBind();


    //            grdForReport.DataSource = _reportBO.GetProcedureReports("SP_REPORT_PROCEDURE_REPORT", txtFromDate.Text, txtToDate.Text, extddlOffice.Text, ddlStatus.SelectedValue, txtCompanyID.Text,"", null);
    //            grdForReport.DataBind();


    //         if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == false)
    //         {
    //             grdAllReports.Columns[5].Visible = false;
    //             grdForReport.Columns[5].Visible = false;
    //         }

    //    }
    //    catch (Exception ex)
    //    {
    //        string strError = ex.Message.ToString();
    //        strError = strError.Replace("\n", " ");
    //        Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + strError);
    //    }
    //}



    protected void btnSearch_Click(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());
        }
        try
        {
            //string str;
            //str = "Bill_Sys_ShowReport.aspx?StartDate=" + txtFromDate.Text + "&EndDate=" + txtToDate.Text + "&OfficeId=" + extddlOffice.Text + "&DocorId=" + extddlDoctor.Text + "&Status=" + ddlStatus.SelectedValue;
            //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + str.ToString() + "','Sign','toolbar=no,directories=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,width=700,height=575'); ", true);
            if (chkShowReport.Checked == true && chkMissingInfo.Checked == true)
            {
                int               iFlag     = 1;
                string            CompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                Bill_Sys_ReportBO _objRPO   = new Bill_Sys_ReportBO();
                string            Showpath  = "";// _objRPO.GenrateHtmlForShowReport(CompanyID, txtFromDate.Text, txtToDate.Text, extddlOffice.Text, extddlDoctor.Text, ddlStatus.SelectedValue, iFlag);
                if (((Bill_Sys_SystemObject)Session["SYSTEM_OBJECT"]).SZ_EMG_BILL == "True")
                {
                    Showpath = _objRPO.GenrateHtmlForShowReportEMG(CompanyID, txtFromDate.Text, txtToDate.Text, extddlOffice.Text, extddlDoctor.Text, ddlStatus.SelectedValue, iFlag);
                }
                else
                {
                    Showpath = _objRPO.GenrateHtmlForShowReport(CompanyID, txtFromDate.Text, txtToDate.Text, extddlOffice.Text, extddlDoctor.Text, ddlStatus.SelectedValue, iFlag);
                }

                string Missingpath = _objRPO.GenrateHtmlForMissingReport(CompanyID, extddlOffice.Text, iFlag);
                Bill_Sys_NF3_Template _bill_Sys_NF3_Template = new Bill_Sys_NF3_Template();
                string szPhisicalPath = _bill_Sys_NF3_Template.getPhysicalPath() + "Reports/SHOW_MISSINF.pdf";
                MergePDF.MergePDFFiles(Showpath, Missingpath, szPhisicalPath);
                string open_Path = ApplicationSettings.GetParameterValue("DocumentManagerURL") + "Reports/SHOW_MISSINF.pdf";
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + open_Path + "','Sign','toolbar=no,directories=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,width=700,height=575'); ", true);
            }
            else if (chkShowReport.Checked == true)
            {
                int               iFlag     = 0;
                string            CompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                Bill_Sys_ReportBO _objRPO   = new Bill_Sys_ReportBO();
                string            path      = "";
                if (((Bill_Sys_SystemObject)Session["SYSTEM_OBJECT"]).SZ_EMG_BILL == "True")
                {
                    path = _objRPO.GenrateHtmlForShowReportEMG(CompanyID, txtFromDate.Text, txtToDate.Text, extddlOffice.Text, extddlDoctor.Text, ddlStatus.SelectedValue, iFlag);
                }
                else
                {
                    path = _objRPO.GenrateHtmlForShowReport(CompanyID, txtFromDate.Text, txtToDate.Text, extddlOffice.Text, extddlDoctor.Text, ddlStatus.SelectedValue, iFlag);
                }
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + path + "','Sign','toolbar=no,directories=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,width=700,height=575'); ", true);
            }
            else if (chkMissingInfo.Checked = true)
            {
                int               iFlag     = 0;
                string            CompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                Bill_Sys_ReportBO _objRPO   = new Bill_Sys_ReportBO();
                string            path      = _objRPO.GenrateHtmlForMissingReport(CompanyID, extddlOffice.Text, iFlag);
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + path + "','Sign','toolbar=no,directories=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,width=700,height=575'); ", 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 GeneratePVTBill(bool isReferingFacility, string szCompanyId, string szCaseId, string szSpecility, string szCompanyName, string szBillId, string szUserName, string szUserId, ServerConnection conn)
    {
        string szDefaultPath = "";
        string szReturnPath  = "";

        try
        {
            log.Debug("in GeneratePVTBill");
            objNF3Template            = new Bill_Sys_NF3_Template();
            _bill_Sys_BillTransaction = new Bill_Sys_BillTransaction_BO();
            #region Generate Bill For Private cases

            String szLastPDFFileName = "";
            String szDestinationDir  = "";


            //changes for Doc manager for new Bill path -- pravin

            objVerification_Desc = new Bill_Sys_Verification_Desc();
            log.Debug("create  Bill_Sys_Verification_Desc object");


            objVerification_Desc.sz_bill_no    = szBillId;
            objVerification_Desc.sz_company_id = szCompanyId;
            objVerification_Desc.sz_flag       = "BILL";

            ArrayList arrNf_Para     = new ArrayList();
            ArrayList arrNf_NodeType = new ArrayList();

            objCaseDetailsBO = new CaseDetailsBO();
            DataSet ds1500from   = new DataSet();
            string  sz_Type      = "";
            string  bt_1500_Form = "";


            arrNf_Para.Add(objVerification_Desc);

            arrNf_NodeType = _bill_Sys_BillTransaction.Get_Node_Type(arrNf_Para, conn);
            log.Debug("called  _bill_Sys_BillTransaction ");
            log.Debug("arrNf_NodeType =" + arrNf_NodeType);
            if (arrNf_NodeType.Contains("NFVER"))
            {
                sz_Type          = "OLD";
                szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Bills/" + szSpecility + "/";
            }
            else
            {
                sz_Type          = "NEW";
                szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Medicals/" + szSpecility + "/" + "Bills/";
            }

            //szDestinationDir = szCompanyName + "/" + szCaseId + "/No Fault File/Bills/" + szSpecility + "/";

            String szSourceDir = "";
            szSourceDir = szCompanyName + "/" + szCaseId + "/Packet Document/";
            log.Debug("szSourceDir =" + szSourceDir);
            //changes for Add only 1500 Form For Insurance Company -- pravin

            ds1500from = objCaseDetailsBO.Get1500FormBitForInsurance(szCompanyId, szBillId, conn);

            if (ds1500from.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds1500from.Tables[0].Rows.Count; i++)
                {
                    bt_1500_Form = ds1500from.Tables[0].Rows[i]["BT_1500_FORM"].ToString();
                }
            }
            if (bt_1500_Form == "1")
            {
                string str_1500 = "";
                _MUVGenerateFunction = new MUVGenerateFunction();

                //str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString());
                string szOriginalTemplatePDFFileName        = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString();
                Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace();
                str_1500 = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId, szCompanyId, conn);

                if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + str_1500))
                {
                    if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                    {
                        Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                    }
                    File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500);
                }
                szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + str_1500;

                ArrayList objAL = new ArrayList();

                if (sz_Type == "OLD")
                {
                    objAL.Add(szBillId);
                    objAL.Add(szDestinationDir + str_1500);
                    objAL.Add(szCompanyId);
                    objAL.Add(szCaseId);
                    objAL.Add(str_1500);
                    objAL.Add(szDestinationDir);
                    objAL.Add(szUserName);
                    objAL.Add(szSpecility);
                    //objAL.Add("");
                    objAL.Add("PVT");
                    objAL.Add(szCaseId);
                    //objAL.Add(txtCaseNo.Text);
                    objNF3Template.saveGeneratedBillPath(objAL, conn);
                }
                else
                {
                    objAL.Add(szBillId);
                    objAL.Add(szDestinationDir + str_1500);
                    objAL.Add(szCompanyId);
                    objAL.Add(szCaseId);
                    objAL.Add(str_1500);
                    objAL.Add(szDestinationDir);
                    objAL.Add(szUserName);
                    objAL.Add(szSpecility);
                    //objAL.Add("");
                    objAL.Add("PVT");
                    objAL.Add(szCaseId);
                    objAL.Add(arrNf_NodeType[0].ToString());
                    objNF3Template.saveGeneratedBillPath_New(objAL, conn);
                }



                // Start : Save Notes for Bill.

                _DAO_NOTES_EO = new DAO_NOTES_EO();
                _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED";
                _DAO_NOTES_EO.SZ_ACTIVITY_DESC = str_1500;

                _DAO_NOTES_BO               = new DAO_NOTES_BO();
                _DAO_NOTES_EO.SZ_USER_ID    = szUserId;
                _DAO_NOTES_EO.SZ_CASE_ID    = szCaseId;
                _DAO_NOTES_EO.SZ_COMPANY_ID = szCompanyId;
                _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO);
            }

            else
            {
                String szGenereatedFileName = "";
                objPDFReplacement = new PDFValueReplacement.PDFValueReplacement();
                string szXMLFileName;
                string szOriginalPDFFileName;
                szXMLFileName = ConfigurationManager.AppSettings["HCFA1500_XML_FILE"].ToString();
                string path = GetPdfFilePath() + szCompanyId + "/HCFA -1500.pdf";
                log.Debug("szXMLFileName =" + szXMLFileName);
                log.Debug("path =" + path);
                if (File.Exists(path))
                {
                    szOriginalPDFFileName = path;
                }
                else
                {
                    szOriginalPDFFileName = ConfigurationManager.AppSettings["HCFA1500_PDF_FILE"].ToString();
                }
                String szPDFPage = "";
                log.Debug("Before PdfValue ReplacePDFvalues");
                string szOriginalTemplatePDFFileName        = ConfigurationManager.AppSettings["PVT_PDF_FILE"].ToString();
                Bill_Sys_PVT_Bill_PDF_Replace objPVTReplace = new Bill_Sys_PVT_Bill_PDF_Replace();
                szPDFPage = objPVTReplace.ReplacePDFvalues(szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId, szCompanyId, conn);
                //szPDFPage = objPDFReplacement.ReplacePDFvalues(szXMLFileName, szOriginalTemplatePDFFileName, szBillId, szCompanyName, szCaseId);
                log.Debug("after PdfValue ReplacePDFvalues");
                log.Debug("szPDFPage" + szPDFPage);

                #region File saving logic
                String szOpenFilePath = "";
                szGenereatedFileName = szDestinationDir + szPDFPage;
                log.Debug("szGenereatedFileName" + szGenereatedFileName);
                szOpenFilePath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szGenereatedFileName;
                log.Debug("szOpenFilePath" + szOpenFilePath);
                string szFileNameWithFullPath = objNF3Template.getPhysicalPath() + "/" + szGenereatedFileName;
                log.Debug("szFileNameWithFullPath" + szFileNameWithFullPath);
                string szFileNameForSaving = "";
                szReturnPath = szOpenFilePath;
                log.Debug("szReturnPath" + szReturnPath);
                // Save Entry in Table
                if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString()))
                {
                    szGenereatedFileName = szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString();
                }
                log.Debug("szGenereatedFileName" + szGenereatedFileName);
                // End

                if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_NewMerge.pdf").ToString()))
                {
                    szFileNameForSaving = szOpenFilePath.Replace(".pdf", "_NewMerge.pdf").ToString();
                    //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.Replace(".pdf", "_NewMerge.pdf").ToString() + "'); ", true);
                }
                else
                {
                    if (System.IO.File.Exists(szFileNameWithFullPath) && System.IO.File.Exists(szFileNameWithFullPath.Replace(".pdf", "_New.pdf").ToString()))
                    {
                        szFileNameForSaving = szOpenFilePath.Replace(".pdf", "_New.pdf").ToString();
                        //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.Replace(".pdf", "_New.pdf").ToString() + "'); ", true);
                    }
                    else
                    {
                        szFileNameForSaving = szOpenFilePath.ToString();
                        //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + szOpenFilePath.ToString() + "'); ", true);
                    }
                }

                log.Debug("szFileNameForSaving" + szFileNameForSaving);
                String[] szTemp;
                string   szBillName = "";
                szTemp = szFileNameForSaving.Split('/');
                log.Debug("szTemp" + szTemp);
                ArrayList objAL = new ArrayList();
                szFileNameForSaving = szFileNameForSaving.Remove(0, ApplicationSettings.GetParameterValue("DocumentManagerURL").Length);
                log.Debug("szFileNameForSaving" + szFileNameForSaving);
                szBillName = szTemp[szTemp.Length - 1].ToString();
                log.Debug("szBillName" + szBillName);
                string bt_CaseType, bt_include, str_1500;
                string strComp = szCompanyId.ToString();
                _MUVGenerateFunction = new MUVGenerateFunction();
                if (System.Configuration.ConfigurationManager.AppSettings["Only_1500_in_PVT_Bill"].ToString() == "true")
                {
                    str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString(), conn);
                    log.Debug("str_1500" + str_1500);
                    if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + str_1500))
                    {
                        if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                        {
                            Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                        }
                        File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500);
                    }
                    szBillName = str_1500;
                    //szBillName = str_1500.Replace(".pdf", "_MER.pdf");
                    szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + szBillName;
                    log.Debug("szReturnPath" + szReturnPath);
                }
                else
                {
                    log.Debug("bjNF3Template.getPhysicalPath() + szSourceDir + szBillName" + objNF3Template.getPhysicalPath() + szSourceDir + szBillName);
                    if (File.Exists(objNF3Template.getPhysicalPath() + szSourceDir + szBillName))
                    {
                        if (!Directory.Exists(objNF3Template.getPhysicalPath() + szDestinationDir))
                        {
                            Directory.CreateDirectory(objNF3Template.getPhysicalPath() + szDestinationDir);
                        }
                        File.Copy(objNF3Template.getPhysicalPath() + szSourceDir + szBillName, objNF3Template.getPhysicalPath() + szDestinationDir + szBillName);
                    }



                    //Tushar
                    bt_include = _MUVGenerateFunction.get_bt_include(strComp, szSpecility, "", "Speciality");
                    log.Debug("bt_include" + bt_include);
                    bt_CaseType = _MUVGenerateFunction.get_bt_include(strComp, "", "WC000000000000000003", "CaseType");
                    log.Debug("bt_CaseType" + bt_CaseType);
                    if (bt_include == "True" && bt_CaseType == "True")
                    {
                        str_1500 = _MUVGenerateFunction.FillPdf(szBillId.ToString(), conn);

                        MergePDF.MergePDFFiles(objNF3Template.getPhysicalPath() + szDestinationDir + szBillName, objNF3Template.getPhysicalPath() + szSourceDir + str_1500, objNF3Template.getPhysicalPath() + szDestinationDir + str_1500.Replace(".pdf", "_MER.pdf"));
                        szBillName   = str_1500.Replace(".pdf", "_MER.pdf");
                        szReturnPath = ApplicationSettings.GetParameterValue("DocumentManagerURL") + szDestinationDir + szBillName;
                    }

                    log.Debug("szReturnPath" + szReturnPath);
                }

                //changes for Doc manager for new Bill path -- pravin

                if (sz_Type == "OLD")
                {
                    objAL.Add(szBillId);
                    objAL.Add(szDestinationDir + szBillName);
                    objAL.Add(szCompanyId);
                    objAL.Add(szCaseId);
                    objAL.Add(szBillName);
                    objAL.Add(szDestinationDir);
                    objAL.Add(szUserName);
                    objAL.Add(szSpecility);
                    //objAL.Add("");
                    objAL.Add("PVT");
                    objAL.Add(szCaseId);
                    //objAL.Add(txtCaseNo.Text);
                    objNF3Template.saveGeneratedBillPath(objAL, conn);
                }
                else
                {
                    objAL.Add(szBillId);
                    objAL.Add(szDestinationDir + szBillName);
                    objAL.Add(szCompanyId);
                    objAL.Add(szCaseId);
                    objAL.Add(szBillName);
                    objAL.Add(szDestinationDir);
                    objAL.Add(szUserName);
                    objAL.Add(szSpecility);
                    //objAL.Add("");
                    objAL.Add("PVT");
                    objAL.Add(szCaseId);
                    objAL.Add(arrNf_NodeType[0].ToString());
                    objNF3Template.saveGeneratedBillPath_New(objAL, conn);
                }



                // Start : Save Notes for Bill.

                _DAO_NOTES_EO = new DAO_NOTES_EO();
                _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "BILL_GENERATED";
                _DAO_NOTES_EO.SZ_ACTIVITY_DESC = szBillName;

                _DAO_NOTES_BO               = new DAO_NOTES_BO();
                _DAO_NOTES_EO.SZ_USER_ID    = szUserId;
                _DAO_NOTES_EO.SZ_CASE_ID    = szCaseId;
                _DAO_NOTES_EO.SZ_COMPANY_ID = szCompanyId;
                _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO);
                #endregion

                //Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" +  ApplicationSettings.GetParameterValue("DocumentManagerURL") + szPDFPage + "'); ", true);
                #endregion
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message, ex);
        }
        return(szReturnPath);
    }
Exemple #8
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);
        }
    }
Exemple #9
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());
        }
    }
        public REQUIREDDOCUMENT_EO MergeDocument(ArrayList objarr)
        {
            _reqDocumentEO = new REQUIREDDOCUMENT_EO();
            try
            {
                ArrayList             objlist     = new ArrayList();
                ArrayList             objFilelist = new ArrayList();
                Bill_Sys_NF3_Template _objTemp    = new Bill_Sys_NF3_Template();
                objFilelist = LoadPath(objarr);
                string _doucumentPath         = "";
                bool   _ischeck               = false;
                String szSourceFile1          = "";
                String szSourceFile1_FullPath = "";
                String szSourceFile2          = "";
                String szSourceFile2_FullPath = "";
                String szOpenFilePath         = "";
                String szBasePhysicalPath     = _objTemp.getPhysicalPath();
                string szerrmsg               = "";

                for (int i = 0; i < objFilelist.Count; i++)
                {
                    //if check file is exist or not
                    if (System.IO.File.Exists(((REQUIREDDOCUMENT_EO)(objFilelist[i])).SZ_DOCUMENT_PATH.ToString()))
                    {
                        objlist.Add(objFilelist[i]);
                    }
                }


                //                        CompanyName                       caseID
                String szDefaultPath = objarr[3].ToString() + "/" + objarr[0].ToString() + "/Packet Document/";
                string _fullPath     = szBasePhysicalPath + szDefaultPath;
                if (!Directory.Exists(_fullPath))
                {
                    Directory.CreateDirectory(_fullPath);
                }
                if (objlist.Count > 1)
                {
                    for (int j = 0; j < objlist.Count; j++)
                    {
                        if (szSourceFile1 == "")
                        {
                            szSourceFile1          = getFileName("Packet") + ".pdf";
                            szSourceFile1_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[j])).SZ_DOCUMENT_PATH);
                            szOpenFilePath         = szDefaultPath + szSourceFile1;
                        }
                        else
                        {
                            szSourceFile2_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[j])).SZ_DOCUMENT_PATH);
                            MergePDF.MergePDFFiles(szSourceFile1_FullPath, szSourceFile2_FullPath, szBasePhysicalPath + szDefaultPath + szSourceFile1);

                            szSourceFile1_FullPath = szBasePhysicalPath + szDefaultPath + szSourceFile1;
                            szOpenFilePath         = szDefaultPath + szSourceFile1;
                        }
                    }
                }
                else
                {
                    szSourceFile1          = getFileName("Packet") + ".pdf";
                    szSourceFile1_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[0])).SZ_DOCUMENT_PATH);
                    szOpenFilePath         = szDefaultPath + szSourceFile1;
                    File.Copy(Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[0])).SZ_DOCUMENT_PATH), szBasePhysicalPath + szDefaultPath + szSourceFile1);
                }
                _reqDocumentEO.SZ_OPEN_FILE_PATH = szOpenFilePath;
            }
            catch (Exception ex)
            { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); }
            return(_reqDocumentEO);
        }