protected void btnRevert_Click1(object sender, EventArgs e)
 {
     for (int j = 0; j < grdProcesureCode.Items.Count; j++)
     {
         CheckBox chkDelete1 = (CheckBox)grdProcesureCode.Items[j].FindControl("chkSelect");
         if (chkDelete1.Checked && grdProcesureCode.Items[j].Cells[11].Text.Trim().ToString().Equals("Received Report"))
         {
             Bill_Sys_ReportBO objUpdateReport = new Bill_Sys_ReportBO();
             objUpdateReport.RevertReport(Convert.ToInt32(grdProcesureCode.Items[j].Cells[1].Text.Trim().ToString()));
             #region Activity_Log
             this._DAO_NOTES_EO = new DAO_NOTES_EO();
             this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "REP_REVERT";
             this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Procedure Id  : " + grdProcesureCode.Items[j].Cells[1].Text.Trim().ToString() + " Report Revrted . ";
             this._DAO_NOTES_BO               = new DAO_NOTES_BO();
             this._DAO_NOTES_EO.SZ_USER_ID    = (((Bill_Sys_UserObject)HttpContext.Current.Session["USER_OBJECT"]).SZ_USER_ID);
             this._DAO_NOTES_EO.SZ_CASE_ID    = this._DAO_NOTES_EO.SZ_CASE_ID = (((Bill_Sys_CaseObject)HttpContext.Current.Session["CASE_OBJECT"]).SZ_CASE_ID);
             this._DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)HttpContext.Current.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
             this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO);
             #endregion
             lblMsg.Text    = "Report Reverted Successfully";
             lblMsg.Visible = true;
         }
     }
     GetProcedureList(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
 }
