Exemplo n.º 1
0
 ///<Summary>Serves four functions.  1. Sends the new patient to the dropdown menu for select patient.  2. Changes which toolbar buttons are enabled.  3. Sets main form text. 4. Displays any popup.</Summary>
 private void FillPatientButton(long patNum,string patName,bool hasEmail,string chartNumber,long siteNum)
 {
     bool patChanged=PatientL.AddPatsToMenu(menuPatient,new EventHandler(menuPatient_Click),patName,patNum);
     if(patChanged){
         if(AutomationL.Trigger(AutomationTrigger.OpenPatient,null,patNum)) {//if a trigger happened
             if(ContrAppt2.Visible) {
                 ContrAppt2.MouseUpForced();
             }
         }
     }
     if(ToolBarMain.Buttons==null || ToolBarMain.Buttons.Count<2){//on startup.  js Not sure why it's checking count.
         return;
     }
     if(CurPatNum==0) {//Only on startup, I think.
         if(!Programs.UsingEcwTight()) {//eCW only gets Patient Select and Popups toolbar buttons
             ToolBarMain.Buttons["Email"].Enabled=false;
             ToolBarMain.Buttons["EmailDropdown"].Enabled=false;
             ToolBarMain.Buttons["Commlog"].Enabled=false;
             ToolBarMain.Buttons["Letter"].Enabled=false;
             ToolBarMain.Buttons["Form"].Enabled=false;
             ToolBarMain.Buttons["Tasklist"].Enabled=false;
             ToolBarMain.Buttons["Label"].Enabled=false;
         }
         ToolBarMain.Buttons["Popups"].Enabled=false;
     }
     else {
         if(!Programs.UsingEcwTight()) {
             if(hasEmail) {
                 ToolBarMain.Buttons["Email"].Enabled=true;
             }
             else {
                 ToolBarMain.Buttons["Email"].Enabled=false;
             }
             ToolBarMain.Buttons["EmailDropdown"].Enabled=true;
             ToolBarMain.Buttons["Commlog"].Enabled=true;
             ToolBarMain.Buttons["Letter"].Enabled=true;
             ToolBarMain.Buttons["Form"].Enabled=true;
             ToolBarMain.Buttons["Tasklist"].Enabled=true;
             ToolBarMain.Buttons["Label"].Enabled=true;
         }
         ToolBarMain.Buttons["Popups"].Enabled=true;
     }
     ToolBarMain.Invalidate();
     Text=PatientL.GetMainTitle(patName,patNum,chartNumber,siteNum);
     if(PopupEventList==null){
         PopupEventList=new List<PopupEvent>();
     }
     if(!patChanged){
         return;
     }
     //New patient selected.  Everything below here is for popups.
     //First, remove all expired popups from the event list.
     for(int i=PopupEventList.Count-1;i>=0;i--){//go backwards
         if(PopupEventList[i].DisableUntil<DateTime.Now){//expired
             PopupEventList.RemoveAt(i);
         }
     }
     //Now, loop through all popups for the patient.
     List<Popup> popList=Popups.GetForPatient(patNum);//get all possible
     for(int i=0;i<popList.Count;i++) {
         //skip any popups that are disabled because they are on the event list
         bool popupIsDisabled=false;
         for(int e=0;e<PopupEventList.Count;e++){
             if(popList[i].PopupNum==PopupEventList[e].PopupNum){
                 popupIsDisabled=true;
                 break;
             }
         }
         if(popupIsDisabled){
             continue;
         }
         //This popup is not disabled, so show it.
         //A future improvement would be to assemble all the popups that are to be shown and then show them all in one large window.
         //But for now, they will show in sequence.
         if(ContrAppt2.Visible) {
             ContrAppt2.MouseUpForced();
         }
         FormPopupDisplay FormP=new FormPopupDisplay();
         FormP.PopupCur=popList[i];
         FormP.ShowDialog();
         if(FormP.MinutesDisabled>0){
             PopupEvent popevent=new PopupEvent();
             popevent.PopupNum=popList[i].PopupNum;
             popevent.DisableUntil=DateTime.Now+TimeSpan.FromMinutes(FormP.MinutesDisabled);
             PopupEventList.Add(popevent);
             PopupEventList.Sort();
         }
     }
 }
