コード例 #1
0
 private void FillGrid()
 {
     Operatories.Refresh();
     gridMain.BeginUpdate();
     gridMain.Rows.Clear();
     UI.ODGridRow row;
     for (int i = 0; i < Operatories.List.Length; i++)
     {
         row = new OpenDental.UI.ODGridRow();
         row.Cells.Add(Operatories.List[i].OpName);
         row.Cells.Add(Operatories.List[i].Abbrev);
         if (Operatories.List[i].IsHidden)
         {
             row.Cells.Add("X");
         }
         else
         {
             row.Cells.Add("");
         }
         row.Cells.Add(Clinics.GetDesc(Operatories.List[i].ClinicNum));
         row.Cells.Add(Providers.GetAbbr(Operatories.List[i].ProvDentist));
         row.Cells.Add(Providers.GetAbbr(Operatories.List[i].ProvHygienist));
         if (Operatories.List[i].IsHygiene)
         {
             row.Cells.Add("X");
         }
         else
         {
             row.Cells.Add("");
         }
         gridMain.Rows.Add(row);
     }
     gridMain.EndUpdate();
 }
コード例 #2
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            Operatory opCur = new Operatory();

            if (gridMain.SelectedIndices.Length > 0)          //a row is selected
            {
                opCur.ItemOrder = gridMain.SelectedIndices[0];
            }
            else
            {
                opCur.ItemOrder = Operatories.List.Length;              //goes at end of list
            }
            FormOperatoryEdit FormE = new FormOperatoryEdit(opCur);

            FormE.IsNew = true;
            FormE.ShowDialog();
            if (FormE.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (gridMain.SelectedIndices.Length > 0)
            {
                //fix the itemOrder of every Operatory following this one
                for (int i = gridMain.SelectedIndices[0]; i < Operatories.List.Length; i++)
                {
                    Operatories.List[i].ItemOrder++;
                    Operatories.InsertOrUpdate(Operatories.List[i], false);
                }
            }
            FillGrid();
            changed = true;
        }
コード例 #3
0
 private void RefreshList()
 {
     Cache.Refresh(InvalidType.Operatories);
     _listOps    = Operatories.GetDeepCopy();       //Already ordered by ItemOrder
     _listOpsOld = _listOps.Select(x => x.Copy()).ToList();
     FillGrid();
 }
コード例 #4
0
        private void FormScheduleBlockEdit_Load(object sender, System.EventArgs e)
        {
            listType.Items.Clear();
            //This list will be null if there isn't a passed in list.  We pass in lists if we want to show a special modified list.
            if (_listBlockoutCatDefs == null)
            {
                _listBlockoutCatDefs = Defs.GetDefsForCategory(DefCat.BlockoutTypes, true);
            }
            for (int i = 0; i < _listBlockoutCatDefs.Count; i++)
            {
                listType.Items.Add(_listBlockoutCatDefs[i].ItemName);
                if (_schedCur.BlockoutType == _listBlockoutCatDefs[i].DefNum)
                {
                    listType.SelectedIndex = i;
                }
            }
            if (listType.Items.Count == 0)
            {
                MsgBox.Show(this, "You must setup blockout types first in Setup-Definitions.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (listType.SelectedIndex == -1)
            {
                listType.SelectedIndex = 0;
            }
            listOp.Items.Clear();
            //Filter clinics by the clinic passed in.
            List <Operatory> listOpsShort = Operatories.GetDeepCopy(true);

            _listOps = new List <Operatory>();
            for (int i = 0; i < listOpsShort.Count; i++)
            {
                if (!PrefC.GetBool(PrefName.EasyNoClinics) && _clinicNum != 0)               //Using clinics and a clinic filter was passed in.
                {
                    if (listOpsShort[i].ClinicNum != _clinicNum)
                    {
                        continue;
                    }
                }
                listOp.Items.Add(listOpsShort[i].OpName);
                _listOps.Add(listOpsShort[i]);
                if (_schedCur.Ops.Contains(listOpsShort[i].OperatoryNum))
                {
                    listOp.SetSelected(listOp.Items.Count - 1, true);                 //Select the item that was just added.
                }
            }
            DateTime time;

            for (int i = 0; i < 24; i++)
            {
                time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i);
                comboStart.Items.Add(time.ToShortTimeString());
                comboStop.Items.Add(time.ToShortTimeString());
            }
            comboStart.Text = _schedCur.StartTime.ToShortTimeString();
            comboStop.Text  = _schedCur.StopTime.ToShortTimeString();
            textNote.Text   = _schedCur.Note;
            comboStart.Select();
        }
コード例 #5
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textOpName.Text == "")
     {
         MsgBox.Show(this, "Operatory name cannot be blank.");
         return;
     }
     if (checkIsHidden.Checked == true && Operatories.HasFutureApts(OpCur.OperatoryNum, ApptStatus.UnschedList))
     {
         MsgBox.Show(this, "Can not hide an operatory with future appointments.");
         checkIsHidden.Checked = false;
         return;
     }
     OpCur.OpName                    = textOpName.Text;
     OpCur.Abbrev                    = textAbbrev.Text;
     OpCur.IsHidden                  = checkIsHidden.Checked;
     OpCur.ClinicNum                 = _selectedClinicNum;
     OpCur.ProvDentist               = _selectedProvNum;
     OpCur.ProvHygienist             = _selectedProvHygNum;
     OpCur.IsHygiene                 = checkIsHygiene.Checked;
     OpCur.SetProspective            = checkSetProspective.Checked;
     OpCur.IsWebSched                = checkIsWebSched.Checked;
     OpCur.ListWSNPAOperatoryDefNums = _listWSNPAOperatoryDefs.Select(x => x.DefNum).ToList();
     if (IsNew)
     {
         ListOps.Insert(OpCur.ItemOrder, OpCur);               //Insert into list at appropriate spot
         for (int i = 0; i < ListOps.Count; i++)
         {
             ListOps[i].ItemOrder = i;                  //reset/correct item orders
         }
     }
     DialogResult = DialogResult.OK;
 }
コード例 #6
0
 ///<summary>Syncs _listOps and _listOpsOld after correcting the order of _listOps.</summary>
 private void ReorderAndSync()
 {
     //Renumber the itemorders to match the grid.  In most cases this will not do anything, but will fix any duplicate itemorders.
     for (int i = 0; i < _listOps.Count; i++)
     {
         _listOps[i].ItemOrder = i;
     }
     Operatories.Sync(_listOps, _listOpsOld);
 }
コード例 #7
0
        private void ButUpdateProvs_Click(object sender, EventArgs e)
        {
            if (IsNew)
            {
                MsgBox.Show(this, "Not for new operatories.");
                return;
            }
            //Check against cache. Instead of saving changes, make them get out and reopen. Safer and simpler.
            Operatory op = Operatories.GetOperatory(OpCur.OperatoryNum);

            if (op.OpName != textOpName.Text ||
                op.Abbrev != textAbbrev.Text ||
                op.IsHidden != checkIsHidden.Checked ||
                op.ClinicNum != comboClinic.SelectedClinicNum ||
                op.ProvDentist != comboProv.GetSelectedProvNum() ||
                op.ProvHygienist != comboHyg.GetSelectedProvNum() ||
                op.IsHygiene != checkIsHygiene.Checked ||
                op.SetProspective != checkSetProspective.Checked ||
                op.IsWebSched != checkIsWebSched.Checked)
            {
                MsgBox.Show(this, "Changes were detected above.  Save all changes, get completely out of the operatories window, and then re-enter.");
                return;
            }
            if (!Security.IsAuthorized(Permissions.Setup) || !Security.IsAuthorized(Permissions.AppointmentEdit))
            {
                return;
            }
            //Operatory operatory=Operatories.GetOperatory(contrApptPanel.OpNumClicked);
            if (Security.CurUser.ClinicIsRestricted && !Clinics.GetForUserod(Security.CurUser).Exists(x => x.ClinicNum == OpCur.ClinicNum))
            {
                MsgBox.Show(this, "You are restricted from accessing the clinic belonging to the selected operatory.  No changes will be made.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.YesNo,
                             "WARNING: We recommend backing up your database before running this tool.  "
                             + "This tool may take a very long time to run and should be run after hours.  "
                             + "In addition, this tool could potentially change hundreds of appointments.  "
                             + "The changes made by this tool can only be manually reversed.  "
                             + "Are you sure you want to continue?"))
            {
                return;
            }
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, Lan.g(this, "Update Provs on Future Appts tool run on operatory ") + OpCur.Abbrev + ".");
            List <Appointment> listAppts = Appointments.GetAppointmentsForOpsByPeriod(new List <long>()
            {
                OpCur.OperatoryNum
            }, DateTime.Now);                                                                                                                      //no end date, so all future
            List <Appointment> listApptsOld = new List <Appointment>();

            foreach (Appointment appt in listAppts)
            {
                listApptsOld.Add(appt.Copy());
            }
            ContrApptRef.MoveAppointments(listAppts, listApptsOld, OpCur);
            MsgBox.Show(this, "Done");
        }
