コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PagePermissions.EnforcePermissions_RequireAll(Session, Response, true, false, false, false, false, true);

        if (!IsPostBack)
        {
            SetupGUI();
        }

        if (SiteDB.GetSiteByType(SiteDB.SiteType.AgedCare) != null)
        {
            HideTableAndSetErrorMessage("Aged Care Site Already Exists");
        }
    }
コード例 #2
0
    protected void GoTo(string db, int orgID, int siteID, int patientID)
    {
        //lblInfo1.Text += "GET<br/>DB: " + db + "<br />Org: " + orgID;

        bool isExternalStaff = orgID != 0 && patientID == -1;
        bool isStakeHolder   = !isExternalStaff && Convert.ToBoolean(Session["IsStakeholder"]);

        if (db != Session["DB"].ToString())
        {
            // Set previous StaffID, pervious DB
            Session["PreviousStaffID"] = Session["StaffID"];
            Session["PreviousDB"]      = Session["DB"];
            Session["PreviousSiteID"]  = Session["SiteID"];

            // Change to new DB & SystemVariables
            Session["DB"] = db;
            Session["SystemVariables"] = SystemVariableDB.GetAll();

            // Set system staff variables
            int   callCentreStaffID = isExternalStaff ? -5 : (!isStakeHolder ? -7 : -8);
            Staff staff             = StaffDB.GetByID(callCentreStaffID);
            Session["IsLoggedIn"]    = true;
            Session["IsStakeholder"] = staff.IsStakeholder;
            Session["IsMasterAdmin"] = staff.IsMasterAdmin;
            Session["IsAdmin"]       = staff.IsAdmin;
            Session["IsPrincipal"]   = staff.IsPrincipal;
            Session["IsProvider"]    = staff.IsProvider;
            Session["IsExternal"]    = staff.IsExternal;
            Session["StaffID"]       = staff.StaffID;
            Session["StaffFullnameWithoutMiddlename"] = staff.Person.FullnameWithoutMiddlename;
            Session["StaffFirstname"] = staff.Person.Firstname;

            // Set OrgID in session as external user has OrgID set
            if (isExternalStaff)
            {
                Organisation org = OrganisationDB.GetByID(orgID);
                Session["OrgID"]   = orgID;
                Session["OrgName"] = org.Name;
            }


            Site site = null;
            if (siteID != 0)
            {
                site = SiteDB.GetByID(siteID);
            }
            else
            {
                // log in to same site type if possible, else just log in to site 1
                site = SiteDB.GetSiteByType((SiteDB.SiteType)Convert.ToInt32(Session["SiteTypeID"]), null, db);
                if (site == null)
                {
                    site = SiteDB.GetByID(1);
                }
            }

            Session["SiteID"]         = site.SiteID;
            Session["SiteName"]       = site.Name;
            Session["SiteIsClinic"]   = site.SiteType.ID == 1;
            Session["SiteIsAgedCare"] = site.SiteType.ID == 2;
            Session["SiteIsGP"]       = site.SiteType.ID == 3;
            Session["SiteTypeID"]     = site.SiteType.ID;
            Session["SiteTypeDescr"]  = site.SiteType.Descr;

            Session["IsMultipleSites"] = SiteDB.GetAll().Length > 1;



            // Remove patient list session data for pt searches
            Session.Remove("patientinfo_data");
            Session.Remove("patientlist_data");
            Session.Remove("patientlist_sortexpression");
            Session.Remove("patientinfo_sortexpression");
        }


        // Go to booking page with this org

        if (isExternalStaff)
        {
            Response.Redirect("~/BookingsV2.aspx?orgs=" + Session["OrgID"] + "&ndays=4", false);
        }

        else if (patientID != -1 && orgID != 0)
        {
            Response.Redirect("~/BookingsV2.aspx?orgs=" + orgID + "&patient=" + patientID + "&ndays=4", false);
        }
        else if (patientID != -1 && orgID == 0)
        {
            Response.Redirect("~/PatientDetailV2.aspx?type=view&id=" + patientID, false);
        }

        else
        {
            Response.Redirect("~/Default.aspx", false);
        }
        return;
    }
コード例 #3
0
    protected Letter.FileContents[] ProcessReferrersLetters(bool viewListOnly, ArrayList bookingsForCurrentReferrer, ref string debugOutput)
    {
        if (bookingsForCurrentReferrer.Count == 0)
        {
            return(new Letter.FileContents[0]);
        }

        // to return - only files to print, as emailing will have been completed
        ArrayList filesToPrint = new ArrayList();


        // an email belongs to the regRef.Org ... so one referrer can have multiple.
        // keep in hash to avoid continued lookups.
        Hashtable refEmailHash = new Hashtable();

        ArrayList regRefIDsToUpdateDateTimeOfLastBatchSend = new ArrayList();

        Site[] sites = SiteDB.GetAll();
        for (int i = 0; i < bookingsForCurrentReferrer.Count; i++)
        {
            Tuple <Booking, PatientReferrer, bool, string, HealthCard> curTuple = (Tuple <Booking, PatientReferrer, bool, string, HealthCard>)bookingsForCurrentReferrer[i];
            Booking         curBooking     = curTuple.Item1;
            PatientReferrer curPR          = curTuple.Item2;
            bool            curRefHasEmail = curTuple.Item3;
            string          curRefEmail    = curTuple.Item4;
            HealthCard      curHC          = curTuple.Item5;

            bool needToGenerateLetters = curBooking.NeedToGenerateFirstLetter || curBooking.NeedToGenerateLastLetter ||
                                         (curPR.RegisterReferrer.ReportEveryVisitToReferrer && curBooking.NoteCount > 0);
            if (needToGenerateLetters)
            {
                SendMethod sendMethod = (curRefHasEmail && this.SelectedSendMethod == SendMethod.Email ? SendMethod.Email : SendMethod.Print);

                if (!viewListOnly)
                {
                    if (curRefHasEmail && this.SelectedSendMethod == SendMethod.Email)
                    {
                        Letter.FileContents[] fileContentsList = curBooking.GetSystemLettersList(Letter.FileFormat.PDF, curBooking.Patient, curHC, curBooking.Offering.Field.ID, curPR.RegisterReferrer.Referrer, true, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, curPR.RegisterReferrer.ReportEveryVisitToReferrer, false, Convert.ToInt32(Session["SiteID"]), Convert.ToInt32(Session["StaffID"]), sendMethod == SendMethod.Email ? 2 : 1);
                        if (fileContentsList != null && fileContentsList.Length > 0)
                        {
                            if (ReferrerEPCLettersSendingV2.LogDebugEmailInfo)
                            {
                                Logger.LogQuery("C ReferrerEPCLetters_GenerateUnsent -- Email Send Item Starting [" + curRefEmail + "]", false, false, true);
                            }

                            Site site = SiteDB.GetSiteByType(curBooking.Organisation.IsAgedCare ? SiteDB.SiteType.AgedCare : SiteDB.SiteType.Clinic, sites);
                            Letter.EmailSystemLetter(site.Name, curRefEmail, fileContentsList,
                                                     "Referral/Treatment Note Letters From Mediclinic" + (curPR.Patient == null ? string.Empty : " For " + curPR.Patient.Person.FullnameWithoutMiddlename),
                                                     "Dr. " + curPR.RegisterReferrer.Referrer.Person.FullnameWithoutMiddlename + "<br /><br />Please find attached referral/treatment note letters for your referrered patient" + (curPR.Patient == null ? string.Empty : " <b>" + curPR.Patient.Person.FullnameWithoutMiddlename + "</b>") + "<br /><br />Best regards,<br />" + site.Name);

                            if (ReferrerEPCLettersSendingV2.LogDebugEmailInfo)
                            {
                                Logger.LogQuery("C ReferrerEPCLetters_GenerateUnsent -- Email Send Item Done!", false, false, true);
                            }
                        }
                    }
                    else
                    {
                        Letter.FileContents[] fileContentsList = curBooking.GetSystemLettersList(Letter.FileFormat.Word, curBooking.Patient, curHC, curBooking.Offering.Field.ID, curPR.RegisterReferrer.Referrer, true, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, curPR.RegisterReferrer.ReportEveryVisitToReferrer, false, Convert.ToInt32(Session["SiteID"]), Convert.ToInt32(Session["StaffID"]), sendMethod == SendMethod.Email ? 2 : 1);
                        if (fileContentsList != null && fileContentsList.Length > 0)
                        {
                            filesToPrint.AddRange(fileContentsList);
                        }
                    }

                    BookingDB.UpdateSetGeneratedSystemLetters(curBooking.BookingID, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, true);
                }

                ArrayList toGenerateList = new ArrayList();
                if (curBooking.NeedToGenerateFirstLetter)
                {
                    toGenerateList.Add("First");
                }
                if (curBooking.NeedToGenerateLastLetter)
                {
                    toGenerateList.Add("Last");
                }
                if (curPR.RegisterReferrer.ReportEveryVisitToReferrer && curBooking.NoteCount > 0)
                {
                    toGenerateList.Add("Notes");
                }
                string toGenerate = string.Join(",", (string[])toGenerateList.ToArray(typeof(string)));

                string addEditContactListPage;
                if (Utilities.GetAddressType().ToString() == "Contact")
                {
                    addEditContactListPage = "AddEditContactList.aspx";
                }
                else if (Utilities.GetAddressType().ToString() == "ContactAus")
                {
                    addEditContactListPage = "ContactAusListV2.aspx";
                }
                else
                {
                    throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }

                string allFeatures     = "dialogWidth:525px;dialogHeight:430px;center:yes;resizable:no; scroll:no";
                string onclick         = "onclick=\"javascript:window.showModalDialog('" + addEditContactListPage + "?entity_type=referrer&id=" + curPR.RegisterReferrer.Organisation.EntityID.ToString() + "', '', '" + allFeatures + "');document.getElementById('" + btnViewList.ClientID + "').click();return false;\"";
                string hrefUpdateEmail = "<u><a style=\"text-decoration: none\" title=\"Edit\" AlternateText=\"Edit\" " + onclick + " href=\"\">Update Clinic Email</a></u>";

                debugOutput += @"<tr>
                                    <td>" + sendMethod + @"</td>
                                    <td style=""white-space:nowrap;"">" + curBooking.BookingID + " &nbsp;&nbsp;&nbsp;[" + curBooking.DateStart.ToString("dd-MM-yyyy") + "&nbsp;&nbsp;&nbsp;" + curBooking.DateStart.ToString("HH:mm") + "-" + curBooking.DateEnd.ToString("HH:mm") + "]" + @"</td>
                                    <td>" + toGenerate + @"</td>
                                    <td>" + curPR.RegisterReferrer.Referrer.Person.FullnameWithoutMiddlename + @"</td>
                                    <td style=""white-space:nowrap;"">" + (curRefHasEmail ? curRefEmail : "Has No Email") + " (" + hrefUpdateEmail + ")" + @"</td>
                                    <td>" + curPR.Patient.Person.FullnameWithoutMiddlename + @"</td>
                                </tr>";
            }

            if (curPR.RegisterReferrer.BatchSendAllPatientsTreatmentNotes)
            {
                regRefIDsToUpdateDateTimeOfLastBatchSend.Add(curPR.RegisterReferrer.RegisterReferrerID);
            }
        }

        RegisterReferrerDB.UpdateLastBatchSendAllPatientsTreatmentNotes((int[])regRefIDsToUpdateDateTimeOfLastBatchSend.ToArray(typeof(int)), DateTime.Now);

        return((Letter.FileContents[])filesToPrint.ToArray(typeof(Letter.FileContents)));
    }
