Esempio n. 1
0
    protected void lnkuplaod_Click(object sender, EventArgs e)
    {
        LinkButton btn = (LinkButton)sender;
        Bill_Sys_Verification_Desc _objDesc;
        ArrayList arr_node_type         = new ArrayList();
        ArrayList objAL                 = new ArrayList();
        Bill_Sys_BillTransaction_BO obj = new Bill_Sys_BillTransaction_BO();
        TableCell    tc                 = (TableCell)btn.Parent;
        DataGridItem it                 = (DataGridItem)tc.Parent;
        int          index              = it.ItemIndex;

        Session["BillNo"]       = txtViewBillNumber.Text;
        Session["NODETYPESCAN"] = "";
        Session["NODETYPE"]     = "";
        Session["VERID"]        = it.Cells[5].Text;
        ArrayList arrBillNo = new ArrayList();
        ArrayList arrSpec   = new ArrayList();
        ArrayList arrCaseId = new ArrayList();

        if (it.Cells[1].Text.ToLower().Equals("verification received"))
        {
            _objDesc                      = new Bill_Sys_Verification_Desc();
            _objDesc.sz_bill_no           = txtViewBillNumber.Text;
            _objDesc.sz_description       = "";
            _objDesc.sz_verification_date = "";
            _objDesc.i_verification       = 0;
            _objDesc.sz_company_id        = txtCompanyID.Text;
            _objDesc.sz_user_id           = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString();
            _objDesc.sz_flag              = "VR";
            objAL.Add(_objDesc);
            arr_node_type = obj.Get_Node_Type(objAL);

            if (arr_node_type.Contains("NFVER"))
            {
                arr_node_type.Clear();
                arr_node_type.Add("NFVER");
                Session["NODETYPE"] = arr_node_type;
            }
            else
            {
                Session["NODETYPE"] = arr_node_type;
            }
            arrCaseId.Add(txtCaseID.Text);
            arrBillNo.Add(txtViewBillNumber.Text);
            arrSpec.Add(Session["Speciality"].ToString());
            Bill_Sys_UploadFile _objUploadFile = new Bill_Sys_UploadFile();
            _objUploadFile.sz_bill_no       = arrBillNo;
            _objUploadFile.sz_company_id    = txtCompanyID.Text;
            _objUploadFile.sz_flag          = "VR";
            _objUploadFile.sz_case_id       = arrCaseId;
            _objUploadFile.sz_speciality_id = arrSpec;
            _objUploadFile.sz_UserId        = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString();
            _objUploadFile.sz_UserName      = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME.ToString();
            ViewState["VSUpload"]           = _objUploadFile;
        }
        ScriptManager.RegisterClientScriptBlock(this, GetType(), "mm", "showUploadFilePopup();", true);
    }
Esempio n. 2
0
    protected void btnSaveDesc_Click(object sender, EventArgs e)
    {
        Bill_Sys_BillTransaction_BO obj;
        Bill_Sys_Verification_Desc  _objDesc;
        Boolean   updateFlag     = false;
        string    sz_status_code = "";
        ArrayList arr_node_type  = new ArrayList();
        string    Bill_number    = "";
        Boolean   uploadflag     = false;
        ArrayList arrCaseId      = new ArrayList();
        ArrayList arrSpeciality  = new ArrayList();
        string    szSpec         = "";

        ViewState["Process"] = "";
        ViewState["Process"] = "VR";
        ArrayList objAL     = new ArrayList();
        ArrayList arrBillNo = new ArrayList();

        String szBillNo = txtbillnumber.Text;

        szSpec = Session["Speciality"].ToString();
        arrCaseId.Add(txtCaseID.Text);
        arrBillNo.Add(szBillNo);
        arrSpeciality.Add(szSpec);
        Bill_number                   = Bill_number + szBillNo + ",";
        _objDesc                      = new Bill_Sys_Verification_Desc();
        _objDesc.sz_bill_no           = szBillNo;
        _objDesc.sz_description       = txtSaveDescription.Text;
        _objDesc.sz_verification_date = txtSaveDate.Text;
        _objDesc.i_verification       = 1;
        _objDesc.sz_company_id        = txtCompanyID.Text;
        _objDesc.sz_user_id           = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString();
        _objDesc.sz_flag              = "VR";
        objAL.Add(_objDesc);
        updateFlag = true;



        _objUploadFile                  = new Bill_Sys_UploadFile();
        _objUploadFile.sz_bill_no       = arrBillNo;
        _objUploadFile.sz_company_id    = txtCompanyID.Text;
        _objUploadFile.sz_flag          = "VR";
        _objUploadFile.sz_case_id       = arrCaseId;
        _objUploadFile.sz_speciality_id = arrSpeciality;


        if (updateFlag)
        {
            obj            = new Bill_Sys_BillTransaction_BO();
            sz_status_code = obj.InsertUpdateBillStatus(objAL);

            _objUploadFile.sz_StatusCode = sz_status_code;
            ViewState["VSUpload"]        = _objUploadFile;

            arr_node_type = obj.Get_Node_Type(objAL);
            uploadflag    = true;
            if (arr_node_type.Contains("NFVER"))
            {
                arr_node_type.Clear();
                arr_node_type.Add("NFVER");
                Session["NODETYPE"] = arr_node_type;
            }
            else
            {
                //Session["NODETYPE"] = "NFVER";
                Session["NODETYPE"] = arr_node_type;
            }
            BindGridforVerification();
            ClearControls();
            usrMessage.PutMessage("Verification Save Successfully ...!");
            usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            usrMessage.Show();
        }
    }
