Example #1
0
		///<summary>Double click on appt sheet or on a single appointment.</summary>
		private void ContrApptSheet2_DoubleClick(object sender,System.EventArgs e) {
			mouseIsDown=false;
			//this logic is a little different than mouse down for now because on the first click of a 
			//double click, an appointment control is created under the mouse.
			if(ContrApptSingle.ClickedAptNum!=0) {//on appt
				long patnum=PIn.Long(TempApptSingle.DataRoww["PatNum"].ToString());
				TempApptSingle.Dispose();
				if(Appointments.GetOneApt(ContrApptSingle.ClickedAptNum)==null) {
					MsgBox.Show(this,"Selected appointment no longer exists.");
					RefreshModuleDataPeriod();
					RefreshModuleScreenPeriod();
					return;
				}
				//security handled inside the form
				FormApptEdit FormAE=new FormApptEdit(ContrApptSingle.ClickedAptNum);
				FormAE.ShowDialog();
				if(FormAE.DialogResult==DialogResult.OK) {
					Appointment apt=Appointments.GetOneApt(ContrApptSingle.ClickedAptNum);
					if(apt!=null && DoesOverlap(apt)) {
						Appointment aptOld=apt.Clone();
						MsgBox.Show(this,"Appointment is too long and would overlap another appointment.  Automatically shortened to fit.");
						while(DoesOverlap(apt)) {
							apt.Pattern=apt.Pattern.Substring(0,apt.Pattern.Length-1);
							if(apt.Pattern.Length==1) {
								break;
							}
						}
						try {
							Appointments.Update(apt,aptOld);
						}
						catch(ApplicationException ex) {
							MessageBox.Show(ex.Message);
						}
					}
					ModuleSelected(patnum);//apt.PatNum);//apt might be null if user deleted appt.
					SetInvalid();
				}
			}
			//not on apt, so trying to schedule an appointment---------------------------------------------------------------------
			else {
				if(!Security.IsAuthorized(Permissions.AppointmentCreate)) {
					return;
				}
				FormPatientSelect FormPS=new FormPatientSelect();
				if(PatCur!=null) {
					FormPS.InitialPatNum=PatCur.PatNum;
				}
				FormPS.ShowDialog();
				if(FormPS.DialogResult!=DialogResult.OK) {
					return;
				}
				if(PatCur==null || FormPS.SelectedPatNum!=PatCur.PatNum) {//if the patient was changed
					RefreshModuleDataPatient(FormPS.SelectedPatNum);
					OnPatientSelected(PatCur);
					//RefreshModulePatient(FormPS.SelectedPatNum);
				}
				Appointment apt;
				if(FormPS.NewPatientAdded) {
					//Patient pat=Patients.GetPat(PatCurNum);
					apt=new Appointment();
					apt.PatNum=PatCur.PatNum;
					apt.IsNewPatient=true;
					apt.Pattern="/X/";
					if(PatCur.PriProv==0) {
						apt.ProvNum=PrefC.GetLong(PrefName.PracticeDefaultProv);
					}
					else {
						apt.ProvNum=PatCur.PriProv;
					}
					apt.ProvHyg=PatCur.SecProv;
					apt.AptStatus=ApptStatus.Scheduled;
					DateTime d=AppointmentL.DateSelected;
					if(ApptDrawing.IsWeeklyView) {
						d=WeekStartDate.AddDays(SheetClickedonDay);
					}
					//minutes always rounded down.
					int minutes=(int)(ContrAppt.SheetClickedonMin/ApptDrawing.MinPerIncr)*ApptDrawing.MinPerIncr;
					apt.AptDateTime=new DateTime(d.Year,d.Month,d.Day,ContrAppt.SheetClickedonHour,minutes,0);
					if(PatCur.AskToArriveEarly>0) {
						apt.DateTimeAskedToArrive=apt.AptDateTime.AddMinutes(-PatCur.AskToArriveEarly);
						MessageBox.Show(Lan.g(this,"Ask patient to arrive")+" "+PatCur.AskToArriveEarly
							+" "+Lan.g(this,"minutes early at")+" "+apt.DateTimeAskedToArrive.ToShortTimeString()+".");
					}
					apt.Op=SheetClickedonOp;
					Operatory curOp=Operatories.GetOperatory(apt.Op);
					//New patient. Set to prospective if operatory is set to set prospective.
					if(curOp.SetProspective) {
						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);
						}
					}
					//if(curOp.ProvDentist!=0) {//if no dentist is assigned to op, then keep the original dentist.  All appts must have prov.
					//  apt.ProvNum=curOp.ProvDentist;
					//}
					//apt.ProvHyg=curOp.ProvHygienist;
					long assignedDent=Schedules.GetAssignedProvNumForSpot(SchedListPeriod,curOp,false,apt.AptDateTime);
					long assignedHyg=Schedules.GetAssignedProvNumForSpot(SchedListPeriod,curOp,true,apt.AptDateTime);
					if(assignedDent!=0) {//if no dentist is assigned to op, then keep the original dentist.  All appts must have prov.
					  apt.ProvNum=assignedDent;
					}
					apt.ProvHyg=assignedHyg;
					apt.IsHygiene=curOp.IsHygiene;
					apt.TimeLocked=PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
					if(curOp.ClinicNum==0){
						apt.ClinicNum=PatCur.ClinicNum;
					}
					else{
						apt.ClinicNum=curOp.ClinicNum;
					}
					try {
						Appointments.Insert(apt);
					}
					catch(ApplicationException ex) {
						MessageBox.Show(ex.Message);
					}
					FormApptEdit FormAE=new FormApptEdit(apt.AptNum);//this is where security log entry is made
					FormAE.IsNew=true;
					FormAE.ShowDialog();
					if(apt.IsNewPatient) {
						AutomationL.Trigger(AutomationTrigger.CreateApptNewPat,null,apt.PatNum);
					}
					if(FormAE.DialogResult==DialogResult.OK) {
						RefreshModuleDataPatient(PatCur.PatNum);
						OnPatientSelected(PatCur);
						//RefreshModulePatient(PatCurNum);
						if(apt!=null && DoesOverlap(apt)) {
							Appointment aptOld=apt.Clone();
							MsgBox.Show(this,"Appointment is too long and would overlap another appointment.  Automatically shortened to fit.");
							while(DoesOverlap(apt)) {
								apt.Pattern=apt.Pattern.Substring(0,apt.Pattern.Length-1);
								if(apt.Pattern.Length==1) {
									break;
								}
							}
							try {
								Appointments.Update(apt,aptOld);
							}
							catch(ApplicationException ex) {
								MessageBox.Show(ex.Message);
							}
						}
						RefreshPeriod();
						SetInvalid();
					}
				}
				else {//new patient not added
					if(Appointments.HasPlannedEtc(PatCur.PatNum) | (Plugins.HookMethod(this,"ContrAppt.ContrApptSheet2_DoubleClick_apptOtherShow"))) {
						DisplayOtherDlg(true);
					}
					else {
						FormApptsOther FormAO=new FormApptsOther(PatCur.PatNum);//doesn't actually get shown
						CheckStatus();
						FormAO.InitialClick=true;
						FormAO.MakeAppointment();
						//if(FormAO.OResult==OtherResult.Cancel) {//this wasn't catching user hitting cancel from within appt edit window
						//	return;
						//}
						if(FormAO.AptNumsSelected.Count>0) {
							ContrApptSingle.SelectedAptNum=FormAO.AptNumsSelected[0];
						}
						//RefreshModuleDataPatient(FormAO.SelectedPatNum);//patient won't have changed
						//OnPatientSelected(PatCur.PatNum,PatCur.GetNameLF(),PatCur.Email!="",PatCur.ChartNumber);
						apt=Appointments.GetOneApt(ContrApptSingle.SelectedAptNum);
						if(apt!=null && DoesOverlap(apt)) {
							Appointment aptOld=apt.Clone();
							MsgBox.Show(this,"Appointment is too long and would overlap another appointment.  Automatically shortened to fit.");
							while(DoesOverlap(apt)) {
								apt.Pattern=apt.Pattern.Substring(0,apt.Pattern.Length-1);
								if(apt.Pattern.Length==1) {
									break;
								}
							}
							try {
								Appointments.Update(apt,aptOld);
							}
							catch(ApplicationException ex) {
								MessageBox.Show(ex.Message);
							}
						}
						RefreshPeriod();
						SetInvalid();
					}
				}
			}
		}
Example #2
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			int currentSelection=gridMain.GetSelectedIndex();
			int currentScroll=gridMain.ScrollValue;
			Patient pat=Patients.GetPat(AptList[e.Row].PatNum);//Only one can be selected at a time in this grid.
			PatientSelectedEventArgs eArgs=new OpenDental.PatientSelectedEventArgs(pat);
			PatientGoTo(this,eArgs);
			FormApptEdit FormAE=new FormApptEdit(AptList[e.Row].AptNum);
			FormAE.PinIsVisible=true;
			FormAE.ShowDialog();
			if(FormAE.DialogResult!=DialogResult.OK) {
				return;
			}
			if(FormAE.PinClicked) {
				SendPinboard_Click();
				DialogResult=DialogResult.OK;
			}
			else {
				FillGrid();
				gridMain.SetSelected(currentSelection,true);
				gridMain.ScrollValue=currentScroll;
			}
		}
Example #3
0
 private void butNote_Click(object sender,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=PrefC.GetLong(PrefName.PracticeDefaultProv);
     }
     else {
         AptCur.ProvNum=PatCur.PriProv;
     }
     AptCur.ProvHyg=PatCur.SecProv;
     AptCur.AptStatus=ApptStatus.PtNote;
     AptCur.ClinicNum=PatCur.ClinicNum;
     if(InitialClick) {//initially double clicked on appt module
         DateTime d;
         if(ApptDrawing.IsWeeklyView) {
             d=ContrAppt.WeekStartDate.AddDays(ContrAppt.SheetClickedonDay);
         }
         else {
             d=AppointmentL.DateSelected;
         }
         int minutes=(int)(ContrAppt.SheetClickedonMin/ApptDrawing.MinPerIncr)
             *ApptDrawing.MinPerIncr;
         AptCur.AptDateTime=new DateTime(d.Year,d.Month,d.Day
             ,ContrAppt.SheetClickedonHour,minutes,0);
         AptCur.Op=ContrAppt.SheetClickedonOp;
     }
     else {
         //new appt will be placed on pinboard instead of specific time
     }
     try {
         Appointments.Insert(AptCur);
     }
     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;
     }
     AptNumsSelected.Add(AptCur.AptNum);
     if(InitialClick) {
         oResult=OtherResult.CreateNew;
     }
     else {
         oResult=OtherResult.NewToPinBoard;
     }
     DialogResult=DialogResult.OK;
 }