Exemplo n.º 2
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        Bill_Sys_Upload_VisitReport objDelete = new Bill_Sys_Upload_VisitReport();
        string szOutPut = "";

        for (int i = 0; i < grdViewDoc.Rows.Count; i++)
        {
            CheckBox grdChk = (CheckBox)grdViewDoc.Rows[i].FindControl("ChkDelete");
            if (grdChk.Checked)
            {
                string szImageId = grdViewDoc.DataKeys[i]["I_IMAGE_ID"].ToString();
                string msg       = "Delete-Visit-Document File " + grdViewDoc.DataKeys[i]["File_Name"].ToString() + " is deleted by user " + ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_NAME + "on " + DateTime.Now.ToString("MM/dd/yyyy") + " with Image ID " + szImageId;
                string szResult  = objDelete.DeleteFile(txtCompnyID.Text, szImageId, "F", ((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_CASE_ID, msg, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID);
                if (szResult == "YES")
                {
                    if (szOutPut == "")
                    {
                        szOutPut = grdViewDoc.DataKeys[i]["File_Name"].ToString() + "is delete";
                    }
                    else
                    {
                        szOutPut = "\\n" + grdViewDoc.DataKeys[i]["File_Name"].ToString() + "is delete";
                    }
                    #region Activity_Log
                    this._DAO_NOTES_EO = new DAO_NOTES_EO();
                    this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "DOC_DELETED";
                    this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Document Id  : " + grdViewDoc.DataKeys[i]["I_IMAGE_ID"].ToString() + " Deleted . ";
                    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    = this._DAO_NOTES_EO.SZ_CASE_ID = (((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_CASE_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
                }
                else if (szResult == "NO")
                {
                    if (szOutPut == "")
                    {
                        szOutPut = grdViewDoc.DataKeys[i]["File_Name"].ToString() + "is not delete";
                    }
                    else
                    {
                        szOutPut = "\\n" + grdViewDoc.DataKeys[i]["File_Name"].ToString() + "is not delete";
                    }
                }
            }
        }
        if (szOutPut != "")
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ss", "<script language='javascript'>alert('" + szOutPut + "');</script>");
            grdViewDoc.XGridBindSearch();
        }
    }
Exemplo n.º 3
0
    public void SaveActivityNotes(DAO_NOTES_EO _notesEO)
    {
        XmlDocument doc = new XmlDocument();

        sqlCon = new SqlConnection(strConn);
        try
        {
            doc.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "XML/ActivityNotesXML.xml");
            XmlNodeList nl         = doc.SelectNodes("NOTES/" + _notesEO.SZ_MESSAGE_TITLE + "/MESSAGE");
            string      strMessage = _notesEO.SZ_ACTIVITY_DESC + " " + nl.Item(0).InnerText;


            sqlCon.Open();
            sqlCmd = new SqlCommand("SP_TXN_NOTES", sqlCon);
            sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
            sqlCmd.CommandTimeout = 0;
            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_CODE", "NOT1004");
            sqlCmd.Parameters.AddWithValue("@SZ_CASE_ID", _notesEO.SZ_CASE_ID);
            sqlCmd.Parameters.AddWithValue("@SZ_USER_ID", _notesEO.SZ_USER_ID);
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_TYPE", "NTY0001");
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_DESCRIPTION", strMessage);
            sqlCmd.Parameters.AddWithValue("@IS_DENIED", _notesEO.IS_DENIED);
            sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", _notesEO.SZ_COMPANY_ID);
            sqlCmd.Parameters.AddWithValue("@FLAG", "ADD");
            sqlCmd.ExecuteNonQuery();
        }
        catch (SqlException ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
        }
        finally
        {
            if (sqlCon.State == ConnectionState.Open)
            {
                sqlCon.Close();
            }
        }
    }
Exemplo n.º 4
0
    protected void btnSave_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
        {
            Boolean _valid = true;
            if (ddlStatus.SelectedValue == "1")
            {
                if (txtReScheduleDate.Text == "" && ddlReSchHours.SelectedValue == "00")
                {
                    lblMessage.Text = "Please enter Res-Schedule Date and Time";
                    _valid          = false;
                }
            }
            else if (ddlStatus.SelectedValue == "2")
            {
                if (ddlTestNames.GetSelectedIndices().Length == 0)
                {
                    lblMessage.Text = "Please select procedure";
                    _valid          = false;
                }

                DateTime dtPassDate;
                dtPassDate = Convert.ToDateTime(lblDate.Text);
                if (dtPassDate > DateTime.Now)
                {
                    lblMessage.Text = "Cannot complete visit at future date.";
                    _valid          = false;
                }
            }
            else if (ddlStatus.SelectedValue == "3")
            {
                DateTime dtPassDate;
                dtPassDate = Convert.ToDateTime(lblDate.Text);
                if (dtPassDate > DateTime.Now)
                {
                    lblMessage.Text = "Cannot no show visit at future date.";
                    _valid          = false;
                }
            }
            if (_valid == true)
            {
                string            eventID            = Request.QueryString["id"].ToString();
                Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                ArrayList         objAdd;
                if (ddlStatus.SelectedValue == "2")
                {
                    foreach (ListItem lst in ddlTestNames.Items)
                    {
                        if (lst.Selected == true)
                        {
                            objAdd = new ArrayList();
                            objAdd.Add(lst.Value);
                            objAdd.Add(eventID);
                            objAdd.Add(ddlStatus.SelectedValue);
                            _bill_Sys_Calender.Update_Event_RefferPrcedure(objAdd);

                            Bill_Sys_ReferalEvent _bill_Sys_ReferalEvent = new Bill_Sys_ReferalEvent();
                            ArrayList             arrOBJ = new ArrayList();
                            arrOBJ.Add(lblDoctorID.Text);
                            arrOBJ.Add(lst.Value);
                            arrOBJ.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                            arrOBJ.Add(lst.Value);
                            _bill_Sys_ReferalEvent.AddDoctorAmount(arrOBJ);

                            _bill_Sys_Calender.UpdateProcedure(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, lblDoctorID.Text, lst.Value, true, "");
                        }
                        else
                        {
                            _bill_Sys_Calender.UpdateProcedure(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, lblDoctorID.Text, lst.Value, false, eventID);
                        }
                    }
                }
                else if (ddlStatus.SelectedValue == "1")
                {
                    objAdd = new ArrayList();
                    objAdd.Add(txtCaseID.Text);
                    objAdd.Add(txtReScheduleDate.Text);
                    objAdd.Add(ddlReSchHours.SelectedValue.ToString() + "." + ddlReSchMinutes.SelectedValue.ToString());
                    objAdd.Add(txtNotes.Text);
                    objAdd.Add(lblDoctorID.Text);
                    objAdd.Add(lblTypeCode.Text);
                    objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    objAdd.Add(ddlReSchTime.SelectedValue);
                    ////////////////
                    int    endMin  = Convert.ToInt32(ddlReSchMinutes.SelectedValue) + Convert.ToInt32("30");
                    int    endHr   = Convert.ToInt32(ddlReSchHours.SelectedValue);
                    string endTime = ddlReSchTime.SelectedValue;
                    if (endMin >= 60)
                    {
                        endMin = endMin - 60;
                        endHr  = endHr + 1;
                        if (endHr > 12)
                        {
                            endHr = endHr - 12;
                            if (ddlReSchHours.SelectedValue != "12")
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                        else if (endHr == 12)
                        {
                            if (ddlReSchHours.SelectedValue != "12")
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                    }

                    //ddlEndHours.SelectedValue = endHr.ToString().PadLeft(2, '0');
                    //ddlEndMinutes.SelectedValue = endMin.ToString().PadLeft(2, '0');
                    //ddlEndTime.SelectedValue = endTime.ToString();
                    /////////////////
                    objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                    objAdd.Add(endTime.ToString());
                    _bill_Sys_Calender.SaveEvent(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                    objAdd = new ArrayList();
                    objAdd.Add(txtCaseID.Text);
                    objAdd.Add(lblDoctorID.Text);
                    objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    int reScheventID = _bill_Sys_Calender.GetEventID(objAdd);
                    if (_bill_Sys_Calender.CheckReferralExists(lblDoctorID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID) == true)
                    {
                        foreach (ListItem lstItem in ddlTestNames.Items)
                        {
                            if (lstItem.Selected == true)
                            {
                                objAdd = new ArrayList();
                                objAdd.Add(lstItem.Value);
                                objAdd.Add(reScheventID);
                                objAdd.Add(0);
                                _bill_Sys_Calender.Update_Event_RefferPrcedure(objAdd, eventID);
                                //              _bill_Sys_Calender.Save_Event_RefferPrcedure(objAdd);


                                _bill_Sys_Calender.UpdateProcedure(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, lblDoctorID.Text, lstItem.Value, true, "");
                            }
                            else
                            {
                                _bill_Sys_Calender.UpdateProcedure(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, lblDoctorID.Text, lstItem.Value, false, reScheventID.ToString());
                            }
                        }
                    }
                }

                _bill_Sys_Calender = new Bill_Sys_Calender();
                objAdd             = new ArrayList();
                objAdd.Add(eventID);
                objAdd.Add(false);
                objAdd.Add(ddlStatus.SelectedValue);
                _bill_Sys_Calender.UPDATE_Event_Status(objAdd);
                // Start : Save appointment Notes.

                _DAO_NOTES_EO = new DAO_NOTES_EO();
                _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "APPOINTMENT_UPDATED";
                //  _DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Date : " + lblDate.Text;

                _DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Date : " + lblDate.Text.Substring(0, lblDate.Text.IndexOf(" ")) + " " + lblHours.Text + ":" + lblMinutes.Text + " " + lblTime.Text;

                _DAO_NOTES_BO               = new DAO_NOTES_BO();
                _DAO_NOTES_EO.SZ_USER_ID    = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;
                _DAO_NOTES_EO.SZ_CASE_ID    = txtCaseID.Text;
                _DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO);


                // End
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ss", "<script language='javascript'>  parent.document.getElementById('divid').style.visibility = 'hidden';window.parent.document.location.href=window.parent.document.location.href;window.self.close();window.parent.document.location.reload(); parent.document.getElementById('lblMsg').value='Event added successfully.';</script>");
            }
        }
        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());
        }
    }
Exemplo n.º 5
0
    public Result saveBillTransaction(ArrayList objBillTransactionEO, ArrayList objUpdateStatus, ArrayList SaveEventRefferPrcedure, DAO_NOTES_EO _DAO_NOTES_EO, ArrayList p_objProcedureCodes, ArrayList p_objALDiagCode)
    {
        Result objResult = new Result();

        conn = new SqlConnection(strsqlCon);
        conn.Open();
        sqlCmd = new SqlCommand();
        sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
        SqlTransaction transaction;

        transaction = conn.BeginTransaction();
        string strBillID = "";

        try
        {
            // conn.Open();
            sqlCmd = new SqlCommand("SP_TXN_BILL_TRANSACTIONS", conn);
            sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
            sqlCmd.CommandTimeout = 0;
            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.Transaction    = transaction;
            sqlCmd.Parameters.AddWithValue("@SZ_CASE_ID", objBillTransactionEO[0].ToString());
            sqlCmd.Parameters.AddWithValue("@DT_BILL_DATE", objBillTransactionEO[1].ToString());
            sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", objBillTransactionEO[2].ToString());
            sqlCmd.Parameters.AddWithValue("@SZ_DOCTOR_ID", objBillTransactionEO[3].ToString());
            sqlCmd.Parameters.AddWithValue("@SZ_DOCTOR_ID", objBillTransactionEO[3].ToString());
            sqlCmd.Parameters.AddWithValue("@SZ_TYPE", objBillTransactionEO[4].ToString());
            sqlCmd.Parameters.AddWithValue("@FLAG", "ADD");
            sqlCmd.ExecuteNonQuery();

            sqlCmd = new SqlCommand();
            sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
            sqlCmd.CommandText    = "SP_TXN_LATEST_BILL_TRANSACTIONS";
            sqlCmd.Transaction    = transaction;
            sqlCmd.CommandTimeout = 0;
            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.Transaction    = transaction;
            sqlCmd.Connection     = conn;

            sqlCmd.Parameters.AddWithValue("@FLAG", "GETLATESTBILLID");
            sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", objBillTransactionEO[2].ToString());

            dr = sqlCmd.ExecuteReader();
            while (dr.Read())
            {
                strBillID = Convert.ToString(dr[0]);
            }
            dr.Close();


            if (objUpdateStatus.Count > 0)
            {
                for (int i = 0; i < objUpdateStatus.Count; i++)
                {
                    UpdateEventStatus objUpdateEventStatus = new UpdateEventStatus();
                    objUpdateEventStatus = (UpdateEventStatus)objUpdateStatus[i];

                    sqlCmd = new SqlCommand();
                    sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                    sqlCmd.CommandText    = "UPDATE_EVENT_STATUS";
                    sqlCmd.CommandType    = CommandType.StoredProcedure;
                    sqlCmd.Connection     = conn;
                    sqlCmd.Parameters.AddWithValue("@I_EVENT_ID ", objUpdateEventStatus.I_EVENT_ID);
                    sqlCmd.Parameters.AddWithValue("@BT_STATUS", objUpdateEventStatus.BT_STATUS);

                    sqlCmd.Parameters.AddWithValue("@I_STATUS", objUpdateEventStatus.I_STATUS);
                    sqlCmd.Parameters.AddWithValue("@SZ_BILL_NUMBER", strBillID);
                    sqlCmd.Parameters.AddWithValue("@DT_BILL_DATE", objUpdateEventStatus.DT_BILL_DATE);
                    sqlCmd.ExecuteNonQuery();
                }
            }

            if (SaveEventRefferPrcedure.Count > 0)
            {
                for (int i = 0; i < SaveEventRefferPrcedure.Count; i++)
                {
                    UpdateEventStatus objUpdateEventStatus = new UpdateEventStatus();
                    objUpdateEventStatus = (UpdateEventStatus)SaveEventRefferPrcedure[i];
                    sqlCmd = new SqlCommand();
                    sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                    sqlCmd.CommandText    = "SP_SAVE_REFERRAL_PROC_CODE";
                    sqlCmd.CommandType    = CommandType.StoredProcedure;
                    sqlCmd.Connection     = conn;
                    sqlCmd.Parameters.AddWithValue("@SZ_PROC_CODE ", objUpdateEventStatus.sz_procode_id);
                    sqlCmd.Parameters.AddWithValue("@I_EVENT_ID", objUpdateEventStatus.I_EVENT_ID);
                    sqlCmd.Parameters.AddWithValue("@I_STATUS", objUpdateEventStatus.I_STATUS);
                    sqlCmd.ExecuteNonQuery();
                }
            }


            sqlCmd = new SqlCommand("SP_TXN_NOTES", conn);
            sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
            sqlCmd.CommandTimeout = 0;
            sqlCmd.CommandType    = CommandType.StoredProcedure;
            sqlCmd.Transaction    = transaction;
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_CODE", "NOT1004");
            sqlCmd.Parameters.AddWithValue("@SZ_CASE_ID", _DAO_NOTES_EO.SZ_CASE_ID);
            sqlCmd.Parameters.AddWithValue("@SZ_USER_ID", _DAO_NOTES_EO.SZ_USER_ID);
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_TYPE", "NTY0001");
            sqlCmd.Parameters.AddWithValue("@SZ_NOTE_DESCRIPTION", strBillID + _DAO_NOTES_EO.SZ_ACTIVITY_DESC);
            sqlCmd.Parameters.AddWithValue("@IS_DENIED", _DAO_NOTES_EO.IS_DENIED);
            sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", _DAO_NOTES_EO.SZ_COMPANY_ID);
            sqlCmd.Parameters.AddWithValue("@FLAG", "ADD");
            sqlCmd.ExecuteNonQuery();

            #region "Save procedure codes."

            if (p_objProcedureCodes != null)
            {
                if (p_objProcedureCodes.Count > 0)
                {
                    for (int i = 0; i < p_objProcedureCodes.Count; i++)
                    {
                        BillProcedureCodeEO objBillProcedureCodeEO = new BillProcedureCodeEO();

                        objBillProcedureCodeEO = (BillProcedureCodeEO)p_objProcedureCodes[i];
                        sqlCmd = new SqlCommand();
                        sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                        sqlCmd.CommandText    = "SP_TXN_BILL_TRANSACTIONS_DETAIL";
                        sqlCmd.CommandType    = CommandType.StoredProcedure;
                        sqlCmd.Connection     = conn;
                        sqlCmd.Transaction    = transaction;
                        sqlCmd.Parameters.AddWithValue("@SZ_PROCEDURE_ID", objBillProcedureCodeEO.SZ_PROCEDURE_ID);
                        sqlCmd.Parameters.AddWithValue("@FL_AMOUNT", objBillProcedureCodeEO.FL_AMOUNT);
                        sqlCmd.Parameters.AddWithValue("@SZ_BILL_NUMBER", strBillID);
                        sqlCmd.Parameters.AddWithValue("@DT_DATE_OF_SERVICE", objBillProcedureCodeEO.DT_DATE_OF_SERVICE);
                        sqlCmd.Parameters.AddWithValue("@SZ_COMPANY_ID", objBillProcedureCodeEO.SZ_COMPANY_ID);
                        sqlCmd.Parameters.AddWithValue("@I_UNIT", objBillProcedureCodeEO.I_UNIT);
                        sqlCmd.Parameters.AddWithValue("@FLT_PRICE", objBillProcedureCodeEO.FLT_PRICE);
                        sqlCmd.Parameters.AddWithValue("@FLT_FACTOR", objBillProcedureCodeEO.FLT_FACTOR);
                        sqlCmd.Parameters.AddWithValue("@DOCT_AMOUNT", objBillProcedureCodeEO.DOCT_AMOUNT);
                        sqlCmd.Parameters.AddWithValue("@PROC_AMOUNT", objBillProcedureCodeEO.PROC_AMOUNT);
                        sqlCmd.Parameters.AddWithValue("@SZ_DOCTOR_ID", objBillProcedureCodeEO.SZ_DOCTOR_ID);
                        sqlCmd.Parameters.AddWithValue("@SZ_CASE_ID", objBillProcedureCodeEO.SZ_CASE_ID);
                        sqlCmd.Parameters.AddWithValue("@SZ_TYPE_CODE_ID", objBillProcedureCodeEO.SZ_TYPE_CODE_ID);
                        if (objBillProcedureCodeEO.I_GROUP_AMOUNT_ID.ToString() != "" && objBillProcedureCodeEO.I_GROUP_AMOUNT_ID.ToString() != "&nbsp;")
                        {
                            sqlCmd.Parameters.AddWithValue("@I_GROUP_AMOUNT_ID", objBillProcedureCodeEO.I_GROUP_AMOUNT_ID.ToString());
                        }

                        if (objBillProcedureCodeEO.FLT_GROUP_AMOUNT.ToString() != "" && objBillProcedureCodeEO.FLT_GROUP_AMOUNT.ToString() != "&nbsp;")
                        {
                            sqlCmd.Parameters.AddWithValue("@FLT_GROUP_AMOUNT", objBillProcedureCodeEO.FLT_GROUP_AMOUNT.ToString());
                        }

                        if (objBillProcedureCodeEO.SZ_PATIENT_TREATMENT_ID != "" && objBillProcedureCodeEO.SZ_PATIENT_TREATMENT_ID != "&nbsp;")
                        {
                            sqlCmd.Parameters.AddWithValue("@SZ_PATIENT_TREATMENT_ID", objBillProcedureCodeEO.SZ_PATIENT_TREATMENT_ID);
                        }
                        if (objBillProcedureCodeEO.i_cyclic_id != "" && objBillProcedureCodeEO.i_cyclic_id != "&nbsp;" && objBillProcedureCodeEO.i_cyclic_id != null)
                        {
                            sqlCmd.Parameters.AddWithValue("@i_cyclic_id", objBillProcedureCodeEO.i_cyclic_id);
                        }
                        if (objBillProcedureCodeEO.bt_cyclic_applied != "" && objBillProcedureCodeEO.bt_cyclic_applied != "&nbsp;" && objBillProcedureCodeEO.bt_cyclic_applied != null)
                        {
                            sqlCmd.Parameters.AddWithValue("@bt_cyclic_applied", objBillProcedureCodeEO.bt_cyclic_applied);
                        }
                        sqlCmd.Parameters.AddWithValue("@FLAG", "ADD");
                        sqlCmd.ExecuteNonQuery();
                    }
                }
            }

            #endregion


            sqlCmd = new SqlCommand("SP_TXN_BILL_TRANSACTIONS_DETAIL", conn);
            sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
            sqlCmd.CommandTimeout = 0;
            sqlCmd.Transaction    = transaction;
            sqlCmd.Parameters.AddWithValue("@SZ_BILL_NUMBER", strBillID);
            sqlCmd.Parameters.AddWithValue("@FLAG", "DELETEBILLDIAGNOSIS");
            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.ExecuteNonQuery();

            #region "Save Diagnosis Code."

            if (p_objALDiagCode != null)
            {
                if (p_objALDiagCode.Count > 0)
                {
                    for (int iCount = 0; iCount < p_objALDiagCode.Count; iCount++)
                    {
                        BillDiagnosisCodeEO objBillDiagnosisCodeEO = new BillDiagnosisCodeEO();
                        objBillDiagnosisCodeEO = (BillDiagnosisCodeEO)p_objALDiagCode[iCount];
                        sqlCmd = new SqlCommand();
                        sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                        sqlCmd.CommandText    = "SP_TXN_BILL_TRANSACTIONS_DETAIL";
                        sqlCmd.CommandType    = CommandType.StoredProcedure;
                        sqlCmd.Connection     = conn;
                        sqlCmd.Transaction    = transaction;
                        sqlCmd.Parameters.AddWithValue("@SZ_DIAGNOSIS_CODE_ID", objBillDiagnosisCodeEO.SZ_DIAGNOSIS_CODE_ID);
                        sqlCmd.Parameters.AddWithValue("@SZ_BILL_NUMBER", strBillID);
                        sqlCmd.Parameters.AddWithValue("@FLAG", "ADDBILLDIAGNOSIS");
                        sqlCmd.ExecuteNonQuery();
                    }
                }
            }

            #endregion
            transaction.Commit();
            objResult.bill_no  = strBillID;
            objResult.msg      = "Sccuess";
            objResult.msg_code = "SCC";
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            objResult.msg_code = "ERR";
            objResult.msg      = "System can not generate bill for this case. Contact GreenBills support <br/> " + ex.Message;
            objResult.bill_no  = "";
            transaction.Rollback();;
        }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
        return(objResult);
    }
Exemplo n.º 6
0
    protected void btnDelete_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());
        }
        _caseDetailsBO = new CaseDetailsBO();
        Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();

        try
        {
            bool flagdelete = false;
            foreach (DataGridItem grdItem in grdCaseMaster.Items)
            {
                CheckBox chkDelete = (CheckBox)grdItem.FindControl("chkHardDelete");
                if (chkDelete.Checked)
                {
                    LinkButton lnk = (LinkButton)grdItem.FindControl("lnkSelectCase");
                    _caseDetailsBO.HardDelete(lnk.CommandArgument.ToString(), txtCompanyID.Text);

                    flagdelete = true;
                    String szDefaultPath    = objNF3Template.getPhysicalPath();
                    String szDestinationDir = "";

                    if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true && ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID == (((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID))
                    {
                        szDestinationDir = objNF3Template.GetCompanyName(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    }
                    else
                    {
                        szDestinationDir = objNF3Template.GetCompanyName(grdItem.Cells[31].Text);
                    }
                    szDestinationDir = szDestinationDir + "/" + lnk.CommandArgument.ToString();

                    if (Directory.Exists(szDefaultPath + szDestinationDir))
                    {
                        string[] files = Directory.GetFiles(szDefaultPath + szDestinationDir, "*.*", SearchOption.AllDirectories);
                        foreach (string file in files)
                        {
                            System.IO.File.Delete(file);
                        }

                        Directory.Delete(szDefaultPath + szDestinationDir, true);
                    }
                    this._DAO_NOTES_EO = new DAO_NOTES_EO();
                    this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "CASE_DELETED";
                    this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Case Id " + lnk.CommandArgument.ToString() + "deleted.";
                    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    = (((Bill_Sys_CaseObject)this.Session["CASE_OBJECT"]).SZ_CASE_ID);
                    this._DAO_NOTES_EO.SZ_COMPANY_ID = this.txtCompanyID.Text;
                    this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO);
                }
            }

            if (flagdelete == true)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "mm", "<script language='javascript'>alert('Case deleted successfully');</script>");
            }
            BindGrid();
        }
        catch (Exception ex)
        {
            log.Debug("Shared_MasterPage. Method - Page_Load : " + ex.Message.ToString());
            log.Debug("Shared_MasterPage. Method - Page_Load : " + ex.StackTrace.ToString());
            log.Debug("Shared_MasterPage. Method - Page_Load : " + ex.InnerException.Message.ToString());
            log.Debug("Shared_MasterPage. Method - Page_Load : " + ex.InnerException.StackTrace.ToString());
            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());
        }
    }