コード例 #8
0
        private void FillGrid()
        {
            this.Cursor   = Cursors.WaitCursor;
            _listPatients = Patients.GetLimForPats(_listAppts.Select(x => x.PatNum).Distinct().ToList());
            gridConflicts.BeginUpdate();
            gridConflicts.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableApptConflicts", "Patient"), 140);

            gridConflicts.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptConflicts", "Date"), 120);
            gridConflicts.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptConflicts", "Op"), 110);
            gridConflicts.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptConflicts", "Prov"), 50);
            gridConflicts.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptConflicts", "Procedures"), 150);
            gridConflicts.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptConflicts", "Notes"), 200);
            gridConflicts.Columns.Add(col);
            gridConflicts.Rows.Clear();
            ODGridRow row;

            foreach (Appointment apptCur in _listAppts)
            {
                row = new ODGridRow();
                Patient patCur = _listPatients.First(x => x.PatNum == apptCur.PatNum);
                row.Cells.Add(patCur.GetNameLF());
                if (apptCur.AptDateTime.Year < 1880)                //shouldn't be possible.
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(apptCur.AptDateTime.ToShortDateString() + "  " + apptCur.AptDateTime.ToShortTimeString());
                }
                row.Cells.Add(Operatories.GetAbbrev(apptCur.Op));
                if (apptCur.IsHygiene)
                {
                    row.Cells.Add(Providers.GetAbbr(apptCur.ProvHyg));
                }
                else
                {
                    row.Cells.Add(Providers.GetAbbr(apptCur.ProvNum));
                }
                row.Cells.Add(apptCur.ProcDescript);
                row.Cells.Add(apptCur.Note);
                row.Tag = apptCur;
                gridConflicts.Rows.Add(row);
            }
            gridConflicts.EndUpdate();
            Cursor = Cursors.Default;
        }
コード例 #9
0
ファイル: FormOperatoryEdit.cs プロジェクト: nampn/ODental
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textOpName.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Op Name cannot be blank."));
         return;
     }
     OpCur.OpName   = textOpName.Text;
     OpCur.Abbrev   = textAbbrev.Text;
     OpCur.IsHidden = checkIsHidden.Checked;
     if (comboClinic.SelectedIndex == 0)         //none
     {
         OpCur.ClinicNum = 0;
     }
     else
     {
         OpCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum;
     }
     if (comboProvDentist.SelectedIndex == 0)         //none
     {
         OpCur.ProvDentist = 0;
     }
     else
     {
         OpCur.ProvDentist = ProviderC.ListShort[comboProvDentist.SelectedIndex - 1].ProvNum;
     }
     if (comboProvHygienist.SelectedIndex == 0)         //none
     {
         OpCur.ProvHygienist = 0;
     }
     else
     {
         OpCur.ProvHygienist = ProviderC.ListShort[comboProvHygienist.SelectedIndex - 1].ProvNum;
     }
     OpCur.IsHygiene      = checkIsHygiene.Checked;
     OpCur.SetProspective = checkSetProspective.Checked;
     try{
         if (IsNew)
         {
             Operatories.Insert(OpCur);
         }
         else
         {
             Operatories.Update(OpCur);
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
コード例 #10
0
        private void FillGrid()
        {
            Operatories.Refresh();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableOperatories", "Op Name"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Clinic"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Dentist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHygiene"), 72, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            UI.ODGridRow row;
            for (int i = 0; i < Operatories.List.Length; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(Operatories.List[i].OpName);
                row.Cells.Add(Operatories.List[i].Abbrev);
                if (Operatories.List[i].IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(Clinics.GetDesc(Operatories.List[i].ClinicNum));
                row.Cells.Add(Providers.GetAbbr(Operatories.List[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(Operatories.List[i].ProvHygienist));
                if (Operatories.List[i].IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #11
0
        private void FillGridWebSchedNewPatApptOps()
        {
            int opNameWidth = 150;
            int clinicWidth = 150;

            if (!PrefC.HasClinicsEnabled)
            {
                opNameWidth += clinicWidth;
            }
            gridWebSchedNewPatApptOps.BeginUpdate();
            gridWebSchedNewPatApptOps.ListGridColumns.Clear();
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Op Name"), opNameWidth));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Abbrev"), 60));
            if (PrefC.HasClinicsEnabled)
            {
                gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Clinic"), clinicWidth));
            }
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Provider"), 60));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "Hygienist"), 60));
            gridWebSchedNewPatApptOps.ListGridColumns.Add(new GridColumn(Lan.g("FormEServicesSetup", "ApptTypes"), 0));
            gridWebSchedNewPatApptOps.ListGridRows.Clear();
            //A list of all operatories that are considered for web sched new pat appt.
            List <Operatory> listWSNPAOps     = Operatories.GetOpsForWebSchedNewPatAppts();
            List <long>      listWSNPADefNums = listWSNPAOps.SelectMany(x => x.ListWSNPAOperatoryDefNums).Distinct().ToList();
            List <Def>       listWSNPADefs    = Defs.GetDefs(DefCat.WebSchedNewPatApptTypes, listWSNPADefNums);
            GridRow          row;

            foreach (Operatory op in listWSNPAOps)
            {
                row = new GridRow();
                row.Cells.Add(op.OpName);
                row.Cells.Add(op.Abbrev);
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(op.ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(op.ProvDentist));
                row.Cells.Add(Providers.GetAbbr(op.ProvHygienist));
                //Display the name of all "appointment types" (definition.ItemName) that are associated with the current operatory.
                row.Cells.Add(string.Join(", ", listWSNPADefs.Where(x => op.ListWSNPAOperatoryDefNums.Any(y => y == x.DefNum)).Select(x => x.ItemName)));
                row.Tag = op;
                gridWebSchedNewPatApptOps.ListGridRows.Add(row);
            }
            gridWebSchedNewPatApptOps.EndUpdate();
        }
コード例 #12
0
        private void FillGridWebSchedOperatories()
        {
            _listWebSchedRecallOps = Operatories.GetOpsForWebSched();
            int opNameWidth = 170;
            int clinicWidth = 80;

            if (!PrefC.HasClinicsEnabled)
            {
                opNameWidth += clinicWidth;
            }
            gridWebSchedOperatories.BeginUpdate();
            gridWebSchedOperatories.Columns.Clear();
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Op Name"), opNameWidth));
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70));
            if (PrefC.HasClinicsEnabled)
            {
                gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Clinic"), clinicWidth));
            }
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Provider"), 90));
            gridWebSchedOperatories.Columns.Add(new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 90));
            gridWebSchedOperatories.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _listWebSchedRecallOps.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_listWebSchedRecallOps[i].OpName);
                row.Cells.Add(_listWebSchedRecallOps[i].Abbrev);
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(_listWebSchedRecallOps[i].ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(_listWebSchedRecallOps[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(_listWebSchedRecallOps[i].ProvHygienist));
                gridWebSchedOperatories.Rows.Add(row);
            }
            gridWebSchedOperatories.EndUpdate();
        }
コード例 #13
0
ファイル: FormOperatories.cs プロジェクト: nampn/ODental
        private void butUp_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "You must first select a row.");
                return;
            }
            int selected = gridMain.SelectedIndices[0];

            if (selected == 0)
            {
                return;                //already at the top
            }
            //move selected item up
            OperatoryC.Listt[selected].ItemOrder--;
            Operatories.Update(OperatoryC.Listt[selected]);
            //move the one above it down
            OperatoryC.Listt[selected - 1].ItemOrder++;
            Operatories.Update(OperatoryC.Listt[selected - 1]);
            FillGrid();
            gridMain.SetSelected(selected - 1, true);
            changed = true;
        }
コード例 #14
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "You must first select a row.");
                return;
            }
            int selected = gridMain.SelectedIndices[0];

            if (selected == Operatories.List.Length - 1)
            {
                return;                //already at the bottom
            }
            //move selected item down
            Operatories.List[selected].ItemOrder++;
            Operatories.InsertOrUpdate(Operatories.List[selected], false);
            //move the one below it up
            Operatories.List[selected + 1].ItemOrder--;
            Operatories.InsertOrUpdate(Operatories.List[selected + 1], false);
            FillGrid();
            gridMain.SetSelected(selected + 1, true);
            changed = true;
        }
