Ejemplo n.º 1
0
    protected void GrdRegistration_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label lblId = (Label)GrdRegistration.FooterRow.FindControl("lblId");

        RegisterStaff registerStaff = RegisterStaffDB.GetByID(Convert.ToInt32(lblId.Text));

        if (BookingDB.GetCountByProviderAndOrg(registerStaff.Staff.StaffID, registerStaff.Organisation.OrganisationID) > 0)
        {
            SetErrorMessage("Can not remove registration of '" + registerStaff.Staff.Person.FullnameWithoutMiddlename + "' to '" + registerStaff.Organisation.Name + "' because there exists a booking for this provider there.");
            return;
        }

        try
        {
            RegisterStaffDB.UpdateInactive(Convert.ToInt32(lblId.Text), false);
        }
        catch (ForeignKeyConstraintException fkcEx)
        {
            if (Utilities.IsDev())
            {
                HideTableAndSetErrorMessage("Can not delete because other records depend on this : " + fkcEx.Message);
            }
            else
            {
                HideTableAndSetErrorMessage("Can not delete because other records depend on this");
            }
        }

        FillGrid();
    }
Ejemplo n.º 2
0
    protected void GrdRegistration_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId             = (Label)GrdRegistration.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlOrganisation   = (DropDownList)GrdRegistration.Rows[e.RowIndex].FindControl("ddlOrganisation");
        TextBox      txtProviderNumber = (TextBox)GrdRegistration.Rows[e.RowIndex].FindControl("txtProviderNumber");
        CheckBox     chkMainProvider   = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkMainProvider");
        CheckBox     chkIncMondays     = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncMondays");
        CheckBox     chkIncTuesdays    = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncTuesdays");
        CheckBox     chkIncWednesdays  = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncWednesdays");
        CheckBox     chkIncThursdays   = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncThursdays");
        CheckBox     chkIncFridays     = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncFridays");
        CheckBox     chkIncSaturdays   = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncSaturdays");
        CheckBox     chkIncSundays     = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIncSundays");


        Staff staff = StaffDB.GetByID(GetFormID());

        if (staff == null)
        {
            HideTableAndSetErrorMessage("");
            return;
        }

        RegisterStaffDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlOrganisation.SelectedValue), staff.StaffID, txtProviderNumber.Text, chkMainProvider.Checked,
                               !chkIncSundays.Checked, !chkIncMondays.Checked, !chkIncTuesdays.Checked, !chkIncWednesdays.Checked, !chkIncThursdays.Checked, !chkIncFridays.Checked, !chkIncSaturdays.Checked);
        if (chkMainProvider.Checked)
        {
            RegisterStaffDB.UpdateAllOtherStaffAsNotMainProviders(Convert.ToInt32(ddlOrganisation.SelectedValue), staff.StaffID);
        }

        GrdRegistration.EditIndex = -1;
        FillGrid();
    }
Ejemplo n.º 3
0
    protected void SetProviderNbrs()
    {
        string provs = StaffDB.GetAllProviderNbrs() + RegisterStaffDB.GetAllProviderNbrs();

        if (provs.Length > 0)
        {
            provs = provs.Substring(0, provs.Length - 1);
        }
        lblProvNbrs.Text = provs;
    }
Ejemplo n.º 4
0
    public static void UpdateActive(int register_staff_id, bool checkFKConstraint = true)
    {
        if (checkFKConstraint)
        {
            RegisterStaff registerStaff = RegisterStaffDB.GetByID(register_staff_id);
            if (IsStaffWorkingInOrg(registerStaff.Staff.StaffID, registerStaff.Organisation.OrganisationID, false))
            {
                throw new CustomMessageException("Can not undelete registration of '" + registerStaff.Staff.Person.FullnameWithoutMiddlename + "' to '" + registerStaff.Organisation.Name + "' because a new active regsitration exists already.");
            }
        }

        string sql = "UPDATE RegisterStaff SET is_deleted = 0 WHERE register_staff_id = " + register_staff_id.ToString();

        DBBase.ExecuteNonResult(sql);
    }
Ejemplo n.º 5
0
    public static void UpdateInactive(int register_staff_id, bool checkFKConstraint = true)
    {
        if (checkFKConstraint)
        {
            RegisterStaff registerStaff = RegisterStaffDB.GetByID(register_staff_id);
            if (BookingDB.GetCountByProviderAndOrg(registerStaff.Staff.StaffID, registerStaff.Organisation.OrganisationID, "0") > 0)
            {
                throw new CustomMessageException("Can not remove registration of '" + registerStaff.Staff.Person.FullnameWithoutMiddlename + "' to '" + registerStaff.Organisation.Name + "' because there exists incomplete bookings for this provider there.");
            }
        }

        string sql = "UPDATE RegisterStaff SET is_deleted = 1 WHERE register_staff_id = " + register_staff_id.ToString();

        DBBase.ExecuteNonResult(sql);
    }
Ejemplo n.º 6
0
    protected string GetStaffProviderNumber(Hashtable bulkRegisterStaffHash, Hashtable bulkStaffHash, Hashtable bulkSites, Invoice invoice)
    {
        bool isClinicSite = ((Site)bulkSites[invoice.Site.SiteID]).SiteType.ID == 1;

        if (!isClinicSite)       // aged care use prov number from staff table
        {
            // return invoice.Booking.Provider.ProviderNumber; // doesnt have all provider info loaded from the db

            return((bulkStaffHash != null) ?
                   ((Staff)bulkStaffHash[invoice.Booking.Provider.StaffID]).ProviderNumber :
                   StaffDB.GetByID(invoice.Booking.Provider.StaffID).ProviderNumber);
        }
        else  // clinic use prov number specific to that clinic
        {
            if (bulkRegisterStaffHash != null)  // use cached bulk preload to avoid excess db calls
            {
                if (bulkRegisterStaffHash[new Hashtable2D.Key(invoice.Booking.Provider.StaffID, invoice.Booking.Organisation.OrganisationID)] == null)
                {
                    // normally doesn't pull back this info, so retrieve it for error info
                    //invoice.Booking.Provider = StaffDB.GetByID(invoice.Booking.Provider.StaffID);
                    //invoice.Booking.Organisation = OrganisationDB.GetByID(invoice.Booking.Organisation.OrganisationID);
                    //string msg = @"For invoice " + invoice.InvoiceID + @" - can not get provider number for <br />&nbsp;&nbsp;" + invoice.Booking.Provider.Person.FullnameWithoutMiddlename + @" (StaffID: " + invoice.Booking.Provider.StaffID + @")<br />at<br />&nbsp;&nbsp;" + invoice.Booking.Organisation.Name + @" (OrgID: " + invoice.Booking.Organisation.OrganisationID + @")<br />becuase they are not registered to this clinic, and the provider number for clinic invoices is stored there.";
                    //throw new CustomMessageException(msg);


                    // Marcus wants it generated with empty provider number, and when rejected, they will fix it
                    return(string.Empty);
                }
                RegisterStaff regStaff = (RegisterStaff)bulkRegisterStaffHash[new Hashtable2D.Key(invoice.Booking.Provider.StaffID, invoice.Booking.Organisation.OrganisationID)];
                return(regStaff.ProviderNumber);
            }
            else
            {
                RegisterStaff regStaff = RegisterStaffDB.GetByStaffIDAndOrganisationID(invoice.Booking.Provider.StaffID, invoice.Booking.Organisation.OrganisationID);
                if (regStaff == null)
                {
                    //string msg = @"For invoice " + invoice.InvoiceID + @" - can not get provider number for <br />&nbsp;&nbsp;" + invoice.Booking.Provider.Person.FullnameWithoutMiddlename + @" (StaffID: " + invoice.Booking.Provider.StaffID + @")<br />at<br />&nbsp;&nbsp;" + invoice.Booking.Organisation.Name + @" (OrgID: " + invoice.Booking.Organisation.OrganisationID + @")<br />becuase they are not registered to this clinic, and the provider number for clinic invoices is stored there.";
                    //throw new CustomMessageException(msg);


                    // Marcus wants it generated with empty provider number, and when rejected, they will fix it
                    return(string.Empty);
                }
                return(regStaff.ProviderNumber);
            }
        }
    }