Example #4
0
		///<Summary>Usually happens after a pinboard appt has been dragged onto main appt sheet.</Summary>
		private void pinBoard_MouseUp(object sender,MouseEventArgs e) {
			if(!boolAptMoved) {
				mouseIsDown=false;
				if(TempApptSingle!=null) {
					TempApptSingle.Dispose();
				}
				return;
			}
			if(TempApptSingle.Location.X>ContrApptSheet2.Width) {
				mouseIsDown=false;
				boolAptMoved=false;
				TempApptSingle.Dispose();
				return;
			}
			if(pinBoard.SelectedAppt.DataRoww["AptStatus"].ToString()==((int)ApptStatus.Planned).ToString()//if Planned appt is on pinboard
				&& !Security.IsAuthorized(Permissions.AppointmentCreate))//and no permission to create a new appt
			{
				mouseIsDown = false;
				boolAptMoved=false;
				TempApptSingle.Dispose();
				return;
			}
			//security prevents moving an appointment by preventing placing it on the pinboard, not here
			//We no longer ask user this question.  It just slows things down: "Move Appointment?"
			//convert loc to new time
			Appointment aptCur=Appointments.GetOneApt(PIn.Long(pinBoard.SelectedAppt.DataRoww["AptNum"].ToString()));
			if(aptCur==null) {
				MsgBox.Show(this,"This appointment has been deleted since it was moved to the pinboard. It will now be cleared from the pinboard.");
				mouseIsDown = false;
				boolAptMoved=false;
				TempApptSingle.Dispose();
				pinBoard.ClearSelected();
				return;
			}
			Appointment aptOld=aptCur.Clone();
			RefreshModuleDataPatient(PIn.Long(pinBoard.SelectedAppt.DataRoww["PatNum"].ToString()));//redundant?
			//Patient pat=Patients.GetPat(PIn.PInt(pinBoard.SelectedAppt.DataRoww["PatNum"].ToString()));
			if(aptCur.IsNewPatient && AppointmentL.DateSelected!=aptCur.AptDateTime) {
				Procedures.SetDateFirstVisit(AppointmentL.DateSelected,4,PatCur);
			}
			int tHr=ApptDrawing.ConvertToHour(TempApptSingle.Location.Y-ContrApptSheet2.Location.Y-panelSheet.Location.Y);
			int tMin=ApptDrawing.ConvertToMin(TempApptSingle.Location.Y-ContrApptSheet2.Location.Y-panelSheet.Location.Y);
			DateTime tDate=AppointmentL.DateSelected;
			if(ApptDrawing.IsWeeklyView) {
				tDate=WeekStartDate.AddDays(ApptDrawing.ConvertToDay(TempApptSingle.Location.X-ContrApptSheet2.Location.X));
			}
			DateTime fromDate=aptCur.AptDateTime.Date;
			aptCur.AptDateTime=new DateTime(tDate.Year,tDate.Month,tDate.Day,tHr,tMin,0);
			if(AppointmentRuleC.List.Length>0) {
				//this is crude and temporary:
				List<long> aptNums=new List<long>();
				for(int i=0;i<DS.Tables["Appointments"].Rows.Count;i++) {
					aptNums.Add(PIn.Long(DS.Tables["Appointments"].Rows[i]["AptNum"].ToString()));//ListDay[i].AptNum;
				}
				List<Procedure> procsMultApts=Procedures.GetProcsMultApts(aptNums);
				Procedure[] procsForOne=Procedures.GetProcsOneApt(aptCur.AptNum,procsMultApts);
				ArrayList doubleBookedCodes=
					AppointmentL.GetDoubleBookedCodes(aptCur,DS.Tables["Appointments"].Copy(),procsMultApts,procsForOne);
				if(doubleBookedCodes.Count>0) {//if some codes would be double booked
					if(AppointmentRules.IsBlocked(doubleBookedCodes)) {
						MessageBox.Show(Lan.g(this,"Not allowed to double book:")+" "
							+AppointmentRules.GetBlockedDescription(doubleBookedCodes));
						mouseIsDown = false;
						boolAptMoved=false;
						TempApptSingle.Dispose();
						return;
					}
				}
			}
			Operatory curOp=ApptDrawing.VisOps
				[ApptDrawing.ConvertToOp(TempApptSingle.Location.X-ContrApptSheet2.Location.X)];
			aptCur.Op=curOp.OperatoryNum;
			long assignedDent=Schedules.GetAssignedProvNumForSpot(SchedListPeriod,curOp,false,aptCur.AptDateTime);
			long assignedHyg=Schedules.GetAssignedProvNumForSpot(SchedListPeriod,curOp,true,aptCur.AptDateTime);
			List<Procedure> procsForSingleApt=null;
			if(aptCur.AptStatus!=ApptStatus.PtNote && aptCur.AptStatus!=ApptStatus.PtNoteCompleted) {
				if(PatCur.AskToArriveEarly>0) {
					aptCur.DateTimeAskedToArrive=aptCur.AptDateTime.AddMinutes(-PatCur.AskToArriveEarly);
					MessageBox.Show(Lan.g(this,"Ask patient to arrive")+" "+PatCur.AskToArriveEarly
						+" "+Lan.g(this,"minutes early at")+" "+aptCur.DateTimeAskedToArrive.ToShortTimeString()+".");
				}
				else {
					aptCur.DateTimeAskedToArrive=DateTime.MinValue;
				}
				//if no dentist/hygienist is assigned to spot, then keep the original dentist/hygienist without prompt.  All appts must have prov.
				if((assignedDent!=0 && assignedDent!=aptCur.ProvNum) || (assignedHyg!=0 && assignedHyg!=aptCur.ProvHyg)) {
					if(MessageBox.Show(Lan.g(this,"Change provider?"),"",MessageBoxButtons.YesNo)==DialogResult.Yes) {
						if(assignedDent!=0) {
							aptCur.ProvNum=assignedDent;
						}
						if(assignedHyg!=0) {//the hygienist will only be changed if the spot has a hygienist.
							aptCur.ProvHyg=assignedHyg;
						}
						if(curOp.IsHygiene) {
							aptCur.IsHygiene=true;
						}
						else {//op not marked as hygiene op
							if(assignedDent==0) {//no dentist assigned
								if(assignedHyg!=0) {//hyg is assigned (we don't really have to test for this)
									aptCur.IsHygiene=true;
								}
							}
							else {//dentist is assigned
								if(assignedHyg==0) {//hyg is not assigned
									aptCur.IsHygiene=false;
								}
								//if both dentist and hyg are assigned, it's tricky
								//only explicitly set it if user has a dentist assigned to the op
								if(curOp.ProvDentist!=0) {
									aptCur.IsHygiene=false;
								}
							}
						}
						bool isplanned=aptCur.AptStatus==ApptStatus.Planned;
						procsForSingleApt=Procedures.GetProcsForSingle(aptCur.AptNum,isplanned);
						List<long> codeNums=new List<long>();
						for(int p=0;p<procsForSingleApt.Count;p++) {
							codeNums.Add(procsForSingleApt[p].CodeNum);
						}
						string calcPattern=Appointments.CalculatePattern(aptCur.ProvNum,aptCur.ProvHyg,codeNums,true);
						if(aptCur.Pattern != calcPattern && !PrefC.GetBool(PrefName.AppointmentTimeIsLocked)) {
							if(aptCur.TimeLocked){
								if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Appointment length is locked.  Change length for new provider anyway?")) {
									aptCur.Pattern=calcPattern;
								}
							}
							else {//appt time not locked
								if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Change length for new provider?")) {
									aptCur.Pattern=calcPattern;
								}
							}
						}
					}
				}
			}
			if(DoesOverlap(aptCur)) {
				int startingOp=ApptDrawing.GetIndexOp(aptCur.Op);
				bool stillOverlaps=true;
				for(int i=startingOp;i<ApptDrawing.VisOps.Count;i++) {
					aptCur.Op=ApptDrawing.VisOps[i].OperatoryNum;
					if(!DoesOverlap(aptCur)) {
						stillOverlaps=false;
						break;
					}
				}
				if(stillOverlaps) {
					for(int i=startingOp;i>=0;i--) {
						aptCur.Op=ApptDrawing.VisOps[i].OperatoryNum;
						if(!DoesOverlap(aptCur)) {
							stillOverlaps=false;
							break;
						}
					}
				}
				if(stillOverlaps) {
					MessageBox.Show(Lan.g(this,"Appointment overlaps existing appointment."));
					mouseIsDown=false;
					boolAptMoved=false;
					TempApptSingle.Dispose();
					return;
				}
			}
			Operatory opCur=Operatories.GetOperatory(aptCur.Op);
			Operatory opOld=Operatories.GetOperatory(aptOld.Op);
			if(opOld==null || opCur.SetProspective!=opOld.SetProspective) {
				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) {
					//Do we need to warn about changing FROM prospective? Assume so for now.
					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);
					}
				}
			}
			if(aptCur.AptStatus==ApptStatus.Broken) {
				aptCur.AptStatus=ApptStatus.Scheduled;
			}
			if(aptCur.AptStatus==ApptStatus.UnschedList) {
				aptCur.AptStatus=ApptStatus.Scheduled;
			}
			//original position of provider settings
			if(curOp.ClinicNum==0){
				aptCur.ClinicNum=PatCur.ClinicNum;
			}
			else{
				aptCur.ClinicNum=curOp.ClinicNum;
			}
			if(aptCur.AptStatus==ApptStatus.Planned) {//if Planned appt is on pinboard
				long plannedAptNum=aptCur.AptNum;
				LabCase lab=LabCases.GetForPlanned(aptCur.AptNum);
				aptCur.NextAptNum=aptCur.AptNum;
				aptCur.AptStatus=ApptStatus.Scheduled;
				aptCur.TimeLocked=PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
				try {
					Appointments.Insert(aptCur);//now, aptnum is different.
					for(int i=0;i<pinBoard.SelectedAppt.TableApptFields.Rows.Count;i++) {//Duplicate the appointment fields.
						//in SendToPinboard, TableApptFields is refreshed for just the one planned appt instead of all appts for day.
						ApptField apptField=new ApptField();
						apptField.AptNum=aptCur.AptNum;
						apptField.FieldName=PIn.String(pinBoard.SelectedAppt.TableApptFields.Rows[i]["FieldName"].ToString());
						apptField.FieldValue=PIn.String(pinBoard.SelectedAppt.TableApptFields.Rows[i]["FieldValue"].ToString());
						ApptFields.Insert(apptField);
					}
					//for(int i=0;i<pinBoard.SelectedAppt.TablePatFields.Rows.Count;i++) {//Duplicate the patient fields.
					//	PatField patField=new PatField();
					//	patField.PatNum=aptCur.PatNum;
					//	patField.FieldName=PIn.String(pinBoard.SelectedAppt.TablePatFields.Rows[i]["FieldName"].ToString());
					//	patField.FieldValue=PIn.String(pinBoard.SelectedAppt.TablePatFields.Rows[i]["FieldValue"].ToString());
					//	PatFields.Insert(patField);
					//}
				}
				catch(ApplicationException ex) {
					MessageBox.Show(ex.Message);
					return;
				}
				SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate,aptCur.PatNum,
					aptCur.AptDateTime.ToString()+", "+aptCur.ProcDescript,
					aptCur.AptNum);
				List<Procedure> ProcList=Procedures.Refresh(aptCur.PatNum);
				bool procAlreadyAttached=false;
				for(int i=0;i<ProcList.Count;i++) {
					if(ProcList[i].PlannedAptNum==plannedAptNum) {//if on the planned apt
						if(ProcList[i].AptNum>0) {//already attached to another appt
							procAlreadyAttached=true;
						}
						else {//only update procedures not already attached to another apt
							Procedures.UpdateAptNum(ProcList[i].ProcNum,aptCur.AptNum);
							//.Update(ProcCur,ProcOld);//recall synch not required.
						}
					}
				}
				if(procAlreadyAttached) {
					MessageBox.Show(Lan.g(this,"One or more procedures could not be scheduled because they were already attached to another appointment. Someone probably forgot to update the Next appointment in the Chart module."));
					FormApptEdit formAE=new FormApptEdit(aptCur.AptNum);
					CheckStatus();
					formAE.IsNew=true;
					formAE.ShowDialog();//to force refresh of aptDescript
					if(formAE.DialogResult!=DialogResult.OK) {//apt gets deleted from within aptEdit window.
						TempApptSingle.Dispose();
						RefreshModuleScreenPatient();
						RefreshPeriod();
						mouseIsDown = false;
						boolAptMoved=false;
						return;
					}
				}
				if(lab!=null) {
					LabCases.AttachToAppt(lab.LabCaseNum,aptCur.AptNum);
				}
			}//if planned appointment is on pinboard
			else {//simple drag off pinboard to a new date/time
				aptCur.Confirmed=DefC.Short[(int)DefCat.ApptConfirmed][0].DefNum;//Causes the confirmation status to be reset.
				try {
					Appointments.Update(aptCur,aptOld);
					SecurityLogs.MakeLogEntry(Permissions.AppointmentMove,aptCur.PatNum,
						aptCur.ProcDescript+", from "+aptOld.AptDateTime.ToString()+", to "+aptCur.AptDateTime.ToString(),
						aptCur.AptNum);
				}
				catch(ApplicationException ex) {
					MessageBox.Show(ex.Message);
					return;
				}
			}
			if(procsForSingleApt==null) {
				procsForSingleApt=Procedures.GetProcsForSingle(aptCur.AptNum,false);
			}
			Procedures.SetProvidersInAppointment(aptCur,procsForSingleApt);
			TempApptSingle.Dispose();
			pinBoard.ClearSelected();
			//PinApptSingle.Visible=false;
			//ContrApptSingle.PinBoardIsSelected=false;
			ContrApptSingle.SelectedAptNum=aptCur.AptNum;
			RefreshModuleScreenPatient();
			//RefreshModulePatient(PatCurNum);
			RefreshPeriod();//date moving to for this computer
			SetInvalid();//date moving to for other computers
			AppointmentL.DateSelected=fromDate;
			SetInvalid();//for date moved from for other computers.
			AppointmentL.DateSelected=aptCur.AptDateTime;
			mouseIsDown = false;
			boolAptMoved=false;
			List<string> procCodes=new List<string>();
			for(int i=0;i<procsForSingleApt.Count;i++) {
				procCodes.Add(ProcedureCodes.GetProcCode((long)procsForSingleApt[i].CodeNum).ProcCode);
			}
			//Recalls.SynchScheduledApptLazy(aptCur.PatNum, aptCur.AptDateTime, procCodes);
			Recalls.SynchScheduledApptFull(aptCur.PatNum);
		}
