Beispiel #1
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (listViews.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            if (listViews.SelectedIndex == ApptViewC.List.Length - 1)
            {
                return;                //can't go down any more
            }
            int selected = listViews.SelectedIndex;
            //it will flip flop with the one below it
            ApptView ApptViewCur = ApptViewC.List[listViews.SelectedIndex];

            ApptViewCur.ItemOrder = ApptViewCur.ItemOrder + 1;
            ApptViews.Update(ApptViewCur);
            //now the other
            ApptViewCur           = ApptViewC.List[listViews.SelectedIndex + 1];
            ApptViewCur.ItemOrder = ApptViewCur.ItemOrder - 1;
            ApptViews.Update(ApptViewCur);
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = selected + 1;
        }
Beispiel #2
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            ApptView ApptViewCur = new ApptView();

            if (_listApptViews.Count == 0)
            {
                ApptViewCur.ItemOrder = 0;
            }
            else
            {
                ApptViewCur.ItemOrder = _listApptViews[_listApptViews.Count - 1].ItemOrder + 1;
            }
            ApptViewCur.ApptTimeScrollStart = DateTime.Parse("08:00:00").TimeOfDay; //default to 8 AM
            ApptViews.Insert(ApptViewCur);                                          //this also gets the primary key
            FormApptViewEdit FormAVE = new FormApptViewEdit();

            FormAVE.ApptViewCur = ApptViewCur;
            FormAVE.IsNew       = true;
            FormAVE.ClinicNum   = _clinicNum;
            FormAVE.ShowDialog();
            if (FormAVE.DialogResult != DialogResult.OK)
            {
                return;
            }
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = listViews.Items.Count - 1;        //this works even if no items
        }
Beispiel #3
0
        private void FillViewList()
        {
            Cache.Refresh(InvalidType.Views);
            listViews.Items.Clear();
            _listApptViews = new List <ApptView>();
            List <ApptView> listApptViewsTemp = ApptViews.GetDeepCopy();
            string          F;

            for (int i = 0; i < listApptViewsTemp.Count; i++)
            {
                if (PrefC.HasClinicsEnabled && _clinicNum != listApptViewsTemp[i].ClinicNum)
                {
                    continue;                    //only add views assigned to the clinic selected
                }
                if (listViews.Items.Count < 12)
                {
                    F = "F" + (listViews.Items.Count + 1).ToString() + "-";
                }
                else
                {
                    F = "";
                }
                listViews.Items.Add(F + listApptViewsTemp[i].Description);
                _listApptViews.Add(listApptViewsTemp[i]);
            }
        }
Beispiel #4
0
 private void FormApptViewEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         ApptViewItems.DeleteAllForView(ApptViewCur);
         ApptViews.Delete(ApptViewCur);
     }
 }
Beispiel #5
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     //this does mess up the item orders a little, but missing numbers don't actually hurt anything.
     if (MessageBox.Show(Lan.g(this, "Delete this category?"), "", MessageBoxButtons.OKCancel)
         != DialogResult.OK)
     {
         return;
     }
     ApptViewItems.DeleteAllForView(ApptViewCur);
     ApptViews.Delete(ApptViewCur);
     DialogResult = DialogResult.OK;
 }
Beispiel #6
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (listOps.SelectedIndices.Count == 0 || listProv.SelectedIndices.Count == 0)
     {
         MessageBox.Show(Lan.g(this, "At least one operatory and one provider must be selected."));
         return;
     }
     if (textDescription.Text == "")
     {
         MessageBox.Show(Lan.g(this, "A description must be entered."));
         return;
     }
     if (displayedElements.Count == 0)
     {
         MessageBox.Show(Lan.g(this, "At least one row type must be displayed."));
         return;
     }
     ApptViewItems.DeleteAllForView(ApptViewCur);            //start with a clean slate
     for (int i = 0; i < Operatories.ListShort.Length; i++)
     {
         if (listOps.SelectedIndices.Contains(i))
         {
             ApptViewItem ApptViewItemCur = new ApptViewItem();
             ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum;
             ApptViewItemCur.OpNum       = Operatories.ListShort[i].OperatoryNum;
             ApptViewItems.Insert(ApptViewItemCur);
         }
     }
     for (int i = 0; i < Providers.List.Length; i++)
     {
         if (listProv.SelectedIndices.Contains(i))
         {
             ApptViewItem ApptViewItemCur = new ApptViewItem();
             ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum;
             ApptViewItemCur.ProvNum     = Providers.List[i].ProvNum;
             ApptViewItems.Insert(ApptViewItemCur);
         }
     }
     for (int i = 0; i < displayedElements.Count; i++)
     {
         ApptViewItem ApptViewItemCur = (ApptViewItem)displayedElements[i];
         ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum;
         //elementDesc and elementColor already handled.
         ApptViewItemCur.ElementOrder = i;
         ApptViewItems.Insert(ApptViewItemCur);
     }
     ApptViewCur.Description = textDescription.Text;
     ApptViewCur.RowsPerIncr = PIn.PInt(textRowsPerIncr.Text);
     ApptViews.Update(ApptViewCur);            //same whether isnew or not
     DialogResult = DialogResult.OK;
 }