Ejemplo n.º 7
0
    public static RegisterStaff[] GetAll()
    {
        DataTable tbl = GetDataTable_All();

        RegisterStaff[] list = new RegisterStaff[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = RegisterStaffDB.Load(tbl.Rows[i]);

            list[i].Staff              = StaffDB.Load(tbl.Rows[i], "staff_");
            list[i].Staff.Person       = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            list[i].Staff.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");

            list[i].Organisation = OrganisationDB.Load(tbl.Rows[i], "organisation_");
        }

        return(list);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

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

            string provider_nrb = Request.QueryString["provider_nrb"];
            if (provider_nrb == null || provider_nrb.Trim().Length == 0)
            {
                throw new CustomMessageException();
            }

            provider_nrb = provider_nrb.Trim();

            string allNbrs1 = RegisterStaffDB.GetAllProviderNbrs();
            string allNbrs2 = StaffDB.GetAllProviderNbrs();
            Response.Write((allNbrs1.Contains(provider_nrb) || allNbrs2.Contains(provider_nrb)) ? "1" : "0");
        }
        catch (SessionTimedOutException)
        {
            Utilities.UnsetSessionVariables();
            Response.Write("SessionTimedOutException");
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator."));
        }
    }
    protected void SetInvoiceInfo(Invoice invoice)
    {
        bool isDebug          = Request["debug"] != null && Request["debug"] == "1";
        bool useOnlyTestItems = false;

        SaveType saveType = Request.QueryString["reftag"] != null ? SaveType.Cancellation : SaveType.Claim;

        string receiptString = string.Empty;

        foreach (Receipt receipt in ReceiptDB.GetByInvoice(invoice.InvoiceID, false))
        {
            receiptString += (receiptString.Length == 0 ? "" : ", ") + "$" + receipt.Total.ToString();
        }

        string invoiceViewURL = "/Invoice_ViewV2.aspx?invoice_id=" + invoice.InvoiceID;

        lblInvoiceID.Text      = "<a href=\"" + invoiceViewURL + "\" onclick=\"open_new_tab('" + invoiceViewURL + "');return false;\">" + invoice.InvoiceID + "</a>";
        lblInvoiceTotal.Text   = "$" + invoice.Total.ToString();
        lblInvoiceOwing.Text   = "$" + invoice.TotalDue.ToString();
        lblReceiptedTotal.Text = "$" + invoice.ReceiptsTotal.ToString() + (invoice.CreditNotesTotal == 0 ? "" : " &nbsp;&nbsp;($" + invoice.CreditNotesTotal.ToString() + " Credit Noted)") + (invoice.RefundsTotal == 0 ? "" : " &nbsp;&nbsp;($" + invoice.RefundsTotal.ToString() + " Refunds)");
        lblDebtor.Text         = invoice.GetDebtor(true);
        lblBkDate.Text         = invoice.Booking.DateStart.ToString("d MMM, yyyy");
        lblBkOrgText.Text      = invoice.Booking.Organisation.IsAgedCare? "Facility" : "Clinic";
        lblBkOrg.Text          = invoice.Booking.Organisation.Name;

        System.Data.DataTable tbl = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "field_id=" + invoice.Booking.Provider.Field.ID, "", "field_id", "descr");
        invoice.Booking.Provider.Field = IDandDescrDB.Load(tbl.Rows[0], "field_id", "descr");

        RegisterStaff regStaff = RegisterStaffDB.GetByStaffIDAndOrganisationID(invoice.Booking.Provider.StaffID, invoice.Booking.Organisation.OrganisationID);

        if (regStaff == null)
        {
            throw new CustomMessageException("Staff Member Not Set To This Clinic/Fac.");
        }

        InvoiceLine[] invLines = InvoiceLineDB.GetByInvoiceID(invoice.InvoiceID);
        Hashtable     patientHealthCardCache = PatientsHealthCardsCacheDB.GetBullkActive(invLines.Select(x => x.Patient.PatientID).ToArray());

        List <TyroHealthPointClaimIten> claimItems = new List <TyroHealthPointClaimIten>();

        for (int i = 0; i < invLines.Length; i++)
        {
            HealthCard hc = GetHealthCardFromCache(patientHealthCardCache, invLines[i].Patient.PatientID);

            string ptURL  = "PatientDetailV2.aspx?type=view&id=" + invLines[i].Patient.PatientID;
            string ptLink = "<a href=\"" + ptURL + "\" onclick=\"open_new_tab('" + ptURL + "');return false;\">" + invLines[i].Patient.Person.FullnameWithoutMiddlename + "</a>";

            if (hc == null)
            {
                throw new CustomMessageException("No healthcard found for " + ptLink + " (PT-ID:" + invLines[i].Patient.PatientID + ")");
            }
            if (hc.Organisation.OrganisationType.OrganisationTypeID != 150)
            {
                throw new CustomMessageException("Healthcard found for " + ptLink + " (PT-ID:" + invLines[i].Patient.PatientID + ") Is Not An Insurance Card");
            }

            /*
             * claim-amount:      claim amount in cents                    - max 10 digits
             * service-code:      item number service code                 - max 5  characters
             * description:       description of item to appear on receipt - max 32 characters
             * service-reference: body part or tooth number suffix         - max 3  characters
             * patient-id:        patient ID on card                       - exactly 2 digits
             * service-date:      claim date in YYYYMMDD format
             */

            isDebug = true;

            claimItems.Add(new TyroHealthPointClaimIten(
                               ((int)(invLines[i].Price * 100)).ToString(),
                               isDebug ? "F1234" : invLines[i].Offering.TacCompanyCode,
                               isDebug ? "Face"  : invLines[i].AreaTreated,
                               invLines[i].ServiceReference,
                               "",      // family number on card -- legally they have to enter it themselves
                               isDebug ? DateTime.Today.ToString("yyyyMMdd") : invoice.Booking.DateStart.ToString("yyyyMMdd")));
        }


        //useOnlyTestItems = true;

        // save variables & JSON array on the page accessable to JS to send to Tyro
        if (useOnlyTestItems)
        {
            claimItems = new List <TyroHealthPointClaimIten>();

            claimItems.Add(new TyroHealthPointClaimIten(
                               "10000",
                               "00001",
                               "SKULL XRAY",
                               "01",
                               "02",
                               DateTime.Today.ToString("yyyyMMdd")));

            claimItems.Add(new TyroHealthPointClaimIten(
                               "15000",
                               "00001",
                               "SKULL XRAY",
                               "01",
                               "02",
                               DateTime.Today.ToString("yyyyMMdd")));

            Page.ClientScript.RegisterStartupScript(this.GetType(), "invoice_items",
                                                    @"<script language=javascript>
                var _providerId       = '4237955J';
                var _serviceType      = 'D';
                var _claimItemsCount  = '2';
                var _totalClaimAmount = '25000';
                var _allClaimItems    = " + new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(claimItems) + @"; 
             </script>");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "invoice_items",
                                                    @"<script language=javascript>
                    var _providerId       = '" + (isDebug ? "4237955J" : (regStaff.ProviderNumber.Length > 0 ? regStaff.ProviderNumber : invoice.Booking.Provider.ProviderNumber)) + @"';
                    var _serviceType      = '" + GetServiceTypeHashtable()[invoice.Booking.Provider.Field.Descr.ToLower()].ToString() + @"';
                    var _claimItemsCount  = '" + invLines.Length.ToString() + @"';
                    var _totalClaimAmount = '" + ((int)(invLines.Sum(item => item.Price) * 100)).ToString() + @"';
                    var _allClaimItems    = " + new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(claimItems) /* convert to JSON array */ + @"; 
                    " + (saveType == SaveType.Cancellation ? "var _refTag = " + Request.QueryString["reftag"] : string.Empty) + @"
                 </script>");
        }
    }