Example #5
0
 private void tbApts_CellDoubleClicked(object sender, CellEventArgs e)
 {
     int currentSelection=tbApts.SelectedRow;
     int currentScroll=tbApts.ScrollValue;
     FormApptEdit FormAE=new FormApptEdit(ApptList[e.Row].AptNum);
     FormAE.PinIsVisible=true;
     FormAE.ShowDialog();
     if(FormAE.DialogResult!=DialogResult.OK)
         return;
     if(FormAE.PinClicked){
         if(!OKtoSendToPinboard(ApptList[e.Row])){
             return;
         }
         AptNumsSelected.Add(ApptList[e.Row].AptNum);
         oResult=OtherResult.CopyToPinBoard;
         DialogResult=DialogResult.OK;
     }
     else{
         Filltb();
         tbApts.SetSelected(currentSelection,true);
         tbApts.ScrollValue=currentScroll;
     }
 }
Example #6
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=PrefC.GetLong(PrefName.PracticeDefaultProv);
     }
     else{
         AptCur.ProvNum=PatCur.PriProv;
     }
     AptCur.ProvHyg=PatCur.SecProv;
     AptCur.AptDateTime=DateTime.MinValue;//(was .Now) This is what triggers automatic deletion from db when clear pinboard is clicked.
     AptCur.ClinicNum=PatCur.ClinicNum;
     if(InitialClick){//initially double clicked on appt module
         DateTime d;
         if(ApptDrawing.IsWeeklyView){
             d=ContrAppt.WeekStartDate.AddDays(ContrAppt.SheetClickedonDay);
         }
         else{
             d=AppointmentL.DateSelected;
         }
         int minutes=(int)(ContrAppt.SheetClickedonMin/ApptDrawing.MinPerIncr)*ApptDrawing.MinPerIncr;
         AptCur.AptDateTime=new DateTime(d.Year,d.Month,d.Day
             ,ContrAppt.SheetClickedonHour,minutes,0);
         if(PatCur.AskToArriveEarly>0){
             AptCur.DateTimeAskedToArrive=AptCur.AptDateTime.AddMinutes(-PatCur.AskToArriveEarly);
             MessageBox.Show(Lan.g(this,"Ask patient to arrive")+" "+PatCur.AskToArriveEarly
                 +" "+Lan.g(this,"minutes early at")+" "+AptCur.DateTimeAskedToArrive.ToShortTimeString()+".");
         }
         AptCur.Op=ContrAppt.SheetClickedonOp;
         Operatory curOp=Operatories.GetOperatory(AptCur.Op);
         //if(curOp.ProvDentist!=0) {
         //  AptCur.ProvNum=curOp.ProvDentist;
         //}
         //AptCur.ProvHyg=curOp.ProvHygienist;
         List<Schedule> schedListPeriod=Schedules.RefreshDayEdit(AptCur.AptDateTime);
         long assignedDent=Schedules.GetAssignedProvNumForSpot(schedListPeriod,curOp,false,AptCur.AptDateTime);
         long assignedHyg=Schedules.GetAssignedProvNumForSpot(schedListPeriod,curOp,true,AptCur.AptDateTime);
         if(assignedDent!=0) {//if no dentist is assigned to op, then keep the original dentist.  All appts must have prov.
             AptCur.ProvNum=assignedDent;
         }
         AptCur.ProvHyg=assignedHyg;
         AptCur.IsHygiene=curOp.IsHygiene;
         if(curOp.ClinicNum!=0){
             AptCur.ClinicNum=curOp.ClinicNum;
         }
         AptCur.AptStatus=ApptStatus.Scheduled;
     }
     else{
         //new appt will be placed on pinboard instead of specific time
         AptCur.AptStatus=ApptStatus.UnschedList;//This is so that if it's on the pinboard when use shuts down OD, no db inconsistency.
     }
     try{
         Appointments.Insert(AptCur);
     }
     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;
     }
     if(InitialClick) {
         //Change PatStatus to Prospective or from Prospective.
         Operatory opCur=Operatories.GetOperatory(AptCur.Op);
         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);
             }
         }
     }
     AptNumsSelected.Add(AptCur.AptNum);
     if(InitialClick){
         oResult=OtherResult.CreateNew;
     }
     else{
         oResult=OtherResult.NewToPinBoard;
     }
     if(AptCur.IsNewPatient) {
         AutomationL.Trigger(AutomationTrigger.CreateApptNewPat,null,AptCur.PatNum);
     }
     DialogResult=DialogResult.OK;
 }
		private void butNew_Click(object sender,EventArgs e) {
			/*if(ApptPlanned.Visible){
				if(MessageBox.Show(Lan.g(this,"Replace existing planned appointment?")
					,"",MessageBoxButtons.OKCancel)!=DialogResult.OK)
					return;
				//Procedures.UnattachProcsInPlannedAppt(ApptPlanned.Info.MyApt.AptNum);
				AppointmentL.Delete(PIn.PInt(ApptPlanned.DataRoww["AptNum"].ToString()));
			}*/
			Appointment AptCur=new Appointment();
			AptCur.PatNum=PatCur.PatNum;
			AptCur.ProvNum=PatCur.PriProv;
			AptCur.ClinicNum=PatCur.ClinicNum;
			AptCur.AptStatus=ApptStatus.Planned;
			AptCur.AptDateTime=DateTimeOD.Today;
			AptCur.Pattern="/X/";
			AptCur.TimeLocked=PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
			Appointments.Insert(AptCur);
			PlannedAppt plannedAppt=new PlannedAppt();
			plannedAppt.AptNum=AptCur.AptNum;
			plannedAppt.PatNum=PatCur.PatNum;
			plannedAppt.ItemOrder=TablePlanned.Rows.Count+1;
			PlannedAppts.Insert(plannedAppt);
			FormApptEdit FormApptEdit2=new FormApptEdit(AptCur.AptNum);
			FormApptEdit2.IsNew=true;
			FormApptEdit2.ShowDialog();
			if(FormApptEdit2.DialogResult!=DialogResult.OK){
				//delete new appt, delete plannedappt, and unattach procs already handled in dialog
				Refresh();
				return;
			}
			List<Procedure> myProcList=Procedures.Refresh(PatCur.PatNum);
			bool allProcsHyg=true;
			for(int i=0;i<myProcList.Count;i++){
				if(myProcList[i].PlannedAptNum!=AptCur.AptNum)
					continue;//only concerned with procs on this plannedAppt
				if(!ProcedureCodes.GetProcCode(myProcList[i].CodeNum).IsHygiene){
					allProcsHyg=false;
					break;
				}
			}
			if(allProcsHyg && PatCur.SecProv!=0){
				Appointment aptOld=AptCur.Clone();
				AptCur.ProvNum=PatCur.SecProv;
				Appointments.Update(AptCur,aptOld);
			}
			Patient patOld=PatCur.Copy();
			//PatCur.NextAptNum=AptCur.AptNum;
			PatCur.PlannedIsDone=false;
			Patients.Update(PatCur,patOld);
			Refresh();//if procs were added in appt, then this will display them
		}