Esempio n. 3
0
    protected void lnkscan_Click(object sender, EventArgs e)
    {
        Bill_Sys_NotesBO _Bill_Sys_NotesBO = new Bill_Sys_NotesBO();
        DataSet          dsdetails         = new DataSet();

        dsdetails           = _Bill_Sys_NotesBO.GetPatientDenial(txtCompanyID.Text, txtCaseID.Text);
        txtcaseno.Text      = dsdetails.Tables[0].Rows[0]["SZ_CASE_NO"].ToString();
        txtpatientname.Text = dsdetails.Tables[0].Rows[0]["SZ_PATIENT_NAME"].ToString();
        int          iindex = grdVerificationReq.SelectedIndex;
        LinkButton   btn    = (LinkButton)sender;
        TableCell    tc     = (TableCell)btn.Parent;
        DataGridItem it     = (DataGridItem)tc.Parent;

        Bill_Sys_Verification_Desc  _objDesc = new Bill_Sys_Verification_Desc();
        Bill_Sys_BillTransaction_BO _obj     = new Bill_Sys_BillTransaction_BO();
        ArrayList objAL       = new ArrayList();
        ArrayList arrNodeType = new ArrayList();
        string    szCaesType  = "";
        string    szProcess   = "";


        int index = it.ItemIndex;

        Session["NODETYPESCAN"] = "";
        Session["NODETYPE"]     = "";
        //atul
        Session["SCANVERID"] = it.Cells[5].Text;

        _objDesc.sz_bill_no    = txtViewBillNumber.Text;
        _objDesc.sz_company_id = txtCompanyID.Text;
        _objDesc.sz_flag       = "VR";

        objAL.Add(_objDesc);

        arrNodeType = _obj.Get_Node_Type(objAL);

        if (it.Cells[1].Text.ToLower().Equals("verification received"))
        {
            szProcess = "VR";

            if (arrNodeType.Contains("NFVER"))
            {
                szCaesType = "OLD";
                arrNodeType.Clear();
                arrNodeType.Add("NFDEN");
                Session["NODETYPE"] = arrNodeType;
            }
            else
            {
                szCaesType          = "NEW";
                Session["NODETYPE"] = arrNodeType;
            }

            //Session["NODETYPESCAN"] = "NFDEN";
        }


        Session["ScanBillNo"] = txtViewBillNumber.Text;

        RedirectToScanApp(iindex, szCaesType, szProcess, arrNodeType[0].ToString());
    }
    protected void btnSaveDesc_Click(object sender, EventArgs e)
    {
        Bill_Sys_BillTransaction_BO obj;
        Bill_Sys_Verification_Desc  _objDesc;
        Boolean   updateFlag     = false;
        string    sz_status_code = "";
        ArrayList arr_node_type  = new ArrayList();
        string    Bill_number    = "";
        Boolean   uploadflag     = false;
        ArrayList arrCaseId      = new ArrayList();
        ArrayList arrSpeciality  = new ArrayList();
        string    szSpec         = "";

        ViewState["Process"] = "";
        ViewState["Process"] = "DEN";
        if (!hfdenialReason.Value.Equals(""))
        {
            char      ch           = ',';
            String[]  DenialReason = hfdenialReason.Value.Split(ch);
            ArrayList objAL        = new ArrayList();
            ArrayList objBillNo    = new ArrayList();
            //ArrayList arrSpeciality=new ArrayList();
            ArrayList _denialReason = new ArrayList();
            Boolean   flag          = false;

            string szBillNo = txtbillnumber.Text;
            arrSpeciality.Add(Session["Speciality"].ToString());
            arrCaseId.Add(txtCaseID.Text);
            _objDesc                      = new Bill_Sys_Verification_Desc();
            _objDesc.sz_bill_no           = szBillNo;
            _objDesc.sz_description       = txtSaveDescription.Text;
            _objDesc.sz_verification_date = txtSaveDate.Text;
            _objDesc.i_verification       = 3;
            _objDesc.sz_company_id        = txtCompanyID.Text;
            _objDesc.sz_user_id           = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString();
            _objDesc.sz_flag              = "DEN";
            objAL.Add(_objDesc);
            updateFlag = true;
            objBillNo.Add(szBillNo);

            _objUploadFile                  = new Bill_Sys_UploadFile();
            _objUploadFile.sz_bill_no       = objBillNo;
            _objUploadFile.sz_company_id    = txtCompanyID.Text;
            _objUploadFile.sz_flag          = "DEN";
            _objUploadFile.sz_case_id       = arrCaseId;
            _objUploadFile.sz_speciality_id = arrSpeciality;
            if (updateFlag)
            {
                obj            = new Bill_Sys_BillTransaction_BO();
                sz_status_code = obj.InsertUpdateBillStatus(objAL);
                _objUploadFile.sz_StatusCode = sz_status_code;
                Session["VSUpload"]          = _objUploadFile;

                uploadflag = true;

                arr_node_type = obj.Get_Node_Type(objAL);
                uploadflag    = true;

                if (hfremovedenialreason.Value != "")
                {
                    String[]  removedeial = hfremovedenialreason.Value.Split(',');
                    ArrayList objRemove   = new ArrayList();
                    for (int i = 0; i < removedeial.Length - 1; i++)
                    {
                        objRemove.Add(removedeial[i].ToString());
                    }
                    for (int j = 0; j < DenialReason.Length - 1; j++)
                    {
                        flag = false;
                        for (int k = 0; k < objRemove.Count; k++)
                        {
                            if (DenialReason[j].ToString() == objRemove[k].ToString())
                            {
                                flag = true;
                                break;
                            }
                        }

                        if (!flag)
                        {
                            _denialReason.Add(DenialReason[j].ToString());
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < DenialReason.Length - 1; j++)
                    {
                        _denialReason.Add(DenialReason[j].ToString());
                    }
                }
                if (sz_status_code != "")
                {
                    for (int i = 0; i < objBillNo.Count; i++)
                    {
                        obj.UpdateDenialReason(sz_status_code, _denialReason, objBillNo[i].ToString());
                    }
                    if (arr_node_type.Contains("NFVER"))
                    {
                        arr_node_type.Clear();
                        arr_node_type.Add("NFDEN");
                        Session["NODETYPE"] = arr_node_type;
                    }
                    else
                    {
                        //Session["NODETYPE"] = "NFVER";
                        Session["NODETYPE"] = arr_node_type;
                    }

                    BindGridforDenial();
                    ClearControls();
                    #region Activity_Log
                    this._DAO_NOTES_EO = new DAO_NOTES_EO();
                    this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "DENIAL_ADDED";
                    this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Bill Id : " + szBillNo + ", Reason : " + String.Join(",", _denialReason.ToArray());
                    this._DAO_NOTES_BO               = new DAO_NOTES_BO();
                    this._DAO_NOTES_EO.SZ_USER_ID    = (((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID);
                    this._DAO_NOTES_EO.SZ_CASE_ID    = new Bill_Sys_BillingCompanyDetails_BO().GetCaseID(szBillNo, ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    this._DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                    this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO);
                    #endregion
                    usrMessage.PutMessage("Denial Save Successfully ...!");
                    usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                    usrMessage.Show();
                }
            }
        }
    }
Esempio n. 5
0
    protected void btnSaveDesc_Click(object sender, EventArgs e)
    {
        try
        {
            Bill_Sys_BillTransaction_BO n_bo;
            Bill_Sys_Verification_Desc  desc;
            bool      flag        = false;
            bool      flag2       = false;
            string    statusCode  = "";
            ArrayList list        = new ArrayList();
            ArrayList list2       = new ArrayList();
            ArrayList list3       = new ArrayList();
            ArrayList listReasons = new ArrayList();

            this.ViewState["Process"] = "";
            this.ViewState["Process"] = "EOR";
            ArrayList list4       = new ArrayList();
            ArrayList list5       = new ArrayList();
            string    specialty   = "";
            string[]  sBillNumber = System.Text.RegularExpressions.Regex.Split(hdnBillNumber.Value.ToString(), @"\,");
            for (int j = 0; j < sBillNumber.Length; j++)
            {
                if (!string.IsNullOrEmpty(hfEORReason.Value))
                {
                    listReasons.AddRange(hfEORReason.Value.TrimEnd(',').Split(','));
                }
                string sBillNo = sBillNumber[j].ToString(); // bill no
                specialty = hdnSpecialty.Value.ToString();  //Specialty
                list2.Add(txtCaseID.Text);
                list5.Add(sBillNo);
                list3.Add(specialty);
                desc = new Bill_Sys_Verification_Desc();
                desc._sz_verification_reasons = listReasons.ToString();
                desc.sz_bill_no           = sBillNo;
                desc.sz_description       = this.txtSaveDescription.Text;
                desc.sz_verification_date = this.txtSaveDate.Text;
                desc.i_verification       = 4;
                desc.sz_company_id        = this.txtCompanyID.Text;
                desc.sz_user_id           = ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID.ToString();
                desc.sz_flag = "EOR";
                list4.Add(desc);
                flag = true;
            }

            this._objUploadFile                  = new Bill_Sys_UploadFile();
            this._objUploadFile.sz_bill_no       = list5;
            this._objUploadFile.sz_company_id    = this.txtCompanyID.Text;
            this._objUploadFile.sz_flag          = "EOR";
            this._objUploadFile.sz_case_id       = list2;
            this._objUploadFile.sz_speciality_id = list3;

            if (flag)
            {
                n_bo       = new Bill_Sys_BillTransaction_BO();
                statusCode = n_bo.InsertUpdateBillStatus(list4);
                this._objUploadFile.sz_StatusCode = statusCode;
                this.ViewState["VSUpload"]        = this._objUploadFile;
                list  = n_bo.Get_Node_Type(list4);
                flag2 = true;
                if (statusCode != "")
                {
                    DataTable eorReasonsWithBill = new DataTable();
                    eorReasonsWithBill.Columns.Add("verificationReasonIds");
                    eorReasonsWithBill.Columns.Add("billNumber");
                    foreach (string billNo in sBillNumber)
                    {
                        foreach (string eorId in listReasons)
                        {
                            eorReasonsWithBill.Rows.Add(eorId, billNo);
                        }
                    }
                    n_bo.UpdateEORReason(statusCode, eorReasonsWithBill);
                }
                if (list.Contains("NFVER"))
                {
                    list.Clear();
                    list.Add("NFVER");
                    this.Session["NODETYPE"] = list;
                }
                else
                {
                    this.Session["NODETYPE"] = list;
                }
            }

            if (!statusCode.Equals("") && flag2)
            {
                lblMessage.Visible  = true;
                lblMessage.Text     = "Record saved successfully";
                hdnStatusCode.Value = statusCode;
            }
            HtmlAnchor anchorScan = (HtmlAnchor)this.FindControl("anchorScan");
            anchorScan.Visible = true;
            BindGrid();
            lblScan.Visible   = true;
            lblScan.InnerText = "[Scan/Upload here to add the same document against all selected bills]";
        }
        catch (Exception ex)
        {
            lblErrorMessage.Visible = true;
            lblErrorMessage.Text    = ex.Message.ToString();
        }
    }
Esempio n. 6
0
    protected void btnSaveDesc_Click(object sender, EventArgs e)
    {
        Bill_Sys_BillTransaction_BO n_bo;
        Bill_Sys_Verification_Desc  desc;
        bool      flag       = false;
        string    statusCode = "";
        ArrayList list       = new ArrayList();
        string    str2       = "";
        bool      flag2      = false;
        ArrayList list2      = new ArrayList();
        ArrayList list3      = new ArrayList();
        string    str3       = "";

        this.ViewState["Process"] = "";
        this.ViewState["Process"] = "DEN";
        if (!this.hfdenialReason.Value.Equals(""))
        {
            char      ch          = ',';
            string[]  strArray    = this.hfdenialReason.Value.Split(new char[] { ch });
            ArrayList list8       = new ArrayList();
            ArrayList list9       = new ArrayList();
            ArrayList list10      = new ArrayList();
            bool      flag3       = false;
            string    specialty   = "";
            string[]  sBillNumber = System.Text.RegularExpressions.Regex.Split(hdnBillNumber.Value.ToString(), @"\,");
            for (int j = 0; j < sBillNumber.Length; j++)
            {
                string sBillNo = sBillNumber[j].ToString();    // bill no
                specialty = hdnSpecialty.Value.ToString();     //Specialty
                list3.Add(specialty);
                list2.Add(this.txtCaseID.Text);
                desc                      = new Bill_Sys_Verification_Desc();
                desc.sz_bill_no           = sBillNo;
                desc.sz_description       = this.txtSaveDescription.Text;
                desc.sz_verification_date = this.txtSaveDate.Text;
                desc.i_verification       = 3;
                desc.sz_company_id        = this.txtCompanyID.Text;
                desc.sz_user_id           = ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID.ToString();
                desc.sz_flag              = "DEN";
                list8.Add(desc);
                flag = true;
                list9.Add(sBillNo);
            }
            this._objUploadFile                  = new Bill_Sys_UploadFile();
            this._objUploadFile.sz_bill_no       = list9;
            this._objUploadFile.sz_company_id    = this.txtCompanyID.Text;
            this._objUploadFile.sz_flag          = "DEN";
            this._objUploadFile.sz_case_id       = list2;
            this._objUploadFile.sz_speciality_id = list3;
            if (flag)
            {
                n_bo       = new Bill_Sys_BillTransaction_BO();
                statusCode = n_bo.InsertUpdateBillStatus(list8);
                this._objUploadFile.sz_StatusCode = statusCode;
                this.ViewState["VSUpload"]        = this._objUploadFile;
                flag2 = true;
                list  = n_bo.Get_Node_Type(list8);
                flag2 = true;
                if (this.hfremovedenialreason.Value != "")
                {
                    string[]  strArray2 = this.hfremovedenialreason.Value.Split(new char[] { ',' });
                    ArrayList list11    = new ArrayList();
                    for (int m = 0; m < (strArray2.Length - 1); m++)
                    {
                        list11.Add(strArray2[m].ToString());
                    }
                    for (int n = 0; n < (strArray.Length - 1); n++)
                    {
                        flag3 = false;
                        for (int num6 = 0; num6 < list11.Count; num6++)
                        {
                            if (strArray[n].ToString() == list11[num6].ToString())
                            {
                                flag3 = true;
                                break;
                            }
                        }
                        if (!flag3)
                        {
                            list10.Add(strArray[n].ToString());
                        }
                    }
                }
                else
                {
                    for (int num7 = 0; num7 < (strArray.Length - 1); num7++)
                    {
                        list10.Add(strArray[num7].ToString());
                    }
                }
                if (statusCode != "")
                {
                    hdnStatusCode.Value = statusCode;
                    for (int num8 = 0; num8 < list9.Count; num8++)
                    {
                        n_bo.UpdateDenialReason(statusCode, list10, list9[num8].ToString());
                    }
                    if (list.Contains("NFVER"))
                    {
                        list.Clear();
                        list.Add("NFDEN");
                        this.Session["NODETYPE"] = list;
                    }
                    else
                    {
                        this.Session["NODETYPE"] = list;
                    }
                    HtmlAnchor anchorScan = (HtmlAnchor)this.FindControl("anchorScan");
                    anchorScan.Visible = true;
                    lblMessage.Visible = true;
                    lblMessage.Text    = "Record saved successfully";
                    this.BindGrid();
                    lblScan.Visible   = true;
                    lblScan.InnerText = "[Scan/Upload here to add the same document against all selected bills]";
                }
            }
        }
    }
Esempio n. 7
0
    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);
    }