Exemple #1
0
    public static Hashtable GetBullkActive(int[] patient_ids)
    {
        // remove duplicates
        ArrayList uniquePatientIDs = new ArrayList();

        for (int i = 0; i < patient_ids.Length; i++)
        {
            if (!uniquePatientIDs.Contains(patient_ids[i]))
            {
                uniquePatientIDs.Add(patient_ids[i]);
            }
        }
        patient_ids = (int[])uniquePatientIDs.ToArray(typeof(int));



        HealthCard[] patientHealthCards = HealthCardDB.GetByPatientIDs(patient_ids);

        Hashtable patientCards = new Hashtable();

        for (int i = 0; i < patientHealthCards.Length; i++)
        {
            if (patientCards[patientHealthCards[i].Patient.PatientID] == null)
            {
                patientCards[patientHealthCards[i].Patient.PatientID] = new PatientActiveHealthCards();
            }

            ((PatientActiveHealthCards)patientCards[patientHealthCards[i].Patient.PatientID]).Add(patientHealthCards[i]);
        }

        return(patientCards);
    }
Exemple #2
0
    protected Tuple <Booking, PatientReferrer, bool, string, HealthCard> LoadRow(DataRow row)
    {
        Booking booking = BookingDB.Load(row, "booking_", true, false);

        booking.Offering = OfferingDB.Load(row, "offering_");

        PatientReferrer pr = PatientReferrerDB.Load(row, "pr_");

        pr.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        pr.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            pr.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }
        pr.Patient              = PatientDB.Load(row, "patient_");
        pr.Patient.Person       = PersonDB.Load(row, "patient_person_");
        pr.Patient.Person.Title = IDandDescrDB.Load(row, "patient_person_title_title_id", "patient_person_title_descr");

        bool   refHasEmail = Convert.ToInt32(row["ref_has_email"]) == 1;
        string refEmail    = row["ref_email"] == DBNull.Value ? null : Convert.ToString(row["ref_email"]);

        HealthCard hc = HealthCardDB.Load(row, "hc_");

        return(new Tuple <Booking, PatientReferrer, bool, string, HealthCard>(booking, pr, refHasEmail, refEmail, hc));
    }
Exemple #3
0
    protected void btnGenerateSystemLetters_Click(object sender, EventArgs e)
    {
        System.Collections.ArrayList fileContentsList = new System.Collections.ArrayList();

        Booking[] bookings = BookingDB.GetBookingsToGenerateSystemLetters(DateTime.MinValue, DateTime.MinValue, GetFormID());
        for (int i = 0; i < bookings.Length; i++)
        {
            // send referrer letters

            PatientReferrer[] patientReferrers = PatientReferrerDB.GetActiveEPCPatientReferrersOf(bookings[i].Patient.PatientID);
            if (patientReferrers.Length > 0)
            {
                HealthCard hc = HealthCardDB.GetActiveByPatientID(bookings[i].Patient.PatientID);
                bool       needToGenerateTreatmentLetter = patientReferrers[patientReferrers.Length - 1].RegisterReferrer.ReportEveryVisitToReferrer;

                Letter.FileContents[] bookingFileContentsList = bookings[i].GetSystemLettersList(Letter.FileFormat.Word, bookings[i].Patient, hc, bookings[i].Offering.Field.ID, patientReferrers[patientReferrers.Length - 1].RegisterReferrer.Referrer, true, bookings[i].NeedToGenerateFirstLetter, bookings[i].NeedToGenerateLastLetter, needToGenerateTreatmentLetter, false, Convert.ToInt32(Session["SiteID"]), Convert.ToInt32(Session["StaffID"]), 1);
                fileContentsList.AddRange(bookingFileContentsList);
                BookingDB.UpdateSetGeneratedSystemLetters(bookings[i].BookingID, bookings[i].NeedToGenerateFirstLetter, bookings[i].NeedToGenerateLastLetter, true);
            }
        }

        Letter.FileContents mergedFileContents = Letter.FileContents.Merge((Letter.FileContents[])fileContentsList.ToArray(typeof(Letter.FileContents)), "Treatment Letters.doc"); // .pdf
        if (mergedFileContents != null)
        {
            Session["downloadFile_Contents"] = mergedFileContents.Contents;
            Session["downloadFile_DocName"]  = mergedFileContents.DocName;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "download", "<script language=javascript>window.open('DownloadFile.aspx','_blank','status=1,toolbar=0,menubar=0,location=1,scrollbars=1,resizable=1,width=30,height=30');</script>");
        }

        UpdateGenerateSystemLetters();
    }
Exemple #4
0
    protected void btnAddEditCard(CardType cardType)
    {
        HealthCard[] hcCards            = HealthCardDB.GetAllByPatientID(this.PatientID, false, cardType == CardType.Medicare ? -1 : -2);
        string       urlFieldsTypeAndID = (hcCards.Length == 0) ? "?type=add&id=" + this.PatientID : "?type=view&id=" + hcCards[0].HealthCardID;

        Response.Redirect("~/HealthCardDetailV2.aspx" + urlFieldsTypeAndID + "&card=" + (cardType == CardType.Medicare ? "medicare" : (cardType == CardType.DVA ? "dva" : "ins")));
    }
 public static HealthCard GetActiveByPatientID(int patient_id, int organisation_id = 0)
 {
     HealthCard[] healthCards = HealthCardDB.GetAllByPatientID(patient_id, true, organisation_id);
     if (healthCards.Length > 1)
     {
         throw new CustomMessageException("Multiple active cards found");
     }
     return(healthCards.Length == 0 ? null : healthCards[0]);
 }
Exemple #6
0
    protected void chkIsActive_CheckedChanged(object sender, EventArgs e)
    {
        int healthCardID = Convert.ToInt32(((CheckBox)sender).Attributes["CommandArgument"]);

        if (((CheckBox)sender).Checked)
        {
            HealthCardDB.UpdateAllCardsInactive(this.PatientID, healthCardID);
            HealthCardDB.UpdateIsActive(healthCardID, true);
        }
        else
        {
            HealthCardDB.UpdateIsActive(healthCardID, false);
        }

        UpdateInfo();
    }
Exemple #7
0
    protected void UpdateInfo()
    {
        if (this.PatientID == -1)
        {
            return;
        }

        HealthCard[] healthcards   = HealthCardDB.GetAllByPatientID(this.PatientID, this.ShowOnlyActiveCard);
        HealthCard   medicareCard  = null;
        HealthCard   dvaCard       = null;
        HealthCard   insuranceCard = null;

        for (int i = 0; i < healthcards.Length; i++)
        {
            if (healthcards[i].Organisation.OrganisationID == -1)
            {
                medicareCard = healthcards[i];
            }
            else if (healthcards[i].Organisation.OrganisationID == -2)
            {
                dvaCard = healthcards[i];
            }
            else
            {
                healthcards[i].Organisation = OrganisationDB.GetByID(healthcards[i].Organisation.OrganisationID);
                if (healthcards[i].Organisation.OrganisationType.OrganisationTypeGroup.ID == 7)
                {
                    insuranceCard = healthcards[i];
                }
            }
        }

        if (this.ShowOnlyActiveCard)
        {
            HideInactiveCards(medicareCard == null || !medicareCard.IsActive, dvaCard == null || !dvaCard.IsActive, insuranceCard == null || !insuranceCard.IsActive);
        }

        no_epc_message_row.Visible = this.ShowNoEpcMessageRow && medicareCard == null && dvaCard == null && insuranceCard == null;

        UpdateCard(medicareCard, CardType.Medicare);
        UpdateCard(dvaCard, CardType.DVA);
        UpdateCard(insuranceCard, CardType.Insurance);
    }
 protected HealthCard GetHealthCareCard(Hashtable bulkHealthCardHash, int patientID)
 {
     if (bulkHealthCardHash != null) // get from bulk cache of healthcards of all patients
     {
         PatientActiveHealthCards healthCards = (PatientActiveHealthCards)bulkHealthCardHash[patientID];
         if (healthCards == null)
         {
             return(null);
         }
         else
         {
             return(this.claimType == ClaimType.Medicare ? healthCards.MedicareCard : healthCards.DVACard);
         }
     }
     else
     {
         HealthCard[] cards = HealthCardDB.GetAllByPatientID(patientID, false, this.claimType == ClaimType.Medicare ? -1 : -2);
         return(cards.Length > 0 ? cards[cards.Length - 1] : null);
     }
 }
Exemple #9
0
    public static Referral LoadAll(DataRow row)
    {
        Referral referral = Load(row);

        referral.HealthCard         = HealthCardDB.Load(row);
        referral.MedicalServiceType = IDandDescrDB.Load(row, "mct_medical_service_type_id", "mct_descr");


        referral.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        referral.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        referral.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        referral.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            referral.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }


        if (row["added_or_last_modified_by_staff_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy = StaffDB.Load(row, "added_or_last_modified_by_");
        }
        if (row["person_added_or_last_modified_by_person_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy.Person       = PersonDB.Load(row, "person_added_or_last_modified_by_");
            referral.AddedOrLastModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_added_or_last_modified_by_title_id", "title_added_or_last_modified_by_descr");
        }

        if (row["deleted_by_staff_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy = StaffDB.Load(row, "deleted_by_");
        }
        if (row["person_deleted_by_person_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy.Person       = PersonDB.Load(row, "person_deleted_by_");
            referral.AddedOrLastModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_deleted_by_title_id", "title_deleted_by_descr");
        }


        return(referral);
    }
Exemple #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

        try
        {
            if (Session == null || Session["DB"] == null)
            {
                throw new SessionTimedOutException();
            }

            string id = Request.QueryString["id"];
            if (id == null)
            {
                throw new CustomMessageException("No id in url");
            }
            if (!Regex.IsMatch(id, @"^\d+$"))
            {
                throw new CustomMessageException("Booking id does not exist or is not a number");
            }

            string type = Request.QueryString["type"];
            if (type == null)
            {
                throw new CustomMessageException("No type in url");
            }
            if (type != "add" && type != "edit")
            {
                throw new CustomMessageException("Unknown type in url not in ('edit','add') : '" + type + "'");
            }

            string cardtype = Request.QueryString["cardtype"];
            if (cardtype == null)
            {
                throw new CustomMessageException("No cardtype in url");
            }
            if (cardtype != "medicare" && cardtype != "dva")
            {
                throw new CustomMessageException("Unknown type in url not in ('edit','add') : '" + type + "'");
            }



            if (type == "add")
            {
                int  patient_id      = Convert.ToInt32(id);
                bool has_active_card = HealthCardDB.ActiveCardExistsFor(Convert.ToInt32(patient_id), 0, -1, cardtype == "medicare" ? -1 : -2);
                Response.Write(has_active_card ? "1" : "0");
            }
            else if (type == "edit")
            {
                int        health_card_id_to_exclude = Convert.ToInt32(id);
                HealthCard health_card     = HealthCardDB.GetByID(health_card_id_to_exclude);
                int        patient_id      = health_card.Patient.PatientID;
                bool       has_active_card = HealthCardDB.ActiveCardExistsFor(Convert.ToInt32(patient_id), 0, health_card_id_to_exclude, cardtype == "medicare" ? -1 : -2);
                Response.Write(has_active_card ? "1" : "0");
            }
        }
        catch (SessionTimedOutException)
        {
            Utilities.UnsetSessionVariables();
            Response.Write("SessionTimedOutException");
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "Error - please contact system administrator."));
        }
    }
Exemple #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

        try
        {
            if (Session == null || Session["DB"] == null)
            {
                throw new SessionTimedOutException();
            }

            string id = Request.QueryString["id"];
            if (id == null)
            {
                throw new CustomMessageException("No id in url");
            }
            if (!Regex.IsMatch(id, @"^\d+$"))
            {
                throw new CustomMessageException("Booking id does not exist or is not a number");
            }

            string id_type = Request.QueryString["id_type"];
            if (id_type == null)
            {
                throw new CustomMessageException("No id_type in url");
            }
            if (id_type != "patient" && id_type != "healthcard")
            {
                throw new CustomMessageException("Unknown id_type in url not in ('patient','healthcard') : '" + id_type + "'");
            }


            int patientID = -1;
            if (id_type == "patient")
            {
                patientID = Convert.ToInt32(id);
            }
            else
            {
                HealthCard hc = HealthCardDB.GetByID(Convert.ToInt32(id));
                if (hc != null)
                {
                    patientID = hc.Patient.PatientID;
                }
            }

            if (!PatientDB.Exists(patientID))
            {
                throw new CustomMessageException("Unknown patient id : " + patientID);
            }

            bool hasReferrer = PatientReferrerDB.GetActiveEPCPatientReferrersOf(patientID).Length > 0;

            Response.Write(hasReferrer ? "1" : "0");
        }
        catch (SessionTimedOutException)
        {
            Utilities.UnsetSessionVariables();
            Response.Write("SessionTimedOutException");
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "Error - please contact system administrator."));
        }
    }