Example #8
0
		private void gridProg_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			//Chartscrollval = gridProg.ScrollValue;
			DataRow row = (DataRow)gridProg.Rows[e.Row].Tag;
			if(row["ProcNum"].ToString() != "0") {
				if(checkAudit.Checked) {
					MsgBox.Show(this,"Not allowed to edit procedures when in audit mode.");
					return;
				}
				Procedure proc = Procedures.GetOneProc(PIn.Long(row["ProcNum"].ToString()),true);
				FormProcEdit FormP = new FormProcEdit(proc,PatCur,FamCur);
				FormP.ShowDialog();
				if(FormP.DialogResult != DialogResult.OK) {
					return;
				}
			}
			else if(row["CommlogNum"].ToString() != "0") {
				Commlog comm = Commlogs.GetOne(PIn.Long(row["CommlogNum"].ToString()));
				FormCommItem FormC = new FormCommItem(comm);
				FormC.ShowDialog();
				if(FormC.DialogResult != DialogResult.OK) {
					return;
				}
			}
			else if(row["RxNum"].ToString() != "0") {
				RxPat rx = RxPats.GetRx(PIn.Long(row["RxNum"].ToString()));
				FormRxEdit FormRxE = new FormRxEdit(PatCur,rx);
				FormRxE.ShowDialog();
				if(FormRxE.DialogResult != DialogResult.OK) {
					return;
				}
			}
			else if(row["LabCaseNum"].ToString() != "0") {
				LabCase lab = LabCases.GetOne(PIn.Long(row["LabCaseNum"].ToString()));
				FormLabCaseEdit FormL = new FormLabCaseEdit();
				FormL.CaseCur = lab;
				FormL.ShowDialog();
			}
			else if(row["TaskNum"].ToString() != "0") {
				Task task = Tasks.GetOne(PIn.Long(row["TaskNum"].ToString()));
				FormTaskEdit FormT = new FormTaskEdit(task,task.Copy());
				FormT.Closing+=new CancelEventHandler(TaskGoToEvent);
				FormT.Show();//non-modal
			}
			else if(row["AptNum"].ToString() != "0") {
				//Appointment apt=Appointments.GetOneApt(
				FormApptEdit FormA = new FormApptEdit(PIn.Long(row["AptNum"].ToString()));
				//PinIsVisible=false
				FormA.ShowDialog();
				if(FormA.DialogResult != DialogResult.OK) {
					return;
				}
			}
			else if(row["EmailMessageNum"].ToString() != "0") {
				EmailMessage msg = EmailMessages.GetOne(PIn.Long(row["EmailMessageNum"].ToString()));
				FormEmailMessageEdit FormE = new FormEmailMessageEdit(msg);
				FormE.ShowDialog();
				if(FormE.DialogResult != DialogResult.OK) {
					return;
				}
			}
			ModuleSelected(PatCur.PatNum);
		}