コード例 #4
0
    protected void SetupGUI()
    {
        mi_patient_add_with_id.Visible = Session != null && Session["DB"] != null && Session["DB"].ToString() == "Mediclinic_0030";


        UserView userView = UserView.GetInstance();
        bool     isLoggedInAsCallCenter = Session != null && Session["StaffID"] != null && (new List <int> {
            -5, -7, -8
        }).Contains((int)Session["StaffID"]);

        if (isLoggedInAsCallCenter)
        {
            nav.Style["background"] = nav_ul.Style["background"] = footer.Style["background"] = "#A3BEF5";
        }

        lblSiteIsClinic.Value   = userView.IsClinicView? "1" : "0";
        lblSiteIsAgedCare.Value = userView.IsAgedCareView ? "1" : "0";

        banner.Style["background"] = (Session["SystemVariables"] == null || ((SystemVariables)Session["SystemVariables"])["MainLogo"] == null) ? "url(../imagesV2/comp_logo.png) no-repeat center center" : "url(../imagesV2/" + ((SystemVariables)Session["SystemVariables"])["MainLogo"].Value + ") no-repeat center center";

        lblSiteName.Text    = Session["SystemVariables"] == null ? "Mediclinic" : ((SystemVariables)Session["SystemVariables"])["Site"].Value;
        lblSiteName.Visible = lblDataStoredAusServersMsg.Visible = lnkLiveSupport.Visible = Session["SystemVariables"] != null;

        // when call centre logged in, put call-centre prefix showing at the end of the sitename always visible
        if (isLoggedInAsCallCenter)
        {
            lblSiteName.Text += Session["SystemVariables"] == null ? "" : " <span style=\"color:#82cde9\">[" + ((SystemVariables)Session["SystemVariables"])["CallCenterPrefix"].Value + "]</span>";
        }


        spn_login_display.Visible = userView.IsLoggedIn;

        if (userView.IsLoggedIn)
        {
            string siteOrgNameRaw = (userView.IsAdminView) ?
                                    (Session["SiteName"] == null ? "[No Site Selected]" : Utilities.TrimName((string)Session["SiteName"], 35, 2)) :
                                    (Session["SiteName"] == null ? "[No Site Selected]" : Utilities.TrimName((string)Session["SiteName"], 18, 2)) + (Session["SiteName"] == null ? "&nbsp;[" : "&nbsp;(") + (Session["OrgName"] == null ? "No Clinic Selected" : Utilities.TrimName((string)Session["OrgName"], 25, 2)) + (Session["SiteName"] == null ? "]" : ")");
            lblSiteOrOrg.Text = siteOrgNameRaw;

            lblUsername.Text = (siteOrgNameRaw.Length > 35) ?
                               Utilities.TrimName((string)Session["StaffFullnameWithoutMiddlename"], 25, 2) :
                               Session["StaffFullnameWithoutMiddlename"].ToString();


            if (Session["SiteID"] == null || Session["IsMultipleSites"] == null || (bool)Session["IsMultipleSites"] == false || Session["PatientID"] != null)
            {
                lnkSelectSite.Visible = lnkSelectSite_OpenBracket.Visible = lnkSelectSite_CloseBracket.Visible = false;
            }

            if (Session["OrgID"] == null || Session["IsMultipleOrgs"] == null || (bool)Session["IsMultipleOrgs"] == false)
            {
                lnkSelectOrg.Visible = lnkSelectOrg_OpenBracket.Visible = lnkSelectOrg_CloseBracket.Visible = false;
            }

            if (Session["SiteID"] == null || (!userView.IsAdminView && Session["OrgID"] == null))
            {
                lnkChangePwd.Visible = lnkChangePwd_OpenBracket.Visible = lnkChangePwd_CloseBracket.Visible = false;
            }
        }


        /*
         * set and hide/show menu items depending on user privileges
         */


        lblMenuOrganisations.Text           = !userView.IsAgedCareView ? "Clinics / Ins." : "Facilities / Ins.";
        lnkMenuOrganisationList.Text        = !userView.IsAgedCareView ? "Clinics List"   : "Facilities List";
        lnkMenuOrganisationList.NavigateUrl = !userView.IsAgedCareView ? "~/OrganisationListV2.aspx?type=clinic" : "~/OrganisationListV2.aspx?type=ac";
        lnkMenuAddOrganisation.Text         = !userView.IsAgedCareView ? "Add Clinic"     : "Add Facility";
        lnkMenuAddOrganisation.NavigateUrl  = !userView.IsAgedCareView ? "~/OrganisationDetailV2.aspx?type=add&orgtype=clinic" : "~/OrganisationDetailV2.aspx?type=add&orgtype=ac";
        lblMenuPatients.Text         = !userView.IsAgedCareView ? "Patients"       : "Residents";
        lnkMenuPatientList.Text      = !userView.IsAgedCareView ? "Patient List"   : "Resident List";
        lnkMenuPatientAdd.Text       = !userView.IsAgedCareView ? "Add Patient"    : "Add Resident";
        lnkMenuPatientAddWithID.Text = !userView.IsAgedCareView ? "Add Patient <b>WITH ID</b>"    : "Add Resident <b>WITH ID</b>";


        bool hasClinics = false;
        bool hasAC      = false;

        if (Session != null && Session["DB"] != null)
        {
            foreach (Site site in SiteDB.GetAll())
            {
                if (site.SiteType.ID == 1 || site.SiteType.ID == 3)
                {
                    hasClinics = true;
                }
                if (site.SiteType.ID == 2)
                {
                    hasAC = true;
                }
            }
        }

        if (hasClinics && hasAC)
        {
            lnkMenuOrganisationCustomerTypes.Text = "Clinic/Facility Customer Types";
        }
        else if (hasClinics)
        {
            lnkMenuOrganisationCustomerTypes.Text = "Clinic Customer Types";
        }
        else if (hasAC)
        {
            lnkMenuOrganisationCustomerTypes.Text = "Facility Customer Types";
        }


        mh_staff.Visible                        = mh_staff_spacer.Visible = userView.IsStakeholder || userView.IsMasterAdmin;
        mh_patients_space.Visible               = mh_patients.Visible = userView.IsAdminView || userView.IsProviderView;
        mi_patient_cond_list.Visible            = userView.IsAdminView;
        mh_organisation.Visible                 = mh_organisation_spacer.Visible = userView.IsAdminView;
        mh_referrers.Visible                    = mh_referrers_space.Visible = userView.IsAdminView || userView.IsProviderView;
        mh_bookings_space.Visible               = mh_bookings.Visible = userView.IsAdminView || userView.IsProviderView;
        lblMenuBookings.Text                    = userView.IsAdminView ? "Bookings & Sales" : "Bookings";
        mi_bookings_offerings_seperator.Visible = userView.IsAdminView;
        mi_bookings_offerings_products_and_services_list.Visible = userView.IsAdminView;
        mi_bookings_offerings_set_specific_prices.Visible        = userView.IsAdminView || userView.IsProviderView;
        mi_bookings_offerings_stock.Visible = userView.IsAdminView || userView.IsProviderView;
        mi_bookings_offerings_set_specific_prices.Visible = userView.IsAdminView;
        mi_bookings_offerings_invoice_cash_add.Visible    = userView.IsAdminView;

        mh_sales.Visible             = mh_sales_space.Visible = userView.IsAdminView || userView.IsProviderView;
        mh_financials.Visible        = mh_financials_spacer.Visible = userView.IsAdminView;
        mh_letters.Visible           = mh_letters_space.Visible = userView.IsAdminView || userView.IsProviderView;
        mh_sms_and_email.Visible     = mh_sms_and_email_spacer.Visible = userView.IsAdminView;
        mh_site_and_settings.Visible = userView.IsAdminView;

        mh_ext_patient_list.Visible       = mh_ext_patient_list_space.Visible = userView.IsExternalView;
        mh_ext_patient_add.Visible        = mh_ext_patient_add_space.Visible = userView.IsExternalView;
        mh_ext_next_booking_space.Visible = userView.IsExternalView;
        mh_ext_next_booking.Visible       = mh_ext_bookings_space.Visible = userView.IsExternalView;
        mh_ext_bookings_space.Visible     = false;
        mh_ext_bookings.Visible           = userView.IsExternalView;
        //mh_ext_bookings.Visible                                   = mh_ext_bookings_space.Visible     = isExternal;
        mh_ext_return_to_callcenter.Visible = mh_ext_return_to_callcenter_space_post.Visible = isLoggedInAsCallCenter;

        mh_ext_return_to_callcenter_space_pre.Visible = false;

        if (isLoggedInAsCallCenter)
        {
            mh_ext_return_to_callcenter_space_pre.Visible  = true;
            mh_ext_return_to_callcenter_space_post.Visible = false;
        }



        if (userView.IsExternalView)
        {
            lnkMenuPatientListExt.NavigateUrl = "~/PatientListV2.aspx";
            lnkMenuPatientAddExt.NavigateUrl  = "~/PatientAddV2.aspx";
            lnkMenuBookingsExt.NavigateUrl    = "~/BookingsV2.aspx?orgs=" + Session["OrgID"] + (Session != null && Session["StaffID"] != null && (int)Session["StaffID"] != -5 ? "&ndays=3" : "&ndays=4");
        }


        mi_patient_ac_types.Visible = userView.IsAgedCareView && userView.IsAdminView;
        mi_patient_ac_types_prices_per_fac.Visible = userView.IsAgedCareView && userView.IsAdminView;

        mi_referrer_epc_letters_generate_unsent_list.Visible = userView.IsAdminView;
        mi_referrer_epc_letters_reprint_list.Visible         = userView.IsAdminView;

        mi_link_bookings.InnerText      = userView.IsAdminView ? "Make Booking" : "Bookings";
        mi_bookings_call_center.Visible = userView.IsAdminView && !isLoggedInAsCallCenter && Session != null && Session["SystemVariables"] != null && ((SystemVariables)Session["SystemVariables"])["IsMediclinicCallCenter"].Value == "1";


        if (userView.IsAdminView)
        {
            mi_bookings_list.Visible = false;
        }
        if (!userView.IsAdminView)
        {
            mi_link_bookings.HRef      = "/BookingsV2.aspx?orgs=" + Session["OrgID"] + "&ndays=1";
            mi_link_bookings_list.HRef = "/BookingsListV2.aspx?staff=" + Session["StaffID"] + "&start_date=" + DateTime.Today.ToString("yyyy_MM_dd") + "&end_date=" + DateTime.Today.ToString("yyyy_MM_dd");

            mi_bookings_list.Visible                         = userView.IsAdminView || userView.IsProviderView;
            mi_bookings_report.Visible                       = userView.IsAdminView;
            mi_bookings_schedule_report.Visible              = userView.IsAdminView || userView.IsProviderView;
            mi_bookings_hours_worked_report.Visible          = userView.IsAdminView || userView.IsProviderView;
            mi_bookings_change_edit_reason.Visible           = userView.IsAdminView;
            mi_bookings_change_unavailability_reason.Visible = userView.IsAdminView;
        }


        mi_link_offerings_set_specific_prices.InnerText = !userView.IsAgedCareView ? "Set Specific Prices Per Clinic" : "Set Specific Prices Per Facility/Wing/Unit";
        mi_link_offerings_invoice_cash_add.HRef         = userView.IsAdminView ? "/InvoiceCashAddV2.aspx" : "/InvoiceCashAddV2.aspx?org=" + (Session["OrgID"] == null ? "" : Session["OrgID"].ToString());;


        mh_sales.Visible = mh_sales_space.Visible = userView.IsProviderView;
        mi_link_sales_invoice_cash_add.HRef = userView.IsAdminView ?
                                              "/InvoiceCashAddV2.aspx" :
                                              "/InvoiceCashAddV2.aspx?org=" + (Session["OrgID"] == null ? "" : Session["OrgID"].ToString());

        mi_financials_ezidebit_info.Visible        = userView.IsStakeholder || userView.IsMasterAdmin;
        mi_financials_claim_nbr_allocation.Visible = userView.IsStakeholder;
        mi_financials_claim_nbrs_allocated.Visible = userView.IsStakeholder;
        mi_financials_hinx_generation.Visible      = userView.IsStakeholder;


        if (!userView.IsAdminView)
        {
            mi_letters_maintain.Visible = false;
            mi_letters_maintain_treatment_letters.Visible = false;
            mi_letters_print_batch.Visible           = false;
            mi_letters_print_batch_referrers.Visible = false;
            mi_letters_recall.Visible = false;
            mi_letters_service_specific_bk_reminders.Visible = false;

            mi_link_letters_print.HRef        += (Session != null && Session["OrgID"] != null ? "?org=" + Session["OrgID"].ToString() : "");
            mi_link_letters_sent_history.HRef += (Session != null && Session["OrgID"] != null ? "?org=" + Session["OrgID"].ToString() : "");
        }
        else
        {
            mi_letters_recall.Visible = !userView.IsAgedCareView;
        }


        mi_website_settings.Visible   = userView.IsStakeholder || userView.IsMasterAdmin;
        mi_add_aged_care_site.Visible = userView.IsStakeholder && SiteDB.GetSiteByType(SiteDB.SiteType.AgedCare) == null;
        mi_add_new_field.Visible      = userView.IsStakeholder;
        mi_create_new_site.Visible    = userView.IsStakeholder;


        if (HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LoginV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.Contains("/Account/SelectOrgV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.Contains("/Account/SelectSiteV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.Contains("/Account/CreateNewLoginV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LostPasswordV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/Account/CreateNewPatientV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/InvoicePaymentV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/PatientUnsubscribeV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/Invoice_WebPayV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/CreateNewCustomerSiteV2.aspx") ||
            HttpContext.Current.Request.Url.LocalPath.EndsWith("/TermsAndConditionsV2.aspx")
            )
        {
            div_menu2.Visible = false;
        }


        if (Session["SystemVariables"] != null && !Page.Title.StartsWith(((SystemVariables)Session["SystemVariables"])["Site"].Value + " - "))
        {
            Page.Title = ((SystemVariables)Session["SystemVariables"])["Site"].Value + " - " + Page.Title;
        }


        int    s  = Session["StaffID"] == null ? -1 : (int)Session["StaffID"];
        string db = Session["DB"] == null ? "" : (string)Session["DB"];

        if ((Session["DB"] != null && (string)Session["DB"] == "Mediclinic_0034") && (Session["StaffID"] != null && (new List <int> {
            -5, -7, -8
        }).Contains((int)Session["StaffID"])))
        {
            lnkLiveSupport.Attributes.Add("onclick", "open_new_tab('http://www.homevisitphysio.com.au/phoneadmin');return false");
            lnkLiveSupport.NavigateUrl = "http://www.homevisitphysio.com.au/phoneadmin";
            lnkLiveSupport.Text        = "&nbsp;PHONE SCRIPT&nbsp;";
            lnkLiveSupport.Style["background-color"] = "#BA9EB0";
            lnkLiveSupport.Style["color"]            = "white";
        }
    }
コード例 #5
0
    public static string Run(bool incDisplay, bool incSending, bool incPtSending, DateTime date)
    {
        date = date.Date;

        string batchEmail = SystemVariableDB.GetByDescr("ServiceSpecificBookingReminderLettersToBatch_EmailAddress").Value;

        // don't actually run it if email empty (ie deactivated)
        incSending = incSending && batchEmail.Length > 0;

        Site[] sites = SiteDB.GetAll();


        string output = string.Empty;

        Hashtable lettersHash = LetterDB.GetHashTable();

        Offering[] offerings = OfferingDB.GetAll(false, -1);
        for (int j = 0; j < offerings.Length; j++)
        {
            if (offerings[j].ReminderLetterMonthsLaterToSend == 0 || offerings[j].ReminderLetterID == -1)
            {
                continue;
            }

            Booking[] bookings = BookingDB.GetWhenLastServiceFromXMonthsAgoToGenerageReminderLetter(offerings[j].OfferingID, date, offerings[j].ReminderLetterMonthsLaterToSend);


            Hashtable distinctPatients = new Hashtable();
            for (int i = 0; i < bookings.Length; i++)
            {
                if (bookings[i].Patient != null && distinctPatients[bookings[i].Patient.PatientID] == null)
                {
                    distinctPatients[bookings[i].Patient.PatientID] = bookings[i].Patient;
                }
            }

            Patient[] patients = (Patient[])(new ArrayList(distinctPatients.Values)).ToArray(typeof(Patient));
            Hashtable patientContactEmailHash = GetPatientEmailCache(patients);



            // Generate Letters

            ArrayList filesToPrint = new ArrayList();
            for (int i = 0; i < bookings.Length; i++)
            {
                Booking curBooking = bookings[i];
                if (curBooking.Patient == null)
                {
                    continue;
                }

                Patient curPatient         = curBooking.Patient;
                string  curPatientEmail    = GetEmail(patientContactEmailHash, curPatient.Person.EntityID);
                bool    curPatientHasEmail = curPatientEmail != null;


                SendMethod sendMethod = incPtSending && curPatientHasEmail ? SendMethod.Email_To_Patient : SendMethod.Batch;

                if (incSending)
                {
                    if (sendMethod == SendMethod.Email_To_Patient)
                    {
                        // generate and send email
                        Letter.FileContents fileContents = GenerteLetter(curBooking, Letter.FileFormat.PDF, lettersHash, sites);
                        fileContents.DocName = "Reminder" + System.IO.Path.GetExtension(fileContents.DocName);
                        if (fileContents != null)
                        {
                            Site site = SiteDB.GetSiteByType(curBooking.Organisation.IsAgedCare ? SiteDB.SiteType.AgedCare : SiteDB.SiteType.Clinic);
                            SendEmail(site.Name, curPatientEmail, "Important Reminder", "Hi " + curBooking.Patient.Person.Firstname + ",<br /><br />Please find attached a review reminder letter for a previous appointment.<br /><br/>Best regards,<br />" + site.Name, true, new Letter.FileContents[] { fileContents });
                        }
                    }
                    else
                    {
                        // generate and add to batch list (if batch email set)
                        if (batchEmail.Length > 0)
                        {
                            Letter.FileContents fileContents = GenerteLetter(curBooking, Letter.FileFormat.Word, lettersHash, sites);
                            if (fileContents != null)
                            {
                                filesToPrint.Add(fileContents);
                            }
                        }
                    }
                }

                string addEditContactListPage;
                if (Utilities.GetAddressType().ToString() == "Contact")
                {
                    addEditContactListPage = "AddEditContactList.aspx";
                }
                else if (Utilities.GetAddressType().ToString() == "ContactAus")
                {
                    addEditContactListPage = "ContactAusListV2.aspx";
                }
                else
                {
                    throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }

                string allFeatures     = "dialogWidth:555px;dialogHeight:350px;center:yes;resizable:no; scroll:no";
                string onclick         = "onclick=\"javascript:window.showModalDialog('" + addEditContactListPage + "?entity_type=referrer&id=" + curBooking.Patient.Person.EntityID.ToString() + "', '', '" + allFeatures + "');document.getElementById('btnUpdateList').click();return false;\"";
                string hrefUpdateEmail = "<u><a style=\"text-decoration: none\" title=\"Edit\" AlternateText=\"Edit\" " + onclick + " href=\"\">Update PT Email</a></u>";

                output += @"<tr>
                                <td class=""nowrap"">" + curBooking.BookingID + " &nbsp;&nbsp;&nbsp;[" + curBooking.DateStart.ToString("dd-MM-yyyy") + "&nbsp;&nbsp;&nbsp;" + curBooking.DateStart.ToString("HH:mm") + "-" + curBooking.DateEnd.ToString("HH:mm") + "]" + @"</td>
                                <td class=""text_left"">" + curBooking.Organisation.Name + @"</td>
                                <td class=""text_left"">" + curBooking.Offering.Name + @"</td>
                                <td class=""text_left"">" + ((Letter)lettersHash[curBooking.Offering.ReminderLetterID]).Docname + @"</td>
                                <td class=""text_left"">" + curPatient.Person.FullnameWithoutMiddlename + @"</td>
                                <td class=""nowrap"">" + (curPatientHasEmail ? curPatientEmail : "Has No Email") + " (" + hrefUpdateEmail + ")" + @"</td>
                                <td>" + sendMethod.ToString().Replace("_", " ") + @"</td>
                            </tr>";
            }


            // combine and email where the patient had no email
            if (incSending && filesToPrint.Count > 0)
            {
                Letter.FileContents filesContents = Letter.FileContents.Merge((Letter.FileContents[])filesToPrint.ToArray(typeof(Letter.FileContents)), "Reminders.pdf"); // .pdf
                SendEmail(
                    ((SystemVariables)System.Web.HttpContext.Current.Session["SystemVariables"])["Email_FromName"].Value,
                    batchEmail,
                    "Batch Reminder Letters",
                    string.Empty,
                    true,
                    new Letter.FileContents[] { filesContents });
            }
        }


        if (output.Length == 0)
        {
            output += @"<tr>
                            <td colspan=""7"">No Reminders To Send Today</td>
                        </tr>";
        }

        return(@"
            <table class=""table table-bordered table-striped table-grid table-grid-top-bottum-padding-thick auto_width block_center"" style=""border-style:solid;border-width:1px;border-collapse:collapse;padding:4px;"">
            <tr>
              <th>Booking (ID, Date/Time)</th>
              <th>Organisation</th>
              <th>Service</th>
              <th>Letter</th>
              <th>Patient</th>
              <th>PT Email</th>
              <th>Send Method</th>
            </tr>
            " + output + @"
            </table>");
    }
コード例 #6
0
    protected Letter.FileContents[] ProcessReferrersLetters(bool viewListOnly, ArrayList bookingsForCurrentReferrer, bool autoSendFaxesAsEmailsIfNoEmailExistsToGPs, ref string debugOutput, int bulkLetterSendingQueueBatchID)
    {
        if (bookingsForCurrentReferrer.Count == 0)
        {
            return(new Letter.FileContents[0]);
        }


        // to return - only files to print, as emailing will have been completed
        ArrayList filesToPrint = new ArrayList();


        // single db lookup per referrer to get email
        Tuple <Booking, PatientReferrer, bool, bool, HealthCard> firstTuple = (Tuple <Booking, PatientReferrer, bool, bool, HealthCard>)bookingsForCurrentReferrer[0];
        PatientReferrer firstPR = firstTuple.Item2;


        int s = firstPR.RegisterReferrer.RegisterReferrerID;



        string[] refEmails = ContactDB.GetEmailsByEntityID(firstPR.RegisterReferrer.Organisation.EntityID);
        string[] refFaxes  = ContactDB.GetFaxesByEntityID(firstPR.RegisterReferrer.Organisation.EntityID);

        bool   firstRefHasEmail = refEmails.Length > 0;
        string refEmail         = refEmails.Length > 0 ? string.Join(",", refEmails) : null;

        bool   firstRefHasFax = refFaxes.Length > 0;
        string refFax         = refFaxes.Length > 0 ? refFaxes[0] : null;


        int  siteID  = Convert.ToInt32(Session["SiteID"]);
        Site site    = SiteDB.GetByID(siteID);
        int  staffID = Convert.ToInt32(Session["StaffID"]);

        Site[] sites = SiteDB.GetAll();
        for (int i = 0; i < bookingsForCurrentReferrer.Count; i++)
        {
            Tuple <Booking, PatientReferrer, bool, bool, HealthCard> curTuple = (Tuple <Booking, PatientReferrer, bool, bool, HealthCard>)bookingsForCurrentReferrer[i];
            Booking         curBooking     = curTuple.Item1;
            PatientReferrer curPR          = curTuple.Item2;
            bool            curRefHasEmail = curTuple.Item3;
            bool            curRefHasFax   = curTuple.Item4;
            HealthCard      curHC          = curTuple.Item5;


            bool needToGenerateLetters = curBooking.NeedToGenerateFirstLetter || curBooking.NeedToGenerateLastLetter ||
                                         (curPR.RegisterReferrer.ReportEveryVisitToReferrer && curBooking.NoteCount > 0);
            if (needToGenerateLetters)
            {
                SendMethod sendMethod = (curRefHasEmail && this.SelectedSendMethod == SendMethod.Email ? SendMethod.Email : SendMethod.Print);

                if (!viewListOnly)
                {
                    bool sendViaEmail = autoSendFaxesAsEmailsIfNoEmailExistsToGPs ? (curRefHasEmail || curRefHasFax) : curRefHasEmail;
                    if (sendViaEmail && this.SelectedSendMethod == SendMethod.Email)
                    {
                        string toEmail = autoSendFaxesAsEmailsIfNoEmailExistsToGPs ?
                                         (curRefHasEmail ? refEmail : Regex.Replace(refFax, "[^0-9]", "") + "@fax.houseofit.com.au")
                            :
                                         refEmail;

                        if (UseBulkLetterSender)
                        {
                            BulkLetterSendingQueueAdditionalLetter[] filesList = GetFilesInfo(curBooking, Letter.FileFormat.PDF, curBooking.Patient, curHC, curBooking.Offering.Field.ID, curPR.RegisterReferrer.Referrer, false, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, curPR.RegisterReferrer.ReportEveryVisitToReferrer, siteID, staffID, sendMethod == SendMethod.Email ? 2 : 1);

                            if (filesList != null && filesList.Length > 0)
                            {
                                string from_email = ((SystemVariables)System.Web.HttpContext.Current.Session["SystemVariables"])["Email_FromEmail"].Value;
                                string subject    = "Referral/Treatment Note Letters From Mediclinic" + (curPR.Patient == null ? string.Empty : " For " + curPR.Patient.Person.FullnameWithoutMiddlename);
                                string text       = "Dr. " + curPR.RegisterReferrer.Referrer.Person.FullnameWithoutMiddlename + "<br /><br />Please find attached referral/treatment note letters for your referrered patient" + (curPR.Patient == null ? string.Empty : " <b>" + curPR.Patient.Person.FullnameWithoutMiddlename + "</b>") + "<br /><br />Best regards,<br />" + site.Name;

                                int bulk_letter_sending_queue_id = BulkLetterSendingQueueDB.Insert
                                                                   (
                                    bulkLetterSendingQueueBatchID,
                                    2,                                          // bulk_letter_sending_queue_method_id (2 = email)
                                    staffID,                                    // added_by
                                    curPR.Patient.PatientID,                    // patient_id
                                    curPR.RegisterReferrer.Referrer.ReferrerID, // referrer_id
                                    curBooking.BookingID,                       // booking_id
                                    "",                                         // phone_number
                                    toEmail,                                    // email_to_address
                                    "",                                         // email_to_name
                                    from_email,                                 // email_from_address
                                    site.Name,                                  // email_from_name
                                    text,                                       // text
                                    subject,                                    // email_subject
                                    "",                                         // email_attachment_location
                                    false,                                      // email_attachment_delete_after_sending
                                    false,                                      // email_attachment_folder_delete_after_sending

                                    filesList[0].EmailLetterLetterID,
                                    filesList[0].EmailLetterKeepHistoryInDb,
                                    filesList[0].EmailLetterKeepHistoryInFile,
                                    filesList[0].EmailLetterLetterPrintHistorySendMethodID,
                                    filesList[0].EmailLetterHistoryDir,
                                    filesList[0].EmailLetterHistoryFilename,
                                    filesList[0].EmailLetterSiteID,
                                    filesList[0].EmailLetterOrganisationID,
                                    filesList[0].EmailLetterBookingID,
                                    filesList[0].EmailLetterPatientID,
                                    filesList[0].EmailLetterRegisterReferrerIdToUseInsteadOfPatientsRegRef,
                                    filesList[0].EmailLetterStaffID,
                                    filesList[0].EmailLetterHealthCardActionID,
                                    filesList[0].EmailLetterSourceTemplatePath,
                                    filesList[0].EmailLetterOutputDocPath,
                                    false, // filesList[0].EmailLetterIsDoubleSidedPrinting,
                                    filesList[0].EmailLetterExtraPages,
                                    filesList[0].EmailLetterItemSeperator,

                                    "",    // sql_to_run_on_completion
                                    ""     // sql_to_run_on_failure
                                                                   );

                                for (int f = 1; f < filesList.Length; f++)
                                {
                                    BulkLetterSendingQueueAdditionalLetterDB.Insert(
                                        bulk_letter_sending_queue_id,
                                        filesList[f].EmailLetterLetterID,
                                        filesList[f].EmailLetterKeepHistoryInDb,
                                        filesList[f].EmailLetterKeepHistoryInFile,
                                        filesList[f].EmailLetterLetterPrintHistorySendMethodID,
                                        filesList[f].EmailLetterHistoryDir,
                                        filesList[f].EmailLetterHistoryFilename,
                                        filesList[f].EmailLetterSiteID,
                                        filesList[f].EmailLetterOrganisationID,
                                        filesList[f].EmailLetterBookingID,
                                        filesList[f].EmailLetterPatientID,
                                        filesList[f].EmailLetterRegisterReferrerIdToUseInsteadOfPatientsRegRef,
                                        filesList[f].EmailLetterStaffID,
                                        filesList[f].EmailLetterHealthCardActionID,
                                        filesList[f].EmailLetterSourceTemplatePath,
                                        filesList[f].EmailLetterOutputDocPath,
                                        false, // filesList[f].EmailLetterIsDoubleSidedPrinting,
                                        filesList[f].EmailLetterExtraPages,
                                        filesList[f].EmailLetterItemSeperator);
                                }
                            }
                        }
                        else
                        {
                            Letter.FileContents[] fileContentsList = curBooking.GetSystemLettersList(Letter.FileFormat.PDF, curBooking.Patient, curHC, curBooking.Offering.Field.ID, curPR.RegisterReferrer.Referrer, false, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, curPR.RegisterReferrer.ReportEveryVisitToReferrer, false, Convert.ToInt32(Session["SiteID"]), Convert.ToInt32(Session["StaffID"]), sendMethod == SendMethod.Email ? 2 : 1);
                            if (fileContentsList != null && fileContentsList.Length > 0)
                            {
                                //Logger.LogQuery("ReferrerEPCLetters_Reprint -- Email Send Item Starting!");
                                Site bkSite = SiteDB.GetSiteByType(curBooking.Organisation.IsAgedCare ? SiteDB.SiteType.AgedCare : SiteDB.SiteType.Clinic, sites);
                                Letter.EmailSystemLetter(bkSite.Name, toEmail, fileContentsList);
                                //Logger.LogQuery("ReferrerEPCLetters_Reprint -- Email Send Item Done!");
                            }
                        }
                    }
                    else
                    {
                        Letter.FileContents[] fileContentsList = curBooking.GetSystemLettersList(Letter.FileFormat.Word, curBooking.Patient, curHC, curBooking.Offering.Field.ID, curPR.RegisterReferrer.Referrer, false, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, curPR.RegisterReferrer.ReportEveryVisitToReferrer, false, Convert.ToInt32(Session["SiteID"]), Convert.ToInt32(Session["StaffID"]), sendMethod == SendMethod.Email ? 2 : 1);
                        if (fileContentsList != null && fileContentsList.Length > 0)
                        {
                            filesToPrint.AddRange(fileContentsList);
                        }
                    }

                    BookingDB.UpdateSetGeneratedSystemLetters(curBooking.BookingID, curBooking.NeedToGenerateFirstLetter, curBooking.NeedToGenerateLastLetter, true);
                }

                ArrayList toGenerateList = new ArrayList();
                if (curBooking.NeedToGenerateFirstLetter)
                {
                    toGenerateList.Add("First");
                }
                if (curBooking.NeedToGenerateLastLetter)
                {
                    toGenerateList.Add("Last");
                }
                if (curPR.RegisterReferrer.ReportEveryVisitToReferrer && curBooking.NoteCount > 0)
                {
                    toGenerateList.Add("Notes");
                }
                string toGenerate = string.Join(",", (string[])toGenerateList.ToArray(typeof(string)));

                debugOutput += @"<tr>
                                    <td>" + sendMethod + @"</td>
                                    <td style=""white-space:nowrap;"">" + curBooking.BookingID + " &nbsp;&nbsp;&nbsp;[" + curBooking.DateStart.ToString("dd-MM-yyyy") + "&nbsp;&nbsp;&nbsp;" + curBooking.DateStart.ToString("HH:mm") + "-" + curBooking.DateEnd.ToString("HH:mm") + "]" + @"</td>
                                    <td>" + toGenerate + @"</td>
                                    <td>" + curPR.RegisterReferrer.Referrer.Person.FullnameWithoutMiddlename + @"</td>
                                    <td style=""white-space:nowrap;"">" + (curRefHasEmail ? refEmail : "") + @"</td>
                                    <td style=""white-space:nowrap;"">" + (curRefHasFax ? refFax : "") + @"</td>
                                    <td>" + curPR.Patient.Person.FullnameWithoutMiddlename + @"</td>
                                </tr>";
            }
        }

        return((Letter.FileContents[])filesToPrint.ToArray(typeof(Letter.FileContents)));
    }
コード例 #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (SiteDB.GetSiteByType(SiteDB.SiteType.AgedCare) != null)
        {
            HideTableAndSetErrorMessage("Aged Care Site Already Exists");
            return;
        }


        string errMsg = string.Empty;

        txtACSiteName.Text = Utilities.FormatName(txtACSiteName.Text.Trim());

        if (txtACSiteName.Text == string.Empty)
        {
            errMsg += (errMsg.Length == 0 ? "" : "<br />") + "Site Name is required";
        }

        if (errMsg.Length > 0)
        {
            SetErrorMessage(errMsg);
            return;
        }



        try
        {
            string sql = @"

Declare @entity_id int

INSERT INTO Entity DEFAULT VALUES;
SET @entity_id = SCOPE_IDENTITY()

SET IDENTITY_INSERT Site ON
INSERT INTO Site
	(
		site_id,
		entity_id,
		name,
		abn,
		acn,
		tfn,
		asic,
		is_provider,
		bank_bpay,
		bank_bsb,
		bank_account,
		bank_direct_debit_userid,
		bank_username,
		oustanding_balance_warning,
		print_epc,
		excl_sun,
		excl_mon,
		excl_tue,
		excl_wed,
		excl_thu,
		excl_fri,
		excl_sat,
		day_start_time,
		lunch_start_time,
		lunch_end_time,
		day_end_time,
		fiscal_yr_end,
		num_booking_months_to_get,
		site_type_id
	) 
    VALUES
    (
		2,
		@entity_id,
		'"         + txtACSiteName.Text + @"',
		'',
		'',
		'',
		'',
		0,
		'',
		'',
		'',
		'',
		'',
		0.00,
		1,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		'08:00:00.0000000',
		'00:00:00.0000000',
		'00:00:00.0000000',
		'22:00:00.0000000',
		'2014-06-30 00:00:00.000',
		54,
		2
    )
    
SET IDENTITY_INSERT Site OFF

";

            DBBase.ExecuteNonResult(sql);

            HideTableAndSetErrorMessage("Site Added!<br /><br /><font color=\"blue\"><center><table style=\"text-align:left;max-width:520px;\"><tr><td><ol><li>Logout and then log back in so the 'change site' link is showing</li><li>Go into the new AC site</li><li>Go to menu <b><u>Letters</u></b> ⇨ <b><u>Treatment Letters</u></b></li><li>Add a row for each profession until the row where you add is no longer showing (indicating there exists a row for all professions already)<br /><br /></li><li>You may also need to add <u>AC invoice</u> and <u>AC Overdue Invoice</u> templates in the letters page</li></ol></td></tr></table></center></font>");
            SetupGUI();
        }
        catch (CustomMessageException ex)
        {
            SetErrorMessage(ex.Message);
        }
        catch (Exception ex)
        {
            SetErrorMessage("", ex.ToString());
        }
    }