Exemple #12
0
    public DataTable GetSelectedList()
    {
        DataTable dt_selected_list = Session["data_selected"] as DataTable;

        string areaTreated = string.Empty;

        if (InvoiceType == Booking.InvoiceType.DVA || InvoiceType == Booking.InvoiceType.Insurance)
        {
            areaTreated = HealthCardDB.GetActiveByPatientID(Booking.Patient.PatientID).AreaTreated;
        }

        if (dt_selected_list == null)
        {
            dt_selected_list = new DataTable();
            dt_selected_list.Columns.Add(new DataColumn("offering_id"));
            dt_selected_list.Columns.Add(new DataColumn("hc_paid"));
            dt_selected_list.Columns.Add(new DataColumn("short_name"));
            dt_selected_list.Columns.Add(new DataColumn("name"));
            dt_selected_list.Columns.Add(new DataColumn("area_treated"));
            dt_selected_list.Columns.Add(new DataColumn("service_reference"));
            dt_selected_list.Columns.Add(new DataColumn("show_area_treated", typeof(Boolean)));
            dt_selected_list.Columns.Add(new DataColumn("show_service_reference", typeof(Boolean)));
            dt_selected_list.Columns.Add(new DataColumn("default_price"));
            dt_selected_list.Columns.Add(new DataColumn("pt_price"));                // added
            dt_selected_list.Columns.Add(new DataColumn("hc_price"));                // added
            dt_selected_list.Columns.Add(new DataColumn("pt_gst"));                  // added
            dt_selected_list.Columns.Add(new DataColumn("hc_gst"));                  // added
            dt_selected_list.Columns.Add(new DataColumn("quantity"));
            dt_selected_list.Columns.Add(new DataColumn("total_line_price"));
            dt_selected_list.Columns.Add(new DataColumn("total_line_gst"));
            dt_selected_list.Columns.Add(new DataColumn("total_pt_price"));          // added
            dt_selected_list.Columns.Add(new DataColumn("total_hc_price"));          // added
            dt_selected_list.Columns.Add(new DataColumn("total_pt_gst"));            // added
            dt_selected_list.Columns.Add(new DataColumn("total_hc_gst"));            // added
            dt_selected_list.Columns.Add(new DataColumn("on_order", typeof(Boolean)));


            if (this.booking != null)
            {
                Booking.InvoiceType invType = InvoiceType;

                Offering orgOffering = OrganisationOfferingsDB.GetOfferingByOrgAndOffering(this.booking.Organisation.OrganisationID, this.booking.Offering.OfferingID);
                if (orgOffering == null)
                {
                    orgOffering = this.booking.Offering;
                }

                bool    invoiceGapPayments = Convert.ToInt32(SystemVariableDB.GetByDescr("InvoiceGapPayments").Value) == 1;
                decimal GST_Percent        = Convert.ToDecimal(((SystemVariables)System.Web.HttpContext.Current.Session["SystemVariables"])["GST_Percent"].Value);
                decimal GST_Modifier       = GST_Percent / (decimal)100;

                bool incGstOnPTInvoices = IncGstOnInvoices_Private && !orgOffering.IsGstExempt;
                bool incGstOnHCInvoices = (invType == Booking.InvoiceType.Medicare && IncGstOnInvoices_MC && !orgOffering.IsGstExempt) ||
                                          (invType == Booking.InvoiceType.DVA && IncGstOnInvoices_DVA && !orgOffering.IsGstExempt) ||
                                          (invType == Booking.InvoiceType.Insurance && IncGstOnInvoices_Insurance && !orgOffering.IsGstExempt);


                decimal pt_price = orgOffering.DefaultPrice;
                decimal hc_price = 0;
                decimal pt_tax   = !incGstOnPTInvoices ? 0 : pt_price * GST_Modifier;
                decimal hc_tax   = !incGstOnHCInvoices ? 0 : hc_price * GST_Modifier;

                if (invType == Booking.InvoiceType.Medicare)
                {
                    pt_price = invoiceGapPayments && orgOffering.DefaultPrice > orgOffering.MedicareCharge ? orgOffering.DefaultPrice - orgOffering.MedicareCharge : 0;
                    hc_price = orgOffering.MedicareCharge;
                    pt_tax   = !incGstOnPTInvoices ? 0 : pt_price * GST_Modifier;
                    hc_tax   = !incGstOnHCInvoices ? 0 : hc_price * GST_Modifier;
                }
                if (invType == Booking.InvoiceType.DVA)
                {
                    pt_price = invoiceGapPayments && orgOffering.DefaultPrice > orgOffering.DvaCharge ? orgOffering.DefaultPrice - orgOffering.DvaCharge : 0;
                    hc_price = orgOffering.DvaCharge;
                    pt_tax   = !incGstOnPTInvoices ? 0 : pt_price * GST_Modifier;
                    hc_tax   = !incGstOnHCInvoices ? 0 : hc_price * GST_Modifier;
                }
                if (invType == Booking.InvoiceType.Insurance)
                {
                    hc_price = orgOffering.TacCompanyCode.Length > 0 ? orgOffering.TacCharge : orgOffering.DefaultPrice;
                    pt_price = invoiceGapPayments && orgOffering.DefaultPrice > hc_price ? orgOffering.DefaultPrice - hc_price : 0;
                    pt_tax   = !incGstOnPTInvoices ? 0 : pt_price * GST_Modifier;
                    hc_tax   = !incGstOnHCInvoices ? 0 : hc_price * GST_Modifier;
                }


                DataRow row = dt_selected_list.NewRow();
                row["offering_id"]            = booking.Offering.OfferingID;
                row["hc_paid"]                = (this.InvoiceType == Booking.InvoiceType.DVA || this.InvoiceType == Booking.InvoiceType.Medicare);
                row["short_name"]             = booking.Offering.ShortName;
                row["name"]                   = booking.Offering.Name;
                row["area_treated"]           = areaTreated;
                row["service_reference"]      = "";
                row["show_area_treated"]      = InvoiceType == Booking.InvoiceType.DVA || InvoiceType == Booking.InvoiceType.Insurance;
                row["show_service_reference"] = InvoiceType == Booking.InvoiceType.Insurance;
                row["default_price"]          = row["total_line_price"] = orgOffering.DefaultPrice;
                row["pt_price"]               = row["total_pt_price"] = pt_price;                      // added
                row["pt_gst"]                 = row["total_pt_gst"] = pt_tax;                          // added
                row["hc_price"]               = row["total_hc_price"] = hc_price;                      // added
                row["hc_gst"]                 = row["total_hc_gst"] = hc_tax;                          // added
                row["quantity"]               = "1";
                row["on_order"]               = false;
                dt_selected_list.Rows.Add(row);
            }

            Session["data_selected"] = dt_selected_list;
        }

        if (dt_selected_list.Rows.Count == 1 && dt_selected_list.Rows[0][0] == DBNull.Value)
        {
            dt_selected_list.Rows.RemoveAt(0);
        }

        return(dt_selected_list);
    }