Example #9
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			int currentSelection=e.Row;
			int currentScroll=gridMain.ScrollValue;
			FormApptEdit FormAE=new FormApptEdit(ApptList[e.Row].AptNum);
			FormAE.IsInViewPatAppts=true;
			FormAE.PinIsVisible=true;
			FormAE.ShowDialog();
			if(FormAE.DialogResult!=DialogResult.OK)
				return;
			if(FormAE.PinClicked){
				if(!OKtoSendToPinboard(ApptList[e.Row])){
					return;
				}
				AptNumsSelected.Add(ApptList[e.Row].AptNum);
				oResult=OtherResult.CopyToPinBoard;
				DialogResult=DialogResult.OK;
			}
			else{
				FillFamily();
				FillGrid();
				gridMain.SetSelected(currentSelection,true);
				gridMain.ScrollValue=currentScroll;
			}
		}
Example #10
0
		public void MakeAppointment(){
			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.AptDateTime=DateTime.MinValue;//(was .Now) This is what triggers automatic deletion from db when clear pinboard is clicked.
			AptCur.ClinicNum=PatCur.ClinicNum;
			AptCur.TimeLocked=PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
			if(InitialClick){//initially double clicked on appt module
				DateTime d;
				if(ApptDrawing.IsWeeklyView){
					d=ContrAppt.WeekStartDate.AddDays(ContrAppt.SheetClickedonDay);
				}
				else{
					d=AppointmentL.DateSelected;
				}
				int minutes=(int)(ContrAppt.SheetClickedonMin/ApptDrawing.MinPerIncr)*ApptDrawing.MinPerIncr;
				AptCur.AptDateTime=new DateTime(d.Year,d.Month,d.Day
					,ContrAppt.SheetClickedonHour,minutes,0);
				if(PatCur.AskToArriveEarly>0){
					AptCur.DateTimeAskedToArrive=AptCur.AptDateTime.AddMinutes(-PatCur.AskToArriveEarly);
					MessageBox.Show(Lan.g(this,"Ask patient to arrive")+" "+PatCur.AskToArriveEarly
						+" "+Lan.g(this,"minutes early at")+" "+AptCur.DateTimeAskedToArrive.ToShortTimeString()+".");
				}
				AptCur.Op=ContrAppt.SheetClickedonOp;
				Operatory curOp=Operatories.GetOperatory(AptCur.Op);
				//if(curOp.ProvDentist!=0) {
				//  AptCur.ProvNum=curOp.ProvDentist;
				//}
				//AptCur.ProvHyg=curOp.ProvHygienist;
				List<Schedule> schedListPeriod=Schedules.RefreshDayEdit(AptCur.AptDateTime);
				long assignedDent=Schedules.GetAssignedProvNumForSpot(schedListPeriod,curOp,false,AptCur.AptDateTime);
				long assignedHyg=Schedules.GetAssignedProvNumForSpot(schedListPeriod,curOp,true,AptCur.AptDateTime);
				//the section below regarding providers is overly wordy because it's copied from ContrAppt.pinBoard_MouseUp to make maint easier.
				if(assignedDent!=0) {
					AptCur.ProvNum=assignedDent;
				}
				if(assignedHyg!=0) {//the hygienist will only be changed if the spot has a hygienist.
					AptCur.ProvHyg=assignedHyg;
				}
				if(curOp.IsHygiene) {
					AptCur.IsHygiene=true;
				}
				else {//op not marked as hygiene op
					if(assignedDent==0) {//no dentist assigned
						if(assignedHyg!=0) {//hyg is assigned (we don't really have to test for this)
							AptCur.IsHygiene=true;
						}
					}
					else {//dentist is assigned
						if(assignedHyg==0) {//hyg is not assigned
							AptCur.IsHygiene=false;
						}
						//if both dentist and hyg are assigned, it's tricky
						//only explicitly set it if user has a dentist assigned to the op
						if(curOp.ProvDentist!=0) {
							AptCur.IsHygiene=false;
						}
					}
				}
				if(curOp.ClinicNum!=0){
					AptCur.ClinicNum=curOp.ClinicNum;
				}
				AptCur.AptStatus=ApptStatus.Scheduled;
			}
			else{
				//new appt will be placed on pinboard instead of specific time
				AptCur.AptStatus=ApptStatus.UnschedList;//This is so that if it's on the pinboard when use shuts down OD, no db inconsistency.
			}
			try{
				Appointments.Insert(AptCur);
			}
			catch(ApplicationException ex){
				MessageBox.Show(ex.Message);
				return;
			}
			//This is done inside FormApptEdit.butOK_Click().  Don't want to make two create entries.
			//SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate,AptCur.PatNum,
			//	AptCur.AptDateTime.ToString()+", "+AptCur.ProcDescript,
			//	AptCur.AptNum);
			FormApptEdit FormApptEdit2=new FormApptEdit(AptCur.AptNum);
			FormApptEdit2.IsNew=true;
			FormApptEdit2.ShowDialog();
			if(FormApptEdit2.DialogResult!=DialogResult.OK){
				return;
			}
			if(InitialClick) {
				//Change PatStatus to Prospective or from Prospective.
				Operatory opCur=Operatories.GetOperatory(AptCur.Op);
				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);
					}
				}
			}
			AptNumsSelected.Add(AptCur.AptNum);
			if(InitialClick){
				oResult=OtherResult.CreateNew;
			}
			else{
				oResult=OtherResult.NewToPinBoard;
			}
			if(AptCur.IsNewPatient) {
				AutomationL.Trigger(AutomationTrigger.CreateApptNewPat,null,AptCur.PatNum);
			}
			DialogResult=DialogResult.OK;
		}