Beispiel #7
0
        ///<summary>Only fill appt views when clinic is HQ. </summary>
        private void FillApptViews()
        {
            if (!PrefC.HasClinicsEnabled || comboBoxClinic.SelectedClinicNum > 0)
            {
                return;                //Either clinics are enabled and we're on a sepecific clinic OR clinics are not enabled. In either case don't fill appt views.
            }
            List <ApptView> listApptViews = ApptViews.GetForClinic(comboBoxClinic.SelectedClinicNum);

            comboApptView.Items.Clear();
            foreach (ApptView view in listApptViews)
            {
                comboApptView.Items.Add(view.Description, view);
            }
            if (listApptViews.Count != 0)           //default to the first
            {
                comboApptView.SelectedIndex = 0;
            }
        }
Beispiel #8
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            ApptView ApptViewCur = new ApptView();

            ApptViewCur.ItemOrder = ApptViewC.List.Length;
            ApptViews.Insert(ApptViewCur);            //this also gets the primary key
            FormApptViewEdit FormAVE = new FormApptViewEdit();

            FormAVE.ApptViewCur = ApptViewCur;
            FormAVE.IsNew       = true;
            FormAVE.ShowDialog();
            if (FormAVE.DialogResult != DialogResult.OK)
            {
                return;
            }
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = listViews.Items.Count - 1;        //this works even if no items
        }
        private void FillViewList()
        {
            ApptViews.Refresh();
            ApptViewItems.Refresh();
            listViews.Items.Clear();
            string F;

            for (int i = 0; i < ApptViews.List.Length; i++)
            {
                if (i < 12)
                {
                    F = "F" + (i + 1).ToString() + "-";
                }
                else
                {
                    F = "";
                }
                listViews.Items.Add(F + ApptViews.List[i].Description);
            }
        }
Beispiel #10
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (listViews.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            if (listViews.SelectedIndex == listViews.Items.Count - 1)
            {
                return;                //can't go down any more
            }
            //it will flip flop with the one below it
            ApptView ApptViewCur = _listApptViews[listViews.SelectedIndex + 1];

            ApptViewCur.ItemOrder = listViews.SelectedIndex;
            ApptViews.Update(ApptViewCur);
            //now the other
            ApptViewCur           = _listApptViews[listViews.SelectedIndex];
            ApptViewCur.ItemOrder = listViews.SelectedIndex + 1;
            ApptViews.Update(ApptViewCur);
            viewChanged = true;
            FillViewList();
            listViews.SelectedIndex = _listApptViews.FindIndex(x => x.ApptViewNum == ApptViewCur.ApptViewNum);
        }