Ejemplo n.º 10
0
    private void FillEditViewForm(Staff staff, bool isEditMode)
    {
        Page.Title = ((SystemVariables)Session["SystemVariables"])["Site"].Value + " - " + staff.Person.FullnameWithoutMiddlename;

        staff.Person = PersonDB.GetByID(staff.Person.PersonID);
        Person addedBy = staff.Person.PersonID < 0 ? null : PersonDB.GetByID(staff.Person.AddedBy);

        if (!Utilities.IsDev())
        {
            idRow.Attributes["class"] = "hiddencol";
        }



        this.lnkThisStaff.Visible     = true;
        this.lnkThisStaff.NavigateUrl = "~/RegisterOrganisationsToStaffV2.aspx?id=" + Request.QueryString["id"].ToString();
        this.lnkThisStaff.Text        = "Edit";


        lblId.Text             = staff.StaffID.ToString();
        lblAddedBy.Text        = addedBy == null ? "" : addedBy.Firstname + " " + addedBy.Surname;
        lblStaffDateAdded.Text = staff.StaffDateAdded.ToString("dd-MM-yyyy");

        txtComments.Text = staff.Comment;


        if (isEditMode)
        {
            DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", staff.Person.Title.ID == 0 ? "" : " title_id <> 0 ", " descr ", "title_id", "descr");
            ddlTitle.DataSource = titles;
            ddlTitle.DataBind();

            if (staff.StartDate != DateTime.MinValue)
            {
                ddlStartDate_Day.SelectedValue   = staff.StartDate.Day.ToString();
                ddlStartDate_Month.SelectedValue = staff.StartDate.Month.ToString();
                ddlStartDate_Year.SelectedValue  = staff.StartDate.Year.ToString();
            }
            if (staff.EndDate != DateTime.MinValue)
            {
                ddlEndDate_Day.SelectedValue   = staff.EndDate.Day.ToString();
                ddlEndDate_Month.SelectedValue = staff.EndDate.Month.ToString();
                ddlEndDate_Year.SelectedValue  = staff.EndDate.Year.ToString();
            }
            ddlTitle.SelectedValue = staff.Person.Title.ID.ToString();
            txtFirstname.Text      = staff.Person.Firstname;
            txtMiddlename.Text     = staff.Person.Middlename;
            txtSurname.Text        = staff.Person.Surname;
            if (ddlGender.Items.FindByValue(staff.Person.Gender) == null)
            {
                ddlGender.Items.Add(new ListItem(staff.Person.Gender == "" ? "" : staff.Person.Gender, staff.Person.Gender));
            }
            ddlGender.SelectedValue = staff.Person.Gender;

            txtLogin.Text = staff.Login;
            txtPwd.Text   = staff.Pwd;
            txtPwd.Attributes["value"] = staff.Pwd;
            ddlStatus.SelectedValue    = staff.IsFired ? "Inactive" : "Active";

            lblTitle.Visible      = false;
            lblFirstname.Visible  = false;
            lblMiddlename.Visible = false;
            lblSurname.Visible    = false;
            lblGender.Visible     = false;
            lblLogin.Visible      = false;
            lblPwd.Visible        = false;
            lblIsFired.Visible    = false;
        }
        else
        {
            lblTitle.Text      = staff.Person.Title.ID == 0 ? "" : staff.Person.Title.Descr;
            lblFirstname.Text  = staff.Person.Firstname.Length == 0 ? "" : staff.Person.Firstname;
            lblMiddlename.Text = staff.Person.Middlename.Length == 0 ? "" : staff.Person.Middlename;
            lblSurname.Text    = staff.Person.Surname.Length == 0 ? "" : staff.Person.Surname;
            lblGender.Text     = GetGenderText(staff.Person.Gender);
            lblLogin.Text      = staff.Login.Length == 0 ? "" : staff.Login;
            lblIsFired.Text    = staff.IsFired                       ? "<b><font color=\"red\">Inactive</font></b>" : "Active";

            lblStartDate.Text = staff.StartDate == DateTime.MinValue ? "" : staff.StartDate.ToString("dd-MM-yyyy");
            lblEndDate.Text   = staff.EndDate == DateTime.MinValue ? "" : staff.EndDate.ToString("dd-MM-yyyy");

            lblAddedBy.Font.Bold        = true;
            lblStaffDateAdded.Font.Bold = true;

            txtComments.Enabled   = false;
            txtComments.ForeColor = System.Drawing.Color.Black;



            ddlTitle.Visible      = false;
            txtFirstname.Visible  = false;
            txtMiddlename.Visible = false;
            txtSurname.Visible    = false;
            ddlGender.Visible     = false;

            ddlStartDate_Day.Visible   = false;
            ddlStartDate_Month.Visible = false;
            ddlStartDate_Year.Visible  = false;
            ddlEndDate_Day.Visible     = false;
            ddlEndDate_Month.Visible   = false;
            ddlEndDate_Year.Visible    = false;

            txtLogin.Visible  = false;
            txtPwd.Visible    = false;
            ddlStatus.Visible = false;
        }


        DataTable incList = RegisterStaffDB.GetDataTable_OrganisationsOf(staff.StaffID);

        incList.DefaultView.Sort = "name ASC";
        if (incList.Rows.Count == 0)
        {
            lstClinics.Items.Add(new ListItem("No Clinics Allocated Yet"));
        }
        else
        {
            foreach (DataRowView row in incList.DefaultView)
            {
                lstClinics.Items.Add(new ListItem(row["name"].ToString()));
            }
        }

        UpdateSiteRestrictions();
        SetBookingsList(staff);

        btnSubmit.Text    = isEditMode ? "Update Details" : "Edit Details";
        btnCancel.Visible = isEditMode;
    }
Ejemplo n.º 11
0
    protected void FillGrid()
    {
        if (!IsValidFormID())
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }

        Organisation org = OrganisationDB.GetByID(GetFormID());

        if (org == null)
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }

        lblHeading.Text             = Page.Title = "Manage Staff For :  " + org.Name;
        this.lnkThisOrg.NavigateUrl = "~/OrganisationDetailV2.aspx?type=view&id=" + GetFormID().ToString();
        this.lnkThisOrg.Text        = "Back to details for " + org.Name;


        DataTable dt = RegisterStaffDB.GetDataTable_StaffOf(org.OrganisationID, chkShowDeleted.Checked);

        Session["registerstafftoorg_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["registerstafftoorg_sortexpression"] != null && Session["registerstafftoorg_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["registerstafftoorg_sortexpression"].ToString();
                GrdRegistration.DataSource = dataView;
            }
            else
            {
                GrdRegistration.DataSource = dt;
            }


            try
            {
                GrdRegistration.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdRegistration.DataSource = dt;
            GrdRegistration.DataBind();

            int TotalColumns = GrdRegistration.Rows[0].Cells.Count;
            GrdRegistration.Rows[0].Cells.Clear();
            GrdRegistration.Rows[0].Cells.Add(new TableCell());
            GrdRegistration.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdRegistration.Rows[0].Cells[0].Text       = "No Record Found";
        }

        if (hideFotter)
        {
            GrdRegistration.FooterRow.Visible = false;
        }
    }