Example #11
0
 private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e)
 {
     SelectedPatNum=AptList[e.Row].PatNum;
     int currentSelection=gridMain.GetSelectedIndex();
     int currentScroll=gridMain.ScrollValue;
     FormApptEdit FormAE=new FormApptEdit(AptList[e.Row].AptNum);
     FormAE.PinIsVisible=true;
     FormAE.ShowDialog();
     if(FormAE.DialogResult!=DialogResult.OK)
         return;
     if(FormAE.PinClicked) {
         PinClicked=true;
         AptSelected=AptList[e.Row].AptNum;
         DialogResult=DialogResult.OK;
         return;
     }
     else {
         FillGrid();
         gridMain.SetSelected(currentSelection,true);
         gridMain.ScrollValue=currentScroll;
     }
 }
Example #12
0
		private void gridPlanned_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			long aptnum=PIn.Long(DataSetMain.Tables["Planned"].Rows[e.Row]["AptNum"].ToString());
			FormApptEdit FormAE=new FormApptEdit(aptnum);
			FormAE.ShowDialog();
			if(Programs.UsingOrion) {
				if(FormAE.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);//if procs were added in appt, then this will display them*/
				}
			}
			else {
				ModuleSelected(PatCur.PatNum);//if procs were added in appt, then this will display them*/
			}
			for(int i=0;i<DataSetMain.Tables["Planned"].Rows.Count;i++){
				if(DataSetMain.Tables["Planned"].Rows[i]["AptNum"].ToString()==aptnum.ToString()){
					gridPlanned.SetSelected(i,true);
				}
			}
		}