Exemple #13
0
    protected void Add(int offeringID)
    {
        string areaTreated = string.Empty;

        if (InvoiceType == Booking.InvoiceType.DVA || InvoiceType == Booking.InvoiceType.Insurance)
        {
            areaTreated = HealthCardDB.GetActiveByPatientID(Booking.Patient.PatientID).AreaTreated;
        }


        int index = -1;

        for (int i = 0; i < GrdOffering.Rows.Count; i++)
        {
            Label lbl = (Label)GrdOffering.Rows[i].FindControl("lblId");
            if (lbl != null && lbl.Text == offeringID.ToString())
            {
                index = i;
            }
        }

        if (index == -1)
        {
            return;
        }



        Label lblId           = (Label)GrdOffering.Rows[index].FindControl("lblId");
        Label lblShortName    = (Label)GrdOffering.Rows[index].FindControl("lblShortName");
        Label lblDefaultPrice = (Label)GrdOffering.Rows[index].FindControl("lblDefaultPrice");


        // see about medicare and dva code ...
        DataTable dt_offering = Session["data_offering"] as DataTable;

        DataRow[] foundRows = dt_offering.Select("o_offering_id=" + lblId.Text);
        DataRow   thisRow   = foundRows[0];

        string medicare_company_code = thisRow["o_medicare_company_code"].ToString();
        string dva_company_code      = thisRow["o_dva_company_code"].ToString();
        string tac_company_code      = thisRow["o_tac_company_code"].ToString();
        bool   hcPaid = (this.InvoiceType == Booking.InvoiceType.DVA && dva_company_code.Length > 0) || (this.InvoiceType == Booking.InvoiceType.Insurance && tac_company_code.Length > 0);


        DataTable dt_selected_list = GetSelectedList();

        foreach (DataRow curRow in dt_selected_list.Rows)
        {
            if (curRow["offering_id"].ToString() == lblId.Text)
            {
                return;
            }
        }

        DataRow row = dt_selected_list.NewRow();

        row["offering_id"]            = lblId.Text;
        row["hc_paid"]                = hcPaid;
        row["short_name"]             = lblShortName.Text;
        row["name"]                   = thisRow["o_name"].ToString();
        row["area_treated"]           = areaTreated;
        row["service_reference"]      = string.Empty;
        row["show_area_treated"]      = InvoiceType == Booking.InvoiceType.DVA || InvoiceType == Booking.InvoiceType.Insurance;
        row["show_service_reference"] = InvoiceType == Booking.InvoiceType.Insurance;
        row["default_price"]          = thisRow["o_default_price"];
        row["pt_price"]               = thisRow["pt_price"];          // added
        row["hc_price"]               = thisRow["hc_price"];          // added
        row["pt_gst"]                 = thisRow["pt_gst"];            // added
        row["hc_gst"]                 = thisRow["hc_gst"];            // added
        row["quantity"]               = "1";
        row["total_line_price"]       = thisRow["o_default_price"];
        row["total_pt_price"]         = thisRow["pt_price"];          // added
        row["total_pt_gst"]           = thisRow["pt_gst"];            // added
        row["total_hc_price"]         = thisRow["hc_price"];          // added
        row["total_hc_gst"]           = thisRow["hc_gst"];            // added
        row["on_order"]               = false;

        dt_selected_list.Rows.Add(row);

        Session["data_selected"] = dt_selected_list;
        UpdateTotal(dt_selected_list);

        FillSelectedGrid();
    }
    protected void InitForm(int patientID)
    {
        HideAllRows();

        string url     = "/PatientReferrerHistoryPopupV2.aspx?id=" + patientID;
        string text    = "History";
        string onclick = @"onclick=""open_new_tab('" + url + @"');return false;""";

        lblPatientReferrerHistoryPopup.Text = "<a " + onclick + " href=\"\">" + text + "</a>";


        PatientReferrer[] patientReferrer = PatientReferrerDB.GetActiveEPCPatientReferrersOf(patientID);  // = PatientReferrerDB.GetEPCPatientReferrersOf(patient.PatientID);
        if (patientReferrer.Length > 0)
        {
            PatientReferrer  currentPatRegReferrer = patientReferrer[patientReferrer.Length - 1]; // get latest
            RegisterReferrer curRegReferrer        = currentPatRegReferrer.RegisterReferrer;

            displayHaveReferrerRow.Visible = true;

            // only allow removing a referrer if no EPC set [ie no active healthcard, or healthcard with neither date set]
            HealthCard hc          = HealthCardDB.GetActiveByPatientID(patientID);
            bool       allowDelete = hc == null || !hc.HasEPC();
            btnDelete.Visible = allowDelete;
            lblDeleteRegistrationReferrerBtnSeperator.Visible = allowDelete;

            //lblReferrer.Text = curRegReferrer.Referrer.Person.Surname + ", " + curRegReferrer.Referrer.Person.Firstname + " [" + curRegReferrer.Organisation.Name + "]" + " [" + currentPatRegReferrer.PatientReferrerDateAdded.ToString("dd-MM-yyyy") + "]";

            string phNumTxt = string.Empty;

            if (Utilities.GetAddressType().ToString() == "Contact")
            {
                Contact[] phNums = ContactDB.GetByEntityID(2, curRegReferrer.Organisation.EntityID);
                for (int i = 0; i < phNums.Length; i++)
                {
                    phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " &nbsp;&nbsp; (" + phNums[i].ContactType.Descr + ")";
                }
            }
            else if (Utilities.GetAddressType().ToString() == "ContactAus")
            {
                ContactAus[] phNums = ContactAusDB.GetByEntityID(2, curRegReferrer.Organisation.EntityID);
                for (int i = 0; i < phNums.Length; i++)
                {
                    phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " &nbsp;&nbsp; (" + phNums[i].ContactType.Descr + ")";
                }
            }
            else
            {
                throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
            }

            lblReferrer.Text = curRegReferrer.Referrer.Person.Surname + ", " + curRegReferrer.Referrer.Person.Firstname + (curRegReferrer.Organisation.Name.Length == 0 ? "" : " [" + curRegReferrer.Organisation.Name + "]") + "<br />" + Environment.NewLine +
                               "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" + Environment.NewLine +
                               "<tr><td>" + "Provider Nbr:" + "</td><td style=\"width:12px\"></td><td><font color=\"#A52A2A\">" + currentPatRegReferrer.RegisterReferrer.ProviderNumber + "</font></td></tr>" + Environment.NewLine +
                               "<tr><td>" + "Date Added:" + "</td><td style=\"width:12px\"></td><td><font color=\"#A52A2A\">" + currentPatRegReferrer.PatientReferrerDateAdded.ToString("dd-MM-yyyy") + "</font></td></tr>" + Environment.NewLine +
                               "</table>" + Environment.NewLine +
                               (phNumTxt.Length == 0 ? "" : phNumTxt + "<br />"); // put in referrers fax and phone numbers

            lblReferrerRegisterID.Text = curRegReferrer.RegisterReferrerID.ToString();
        }
        else
        {
            displayNoReferrerRow.Visible = true;
        }
    }