Ejemplo n.º 12
0
    protected void FillGrid()
    {
        if (!IsValidFormID())
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }

        Staff staff = StaffDB.GetByID(GetFormID());

        if (staff == null)
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }
        staff.Person = PersonDB.GetByID(staff.Person.PersonID);

        lblHeading.Text = Page.Title = "Manage Clinics/Facilities For :  " + staff.Person.Firstname + " " + staff.Person.Surname;
        this.lnkThisStaff.NavigateUrl = staff.IsExternal ?  "~/StaffDetailExternalV2.aspx?type=view&id=" + GetFormID().ToString() :  "~/StaffDetailV2.aspx?type=view&id=" + GetFormID().ToString();
        this.lnkThisStaff.Text        = "Back to details for " + staff.Person.Firstname + " " + staff.Person.Surname;


        if (staff.IsExternal)
        {
            GrdRegistration.Columns[3].Visible  = false;
            GrdRegistration.Columns[4].Visible  = false;
            GrdRegistration.Columns[5].Visible  = false;
            GrdRegistration.Columns[6].Visible  = false;
            GrdRegistration.Columns[7].Visible  = false;
            GrdRegistration.Columns[8].Visible  = false;
            GrdRegistration.Columns[9].Visible  = false;
            GrdRegistration.Columns[10].Visible = false;
            GrdRegistration.Columns[11].Visible = false;
        }


        DataTable dt = RegisterStaffDB.GetDataTable_OrganisationsOf(staff.StaffID, null, chkShowDeleted.Checked);

        Session["registerorgtostaff_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["registerorgtostaff_sortexpression"] != null && Session["registerorgtostaff_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["registerorgtostaff_sortexpression"].ToString();
                GrdRegistration.DataSource = dataView;
            }
            else
            {
                GrdRegistration.DataSource = dt;
            }


            try
            {
                GrdRegistration.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdRegistration.DataSource = dt;
            GrdRegistration.DataBind();

            int TotalColumns = GrdRegistration.Rows[0].Cells.Count;
            GrdRegistration.Rows[0].Cells.Clear();
            GrdRegistration.Rows[0].Cells.Add(new TableCell());
            GrdRegistration.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdRegistration.Rows[0].Cells[0].Text       = "No Record Found";
        }

        if (hideFotter)
        {
            GrdRegistration.FooterRow.Visible = false;
        }
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            main_content.Style["background"] = (Session["SystemVariables"] == null) ? "url(../imagesV2/login_bg.png) center top no-repeat #EDEDED" : "url(../imagesV2/" + ((SystemVariables)Session["SystemVariables"])["MainLogoBackground"].Value + ") center top no-repeat #EDEDED";
        }

        bool showPageHeader = Request.QueryString["show_header"] == null || Request.QueryString["show_header"] == "1";

        if (!showPageHeader)
        {
            Utilities.UpdatePageHeader(Page.Master, true, true);
        }

        int type_group_id = -1;

        if (Session["SiteTypeID"] != null && (Convert.ToInt32(Session["SiteTypeID"]) == 1 || Convert.ToInt32(Session["SiteTypeID"]) == 3))
        {
            lblHeading.InnerHtml = "Select A Clinic";
            type_group_id        = 5;
        }
        else if (Session["SiteTypeID"] != null && Convert.ToInt32(Session["SiteTypeID"]) == 2)
        {
            lblHeading.InnerHtml = "Select A Facility/Wing";
            type_group_id        = 6;
        }
        else
        {
            throw new Exception("Unknown SiteTypeID in session");
        }


        if (Session["PatientID"] != null)
        {
            DataTable dt = RegisterPatientDB.GetDataTable_OrganisationsOf(Convert.ToInt32(Session["PatientID"]), true, false, true, true, true);

            if (dt.Rows.Count == 1)  // if only org, auto select it
            {
                Session["IsMultipleOrgs"] = false;
                Select(Convert.ToInt32(dt.Rows[0]["organisation_id"]));
            }
            else
            {
                Session["IsMultipleOrgs"] = true;
                lstOrgs.DataSource        = dt;
                lstOrgs.DataBind();
            }
        }
        else // if (Session["StaffID"] != null)
        {
            DataTable dt = RegisterStaffDB.GetDataTable_OrganisationsOf(Convert.ToInt32(Session["StaffID"]), type_group_id.ToString());

            if (dt.Rows.Count == 1)  // if only org, auto select it
            {
                Session["IsMultipleOrgs"] = false;
                Select(Convert.ToInt32(dt.Rows[0]["organisation_id"]));
            }
            else
            {
                Session["IsMultipleOrgs"] = true;
                lstOrgs.DataSource        = dt;
                lstOrgs.DataBind();
            }
        }
    }
Ejemplo n.º 14
0
    protected void GrdRegistration_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Insert"))
        {
            DropDownList ddlOrganisation   = (DropDownList)GrdRegistration.FooterRow.FindControl("ddlNewOrganisation");
            TextBox      txtProviderNumber = (TextBox)GrdRegistration.FooterRow.FindControl("txtNewProviderNumber");
            CheckBox     chkMainProvider   = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewMainProvider");
            CheckBox     chkIncMondays     = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncMondays");
            CheckBox     chkIncTuesdays    = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncTuesdays");
            CheckBox     chkIncWednesdays  = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncWednesdays");
            CheckBox     chkIncThursdays   = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncThursdays");
            CheckBox     chkIncFridays     = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncFridays");
            CheckBox     chkIncSaturdays   = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncSaturdays");
            CheckBox     chkIncSundays     = (CheckBox)GrdRegistration.FooterRow.FindControl("chkNewIncSundays");


            Staff staff = StaffDB.GetByID(GetFormID());
            if (staff == null)
            {
                HideTableAndSetErrorMessage("");
                return;
            }

            try
            {
                RegisterStaffDB.Insert(Convert.ToInt32(ddlOrganisation.SelectedValue), staff.StaffID, txtProviderNumber.Text, chkMainProvider.Checked,
                                       !chkIncSundays.Checked, !chkIncMondays.Checked, !chkIncTuesdays.Checked, !chkIncWednesdays.Checked, !chkIncThursdays.Checked, !chkIncFridays.Checked, !chkIncSaturdays.Checked);
                if (chkMainProvider.Checked)
                {
                    RegisterStaffDB.UpdateAllOtherStaffAsNotMainProviders(Convert.ToInt32(ddlOrganisation.SelectedValue), staff.StaffID);
                }
            }
            catch (UniqueConstraintException)
            {
                // happens when 2 forms allow adding - do nothing and let form re-update
            }
            FillGrid();
        }

        if (e.CommandName.Equals("_Delete") || e.CommandName.Equals("_UnDelete"))
        {
            int register_staff_id = Convert.ToInt32(e.CommandArgument);

            try
            {
                if (e.CommandName.Equals("_Delete"))
                {
                    RegisterStaffDB.UpdateInactive(register_staff_id);
                }
                else
                {
                    RegisterStaffDB.UpdateActive(register_staff_id);
                }
            }
            catch (CustomMessageException cmEx)
            {
                SetErrorMessage(cmEx.Message);
            }
            catch (ForeignKeyConstraintException fkcEx)
            {
                if (Utilities.IsDev())
                {
                    SetErrorMessage("Can not delete because other records depend on this : " + fkcEx.Message);
                }
                else
                {
                    SetErrorMessage("Can not delete because other records depend on this");
                }
            }

            FillGrid();
        }
    }
Ejemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                Utilities.SetNoCache(Response);
            }
            HideErrorMessage();

            if (!IsPostBack)
            {
                PagePermissions.EnforcePermissions_RequireAny(Session, Response, true, true, true, true, true, false);
                Session.Remove("invoicelistac_sortexpression");
                Session.Remove("invoicelistac_data");

                if (!IsValidFormBooking())
                {
                    throw new CustomMessageException("No booking in url");
                }

                Booking booking = BookingDB.GetByID(GetFormBooking());


                string orgAddressText;
                if (Utilities.GetAddressType().ToString() == "Contact")
                {
                    Contact orgAddress = ContactDB.GetFirstByEntityID(1, booking.Organisation != null ? booking.Organisation.EntityID : -1);
                    orgAddressText = orgAddress == null    ? "No address found" : orgAddress.GetFormattedAddress("No address found");
                }
                else if (Utilities.GetAddressType().ToString() == "ContactAus")
                {
                    ContactAus orgAddressAus = ContactAusDB.GetFirstByEntityID(1, booking.Organisation != null ? booking.Organisation.EntityID : -1);
                    orgAddressText = orgAddressAus == null ? "No address found" : orgAddressAus.GetFormattedAddress("No address found");
                }
                else
                {
                    throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }


                lblTreatmentDate.Text = booking.DateStart.ToString("d MMM, yyyy") + "&nbsp;&nbsp;" + booking.DateStart.ToString("H:mm") + (booking.DateStart.Hour < 12 ? "am" : "pm");
                lblOrgType.Text       = booking.Organisation.OrganisationType.Descr;
                lblOrgName.Text       = booking.Organisation.Name;
                lblOrgAddress.Text    = orgAddressText.Replace(Environment.NewLine, "<br />");
                lblProviderName.Text  = booking.Provider.Person.FullnameWithoutMiddlename;
                lblProviderNbr.Text   = booking.Provider.ProviderNumber;

                string link = @"http://localhost:2524/Invoice_ViewV2.aspx?booking_id=264225";
                lblInvLink.Text = "<a href=\"" + link + "\" onclick=\"open_new_tab('" + link + "');return false;\">View All Invoices</a>";


                if (!booking.Organisation.IsAgedCare)
                {
                    tr_address.Visible             = false;
                    btnEmailToFac.Visible          = false;
                    br_before_email_to_fac.Visible = false;

                    RegisterStaff regStaff = RegisterStaffDB.GetByStaffIDAndOrganisationID(booking.Provider.StaffID, booking.Organisation.OrganisationID, true);
                    if (regStaff != null)
                    {
                        lblProviderNbr.Text = regStaff.ProviderNumber;
                    }
                }


                FillGrid();
            }

            this.GrdBooking.EnableViewState = true;
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
Ejemplo n.º 16
0
    protected void GrdRegistration_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        Staff staff = StaffDB.GetByID(GetFormID());

        if (staff == null)
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }

        DataTable dt       = Session["registerorgtostaff_data"] as DataTable;
        bool      tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value);

        if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow)
        {
            Label     lblId     = (Label)e.Row.FindControl("lblId");
            DataRow[] foundRows = dt.Select("register_staff_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];


            DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlOrganisation");
            if (ddlOrganisation != null)
            {
                Organisation[] incList_orig = RegisterStaffDB.GetOrganisationsOf(staff.StaffID);
                Organisation[] incList      = Organisation.RemoveByID(incList_orig, Convert.ToInt32(thisRow["organisation_id"]));
                DataTable      orgs         = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true);
                orgs.DefaultView.Sort = "name ASC";

                foreach (DataRowView row in orgs.DefaultView)
                {
                    ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString()));
                }
                ddlOrganisation.SelectedValue = thisRow["organisation_id"].ToString();
            }

            ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete");
            if (btnDelete != null)
            {
                bool is_deleted = Convert.ToBoolean(thisRow["registration_is_deleted"]);
                if (is_deleted)
                {
                    btnDelete.CommandName   = "_UnDelete";
                    btnDelete.ImageUrl      = "~/images/tick-24.png";
                    btnDelete.AlternateText = "UnDelete";
                    btnDelete.ToolTip       = "UnDelete";

                    btnDelete.Visible = false;
                }
            }

            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlNewOrganisation");
            if (ddlOrganisation != null)
            {
                Organisation[] incList = RegisterStaffDB.GetOrganisationsOf(staff.StaffID);
                DataTable      orgs    = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true);
                orgs.DefaultView.Sort = "name ASC";

                foreach (DataRowView row in orgs.DefaultView)
                {
                    ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString()));
                }

                if (orgs.Rows.Count == 0)
                {
                    hideFotter = true;
                }
            }

            if (staff.IsExternal)
            {
                CheckBox chkNewIncMondays    = (CheckBox)e.Row.FindControl("chkNewIncMondays");
                CheckBox chkNewIncTuesdays   = (CheckBox)e.Row.FindControl("chkNewIncTuesdays");
                CheckBox chkNewIncWednesdays = (CheckBox)e.Row.FindControl("chkNewIncWednesdays");
                CheckBox chkNewIncThursdays  = (CheckBox)e.Row.FindControl("chkNewIncThursdays");
                CheckBox chkNewIncFridays    = (CheckBox)e.Row.FindControl("chkNewIncFridays");
                CheckBox chkNewIncSaturdays  = (CheckBox)e.Row.FindControl("chkNewIncSaturdays");
                CheckBox chkNewIncSundays    = (CheckBox)e.Row.FindControl("chkNewIncSundays");

                if (chkNewIncMondays != null)
                {
                    chkNewIncMondays.Checked = false;
                }
                if (chkNewIncTuesdays != null)
                {
                    chkNewIncTuesdays.Checked = false;
                }
                if (chkNewIncWednesdays != null)
                {
                    chkNewIncWednesdays.Checked = false;
                }
                if (chkNewIncThursdays != null)
                {
                    chkNewIncThursdays.Checked = false;
                }
                if (chkNewIncFridays != null)
                {
                    chkNewIncFridays.Checked = false;
                }
                if (chkNewIncSaturdays != null)
                {
                    chkNewIncSaturdays.Checked = false;
                }
                if (chkNewIncSundays != null)
                {
                    chkNewIncSundays.Checked = false;
                }
            }
        }
    }