Beispiel #11
0
 ///<summary>Fills visProvs, visOps, forCurView, apptRows, and rowsPerIncr based on the appointment view passed in and whether it is for the week view or not.  This method uses 'out' variables so that the encompassing logic doesn't ALWAYS affect the global static variables used to draw the appointment views.  We don't want the following logic to affect the global static variables in the case where we are trying to get information needed to filter the waiting room.</summary>
 public static void FillForApptView(bool isWeekly, ApptView apptViewCur, out List <Provider> visProvs, out List <Operatory> visOps,
                                    out List <ApptViewItem> forCurView, out List <ApptViewItem> apptRows, out int rowsPerIncr, bool isFillVisProvs = true)
 {
     forCurView = new List <ApptViewItem>();
     visProvs   = new List <Provider>();
     visOps     = new List <Operatory>();
     apptRows   = new List <ApptViewItem>();
     //If there are no appointment views set up (therefore, none selected), then use a hard-coded default view.
     if (ApptViews.IsNoneView(apptViewCur))
     {
         //make visible ops exactly the same as the short ops list (all except hidden)
         visOps.AddRange(
             Operatories.GetWhere(x => !PrefC.HasClinicsEnabled ||                  //if clinics disabled
                                  Clinics.ClinicNum == 0 ||              //or if program level ClinicNum set to Headquarters
                                  x.ClinicNum == Clinics.ClinicNum                 //or this is the program level ClinicNum
                                  , true)
             );
         if (isFillVisProvs)
         {
             if (PrefC.HasClinicsEnabled)
             {
                 foreach (Operatory op in visOps)
                 {
                     Provider provDent = Providers.GetProv(op.ProvDentist);
                     Provider provHyg  = Providers.GetProv(op.ProvHygienist);
                     if (provDent != null)
                     {
                         visProvs.Add(provDent);
                     }
                     if (provHyg != null)
                     {
                         visProvs.Add(provHyg);
                     }
                 }
             }
             else
             {
                 //make visible provs exactly the same as the prov list (all except hidden)
                 visProvs.AddRange(Providers.GetDeepCopy(true));
             }
         }
         //Hard coded elements showing
         apptRows.Add(new ApptViewItem("PatientName", 0, Color.Black));
         apptRows.Add(new ApptViewItem("ASAP", 1, Color.DarkRed));
         apptRows.Add(new ApptViewItem("MedUrgNote", 2, Color.DarkRed));
         apptRows.Add(new ApptViewItem("PremedFlag", 3, Color.DarkRed));
         apptRows.Add(new ApptViewItem("Lab", 4, Color.DarkRed));
         apptRows.Add(new ApptViewItem("Procs", 5, Color.Black));
         apptRows.Add(new ApptViewItem("Note", 6, Color.Black));
         rowsPerIncr = 1;
     }
     //An appointment view is selected, so add provs and ops from the view to our lists of indexes.
     else
     {
         List <ApptViewItem> listApptViewItems = ApptViewItems.GetWhere(x => x.ApptViewNum == apptViewCur.ApptViewNum);
         for (int i = 0; i < listApptViewItems.Count; i++)
         {
             forCurView.Add(listApptViewItems[i]);
             if (listApptViewItems[i].OpNum > 0)                   //op
             {
                 if (apptViewCur.OnlyScheduledProvs && !isWeekly)
                 {
                     continue;                            //handled below in AddOpsForScheduledProvs
                 }
                 Operatory op = Operatories.GetFirstOrDefault(x => x.OperatoryNum == listApptViewItems[i].OpNum, true);
                 if (op != null)
                 {
                     visOps.Add(op);
                 }
             }
             else if (listApptViewItems[i].ProvNum > 0)                   //prov
             {
                 if (!isFillVisProvs)
                 {
                     continue;
                 }
                 Provider prov = Providers.GetFirstOrDefault(x => x.ProvNum == listApptViewItems[i].ProvNum, true);
                 if (prov != null)
                 {
                     visProvs.Add(prov);
                 }
             }
             else                      //element or apptfielddef
             {
                 apptRows.Add(listApptViewItems[i]);
             }
         }
         rowsPerIncr = apptViewCur.RowsPerIncr;
     }
     //Remove any duplicates before return.
     visOps = visOps.GroupBy(x => x.OperatoryNum).Select(x => x.First()).ToList();
     if (isFillVisProvs)
     {
         visProvs = visProvs.GroupBy(x => x.ProvNum).Select(x => x.First()).ToList();
     }
 }