Exemplo 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);
    }
    protected void btnSave_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
        {
            this._bill_Sys_Visit_BO = new Bill_Sys_Visit_BO();
            string    str         = "";
            string    str1        = "";
            string    szPatientID = null;
            string    dt_Opendate = null;
            string    dt_Created  = null;
            ArrayList arr         = new ArrayList();
            foreach (DataGridItem item in this.grdCaseMaster.Items)
            {
                if (!((CheckBox)item.Cells[0].FindControl("chkSelect")).Checked)
                {
                    continue;
                }
                szPatientID = item.Cells[3].Text;
                ArrayList arrayLists = new ArrayList();
                arrayLists.Add(this.txtCompanyID.Text);
                arrayLists.Add(item.Cells[COL_CASE_ID].Text);
                arrayLists.Add(this.ddlDoctor.SelectedValue);
                arrayLists.Add(this.txtAppointdate.Text);
                if (this._bill_Sys_Visit_BO.Checkvisitexists(arrayLists))
                {
                    str = (str != "" ? string.Concat(str, ", ", item.Cells[4].Text) : item.Cells[4].Text);

                    //List of patients who have a visit for the selected date. Avoid adding visit for them
                    arr.Add(szPatientID);
                }
            }

            foreach (DataGridItem item in this.grdCaseMaster.Items)
            {
                if (!((CheckBox)item.Cells[0].FindControl("chkSelect")).Checked)
                {
                    continue;
                }
                szPatientID = item.Cells[3].Text;
                dt_Opendate = item.Cells[7].Text;
                DateTime dtOpen = Convert.ToDateTime(dt_Opendate);
                dt_Created = item.Cells[6].Text;
                DateTime dtcreate         = Convert.ToDateTime(dt_Created);
                bool     flagAlreadyExist = exists(szPatientID, arr);

                if (flagAlreadyExist == false)
                {
                    if (this.lstProcedureCode.Visible || !(Convert.ToDateTime(this.txtAppointdate.Text) > Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"))))
                    {
                        if ((Convert.ToDateTime(this.txtAppointdate.Text) >= Convert.ToDateTime(dtOpen.ToString("MM/dd/yyyy"))) && (Convert.ToDateTime(this.txtAppointdate.Text) >= Convert.ToDateTime(dtcreate.ToString("MM/dd/yyyy"))))
                        {
                            bool flag2 = false;
                            if (!((CheckBox)item.Cells[0].FindControl("chkSelect")).Checked)
                            {
                                continue;
                            }

                            this._bill_Sys_Calender = new Bill_Sys_Calender();
                            this.objAdd             = new ArrayList();
                            this.objAdd.Add(item.Cells[2].Text);
                            this.objAdd.Add(this.txtAppointdate.Text);
                            this.objAdd.Add("8.30");
                            this.objAdd.Add("");
                            this.objAdd.Add(this.ddlDoctor.SelectedValue);
                            this.objAdd.Add("TY000000000000000003");
                            this.objAdd.Add(((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                            this.objAdd.Add("AM");
                            this.objAdd.Add("9.00");
                            this.objAdd.Add("AM");
                            this.objAdd.Add(szPatientID);


                            this._bill_Sys_Calender.SaveEventWithAutoVisitType(this.objAdd, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                            ArrayList arrayLists1 = new ArrayList();
                            arrayLists1.Add(item.Cells[2].Text);
                            arrayLists1.Add(this.ddlDoctor.SelectedValue);
                            arrayLists1.Add(((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                            int eventID = this._bill_Sys_Calender.GetEventID(arrayLists1);

                            if (this.lstProcedureCode.Visible)
                            {
                                this._bill_Sys_Calender = new Bill_Sys_Calender();

                                this.objAdd = new ArrayList();
                                this.objAdd.Add(eventID);
                                this.objAdd.Add(false);
                                this.objAdd.Add(this.ddlStatus.SelectedValue);
                                this._bill_Sys_Calender.UPDATE_Event_Status(this.objAdd);
                                foreach (ListItem listItem in this.lstProcedureCode.Items)
                                {
                                    if (!listItem.Selected)
                                    {
                                        continue;
                                    }
                                    this.objAdd = new ArrayList();
                                    this.objAdd.Add(listItem.Value);
                                    this.objAdd.Add(eventID);
                                    this.objAdd.Add(this.ddlStatus.SelectedValue);
                                    this._bill_Sys_Calender.Save_Event_RefferPrcedure(this.objAdd);
                                }
                            }
                            this._DAO_NOTES_EO = new DAO_NOTES_EO();
                            this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "APPOINTMENT_ADDED";
                            this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = string.Concat("Date : ", this.txtAppointdate.Text);
                            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    = item.Cells[2].Text;
                            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);
                            flag2 = true;

                            if (flag2)
                            {
                                this.lblMsg.Text = "Appointment(s) scheduled successfully";
                            }
                        }
                        else
                        {
                            str1 = (str1 != "" ? string.Concat(str1, ", ", item.Cells[4].Text) : item.Cells[4].Text);
                            //this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "ss", "<script language='javascript'>alert('Visit date cannot be future date from open date');</script>");
                        }
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "ss", "<script language='javascript'>alert('Visit for future date cannot be added');</script>");
                    }
                }
            }

            if (str != "")
            {
                ClientScriptManager clientScript = this.Page.ClientScript;
                Type     type = base.GetType();
                string[] text = new string[] { "<script language='javascript'>alert('Visit for ", str, " already scheduled on ", this.txtAppointdate.Text, " ...!');</script>" };
                clientScript.RegisterClientScriptBlock(type, "ss", string.Concat(text));
            }
            if (str1 != "")
            {
                lblDateMsg.Text = "Visit for " + str1 + " can be future date from open date.";
            }
        }
        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());
        }
    }
Exemplo n.º 9
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);
        }
    }
Exemplo n.º 10
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());
        }
    }