コード例 #15
0
        ///<summary>Offers to use unscheduled appt.  Shows ApptEdit window. Sets Prospective, if necessary.  Fires Automation triggers.  ListAptNumsSelected will contain the AptNum of the new appointment.</summary>
        public void MakeAppointment()
        {
            //Check to see if the patient has any unscheduled appointments and inform the user.
            List <Appointment> listUnschedAppts = Appointments.GetUnschedApptsForPat(_patCur.PatNum);

            //Per Nathan, pinboard appointments will not be considered unscheduled for this logic.
            listUnschedAppts.RemoveAll(x => x.AptNum.In(_listPinboardApptNums));
            FormApptEdit formApptEdit            = null;
            long         aptNum                  = 0;
            bool         isSchedulingUnscheduled = false;

            if (listUnschedAppts.Count > 0 &&
                MsgBox.Show(this, MsgBoxButtons.YesNo, "This patient has an unscheduled appointment, would you like to use an existing unscheduled appointment?"))
            {
                if (listUnschedAppts.Count == 1)
                {
                    aptNum = listUnschedAppts[0].AptNum;
                }
                else                  //Multiple unscheduled appointments, let the user pick which one to use.
                {
                    FormUnschedListPatient formUnschedListPatient = new FormUnschedListPatient(_patCur);
                    if (formUnschedListPatient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    //Use the appointment the user selected.
                    aptNum = formUnschedListPatient.SelectedAppt.AptNum;
                }
                isSchedulingUnscheduled = true;
            }
            formApptEdit       = new FormApptEdit(aptNum, patNum: _patCur.PatNum, useApptDrawingSettings: IsInitialDoubleClick, patient: _patCur, dateTNew: DateTNew, opNumNew: OpNumNew);
            formApptEdit.IsNew = (aptNum == 0);
            formApptEdit.IsSchedulingUnscheduledAppt = isSchedulingUnscheduled;
            formApptEdit.ShowDialog();
            if (formApptEdit.DialogResult != DialogResult.OK)
            {
                return;
            }
            Appointment aptCur = formApptEdit.GetAppointmentCur();

            if (IsInitialDoubleClick)
            {
                if (isSchedulingUnscheduled)                 //User double clicked in Appointment Module, intending to schedule appointment at a specific time/op/etc.
                {
                    Appointment aptOld = aptCur.Copy();
                    aptCur.AptDateTime = DateTimeClicked;
                    aptCur.Op          = OpNumClicked;
                    if (_patCur != null && _patCur.AskToArriveEarly > 0)
                    {
                        aptCur.DateTimeAskedToArrive = aptCur.AptDateTime.AddMinutes(-_patCur.AskToArriveEarly);
                    }
                    aptCur           = Appointments.AssignFieldsForOperatory(aptCur);
                    aptCur.AptStatus = ApptStatus.Scheduled;
                    Appointments.Update(aptCur, aptOld);
                }
                //Change PatStatus to Prospective or from Prospective.
                Operatory opCur = Operatories.GetOperatory(aptCur.Op);
                if (opCur != null)
                {
                    if (opCur.SetProspective && _patCur.PatStatus != PatientStatus.Prospective)                    //Don't need to prompt if patient is already prospective.
                    {
                        if (MsgBox.Show(this, MsgBoxButtons.OKCancel, "Patient's status will be set to Prospective."))
                        {
                            Patient patOld = _patCur.Copy();
                            _patCur.PatStatus = PatientStatus.Prospective;
                            Patients.Update(_patCur, patOld);
                        }
                    }
                    else if (!opCur.SetProspective && _patCur.PatStatus == PatientStatus.Prospective)
                    {
                        if (MsgBox.Show(this, MsgBoxButtons.OKCancel, "Patient's status will change from Prospective to Patient."))
                        {
                            Patient patOld = _patCur.Copy();
                            _patCur.PatStatus = PatientStatus.Patient;
                            Patients.Update(_patCur, patOld);
                        }
                    }
                }
            }
            ListAptNumsSelected.Add(aptCur.AptNum);
            if (IsInitialDoubleClick)
            {
                _otherResult = OtherResult.CreateNew;
            }
            else
            {
                _otherResult = OtherResult.NewToPinBoard;
            }
            if (aptCur.IsNewPatient)
            {
                AutomationL.Trigger(AutomationTrigger.CreateApptNewPat, null, aptCur.PatNum, aptCur.AptNum);
            }
            AutomationL.Trigger(AutomationTrigger.CreateAppt, null, aptCur.PatNum, aptCur.AptNum);
            DialogResult = DialogResult.OK;
        }
コード例 #16
0
        ///<summary>Gets (list)ForCurView, VisOps, VisProvs, and ApptRows.  Also sets TwoRows. Works even if supply -1 to indicate no apptview is selected.</summary>
        public static void GetForCurView(ApptView ApptViewCur)
        {
            ArrayList tempAL     = new ArrayList();
            ArrayList ALprov     = new ArrayList();
            ArrayList ALops      = new ArrayList();
            ArrayList ALelements = new ArrayList();

            if (ApptViewCur.ApptViewNum == 0)
            {
                //MessageBox.Show("apptcategorynum:"+ApptCategories.Cur.ApptCategoryNum.ToString());
                //make visible ops exactly the same as the short ops list (all except hidden)
                for (int i = 0; i < Operatories.ListShort.Length; i++)
                {
                    ALops.Add(i);
                }
                //make visible provs exactly the same as the prov list (all except hidden)
                for (int i = 0; i < Providers.List.Length; i++)
                {
                    ALprov.Add(i);
                }
                //Hard coded elements showing
                ALelements.Add(new ApptViewItem("PatientName", 0, Color.Black));
                ALelements.Add(new ApptViewItem("Lab", 1, Color.DarkRed));
                ALelements.Add(new ApptViewItem("Procs", 2, Color.Black));
                ALelements.Add(new ApptViewItem("Note", 3, Color.Black));
                ContrApptSheet.RowsPerIncr = 1;
            }
            else
            {
                int index;
                for (int i = 0; i < List.Length; i++)
                {
                    if (List[i].ApptViewNum == ApptViewCur.ApptViewNum)
                    {
                        tempAL.Add(List[i]);
                        if (List[i].OpNum > 0)                      //op
                        {
                            index = Operatories.GetOrder(List[i].OpNum);
                            if (index != -1)
                            {
                                ALops.Add(index);
                            }
                        }
                        else if (List[i].ProvNum > 0)                      //prov
                        {
                            index = Providers.GetIndex(List[i].ProvNum);
                            if (index != -1)
                            {
                                ALprov.Add(index);
                            }
                        }
                        else                         //element
                        {
                            ALelements.Add(List[i]);
                        }
                    }
                }
                ContrApptSheet.RowsPerIncr = ApptViewCur.RowsPerIncr;
            }
            ForCurView = new ApptViewItem[tempAL.Count];
            for (int i = 0; i < tempAL.Count; i++)
            {
                ForCurView[i] = (ApptViewItem)tempAL[i];
            }
            VisOps = new int[ALops.Count];
            for (int i = 0; i < ALops.Count; i++)
            {
                VisOps[i] = (int)ALops[i];
            }
            Array.Sort(VisOps);
            VisProvs = new int[ALprov.Count];
            for (int i = 0; i < ALprov.Count; i++)
            {
                VisProvs[i] = (int)ALprov[i];
            }
            Array.Sort(VisProvs);
            ApptRows = new ApptViewItem[ALelements.Count];
            for (int i = 0; i < ALelements.Count; i++)
            {
                ApptRows[i] = (ApptViewItem)ALelements[i];
            }
        }
コード例 #17
0
        private void FillGrid()
        {
            //do not refresh from db
            SchedList.Sort(CompareSchedule);
            graphScheduleDay.SetSchedules(SchedList);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableSchedDay", "Provider"), 100);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSchedDay", "Employee"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSchedDay", "Start Time"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSchedDay", "Stop Time"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSchedDay", "Ops"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSchedDay", "Note"), 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            string    note;
            string    opdesc;

            //string opstr;
            //string[] oparray;
            for (int i = 0; i < SchedList.Count; i++)
            {
                row = new ODGridRow();
                //Prov
                if (SchedList[i].ProvNum != 0)
                {
                    row.Cells.Add(Providers.GetAbbr(SchedList[i].ProvNum));
                }
                else
                {
                    row.Cells.Add("");
                }
                //Employee
                if (SchedList[i].EmployeeNum == 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Employees.GetEmp(SchedList[i].EmployeeNum).FName);
                }
                //times
                if (SchedList[i].StartTime == TimeSpan.Zero &&
                    SchedList[i].StopTime == TimeSpan.Zero)
                //SchedList[i].SchedType==ScheduleType.Practice){
                {
                    row.Cells.Add("");
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(SchedList[i].StartTime.ToShortTimeString());
                    row.Cells.Add(SchedList[i].StopTime.ToShortTimeString());
                }
                //ops
                opdesc = "";
                for (int o = 0; o < SchedList[i].Ops.Count; o++)
                {
                    Operatory op = Operatories.GetOperatory(SchedList[i].Ops[o]);
                    if (op.IsHidden)                     //Skip hidden operatories because it just confuses users.
                    {
                        continue;
                    }
                    if (opdesc != "")
                    {
                        opdesc += ",";
                    }
                    opdesc += op.Abbrev;
                }
                row.Cells.Add(opdesc);
                //note
                note = "";
                if (SchedList[i].Status == SchedStatus.Holiday)
                {
                    note += Lan.g(this, "Holiday: ");
                }
                note += SchedList[i].Note;
                row.Cells.Add(note);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #18
0
        private void FormScheduleEdit_Load(object sender, System.EventArgs e)
        {
            _isHolidayOrNote = (SchedCur.StartTime == TimeSpan.Zero && SchedCur.StopTime == TimeSpan.Zero);
            if (PrefC.HasClinicsEnabled)
            {
                if (ClinicNum == 0)
                {
                    Text += " - " + Lan.g(this, "Headquarters");
                }
                else
                {
                    string abbr = Clinics.GetAbbr(ClinicNum);
                    if (!string.IsNullOrWhiteSpace(abbr))
                    {
                        Text += " - " + abbr;
                    }
                }
                //if clinics are enabled and this is a holiday or practice note, set visible and fill the clinic combobox and private list of clinics
                if (_isHolidayOrNote && SchedCur.SchedType == ScheduleType.Practice)
                {
                    comboClinic.Visible = true;                  //only visible for holidays and practice notes and only if clinics are enabled
                    labelClinic.Visible = true;
                    _listClinics        = Clinics.GetForUserod(Security.CurUser);
                    if (!Security.CurUser.ClinicIsRestricted)
                    {
                        comboClinic.Items.Add(Lan.g(this, "Headquarters"));
                        if (SchedCur.ClinicNum == 0)                       //new sched and HQ selected or opened one from db for HQ
                        {
                            comboClinic.SelectedIndex = 0;
                        }
                    }
                    foreach (Clinic clinicCur in _listClinics)
                    {
                        comboClinic.Items.Add(clinicCur.Abbr);
                        if (clinicCur.ClinicNum == SchedCur.ClinicNum)
                        {
                            comboClinic.SelectedIndex = comboClinic.Items.Count - 1;
                        }
                    }
                    if (comboClinic.SelectedIndex < 0)                                                                                                 //current sched's clinic not found or set to 0 and user is restricted, default to clinic sent in
                    {
                        comboClinic.SelectedIndex = _listClinics.FindIndex(x => x.ClinicNum == ClinicNum) + (Security.CurUser.ClinicIsRestricted?0:1); //add one for HQ if not restricted
                    }
                }
            }
            textNote.Text = SchedCur.Note;
            if (_isHolidayOrNote)
            {
                comboStart.Visible = false;
                labelStart.Visible = false;
                comboStop.Visible  = false;
                labelStop.Visible  = false;
                listOps.Visible    = false;
                labelOps.Visible   = false;
                textNote.Select();
                return;
            }
            //from here on, NOT a practice note or holiday
            DateTime time;

            for (int i = 0; i < 24; i++)
            {
                time = DateTime.Today + TimeSpan.FromHours(7) + TimeSpan.FromMinutes(30 * i);
                comboStart.Items.Add(time.ToShortTimeString());
                comboStop.Items.Add(time.ToShortTimeString());
            }
            comboStart.Text = SchedCur.StartTime.ToShortTimeString();
            comboStop.Text  = SchedCur.StopTime.ToShortTimeString();
            listOps.Items.Add(Lan.g(this, "not specified"));
            //filter list if using clinics and if a clinic filter was passed in to only ops assigned to the specified clinic, otherwise all non-hidden ops
            _listOps = Operatories.GetDeepCopy(true);
            if (PrefC.HasClinicsEnabled && ClinicNum > 0)
            {
                _listOps.RemoveAll(x => x.ClinicNum != ClinicNum);
            }
            foreach (Operatory opCur in _listOps)
            {
                int curIndex = listOps.Items.Add(opCur.OpName);
                //Select the item that was just added if the schedule's Ops contains the current OpNum.
                listOps.SetSelected(curIndex, SchedCur.Ops.Contains(opCur.OperatoryNum));
            }
            listOps.SetSelected(0, listOps.SelectedIndices.Count == 0);         //select 'not specified' if no ops were selected in the loop
            comboStart.Select();
        }
コード例 #19
0
ファイル: FormLabCases.cs プロジェクト: ChemBrain/OpenDental
        private void FillGrid()
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateFrom.errorProvider1.GetError(textDateFrom) != "")
            {
                //MsgBox.Show(this,"Please fix errors first.");
                return;
            }
            DateTime dateMax = new DateTime(2100, 1, 1);

            if (textDateTo.Text != "")
            {
                dateMax = PIn.Date(textDateTo.Text);
            }
            table = LabCases.Refresh(PIn.Date(textDateFrom.Text), dateMax, checkShowAll.Checked, checkShowUnattached.Checked);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120);
            col.SortingStrategy = GridSortingStrategy.DateParse;
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Procedures"), 200);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Patient"), 120);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Status"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Lab"), 75);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Lab Phone"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCases", "Instructions"), 100);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow     row;
            List <long> operatoryNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                if (comboClinic.SelectedIndex == 0 && !Security.CurUser.ClinicIsRestricted)               //"All"
                {
                    operatoryNums = null;
                }
                else if (comboClinic.SelectedIndex == 0)               //"All" that the user has access to.
                {
                    foreach (Clinic clinic in _listClinics)
                    {
                        operatoryNums.AddRange(Operatories.GetOpsForClinic(clinic.ClinicNum).Select(x => x.OperatoryNum));
                    }
                }
                else
                {
                    operatoryNums.AddRange(Operatories.GetOpsForClinic(_listClinics[comboClinic.SelectedIndex - 1].ClinicNum).Select(x => x.OperatoryNum));
                }
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (PrefC.HasClinicsEnabled &&             //no filtering for non clinics.
                    operatoryNums != null &&                   //we don't have "All" selected for an unrestricted user.
                    table.Rows[i]["AptNum"].ToString() != "0" &&                   //show unattached for any clinic
                    !operatoryNums.Contains(PIn.Long(table.Rows[i]["OpNum"].ToString()))) //Attached appointment is scheduled in an Op for the clinic
                {
                    continue;                                                             //appointment scheduled in an operatory for another clinic.
                }
                row = new GridRow();
                row.Cells.Add(table.Rows[i]["aptDateTime"].ToString());
                row.Cells.Add(table.Rows[i]["ProcDescript"].ToString());
                row.Cells.Add(table.Rows[i]["patient"].ToString());
                row.Cells.Add(table.Rows[i]["status"].ToString());
                row.Cells.Add(table.Rows[i]["lab"].ToString());
                row.Cells.Add(table.Rows[i]["phone"].ToString());
                row.Cells.Add(table.Rows[i]["Instructions"].ToString());
                row.Tag = table.Rows[i];
                gridMain.ListGridRows.Add(row);
            }
            gridMain.AllowSortingByColumn = true;
            gridMain.EndUpdate();
        }