Beispiel #12
0
        ///<summary>When looking at a daily appointment module and the current appointment view is has 'OnlyScheduleProvs' turned on, this method will dynamically add additional operatories to visOps for providers that are scheduled to work.</summary>
        public static void AddOpsForScheduledProvs(bool isWeekly, List <Schedule> dailySched, ApptView apptViewCur, ref List <Operatory> visOps)
        {
            //if this appt view has the option to show only scheduled providers and this is daily view.
            //Remember that there is no intelligence in weekly view for this option, and it behaves just like it always did.
            if (ApptViews.IsNoneView(apptViewCur) ||
                dailySched == null ||
                visOps == null ||
                !apptViewCur.OnlyScheduledProvs ||
                isWeekly)
            {
                return;
            }
            //intelligently decide what ops to show.  It's based on the schedule for the day.
            //visOps will be totally empty right now because it looped out of the above section of code.
            List <long>      listSchedOps;
            bool             opAdded;
            int              indexOp;
            List <Operatory> listOpsShort       = Operatories.GetDeepCopy(true);
            List <long>      listApptViewOpNums = ApptViewItems.GetOpsForView(apptViewCur.ApptViewNum);

            for (int i = 0; i < listOpsShort.Count; i++)       //loop through all ops for all views (except the hidden ones, of course)
            //If this operatory was not one of the selected Ops from the Appt View Edit window, skip it.
            {
                if (!listApptViewOpNums.Contains(listOpsShort[i].OperatoryNum))
                {
                    continue;
                }
                //find any applicable sched for the op
                opAdded = false;
                for (int s = 0; s < dailySched.Count; s++)
                {
                    if (dailySched[s].SchedType != ScheduleType.Provider)
                    {
                        continue;
                    }
                    if (dailySched[s].StartTime == new TimeSpan(0))                   //skip if block starts at midnight.
                    {
                        continue;
                    }
                    if (dailySched[s].StartTime == dailySched[s].StopTime)                   //skip if block has no length.
                    {
                        continue;
                    }
                    if (apptViewCur.OnlySchedAfterTime > new TimeSpan(0, 0, 0))
                    {
                        if (dailySched[s].StartTime < apptViewCur.OnlySchedAfterTime ||
                            dailySched[s].StopTime < apptViewCur.OnlySchedAfterTime)
                        {
                            continue;
                        }
                    }
                    if (apptViewCur.OnlySchedBeforeTime > new TimeSpan(0, 0, 0))
                    {
                        if (dailySched[s].StartTime > apptViewCur.OnlySchedBeforeTime ||
                            dailySched[s].StopTime > apptViewCur.OnlySchedBeforeTime)
                        {
                            continue;
                        }
                    }
                    //this 'sched' must apply to this situation.
                    //listSchedOps is the ops for this 'sched'.
                    listSchedOps = dailySched[s].Ops;
                    //Add all the ops for this 'sched' to the list of visible ops
                    for (int p = 0; p < listSchedOps.Count; p++)
                    {
                        //Filter the ops if the clinic option was set for the appt view.
                        if (apptViewCur.ClinicNum > 0 && apptViewCur.ClinicNum != Operatories.GetOperatory(listSchedOps[p]).ClinicNum)
                        {
                            continue;
                        }
                        if (listSchedOps[p] == listOpsShort[i].OperatoryNum)
                        {
                            Operatory op = listOpsShort[i];
                            indexOp = Operatories.GetOrder(listSchedOps[p]);
                            if (indexOp != -1 && !visOps.Contains(op))                           //prevents adding duplicate ops
                            {
                                visOps.Add(op);
                                opAdded = true;
                                break;
                            }
                        }
                    }
                    //If the provider is not scheduled to any op(s), add their default op(s).
                    if (listOpsShort[i].ProvDentist == dailySched[s].ProvNum && listSchedOps.Count == 0)                 //only if the sched does not specify any ops
                    //Only add the op if the clinic option was not set in the appt view or if the op is assigned to that clinic.
                    {
                        if (apptViewCur.ClinicNum == 0 || apptViewCur.ClinicNum == listOpsShort[i].ClinicNum)
                        {
                            indexOp = Operatories.GetOrder(listOpsShort[i].OperatoryNum);
                            if (indexOp != -1 && !visOps.Contains(listOpsShort[i]))
                            {
                                visOps.Add(listOpsShort[i]);
                                opAdded = true;
                            }
                        }
                    }
                    if (opAdded)
                    {
                        break;                        //break out of the loop of schedules.  Continue with the next op.
                    }
                }
            }
            //Remove any duplicates before return.
            visOps = visOps.GroupBy(x => x.OperatoryNum).Select(x => x.First()).ToList();
        }