///<summary>Get the list of websched appointments using the RpAppointments query.</summary>
        private DataTable GetAppointments()
        {
            List <long> listProvNums = Providers.GetProvidersForWebSchedNewPatAppt().Select(x => x.ProvNum).ToList();
            List <long> listStatus   = comboBoxMultiConfStatus.ListSelectedIndices.Select(x => ((ODBoxItem <long>)comboBoxMultiConfStatus.Items[x]).Tag).ToList();

            return(RpAppointments.GetAppointmentTable(
                       datePicker.GetDateTimeFrom(),
                       datePicker.GetDateTimeTo(),
                       listProvNums,
                       comboBoxClinicMulti.ListSelectedClinicNums,
                       PrefC.HasClinicsEnabled,
                       checkWebSchedRecall.Checked,
                       checkWebSchedNewPat.Checked,
                       checkASAP.Checked,
                       RpAppointments.SortAndFilterBy.SecurityLogDate,
                       new List <ApptStatus>(),
                       listStatus,
                       nameof(FormWebSchedAppts)));
        }
Example #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!IsValid())
            {
                return;
            }
            List <long> listClinicNums = new List <long>();

            for (int i = 0; i < listClinics.SelectedIndices.Count; i++)
            {
                if (Security.CurUser.ClinicIsRestricted)
                {
                    listClinicNums.Add(_listClinics[listClinics.SelectedIndices[i]].ClinicNum);                            //we know that the list is a 1:1 to _listClinics
                }
                else
                {
                    if (listClinics.SelectedIndices[i] == 0)
                    {
                        listClinicNums.Add(0);
                    }
                    else
                    {
                        listClinicNums.Add(_listClinics[listClinics.SelectedIndices[i] - 1].ClinicNum);                      //Minus 1 from the selected index
                    }
                }
            }
            List <long> listProvNums = new List <long>();

            if (checkAllProvs.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                }
            }
            else
            {
                for (int i = 0; i < listProvs.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(_listProviders[listProvs.SelectedIndices[i]].ProvNum);
                }
            }
            ReportComplex     report       = new ReportComplex(true, true);
            DateTime          dateFrom     = PIn.Date(textDateFrom.Text);
            DateTime          dateTo       = PIn.Date(textDateTo.Text);
            DataTable         table        = new DataTable();
            List <ApptStatus> listStatuses = new List <ApptStatus> {
                ApptStatus.Planned, ApptStatus.UnschedList
            };

            if (!checkShowNoteAppts.Checked)
            {
                listStatuses.Add(ApptStatus.PtNote);
                listStatuses.Add(ApptStatus.PtNoteCompleted);
            }
            RpAppointments.SortAndFilterBy sortBy = radioDateAptCreated.Checked ? RpAppointments.SortAndFilterBy.SecDateEntry : RpAppointments.SortAndFilterBy.AptDateTime;
            table = RpAppointments.GetAppointmentTable(dateFrom, dateTo, listProvNums, listClinicNums, _hasClinicsEnabled, checkWebSchedRecall.Checked,
                                                       checkWebSchedNewPat.Checked, checkWebSchedASAP.Checked, sortBy, listStatuses, new List <long>(), nameof(FormRpAppointments));
            //create the report
            Font font         = new Font("Tahoma", 9);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Appointments");
            report.AddTitle("Title", Lan.g(this, "Appointments"), fontTitle);
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(), fontSubTitle);
            if (checkAllProvs.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                string str = "";
                for (int i = 0; i < listProvs.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        str += ", ";
                    }
                    str += _listProviders[listProvs.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Providers", str);
            }
            QueryObject query;

            //setup query
            if (!_hasClinicsEnabled)
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
            }
            else
            {
                query = report.AddQuery(table, "", "ClinicDesc", SplitByKind.Value, 1, true);
            }
            // add columns to report
            if (radioAptDate.Checked)
            {
                query.AddColumn("Date", 80, FieldValueType.Date, font);
                query.GetColumnDetail("Date").SuppressIfDuplicate = true;
                query.GetColumnDetail("Date").StringFormat        = "d";
            }
            else
            {
                query.AddColumn("DateCreated", 80, FieldValueType.Date, font);
                query.GetColumnDetail("DateCreated").SuppressIfDuplicate = true;
                query.GetColumnDetail("DateCreated").StringFormat        = "d";
                query.AddColumn("AptDate", 80, FieldValueType.Date, font);
                query.GetColumnDetail("AptDate").StringFormat = "d";
            }
            query.AddColumn("PatNum", 55, FieldValueType.String, font);
            query.AddColumn("Patient", 150, FieldValueType.String, font);
            query.AddColumn("Age", 45, FieldValueType.Age, font);
            query.AddColumn("Time", 65, FieldValueType.Date, font);
            query.GetColumnDetail("Time").StringFormat     = "t";
            query.GetColumnDetail("Time").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnHeader("Time").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Length", 45, FieldValueType.Integer, font);
            query.GetColumnHeader("Length").Location = new Point(
                query.GetColumnHeader("Length").Location.X,
                query.GetColumnHeader("Length").Location.Y);
            query.GetColumnHeader("Length").ContentAlignment = ContentAlignment.MiddleCenter;
            query.GetColumnDetail("Length").ContentAlignment = ContentAlignment.MiddleCenter;
            query.GetColumnDetail("Length").Location         = new Point(
                query.GetColumnDetail("Length").Location.X,
                query.GetColumnDetail("Length").Location.Y);
            query.AddColumn("Description", 170, FieldValueType.String, font);
            query.AddColumn("Home Ph.", 120, FieldValueType.String, font);
            query.AddColumn("Work Ph.", 120, FieldValueType.String, font);
            query.AddColumn("Cell Ph.", 120, FieldValueType.String, font);
            report.AddPageNum(font);
            report.AddGridLines();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            //FormR.MyReport=report;
            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }