Ejemplo n.º 1
0
        private void SendPinboard_Click()
        {
            if (grid.SelectedIndices.Length == 0)
            {
                MsgBox.Show("Please select an appointment first.");
                return;
            }
            _listAptSelected.Clear();
            int patsRestricted = 0;

            for (int i = 0; i < grid.SelectedIndices.Length; i++)
            {
                if (PatRestrictionL.IsRestricted(_listUnschedApt[grid.SelectedIndices[i]].PatNum, PatRestrict.ApptSchedule, true))
                {
                    patsRestricted++;
                    continue;
                }
                _listAptSelected.Add(_listUnschedApt[grid.SelectedIndices[i]].AptNum);
            }
            if (patsRestricted > 0)
            {
                if (_listAptSelected.Count == 0)
                {
                    MsgBox.Show("All selected appointments have been skipped due to patient restriction "
                                + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule) + ".");
                    return;
                }
                MessageBox.Show("Appointments skipped due to patient restriction " + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule)
                                + ": " + patsRestricted + ".");
            }
            GotoModule.PinToAppt(_listAptSelected, 0);           //This will send all appointments in _listAptSelected to the pinboard, and will select the patient attached to the last appointment in _listAptSelected.
        }
Ejemplo n.º 2
0
 public static bool ValidateApptUnsched(Appointment appt)
 {
     if ((appt.AptStatus != ApptStatus.Complete && !Security.IsAuthorized(Permissions.AppointmentMove)) ||       //seperate permissions for complete appts.
         (appt.AptStatus == ApptStatus.Complete && !Security.IsAuthorized(Permissions.AppointmentCompleteEdit)))
     {
         return(false);
     }
     if (PatRestrictionL.IsRestricted(appt.PatNum, PatRestrict.ApptSchedule))
     {
         return(false);
     }
     if (appt.AptStatus == ApptStatus.PtNote | appt.AptStatus == ApptStatus.PtNoteCompleted)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 public static bool ValidateApptToPinboard(Appointment appt)
 {
     if (!Security.IsAuthorized(Permissions.AppointmentMove))
     {
         return(false);
     }
     if (appt.AptStatus == ApptStatus.Complete)
     {
         MsgBox.Show("Appointments", "Not allowed to move completed appointments.");
         return(false);
     }
     if (PatRestrictionL.IsRestricted(appt.PatNum, PatRestrict.ApptSchedule))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 4
0
 private void butPin_Click(object sender, System.EventArgs e)
 {
     if (odApptGrid.SelectedApptOther == null)
     {
         MsgBox.Show(this, "Please select appointment first.");
         return;
     }
     if (odApptGrid.IsSelectedApptOtherNull())
     {
         return;
     }
     if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
     {
         return;
     }
     if (!AppointmentL.OKtoSendToPinboard(odApptGrid.SelectedApptOther, odApptGrid.ListApptOthers, this))           //Tag is AptNum
     {
         return;
     }
     ListAptNumsSelected.Add(odApptGrid.SelectedApptOther.AptNum);
     _otherResult = OtherResult.CopyToPinBoard;
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 5
0
 private void butNew_Click(object sender, System.EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.AppointmentCreate))
     {
         return;
     }
     if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
     {
         return;
     }
     if (AppointmentL.PromptForMerge(_patCur, out _patCur))
     {
         FillFamily();
         odApptGrid.PatCur = _patCur;
         odApptGrid.RefreshAppts();
         FormOpenDental.S_Contr_PatientSelected(_patCur, true, false);
     }
     if (_patCur != null && _patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
     {
         MsgBox.Show(this, "Appointments cannot be scheduled for " + _patCur.PatStatus.ToString().ToLower() + " patients.");
         return;
     }
     MakeAppointment();
 }
Ejemplo n.º 6
0
        private void butNote_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.AppointmentCreate))
            {
                return;
            }
            if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
            {
                return;
            }
            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 = PrefC.GetLong(PrefName.PracticeDefaultProv);
            }
            else
            {
                aptCur.ProvNum = _patCur.PriProv;
            }
            aptCur.ProvHyg    = _patCur.SecProv;
            aptCur.AptStatus  = ApptStatus.PtNote;
            aptCur.ClinicNum  = _patCur.ClinicNum;
            aptCur.TimeLocked = PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
            if (IsInitialDoubleClick)             //initially double clicked on appt module
            {
                aptCur.AptDateTime = DateTimeClicked;
                aptCur.Op          = OpNumClicked;
            }
            else
            {
                //new appt will be placed on pinboard instead of specific time
            }
            try {
                if (!AppointmentL.IsSpecialtyMismatchAllowed(_patCur.PatNum, aptCur.ClinicNum))
                {
                    return;
                }
                Appointments.Insert(aptCur);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FormApptEdit formApptEdit = new FormApptEdit(aptCur.AptNum);

            formApptEdit.IsNew = true;
            formApptEdit.ShowDialog();
            if (formApptEdit.DialogResult != DialogResult.OK)
            {
                return;
            }
            ListAptNumsSelected.Add(aptCur.AptNum);
            if (IsInitialDoubleClick)
            {
                _otherResult = OtherResult.CreateNew;
            }
            else
            {
                _otherResult = OtherResult.NewToPinBoard;
            }
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 7
0
        ///<summary>Creates appointments for each patient in _famCur.  MsgBox informs user of anyone skipped.  StringDateJumpTo will contain the due date (of the last family member) to jump to.  ListAptNumsSelected will contain the AptNums of the new appointments on the pinboard.</summary>
        public void MakeRecallFamily()
        {
            List <Recall>  listPatRecalls;
            List <InsPlan> listInsPlans;
            List <InsSub>  listInsSubs;
            Appointment    apt = null;
            Recall         recall;
            int            countAlreadySched           = 0;
            int            countNoRecalls              = 0;
            int            countPatsRestricted         = 0;
            int            countPatsArchivedOrDeceased = 0;

            for (int i = 0; i < _famCur.ListPats.Length; i++)
            {
                Patient patCur = _famCur.ListPats[i];
                if (PatRestrictionL.IsRestricted(patCur.PatNum, PatRestrict.ApptSchedule, true))
                {
                    countPatsRestricted++;
                    continue;
                }
                if (patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
                {
                    countPatsArchivedOrDeceased++;
                    continue;
                }
                listPatRecalls = Recalls.GetList(patCur.PatNum);              //get the recall for this pt
                //Check to see if the special type recall is disabled or already scheduled.  This is also done in AppointmentL.CreateRecallApt() below so I'm
                //	not sure why we do it here.
                List <Recall> listRecalls = listPatRecalls.FindAll(x => x.RecallTypeNum == RecallTypes.PerioType || x.RecallTypeNum == RecallTypes.ProphyType);
                if (listRecalls.Count == 0 || listRecalls.Exists(x => x.IsDisabled))
                {
                    countNoRecalls++;
                    continue;
                }
                if (listRecalls.Exists(x => x.DateScheduled.Year > 1880))
                {
                    countAlreadySched++;
                    continue;
                }
                listInsSubs  = InsSubs.RefreshForFam(_famCur);
                listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
                try {
                    apt = AppointmentL.CreateRecallApt(patCur, listInsPlans, -1, listInsSubs);
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    continue;
                }
                ListAptNumsSelected.Add(apt.AptNum);
                _otherResult = OtherResult.PinboardAndSearch;
                recall       = Recalls.GetRecallProphyOrPerio(patCur.PatNum);        //should not return null
                if (recall.DateDue < DateTime.Today)
                {
                    StringDateJumpTo = DateTime.Today.ToShortDateString();                  //they are overdue
                }
                else
                {
                    StringDateJumpTo = recall.DateDue.ToShortDateString();
                }
                //Log will be made when appointment dragged off of the pinboard.
                //SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate,apt.PatNum,apt.AptDateTime.ToString(),apt.AptNum);
            }
            List <string> listUserMsgs = new List <string>();

            if (countPatsRestricted > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped due to patient restriction") + " "
                                 + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule) + ": " + countPatsRestricted + ".");
            }
            if (countNoRecalls > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because recall disabled") + ": " + countNoRecalls + ".");
            }
            if (countAlreadySched > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because already scheduled") + ": " + countAlreadySched + ".");
            }
            if (countPatsArchivedOrDeceased > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because status is archived or deceased") + ": " + countPatsArchivedOrDeceased + ".");
            }
            if (ListAptNumsSelected.Count == 0)
            {
                listUserMsgs.Add(Lan.g(this, "There are no recall appointments to schedule."));
            }
            if (listUserMsgs.Count > 0)
            {
                MessageBox.Show(string.Join("\r\n", listUserMsgs));
                if (ListAptNumsSelected.Count == 0)
                {
                    return;
                }
            }
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 8
0
        ///<summary></summary>
        public static PlannedApptStatus CreatePlannedAppt(Patient pat, int itemOrder, List <long> listPreSelectedProcNums = null)
        {
            if (!Security.IsAuthorized(Permissions.AppointmentCreate))
            {
                return(PlannedApptStatus.Failure);
            }
            if (PatRestrictionL.IsRestricted(pat.PatNum, PatRestrict.ApptSchedule))
            {
                return(PlannedApptStatus.Failure);
            }
            if (PromptForMerge(pat, out pat))
            {
                FormOpenDental.S_Contr_PatientSelected(pat, true, false);
            }
            if (pat.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
            {
                MsgBox.Show("Appointments", "Appointments cannot be scheduled for " + pat.PatStatus.ToString().ToLower() + " patients.");
                return(PlannedApptStatus.Failure);
            }
            Appointment AptCur = new Appointment();

            AptCur.PatNum      = pat.PatNum;
            AptCur.ProvNum     = pat.PriProv;
            AptCur.ClinicNum   = pat.ClinicNum;
            AptCur.AptStatus   = ApptStatus.Planned;
            AptCur.AptDateTime = DateTimeOD.Today;
            List <Procedure> listProcs = Procedures.GetManyProc(listPreSelectedProcNums, false);        //Returns empty list if null.

            //If listProcs is empty then AptCur.Pattern defaults to PrefName.AppointmentWithoutProcsDefaultLength value.
            //See Appointments.GetApptTimePatternForNoProcs().
            AptCur.Pattern    = Appointments.CalculatePattern(pat, AptCur.ProvNum, AptCur.ProvHyg, listProcs, isMake5Minute: true);
            AptCur.TimeLocked = PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
            Appointments.Insert(AptCur);
            PlannedAppt plannedAppt = new PlannedAppt();

            plannedAppt.AptNum    = AptCur.AptNum;
            plannedAppt.PatNum    = pat.PatNum;
            plannedAppt.ItemOrder = itemOrder;
            PlannedAppts.Insert(plannedAppt);
            Procedures.UpdateAptNums(listPreSelectedProcNums, plannedAppt.AptNum, true);          //Simply returns if listPreSelectedProcNums is null
            FormApptEdit FormApptEdit = new FormApptEdit(AptCur.AptNum);

            FormApptEdit.IsNew = true;
            FormApptEdit.ShowDialog();
            if (FormApptEdit.DialogResult != DialogResult.OK)
            {
                Procedures.UpdateAptNums(listPreSelectedProcNums, 0, true);              //Simply returns if listPreSelectedProcNums is null
                return(PlannedApptStatus.FillGridNeeded);
            }
            //Only set the appointment hygienist to this patient's secondary provider if one was not manually set within the edit window.
            if (AptCur.ProvHyg < 1)
            {
                List <Procedure> myProcList  = Procedures.GetProcsForSingle(AptCur.AptNum, true);
                bool             allProcsHyg = (myProcList.Count > 0 && myProcList.Select(x => ProcedureCodes.GetProcCode(x.CodeNum)).ToList().All(x => x.IsHygiene));
                //Automatically set the appointments hygienist to the secondary provider of the patient if one is set.
                if (allProcsHyg && pat.SecProv != 0)
                {
                    Appointment aptOld = AptCur.Copy();
                    AptCur.ProvNum = pat.SecProv;
                    Appointments.Update(AptCur, aptOld);
                }
            }
            Patient patOld = pat.Copy();

            pat.PlannedIsDone = false;
            Patients.Update(pat, patOld);
            FormOpenDental.S_RefreshCurrentModule(isClinicRefresh: false);           //if procs were added in appt, then this will display them
            return(PlannedApptStatus.Success);
        }