Exemplo n.º 11
0
        public void DeleteRequiredDocuments(ArrayList p_List)
        {
            SqlConnection sqlCon = null;

            try
            {
                sqlCon = new SqlConnection(strsqlCon);
                sqlCon.Open();

                Bill_Sys_RequiredDAO dao;
                string szFilePath = "";
                for (int i = 0; i < p_List.Count; i++)
                {
                    dao = (Bill_Sys_RequiredDAO)p_List[i];
                    SqlCommand sqlCmd = new SqlCommand("sp_delete_required_documents", sqlCon);
                    sqlCmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                    sqlCmd.CommandType    = CommandType.StoredProcedure;
                    sqlCmd.Parameters.AddWithValue("@i_image_id", dao.ImageID);
                    sqlCmd.Parameters.AddWithValue("@i_txn_id", dao.TransactionID);
                    sqlCmd.Parameters.AddWithValue("@sz_case_id", dao.CaseId);
                    sqlCmd.Parameters.AddWithValue("@sz_company_id", dao.CompanyId);
                    SqlParameter paramImageID = new SqlParameter("@sz_file_path", SqlDbType.NVarChar);
                    paramImageID.Direction = ParameterDirection.Output;
                    paramImageID.Size      = 255;
                    sqlCmd.Parameters.Add(paramImageID);
                    sqlCmd.ExecuteNonQuery();
                    szFilePath = sqlCmd.Parameters["@sz_file_path"].Value.ToString();
                    if (szFilePath != null)
                    {
                        if (szFilePath != "")
                        {
                            if (System.IO.File.Exists(szFilePath))
                            {
                                try
                                {
                                    System.IO.File.Move(szFilePath, szFilePath + ".deleted.req");
                                }
                                catch (Exception ex)
                                {
                                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                                }
                            }
                        }
                    }
                    #region Activity_Log
                    this._DAO_NOTES_EO = new DAO_NOTES_EO();
                    this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "DOC_DELETED";
                    this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Document Id  : " + dao.ImageID + " Deleted . ";
                    this._DAO_NOTES_BO               = new DAO_NOTES_BO();
                    this._DAO_NOTES_EO.SZ_USER_ID    = (((Bill_Sys_UserObject)HttpContext.Current.Session["USER_OBJECT"]).SZ_USER_ID);
                    this._DAO_NOTES_EO.SZ_CASE_ID    = this._DAO_NOTES_EO.SZ_CASE_ID = (((Bill_Sys_CaseObject)HttpContext.Current.Session["CASE_OBJECT"]).SZ_CASE_ID);
                    this._DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)HttpContext.Current.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                    this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO);
                    #endregion
                }
            }
            catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); }
            finally
            {
                if (sqlCon != null)
                {
                    sqlCon.Close();
                    sqlCon = null;
                }
            }
        }
    protected void btnDelete_Click(object sender, System.EventArgs e)
    {//Logging Start
        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 companyid = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;

            //this.btnDelete.Attributes.Add("onclick", "return ConfirmDelete();");
            for (int i = 0; i < this.grdDelDocImg.VisibleRowCount; i++)
            {
                GridViewDataColumn col = (GridViewDataColumn)grdDelDocImg.Columns[5];
                CheckBox           box = (CheckBox)this.grdDelDocImg.FindRowCellTemplateControl(i, col, "chkDel");

                if (box.Checked == true)
                {
                    //To Delete to documents images from database //

                    string billno   = grdDelDocImg.GetRowValues(i, "SZ_BILL_NUMBER").ToString();
                    string Filename = grdDelDocImg.GetRowValues(i, "Filename").ToString();
                    Int32  Imageid  = Convert.ToInt32(grdDelDocImg.GetRowValues(i, "ImageID").ToString());
                    string msg      = "Verification File " + Filename + " deleted by user " + ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_NAME + "on " + DateTime.Now.ToString("MM/dd/yyyy") + " For Bill Number " + billno;
                    this.DeleteImageDocument(companyid, billno, Imageid, hdncaseid.Value, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID, msg);


                    // To Move documents //

                    string filename         = "";
                    string Physicalfilepath = "";
                    string destpath         = "";
                    string deletefile       = "";

                    filename         = grdDelDocImg.GetRowValues(i, "Filename").ToString();
                    Physicalfilepath = grdDelDocImg.GetRowValues(i, "Physical_File_Path").ToString();

                    //pdfpath = ConfigurationManager.AppSettings["DocumentManagerURL"] + filepath ;
                    if (Physicalfilepath == "")
                    {
                        string pth = ConfigurationManager.AppSettings["BASEPATH"] + Physicalfilepath;
                        if (Directory.Exists(pth))
                        {
                        }
                        else
                        {
                            Directory.CreateDirectory(pth);
                        }
                    }
                    else
                    {
                        destpath = ConfigurationManager.AppSettings["BASEPATH"] + Physicalfilepath;

                        deletefile = destpath + ".deleted";

                        // if delete file is exist
                        if (File.Exists(deletefile))
                        {
                            File.Move(destpath, destpath + DateTime.Now.ToString("MMddyyyyss") + ".deleted");
                        }

                        // if file is exist
                        if (File.Exists(destpath))
                        {
                            File.Move(destpath, destpath + ".deleted");
                        }
                        else
                        {
                            //this.usrMessage.PutMessage("File Not Found..!");
                            //this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_SystemMessage);
                            //this.usrMessage.Show();
                        }
                    }
                    #region Activity_Log
                    this._DAO_NOTES_EO = new DAO_NOTES_EO();

                    this._DAO_NOTES_EO.SZ_MESSAGE_TITLE = "VER_IMAGE_DELETED";
                    this._DAO_NOTES_EO.SZ_ACTIVITY_DESC = "for  Bill Id : " + billno + " Image Id  : " + Imageid;
                    this._DAO_NOTES_BO               = new DAO_NOTES_BO();
                    this._DAO_NOTES_EO.SZ_USER_ID    = (((Bill_Sys_UserObject)HttpContext.Current.Session["USER_OBJECT"]).SZ_USER_ID);
                    this._DAO_NOTES_EO.SZ_CASE_ID    = new Bill_Sys_BillingCompanyDetails_BO().GetCaseID(billno, ((Bill_Sys_BillingCompanyObject)HttpContext.Current.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    this._DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)HttpContext.Current.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                    this._DAO_NOTES_BO.SaveActivityNotes(this._DAO_NOTES_EO);
                    #endregion

                    this.usrMessage.PutMessage("Delete Records Sucessfully");
                    this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                    this.usrMessage.Show();
                }
            }

            BindGrid();
        }
        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());
        }
    }
Exemplo n.º 13
0
    protected void btnUpdate_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_Visit_BO = new Bill_Sys_Visit_BO();
        objAdd             = new ArrayList();
        Bill_Sys_Calender _bill_Sys_Calender;
        string            eventId = Request.QueryString["eventId"].ToString();

        try
        {
            if (Convert.ToDateTime(txtAppointmentDate.Text) > Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")) && ddlStatus.SelectedValue == "2")
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ss", "<script language='javascript'>alert('Visit for future date cannot be completed...!');</script>");
            }
            else
            {
                //////////

                //Boolean iEvisitExists = false;
                //Boolean visitExists = false;
                //Boolean reVisitExists = false;
                //SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings.Get("MyConnectionString"));
                //SqlCommand comd = new SqlCommand("SP_CHECK_UPDATE_INITIALE_VALUATIONEXISTS");
                //comd.CommandType = CommandType.StoredProcedure;
                //comd.Connection = con;
                //comd.Connection.Open();
                //comd.Parameters.AddWithValue("@SZ_CASE_ID", ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID);
                //comd.Parameters.AddWithValue("@SZ_COMPANY_ID", ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                //comd.Parameters.AddWithValue("@SZ_PATIENT_ID", ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_PATIENT_ID);
                //comd.Parameters.AddWithValue("@SZ_DOCTOR_ID", extddlDoctor.Text);
                //comd.Parameters.AddWithValue("@VISIT_DATE", txtAppointmentDate.Text);
                //comd.Parameters.AddWithValue("@I_EVENT_ID", eventId);
                ////int intCountVisits = Convert.ToInt32(comd.ExecuteScalar());
                //if (ddlStatus.SelectedValue == "1") { comd.Parameters.AddWithValue("@RE_VISIT_DATE", txtReDate.Text); }
                //SqlParameter objIEExists = new SqlParameter("@INITIAL_EXISTS", SqlDbType.Bit);
                //objIEExists.Direction = ParameterDirection.Output;
                //comd.Parameters.Add(objIEExists);
                //SqlParameter objVisitStatus = new SqlParameter("@VISIT_EXISTS", SqlDbType.Bit, 20);
                //objVisitStatus.Direction = ParameterDirection.Output;
                //comd.Parameters.Add(objVisitStatus);
                //SqlParameter objReVisitStatus = new SqlParameter("@RE_VISIT_EXISTS", SqlDbType.Bit, 20);
                //objReVisitStatus.Direction = ParameterDirection.Output;
                //comd.Parameters.Add(objReVisitStatus);
                //comd.ExecuteNonQuery();
                //comd.Connection.Close();

                //iEvisitExists = Convert.ToBoolean(objIEExists.Value);
                //visitExists = Convert.ToBoolean(objVisitStatus.Value);
                //if (objReVisitStatus.Value.ToString() != "") reVisitExists = Convert.ToBoolean(objReVisitStatus.Value);
                //if (iEvisitExists == false && extddlVisitType.Selected_Text != "IE")
                //{
                //    lblMsg.Text = "Schedule can not be saved patient is visiting first time hence there visit type should be Initial Evaluation.";
                //    lblMsg.Focus();
                //    lblMsg.Visible = true;
                //    return;
                //}
                //if (iEvisitExists == true && extddlVisitType.Selected_Text == "IE")
                //{
                //    lblMsg.Text = "Schedule can not be saved because patient already has Initial Evaluation.";
                //    lblMsg.Focus();
                //    lblMsg.Visible = true;
                //    return;
                //}
                //if (visitExists == true && ddlStatus.SelectedValue!="1")
                //{
                //    lblMsg.Text = "Schedule can not be saved because patient already has this visit";
                //    lblMsg.Focus();
                //    lblMsg.Visible = true;
                //    return;
                //}
                //if (reVisitExists == true && ddlStatus.SelectedValue == "1" && txtReEventID.Text == "")
                //{
                //    lblMsg.Text = "Schedule can not be saved because patient already has visit on re-schedule date";
                //    lblMsg.Focus();
                //    lblMsg.Visible = true;
                //    return;
                //}
                /////////

                ////////////RE-Schedule
                ////////////RE-Schedule add
                int    reendMin  = Convert.ToInt32(ddlReSchMinutes.SelectedValue) + Convert.ToInt32(30);
                int    reendHr   = Convert.ToInt32(ddlReSchHours.SelectedValue);
                string reendTime = ddlReSchTime.SelectedValue;
                if (reendMin >= 60)
                {
                    reendMin = reendMin - 60;
                    reendHr  = reendHr + 1;
                    if (reendHr > 12)
                    {
                        reendHr = reendHr - 12;
                        if (ddlReSchHours.SelectedValue != "12")
                        {
                            if (reendTime == "AM")
                            {
                                reendTime = "PM";
                            }
                            else if (reendTime == "PM")
                            {
                                reendTime = "AM";
                            }
                        }
                    }
                    else if (reendHr == 12)
                    {
                        if (ddlReSchHours.SelectedValue != "12")
                        {
                            if (reendTime == "AM")
                            {
                                reendTime = "PM";
                            }
                            else if (reendTime == "PM")
                            {
                                reendTime = "AM";
                            }
                        }
                    }
                }
                if (ddlStatus.SelectedValue == "1" && txtReEventID.Text == "")
                {
                    _bill_Sys_Calender = new Bill_Sys_Calender();
                    objAdd             = new ArrayList();
                    objAdd.Add(txtCaseID.Text);                                                                          //Case Id
                    objAdd.Add(txtReDate.Text);                                                                          //Appointment date
                    objAdd.Add(ddlReSchHours.SelectedValue.ToString() + "." + ddlReSchMinutes.SelectedValue.ToString()); //Appointment time
                    objAdd.Add("");                                                                                      //Notes
                    objAdd.Add(extddlDoctor.Text);
                    objAdd.Add("TY000000000000000003");
                    objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    objAdd.Add(ddlReSchTime.SelectedValue);
                    objAdd.Add(reendHr.ToString().PadLeft(2, '0') + "." + reendMin.ToString().PadLeft(2, '0'));
                    objAdd.Add(reendTime);
                    if (Convert.ToDateTime(txtReDate.Text) >= Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")))
                    {
                        objAdd.Add("0");
                    }
                    else
                    {
                        objAdd.Add("2");
                    }
                    objAdd.Add(extddlVisitType.Text);
                    _bill_Sys_Calender.SaveEvent(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                    ArrayList objGetEvent = new ArrayList();
                    objGetEvent.Add(txtCaseID.Text);
                    objGetEvent.Add(extddlDoctor.Text);
                    objGetEvent.Add(txtCompanyID.Text);
                    int reeventID = _bill_Sys_Calender.GetEventID(objGetEvent);
                    txtReEventID.Text = reeventID.ToString();
                    foreach (ListItem lstItem in ddlTestNames.Items)
                    {
                        if (lstItem.Selected == true)
                        {
                            objAdd = new ArrayList();
                            objAdd.Add(lstItem.Value);
                            objAdd.Add(reeventID);
                            if (Convert.ToDateTime(txtReDate.Text) >= Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")))
                            {
                                objAdd.Add("0");
                            }
                            else
                            {
                                objAdd.Add("2");
                            }
                            _bill_Sys_Calender.Save_Event_RefferPrcedure(objAdd);
                        }
                    }
                    // Start : Save appointment Notes.

                    _DAO_NOTES_EO = new DAO_NOTES_EO();
                    _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "APPOINTMENT_ADDED";
                    _DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Date : " + txtReDate.Text;

                    _DAO_NOTES_BO               = new DAO_NOTES_BO();
                    _DAO_NOTES_EO.SZ_USER_ID    = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;
                    _DAO_NOTES_EO.SZ_CASE_ID    = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
                    _DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                    _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO);

                    lblMsg.Visible = true;
                    lblMsg.Text    = "Appointment Added successfully.";
                }
                ////////////RE-Schedule add
                ////////////RE-Schedule Update
                else if (ddlStatus.SelectedValue == "1" && txtReEventID.Text != "")
                {
                    _bill_Sys_Calender = new Bill_Sys_Calender();
                    objAdd             = new ArrayList();
                    objAdd.Add(txtReEventID.Text);                                                                       //event Id
                    objAdd.Add(txtCaseID.Text);                                                                          //Case Id
                    objAdd.Add(txtReDate.Text);                                                                          //Appointment date
                    objAdd.Add(ddlReSchHours.SelectedValue.ToString() + "." + ddlReSchMinutes.SelectedValue.ToString()); //Appointment time
                    objAdd.Add("");                                                                                      //Notes
                    objAdd.Add(extddlDoctor.Text);
                    objAdd.Add("TY000000000000000003");
                    objAdd.Add(txtCompanyID.Text);

                    objAdd.Add(ddlReSchTime.SelectedValue);
                    objAdd.Add(reendHr.ToString().PadLeft(2, '0') + "." + reendMin.ToString().PadLeft(2, '0'));
                    objAdd.Add(reendTime);

                    if (Convert.ToDateTime(txtReDate.Text) >= Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")))
                    {
                        objAdd.Add("0");
                    }
                    else
                    {
                        objAdd.Add("2");
                    }
                    objAdd.Add(extddlVisitType.Text);
                    _bill_Sys_Calender.UPDATEEvent(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());

                    _bill_Sys_Calender.Delete_Event_RefferPrcedure(Convert.ToInt32(txtReEventID.Text));

                    foreach (ListItem lstItem in ddlTestNames.Items)
                    {
                        if (lstItem.Selected == true)
                        {
                            objAdd = new ArrayList();
                            objAdd.Add(lstItem.Value);
                            objAdd.Add(txtReEventID.Text);
                            if (ddlTestNames.Visible == true && Convert.ToDateTime(txtAppointmentDate.Text) >= Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")))
                            {
                                objAdd.Add("0");
                            }
                            else
                            {
                                objAdd.Add("2");
                            }
                            _bill_Sys_Calender.Save_Event_RefferPrcedure(objAdd);
                        }
                    }
                }
                ////////////RE-Schedule Update
                ////////////RE-Schedule

                _bill_Sys_Calender = new Bill_Sys_Calender();
                objAdd             = new ArrayList();
                objAdd.Add(eventId);                                                                       //event Id
                objAdd.Add(txtCaseID.Text);                                                                //Case Id
                objAdd.Add(txtAppointmentDate.Text);                                                       //Appointment date
                objAdd.Add(ddlHours.SelectedValue.ToString() + "." + ddlMinutes.SelectedValue.ToString()); //Appointment time
                objAdd.Add("");                                                                            //Notes
                objAdd.Add(extddlDoctor.Text);
                objAdd.Add("TY000000000000000003");
                objAdd.Add(txtCompanyID.Text);

                int    endMin  = Convert.ToInt32(ddlMinutes.SelectedValue) + Convert.ToInt32(30);
                int    endHr   = Convert.ToInt32(ddlHours.SelectedValue);
                string endTime = ddlTime.SelectedValue;
                if (endMin >= 60)
                {
                    endMin = endMin - 60;
                    endHr  = endHr + 1;
                    if (endHr > 12)
                    {
                        endHr = endHr - 12;
                        if (ddlHours.SelectedValue != "12")
                        {
                            if (endTime == "AM")
                            {
                                endTime = "PM";
                            }
                            else if (endTime == "PM")
                            {
                                endTime = "AM";
                            }
                        }
                    }
                    else if (endHr == 12)
                    {
                        if (ddlHours.SelectedValue != "12")
                        {
                            if (endTime == "AM")
                            {
                                endTime = "PM";
                            }
                            else if (endTime == "PM")
                            {
                                endTime = "AM";
                            }
                        }
                    }
                }
                objAdd.Add(ddlTime.SelectedValue);
                objAdd.Add(endHr.ToString().PadLeft(2, '0') + "." + endMin.ToString().PadLeft(2, '0'));
                objAdd.Add(endTime);



                objAdd.Add(ddlStatus.SelectedValue);
                objAdd.Add(extddlVisitType.Text);
                if (ddlStatus.SelectedValue == "1")
                {
                    objAdd.Add(txtReEventID.Text);
                    objAdd.Add(txtReDate.Text);
                }
                _bill_Sys_Calender.UPDATEEvent(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                _bill_Sys_Calender.Delete_Event_RefferPrcedure(Convert.ToInt32(eventId));


                ArrayList Olditems = new ArrayList();
                foreach (ListItem lstItem in ddlTestNames.Items)
                {
                    if (lstItem.Selected == true)
                    {
                        objAdd = new ArrayList();
                        objAdd.Add(lstItem.Value);
                        objAdd.Add(eventId);
                        if (ddlTestNames.Visible == true && Convert.ToDateTime(txtAppointmentDate.Text) >= Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")))
                        {
                            objAdd.Add("0");
                        }
                        else
                        {
                            objAdd.Add("2");
                        }
                        _bill_Sys_Calender.Save_Event_RefferPrcedure(objAdd);
                    }

                    if (ddlOldTestNames.Items.FindByValue(lstItem.Value).Selected == true && lstItem.Selected == false)
                    {
                        Olditems.Add(lstItem.Value);
                    }
                }

                //////////If appointment is updated from schedule to completed and remove any existing treatments
                if (txtVisitStatus.Text == "0" && ddlStatus.SelectedValue != "0" && Olditems.Count > 0)
                {
                    _bill_Sys_Calender = new Bill_Sys_Calender();
                    objAdd             = new ArrayList();
                    objAdd.Add(txtCaseID.Text);                                                                //Case Id
                    objAdd.Add(txtAppointmentDate.Text);                                                       //Appointment date
                    objAdd.Add(ddlHours.SelectedValue.ToString() + "." + ddlMinutes.SelectedValue.ToString()); //Appointment time
                    objAdd.Add("");                                                                            //Notes
                    objAdd.Add(extddlDoctor.Text);
                    objAdd.Add("TY000000000000000003");
                    objAdd.Add(txtCompanyID.Text);

                    objAdd.Add(ddlTime.SelectedValue);
                    objAdd.Add(endHr.ToString().PadLeft(2, '0') + "." + endMin.ToString().PadLeft(2, '0'));
                    objAdd.Add(endTime);
                    objAdd.Add("0");
                    objAdd.Add(extddlVisitType.Text);

                    _bill_Sys_Calender.SaveEvent(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());

                    ArrayList objOldGetEvent = new ArrayList();
                    objOldGetEvent.Add(txtCaseID.Text);
                    objOldGetEvent.Add(extddlDoctor.Text);
                    objOldGetEvent.Add(txtCompanyID.Text);
                    int neweventID = _bill_Sys_Calender.GetEventID(objOldGetEvent);

                    foreach (Object obj in Olditems)
                    {
                        objAdd = new ArrayList();
                        objAdd.Add(obj.ToString());
                        objAdd.Add(neweventID);
                        objAdd.Add("0");
                        _bill_Sys_Calender.Save_Event_RefferPrcedure(objAdd);
                    }
                }
                //////////If appointment is updated from schedule to completed and remove any existing treatments


                // Start : Save appointment Notes.

                _DAO_NOTES_EO = new DAO_NOTES_EO();
                _DAO_NOTES_EO.SZ_MESSAGE_TITLE = "APPOINTMENT_ADDED";
                _DAO_NOTES_EO.SZ_ACTIVITY_DESC = "Date : " + txtAppointmentDate.Text;

                _DAO_NOTES_BO               = new DAO_NOTES_BO();
                _DAO_NOTES_EO.SZ_USER_ID    = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;
                _DAO_NOTES_EO.SZ_CASE_ID    = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
                _DAO_NOTES_EO.SZ_COMPANY_ID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                _DAO_NOTES_BO.SaveActivityNotes(_DAO_NOTES_EO);

                lblMsg.Visible = true;
                lblMsg.Text    = "Appointment Updated successfully.";

                if (Request.QueryString["GRD_ID"] != null)
                {
                    Session["GRD_ID"] = Request.QueryString["GRD_ID"].ToString();
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script language='javascript'> window.parent.document.location.href='Bill_SysPatientDesk.aspx';window.self.close(); </script>");
            }
        }
        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());
        }
    }