コード例 #1
0
    public static Hashtable GetMedicareServiceTypeHash()
    {
        Hashtable medicalServiceTypeHash = new Hashtable();
        DataTable dt_MST = DBBase.GetGenericDataTable(null, "MedicalServiceType", "medical_service_type_id", "descr");

        for (int i = 0; i < dt_MST.Rows.Count; i++)
        {
            medicalServiceTypeHash[dt_MST.Rows[i]["medical_service_type_id"].ToString()] = dt_MST.Rows[i]["descr"].ToString();
        }

        return(medicalServiceTypeHash);
    }
コード例 #2
0
    public void SetupGUI()
    {
        DataTable refundReasons = DBBase.GetGenericDataTable(null, "RefundReason", "refund_reason_id", "descr");

        ddlRefundReason.DataSource = refundReasons;
        ddlRefundReason.DataBind();

        bool editable = GetUrlParamType() == UrlParamType.Add || GetUrlParamType() == UrlParamType.Edit;

        Utilities.SetEditControlBackColour(txtTotal, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(ddlRefundReason, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(txtComment, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
    }
コード例 #3
0
    public static IDandDescr[] GetAll()
    {
        DataTable dt_MST = DBBase.GetGenericDataTable(null, "MedicalServiceType", "medical_service_type_id", "descr");

        IDandDescr[] list = new IDandDescr[dt_MST.Rows.Count];
        Hashtable    medicalServiceTypeHash = new Hashtable();

        for (int i = 0; i < dt_MST.Rows.Count; i++)
        {
            list[i] = new IDandDescr(Convert.ToInt32(dt_MST.Rows[i]["medical_service_type_id"]), Convert.ToString(dt_MST.Rows[i]["descr"]));
        }

        return(list);
    }
コード例 #4
0
    protected void EnsureGPFoldersExist(Patient patient, string scannedDocsDir)
    {
        if (patient.IsGPPatient)
        {
            DataTable dt = DBBase.GetGenericDataTable(null, "MedicalServiceType", "medical_service_type_id", "descr");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int    medicalServiceTypeID = Convert.ToInt32(dt.Rows[i]["medical_service_type_id"]);
                string descr = Convert.ToString(dt.Rows[i]["descr"]);

                string folderName = "__" + medicalServiceTypeID + "__";
                string folderPath = scannedDocsDir + "\\" + folderName;

                if (!Directory.Exists(folderPath))
                {
                    CreateDirectory(folderPath);
                }
            }
        }
    }
コード例 #5
0
    protected void GrdStaff_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable fields      = DBBase.GetGenericDataTable(null, "Field", "field_id", "descr");
        DataTable costcentres = CostCentreDB.GetDataTable();
        DataTable positions   = StaffPositionDB.GetDataTable();
        DataTable dt          = Session["externalstaffinfo_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("staff_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];


            DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlTitle");
            if (ddlTitle != null)
            {
                DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", Convert.ToInt32(thisRow["title_id"]) == 0 ? "" : " title_id <> 0 ", " descr ", "title_id", "descr");
                ddlTitle.DataSource     = titles;
                ddlTitle.DataTextField  = "descr";
                ddlTitle.DataValueField = "title_id";
                ddlTitle.DataBind();
                ddlTitle.SelectedValue = thisRow["title_id"].ToString();
            }
            DropDownList ddlGender = (DropDownList)e.Row.FindControl("ddlGender");
            if (ddlGender != null)
            {
                if (thisRow["gender"].ToString() != "")
                {
                    for (int i = ddlGender.Items.Count - 1; i >= 0; i--)
                    {
                        if (ddlGender.Items[i].Value == "")
                        {
                            ddlGender.Items.RemoveAt(i);
                        }
                    }
                }
            }

            if (ddlTitle != null && ddlGender != null)
            {
                ddlTitle.Attributes["onchange"] = "title_changed_reset_gender('" + ddlTitle.ClientID + "','" + ddlGender.ClientID + "');";
            }


            DropDownList ddlDOB_Day   = (DropDownList)e.Row.FindControl("ddlDOB_Day");
            DropDownList ddlDOB_Month = (DropDownList)e.Row.FindControl("ddlDOB_Month");
            DropDownList ddlDOB_Year  = (DropDownList)e.Row.FindControl("ddlDOB_Year");
            if (ddlDOB_Day != null && ddlDOB_Month != null && ddlDOB_Year != null)
            {
                ddlDOB_Day.Items.Add(new ListItem("--", "-1"));
                ddlDOB_Month.Items.Add(new ListItem("--", "-1"));
                ddlDOB_Year.Items.Add(new ListItem("----", "-1"));

                for (int i = 1; i <= 31; i++)
                {
                    ddlDOB_Day.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                for (int i = 1; i <= 12; i++)
                {
                    ddlDOB_Month.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                for (int i = 1915; i <= DateTime.Today.Year; i++)
                {
                    ddlDOB_Year.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }

                if (thisRow["dob"] != DBNull.Value)
                {
                    DateTime dob = Convert.ToDateTime(thisRow["dob"]);

                    ddlDOB_Day.SelectedValue   = dob.Day.ToString();
                    ddlDOB_Month.SelectedValue = dob.Month.ToString();

                    int firstYearSelectable = Convert.ToInt32(ddlDOB_Year.Items[1].Value);
                    int lastYearSelectable  = Convert.ToInt32(ddlDOB_Year.Items[ddlDOB_Year.Items.Count - 1].Value);
                    if (dob.Year < firstYearSelectable)
                    {
                        ddlDOB_Year.Items.Insert(1, new ListItem(dob.Year.ToString(), dob.Year.ToString()));
                    }
                    if (dob.Year > lastYearSelectable)
                    {
                        ddlDOB_Year.Items.Add(new ListItem(dob.Year.ToString(), dob.Year.ToString()));
                    }

                    ddlDOB_Year.SelectedValue = dob.Year.ToString();
                }
            }

            TextBox txtPwd = (TextBox)e.Row.FindControl("txtPwd");
            if (txtPwd != null)
            {
                txtPwd.Attributes["value"] = thisRow["pwd"].ToString();
            }

            DropDownList ddlPosition = (DropDownList)e.Row.FindControl("ddlStaffPosition");
            if (ddlPosition != null)
            {
                ddlPosition.DataSource     = positions;
                ddlPosition.DataTextField  = "descr";
                ddlPosition.DataValueField = "staff_position_id";
                ddlPosition.DataBind();
                ddlPosition.SelectedValue = thisRow["staff_position_id"].ToString();
            }
            DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlField");
            if (ddlField != null)
            {
                ddlField.DataSource     = fields;
                ddlField.DataTextField  = "descr";
                ddlField.DataValueField = "field_id";
                ddlField.DataBind();
                ddlField.SelectedValue = thisRow["field_id"].ToString();
            }
            DropDownList ddlCostCentre = (DropDownList)e.Row.FindControl("ddlCostCentre");
            if (ddlCostCentre != null)
            {
                ddlCostCentre.DataSource     = costcentres;
                ddlCostCentre.DataTextField  = "descr";
                ddlCostCentre.DataValueField = "costcentre_id";
                ddlCostCentre.DataBind();
                ddlCostCentre.SelectedValue = thisRow["costcentre_id"].ToString();
            }

            bool is_fired = Convert.ToBoolean(thisRow["is_fired"]);

            DropDownList ddlStatus = (DropDownList)e.Row.FindControl("ddlStatus");
            if (ddlStatus != null)
            {
                if (is_fired)
                {
                    ddlStatus.SelectedValue = "Inactive";
                }
                else
                {
                    ddlStatus.SelectedValue = "Active";
                }
            }
            Label lblIsFired = (Label)e.Row.FindControl("lblIsFired");
            if (is_fired)
            {
                e.Row.ForeColor = System.Drawing.Color.Gray;
                if (lblIsFired != null)
                {
                    lblIsFired.ForeColor = System.Drawing.Color.Red;
                }
            }

            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            DataTable    titles   = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", " title_id <> 0 ", " descr ", "title_id", "descr");
            DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlNewTitle");
            ddlTitle.DataSource = titles;
            ddlTitle.DataBind();
            ddlTitle.SelectedIndex = Utilities.IndexOf(ddlTitle, "mr", "mr.");
        }
    }
コード例 #6
0
    protected void GrdNote_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            UserView userView = UserView.GetInstance();

            // if there exists note with the type not in the list of types offered on this screen, use this to add below with "foundRows"
            DataTable allNoteTypes = DBBase.GetGenericDataTable(null, "NoteType", "note_type_id", "descr");
            DataTable allBodyParts = DBBase.GetGenericDataTable(null, "BodyPart", "body_part_id", "descr");

            DataTable noteTypes = IsValidFormScreen() ? ScreenNoteTypesDB.GetDataTable_ByScreenID(GetFormScreen()) : allNoteTypes;
            DataTable sites     = SiteDB.GetDataTable();

            DataTable dt       = ViewState["noteinfo_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("note_id=" + lblId.Text);
                DataRow   thisRow   = foundRows[0];


                bool isDeleted = thisRow["deleted_by"] != DBNull.Value || thisRow["date_deleted"] != DBNull.Value;


                DropDownList ddlDate_Day   = (DropDownList)e.Row.FindControl("ddlDate_Day");
                DropDownList ddlDate_Month = (DropDownList)e.Row.FindControl("ddlDate_Month");
                DropDownList ddlDate_Year  = (DropDownList)e.Row.FindControl("ddlDate_Year");
                if (ddlDate_Day != null && ddlDate_Month != null && ddlDate_Year != null)
                {
                    ddlDate_Day.Items.Add(new ListItem("--", "-1"));
                    ddlDate_Month.Items.Add(new ListItem("--", "-1"));
                    ddlDate_Year.Items.Add(new ListItem("----", "-1"));

                    for (int i = 1; i <= 31; i++)
                    {
                        ddlDate_Day.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    for (int i = 1; i <= 12; i++)
                    {
                        ddlDate_Month.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    for (int i = DateTime.Today.Year - 1; i <= DateTime.Today.Year + 1; i++)
                    {
                        ddlDate_Year.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }

                    if (thisRow["date_added"] != DBNull.Value)
                    {
                        DateTime Date = Convert.ToDateTime(thisRow["date_added"]);

                        ddlDate_Day.SelectedValue   = Date.Day.ToString();
                        ddlDate_Month.SelectedValue = Date.Month.ToString();

                        int firstYearSelectable = Convert.ToInt32(ddlDate_Year.Items[1].Value);
                        int lastYearSelectable  = Convert.ToInt32(ddlDate_Year.Items[ddlDate_Year.Items.Count - 1].Value);
                        if (Date.Year < firstYearSelectable)
                        {
                            ddlDate_Year.Items.Insert(1, new ListItem(Date.Year.ToString(), Date.Year.ToString()));
                        }
                        if (Date.Year > lastYearSelectable)
                        {
                            ddlDate_Year.Items.Add(new ListItem(Date.Year.ToString(), Date.Year.ToString()));
                        }

                        ddlDate_Year.SelectedValue = Date.Year.ToString();
                    }
                }


                DropDownList ddlNoteType = (DropDownList)e.Row.FindControl("ddlNoteType");
                if (ddlNoteType != null)
                {
                    ddlNoteType.DataSource     = noteTypes;
                    ddlNoteType.DataTextField  = "descr";
                    ddlNoteType.DataValueField = "note_type_id";
                    ddlNoteType.DataBind();

                    // if this note type is not in the list for this screen, add it to the edit list
                    bool found = false;
                    foreach (ListItem li in ddlNoteType.Items)
                    {
                        if (li.Value == thisRow["note_type_id"].ToString())
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        ddlNoteType.Items.Add(new ListItem(thisRow["note_type_descr"].ToString(), thisRow["note_type_id"].ToString()));
                    }

                    ddlNoteType.SelectedValue = thisRow["note_type_id"].ToString();
                }

                DropDownList ddlBodyPart = (DropDownList)e.Row.FindControl("ddlBodyPart");
                if (ddlBodyPart != null)
                {
                    ddlBodyPart.Items.Clear();
                    ddlBodyPart.Items.Add(new ListItem("", "-1"));
                    for (int i = 0; i < allBodyParts.Rows.Count; i++)
                    {
                        ddlBodyPart.Items.Add(new ListItem(allBodyParts.Rows[i]["body_part_id"].ToString() + ". " + allBodyParts.Rows[i]["descr"].ToString(), allBodyParts.Rows[i]["body_part_id"].ToString()));
                    }

                    ddlBodyPart.SelectedValue = thisRow["body_part_id"].ToString();
                }


                ImageButton lnkEdit = (ImageButton)e.Row.FindControl("lnkEdit");
                if (lnkEdit != null)
                {
                    lnkEdit.Visible = !isDeleted &&
                                      (userView.IsAdminView ||
                                       (thisRow["added_by_staff_id"] != DBNull.Value && Convert.ToInt32(thisRow["added_by_staff_id"]) == Convert.ToInt32(Session["StaffID"])) ||
                                       (thisRow["modified_by_staff_id"] != DBNull.Value && Convert.ToInt32(thisRow["modified_by_staff_id"]) == Convert.ToInt32(Session["StaffID"])));
                }

                /*
                 * DropDownList ddlSite = (DropDownList)e.Row.FindControl("ddlSite");
                 * if (ddlSite != null)
                 * {
                 *  ddlSite.Items.Add(new ListItem("--", "-1"));
                 *  foreach (DataRow row in sites.Rows)
                 *      ddlSite.Items.Add(new ListItem(row["name"].ToString(), row["site_id"].ToString()));
                 *  ddlSite.SelectedValue = thisRow["site_id"].ToString();
                 * }
                 */


                ImageButton lnkDelete = (ImageButton)e.Row.FindControl("lnkDelete");
                if (lnkDelete != null)
                {
                    lnkDelete.Visible = userView.IsAdminView ||
                                        (thisRow["added_by_staff_id"] != DBNull.Value && Convert.ToInt32(thisRow["added_by_staff_id"]) == Convert.ToInt32(Session["StaffID"])) ||
                                        (thisRow["modified_by_staff_id"] != DBNull.Value && Convert.ToInt32(thisRow["modified_by_staff_id"]) == Convert.ToInt32(Session["StaffID"]));

                    if (isDeleted)
                    {
                        lnkDelete.CommandName = "_UnDelete";
                        lnkDelete.ImageUrl    = "~/images/tick-24.png";
                        lnkDelete.ToolTip     = "Un-Delete";
                    }
                }

                if (isDeleted)
                {
                    e.Row.AddCssClass("deleted_note");
                    e.Row.Style["display"] = "none";
                    e.Row.Style["color"]   = "gray";
                }


                Utilities.AddConfirmationBox(e);
                if ((e.Row.RowState & DataControlRowState.Edit) > 0)
                {
                    Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
                }
            }
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                DropDownList ddlDate_Day   = (DropDownList)e.Row.FindControl("ddlNewDate_Day");
                DropDownList ddlDate_Month = (DropDownList)e.Row.FindControl("ddlNewDate_Month");
                DropDownList ddlDate_Year  = (DropDownList)e.Row.FindControl("ddlNewDate_Year");
                if (ddlDate_Day != null && ddlDate_Month != null && ddlDate_Year != null)
                {
                    ddlDate_Day.Items.Add(new ListItem("--", "-1"));
                    ddlDate_Month.Items.Add(new ListItem("--", "-1"));
                    ddlDate_Year.Items.Add(new ListItem("----", "-1"));

                    for (int i = 1; i <= 31; i++)
                    {
                        ddlDate_Day.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    for (int i = 1; i <= 12; i++)
                    {
                        ddlDate_Month.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    for (int i = DateTime.Today.Year - 1; i <= DateTime.Today.Year + 1; i++)
                    {
                        ddlDate_Year.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }

                    ddlDate_Day.SelectedValue   = DateTime.Today.Day.ToString();
                    ddlDate_Month.SelectedValue = DateTime.Today.Month.ToString();
                    ddlDate_Year.SelectedValue  = DateTime.Today.Year.ToString();
                }

                DropDownList ddlNoteType = (DropDownList)e.Row.FindControl("ddlNewNoteType");
                ddlNoteType.DataSource = noteTypes;
                ddlNoteType.DataBind();

                DropDownList ddlBodyPart = (DropDownList)e.Row.FindControl("ddlNewBodyPart");
                ddlBodyPart.Items.Add(new ListItem("", "-1"));
                for (int i = 0; i < allBodyParts.Rows.Count; i++)
                {
                    ddlBodyPart.Items.Add(new ListItem(allBodyParts.Rows[i]["body_part_id"].ToString() + ". " + allBodyParts.Rows[i]["descr"].ToString(), allBodyParts.Rows[i]["body_part_id"].ToString()));
                }


                // set note text in cookie in case user logged out, to keep note text for this user and this entity
                TextBox txtNewText = (TextBox)e.Row.FindControl("txtNewText");
                txtNewText.Attributes["onkeyup"] = "set_note(document.getElementById('" + txtNewText.ClientID + "'), document.getElementById('" + userID.ClientID + "').value, document.getElementById('" + entityID.ClientID + "').value);";


                /*
                 * DropDownList ddlSite = (DropDownList)e.Row.FindControl("ddlNewSite");
                 * ddlSite.Items.Add(new ListItem("--", "-1"));
                 * foreach (DataRow row in sites.Rows)
                 *  ddlSite.Items.Add(new ListItem(row["name"].ToString(), row["site_id"].ToString()));
                 * ddlSite.SelectedValue = Session["SiteID"].ToString();
                 */
            }
        }
        catch (Exception ex)
        {
            if (Utilities.IsDev())
            {
                throw;
            }
            else
            {
                HideTableAndSetErrorMessage(ex is CustomMessageException ? ex.Message : "");
            }
        }
    }
コード例 #7
0
    private void FillEmptyAddForm()
    {
        Invoice invoice = InvoiceDB.GetByID(GetFormID());

        if (invoice == null)
        {
            HideTableAndSetErrorMessage("Invalid invoice ID");
            return;
        }

        lblInvoiceNbr.Text  = invoice.InvoiceID.ToString();
        lblAmountOwing.Text = "$" + invoice.TotalDue.ToString();


        DataTable dt = DBBase.GetGenericDataTable(null, "ReceiptPaymentType", "receipt_payment_type_id", "descr");

        // add column for displaying data in first few rows with invoice id and invoice amount owing
        dt.Columns.Add("text");
        dt.Columns.Add("tab_index");
        for (int i = dt.Rows.Count - 1; i >= 0; i--)
        {
            dt.Rows[i]["text"] = "";
            if (Convert.ToInt32(dt.Rows[i]["receipt_payment_type_id"]) == 363)
            {
                dt.Rows.RemoveAt(i);
            }
        }

        lstPayments.DataSource = dt;
        lstPayments.DataBind();

        for (int i = lstPayments.Items.Count - 1; i >= 0; i--)
        {
            Label   lblReceiptPaymentTypeID     = (Label)lstPayments.Items[i].FindControl("lblTypeID");
            TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[i].FindControl("txtAmount");
            Button  btnWebPay = (Button)lstPayments.Items[i].FindControl("btnWebPay");

            if (lblReceiptPaymentTypeID.Text != "133" && lblReceiptPaymentTypeID.Text != "362")
            {
                btnWebPay.Visible = false;
            }

            if (((SystemVariables)Session["SystemVariables"])["EziDebit_Enabled"].Value != "1")
            {
                btnWebPay.Visible = false;
            }

            Utilities.SetEditControlBackColour(txtReceiptPaymentTypeAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        if (lstPayments.Items.Count > 0)
        {
            TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[0].FindControl("txtAmount");
            SetFocus(txtReceiptPaymentTypeAmount);
        }



        int entityID = -1;

        if (invoice.PayerOrganisation != null)
        {
            entityID = invoice.PayerOrganisation.EntityID;
        }
        else if (invoice.PayerPatient != null)
        {
            entityID = invoice.PayerPatient.Person.EntityID;
        }
        else if (invoice.Booking != null && invoice.Booking.Patient != null)
        {
            entityID = BookingDB.GetByID(invoice.Booking.BookingID).Patient.Person.EntityID;
        }

        DataTable dt_vouchers = CreditDB.GetUnusedVouchers(entityID);

        lstVouchers.DataSource = dt_vouchers;
        lstVouchers.DataBind();

        for (int i = lstVouchers.Items.Count - 1; i >= 0; i--)
        {
            TextBox txtAmount = (TextBox)lstVouchers.Items[i].FindControl("txtAmount");
            Utilities.SetEditControlBackColour(txtAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        if (lstVouchers.Items.Count == 0)
        {
            divVouchers.Visible = false;
        }



        Utilities.SetEditControlBackColour(txtCreditNoteTotal, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(txtCreditCardReason, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);

        btnSubmit.Text    = "Add Payment(s)";
        btnCancel.Visible = true;
    }
コード例 #8
0
    private void FillEmptyAddForm()
    {
        Tuple <string, int> formParams = GetFormParams(false);

        Invoice invoice = InvoiceDB.GetByID(formParams.Item2, formParams.Item1);

        if (invoice == null)
        {
            HideTableAndSetErrorMessage("Invalid invoice ID");
            return;
        }


        lblInvoiceNbr.Text  = invoice.InvoiceID.ToString();
        lblAmountOwing.Text = "$" + invoice.TotalDue.ToString();


        DataTable dt = DBBase.GetGenericDataTable(formParams.Item1, "ReceiptPaymentType", "receipt_payment_type_id", "descr");

        for (int i = dt.Rows.Count - 1; i >= 0; i--)
        {
            if (Convert.ToInt32(dt.Rows[i]["receipt_payment_type_id"]) != 133)
            {
                dt.Rows.RemoveAt(i);
            }
        }

        // add column for displaying data in first few rows with invoice id and invoice amount owing
        dt.Columns.Add("text");
        dt.Columns.Add("tab_index");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["text"] = "";
        }

        lstPayments.DataSource = dt;
        lstPayments.DataBind();

        for (int i = lstPayments.Items.Count - 1; i >= 0; i--)
        {
            Label   lblReceiptPaymentTypeID     = (Label)lstPayments.Items[i].FindControl("lblTypeID");
            TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[i].FindControl("txtAmount");
            Button  btnWebPay = (Button)lstPayments.Items[i].FindControl("btnWebPay");

            if (lblReceiptPaymentTypeID.Text != "133" && lblReceiptPaymentTypeID.Text != "362")
            {
                btnWebPay.Visible = false;
            }

            txtReceiptPaymentTypeAmount.Text = invoice.TotalDue.ToString();

            SystemVariables sysVariables = SystemVariableDB.GetAll(formParams.Item1);
            if (sysVariables["EziDebit_Enabled"].Value != "1")
            {
                btnWebPay.Visible = false;
            }

            Utilities.SetEditControlBackColour(txtReceiptPaymentTypeAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        if (invoice.IsPaID)
        {
            maintable.Visible = false;
            SetErrorMessage("Invoice already paid");
        }
    }
コード例 #9
0
    protected void GrdOffering_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable offeringTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "OfferingType", "offering_type_id <> 90", "", "offering_type_id", "descr");
        DataTable fields        = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "has_offerings = 1", "descr", "field_id", "descr");
        DataTable offeringPatientSubcategories = DBBase.GetGenericDataTable(null, "AgedCarePatientType", "aged_care_patient_type_id", "descr");
        DataTable offeringInvoiceTypes         = DBBase.GetGenericDataTable(null, "OfferingInvoiceType", "offering_invoice_type_id", "descr");
        DataTable letters = LetterDB.GetDataTable_ByLetterType(391);

        int BookingScreenDefaultServiceID = Convert.ToInt32(SystemVariableDB.GetByDescr("BookingScreenDefaultServiceID").Value);

        // move 'None' item to the top
        for (int i = 0; i < fields.Rows.Count; i++)
        {
            if (fields.Rows[i]["descr"].ToString() != "None")
            {
                continue;
            }

            DataRow newRow = fields.NewRow();
            newRow.ItemArray = fields.Rows[i].ItemArray;
            fields.Rows.RemoveAt(i);
            fields.Rows.InsertAt(newRow, 0);
            break;
        }


        DataTable dt       = Session["offeringinfo_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("o_offering_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];


            int offering_id = Convert.ToInt32(thisRow["o_offering_id"]);


            TextBox txtName = (TextBox)e.Row.FindControl("txtName");
            if (txtName != null)
            {
                if (Session["DB"] != null && Session["DB"].ToString() == "Mediclinic_0040")
                {
                    txtName.MaxLength = 2000;
                    txtName.TextMode  = TextBoxMode.MultiLine;
                }
                else if (thisRow["o_name"].ToString().Contains(Environment.NewLine))
                {
                    txtName.TextMode = TextBoxMode.MultiLine;
                }
            }


            DropDownList ddlOfferingType = (DropDownList)e.Row.FindControl("ddlOfferingType");
            if (ddlOfferingType != null)
            {
                ddlOfferingType.DataSource     = offeringTypes;
                ddlOfferingType.DataTextField  = "descr";
                ddlOfferingType.DataValueField = "offering_type_id";
                ddlOfferingType.DataBind();
                ddlOfferingType.SelectedValue = thisRow["o_offering_type_id"].ToString();
            }

            DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlField");
            if (ddlField != null)
            {
                ddlField.DataSource     = fields;
                ddlField.DataTextField  = "descr";
                ddlField.DataValueField = "field_id";
                ddlField.DataBind();
                ddlField.SelectedValue = thisRow["o_field_id"].ToString();
            }

            DropDownList ddlOfferingPatientSubcategory = (DropDownList)e.Row.FindControl("ddlOfferingPatientSubcategory");
            if (ddlOfferingPatientSubcategory != null)
            {
                ddlOfferingPatientSubcategory.DataSource     = offeringPatientSubcategories;
                ddlOfferingPatientSubcategory.DataTextField  = "descr";
                ddlOfferingPatientSubcategory.DataValueField = "aged_care_patient_type_id";
                ddlOfferingPatientSubcategory.DataBind();
                ddlOfferingPatientSubcategory.SelectedValue = thisRow["o_aged_care_patient_type_id"].ToString();
            }

            DropDownList ddlOfferingInvoiceType = (DropDownList)e.Row.FindControl("ddlOfferingInvoiceType");
            if (ddlOfferingInvoiceType != null)
            {
                if (IsValidFormInvType())
                {
                    IDandDescr invType = GetFormInvType();
                    ddlOfferingInvoiceType.Items.Add(new ListItem(invType.Descr, invType.ID.ToString()));
                }
                else
                {
                    string v = thisRow["o_offering_invoice_type_id"].ToString();

                    ddlOfferingInvoiceType.DataSource     = offeringInvoiceTypes;
                    ddlOfferingInvoiceType.DataTextField  = "descr";
                    ddlOfferingInvoiceType.DataValueField = "offering_invoice_type_id";
                    ddlOfferingInvoiceType.DataBind();
                    ddlOfferingInvoiceType.SelectedValue = thisRow["o_offering_invoice_type_id"].ToString();
                }
            }

            DropDownList ddlServiceTimeMinutes = (DropDownList)e.Row.FindControl("ddlServiceTimeMinutes");
            if (ddlServiceTimeMinutes != null)
            {
                ddlServiceTimeMinutes.Items.AddRange(GetListOfTimes());
                int valueToSelect = Convert.ToInt32(dt.Rows[e.Row.RowIndex]["o_service_time_minutes"]);
                if (ddlServiceTimeMinutes.Items.FindByValue(valueToSelect.ToString()) != null)
                {
                    ddlServiceTimeMinutes.SelectedValue = valueToSelect.ToString();
                }
                else
                {
                    ddlServiceTimeMinutes.Items.Clear();
                    ddlServiceTimeMinutes.Items.AddRange(GetListOfTimes(valueToSelect));
                    ddlServiceTimeMinutes.SelectedValue = valueToSelect.ToString();
                }
            }

            DropDownList ddlNumClinicVisitsAllowedPerYear = (DropDownList)e.Row.FindControl("ddlNumClinicVisitsAllowedPerYear");
            if (ddlNumClinicVisitsAllowedPerYear != null)
            {
                for (int i = 0; i < 6; i++)
                {
                    ddlNumClinicVisitsAllowedPerYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddlNumClinicVisitsAllowedPerYear.SelectedValue = thisRow["o_num_clinic_visits_allowed_per_year"].ToString();
            }

            DropDownList ddlMaxNbrClaimable = (DropDownList)e.Row.FindControl("ddlMaxNbrClaimable");
            if (ddlMaxNbrClaimable != null)
            {
                for (int i = 0; i < 10; i++)
                {
                    ddlMaxNbrClaimable.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddlMaxNbrClaimable.SelectedValue = thisRow["o_max_nbr_claimable"].ToString();
            }

            DropDownList ddlMaxNbrClaimableMonths = (DropDownList)e.Row.FindControl("ddlMaxNbrClaimableMonths");
            if (ddlMaxNbrClaimableMonths != null)
            {
                for (int i = 0; i <= 24; i++)
                {
                    ddlMaxNbrClaimableMonths.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddlMaxNbrClaimableMonths.SelectedValue = thisRow["o_max_nbr_claimable_months"].ToString();
            }

            DropDownList ddlReminderLetterMonthsLaterToSend = (DropDownList)e.Row.FindControl("ddlReminderLetterMonthsLaterToSend");
            if (ddlReminderLetterMonthsLaterToSend != null)
            {
                for (int i = 0; i <= 24; i++)
                {
                    ddlReminderLetterMonthsLaterToSend.Items.Add(new ListItem((i == 0 ? "Disabled" : i.ToString()), i.ToString()));
                }
                ddlReminderLetterMonthsLaterToSend.SelectedValue = thisRow["o_reminder_letter_months_later_to_send"].ToString();
            }

            DropDownList ddlReminderLetter = (DropDownList)e.Row.FindControl("ddlReminderLetter");
            if (ddlReminderLetter != null)
            {
                ddlReminderLetter.Items.Add(new ListItem("--", "-1"));
                for (int i = 0; i < letters.Rows.Count; i++)
                {
                    ddlReminderLetter.Items.Add(new ListItem(letters.Rows[i]["letter_docname"].ToString(), letters.Rows[i]["letter_letter_id"].ToString()));
                }
                if (thisRow["o_reminder_letter_id"] != DBNull.Value)
                {
                    ddlReminderLetter.SelectedValue = thisRow["o_reminder_letter_id"].ToString();
                }
            }

            Label lblReminderLetter = (Label)e.Row.FindControl("lblReminderLetter");
            if (lblReminderLetter != null)
            {
                if (thisRow["o_reminder_letter_id"] == DBNull.Value)
                {
                    lblReminderLetter.Text = string.Empty;
                }

                else
                {
                    for (int i = 0; i < letters.Rows.Count; i++)
                    {
                        if (Convert.ToInt32(letters.Rows[i]["letter_letter_id"]) == Convert.ToInt32(thisRow["o_reminder_letter_id"]))
                        {
                            lblReminderLetter.Text = letters.Rows[i]["letter_docname"].ToString();
                            break;
                        }
                    }
                }
            }



            ImageButton lnkPopupMessage = (ImageButton)e.Row.FindControl("lnkPopupMessage");
            if (lnkPopupMessage != null)
            {
                string allFeatures = "dialogWidth:550px;dialogHeight:400px;center:yes;resizable:no; scroll:no";
                string js          = "javascript:window.showModalDialog('OfferingPopupMessageDetailV2.aspx?type=edit&id=" + offering_id.ToString() + "', '', '" + allFeatures + "');return false;";

                lnkPopupMessage.Visible     = true;
                lnkPopupMessage.PostBackUrl = "  ";
                lnkPopupMessage.Attributes.Add("onclick", js);
            }


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


            LinkButton lnkUpdate = (LinkButton)e.Row.FindControl("lnkUpdate");
            if (lnkUpdate != null)
            {
                TextBox txtMedicareCharge = (TextBox)e.Row.FindControl("txtMedicareCharge");
                TextBox txtDvaCharge      = (TextBox)e.Row.FindControl("txtDvaCharge");
                TextBox txtTacCharge      = (TextBox)e.Row.FindControl("txtTacCharge");

                lnkUpdate.OnClientClick = "set_if_empty_price(document.getElementById('" + txtMedicareCharge.ClientID + "'),document.getElementById('" + txtDvaCharge.ClientID + "'),document.getElementById('" + txtTacCharge.ClientID + "'));";
            }

            Image imgBookingScreenDefaultService = (Image)e.Row.FindControl("imgBookingScreenDefaultService");
            imgBookingScreenDefaultService.Visible = offering_id == BookingScreenDefaultServiceID;

            LinkButton btnSetAsBookingScreenDefaultService = (LinkButton)e.Row.FindControl("btnSetAsBookingScreenDefaultService");
            btnSetAsBookingScreenDefaultService.Visible = offering_id != BookingScreenDefaultServiceID;


            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            DropDownList ddlOfferingType = (DropDownList)e.Row.FindControl("ddlNewOfferingType");
            ddlOfferingType.DataSource = offeringTypes;
            ddlOfferingType.DataBind();

            DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlNewField");
            ddlField.DataSource = fields;
            ddlField.DataBind();

            DropDownList ddlOfferingPatientSubcategory = (DropDownList)e.Row.FindControl("ddlNewOfferingPatientSubcategory");
            ddlOfferingPatientSubcategory.DataSource = offeringPatientSubcategories;
            ddlOfferingPatientSubcategory.DataBind();

            bool isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false;
            if (isAgedCareResidentTypes)
            {
                ddlOfferingPatientSubcategory.Items.RemoveAt(0);
            }

            DropDownList ddlOfferingInvoiceType = (DropDownList)e.Row.FindControl("ddlNewOfferingInvoiceType");
            if (IsValidFormInvType())
            {
                IDandDescr invType = GetFormInvType();
                ddlOfferingInvoiceType.Items.Add(new ListItem(invType.Descr, invType.ID.ToString()));
            }
            else
            {
                //ddlOfferingInvoiceType.DataSource = offeringInvoiceTypes;
                //ddlOfferingInvoiceType.DataBind();
                foreach (DataRow row in offeringInvoiceTypes.Rows)
                {
                    if (row["offering_invoice_type_id"].ToString() != "0")
                    {
                        ddlOfferingInvoiceType.Items.Add(new ListItem(row["descr"].ToString(), row["offering_invoice_type_id"].ToString()));
                    }
                }

                ddlOfferingInvoiceType.SelectedValue = UserView.GetInstance().IsClinicView ? "1" : "4"; // 1 = clinics, 4 = aged care
            }

            DropDownList ddlServiceTimeMinutes = (DropDownList)e.Row.FindControl("ddlNewServiceTimeMinutes");
            for (int i = 0; i < 20; i++)
            {
                ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            for (int i = 20; i <= 90; i++)
            {
                if (i % 5 == 0)
                {
                    ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
            }
            for (int i = 91; i <= 480; i++)
            {
                if (i % 30 == 0)
                {
                    ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
            }


            DropDownList ddlNumClinicVisitsAllowedPerYear = (DropDownList)e.Row.FindControl("ddlNewNumClinicVisitsAllowedPerYear");
            if (ddlNumClinicVisitsAllowedPerYear != null)
            {
                for (int i = 0; i < 6; i++)
                {
                    ddlNumClinicVisitsAllowedPerYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
            }

            DropDownList ddlMaxNbrClaimable = (DropDownList)e.Row.FindControl("ddlNewMaxNbrClaimable");
            for (int i = 0; i < 10; i++)
            {
                ddlMaxNbrClaimable.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            DropDownList ddlMaxNbrClaimableMonths = (DropDownList)e.Row.FindControl("ddlNewMaxNbrClaimableMonths");
            for (int i = 0; i <= 24; i++)
            {
                ddlMaxNbrClaimableMonths.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            DropDownList ddlReminderLetterMonthsLaterToSend = (DropDownList)e.Row.FindControl("ddlNewReminderLetterMonthsLaterToSend");
            for (int i = 0; i <= 24; i++)
            {
                ddlReminderLetterMonthsLaterToSend.Items.Add(new ListItem((i == 0 ? "Disabled" : i.ToString()), i.ToString()));
            }

            DropDownList ddlReminderLetter = (DropDownList)e.Row.FindControl("ddlNewReminderLetter");
            ddlReminderLetter.Items.Add(new ListItem("--", "-1"));
            for (int i = 0; i < letters.Rows.Count; i++)
            {
                ddlReminderLetter.Items.Add(new ListItem(letters.Rows[i]["letter_docname"].ToString(), letters.Rows[i]["letter_letter_id"].ToString()));
            }


            LinkButton lnkAdd            = (LinkButton)e.Row.FindControl("lnkAdd");
            TextBox    txtMedicareCharge = (TextBox)e.Row.FindControl("txtNewMedicareCharge");
            TextBox    txtDvaCharge      = (TextBox)e.Row.FindControl("txtNewDvaCharge");
            TextBox    txtTacCharge      = (TextBox)e.Row.FindControl("txtNewTacCharge");
            lnkAdd.OnClientClick = "set_if_empty_price(document.getElementById('" + txtMedicareCharge.ClientID + "'),document.getElementById('" + txtDvaCharge.ClientID + "'),document.getElementById('" + txtTacCharge.ClientID + "'));";
        }
    }