コード例 #20
0
        ///<summary>Gets (list)ForCurView, ApptDrawing.VisOps, ApptDrawing.VisProvs, and ApptRows.  Also sets TwoRows. Works even if supply -1 to indicate no apptview is selected.  Pass in null for the dailySched if this is a weekly view or if in FormApptViewEdit.</summary>
        public static void GetForCurView(ApptView av, bool isWeekly, List <Schedule> dailySched)
        {
            ApptViewCur          = av;
            ForCurView           = new List <ApptViewItem>();
            ApptDrawing.VisProvs = new List <Provider>();
            ApptDrawing.VisOps   = new List <Operatory>();
            ApptRows             = new List <ApptViewItem>();
            int index;

            //If there are no appointment views set up (therefore, none selected), then use a hard-coded default view.
            if (ApptViewCur == null)
            {
                //MessageBox.Show("apptcategorynum:"+ApptCategories.Cur.ApptCategoryNum.ToString());
                //make visible ops exactly the same as the short ops list (all except hidden)
                for (int i = 0; i < OperatoryC.ListShort.Count; i++)
                {
                    ApptDrawing.VisOps.Add(OperatoryC.ListShort[i]);
                }
                //make visible provs exactly the same as the prov list (all except hidden)
                for (int i = 0; i < ProviderC.ListShort.Count; i++)
                {
                    ApptDrawing.VisProvs.Add(ProviderC.ListShort[i]);
                }
                //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));
                ApptDrawing.RowsPerIncr = 1;
            }
            //An appointment view is selected, so add provs and ops from the view to our lists of indexes.
            else
            {
                for (int i = 0; i < ApptViewItemC.List.Length; i++)
                {
                    if (ApptViewItemC.List[i].ApptViewNum == ApptViewCur.ApptViewNum)
                    {
                        ForCurView.Add(ApptViewItemC.List[i]);
                        if (ApptViewItemC.List[i].OpNum > 0)                      //op
                        {
                            if (ApptViewCur.OnlyScheduledProvs && !isWeekly)
                            {
                                continue;                                //handled below
                            }
                            index = Operatories.GetOrder(ApptViewItemC.List[i].OpNum);
                            if (index != -1)
                            {
                                ApptDrawing.VisOps.Add(OperatoryC.ListShort[index]);
                            }
                        }
                        else if (ApptViewItemC.List[i].ProvNum > 0)                      //prov
                        {
                            index = Providers.GetIndex(ApptViewItemC.List[i].ProvNum);
                            if (index != -1)
                            {
                                ApptDrawing.VisProvs.Add(ProviderC.ListShort[index]);
                            }
                        }
                        else                         //element or apptfielddef
                        {
                            ApptRows.Add(ApptViewItemC.List[i]);
                        }
                    }
                }
                ApptDrawing.RowsPerIncr = ApptViewCur.RowsPerIncr;
            }
            //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 (ApptViewCur != null && ApptViewCur.OnlyScheduledProvs && !isWeekly)
            {
                //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;
                for (int i = 0; i < OperatoryC.ListShort.Count; i++)          //loop through all ops for all views (except the hidden ones, of course)
                //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] == OperatoryC.ListShort[i].OperatoryNum)
                            {
                                Operatory op = OperatoryC.ListShort[i];
                                indexOp = Operatories.GetOrder(listSchedOps[p]);
                                if (indexOp != -1 && !ApptDrawing.VisOps.Contains(op))                               //prevents adding duplicate ops
                                {
                                    ApptDrawing.VisOps.Add(op);
                                    opAdded = true;
                                    break;
                                }
                            }
                        }
                        //If the provider is not scheduled to any op(s), add their default op(s).
                        if (OperatoryC.ListShort[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 == OperatoryC.ListShort[i].ClinicNum)
                            {
                                indexOp = Operatories.GetOrder(OperatoryC.ListShort[i].OperatoryNum);
                                if (indexOp != -1 && !ApptDrawing.VisOps.Contains(OperatoryC.ListShort[i]))
                                {
                                    ApptDrawing.VisOps.Add(OperatoryC.ListShort[i]);
                                    opAdded = true;
                                }
                            }
                        }
                        if (opAdded)
                        {
                            break;                            //break out of the loop of schedules.  Continue with the next op.
                        }
                    }
                }
            }
            ApptDrawing.VisOps.Sort(CompareOps);
            ApptDrawing.VisProvs.Sort(CompareProvs);
        }