Ejemplo n.º 17
0
    private void FillEditViewForm(Staff staff, bool isEditMode)
    {
        Page.Title = ((SystemVariables)Session["SystemVariables"])["Site"].Value + " - " + staff.Person.FullnameWithoutMiddlename;

        staff.Person = PersonDB.GetByID(staff.Person.PersonID);
        Person addedBy = staff.Person.PersonID < 0 ? null : PersonDB.GetByID(staff.Person.AddedBy);

        if (!Utilities.IsDev())
        {
            idRow.Attributes["class"] = "hiddencol";
        }

        this.lnkBookingList.Visible     = true;
        this.lnkBookingList.NavigateUrl = "~/BookingsListV2.aspx?staff=" + Request.QueryString["id"].ToString();
        this.lnkBookingList.Text        = "Bookings List";

        string allFeatures = "dialogWidth:1250px;dialogHeight:835px;center:yes;resizable:no; scroll:no";
        string js          = "javascript:window.showModalDialog('" + "BookingSheetBlockoutV2.aspx?staff=" + staff.StaffID.ToString() + "', '', '" + allFeatures + "');return false;";

        this.lnkUnavailabilities.Attributes.Add("onclick", js);
        lnkUnavailabilities.NavigateUrl = "javascript:void(0)";

        UpdateGenerateSystemLetters();

        this.lnkThisStaff.Visible     = true;
        this.lnkThisStaff.NavigateUrl = "~/RegisterOrganisationsToStaffV2.aspx?id=" + Request.QueryString["id"].ToString();
        this.lnkThisStaff.Text        = "Edit";

        this.lnkStaffOfferings.Visible     = true;
        this.lnkStaffOfferings.NavigateUrl = "~/StaffOfferingsListV2.aspx?staff=" + Request.QueryString["id"].ToString();
        this.lnkStaffOfferings.Text        = "Set Comissions/Fixed Rates";


        lblId.Text             = staff.StaffID.ToString();
        lblAddedBy.Text        = addedBy == null ? "" : addedBy.Firstname + " " + addedBy.Surname;
        lblStaffDateAdded.Text = staff.StaffDateAdded.ToString("dd-MM-yyyy");

        txtComments.Text = staff.Comment;


        if (isEditMode)
        {
            DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", staff.Person.Title.ID == 0 ? "" : " title_id <> 0 ", " descr ", "title_id", "descr");
            ddlTitle.DataSource = titles;
            ddlTitle.DataBind();
            DataTable fields = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "field_id <> 0", "descr", "field_id", "descr");
            ddlField.DataSource = fields;
            ddlField.DataBind();
            //DataTable costcentres = CostCentreDB.GetDataTable();
            //ddlCostCentre.DataSource = costcentres;
            //ddlCostCentre.DataBind();

            if (staff.StartDate != DateTime.MinValue)
            {
                ddlStartDate_Day.SelectedValue   = staff.StartDate.Day.ToString();
                ddlStartDate_Month.SelectedValue = staff.StartDate.Month.ToString();
                ddlStartDate_Year.SelectedValue  = staff.StartDate.Year.ToString();
            }
            if (staff.EndDate != DateTime.MinValue)
            {
                ddlEndDate_Day.SelectedValue   = staff.EndDate.Day.ToString();
                ddlEndDate_Month.SelectedValue = staff.EndDate.Month.ToString();
                ddlEndDate_Year.SelectedValue  = staff.EndDate.Year.ToString();
            }
            ddlTitle.SelectedValue = staff.Person.Title.ID.ToString();
            txtFirstname.Text      = staff.Person.Firstname;
            txtMiddlename.Text     = staff.Person.Middlename;
            txtSurname.Text        = staff.Person.Surname;
            if (ddlGender.Items.FindByValue(staff.Person.Gender) == null)
            {
                ddlGender.Items.Add(new ListItem(staff.Person.Gender == "" ? "" : staff.Person.Gender, staff.Person.Gender));
            }
            ddlGender.SelectedValue = staff.Person.Gender;
            if (staff.Person.Dob != DateTime.MinValue)
            {
                ddlDOB_Day.SelectedValue   = staff.Person.Dob.Day.ToString();
                ddlDOB_Month.SelectedValue = staff.Person.Dob.Month.ToString();
                ddlDOB_Year.SelectedValue  = staff.Person.Dob.Year.ToString();
            }
            txtLogin.Text = staff.Login;
            txtPwd.Text   = staff.Pwd;
            txtPwd.Attributes["value"] = staff.Pwd;

            if (ddlField.Items.FindByValue(staff.Field.ID.ToString()) == null)
            {
                ddlField.Items.Add(new ListItem(staff.Field.Descr, staff.Field.ID.ToString()));
            }

            ddlField.SelectedValue  = staff.Field.ID.ToString();
            chkContractor.Checked   = staff.IsContractor;
            txtTFN.Text             = staff.Tfn;
            ddlStatus.SelectedValue = staff.IsFired ? "Inactive" : "Active";
            chkSMSBKs.Checked       = staff.EnableDailyReminderSMS;
            chkEmailBKs.Checked     = staff.EnableDailyReminderEmail;
            //ddlCostCentre.SelectedValue    = staff.CostCentre.CostCentreID.ToString();
            txtProviderNumber.Text    = staff.ProviderNumber;
            chkIsCommission.Checked   = staff.IsCommission;
            txtCommissionPercent.Text = staff.CommissionPercent.ToString();
            chkIsProvider.Checked     = staff.IsProvider;
            chkIsPrincipal.Checked    = staff.IsPrincipal;
            chkIsAdmin.Checked        = staff.IsAdmin;
            chkIsMasterAdmin.Checked  = staff.IsMasterAdmin;
            chkIsStakeholder.Checked  = staff.IsStakeholder;

            lblTitle.Visible      = false;
            lblFirstname.Visible  = false;
            lblMiddlename.Visible = false;
            lblSurname.Visible    = false;
            lblGender.Visible     = false;
            lblDOB.Visible        = false;
            lblLogin.Visible      = false;
            lblPwd.Visible        = false;
            lblField.Visible      = false;
            lblContractor.Visible = false;
            lblTFN.Visible        = false;
            //lblCostCentre.Visible         = false;
            lblProviderNumber.Visible    = false;
            lblIsCommission.Visible      = false;
            lblCommissionPercent.Visible = false;
            lblIsFired.Visible           = false;
            lblSMSBKs.Visible            = false;
            lblEmailBKs.Visible          = false;
            lblIsProvider.Visible        = false;
            lblIsPrincipal.Visible       = false;
            lblIsAdmin.Visible           = false;
            lblIsMasterAdmin.Visible     = false;
            lblIsStakeholder.Visible     = false;
        }
        else
        {
            lblTitle.Text      = staff.Person.Title.ID == 0 ? "" : staff.Person.Title.Descr;
            lblFirstname.Text  = staff.Person.Firstname.Length == 0 ? "" : staff.Person.Firstname;
            lblMiddlename.Text = staff.Person.Middlename.Length == 0 ? "" : staff.Person.Middlename;
            lblSurname.Text    = staff.Person.Surname.Length == 0 ? "" : staff.Person.Surname;
            lblGender.Text     = GetGenderText(staff.Person.Gender);
            lblDOB.Text        = staff.Person.Dob == DateTime.MinValue ? "" : staff.Person.Dob.ToString("dd-MM-yyyy");
            lblLogin.Text      = staff.Login.Length == 0 ? "" : staff.Login;
            lblField.Text      = staff.Field.Descr;
            lblContractor.Text = staff.IsContractor  ? "Yes" : "No";
            lblTFN.Text        = staff.Tfn.Length == 0 ? "" : staff.Tfn;
            //lblCostCentre.Text        = staff.CostCentre.Descr.Length  == 0 ? "" : staff.CostCentre.Descr;
            lblProviderNumber.Text    = staff.ProviderNumber.Length == 0 ? "" : staff.ProviderNumber;
            lblIsCommission.Text      = staff.IsCommission  ? "Yes" : "No";
            lblCommissionPercent.Text = staff.CommissionPercent.ToString();
            lblIsFired.Text           = staff.IsFired       ? "<b><font color=\"red\">Inactive</font></b>" : "Active";
            lblSMSBKs.Text            = staff.EnableDailyReminderSMS   ? "Yes" : "No";
            lblEmailBKs.Text          = staff.EnableDailyReminderEmail ? "Yes" : "No";

            lblIsProvider.Text    = staff.IsProvider    ? "Yes" : "No";
            lblIsPrincipal.Text   = staff.IsPrincipal   ? "Yes" : "No";
            lblIsAdmin.Text       = staff.IsAdmin       ? "Yes" : "No";
            lblIsMasterAdmin.Text = staff.IsMasterAdmin ? "Yes" : "No";
            lblIsStakeholder.Text = staff.IsStakeholder ? "Yes" : "No";

            lblStartDate.Text = staff.StartDate == DateTime.MinValue ? "" : staff.StartDate.ToString("dd-MM-yyyy");
            lblEndDate.Text   = staff.EndDate == DateTime.MinValue ? "" : staff.EndDate.ToString("dd-MM-yyyy");

            lblAddedBy.Font.Bold        = true;
            lblStaffDateAdded.Font.Bold = true;

            txtComments.Enabled   = false;
            txtComments.ForeColor = System.Drawing.Color.Black;



            ddlTitle.Visible      = false;
            txtFirstname.Visible  = false;
            txtMiddlename.Visible = false;
            txtSurname.Visible    = false;
            ddlGender.Visible     = false;
            ddlDOB_Day.Visible    = false;
            ddlDOB_Month.Visible  = false;
            ddlDOB_Year.Visible   = false;

            ddlStartDate_Day.Visible   = false;
            ddlStartDate_Month.Visible = false;
            ddlStartDate_Year.Visible  = false;
            ddlEndDate_Day.Visible     = false;
            ddlEndDate_Month.Visible   = false;
            ddlEndDate_Year.Visible    = false;

            txtLogin.Visible      = false;
            txtPwd.Visible        = false;
            ddlField.Visible      = false;
            chkContractor.Visible = false;
            txtTFN.Visible        = false;
            ddlStatus.Visible     = false;
            chkSMSBKs.Visible     = false;
            chkEmailBKs.Visible   = false;
            //ddlCostCentre.Visible        = false;
            txtProviderNumber.Visible    = false;
            chkIsCommission.Visible      = false;
            txtCommissionPercent.Visible = false;
            chkIsProvider.Visible        = false;
            chkIsPrincipal.Visible       = false;
            chkIsAdmin.Visible           = false;
            chkIsMasterAdmin.Visible     = false;
            chkIsStakeholder.Visible     = false;
        }


        DataTable incList = RegisterStaffDB.GetDataTable_OrganisationsOf(staff.StaffID);

        incList.DefaultView.Sort = "name ASC";
        if (incList.Rows.Count == 0)
        {
            lstClinics.Items.Add(new ListItem("No Clinics Allocated Yet"));
        }
        else
        {
            foreach (DataRowView row in incList.DefaultView)
            {
                lstClinics.Items.Add(new ListItem(row["name"].ToString()));
            }
        }

        UpdateSiteRestrictions();


        btnSubmit.Text    = isEditMode ? "Update Details" : "Edit Details";
        btnCancel.Visible = isEditMode;
    }