Exemple #15
0
    public static LetterPrintHistory LoadAll(DataRow row)
    {
        LetterPrintHistory lph = Load(row, "lph_");

        lph.Letter = LetterDB.Load(row, "letter_");

        lph.SendMethod = new IDandDescr(Convert.ToInt32(row["lph_send_method_letter_print_history_send_method_id"]), Convert.ToString(row["lph_send_method_descr"]));

        lph.Letter.LetterType = IDandDescrDB.Load(row, "lettertype_letter_type_id", "lettertype_descr");
        if (row["letterorg_organisation_id"] != DBNull.Value)
        {
            lph.Letter.Organisation = OrganisationDB.Load(row, "letterorg_");
        }

        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            lph.Organisation = OrganisationDB.Load(row, "organisation_");
        }

        if (row["patient_patient_id"] != DBNull.Value)
        {
            lph.Patient = PatientDB.Load(row, "patient_");
        }
        if (row["patient_patient_id"] != DBNull.Value)
        {
            lph.Patient.Person       = PersonDB.Load(row, "person_patient_");
            lph.Patient.Person.Title = IDandDescrDB.Load(row, "title_patient_title_id", "title_patient_descr");
        }

        if (row["staff_staff_id"] != DBNull.Value)
        {
            lph.Staff = StaffDB.Load(row, "staff_");
        }
        if (row["staff_staff_id"] != DBNull.Value)
        {
            lph.Staff.Person       = PersonDB.Load(row, "person_staff_");
            lph.Staff.Person.Title = IDandDescrDB.Load(row, "title_staff_title_id", "title_staff_descr");
        }

        if (row["regref_register_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer = RegisterReferrerDB.Load(row, "regref_");
        }
        if (row["regreforg_organisation_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Organisation = OrganisationDB.Load(row, "regreforg_");
        }
        if (row["referrer_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Referrer = ReferrerDB.Load(row, "referrer_");
        }
        if (row["referrer_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "person_referrer_");
            lph.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "title_referrer_title_id", "title_referrer_descr");
        }

        if (row["lph_health_card_action_id"] != DBNull.Value)
        {
            lph.HealthCardAction = HealthCardActionDB.Load(row, "hca_");
            lph.HealthCardAction.healthCardActionType = IDandDescrDB.Load(row, "hcat_health_card_action_type_id", "hcat_descr");
            lph.HealthCardAction.HealthCard           = HealthCardDB.Load(row, "hc_");
        }

        if (row["lph_booking_id"] != DBNull.Value)
        {
            lph.Booking = BookingDB.Load(row, "booking_");
        }

        return(lph);
    }