コード例 #21
0
        private void butNew_Click(object sender, System.EventArgs e)
        {
            Appointment AptCur = new Appointment();

            AptCur.PatNum = PatCur.PatNum;
            if (PatCur.DateFirstVisit.Year < 1880 &&
                !Procedures.AreAnyComplete(PatCur.PatNum))                   //this only runs if firstVisit blank
            {
                AptCur.IsNewPatient = true;
            }
            AptCur.Pattern = "/X/";
            if (PatCur.PriProv == 0)
            {
                AptCur.ProvNum = PIn.PInt(((Pref)PrefB.HList["PracticeDefaultProv"]).ValueString);
            }
            else
            {
                AptCur.ProvNum = PatCur.PriProv;
            }
            AptCur.ProvHyg   = PatCur.SecProv;
            AptCur.AptStatus = ApptStatus.Scheduled;
            AptCur.ClinicNum = PatCur.ClinicNum;
            if (InitialClick)            //initially double clicked on appt module
            {
                DateTime d;
                if (ContrApptSheet.IsWeeklyView)
                {
                    d = ContrAppt.WeekStartDate.AddDays(ContrAppt.SheetClickedonDay);
                }
                else
                {
                    d = Appointments.DateSelected;
                }
                int minutes = (int)(ContrAppt.SheetClickedonMin / ContrApptSheet.MinPerIncr) * ContrApptSheet.MinPerIncr;
                AptCur.AptDateTime = new DateTime(d.Year, d.Month, d.Day
                                                  , ContrAppt.SheetClickedonHour, minutes, 0);
                AptCur.Op = ContrAppt.SheetClickedonOp;
                Operatory curOp = Operatories.GetOperatory(AptCur.Op);
                if (curOp.ProvDentist != 0)
                {
                    AptCur.ProvNum = curOp.ProvDentist;
                }
                AptCur.ProvHyg   = curOp.ProvHygienist;
                AptCur.IsHygiene = curOp.IsHygiene;
                AptCur.ClinicNum = curOp.ClinicNum;
                try {
                    Appointments.InsertOrUpdate(AptCur, null, true);
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //new appt will be placed on pinboard instead of specific time
            }
            try{
                Appointments.InsertOrUpdate(AptCur, null, true);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FormApptEdit FormApptEdit2 = new FormApptEdit(AptCur.AptNum);

            FormApptEdit2.IsNew = true;
            FormApptEdit2.ShowDialog();
            if (FormApptEdit2.DialogResult != DialogResult.OK)
            {
                return;
            }
            AptSelected = AptCur.AptNum;
            if (InitialClick)
            {
                oResult = OtherResult.CreateNew;
            }
            else
            {
                oResult = OtherResult.NewToPinBoard;
            }
            DialogResult = DialogResult.OK;
        }
コード例 #22
0
        private void DoSearch()
        {
            Cursor = Cursors.WaitCursor;
            DateTime startDate = dateSearchFrom.Value.Date.AddDays(-1);          //Text on boxes is To/From. This will effecitvely make it the 'afterDate'.
            DateTime endDate   = dateSearchTo.Value.Date.AddDays(1);

            _listOpenings.Clear();
            #region validation
            if (startDate.Year < 1880 || endDate.Year < 1880)
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Invalid date selection.");
                return;
            }
            TimeSpan beforeTime = new TimeSpan(0);
            if (textBefore.Text != "")
            {
                try {
                    beforeTime = GetBeforeAfterTime(textBefore.Text, radioBeforePM.Checked);
                }
                catch {
                    Cursor = Cursors.Default;
                    MsgBox.Show(this, "Invalid 'Starting before' time.");
                    return;
                }
            }
            TimeSpan afterTime = new TimeSpan(0);
            if (textAfter.Text != "")
            {
                try {
                    afterTime = GetBeforeAfterTime(textAfter.Text, radioAfterPM.Checked);
                }
                catch {
                    Cursor = Cursors.Default;
                    MsgBox.Show(this, "Invalid 'Starting after' time.");
                    return;
                }
            }
            if (comboBoxMultiProv.SelectedTags <Provider>().Contains(null) && comboBlockout.GetSelectedDefNum() == 0)
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Please pick a provider or a blockout type.");
                return;
            }
            #endregion
            //get lists of info to do the search
            List <long> listOpNums     = new List <long>();
            List <long> listClinicNums = new List <long>();
            List <long> listProvNums   = new List <long>();
            long        blockoutType   = 0;
            if (comboBlockout.GetSelectedDefNum() != 0)
            {
                blockoutType = comboBlockout.GetSelectedDefNum();
                listProvNums.Add(0);                //providers don't matter for blockouts
            }
            if (!comboBoxMultiProv.SelectedTags <Provider>().Contains(null))
            {
                foreach (ODBoxItem <Provider> provBoxItem in comboBoxMultiProv.ListSelectedItems)
                {
                    listProvNums.Add(provBoxItem.Tag.ProvNum);
                }
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (comboBoxClinic.SelectedClinicNum != 0)
                {
                    listClinicNums.Add(comboBoxClinic.SelectedClinicNum);
                    listOpNums = Operatories.GetOpsForClinic(comboBoxClinic.SelectedClinicNum).Select(x => x.OperatoryNum).ToList();
                }
                else                  //HQ //and unassigned (which is clinic num 0)
                {
                    long apptViewNum = comboApptView.GetSelected <ApptView>().ApptViewNum;
                    //get the disctinct clinic nums for the operatories in the current appointment view
                    List <long>      listOpsForView  = ApptViewItems.GetOpsForView(apptViewNum);
                    List <Operatory> listOperatories = Operatories.GetOperatories(listOpsForView, true);
                    listClinicNums = listOperatories.Select(x => x.ClinicNum).Distinct().ToList();
                    listOpNums     = listOperatories.Select(x => x.OperatoryNum).ToList();
                }
            }
            else              //no clinics
            {
                listOpNums = Operatories.GetDeepCopy(true).Select(x => x.OperatoryNum).ToList();
            }
            if (blockoutType != 0 && listProvNums.Max() > 0)
            {
                _listOpenings.AddRange(ApptSearch.GetSearchResultsForBlockoutAndProvider(listProvNums, _appt.AptNum, startDate, endDate, listOpNums, listClinicNums
                                                                                         , beforeTime, afterTime, blockoutType, 15));
            }
            else
            {
                _listOpenings = ApptSearch.GetSearchResults(_appt.AptNum, startDate, endDate, listProvNums, listOpNums, listClinicNums
                                                            , beforeTime, afterTime, blockoutType, resultCount: 15);
            }
            Cursor = Cursors.Default;
            FillGrid();
        }