Ejemplo n.º 18
0
    protected void MergeFile(bool isAgedCare, string originalFile, string outputFile)
    {
        Booking   booking = BookingDB.GetByID(GetFormBooking());
        DataTable dt      = Session["invoicelistac_data"] as DataTable;


        string orgAddressText, orgAddressTabbedText, orgPhoneText, orgFaxText, orgWebText, orgEmailText;

        if (Utilities.GetAddressType().ToString() == "Contact")
        {
            Contact orgAddress = ContactDB.GetFirstByEntityID(1, booking.Organisation != null ? booking.Organisation.EntityID : -1);
            Contact orgPhone   = ContactDB.GetFirstByEntityID(null, booking.Organisation != null ? booking.Organisation.EntityID : -1, "30,33,34");
            Contact orgFax     = ContactDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 29);
            Contact orgWeb     = ContactDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 28);
            Contact orgEmail   = ContactDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 27);

            orgAddressText       = orgAddress == null    ? "No address found"      : orgAddress.GetFormattedAddress("No address found");
            orgAddressTabbedText = orgAddress == null    ? "No address found"      : orgAddress.GetFormattedAddress("No address found", 1);
            orgPhoneText         = orgPhone == null    ? "No phone number found" : orgPhone.GetFormattedPhoneNumber("No phone number found");
            orgFaxText           = orgFax == null    ? "No fax number found"   : orgFax.GetFormattedPhoneNumber("No fax number found");
            orgWebText           = orgWeb == null    ? "No website found"      : orgWeb.AddrLine1;
            orgEmailText         = orgEmail == null    ? "No email found"        : orgEmail.AddrLine1;
        }
        else if (Utilities.GetAddressType().ToString() == "ContactAus")
        {
            ContactAus orgAddressAus = ContactAusDB.GetFirstByEntityID(1, booking.Organisation != null ? booking.Organisation.EntityID : -1);
            ContactAus orgPhoneAus   = ContactAusDB.GetFirstByEntityID(null, booking.Organisation != null ? booking.Organisation.EntityID : -1, "30,33,34");
            ContactAus orgFaxAus     = ContactAusDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 29);
            ContactAus orgWebAus     = ContactAusDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 28);
            ContactAus orgEmailAus   = ContactAusDB.GetFirstByEntityID(-1, booking.Organisation != null ? booking.Organisation.EntityID : -1, 27);

            orgAddressText       = orgAddressAus == null ? "No address found"      : orgAddressAus.GetFormattedAddress("No address found");
            orgAddressTabbedText = orgAddressAus == null ? "No address found"      : orgAddressAus.GetFormattedAddress("No address found", 1);
            orgPhoneText         = orgPhoneAus == null ? "No phone number found" : orgPhoneAus.GetFormattedPhoneNumber("No phone number found");
            orgFaxText           = orgFaxAus == null ? "No fax number found"   : orgFaxAus.GetFormattedPhoneNumber("No fax number found");
            orgWebText           = orgWebAus == null ? "No website found"      : orgWebAus.AddrLine1;
            orgEmailText         = orgEmailAus == null ? "No email found"        : orgEmailAus.AddrLine1;
        }
        else
        {
            throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
        }


        string providerNumber = booking.Provider.ProviderNumber;

        if (!isAgedCare)
        {
            RegisterStaff regStaff = RegisterStaffDB.GetByStaffIDAndOrganisationID(booking.Provider.StaffID, booking.Organisation.OrganisationID, true);
            if (regStaff != null)
            {
                providerNumber = regStaff.ProviderNumber;
            }
        }


        System.Data.DataSet sourceDataSet = new System.Data.DataSet();
        sourceDataSet.Tables.Add("MergeIt");


        sourceDataSet.Tables[0].Columns.Add("curr_date");

        sourceDataSet.Tables[0].Columns.Add("bk_prov_fullname");
        sourceDataSet.Tables[0].Columns.Add("bk_prov_number");
        sourceDataSet.Tables[0].Columns.Add("bk_date");

        sourceDataSet.Tables[0].Columns.Add("bk_org_name");
        sourceDataSet.Tables[0].Columns.Add("bk_org_abn");
        sourceDataSet.Tables[0].Columns.Add("bk_org_acn");
        sourceDataSet.Tables[0].Columns.Add("bk_org_bpay_account");
        sourceDataSet.Tables[0].Columns.Add("bk_org_addr");
        sourceDataSet.Tables[0].Columns.Add("bk_org_addr_tabbedx1");
        sourceDataSet.Tables[0].Columns.Add("bk_org_phone");
        sourceDataSet.Tables[0].Columns.Add("bk_org_office_fax");
        sourceDataSet.Tables[0].Columns.Add("bk_org_web");
        sourceDataSet.Tables[0].Columns.Add("bk_org_email");


        sourceDataSet.Tables[0].Rows.Add(
            DateTime.Now.ToString("d MMMM, yyyy"),

            booking.Provider.Person.FullnameWithoutMiddlename,
            providerNumber,
            booking.DateStart.ToString("d MMMM, yyyy"),

            booking.Organisation.Name,
            booking.Organisation.Abn,
            booking.Organisation.Acn,
            booking.Organisation.BpayAccount,
            orgAddressText,
            orgAddressTabbedText,
            orgPhoneText,
            orgFaxText,
            orgWebText,
            orgEmailText
            );



        string[,] tblInfo = new string[dt.Rows.Count, isAgedCare ? 5 : 4];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (isAgedCare)
            {
                /*
                 *  0 = i (row nbr)
                 *  1 = room (addr1 of patient)
                 *  2 = resident
                 *  3 = resident type
                 *  4 = debtor
                 */

                tblInfo[i, 0] = (i + 1).ToString();
                tblInfo[i, 1] = dt.Rows[i]["Room"].ToString();
                tblInfo[i, 2] = dt.Rows[i]["PatientName"].ToString();
                tblInfo[i, 3] = dt.Rows[i]["ItemDescr"].ToString();
                tblInfo[i, 4] = dt.Rows[i]["Debtor"].ToString();
            }
            else
            {
                /*
                 *  0 = i (row nbr)
                 *  1 = patient
                 *  2 = service
                 *  3 = debtor
                 */

                tblInfo[i, 0] = (i + 1).ToString();
                tblInfo[i, 1] = dt.Rows[i]["PatientName"].ToString();
                tblInfo[i, 2] = dt.Rows[i]["ItemDescr"].ToString();
                tblInfo[i, 3] = dt.Rows[i]["Debtor"].ToString();
            }
        }



        // merge

        string errorString = null;

        WordMailMerger.Merge(

            originalFile,
            outputFile,
            sourceDataSet,

            tblInfo,
            1,
            true,

            true,
            null,
            true,
            null,
            out errorString);

        if (errorString != string.Empty)
        {
            throw new Exception(errorString);
        }
    }