Exemplo n.º 2
0
		///<Summary>Serves four functions.  1. Sends the new patient to the dropdown menu for select patient.  2. Changes which toolbar buttons are enabled.  3. Sets main form text. 4. Displays any popup.</Summary>
		private void FillPatientButton(Patient pat){
			if(pat==null) {
				pat=new Patient();
			}
			bool patChanged=PatientL.AddPatsToMenu(menuPatient,new EventHandler(menuPatient_Click),pat.GetNameLF(),pat.PatNum);
			if(patChanged){
				if(AutomationL.Trigger(AutomationTrigger.OpenPatient,null,pat.PatNum)) {//if a trigger happened
					if(ContrAppt2.Visible) {
						ContrAppt2.MouseUpForced();
					}
				}
			}
			if(ToolBarMain.Buttons==null || ToolBarMain.Buttons.Count<2){//on startup.  js Not sure why it's checking count.
				return;
			}
			if(CurPatNum==0) {//Only on startup, I think.
				if(!Programs.UsingEcwTightMode()) {//eCW tight only gets Patient Select and Popups toolbar buttons
					ToolBarMain.Buttons["Email"].Enabled=false;
					ToolBarMain.Buttons["Text"].Enabled=false;
					ToolBarMain.Buttons["Commlog"].Enabled=false;
					ToolBarMain.Buttons["Letter"].Enabled=false;
					ToolBarMain.Buttons["Form"].Enabled=false;
					ToolBarMain.Buttons["Tasklist"].Enabled=false;
					ToolBarMain.Buttons["Label"].Enabled=false;
				}
				ToolBarMain.Buttons["Popups"].Enabled=false;
			}
			else {
				if(!Programs.UsingEcwTightMode()) {
					ToolBarMain.Buttons["Commlog"].Enabled=true;
					if(pat.Email!="") {
						ToolBarMain.Buttons["Email"].Enabled=true;
					}
					else {
						ToolBarMain.Buttons["Email"].Enabled=false;
					}
					if(pat.WirelessPhone=="" || !Programs.IsEnabled(ProgramName.CallFire)) {
						ToolBarMain.Buttons["Text"].Enabled=false;
					}
					else {//Pat has a wireless phone number and CallFire is enabled
						if(pat.TxtMsgOk==YN.Unknown) {
							ToolBarMain.Buttons["Text"].Enabled=!PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo);//Not enabled since TxtMsgOk is ?? and "Treat ?? As No" is true.
						}
						else {
							ToolBarMain.Buttons["Text"].Enabled=(pat.TxtMsgOk==YN.Yes);
						}
					}
					ToolBarMain.Buttons["Letter"].Enabled=true;
					ToolBarMain.Buttons["Form"].Enabled=true;
					ToolBarMain.Buttons["Tasklist"].Enabled=true;
					ToolBarMain.Buttons["Label"].Enabled=true;
				}
				ToolBarMain.Buttons["Popups"].Enabled=true;
			}
			ToolBarMain.Invalidate();
			Text=PatientL.GetMainTitle(pat,ClinicNum);
			if(PopupEventList==null){
				PopupEventList=new List<PopupEvent>();
			}
			if(Plugins.HookMethod(this,"FormOpenDental.FillPatientButton_popups",pat,PopupEventList,patChanged)) {
				return;
			}
			if(!patChanged) {
				return;
			}
			if(ContrChart2.Visible) {
				TryNonPatientPopup();
			}
			//New patient selected.  Everything below here is for popups.
			//First, remove all expired popups from the event list.
			for(int i=PopupEventList.Count-1;i>=0;i--){//go backwards
				if(PopupEventList[i].DisableUntil<DateTime.Now){//expired
					PopupEventList.RemoveAt(i);
				}
			}
			//Now, loop through all popups for the patient.
			List<Popup> popList=Popups.GetForPatient(pat.PatNum);//get all possible 
			for(int i=0;i<popList.Count;i++) {
				//skip any popups that are disabled because they are on the event list
				bool popupIsDisabled=false;
				for(int e=0;e<PopupEventList.Count;e++){
					if(popList[i].PopupNum==PopupEventList[e].PopupNum){
						popupIsDisabled=true;
						break;
					}
				}
				if(popupIsDisabled){
					continue;
				}
				//This popup is not disabled, so show it.
				//A future improvement would be to assemble all the popups that are to be shown and then show them all in one large window.
				//But for now, they will show in sequence.
				if(ContrAppt2.Visible) {
					ContrAppt2.MouseUpForced();
				}
				FormPopupDisplay FormP=new FormPopupDisplay();
				FormP.PopupCur=popList[i];
				FormP.ShowDialog();
				if(FormP.MinutesDisabled>0){
					PopupEvent popevent=new PopupEvent();
					popevent.PopupNum=popList[i].PopupNum;
					popevent.DisableUntil=DateTime.Now+TimeSpan.FromMinutes(FormP.MinutesDisabled);
					PopupEventList.Add(popevent);
					PopupEventList.Sort();
				}
			}
		}