Exemplo n.º 1
0
    protected void Sort(string sortExpression, params string[] sortExpr)
    {
        DataTable dataTable = Session["data_receiptsReport"] as DataTable;

        if (dataTable != null)
        {
            if (Session["sortExpression_receiptsReport"] == null)
            {
                Session["sortExpression_receiptsReport"] = "";
            }

            DataView dataView = new DataView(dataTable);
            string[] sortData = Session["sortExpression_receiptsReport"].ToString().Trim().Split(' ');

            string newSortExpr = (sortExpr.Length == 0) ?
                                 (sortExpression == sortData[0] && sortData[1] == "ASC") ? "DESC" : "ASC" :
                                 sortExpr[0];

            dataView.Sort = sortExpression + " " + newSortExpr;
            Session["sortExpression_receiptsReport"] = sortExpression + " " + newSortExpr;

            GrdSummaryReport.DataSource = dataView;
            GrdSummaryReport.DataBind();
        }
    }
Exemplo n.º 2
0
    protected void FillGrid()
    {
        UserView userView = UserView.GetInstance();

        DateTime fromDate = IsValidDate(txtStartDate.Text) ? GetDate(txtStartDate.Text)                              : DateTime.MinValue;
        DateTime toDate   = IsValidDate(txtEndDate.Text)   ? GetDate(txtEndDate.Text).Add(new TimeSpan(23, 59, 59))  : DateTime.MinValue;


        int organisation_type_group_id = -1;

        if (userView.IsClinicView)
        {
            organisation_type_group_id = 5;
        }
        if (userView.IsAgedCareView)
        {
            organisation_type_group_id = 6;
        }

        DataTable dt = null;

        if (rblDateType.SelectedValue == "Bookings")
        {
            dt = BookingDB.GetReport_InvoiceLines(fromDate, toDate, DateTime.MinValue, DateTime.MinValue, Convert.ToInt32(ddlOrgs.SelectedValue), Convert.ToInt32(ddlProviders.SelectedValue), Convert.ToInt32(ddlOfferings.SelectedValue), organisation_type_group_id);
        }
        else if (rblDateType.SelectedValue == "Invoices")
        {
            dt = BookingDB.GetReport_InvoiceLines(DateTime.MinValue, DateTime.MinValue, fromDate, toDate, Convert.ToInt32(ddlOrgs.SelectedValue), Convert.ToInt32(ddlProviders.SelectedValue), Convert.ToInt32(ddlOfferings.SelectedValue), organisation_type_group_id);
        }
        else
        {
            SetErrorMessage("Please select date range to be treatment date or invoice date.");
            return;
        }



        dt.Columns.Add("booking_duration_total_minutes", typeof(string));
        dt.Columns.Add("organisation_name", typeof(string));
        dt.Columns.Add("patient_id", typeof(int));
        dt.Columns.Add("patient_firstname", typeof(string));
        dt.Columns.Add("patient_surname", typeof(string));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["booking_id"] == DBNull.Value)
            {
                dt.Rows[i]["booking_duration_total_minutes"] = "";
                dt.Rows[i]["organisation_name"] = dt.Rows[i]["non_booking_organisation_name"];
                dt.Rows[i]["patient_id"]        = dt.Rows[i]["non_booking_patient_id"];
                dt.Rows[i]["patient_firstname"] = dt.Rows[i]["non_booking_patient_firstname"];
                dt.Rows[i]["patient_surname"]   = dt.Rows[i]["non_booking_patient_surname"];
            }
            else
            {
                DateTime bookingStart = Convert.ToDateTime(dt.Rows[i]["booking_date_start"]);
                DateTime bookingEnd   = Convert.ToDateTime(dt.Rows[i]["booking_date_end"]);
                dt.Rows[i]["booking_duration_total_minutes"] = bookingEnd.Subtract(bookingStart).TotalMinutes.ToString();
                dt.Rows[i]["organisation_name"] = dt.Rows[i]["booking_organisation_name"];
                dt.Rows[i]["patient_id"]        = dt.Rows[i]["booking_patient_id"];
                dt.Rows[i]["patient_firstname"] = dt.Rows[i]["booking_patient_firstname"];
                dt.Rows[i]["patient_surname"]   = dt.Rows[i]["booking_patient_surname"];
            }
        }


        Hashtable staffOfferingHash = StaffOfferingsDB.Get2DHash(true, Convert.ToInt32(ddlProviders.SelectedValue));

        dt.Columns.Add("commission_percent_text", typeof(string));
        dt.Columns.Add("fixed_rate_text", typeof(string));
        dt.Columns.Add("commission_percent_amount", typeof(decimal));
        dt.Columns.Add("fixed_rate_amount", typeof(decimal));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["booking_id"] == DBNull.Value)
            {
                dt.Rows[i]["commission_percent_text"]   = "";
                dt.Rows[i]["fixed_rate_text"]           = "";
                dt.Rows[i]["commission_percent_amount"] = 0;
                dt.Rows[i]["fixed_rate_amount"]         = 0;
            }
            else
            {
                StaffOfferings staffOffering = (StaffOfferings)staffOfferingHash[new Hashtable2D.Key(Convert.ToInt32(dt.Rows[i]["provider_staff_id"]), dt.Rows[i]["offering_id"] == DBNull.Value ? -1 : Convert.ToInt32(dt.Rows[i]["offering_id"]))];
                //dt.Rows[i]["commission_percent_text"]   = staffOffering == null || !staffOffering.IsCommission ? "" : Math.Round(staffOffering.CommissionPercent * Convert.ToDecimal(dt.Rows[i]["invoice_line_price"]) / 100, 2).ToString() + " (" + staffOffering.CommissionPercent + "%)";
                dt.Rows[i]["commission_percent_text"]   = staffOffering == null || !staffOffering.IsCommission ? "" : Math.Round(staffOffering.CommissionPercent * Convert.ToDecimal(dt.Rows[i]["invoice_line_price"]) / 100, 2).ToString();
                dt.Rows[i]["fixed_rate_text"]           = staffOffering == null || !staffOffering.IsFixedRate  ? "" : staffOffering.FixedRate.ToString();
                dt.Rows[i]["commission_percent_amount"] = staffOffering == null || !staffOffering.IsCommission ? Convert.ToDecimal(0.00) : Math.Round(staffOffering.CommissionPercent * Convert.ToDecimal(dt.Rows[i]["invoice_line_price"]) / 100, 2);
                dt.Rows[i]["fixed_rate_amount"]         = staffOffering == null || !staffOffering.IsFixedRate  ? Convert.ToDecimal(0.00) : staffOffering.FixedRate;
            }
        }



        Session["data_summaryReport"] = dt;

        if (!IsPostBack)
        {
            chkUsePaging.Checked = dt.Rows.Count > 50;
        }

        this.GrdSummaryReport.AllowPaging = chkUsePaging.Checked;

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


            try
            {
                GrdSummaryReport.DataBind();
                GrdSummaryReport.PagerSettings.FirstPageText = "1";
                GrdSummaryReport.PagerSettings.LastPageText  = GrdSummaryReport.PageCount.ToString();
                GrdSummaryReport.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdSummaryReport.DataSource = dt;
            GrdSummaryReport.DataBind();

            int TotalColumns = GrdSummaryReport.Rows[0].Cells.Count;
            GrdSummaryReport.Rows[0].Cells.Clear();
            GrdSummaryReport.Rows[0].Cells.Add(new TableCell());
            GrdSummaryReport.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdSummaryReport.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
Exemplo n.º 3
0
    protected void FillGrid()
    {
        UserView userView = UserView.GetInstance();

        DateTime fromDate = IsValidDate(txtStartDate.Text) ? GetDate(txtStartDate.Text) : DateTime.MinValue;
        DateTime toDate   = IsValidDate(txtEndDate.Text)   ? GetDate(txtEndDate.Text).Add(new TimeSpan(23, 59, 59))  : DateTime.MinValue;

        int organisation_type_group_id = -1;

        if (userView.IsClinicView)
        {
            organisation_type_group_id = 5;
        }
        if (userView.IsAgedCareView)
        {
            organisation_type_group_id = 6;
        }


        DataTable dt = BookingDB.GetReport_Receipts(fromDate, toDate, Convert.ToInt32(ddlOrgs.SelectedValue), Convert.ToInt32(ddlProviders.SelectedValue), chkIncMedicare.Checked, chkIncDVA.Checked, chkIncPrivate.Checked, chkIncReconciled.Checked, Convert.ToInt32(ddlReceiptPaymentType.SelectedValue), organisation_type_group_id);  // organisation_type_group_id : [clinic=5, aged care = 6]

        Session["data_receiptsReport"] = dt;

        if (!IsPostBack)
        {
            chkUsePaging.Checked = dt.Rows.Count > 50;
        }

        this.GrdSummaryReport.AllowPaging = chkUsePaging.Checked;

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


            try
            {
                GrdSummaryReport.DataBind();
                GrdSummaryReport.PagerSettings.FirstPageText = "1";
                GrdSummaryReport.PagerSettings.LastPageText  = GrdSummaryReport.PageCount.ToString();
                GrdSummaryReport.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdSummaryReport.DataSource = dt;
            GrdSummaryReport.DataBind();

            int TotalColumns = GrdSummaryReport.Rows[0].Cells.Count;
            GrdSummaryReport.Rows[0].Cells.Clear();
            GrdSummaryReport.Rows[0].Cells.Add(new TableCell());
            GrdSummaryReport.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdSummaryReport.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
Exemplo n.º 4
0
    protected void FillGrid()
    {
        DataTable dt;

        try
        {
            dt = PatientDB.GetBirthdays_DataTable(Convert.ToInt32(ddlStartDate_Month.SelectedValue), Convert.ToInt32(ddlStartDate_Day.SelectedValue),
                                                  Convert.ToInt32(ddlEndDate_Month.SelectedValue), Convert.ToInt32(ddlEndDate_Day.SelectedValue));
        }
        catch (CustomMessageException ex)
        {
            SetErrorMessage(ex.Message);
            return;
        }


        // get their mobile and emails

        Patient[] patients = new Patient[dt.Rows.Count];
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            patients[i]              = PatientDB.Load(dt.Rows[i]);
            patients[i].Person       = PersonDB.Load(dt.Rows[i]);
            patients[i].Person.Title = IDandDescrDB.Load(dt.Rows[i], "t_title_id", "t_descr");
        }

        Hashtable patientContactPhoneNbrHash = GetPatientPhoneNbrCache(patients);
        Hashtable patientContactEmailHash    = GetPatientEmailCache(patients);

        ArrayList patientIDs = new ArrayList();

        dt.Columns.Add("mobile", typeof(string));
        dt.Columns.Add("email", typeof(string));
        for (int i = dt.Rows.Count - 1; i >= 0; i--)
        {
            string phoneNumPatient = GetPhoneNbr(patientContactPhoneNbrHash, patients[i].Person.EntityID, true);
            string emailPatient    = GetEmail(patientContactEmailHash, patients[i].Person.EntityID);

            if ((!chkIncWithMobile.Checked && (phoneNumPatient != null && phoneNumPatient.Length > 0)) ||
                (!chkIncWithEmail.Checked && (emailPatient != null && emailPatient.Length > 0)))
            {
                dt.Rows.RemoveAt(i);
                continue;
            }

            dt.Rows[i]["mobile"] = phoneNumPatient == null ? "" : phoneNumPatient;
            dt.Rows[i]["email"]  = emailPatient == null ? ""  : emailPatient;

            patientIDs.Add(patients[i].PatientID);
        }


        hiddenPatientIDs.Value = string.Join(",", (int[])patientIDs.ToArray(typeof(int)));

        Session["data_bookingswithoutsmsoremail"] = dt;

        if (!IsPostBack)
        {
            chkUsePaging.Checked = dt.Rows.Count > 50;
        }

        this.GrdSummaryReport.AllowPaging = chkUsePaging.Checked;

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


            try
            {
                GrdSummaryReport.DataBind();
                GrdSummaryReport.PagerSettings.FirstPageText = "1";
                GrdSummaryReport.PagerSettings.LastPageText  = GrdSummaryReport.PageCount.ToString();
                GrdSummaryReport.DataBind();
            }
            catch (Exception ex)
            {
                SetErrorMessage(ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdSummaryReport.DataSource = dt;
            GrdSummaryReport.DataBind();

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