コード例 #23
0
 private void butCombine_Click(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.Setup))
     {
         return;
     }
     if (gridMain.SelectedIndices.Length < 2)
     {
         MsgBox.Show(this, "Please select multiple items first while holding down the control key.");
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                      "Combine all selected operatories into a single operatory?\r\n\r\n"
                      + "This will affect all appointments set in these operatories and could take a while to run.  "
                      + "The next window will let you select which operatory to keep when combining."))
     {
         return;
     }
     #region Get selected OperatoryNums
     bool hasNewOp = gridMain.SelectedIndices.ToList().Exists(x => ((Operatory)gridMain.Rows[x].Tag).IsNew);
     if (hasNewOp)
     {
         //This is needed due to the user adding an operatory then clicking combine.
         //The newly added operatory does not hava and OperatoryNum , so sync.
         ReorderAndSync();
         DataValid.SetInvalid(InvalidType.Operatories); //With sync we don't know if anything changed.
         RefreshList();                                 //Without this the user could cancel out of a prompt below and quickly close FormOperatories, causing a duplicate op from sync.
     }
     List <long> listSelectedOpNums = new List <long>();
     for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
     {
         listSelectedOpNums.Add(((Operatory)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).OperatoryNum);
     }
     #endregion
     #region Determine what Op to keep as the 'master'
     FormOperatoryPick FormOP = new FormOperatoryPick(_listOps.FindAll(x => listSelectedOpNums.Contains(x.OperatoryNum)));
     FormOP.ShowDialog();
     if (FormOP.DialogResult != DialogResult.OK)
     {
         return;
     }
     long masterOpNum = FormOP.SelectedOperatoryNum;
     #endregion
     #region Determine if any appts conflict exist and potentially show them
     //List of all appointments for all child ops. If conflict was detected the appointments OperatoryNum will bet set to -1
     List <ODTuple <Appointment, bool> > listTupleApptsToMerge = Operatories.MergeApptCheck(masterOpNum, listSelectedOpNums.FindAll(x => x != masterOpNum));
     ListConflictingAppts = listTupleApptsToMerge.Where(x => x.Item2).Select(x => x.Item1).ToList();
     List <Appointment> listApptsToMerge = listTupleApptsToMerge.Select(x => x.Item1).ToList();
     if (ListConflictingAppts.Count > 0)             //Appointments conflicts exist, can not merge
     {
         if (!MsgBox.Show(this, true, "Cannot merge operatories due to appointment conflicts.\r\n\r\n"
                          + "These conflicts need to be resolved before combining can occur.\r\n"
                          + "Click OK to view the conflicting appointments."))
         {
             ListConflictingAppts.Clear();
             return;
         }
         Close();                //Having ListConflictingAppts filled with appointments will cause outside windows that care to show the corresponding window.
         return;
     }
     #endregion
     #region Final prompt, displays number of appts to move and the 'master' ops abbr.
     int apptCount = listApptsToMerge.FindAll(x => x.Op != masterOpNum).Count;
     if (apptCount > 0)
     {
         string selectedOpName = _listOps.First(x => x.OperatoryNum == masterOpNum).Abbrev;            //Safe
         if (MessageBox.Show(Lan.g(this, "Would you like to move") + " " + apptCount + " "
                             + Lan.g(this, "appointments from their current operatories to") + " " + selectedOpName + "?\r\n\r\n"
                             + Lan.g(this, "You cannot undo this!")
                             , "WARNING"
                             , MessageBoxButtons.OKCancel) != DialogResult.OK)
         {
             return;
         }
     }
     #endregion
     //Point of no return.
     if (!hasNewOp)             //Avoids running ReorderAndSync() twice.
     //The user could have made other changes within this window, we need to make sure to save those changes before merging.
     {
         ReorderAndSync();
         DataValid.SetInvalid(InvalidType.Operatories);                //With sync we don't know if anything changed.
     }
     try {
         Operatories.MergeOperatoriesIntoMaster(masterOpNum, listSelectedOpNums, listApptsToMerge);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     MessageBox.Show(Lan.g("Operatories", "The following operatories and all of their appointments were merged into the")
                     + " " + _listOps.FirstOrDefault(x => x.OperatoryNum == masterOpNum).Abbrev + " " + Lan.g("Operatories", "operatory;") + "\r\n"
                     + string.Join(", ", _listOps.FindAll(x => x.OperatoryNum != masterOpNum && listSelectedOpNums.Contains(x.OperatoryNum)).Select(x => x.Abbrev)));
     RefreshList();
     FillGrid();
 }