Example #13
0
		private void gridProg_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Chartscrollval=gridProg.ScrollValue;
			DataRow row=(DataRow)gridProg.Rows[e.Row].Tag;
			if(row["ProcNum"].ToString()!="0"){
				if(checkAudit.Checked){
					MsgBox.Show(this,"Not allowed to edit procedures when in audit mode.");
					return;
				}
				Procedure proc=Procedures.GetOneProc(PIn.Long(row["ProcNum"].ToString()),true);
				if(ProcedureCodes.GetStringProcCode(proc.CodeNum)==ProcedureCodes.GroupProcCode){
					FormProcGroup FormP=new FormProcGroup();		
					List<ProcGroupItem> groupItemList=ProcGroupItems.GetForGroup(proc.ProcNum);
					List<Procedure> procList=new List<Procedure>();
					for(int i=0;i<groupItemList.Count;i++){
						procList.Add(Procedures.GetOneProc(groupItemList[i].ProcNum,false));
					}
					FormP.GroupCur=proc;
					FormP.GroupItemList=groupItemList;
					FormP.ProcList=procList;
					FormP.ShowDialog();
					if(FormP.DialogResult==DialogResult.OK){
						ModuleSelected(PatCur.PatNum);
						FillProgNotes();
					}
					return;
				}
				else{
					FormProcEdit FormP=new FormProcEdit(proc,PatCur,FamCur);
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc", proc, FormP);
					if(!FormP.IsDisposed) { //Form might be disposed by the above hook.
						FormP.ShowDialog();
					} 
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc2", proc, FormP);
					if(FormP.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["CommlogNum"].ToString()!="0"){
				Commlog comm=Commlogs.GetOne(PIn.Long(row["CommlogNum"].ToString()));
				FormCommItem FormC=new FormCommItem(comm);
				FormC.ShowDialog();
				if(FormC.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["RxNum"].ToString()!="0") {
				RxPat rx=RxPats.GetRx(PIn.Long(row["RxNum"].ToString()));
				FormRxEdit FormRxE=new FormRxEdit(PatCur,rx);
				FormRxE.ShowDialog();
				if(FormRxE.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["LabCaseNum"].ToString()!="0") {
				LabCase lab=LabCases.GetOne(PIn.Long(row["LabCaseNum"].ToString()));
				FormLabCaseEdit FormL=new FormLabCaseEdit();
				FormL.CaseCur=lab;
				FormL.ShowDialog();
				//needs to always refresh due to complex ok/cancel
			}
			else if(row["TaskNum"].ToString()!="0") {
				Task task=Tasks.GetOne(PIn.Long(row["TaskNum"].ToString()));
				if(task==null) {
					MsgBox.Show(this,"This task has been deleted by another user.");
				}
				else {
					FormTaskEdit FormT=new FormTaskEdit(task,task.Copy());
					FormT.Closing+=new CancelEventHandler(TaskGoToEvent);
					FormT.Show();//non-modal
				}
			}
			else if(row["AptNum"].ToString()!="0") {
				//Appointment apt=Appointments.GetOneApt(
				FormApptEdit FormA=new FormApptEdit(PIn.Long(row["AptNum"].ToString()));
				//PinIsVisible=false
				FormA.IsInChartModule=true;
				FormA.ShowDialog();
				if(FormA.CloseOD) {
					((Form)this.Parent).Close();
					return;
				}
				if(FormA.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["EmailMessageNum"].ToString()!="0") {
				EmailMessage msg=EmailMessages.GetOne(PIn.Long(row["EmailMessageNum"].ToString()));
				if(msg.SentOrReceived==EmailSentOrReceived.WebMailReceived
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailRecdRead
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSent
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSentRead) 
				{
					//web mail uses special secure messaging portal
					FormWebMailMessageEdit FormWMME=new FormWebMailMessageEdit(PatCur.PatNum,msg.EmailMessageNum);
					if(FormWMME.ShowDialog()!=DialogResult.OK) {
						return;
					}
				}
				else {
					FormEmailMessageEdit FormE=new FormEmailMessageEdit(msg);
					FormE.ShowDialog();
					if(FormE.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["SheetNum"].ToString()!="0") {
				Sheet sheet=Sheets.GetSheet(PIn.Long(row["SheetNum"].ToString()));
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.ShowDialog();
				if(FormSFE.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["FormPatNum"].ToString()!="0"){
				FormPat form=FormPats.GetOne(PIn.Long(row["FormPatNum"].ToString()));
				FormFormPatEdit FormP=new FormFormPatEdit();
				FormP.FormPatCur=form;
				FormP.ShowDialog();
				if(FormP.DialogResult==DialogResult.OK)
				{
					ModuleSelected(PatCur.PatNum);//Why is this called here and down 3 lines? Do we need the Allocator, or should we return here?
				}
			}
			ModuleSelected(PatCur.PatNum);
			Reporting.Allocators.MyAllocator1_ProviderPayment.AllocateWithToolCheck(this.PatCur.Guarantor);
		}
		private void grid_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e) {
			SelectedPatNum=PIn.Long(Table.Rows[e.Row]["PatNum"].ToString());
			Cursor=Cursors.WaitCursor;
			long selectedApt=PIn.Long(Table.Rows[e.Row]["AptNum"].ToString());
			//Appointment apt=Appointments.GetOneApt(selectedApt);
			FormApptEdit FormA=new FormApptEdit(selectedApt);
			FormA.PinIsVisible=true;
			FormA.ShowDialog();
			if(FormA.PinClicked) {
				PinClicked=true;
				AptSelected=selectedApt;
				DialogResult=DialogResult.OK;
				return;
			}
			else {
				FillMain();
			}
			for(int i=0;i<Table.Rows.Count;i++){
				if(PIn.Long(Table.Rows[i]["AptNum"].ToString())==selectedApt){
					grid.SetSelected(i,true);
				}
			}
			SetFamilyColors();
			Cursor=Cursors.Default;
		}
Example #15
0
		private void gridPlanned_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			long aptnum=PIn.Long(TablePlanned.Rows[e.Row]["AptNum"].ToString());
			FormApptEdit FormAE=new FormApptEdit(aptnum);
			FormAE.ShowDialog();
			if(FormAE.DialogResult==DialogResult.OK) {
				Refresh();
			}
			for(int i=0;i<TablePlanned.Rows.Count;i++){
				if(TablePlanned.Rows[i]["AptNum"].ToString()==aptnum.ToString()){
					gridPlanned.SetSelected(i,true);
				}
			}
		}
Example #16
0
		private void grid_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			int currentSelection=e.Row;//tbApts.SelectedRow;
			int currentScroll=grid.ScrollValue;//tbApts.ScrollValue;
			SelectedPatNum=ListUn[e.Row].PatNum;
			FormApptEdit FormAE=new FormApptEdit(ListUn[e.Row].AptNum);
			FormAE.PinIsVisible=true;
			FormAE.ShowDialog();
			if(FormAE.DialogResult!=DialogResult.OK)
				return;
			if(FormAE.PinClicked) {
				PinClicked=true;
				AptSelected=ListUn[e.Row].AptNum;
				DialogResult=DialogResult.OK;
			}
			else {
				FillGrid();
				grid.SetSelected(currentSelection,true);
				grid.ScrollValue=currentScroll;
			}
		}
Example #17
0
		private void grid_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			int currentSelection=e.Row;//tbApts.SelectedRow;
			int currentScroll=grid.ScrollValue;//tbApts.ScrollValue;
			Patient pat=Patients.GetPat(ListUn[e.Row].PatNum);//If multiple selected, just take the one that was clicked on.
			PatientSelectedEventArgs eArgs=new OpenDental.PatientSelectedEventArgs(pat);
			PatientGoTo(this,eArgs);
			FormApptEdit FormAE=new FormApptEdit(ListUn[e.Row].AptNum);
			FormAE.PinIsVisible=true;
			FormAE.ShowDialog();
			if(FormAE.DialogResult!=DialogResult.OK) {
				return;
			}
			if(FormAE.PinClicked) {
				SendPinboard_Click();//Whatever they double clicked on will still be selected, just fire the event.
				DialogResult=DialogResult.OK;
			}
			else {
				FillGrid();
				grid.SetSelected(currentSelection,true);
				grid.ScrollValue=currentScroll;
			}
		}