Ejemplo n.º 19
0
    public void CreateXML(Invoice[] invoices, bool validate = true)
    {
        if (validate)
        {
            Invoice[] tooOldList = GetInvoicesTooOldToClaim(invoices);
            if (tooOldList.Length > 0)
            {
                string invalids = string.Empty;
                foreach (Invoice i in tooOldList)
                {
                    invalids += (invalids.Length == 0 ? "" : ",") + i.InvoiceID.ToString();
                }
                throw new Exception("The following invoices are too old to claim: " + "<br />" + invalids);
            }
        }

        // get bulk invoice lines for less db calls in individual invoice create xml method  [invoiceID => list of invoicelines]
        Hashtable bulkInvoiceLineHash = InvoiceLineDB.GetBulkInvoiceLinesByInvoiceID(invoices);

        ArrayList allInvoiceLines = new ArrayList();

        foreach (DictionaryEntry pair in bulkInvoiceLineHash)
        {
            allInvoiceLines.AddRange((InvoiceLine[])pair.Value);
        }

        // get bluk health cards  [patientID=>healthcard]
        //
        // NB:
        // A DVA invoice can only use a DVA card
        // A Medicare invoice can only use a Medicare card
        // The system can only create a DVA invoice is if DVA is set as the active card (vice versa for Medicare)
        // So when a DVA invoice is created the DVA card was active, and then someone switches it to be the Medicare card thatis active.
        // So, it's correct to get only the DVA cards for DVA invoices (and Medicare cards for Medicare invoices), and also would be correct to ignore the active flag and just get the most recent.
        int[]     allPatientIDs      = GetAllPatientIDs((InvoiceLine[])allInvoiceLines.ToArray(typeof(InvoiceLine)));
        Hashtable bulkHealthCardHash = PatientsHealthCardsCacheDB.GetBullkMostRecent(allPatientIDs, claimType == ClaimType.Medicare ? -1 : -2);

        // get bluk staff provider numbers from registerstaff table
        int[]     allProviderStaffIDs   = GetAllProviderStaffIDs(invoices);
        Hashtable bulkRegisterStaffHash = RegisterStaffDB.Get2DHashByStaffIDOrgID(allProviderStaffIDs);
        Hashtable bulkStaffHash         = StaffDB.GetAllInHashtable(false, true, false, false);

        // get bluk healthcard actions to get EPC signed dates
        Hashtable bulkHealthCardActionsHash = HealthCardActionDB.GetReceivedActionsByPatientIDs(allPatientIDs);

        // get bluk epcreferrers
        Hashtable bulkEPCReferrersHash = PatientReferrerDB.GetEPCReferrersOf(allPatientIDs, false);

        // get all sites in one call
        Hashtable bulkSites = SiteDB.GetAllInHashtable();


        Hashtable claimNumberInvoiceGroups = new Hashtable();

        for (int i = 0; i < invoices.Length; i++)
        {
            if (claimNumberInvoiceGroups[(invoices[i]).HealthcareClaimNumber] == null)
            {
                claimNumberInvoiceGroups[(invoices[i]).HealthcareClaimNumber] = new ArrayList();
            }

            ((ArrayList)claimNumberInvoiceGroups[(invoices[i]).HealthcareClaimNumber]).Add(invoices[i]);
        }


        string noPatientFailures    = string.Empty;
        string noHealthcardFailures = string.Empty;

        foreach (string claimNbr in claimNumberInvoiceGroups.Keys)
        {
            Invoice[] invoiceList = (Invoice[])((ArrayList)claimNumberInvoiceGroups[claimNbr]).ToArray(typeof(Invoice));

            try
            {
                CreateXML(invoiceList, bulkInvoiceLineHash, bulkHealthCardHash, bulkRegisterStaffHash, bulkStaffHash, bulkSites, bulkHealthCardActionsHash, bulkEPCReferrersHash);
            }
            catch (HINXNoPatientOnInvoiceLineException ex)
            {
                noPatientFailures += (noPatientFailures.Length == 0 ? "" : "<br />") + ex.Message;
            }
            catch (HINXNoHealthcardException ex)
            {
                noHealthcardFailures += (noHealthcardFailures.Length == 0 ? "" : "<br />") + ex.Message;
            }
        }



        string errors = string.Empty;

        if (noPatientFailures.Length > 0)
        {
            errors += (errors.Length == 0 ? "" : "<br /><br />") + "The following invoices have invoices lines with no patient set (Fix this and re-generate): <br />" + noPatientFailures;
        }
        if (noHealthcardFailures.Length > 0)
        {
            errors += (errors.Length == 0 ? "" : "<br /><br />") + "The following invoices have patients with no " + (claimType == ClaimType.Medicare ? "Medicare" : "DVA") + " card set (Fix this and re-generate): <br />" + noHealthcardFailures;
        }
        if (errors.Length > 0)
        {
            throw new HINXUnsuccessfulItemsException(errors);
        }
    }