コード例 #24
0
ファイル: FormOperatories.cs プロジェクト: nampn/ODental
        private void FillGrid()
        {
            Cache.Refresh(InvalidType.Operatories);
            bool neededFixing = false;

            for (int i = 0; i < OperatoryC.Listt.Count; i++)
            {
                if (OperatoryC.Listt[i].ItemOrder != i)
                {
                    OperatoryC.Listt[i].ItemOrder = i;
                    Operatories.Update(OperatoryC.Listt[i]);
                    neededFixing = true;
                }
            }
            if (neededFixing)
            {
                DataValid.SetInvalid(InvalidType.Operatories);
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableOperatories", "Op Name"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Clinic"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Dentist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHygiene"), 72, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            UI.ODGridRow row;
            for (int i = 0; i < OperatoryC.Listt.Count; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(OperatoryC.Listt[i].OpName);
                row.Cells.Add(OperatoryC.Listt[i].Abbrev);
                if (OperatoryC.Listt[i].IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(Clinics.GetDesc(OperatoryC.Listt[i].ClinicNum));
                row.Cells.Add(Providers.GetAbbr(OperatoryC.Listt[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(OperatoryC.Listt[i].ProvHygienist));
                if (OperatoryC.Listt[i].IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #25
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            int opNameWidth = 180;
            int clinicWidth = 85;

            if (!PrefC.HasClinicsEnabled)
            {
                //Clinics are hidden so add the width of the clinic column to the Op Name column because the clinic column will not show.
                opNameWidth += clinicWidth;
            }
            GridColumn col = new GridColumn(Lan.g("TableOperatories", "Op Name"), opNameWidth);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g("TableOperatories", "Clinic"), clinicWidth);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g("TableOperatories", "Provider"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsHygiene"), 64, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsWebSched"), 74, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableOperatories", "IsNewPat"), 0, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow     row;
            List <long> listWSNPAOperatoryNums = Operatories.GetOpsForWebSchedNewPatAppts().Select(x => x.OperatoryNum).ToList();

            foreach (Operatory opCur in _listOps)
            {
                row = new GridRow();
                row.Cells.Add(opCur.OpName);
                row.Cells.Add(opCur.Abbrev);
                if (opCur.IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(opCur.ClinicNum));
                }
                row.Cells.Add(Providers.GetAbbr(opCur.ProvDentist));
                row.Cells.Add(Providers.GetAbbr(opCur.ProvHygienist));
                if (opCur.IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(opCur.IsWebSched?"X":"");
                row.Cells.Add(listWSNPAOperatoryNums.Contains(opCur.OperatoryNum) ? "X" : "");
                row.Tag = opCur;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #26
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();
     }
 }
コード例 #27
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();
        }
コード例 #28
0
ファイル: AppointmentL.cs プロジェクト: royedwards/DRDNet
        /// <summary>Uses Inputs to construct a List&lt;ApptSearchOperatorySchedule&gt;. It is written to reduce the number of queries to the database.</summary>
        private static List <ApptSearchOperatorySchedule> GetAllForDate(DateTime ScheduleDate, List <Schedule> ScheduleList, List <Appointment> AppointmentList, List <ScheduleOp> ScheduleOpList, List <long> OperatoryNums, List <long> ProviderNums)
        {
            List <ApptSearchOperatorySchedule> retVal         = new List <ApptSearchOperatorySchedule>();
            List <ApptSearchOperatorySchedule> opSchedListAll = new List <ApptSearchOperatorySchedule>();
            List <Operatory> opsListAll = Operatories.GetDeepCopy();

            opsListAll.Sort(compareOpsByOpNum);                                    //sort by Operatory Num Ascending
            OperatoryNums.Sort();                                                  //Sort by operatory Num Ascending to match
            List <List <long> > opsProvPerSchedules   = new List <List <long> >(); //opsProvPerSchedules[<opIndex>][ProviderNums] based solely on schedules, lists of providers 'allowed' to work in the given operatory
            List <List <long> > opsProvPerOperatories = new List <List <long> >(); //opsProvPerSchedules[<opIndex>][ProviderNums] based solely on operatories, lists of providers 'allowed' to work in the given operatory
            List <List <long> > opsProvIntersect      = new List <List <long> >(); ////opsProvPerSchedules[<opIndex>][ProviderNums] based on the intersection of the two data sets above.

            ScheduleDate = ScheduleDate.Date;                                      //remove time component
            for (int i = 0; i < OperatoryNums.Count; i++)
            {
                opSchedListAll.Add(new ApptSearchOperatorySchedule());
                opSchedListAll[i].SchedDate      = ScheduleDate;
                opSchedListAll[i].ProviderNums   = new List <long>();
                opSchedListAll[i].OperatoryNum   = OperatoryNums[i];
                opSchedListAll[i].OperatorySched = new bool[288];
                for (int j = 0; j < 288; j++)
                {
                    opSchedListAll[i].OperatorySched[j] = true;                  //Set entire operatory schedule to true. True=available.
                }
                opsProvPerSchedules.Add(new List <long>());
                opsProvPerOperatories.Add(new List <long>());
                opsProvIntersect.Add(new List <long>());
            }
            #region fillOpSchedListAll.ProviderNums
            for (int i = 0; i < ScheduleList.Count; i++)            //use this loop to fill opsProvPerSchedules
            {
                if (ScheduleList[i].SchedDate.Date != ScheduleDate) //only schedules for the applicable day.
                {
                    continue;
                }
                int schedopsforschedule = 0;
                for (int j = 0; j < ScheduleOpList.Count; j++)
                {
                    if (ScheduleOpList[j].ScheduleNum != ScheduleList[i].ScheduleNum)                   //ScheduleOp does not apply to this schedule
                    {
                        continue;
                    }
                    schedopsforschedule++;
                    int indexofop = OperatoryNums.IndexOf(ScheduleOpList[j].OperatoryNum);                    //cache to increase speed
                    if (opsProvPerSchedules[indexofop].Contains(ScheduleList[i].ProvNum))                     //only add ones that have not been added.
                    {
                        continue;
                    }
                    opsProvPerSchedules[indexofop].Add(ScheduleList[i].ProvNum);
                }
                if (schedopsforschedule == 0)               //Provider is scheduled to work, but not limited to any specific operatory so add provider num to all operatories in opsProvPerSchedules
                {
                    for (int k = 0; k < opsProvPerSchedules.Count; k++)
                    {
                        if (opsProvPerSchedules[k].Contains(ScheduleList[i].ProvNum))
                        {
                            continue;
                        }
                        opsProvPerSchedules[k].Add(ScheduleList[i].ProvNum);
                    }
                }
            }
            for (int i = 0; i < opsListAll.Count; i++)       //use this loop to fill opsProvPerOperatories
            {
                opsProvPerOperatories[i].Add(opsListAll[i].ProvDentist);
                opsProvPerOperatories[i].Add(opsListAll[i].ProvHygienist);
            }
            for (int i = 0; i < opsProvPerSchedules.Count; i++)       //Use this loop to fill opsProvIntersect by finding matching pairs in opsProvPerSchedules and opsProvPerOperatories
            {
                for (int j = 0; j < opsProvPerSchedules[i].Count; j++)
                {
                    if (opsProvPerOperatories[i][0] == 0 && opsProvPerOperatories[i][1] == 0)                 //There are no providers set for this operatory, use all the provider nums from the schedules.
                    {
                        opsProvIntersect[i].Add(opsProvPerSchedules[i][j]);
                        opSchedListAll[i].ProviderNums.Add(opsProvPerSchedules[i][j]);
                        continue;
                    }
                    if (opsProvPerSchedules[i][j] == 0)
                    {
                        continue;                                                     //just in case a non valid prov num got through.
                    }
                    if (opsProvPerOperatories[i].Contains(opsProvPerSchedules[i][j])) //if a provider was assigned and matches
                    {
                        opsProvIntersect[i].Add(opsProvPerSchedules[i][j]);
                        opSchedListAll[i].ProviderNums.Add(opsProvPerSchedules[i][j]);
                    }
                }
            }
            #endregion fillOpSchedListAll.ProviderNums
            for (int i = 0; i < AppointmentList.Count; i++)              //use this loop to set all operatory schedules.
            {
                if (AppointmentList[i].AptDateTime.Date != ScheduleDate) //skip appointments that do not apply to this date
                {
                    continue;
                }
                if (AppointmentList[i].Op == 0)               //If the appointment isn't associated to an Op, it isn't on the schedule and won't interfere with available timeslots.
                {
                    continue;
                }
                int indexofop     = OperatoryNums.IndexOf(AppointmentList[i].Op);
                int aptstartindex = (int)AppointmentList[i].AptDateTime.TimeOfDay.TotalMinutes / 5;
                for (int j = 0; j < AppointmentList[i].Pattern.Length; j++)              //make unavailable all blocks of time during this appointment.
                {
                    opSchedListAll[indexofop].OperatorySched[aptstartindex + j] = false; //Set time block to false, meaning something is scheduled here.
                }
            }
            for (int i = 0; i < opSchedListAll.Count; i++)       //Filter out operatory schedules for ops that our selected providers don't work in.
            {
                if (retVal.Contains(opSchedListAll[i]))
                {
                    continue;
                }
                for (int j = 0; j < opSchedListAll[i].ProviderNums.Count; j++)
                {
                    if (ProviderNums.Contains(opSchedListAll[i].ProviderNums[j]))
                    {
                        retVal.Add(opSchedListAll[i]);
                        break;
                    }
                }
            }
            //For Future Use When adding third search behavior:
            //if((SearchBehaviorCriteria)PrefC.GetInt(PrefName.AppointmentSearchBehavior)==SearchBehaviorCriteria.OperatoryOnly) {
            //  return opSchedListAll;
            //}
            return(retVal);
        }
コード例 #29
0
        private void contrGrid_DoubleClick(object sender, System.EventArgs e)
        {
            int tempDay = (int)Math.Floor((double)(mousePos.X - contrGrid.NumW) / (double)contrGrid.ColW);

            if (tempDay == 7)
            {
                return;
            }
            if (tempDay == -1)
            {
                return;
            }
            int tempOpI
                = (int)Math.Floor((mousePos.X - contrGrid.NumW - (tempDay * contrGrid.ColW)) / contrGrid.opW);
            int      tempMin  = (int)((mousePos.Y - Math.Floor((double)mousePos.Y / (double)contrGrid.RowH / 6) * contrGrid.RowH * 6) / contrGrid.RowH) * 10;
            int      tempHr   = (int)Math.Floor((double)mousePos.Y / (double)contrGrid.RowH / (double)6);
            TimeSpan tempSpan = new TimeSpan(tempHr, tempMin, 0);

            //MessageBox.Show(tempDay.ToString()+","+tempHr.ToString()+":"+tempMin.ToString());
            for (int i = 0; i < SchedDefaults.List.Length; i++)
            {
                if (SchedType == ScheduleType.Practice)              //for practice
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Practice)
                    {
                        continue;                        //only use practice blocks
                    }
                }
                if (SchedType == ScheduleType.Provider)              //for providers
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Provider)
                    {
                        continue;                        //only use prov blocks
                    }
                    if (SchedDefaults.List[i].ProvNum != Providers.List[listProv.SelectedIndex].ProvNum)
                    {
                        continue;                        //only use blocks for this prov
                    }
                }
                if (SchedType == ScheduleType.Blockout)              //for blockouts
                //only use blockout blocks
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Blockout)
                    {
                        continue;
                    }
                    //if op is zero (any), then don't filter
                    if (SchedDefaults.List[i].Op != 0)
                    {
                        if (Operatories.GetOrder(SchedDefaults.List[i].Op) != tempOpI)
                        {
                            continue;
                        }
                    }
                }
                if (tempDay == SchedDefaults.List[i].DayOfWeek &&
                    tempSpan >= SchedDefaults.List[i].StartTime.TimeOfDay &&
                    tempSpan < SchedDefaults.List[i].StopTime.TimeOfDay)
                {
                    FormSchedDefaultBlockEdit FormBE = new FormSchedDefaultBlockEdit(SchedDefaults.List[i]);
                    FormBE.ShowDialog();
                    if (FormBE.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    changed = true;
                    FillGrid();
                    return;
                }
            }
        }
