private void comboStatus_SelectionChangeCommitted(object sender, System.EventArgs e) { if (grid.SelectedIndices.Length == 0) { return; //because user could never initiate this action. } Appointment apt; Cursor = Cursors.WaitCursor; int[] selectedApts = new int[grid.SelectedIndices.Length]; for (int i = 0; i < grid.SelectedIndices.Length; i++) { selectedApts[i] = PIn.PInt(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()); } for (int i = 0; i < grid.SelectedIndices.Length; i++) { apt = Appointments.GetOneApt(PIn.PInt(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString())); Appointment aptOld = apt.Copy(); int selectedI = comboStatus.SelectedIndex; apt.Confirmed = DefB.Short[(int)DefCat.ApptConfirmed][selectedI].DefNum; try{ Appointments.InsertOrUpdate(apt, aptOld, false); } catch (ApplicationException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); return; } } FillMain(); //reselect all the apts for (int i = 0; i < table.Rows.Count; i++) { for (int j = 0; j < selectedApts.Length; j++) { if (PIn.PInt(table.Rows[i]["AptNum"].ToString()) == selectedApts[j]) { grid.SetSelected(i, true); } } } SetFamilyColors(); comboStatus.SelectedIndex = -1; Cursor = Cursors.Default; }
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; }
///<summary>Used by UI when it needs a recall appointment placed on the pinboard ready to schedule. This method creates the appointment and attaches all appropriate procedures. It's up to the calling class to then place the appointment on the pinboard. If the appointment doesn't get scheduled, it's important to delete it.</summary> public static Appointment CreateRecallApt(Patient patCur, Procedure[] procList, Recall recallCur, InsPlan[] planList) { Appointment AptCur = new Appointment(); AptCur.PatNum = patCur.PatNum; AptCur.AptStatus = ApptStatus.Scheduled; //convert time pattern to 5 minute increment StringBuilder savePattern = new StringBuilder(); for (int i = 0; i < PrefB.GetString("RecallPattern").Length; i++) { savePattern.Append(PrefB.GetString("RecallPattern").Substring(i, 1)); savePattern.Append(PrefB.GetString("RecallPattern").Substring(i, 1)); if (PrefB.GetInt("AppointmentTimeIncrement") == 15) { savePattern.Append(PrefB.GetString("RecallPattern").Substring(i, 1)); } } AptCur.Pattern = savePattern.ToString(); if (patCur.PriProv == 0) { AptCur.ProvNum = PrefB.GetInt("PracticeDefaultProv"); } else { AptCur.ProvNum = patCur.PriProv; } AptCur.ProvHyg = patCur.SecProv; if (AptCur.ProvHyg != 0) { AptCur.IsHygiene = true; } AptCur.ClinicNum = patCur.ClinicNum; string[] procs = PrefB.GetString("RecallProcedures").Split(','); if (PrefB.GetString("RecallBW") != "") //BWs { bool dueBW = true; //DateTime dueDate=PIn.PDate(listFamily.Items[ for (int i = 0; i < procList.Length; i++) //loop through all procedures for this pt. //if any BW found within last year, then dueBW=false. { if (PrefB.GetString("RecallBW") == procList[i].ADACode && recallCur.DateDue.Year > 1880 && procList[i].ProcDate > recallCur.DateDue.AddYears(-1)) { dueBW = false; } } if (dueBW) { string[] procs2 = new string[procs.Length + 1]; procs.CopyTo(procs2, 0); procs2[procs2.Length - 1] = PrefB.GetString("RecallBW"); procs = new string[procs2.Length]; procs2.CopyTo(procs, 0); } } AptCur.ProcDescript = ""; for (int i = 0; i < procs.Length; i++) { if (i > 0) { AptCur.ProcDescript += ", "; } AptCur.ProcDescript += ProcedureCodes.GetProcCode(procs[i]).AbbrDesc; } Appointments.InsertOrUpdate(AptCur, null, true); Procedure ProcCur; PatPlan[] patPlanList = PatPlans.Refresh(patCur.PatNum); Benefit[] benefitList = Benefits.Refresh(patPlanList); //ClaimProc[] claimProcs=ClaimProcs.Refresh(Patients.Cur.PatNum); for (int i = 0; i < procs.Length; i++) { ProcCur = new Procedure(); //this will be an insert //procnum ProcCur.PatNum = patCur.PatNum; ProcCur.AptNum = AptCur.AptNum; ProcCur.ADACode = procs[i]; ProcCur.ProcDate = DateTime.Now; ProcCur.ProcFee = Fees.GetAmount0(ProcCur.ADACode, Fees.GetFeeSched(patCur, planList, patPlanList)); //ProcCur.OverridePri=-1; //ProcCur.OverrideSec=-1; //surf //toothnum //Procedures.Cur.ToothRange=""; //ProcCur.NoBillIns=ProcedureCodes.GetProcCode(ProcCur.ADACode).NoBillIns; //priority ProcCur.ProcStatus = ProcStat.TP; ProcCur.Note = ""; //Procedures.Cur.PriEstim= //Procedures.Cur.SecEstim= //claimnum ProcCur.ProvNum = patCur.PriProv; //Procedures.Cur.Dx= ProcCur.ClinicNum = patCur.ClinicNum; //nextaptnum ProcCur.MedicalCode = ProcedureCodes.GetProcCode(ProcCur.ADACode).MedicalCode; Procedures.Insert(ProcCur); //no recall synch required Procedures.ComputeEstimates(ProcCur, patCur.PatNum, new ClaimProc[0], false, planList, patPlanList, benefitList); } return(AptCur); }