コード例 #30
0
ファイル: AppointmentL.cs プロジェクト: royedwards/DRDNet
        ///<summary></summary>
        public static List <DateTime> GetSearchResults(long aptNum, DateTime afterDate, List <long> providerNums, int resultCount, TimeSpan beforeTime, TimeSpan afterTime)
        {
            if (beforeTime == TimeSpan.FromSeconds(0))           //if they didn't set a before time, set it to a large timespan so that we can use the same logic for checking appointment times.
            {
                beforeTime = TimeSpan.FromHours(25);             //bigger than any time of day.
            }
            SearchBehaviorCriteria SearchType   = (SearchBehaviorCriteria)PrefC.GetInt(PrefName.AppointmentSearchBehavior);
            List <DateTime>        retVal       = new List <DateTime>();
            DateTime           dayEvaluating    = afterDate.AddDays(1);
            Appointment        appointmentToAdd = Appointments.GetOneApt(aptNum);
            List <DateTime>    potentialProvAppointmentTime;
            List <DateTime>    potentialOpAppointmentTime;
            List <Operatory>   opsListAll                          = Operatories.GetDeepCopy();                 //all operatory Numbers
            List <Schedule>    scheduleListAll                     = Schedules.GetTwoYearPeriod(dayEvaluating); // Schedules for the given day.
            List <Appointment> appointmentListAll                  = Appointments.GetForPeriodList(dayEvaluating, dayEvaluating.AddYears(2));
            List <ScheduleOp>  schedOpListAll                      = ScheduleOps.GetForSchedList(scheduleListAll);
            List <ApptSearchProviderSchedule>  provScheds          = new List <ApptSearchProviderSchedule>();  //Provider Bar, ProviderSched Bar, Date and Provider
            List <ApptSearchOperatorySchedule> operatrorySchedules = new List <ApptSearchOperatorySchedule>(); //filtered based on SearchType
            List <long> operatoryNums = new List <long>();                                                     //more usefull than a list of operatories.

            for (int i = 0; i < opsListAll.Count; i++)
            {
                operatoryNums.Add(opsListAll[i].OperatoryNum);
            }
            while (retVal.Count < resultCount && dayEvaluating < afterDate.AddYears(2))
            {
                potentialOpAppointmentTime = new List <DateTime>();               //clear or create
                //Providers-------------------------------------------------------------------------------------------------------------------------------------
                potentialProvAppointmentTime = new List <DateTime>();             //clear or create
                provScheds = Appointments.GetApptSearchProviderScheduleForProvidersAndDate(providerNums, dayEvaluating, scheduleListAll, appointmentListAll);
                for (int i = 0; i < provScheds.Count; i++)
                {
                    for (int j = 0; j < 288; j++)               //search every 5 minute increment per day
                    {
                        if (j + appointmentToAdd.Pattern.Length > 288)
                        {
                            break;
                        }
                        if (potentialProvAppointmentTime.Contains(dayEvaluating.AddMinutes(j * 5)))
                        {
                            continue;
                        }
                        bool addDateTime = true;
                        for (int k = 0; k < appointmentToAdd.Pattern.Length; k++)
                        {
                            if ((provScheds[i].ProvBar[j + k] == false && appointmentToAdd.Pattern[k] == 'X') || provScheds[i].ProvSchedule[j + k] == false)
                            {
                                addDateTime = false;
                                break;
                            }
                        }
                        if (addDateTime)
                        {
                            potentialProvAppointmentTime.Add(dayEvaluating.AddMinutes(j * 5));
                        }
                    }
                }
                if (SearchType == SearchBehaviorCriteria.ProviderTimeOperatory)               //Handle Operatories here----------------------------------------------------------------------------
                {
                    operatrorySchedules        = GetAllForDate(dayEvaluating, scheduleListAll, appointmentListAll, schedOpListAll, operatoryNums, providerNums);
                    potentialOpAppointmentTime = new List <DateTime>(); //create or clear
                    //for(int j=0;j<operatrorySchedules.Count;j++) {//for each operatory
                    for (int i = 0; i < 288; i++)                       //search every 5 minute increment per day
                    {
                        if (i + appointmentToAdd.Pattern.Length > 288)  //skip if appointment would span across midnight
                        {
                            break;
                        }
                        for (int j = 0; j < operatrorySchedules.Count; j++)                   //for each operatory
                        //if(potentialOpAppointmentTime.Contains(dayEvaluating.AddMinutes(i*5))) {//skip if we already have this dateTime
                        //  break;
                        //}
                        {
                            bool addDateTime = true;
                            for (int k = 0; k < appointmentToAdd.Pattern.Length; k++)                       //check appointment against operatories
                            {
                                if (operatrorySchedules[j].OperatorySched[i + k] == false)
                                {
                                    addDateTime = false;
                                    break;
                                }
                            }
                            if (!addDateTime)
                            {
                                continue;
                            }
                            if (addDateTime)                            // && SearchType==SearchBehaviorCriteria.ProviderTimeOperatory) {//check appointment against providers available for the given operatory
                            {
                                bool provAvail = false;
                                for (int k = 0; k < providerNums.Count; k++)
                                {
                                    if (!operatrorySchedules[j].ProviderNums.Contains(providerNums[k]))
                                    {
                                        continue;
                                    }
                                    provAvail = true;
                                    for (int m = 0; m < appointmentToAdd.Pattern.Length; m++)
                                    {
                                        if ((provScheds[k].ProvBar[i + m] == false && appointmentToAdd.Pattern[m] == 'X') || provScheds[k].ProvSchedule[i + m] == false)                               //if provider bar time slot
                                        {
                                            provAvail = false;
                                            break;
                                        }
                                    }
                                    if (provAvail)                                     //found a provider with an available operatory
                                    {
                                        break;
                                    }
                                }
                                if (provAvail && addDateTime)                                 //operatory and provider are available
                                {
                                    potentialOpAppointmentTime.Add(dayEvaluating.AddMinutes(i * 5));
                                }
                            }
                            else                              //not using SearchBehaviorCriteria.ProviderTimeOperatory
                            {
                                if (addDateTime)
                                {
                                    potentialOpAppointmentTime.Add(dayEvaluating.AddMinutes(i * 5));
                                }
                            }
                        }
                    }
                }
                //At this point the potentialOpAppointmentTime is already filtered and only contains appointment times that match both provider time and operatory time.
                switch (SearchType)
                {
                case SearchBehaviorCriteria.ProviderTime:
                    //Add based on provider bars
                    for (int i = 0; i < potentialProvAppointmentTime.Count; i++)
                    {
                        if (potentialProvAppointmentTime[i].TimeOfDay > beforeTime || potentialProvAppointmentTime[i].TimeOfDay < afterTime)
                        {
                            continue;
                        }
                        retVal.Add(potentialProvAppointmentTime[i]); //add one for this day
                        break;                                       //stop looking through potential times for today.
                    }
                    break;

                case SearchBehaviorCriteria.ProviderTimeOperatory:
                    //add based on provider bar and operatory bar
                    for (int i = 0; i < potentialOpAppointmentTime.Count; i++)
                    {
                        if (potentialOpAppointmentTime[i].TimeOfDay > beforeTime || potentialOpAppointmentTime[i].TimeOfDay < afterTime)
                        {
                            continue;
                        }
                        retVal.Add(potentialOpAppointmentTime[i]); //add one for this day
                        break;                                     //stop looking through potential times for today.
                    }
                    break;
                }
                dayEvaluating = dayEvaluating.AddDays(1);
            }
            return(retVal);
        }