Exemplo n.º 1
0
Arquivo: Commlogs.cs Projeto: mnisl/OD
		///<summary></summary>
		public static void Delete(Commlog comm) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),comm);
				return;
			}
			Crud.CommlogCrud.Delete(comm.CommlogNum);
		}
Exemplo n.º 2
0
Arquivo: Commlogs.cs Projeto: mnisl/OD
		///<summary></summary>
		public static long Insert(Commlog comm) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				comm.CommlogNum=Meth.GetLong(MethodBase.GetCurrentMethod(),comm);
				return comm.CommlogNum;
			}
			return Crud.CommlogCrud.Insert(comm);
		}
Exemplo n.º 3
0
 ///<summary>Updates only the changed fields (if any).</summary>
 public static bool Update(Commlog comm, Commlog oldCommlog)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetBool(MethodBase.GetCurrentMethod(), comm, oldCommlog));
     }
     return(Crud.CommlogCrud.Update(comm, oldCommlog));
 }
Exemplo n.º 4
0
 ///<summary></summary>
 public static void Delete(Commlog comm)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), comm);
         return;
     }
     Crud.CommlogCrud.Delete(comm.CommlogNum);
 }
Exemplo n.º 5
0
 ///<summary></summary>
 public static long Insert(Commlog comm)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         comm.CommlogNum = Meth.GetLong(MethodBase.GetCurrentMethod(), comm);
         return(comm.CommlogNum);
     }
     return(Crud.CommlogCrud.Insert(comm));
 }
Exemplo n.º 6
0
		/// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually  disabled if it is not OK, but this is needed for Confirmations, Recalls, etc.) </summary>
		public bool SendText(long patNum,string wirelessPhone,string message,YN txtMsgOk) {
			if(Plugins.HookMethod(this,"FormTxtMsgEdit.SendText_Start",patNum,wirelessPhone,message,txtMsgOk)) {
				return false;
			}
			if(Plugins.HookMethod(this,"FormTxtMsgEdit.SendText_Start2",patNum,wirelessPhone,message,txtMsgOk)) {
				return true;
			}
			if(wirelessPhone=="") {
				MsgBox.Show(this,"Please enter a phone number.");
				return false;
			}
			if(!Programs.IsEnabled(ProgramName.CallFire)) {
				MsgBox.Show(this,"CallFire Program Link must be enabled.");
				return false;
			}
			if(txtMsgOk==YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)){
				MsgBox.Show(this,"It is not OK to text this patient.");
				return false;
			}
			if(txtMsgOk==YN.No){
				MsgBox.Show(this,"It is not OK to text this patient.");
				return false;
			}
			if(message.Length>160) {
				MsgBox.Show(this,"Text length must be less than 160 characters.");
				return false;
			}
			string key=ProgramProperties.GetPropVal(ProgramName.CallFire,"Key From CallFire");
			string msg=wirelessPhone+","+message.Replace(",","");//ph#,msg Commas in msg cause error.
			try {
				CallFireService.SMSService callFire=new CallFireService.SMSService();
				callFire.sendSMSCampaign(
					key,
					new string[] { msg },
					"Open Dental");
			}
			catch(Exception ex) {
				MsgBox.Show(this,"Error sending text message.\r\n\r\n"+ex.Message);
				return false;
			}
			Commlog commlog=new Commlog();
			commlog.CommDateTime=DateTime.Now;
			commlog.DateTStamp=DateTime.Now;
			commlog.CommType=DefC.Short[(int)DefCat.CommLogTypes][0].DefNum;//The first one in the list.  We can enhance later.
			commlog.Mode_=CommItemMode.Text;
			commlog.Note=msg;//phone,note
			commlog.PatNum=patNum;
			commlog.SentOrReceived=CommSentOrReceived.Sent;
			commlog.UserNum=Security.CurUser.UserNum;
			commlog.DateTimeEnd=DateTime.Now;
			Commlogs.Insert(commlog);
			SecurityLogs.MakeLogEntry(Permissions.CommlogEdit,commlog.PatNum,"Insert Text Message");
			return true;
		}
Exemplo n.º 7
0
        //<summary>FK to emailmessage.EmailMessageNum, if there is an associated email. Otherwise 0.</summary>
        //public int EmailMessageNum;

        ///<summary></summary>
        public Commlog Copy()
        {
            Commlog c = new Commlog();

            c.CommlogNum     = CommlogNum;
            c.PatNum         = PatNum;
            c.CommDateTime   = CommDateTime;
            c.CommType       = CommType;
            c.Note           = Note;
            c.Mode_          = Mode_;
            c.SentOrReceived = SentOrReceived;
            return(c);
        }
Exemplo n.º 8
0
        ///<summary></summary>
        public static void Delete(Commlog comm)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), comm);
                return;
            }
            string command = "SELECT COUNT(*) FROM smsfrommobile WHERE CommlogNum=" + POut.Long(comm.CommlogNum);

            if (Db.GetCount(command) != "0")
            {
                throw new Exception(Lans.g("CommLogs", "Not allowed to delete a commlog attached to a text message."));
            }
            Crud.CommlogCrud.Delete(comm.CommlogNum);
        }
Exemplo n.º 9
0
 public bool Compare(Commlog commlogCur)
 {
     if (PatNum != commlogCur.PatNum ||
         CommDateTime != commlogCur.CommDateTime ||
         CommType != commlogCur.CommType ||
         Note != commlogCur.Note ||
         Mode_ != commlogCur.Mode_ ||
         SentOrReceived != commlogCur.SentOrReceived ||
         UserNum != commlogCur.UserNum)
     //Do we want to try and save the signature?
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 10
0
		private void butAddComm_Click(object sender, System.EventArgs e) {
			Commlog CommlogCur=new Commlog();
			CommlogCur.PatNum=pat.PatNum;
			CommlogCur.CommDateTime=DateTime.Now;
			CommlogCur.CommType=CommItemType.ApptRelated;
			FormCommItem FormCI=new FormCommItem(CommlogCur);
			FormCI.IsNew=true;
			FormCI.ShowDialog();
			FillComm();
		}	
Exemplo n.º 11
0
		private void butCommlog_Click(object sender,EventArgs e) {
			if(gridMain.SelectedIndices.Length==0) {
				MsgBox.Show(this,"Please select a patient first.");
				return;
			}
			//show the first one, and then make all the others very similar
			Commlog CommlogCur=new Commlog();
			CommlogCur.PatNum=PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
			CommlogCur.CommDateTime=DateTime.Now;
			CommlogCur.SentOrReceived=CommSentOrReceived.Sent;
			CommlogCur.Mode_=CommItemMode.Phone;//user can change this, of course.
			CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
			CommlogCur.UserNum=Security.CurUser.UserNum;
			FormCommItem FormCI=new FormCommItem(CommlogCur);
			FormCI.IsNew=true;
			FormCI.ShowDialog();
			if(FormCI.DialogResult!=DialogResult.OK) {
				return;
			}
			for(int i=1;i<gridMain.SelectedIndices.Length;i++) {
				CommlogCur.PatNum=PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
				Commlogs.Insert(CommlogCur);
			}
			FillMain(null);
		}
Exemplo n.º 12
0
 private void butPrint_Click(object sender, System.EventArgs e)
 {
     #if DISABLE_MICROSOFT_OFFICE
     MessageBox.Show(this, "This version of Open Dental does not support Microsoft Word.");
     return;
     #endif
     if(listLetters.SelectedIndex==-1){
         MsgBox.Show(this,"Please select a letter first.");
         return;
     }
     LetterMerge letterCur=ListForCat[listLetters.SelectedIndex];
     string templateFile=ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath),letterCur.TemplateName);
     string dataFile=ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath),letterCur.DataFileName);
     if(!File.Exists(templateFile)){
         MsgBox.Show(this,"Template file does not exist.");
         return;
     }
     PrintDocument pd=new PrintDocument();
     if(!PrinterL.SetPrinter(pd,PrintSituation.Default)){
         return;
     }
     if(!CreateDataFile(dataFile,letterCur)){
         return;
     }
     Word.MailMerge wrdMailMerge;
     //Create an instance of Word.
     Word.Application WrdApp=LetterMerges.WordApp;
     //Open a document.
     Object oName=templateFile;
     wrdDoc=WrdApp.Documents.Open(ref oName,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
     wrdDoc.Select();
     wrdMailMerge=wrdDoc.MailMerge;
     //Attach the data file.
     wrdDoc.MailMerge.OpenDataSource(dataFile,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
     wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
     //WrdApp.ActivePrinter=pd.PrinterSettings.PrinterName;
     //replaced with following 4 lines due to MS bug that changes computer default printer
     object oWBasic = WrdApp.WordBasic;
     object[] oWBValues = new object[] { pd.PrinterSettings.PrinterName, 1 };
     String[] sWBNames = new String[] { "Printer", "DoNotSetAsSysDefault" };
     oWBasic.GetType().InvokeMember("FilePrintSetup", BindingFlags.InvokeMethod, null, oWBasic, oWBValues, null, null, sWBNames);
     wrdMailMerge.Execute(ref oFalse);
     //Close the original form document since just one record.
     wrdDoc.Saved=true;
     wrdDoc.Close(ref oFalse,ref oMissing,ref oMissing);
     //At this point, Word remains open with no documents.
     WrdApp.WindowState=Word.WdWindowState.wdWindowStateMinimize;
     wrdMailMerge=null;
     wrdDoc=null;
     Commlog CommlogCur=new Commlog();
     CommlogCur.CommDateTime=DateTime.Now;
     CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
     CommlogCur.Mode_=CommItemMode.Mail;
     CommlogCur.SentOrReceived=CommSentOrReceived.Sent;
     CommlogCur.PatNum=PatCur.PatNum;
     CommlogCur.Note="Letter sent: "+letterCur.Description+". ";
     CommlogCur.UserNum=Security.CurUser.UserNum;
     Commlogs.Insert(CommlogCur);
     DialogResult=DialogResult.OK;
 }
Exemplo n.º 13
0
 private void OnCommlog_Click()
 {
     Commlog CommlogCur = new Commlog();
     CommlogCur.PatNum = CurPatNum;
     CommlogCur.CommDateTime = DateTime.Now;
     CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
     if(PrefC.GetBool(PrefName.DistributorKey)) {//for OD HQ
         CommlogCur.Mode_=CommItemMode.None;
         CommlogCur.SentOrReceived=CommSentOrReceived.Neither;
     }
     else {
         CommlogCur.Mode_=CommItemMode.Phone;
         CommlogCur.SentOrReceived=CommSentOrReceived.Received;
     }
     CommlogCur.UserNum=Security.CurUser.UserNum;
     FormCommItem FormCI = new FormCommItem(CommlogCur);
     FormCI.IsNew = true;
     FormCI.ShowDialog();
     if(FormCI.DialogResult == DialogResult.OK) {
         RefreshCurrentModule();
     }
 }
Exemplo n.º 14
0
		///<summary>Called from butOK_Click and butPin_Click</summary>
		private bool UpdateToDB(){
			DateTime dateTimeAskedToArrive=DateTime.MinValue;
			if(textTimeAskedToArrive.Text!=""){
				try{
					dateTimeAskedToArrive=AptCur.AptDateTime.Date+DateTime.Parse(textTimeAskedToArrive.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Asked To Arrive invalid.");
					return false;
				}
			}
			DateTime dateTimeArrived=AptCur.AptDateTime.Date;
			if(textTimeArrived.Text!=""){
				try{
					dateTimeArrived=AptCur.AptDateTime.Date+DateTime.Parse(textTimeArrived.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Arrived invalid.");
					return false;
				}
			}
			DateTime dateTimeSeated=AptCur.AptDateTime.Date;
			if(textTimeSeated.Text!=""){
				try{
					dateTimeSeated=AptCur.AptDateTime.Date+DateTime.Parse(textTimeSeated.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Seated invalid.");
					return false;
				}
			}
			DateTime dateTimeDismissed=AptCur.AptDateTime.Date;
			if(textTimeDismissed.Text!=""){
				try{
					dateTimeDismissed=AptCur.AptDateTime.Date+DateTime.Parse(textTimeDismissed.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Arrived invalid.");
					return false;
				}
			}
			//This change was just slightly too risky to make to 6.9, so 7.0 only
			if(AptCur.AptStatus!=ApptStatus.Complete//was not originally complete
				&& AptCur.AptStatus!=ApptStatus.PtNote
				&& AptCur.AptStatus!=ApptStatus.PtNoteCompleted
				&& comboStatus.SelectedIndex==1 //making it complete
				&& AptCur.AptDateTime.Date > DateTime.Today)//and future appt
			{
				MsgBox.Show(this,"Not allowed to set complete future appointments.");
				return false;
			}
			string aptPattern=Appointments.ConvertPatternTo5(strBTime.ToString());
			//Only run appt overlap check if editing an appt from the chart module and eCW program link not enabled.
			if(IsInChartModule && !Programs.UsingEcwTightOrFullMode()) {
				List<Appointment> apptList=Appointments.GetForPeriodList(AptCur.AptDateTime,AptCur.AptDateTime);
				if(DoesOverlap(aptPattern,apptList)) {
					MsgBox.Show(this,"Appointment is too long and would overlap another appointment.  Automatically shortened to fit.");
					do {
						aptPattern=aptPattern.Substring(0,aptPattern.Length-1);
						if(aptPattern.Length==1) {
							break;
						}
					} while(DoesOverlap(aptPattern,apptList));
				}
			}
			if(AptCur.AptStatus == ApptStatus.Planned) {
				;
			}
			else if(comboStatus.SelectedIndex==-1) {
				AptCur.AptStatus=ApptStatus.Scheduled;
			}
			else if (AptCur.AptStatus == ApptStatus.PtNote | AptCur.AptStatus == ApptStatus.PtNoteCompleted){
				AptCur.AptStatus = (ApptStatus)comboStatus.SelectedIndex + 7;
			}
			else {
				AptCur.AptStatus=(ApptStatus)comboStatus.SelectedIndex+1;
			}
			//set procs complete was moved further down
			//convert from current increment into 5 minute increment
			//MessageBox.Show(strBTime.ToString());
			AptCur.Pattern=aptPattern;
			if(comboUnschedStatus.SelectedIndex==0){//none
				AptCur.UnschedStatus=0;
			}
			else{
				AptCur.UnschedStatus=DefC.Short[(int)DefCat.RecallUnschedStatus][comboUnschedStatus.SelectedIndex-1].DefNum;
			}
			if(comboConfirmed.SelectedIndex!=-1){
				AptCur.Confirmed=DefC.Short[(int)DefCat.ApptConfirmed][comboConfirmed.SelectedIndex].DefNum;
			}
			AptCur.TimeLocked=checkTimeLocked.Checked;
			AptCur.ColorOverride=butColor.BackColor;
			AptCur.Note=textNote.Text;
			if(comboClinic.SelectedIndex==0) {//none
				AptCur.ClinicNum=0;
			}
			else {
				AptCur.ClinicNum=Clinics.List[comboClinic.SelectedIndex-1].ClinicNum;
			}
			//there should always be a non-hidden primary provider for an appt.
			if(comboProvNum.SelectedIndex==-1) {
				AptCur.ProvNum=ProviderC.ListShort[0].ProvNum;
			}
			else {
				AptCur.ProvNum=ProviderC.ListShort[comboProvNum.SelectedIndex].ProvNum;
			}
			if(comboProvHyg.SelectedIndex==0) {//none
				AptCur.ProvHyg=0;
			}
			else {
				AptCur.ProvHyg=ProviderC.ListShort[comboProvHyg.SelectedIndex-1].ProvNum;
			}
			AptCur.IsHygiene=checkIsHygiene.Checked;
			if(comboAssistant.SelectedIndex==0) {//none
				AptCur.Assistant=0;
			}
			else {
				AptCur.Assistant=Employees.ListShort[comboAssistant.SelectedIndex-1].EmployeeNum;
			}
			AptCur.IsNewPatient=checkIsNewPatient.Checked;
			AptCur.DateTimeAskedToArrive=dateTimeAskedToArrive;
			AptCur.DateTimeArrived=dateTimeArrived;
			AptCur.DateTimeSeated=dateTimeSeated;
			AptCur.DateTimeDismissed=dateTimeDismissed;
			//AptCur.InsPlan1 and InsPlan2 already handled 
			//The ApptProcDescript region is also in FormProcEdit.SaveAndClose() and FormDatabaseMaintenance.butApptProcs_Click()  Make any changes there as well.
			#region ApptProcDescript
			AptCur.ProcDescript="";
			AptCur.ProcsColored="";
			for(int i=0;i<gridProc.SelectedIndices.Length;i++) {
				string procDescOne="";
				string procCode=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ProcCode"].ToString();
				if(i>0){
					AptCur.ProcDescript+=", ";
				}
				switch(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["TreatArea"].ToString()) {
				  case "1"://TreatmentArea.Surf:
				    procDescOne+="#"+Tooth.GetToothLabel(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ToothNum"].ToString())+"-"
				      +DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//""#12-MOD-"
				    break;
				  case "2"://TreatmentArea.Tooth:
				    procDescOne+="#"+Tooth.GetToothLabel(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ToothNum"].ToString())+"-";//"#12-"
				    break;
				  default://area 3 or 0 (mouth)
				    break;
				  case "4"://TreatmentArea.Quad:
				    procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"UL-"
				    break;
				  case "5"://TreatmentArea.Sextant:
				    procDescOne+="S"+DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"S2-"
				    break;
				  case "6"://TreatmentArea.Arch:
				    procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"U-"
				    break;
				  case "7"://TreatmentArea.ToothRange:
				    //strLine+=table.Rows[j][13].ToString()+" ";//don't show range
				    break;
				}
				procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["AbbrDesc"].ToString();
				AptCur.ProcDescript+=procDescOne;
				//Color and previous date are determined by ProcApptColor object
				ProcApptColor pac=ProcApptColors.GetMatch(procCode);
				System.Drawing.Color pColor=System.Drawing.Color.Black;
				string prevDateString="";
				if(pac!=null){
					pColor=pac.ColorText;
					if(pac.ShowPreviousDate) {
						prevDateString=Procedures.GetRecentProcDateString(AptCur.PatNum,AptCur.AptDateTime,pac.CodeRange);
						if(prevDateString!="") {
							prevDateString=" ("+prevDateString+")";
						}
					}
				}
				AptCur.ProcsColored+="<span color=\""+pColor.ToArgb().ToString()+"\">"+procDescOne+prevDateString+"</span>";
			}
			#endregion
			bool isPlanned=AptCur.AptStatus==ApptStatus.Planned;
			try {
				Appointments.Update(AptCur,AptOld);
				//Appointments.UpdateAttached(AptCur.AptNum,procNums,isPlanned);
			}
			catch(ApplicationException ex) {
				MessageBox.Show(ex.Message);
				return false;
			}
			//if appointment is marked complete and any procedures are not,
			//then set the remaining procedures complete
			if(AptCur.AptStatus==ApptStatus.Complete) {
				bool allProcsComplete=true;
				for(int i=0;i<gridProc.SelectedIndices.Length;i++){
					if(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ProcStatus"].ToString()!="2") {//Complete
						allProcsComplete=false;
						break;
					}
				}
				if(!allProcsComplete) {
					if(!Security.IsAuthorized(Permissions.ProcComplCreate,AptCur.AptDateTime)) {
						return false;
					}
					List <PatPlan> PatPlanList=PatPlans.Refresh(AptCur.PatNum);
					ProcedureL.SetCompleteInAppt(AptCur,PlanList,PatPlanList,pat.SiteNum,pat.Age,SubList);
					SecurityLogs.MakeLogEntry(Permissions.ProcComplCreate,pat.PatNum,
						AptCur.AptDateTime.ToShortDateString()+", "+AptCur.ProcDescript+", Procedures automatically set complete due to appt being set complete",0);
				}
			}
			else{
				Procedures.SetProvidersInAppointment(AptCur,Procedures.GetProcsForSingle(AptCur.AptNum,false));
			}
			//Do the appointment "break" automation for appointments that were just broken.
			if(AptCur.AptStatus==ApptStatus.Broken && AptOld.AptStatus!=ApptStatus.Broken) {
				SecurityLogs.MakeLogEntry(Permissions.AppointmentMove,pat.PatNum,AptCur.ProcDescript+", "+AptCur.AptDateTime.ToString()
					+", Broken by changing the Status in the Edit Appointment window.",AptCur.AptNum);
				if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
					Commlog CommlogCur=new Commlog();
					CommlogCur.PatNum=pat.PatNum;
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
					CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+AptCur.ProcDescript+"  "+AptCur.AptDateTime.ToString();
					CommlogCur.Mode_=CommItemMode.None;
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					FormCI.ShowDialog();
				}
				else {
					Adjustment AdjustmentCur=new Adjustment();
					AdjustmentCur.DateEntry=DateTime.Today;
					AdjustmentCur.AdjDate=DateTime.Today;
					AdjustmentCur.ProcDate=DateTime.Today;
					AdjustmentCur.ProvNum=AptCur.ProvNum;
					AdjustmentCur.PatNum=pat.PatNum;
					AdjustmentCur.AdjType=PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType);
					AdjustmentCur.ClinicNum=pat.ClinicNum;
					FormAdjust FormA=new FormAdjust(pat,AdjustmentCur);
					FormA.IsNew=true;
					FormA.ShowDialog();
				}
				AutomationL.Trigger(AutomationTrigger.BreakAppointment,null,pat.PatNum);
			}
			return true;
		}
Exemplo n.º 15
0
        private static void MakeCommlog(Patient pat, string phoneNumber, int statusCode)
        {
            string commText = "";

            //Status code meanings:
            //		-100: Patient had no phone number
            //		-200: Patient can't text and had no email
            //		2XX: Successfully sent message
            //		422: Message has already been sent for patient
            //		Anything else: Failure of some sort.
            switch (statusCode / 100)           //Get general http status codes e.g. -100=-1, 203=2
            {
            case -1:                            //Failure, no phone number
                commText = Lans.g("Podium", "Podium review invitation request failed because there was no phone number.  Error code:") + " " + statusCode;
                break;

            case -2:                            //Failure, no email
                commText = Lans.g("Podium", "Podium review invitation request failed because the patient doesn't accept texts "
                                  + "and there was no email address.  Error code:") + " " + statusCode;
                break;

            case 2:                     //Success https://httpstatusdogs.com/200-ok
                commText = Lans.g("Podium", "Podium review invitation request successfully sent.");
                break;

            case 4:                     //Client side communication failure https://httpstatusdogs.com/400-bad-request
                if (statusCode == 422)  //422 is Unprocessable Entity, which is sent in this case when a phone number has received an invite already.
                {
                    commText = Lans.g("Podium", "The request failed because an identical request was previously sent.");
                }
                else
                {
                    commText = Lans.g("Podium", "The request failed to reach Podium with error code:") + " " + statusCode;
                }
                break;

            case 5:                     //Server side internal failure. https://httpstatusdogs.com/500-internal-server-error
                commText = Lans.g("Podium", "The request was rejected by the Podium server with error code:") + " " + statusCode;
                break;

            default:                            //General Failure
                commText = Lans.g("Podium", "The request failed to send with error code:") + " " + statusCode;
                break;
            }
            if (!string.IsNullOrEmpty(commText))
            {
                commText += "\r\n";
            }
            commText += Lans.g("Podium", "The information sent in the request was") + ": \r\n"
                        + Lans.g("Podium", "First name") + ": \"" + pat.FName + "\", "
                        + Lans.g("Podium", "Last name") + ": \"" + pat.LName + "\", "
                        + Lans.g("Podium", "Email") + ": \"" + pat.Email + "\"";
            if (phoneNumber != "")           //If "successful".
            {
                commText += ", " + Lans.g("Podium", "Phone number") + ": \"" + phoneNumber + "\"";
            }
            else
            {
                string        wirelessPhone = new string(pat.WirelessPhone.Where(x => char.IsDigit(x)).ToArray());
                string        homePhone = new string(pat.HmPhone.Where(x => char.IsDigit(x)).ToArray());
                List <string> phonesTried = new List <string> {
                    wirelessPhone, homePhone
                }.FindAll(x => x != "");
                string phoneNumbersTried = ", " + Lans.g("Podium", "No valid phone number found.");
                if (pat.TxtMsgOk == YN.No || (pat.TxtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)))             //Used email
                {
                    phoneNumbersTried = "";
                }
                else if (phonesTried.Count > 0)
                {
                    phoneNumbersTried = ", " + Lans.g("Podium", "Phone numbers tried") + ": " + string.Join(", ", phonesTried);
                }
                commText += phoneNumbersTried;
            }
            long    programNum = Programs.GetProgramNum(ProgramName.Podium);
            Commlog commlogCur = new Commlog();

            commlogCur.CommDateTime   = DateTime.Now;
            commlogCur.DateTimeEnd    = DateTime.Now;
            commlogCur.PatNum         = pat.PatNum;
            commlogCur.UserNum        = 0;   //run from server, no valid CurUser
            commlogCur.CommSource     = CommItemSource.ProgramLink;
            commlogCur.ProgramNum     = programNum;
            commlogCur.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
            commlogCur.Note           = commText;
            commlogCur.Mode_          = CommItemMode.Text;
            commlogCur.SentOrReceived = CommSentOrReceived.Sent;
            Commlogs.Insert(commlogCur);
        }
Exemplo n.º 16
0
		private void OnBreak_Click() {
			if(!PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment) && PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType)==0) {
				MsgBox.Show(this,"Broken appointment adjustment type is not setup yet.  Please go to Setup | Modules to fix this.");
				return;
			}
			int thisI=GetIndex(ContrApptSingle.SelectedAptNum);
			if(thisI==-1) {//selected appt is on a different day
				MsgBox.Show(this,"Please select an appointment first.");
				return;
			}
			Appointment apt = Appointments.GetOneApt(ContrApptSingle.SelectedAptNum);
			Patient pat=Patients.GetPat(PIn.Long(ContrApptSingle3[thisI].DataRoww["PatNum"].ToString()));
			if(!Security.IsAuthorized(Permissions.AppointmentEdit)) {
				return;
			}
			if(apt.AptStatus == ApptStatus.PtNote || apt.AptStatus == ApptStatus.PtNoteCompleted) {
				MsgBox.Show(this,"Only appointments may be broken, not notes.");
				return;
			}
			if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
				if(!MsgBox.Show(this,true,"Break appointment?")) {
					return;
				}
			}
			Appointments.SetAptStatus(ContrApptSingle.SelectedAptNum,ApptStatus.Broken);
			SecurityLogs.MakeLogEntry(Permissions.AppointmentMove,pat.PatNum,
				ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", Broken from the Appts module.",
				PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
			long provNum=PIn.Long(ContrApptSingle3[thisI].DataRoww["ProvNum"].ToString());//remember before ModuleSelected
			ModuleSelected(pat.PatNum);
			SetInvalid();
			if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
				Commlog CommlogCur=new Commlog();
				CommlogCur.PatNum=pat.PatNum;
				CommlogCur.CommDateTime=DateTime.Now;
				CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
				CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+apt.ProcDescript+"  "+apt.AptDateTime.ToString();
				CommlogCur.Mode_=CommItemMode.None;
				CommlogCur.UserNum=Security.CurUser.UserNum;
				FormCommItem FormCI=new FormCommItem(CommlogCur);
				FormCI.IsNew=true;
				FormCI.ShowDialog();
			}
			else {
				Adjustment AdjustmentCur=new Adjustment();
				AdjustmentCur.DateEntry=DateTime.Today;
				AdjustmentCur.AdjDate=DateTime.Today;
				AdjustmentCur.ProcDate=DateTime.Today;
				AdjustmentCur.ProvNum=provNum;
				AdjustmentCur.PatNum=pat.PatNum;
				AdjustmentCur.AdjType=PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType);
				AdjustmentCur.ClinicNum=pat.ClinicNum;
				FormAdjust FormA=new FormAdjust(pat,AdjustmentCur);
				FormA.IsNew=true;
				FormA.ShowDialog();
			}
			AutomationL.Trigger(AutomationTrigger.BreakAppointment,null,pat.PatNum);
			Recalls.SynchScheduledApptFull(apt.PatNum);
		}
Exemplo n.º 17
0
		private void pd2_PrintApptCard(object sender,PrintPageEventArgs ev) {
			Graphics g=ev.Graphics;
			//Return Address--------------------------------------------------------------------------
			string str=PrefC.GetString(PrefName.PracticeTitle)+"\r\n";
			g.DrawString(str,new Font(FontFamily.GenericSansSerif,9,FontStyle.Bold),Brushes.Black,60,60);
			str=PrefC.GetString(PrefName.PracticeAddress)+"\r\n";
			if(PrefC.GetString(PrefName.PracticeAddress2)!="") {
				str+=PrefC.GetString(PrefName.PracticeAddress2)+"\r\n";
			}
			str+=PrefC.GetString(PrefName.PracticeCity)+"  "
				+PrefC.GetString(PrefName.PracticeST)+"  "
				+PrefC.GetString(PrefName.PracticeZip)+"\r\n";
			string phone=PrefC.GetString(PrefName.PracticePhone);
			if(CultureInfo.CurrentCulture.Name=="en-US"
				&& phone.Length==10) {
				str+="("+phone.Substring(0,3)+")"+phone.Substring(3,3)+"-"+phone.Substring(6);
			}
			else {//any other phone format
				str+=phone;
			}
			g.DrawString(str,new Font(FontFamily.GenericSansSerif,8),Brushes.Black,60,75);
			//Body text-------------------------------------------------------------------------------
			string name;
			str="Appointment Reminders:"+"\r\n\r\n";
			Appointment[] aptsOnePat;
			Family fam=Patients.GetFamily(PatCur.PatNum);
			Patient pat=fam.GetPatient(PatCur.PatNum);
			for(int i=0;i<fam.ListPats.Length;i++) {
				if(!cardPrintFamily && fam.ListPats[i].PatNum!=pat.PatNum) {
					continue;
				}
				name=fam.ListPats[i].FName;
				if(name.Length>15) {//trim name so it won't be too long
					name=name.Substring(0,15);
				}
				aptsOnePat=Appointments.GetForPat(fam.ListPats[i].PatNum);
				for(int a=0;a<aptsOnePat.Length;a++) {
					if(aptsOnePat[a].AptDateTime.Date<=DateTime.Today) {
						continue;//ignore old appts
					}
					if(aptsOnePat[a].AptStatus!=ApptStatus.Scheduled && aptsOnePat[a].AptStatus!=ApptStatus.ASAP){
						continue;
					}
					str+=name+": "+aptsOnePat[a].AptDateTime.ToShortDateString()+" "+aptsOnePat[a].AptDateTime.ToShortTimeString()+"\r\n";
				}
			}
			g.DrawString(str,new Font(FontFamily.GenericSansSerif,9),Brushes.Black,40,180);
			//Patient's Address-----------------------------------------------------------------------
			Patient guar;
			if(cardPrintFamily) {
				guar=fam.ListPats[0].Copy();
			}
			else {
				guar=pat.Copy();
			}
			str=guar.FName+" "+guar.LName+"\r\n"
				+guar.Address+"\r\n";
			if(guar.Address2!="") {
				str+=guar.Address2+"\r\n";
			}
			str+=guar.City+"  "+guar.State+"  "+guar.Zip;
			g.DrawString(str,new Font(FontFamily.GenericSansSerif,11),Brushes.Black,300,240);
			//CommLog entry---------------------------------------------------------------------------
			Commlog CommlogCur=new Commlog();
			CommlogCur.CommDateTime=DateTime.Now;
			CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
			CommlogCur.Note="Appointment card sent";
			CommlogCur.PatNum=pat.PatNum;
			CommlogCur.UserNum=Security.CurUser.UserNum;
			//there is no dialog here because it is just a simple entry
			Commlogs.Insert(CommlogCur);
			ev.HasMorePages = false;
		}
Exemplo n.º 18
0
        ///<summary>Attempts to find exact match for patient. If found, creates commlog, associates Patnum, and inserts into DB.
        ///Otherwise, it simply inserts SmsFromMobiles into the DB. ClinicNum should have already been set before calling this function.</summary>
        public static void ProcessInboundSms(List <SmsFromMobile> listMessages)
        {
            if (listMessages == null || listMessages.Count == 0)
            {
                return;
            }
            List <SmsBlockPhone> listBlockedPhones = SmsBlockPhones.GetDeepCopy();

            for (int i = 0; i < listMessages.Count; i++)
            {
                SmsFromMobile sms = listMessages[i];
                if (listBlockedPhones.Any(x => TelephoneNumbers.AreNumbersEqual(x.BlockWirelessNumber, sms.MobilePhoneNumber)))
                {
                    continue;                    //The office has blocked this number.
                }
                sms.DateTimeReceived = DateTime.Now;
                string countryCode = CultureInfo.CurrentCulture.Name.Substring(CultureInfo.CurrentCulture.Name.Length - 2);
                if (sms.SmsPhoneNumber != SmsPhones.SHORTCODE)
                {
                    SmsPhone smsPhone = SmsPhones.GetByPhone(sms.SmsPhoneNumber);
                    if (smsPhone != null)
                    {
                        sms.ClinicNum = smsPhone.ClinicNum;
                        countryCode   = smsPhone.CountryCode;
                    }
                }
                if (!PrefC.HasClinicsEnabled)
                {
                    //We want customer side records of this message to list SmsPhones.SHORTCODE as the number on which the message was sent.  This ensures we do
                    //not record this communication on a different valid SmsPhone/VLN that it didn't truly take place on.  However, on the HQ side, we want
                    //records of this communication to be listed as having taken place on the actual Short Code number.  In the case of a Short Code,
                    //sms.SmsPhoneNumber will read "SHORTCODE", which won't be found in the customer's SmsPhone table.  As a result, the code to use the
                    //customer's SmsPhone.ClinicNum and Country code cannot be used.  Since this code was intended to handle the case where the customer had
                    //turned clinics on->off, we will specifically check if the customer has disabled clinics and only then change the sms.ClinicNum.
                    //Otherwise, trust HQ sent the correct ClinicNum.  Since we expect to only use Short Codes in the US/Canada, we will trust the server we
                    //are processing inbound sms will have the correct country code, which will be used here.
                    sms.ClinicNum = 0;
                }
                //First try the clinic that belongs to this phone.
                List <long> listClinicNums = new List <long>();
                if (sms.ClinicNum != 0)
                {
                    listClinicNums.Add(sms.ClinicNum);
                }
                List <long[]> listPatNums = FindPatNums(sms.MobilePhoneNumber, countryCode, listClinicNums);
                if (listPatNums.Count == 0 && listClinicNums.Count > 0)            //Could not find that patient in this clinic so try again for all clinics.
                {
                    listPatNums = FindPatNums(sms.MobilePhoneNumber, countryCode);
                }
                sms.MatchCount = listPatNums.Count;
                //Item1=PatNum; Item2=Guarantor
                if (listPatNums.Count == 0 || listPatNums.Select(x => x[1]).Distinct().ToList().Count != 1)
                {
                    //We could not find definitive match, either 0 matches found, or more than one match found with different garantors
                    Insert(sms);
                    //Alert ODMobile where applicable.
                    PushNotificationUtils.ODM_NewTextMessage(sms);
                    continue;
                }
                if (listPatNums.Count == 1)
                {
                    sms.PatNum = listPatNums[0][0];                  //PatNum
                }
                else
                {
                    sms.PatNum = listPatNums[0][1];                  //GuarantorNum;  more than one match, but all have the same garantor.
                }
                Commlog comm = new Commlog()
                {
                    CommDateTime   = sms.DateTimeReceived,
                    Mode_          = CommItemMode.Text,
                    Note           = sms.MsgText,
                    PatNum         = sms.PatNum,
                    CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.TEXT),
                    SentOrReceived = CommSentOrReceived.Received
                };
                sms.CommlogNum = Commlogs.Insert(comm);
                Insert(sms);
                //Alert ODMobile where applicable.
                PushNotificationUtils.ODM_NewTextMessage(sms, sms.PatNum);
            }
            //We used to update the SmsNotification indicator via a queries and a signal here.  Now managed by the eConnector.
        }
Exemplo n.º 19
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			SelectedPatNum=PIn.Long(table.Rows[e.Row]["PatNum"].ToString());
			Recall recall=Recalls.GetRecall(PIn.Long(table.Rows[e.Row]["RecallNum"].ToString()));
			FormRecallEdit FormR=new FormRecallEdit();
			FormR.RecallCur=recall.Copy();
			FormR.ShowDialog();
			if(FormR.DialogResult!=DialogResult.OK) {
				return;
			}
			if(recall.RecallStatus!=FormR.RecallCur.RecallStatus//if the status has changed
				|| (recall.IsDisabled != FormR.RecallCur.IsDisabled)//or any of the three disabled fields was changed
				|| (recall.DisableUntilDate != FormR.RecallCur.DisableUntilDate)
				|| (recall.DisableUntilBalance != FormR.RecallCur.DisableUntilBalance)
				|| (recall.Note != FormR.RecallCur.Note))//or a note was added
			{
				//make a commlog entry
				//unless there is an existing recall commlog entry for today
				bool recallEntryToday=false;
				List<Commlog> CommlogList=Commlogs.Refresh(SelectedPatNum);
				for(int i=0;i<CommlogList.Count;i++) {
					if(CommlogList[i].CommDateTime.Date==DateTime.Today	
						&& CommlogList[i].CommType==Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL)) {
						recallEntryToday=true;
					}
				}
				if(!recallEntryToday) {
					Commlog CommlogCur=new Commlog();
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
					CommlogCur.PatNum=SelectedPatNum;
					CommlogCur.Note="";
					if(recall.RecallStatus!=FormR.RecallCur.RecallStatus) {
						if(FormR.RecallCur.RecallStatus==0) {
							CommlogCur.Note+=Lan.g(this,"Status None");
						}
						else {
							CommlogCur.Note+=DefC.GetName(DefCat.RecallUnschedStatus,FormR.RecallCur.RecallStatus);
						}
					}
					if(recall.DisableUntilDate!=FormR.RecallCur.DisableUntilDate && FormR.RecallCur.DisableUntilDate.Year>1880) {
						if(CommlogCur.Note!="") {
							CommlogCur.Note+=",  ";
						}
						CommlogCur.Note+=Lan.g(this,"Disabled until ")+FormR.RecallCur.DisableUntilDate.ToShortDateString();
					}
					if(recall.DisableUntilBalance!=FormR.RecallCur.DisableUntilBalance && FormR.RecallCur.DisableUntilBalance>0) {
						if(CommlogCur.Note!="") {
							CommlogCur.Note+=",  ";
						}
						CommlogCur.Note+=Lan.g(this,"Disabled until balance below ")+FormR.RecallCur.DisableUntilBalance.ToString("c");
					}
					if(recall.Note!=FormR.RecallCur.Note) {
						if(CommlogCur.Note!="") {
							CommlogCur.Note+=",  ";
						}
						CommlogCur.Note+=FormR.RecallCur.Note;
					}
					CommlogCur.Note+=".  ";
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					//forces user to at least consider a commlog entry
					FormCI.ShowDialog();//typically saved in this window.
				}
			}
			FillMain(null);
			for(int i=0;i<gridMain.Rows.Count;i++) {
				if(PIn.Long(table.Rows[i]["PatNum"].ToString())==SelectedPatNum){
					gridMain.SetSelected(i,true);
				}
			}
			SetFamilyColors();
		}
Exemplo n.º 20
0
		///<summary>Only used for eCW tight.  Everyone else has the commlog button up in the main toolbar.</summary>
		private void Tool_Commlog_Click() {
			Commlog CommlogCur = new Commlog();
			CommlogCur.PatNum = PatCur.PatNum;
			CommlogCur.CommDateTime = DateTime.Now;
			CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
			CommlogCur.Mode_=CommItemMode.Phone;
			CommlogCur.SentOrReceived=CommSentOrReceived.Received;
			CommlogCur.UserNum=Security.CurUser.UserNum;
			FormCommItem FormCI = new FormCommItem(CommlogCur);
			FormCI.IsNew = true;
			FormCI.ShowDialog();
			if(FormCI.DialogResult == DialogResult.OK) {
				ModuleSelected(PatCur.PatNum);
			}
		}
Exemplo n.º 21
0
		private void butDelete_Click(object sender,EventArgs e) {
			if (AptCur.AptStatus == ApptStatus.PtNote || AptCur.AptStatus == ApptStatus.PtNoteCompleted) {
				if (!MsgBox.Show(this, true, "Delete Patient Note?")) {
					return;
				}
				if(textNote.Text != "") {
					if(MessageBox.Show(Commlogs.GetDeleteApptCommlogMessage(textNote.Text,AptCur.AptStatus),"Question...",MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = AptCur.PatNum;
						CommlogCur.CommDateTime = DateTime.Now;
						CommlogCur.CommType = Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Pt NOTE from schedule, saved copy: ";
						CommlogCur.Note += textNote.Text;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
			}
			else {//ordinary appointment
				if (MessageBox.Show(Lan.g(this, "Delete appointment?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) {
					return;
				}
				if(textNote.Text != "") {
					if(MessageBox.Show(Commlogs.GetDeleteApptCommlogMessage(textNote.Text,AptCur.AptStatus),"Question...",MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = AptCur.PatNum;
						CommlogCur.CommDateTime = DateTime.Now;
						CommlogCur.CommType = Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Appt. & saved note: ";
						if(AptCur.ProcDescript != "") {
							CommlogCur.Note += AptCur.ProcDescript + ": ";
						}
						CommlogCur.Note += textNote.Text;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
				//If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
				if(HL7Defs.IsExistingHL7Enabled()) {
					//S17 - Appt Deletion event
					MessageHL7 messageHL7=MessageConstructor.GenerateSIU(pat,fam.GetPatient(pat.Guarantor),EventTypeHL7.S17,AptCur);
					//Will be null if there is no outbound SIU message defined, so do nothing
					if(messageHL7!=null) {
						HL7Msg hl7Msg=new HL7Msg();
						hl7Msg.AptNum=AptCur.AptNum;
						hl7Msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
						hl7Msg.MsgText=messageHL7.ToString();
						hl7Msg.PatNum=pat.PatNum;
						HL7Msgs.Insert(hl7Msg);
#if DEBUG
						MessageBox.Show(this,messageHL7.ToString());
#endif
					}
				}
			}
			Appointments.Delete(AptCur.AptNum);
			SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,pat.PatNum,
				"Delete for date/time: "+AptCur.AptDateTime.ToString(),
				AptCur.AptNum);
			if(IsNew){
				//The dialog is considered cancelled when a new appointment is immediately deleted.
			  DialogResult=DialogResult.Cancel;
			}
			else{
				DialogResult=DialogResult.OK;
			}
		}
Exemplo n.º 22
0
		///<summary>Called from butOK_Click and butPin_Click</summary>
		private bool UpdateToDB(){
			DateTime dateTimeAskedToArrive=DateTime.MinValue;
			if((AptOld.AptStatus==ApptStatus.Complete && comboStatus.SelectedIndex!=1)
				|| (AptOld.AptStatus==ApptStatus.Broken && comboStatus.SelectedIndex!=4)) //Un-completing or un-breaking the appt.  We must use selectedindex due to AptCur gets updated later UpdateDB()
			{
				//If the insurance plans have changed since this appt was completed, warn the user that the historical data will be neutralized.
				List<PatPlan> listPatPlans=PatPlans.Refresh(pat.PatNum);
				InsSub sub1=InsSubs.GetSub(PatPlans.GetInsSubNum(listPatPlans,PatPlans.GetOrdinal(PriSecMed.Primary,listPatPlans,PlanList,SubList)),SubList);
				InsSub sub2=InsSubs.GetSub(PatPlans.GetInsSubNum(listPatPlans,PatPlans.GetOrdinal(PriSecMed.Secondary,listPatPlans,PlanList,SubList)),SubList);
				if(sub1.PlanNum!=AptCur.InsPlan1 || sub2.PlanNum!=AptCur.InsPlan2) {
					if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"The current insurance plans for this patient are different than the plans associated to this appointment.  They will be updated to the patient's current insurance plans.  Continue?")) {
						return false;
					}
					//Update the ins plans associated to this appointment so that they're the most accurate at this time.
					AptCur.InsPlan1=sub1.PlanNum;
					AptCur.InsPlan2=sub2.PlanNum;
				}
			}
			if(textTimeAskedToArrive.Text!=""){
				try{
					dateTimeAskedToArrive=AptCur.AptDateTime.Date+DateTime.Parse(textTimeAskedToArrive.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Asked To Arrive invalid.");
					return false;
				}
			}
			DateTime dateTimeArrived=AptCur.AptDateTime.Date;
			if(textTimeArrived.Text!=""){
				try{
					dateTimeArrived=AptCur.AptDateTime.Date+DateTime.Parse(textTimeArrived.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Arrived invalid.");
					return false;
				}
			}
			DateTime dateTimeSeated=AptCur.AptDateTime.Date;
			if(textTimeSeated.Text!=""){
				try{
					dateTimeSeated=AptCur.AptDateTime.Date+DateTime.Parse(textTimeSeated.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Seated invalid.");
					return false;
				}
			}
			DateTime dateTimeDismissed=AptCur.AptDateTime.Date;
			if(textTimeDismissed.Text!=""){
				try{
					dateTimeDismissed=AptCur.AptDateTime.Date+DateTime.Parse(textTimeDismissed.Text).TimeOfDay;
				}
				catch{
					MsgBox.Show(this,"Time Arrived invalid.");
					return false;
				}
			}
			//This change was just slightly too risky to make to 6.9, so 7.0 only
			if(AptCur.AptStatus!=ApptStatus.Complete//was not originally complete
				&& AptCur.AptStatus!=ApptStatus.PtNote
				&& AptCur.AptStatus!=ApptStatus.PtNoteCompleted
				&& comboStatus.SelectedIndex==1 //making it complete
				&& AptCur.AptDateTime.Date > DateTime.Today)//and future appt
			{
				MsgBox.Show(this,"Not allowed to set complete future appointments.");
				return false;
			}
			string aptPattern=Appointments.ConvertPatternTo5(strBTime.ToString());
			//Only run appt overlap check if editing an appt not in unscheduled list and in chart module and eCW program link not enabled.
			if((IsInChartModule || IsInViewPatAppts) && !Programs.UsingEcwTightOrFullMode() && AptCur.AptStatus!=ApptStatus.UnschedList) {
				//==Travis 04/06/2015:  This call was added on 04/23/2014 and backported to 14.1.  It is not storing the return value and does not look to be
				//		doing anything so it has been commented out.
				//Appointments.RefreshPeriod(AptCur.AptDateTime,AptCur.AptDateTime);
				List<Appointment> apptList=Appointments.GetForPeriodList(AptCur.AptDateTime,AptCur.AptDateTime);
				if(DoesOverlap(aptPattern,apptList)) {
					MsgBox.Show(this,"Appointment is too long and would overlap another appointment.  Automatically shortened to fit.");
					do {
						aptPattern=aptPattern.Substring(0,aptPattern.Length-1);
						if(aptPattern.Length==1) {
							break;
						}
					} while(DoesOverlap(aptPattern,apptList));
				}
			}
			if(AptCur.AptStatus == ApptStatus.Planned) {
				;
			}
			else if(comboStatus.SelectedIndex==-1) {
				AptCur.AptStatus=ApptStatus.Scheduled;
			}
			else if (AptCur.AptStatus == ApptStatus.PtNote | AptCur.AptStatus == ApptStatus.PtNoteCompleted){
				AptCur.AptStatus = (ApptStatus)comboStatus.SelectedIndex + 7;
			}
			else {
				AptCur.AptStatus=(ApptStatus)comboStatus.SelectedIndex+1;
			}
			//set procs complete was moved further down
			//convert from current increment into 5 minute increment
			//MessageBox.Show(strBTime.ToString());
			AptCur.Pattern=aptPattern;
			if(comboUnschedStatus.SelectedIndex==0){//none
				AptCur.UnschedStatus=0;
			}
			else{
				AptCur.UnschedStatus=DefC.Short[(int)DefCat.RecallUnschedStatus][comboUnschedStatus.SelectedIndex-1].DefNum;
			}
			if(comboConfirmed.SelectedIndex!=-1){
				AptCur.Confirmed=DefC.Short[(int)DefCat.ApptConfirmed][comboConfirmed.SelectedIndex].DefNum;
			}
			AptCur.TimeLocked=checkTimeLocked.Checked;
			AptCur.ColorOverride=butColor.BackColor;
			AptCur.Note=textNote.Text;
			if(comboClinic.SelectedIndex==0) {//none
				AptCur.ClinicNum=0;
			}
			else {
				AptCur.ClinicNum=Clinics.List[comboClinic.SelectedIndex-1].ClinicNum;
			}
			//there should always be a non-hidden primary provider for an appt.
			if(comboProvNum.SelectedIndex==-1) {
				AptCur.ProvNum=ProviderC.ListShort[0].ProvNum;
			}
			else {
				AptCur.ProvNum=ProviderC.ListShort[comboProvNum.SelectedIndex].ProvNum;
			}
			if(comboProvHyg.SelectedIndex==0) {//none
				AptCur.ProvHyg=0;
			}
			else {
				AptCur.ProvHyg=ProviderC.ListShort[comboProvHyg.SelectedIndex-1].ProvNum;
			}
			AptCur.IsHygiene=checkIsHygiene.Checked;
			if(comboAssistant.SelectedIndex==0) {//none
				AptCur.Assistant=0;
			}
			else {
				AptCur.Assistant=Employees.ListShort[comboAssistant.SelectedIndex-1].EmployeeNum;
			}
			AptCur.IsNewPatient=checkIsNewPatient.Checked;
			AptCur.DateTimeAskedToArrive=dateTimeAskedToArrive;
			AptCur.DateTimeArrived=dateTimeArrived;
			AptCur.DateTimeSeated=dateTimeSeated;
			AptCur.DateTimeDismissed=dateTimeDismissed;
			//AptCur.InsPlan1 and InsPlan2 already handled 
			//The ApptProcDescript region is also in FormProcEdit.SaveAndClose() and FormDatabaseMaintenance.butApptProcs_Click()  Make any changes there as well.
			#region ApptProcDescript
			AptCur.ProcDescript="";
			AptCur.ProcsColored="";
			for(int i=0;i<gridProc.SelectedIndices.Length;i++) {
				string procDescOne="";
				string procCode=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ProcCode"].ToString();
				if(i>0){
					AptCur.ProcDescript+=", ";
				}
				switch(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["TreatArea"].ToString()) {
				  case "1"://TreatmentArea.Surf:
				    procDescOne+="#"+Tooth.GetToothLabel(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ToothNum"].ToString())+"-"
				      +DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//""#12-MOD-"
				    break;
				  case "2"://TreatmentArea.Tooth:
				    procDescOne+="#"+Tooth.GetToothLabel(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ToothNum"].ToString())+"-";//"#12-"
				    break;
				  default://area 3 or 0 (mouth)
				    break;
				  case "4"://TreatmentArea.Quad:
				    procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"UL-"
				    break;
				  case "5"://TreatmentArea.Sextant:
				    procDescOne+="S"+DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"S2-"
				    break;
				  case "6"://TreatmentArea.Arch:
				    procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["Surf"].ToString()+"-";//"U-"
				    break;
				  case "7"://TreatmentArea.ToothRange:
				    //strLine+=table.Rows[j][13].ToString()+" ";//don't show range
				    break;
				}
				procDescOne+=DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["AbbrDesc"].ToString();
				AptCur.ProcDescript+=procDescOne;
				//Color and previous date are determined by ProcApptColor object
				ProcApptColor pac=ProcApptColors.GetMatch(procCode);
				System.Drawing.Color pColor=System.Drawing.Color.Black;
				string prevDateString="";
				if(pac!=null){
					pColor=pac.ColorText;
					if(pac.ShowPreviousDate) {
						prevDateString=Procedures.GetRecentProcDateString(AptCur.PatNum,AptCur.AptDateTime,pac.CodeRange);
						if(prevDateString!="") {
							prevDateString=" ("+prevDateString+")";
						}
					}
				}
				AptCur.ProcsColored+="<span color=\""+pColor.ToArgb().ToString()+"\">"+procDescOne+prevDateString+"</span>";
			}
			#endregion
			bool isPlanned=AptCur.AptStatus==ApptStatus.Planned;
			if(comboApptType.SelectedIndex==0) {//0 index = none.
				AptCur.AppointmentTypeNum=0;
			}
			else {
				AptCur.AppointmentTypeNum=_listAppointmentType[comboApptType.SelectedIndex-1].AppointmentTypeNum;
			}
			try {
				Appointments.Update(AptCur,AptOld);
				//Appointments.UpdateAttached(AptCur.AptNum,procNums,isPlanned);
			}
			catch(ApplicationException ex) {
				MessageBox.Show(ex.Message);
				return false;
			}
			//if appointment is marked complete and any procedures are not,
			//then set the remaining procedures complete
			if(AptCur.AptStatus==ApptStatus.Complete) {
				bool allProcsComplete=true;
				for(int i=0;i<gridProc.SelectedIndices.Length;i++){
					if(DS.Tables["Procedure"].Rows[gridProc.SelectedIndices[i]]["ProcStatus"].ToString()!="2") {//Complete
						allProcsComplete=false;
						break;
					}
				}
				if(!allProcsComplete) {
					if(!Security.IsAuthorized(Permissions.ProcComplCreate,AptCur.AptDateTime)) {
						return false;
					}
					List <PatPlan> PatPlanList=PatPlans.Refresh(AptCur.PatNum);
					ProcedureL.SetCompleteInAppt(AptCur,PlanList,PatPlanList,pat.SiteNum,pat.Age,SubList);
					SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,pat.PatNum,
						AptCur.AptDateTime.ToShortDateString()+", "+AptCur.ProcDescript+", Procedures automatically set complete due to appt being set complete",AptCur.AptNum);
				}
			}
			else{
				Procedures.SetProvidersInAppointment(AptCur,Procedures.GetProcsForSingle(AptCur.AptNum,false));
			}
			//Do the appointment "break" automation for appointments that were just broken.
			if(AptCur.AptStatus==ApptStatus.Broken && AptOld.AptStatus!=ApptStatus.Broken) {
				SecurityLogs.MakeLogEntry(Permissions.AppointmentMove,pat.PatNum,AptCur.ProcDescript+", "+AptCur.AptDateTime.ToString()
					+", Broken by changing the Status in the Edit Appointment window.",AptCur.AptNum);
				//If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
				if(HL7Defs.IsExistingHL7Enabled()) {
					//S15 - Appt Cancellation event
					MessageHL7 messageHL7=MessageConstructor.GenerateSIU(pat,fam.GetPatient(pat.Guarantor),EventTypeHL7.S15,AptCur);
					//Will be null if there is no outbound SIU message defined, so do nothing
					if(messageHL7!=null) {
						HL7Msg hl7Msg=new HL7Msg();
						hl7Msg.AptNum=AptCur.AptNum;
						hl7Msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
						hl7Msg.MsgText=messageHL7.ToString();
						hl7Msg.PatNum=pat.PatNum;
						HL7Msgs.Insert(hl7Msg);
#if DEBUG
						MessageBox.Show(this,messageHL7.ToString());
#endif
					}
				}
				ProcedureCode procCodeBrokenApt=ProcedureCodes.GetProcCode("D9986");
				if(procCodeBrokenApt.CodeNum!=0) {//ADA proc code D9986 exists
					Procedure procedureCur=new Procedure();
					procedureCur.PatNum=pat.PatNum;
					procedureCur.ProvNum=AptCur.ProvNum;
					procedureCur.ProcFee=0;
					procedureCur.CodeNum=procCodeBrokenApt.CodeNum;
					procedureCur.ProcDate=DateTime.Today;
					procedureCur.DateEntryC=DateTime.Now;
					procedureCur.ProcStatus=ProcStat.C;
					procedureCur.ClinicNum=pat.ClinicNum;
					procedureCur.Note=Lan.g(this,"Appt BROKEN for ")+AptCur.ProcDescript+"  "+AptCur.AptDateTime.ToString();
					Procedures.Insert(procedureCur);
					//Now make a claimproc if the patient has insurance.  We do this now for consistency because a claimproc could get created in the future.
					List<InsSub> listInsSubs=InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum));
					List<InsPlan> listInsPlans=InsPlans.RefreshForSubList(listInsSubs);
					List<PatPlan> listPatPlans=PatPlans.Refresh(pat.PatNum);
					List<Benefit> listBenefits=Benefits.Refresh(listPatPlans,listInsSubs);
					List<ClaimProc> listClaimProcsForProc=ClaimProcs.RefreshForProc(procedureCur.ProcNum);
					Procedures.ComputeEstimates(procedureCur,pat.PatNum,listClaimProcsForProc,false,listInsPlans,listPatPlans,listBenefits,pat.Age,listInsSubs);
					FormProcEdit FormP=new FormProcEdit(procedureCur,pat,Patients.GetFamily(pat.PatNum));
					FormP.IsNew=false;
					FormP.ShowDialog();
					if(PrefC.GetBool(PrefName.BrokenApptCommLogWithProcedure)) {
						Commlog CommlogCur=new Commlog();
						CommlogCur.PatNum=pat.PatNum;
						CommlogCur.CommDateTime=DateTime.Now;
						CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+AptCur.ProcDescript+"  "+AptCur.AptDateTime.ToString();
						CommlogCur.Mode_=CommItemMode.None;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						FormCommItem FormCI=new FormCommItem(CommlogCur);
						FormCI.IsNew=true;
						FormCI.ShowDialog();
					}
				}
				else {//No D9986 present
					if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
						Commlog CommlogCur=new Commlog();
						CommlogCur.PatNum=pat.PatNum;
						CommlogCur.CommDateTime=DateTime.Now;
						CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+AptCur.ProcDescript+"  "+AptCur.AptDateTime.ToString();
						CommlogCur.Mode_=CommItemMode.None;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						FormCommItem FormCI=new FormCommItem(CommlogCur);
						FormCI.IsNew=true;
						FormCI.ShowDialog();
					}
					else {
						Adjustment AdjustmentCur=new Adjustment();
						AdjustmentCur.DateEntry=DateTime.Today;
						AdjustmentCur.AdjDate=DateTime.Today;
						AdjustmentCur.ProcDate=DateTime.Today;
						AdjustmentCur.ProvNum=AptCur.ProvNum;
						AdjustmentCur.PatNum=pat.PatNum;
						AdjustmentCur.AdjType=PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType);
						AdjustmentCur.ClinicNum=pat.ClinicNum;
						FormAdjust FormA=new FormAdjust(pat,AdjustmentCur);
						FormA.IsNew=true;
						FormA.ShowDialog();
					}
				}
				AutomationL.Trigger(AutomationTrigger.BreakAppointment,null,pat.PatNum);
			}
			return true;
		}
Exemplo n.º 23
0
        ///<summary>Attempts to find exact match for patient. If found, creates commlog, associates Patnum, and inserts into DB.
        ///Otherwise, it simply inserts SmsFromMobiles into the DB. ClinicNum should have already been set before calling this function.</summary>
        public static void ProcessInboundSms(List <SmsFromMobile> listMessages)
        {
            if (listMessages == null || listMessages.Count == 0)
            {
                return;
            }
            List <SmsBlockPhone> listBlockedPhones = SmsBlockPhones.GetDeepCopy();

            for (int i = 0; i < listMessages.Count; i++)
            {
                SmsFromMobile sms = listMessages[i];
                if (listBlockedPhones.Any(x => TelephoneNumbers.AreNumbersEqual(x.BlockWirelessNumber, sms.MobilePhoneNumber)))
                {
                    continue;                    //The office has blocked this number.
                }
                sms.DateTimeReceived = DateTime.Now;
                SmsPhone smsPhone    = SmsPhones.GetByPhone(sms.SmsPhoneNumber);
                string   countryCode = CultureInfo.CurrentCulture.Name.Substring(CultureInfo.CurrentCulture.Name.Length - 2);
                if (smsPhone != null)
                {
                    sms.ClinicNum = smsPhone.ClinicNum;
                    countryCode   = smsPhone.CountryCode;
                }
                //First try the clinic that belongs to this phone.
                List <long> listClinicNums = new List <long>();
                if (sms.ClinicNum != 0)
                {
                    listClinicNums.Add(sms.ClinicNum);
                }
                List <long[]> listPatNums = FindPatNums(sms.MobilePhoneNumber, countryCode, listClinicNums);
                if (listPatNums.Count == 0 && listClinicNums.Count > 0)              //Could not find that patient in this clinic so try again for all clinics.
                {
                    listPatNums = FindPatNums(sms.MobilePhoneNumber, countryCode);
                }
                sms.MatchCount = listPatNums.Count;
                //Item1=PatNum; Item2=Guarantor
                if (listPatNums.Count == 0 || listPatNums.Select(x => x[1]).Distinct().ToList().Count != 1)
                {
                    //We could not find definitive match, either 0 matches found, or more than one match found with different garantors
                    Insert(sms);
                    continue;
                }
                if (listPatNums.Count == 1)
                {
                    sms.PatNum = listPatNums[0][0];                  //PatNum
                }
                else
                {
                    sms.PatNum = listPatNums[0][1];                  //GuarantorNum;  more than one match, but all have the same garantor.
                }
                Commlog comm = new Commlog()
                {
                    CommDateTime   = sms.DateTimeReceived,
                    Mode_          = CommItemMode.Text,
                    Note           = sms.MsgText,
                    PatNum         = sms.PatNum,
                    CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.TEXT),
                    SentOrReceived = CommSentOrReceived.Received
                };
                sms.CommlogNum = Commlogs.Insert(comm);
                Insert(sms);
            }
            UpdateSmsNotification();
        }
Exemplo n.º 24
0
Arquivo: Commlogs.cs Projeto: mnisl/OD
		///<summary>Used when printing or emailing recall to make a commlog entry without any display.  Only set isWebSched to true if this is a commlog associated to the GWT Web Sched app.</summary>
		public static void InsertForRecall(long patNum,CommItemMode _mode,int numberOfReminders,long defNumNewStatus,bool isWebSched,long userNum) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),patNum,_mode,numberOfReminders,defNumNewStatus,isWebSched,userNum);
				return;
			}
			long recallType=Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
			string command;
			string datesql="CURDATE()";
			if(DataConnection.DBtype==DatabaseType.Oracle){
				datesql="(SELECT CURRENT_DATE FROM dual)";
			}
			if(recallType!=0){
				command="SELECT COUNT(*) FROM commlog WHERE ";
				command+=DbHelper.DtimeToDate("CommDateTime")+" = "+datesql;
				command+=" AND PatNum="+POut.Long(patNum)+" AND CommType="+POut.Long(recallType)
					+" AND Mode_="+POut.Long((int)_mode)
					+" AND SentOrReceived=1";
				if(Db.GetCount(command)!="0"){
					return;
				}
			}
			Commlog com=new Commlog();
			com.PatNum=patNum;
			com.CommDateTime=DateTime.Now;
			com.CommType=recallType;
			com.Mode_=_mode;
			com.SentOrReceived=CommSentOrReceived.Sent;
			com.Note="";
			if(numberOfReminders==0){
				com.Note=Lans.g("FormRecallList","Recall reminder.");
			}
			else if(numberOfReminders==1) {
				com.Note=Lans.g("FormRecallList","Second recall reminder.");
			}
			else if(numberOfReminders==2) {
				com.Note=Lans.g("FormRecallList","Third recall reminder.");
			}
			else {
				com.Note=Lans.g("FormRecallList","Recall reminder:")+" "+(numberOfReminders+1).ToString();
			}
			if(defNumNewStatus==0) {
				com.Note+="  "+Lans.g("Commlogs","Status None");
			}
			else {
				com.Note+="  "+DefC.GetName(DefCat.RecallUnschedStatus,defNumNewStatus);
			}
			com.UserNum=userNum;
			com.IsWebSched=isWebSched;
			Insert(com);
			EhrMeasureEvent newMeasureEvent=new EhrMeasureEvent();
			newMeasureEvent.DateTEvent=com.CommDateTime;
			newMeasureEvent.EventType=EhrMeasureEventType.ReminderSent;
			newMeasureEvent.PatNum=com.PatNum;
			newMeasureEvent.MoreInfo=com.Note;
			EhrMeasureEvents.Insert(newMeasureEvent);
		}
Exemplo n.º 25
0
		///<summary>ProcCodes will be null unless trigger is CompleteProcedure.  This routine will generally fail silently.  Will return true if a trigger happened.</summary>
		public static bool Trigger(AutomationTrigger trigger,List<string> procCodes,long patNum) {
			if(patNum==0) {//Could happen for OpenPatient trigger
				return false;
			}
			bool automationHappened=false;
			for(int i=0;i<Automations.Listt.Count;i++) {
				if(Automations.Listt[i].Autotrigger!=trigger) {
					continue;
				}
				if(trigger==AutomationTrigger.CompleteProcedure) {
					if(procCodes==null) {
						continue;//fail silently
					}
					bool codeFound=false;
					string[] arrayCodes=Automations.Listt[i].ProcCodes.Split(',');
					for(int p=0;p<procCodes.Count;p++) {
						for(int a=0;a<arrayCodes.Length;a++) {
							if(arrayCodes[a]==procCodes[p]) {
								codeFound=true;
								break;
							}
						}
					}
					if(!codeFound) {
						continue;
					}
				}
				//matching automation item has been found
				//Get possible list of conditions that exist for this automation item
				List<AutomationCondition> autoConditionsList=AutomationConditions.GetListByAutomationNum(Automations.Listt[i].AutomationNum);
				if(Automations.Listt[i].AutoAction==AutomationAction.CreateCommlog) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					Commlog CommlogCur=new Commlog();
					CommlogCur.PatNum=patNum;
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Automations.Listt[i].CommType;
					CommlogCur.Note=Automations.Listt[i].MessageContent;
					CommlogCur.Mode_=CommItemMode.None;
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					FormCI.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PopUp) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					MessageBox.Show(Automations.Listt[i].MessageContent);
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PrintPatientLetter) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					//SheetParameter.SetParameter(sheet,"ReferralNum",referral.ReferralNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PrintReferralLetter) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					long referralNum=RefAttaches.GetReferralNum(patNum);
					if(referralNum==0) {
						MsgBox.Show("Automations","This patient has no referral source entered.");
						automationHappened=true;
						continue;
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					SheetParameter.SetParameter(sheet,"ReferralNum",referralNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.ShowExamSheet) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
			}
			return automationHappened;
		}
Exemplo n.º 26
0
        ///<summary>Used when printing or emailing recall to make a commlog entry without any display.
        ///Set commSource to the corresponding entity that is making this recall.  E.g. Web Sched.
        ///If the commSource is a 3rd party, set it to ProgramLink and make an overload that accepts the ProgramNum.</summary>
        public static Commlog InsertForRecall(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus, CommItemSource commSource,
                                              long userNum, DateTime dateTimeNow)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <Commlog>(MethodBase.GetCurrentMethod(), patNum, _mode, numberOfReminders, defNumNewStatus, commSource, userNum, dateTimeNow));
            }
            long   recallType = Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
            string command;
            string datesql = "CURDATE()";

            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                datesql = "(SELECT CURRENT_DATE FROM dual)";
            }
            if (recallType != 0)
            {
                command  = "SELECT * FROM commlog WHERE ";
                command += DbHelper.DtimeToDate("CommDateTime") + " = " + datesql;
                command += " AND PatNum=" + POut.Long(patNum) + " AND CommType=" + POut.Long(recallType)
                           + " AND Mode_=" + POut.Long((int)_mode)
                           + " AND SentOrReceived=1";
                List <Commlog> listComms = Crud.CommlogCrud.SelectMany(command).OrderByDescending(x => x.CommDateTime).ToList();
                if (listComms.Count > 0)
                {
                    return(listComms[0]);
                }
            }
            Commlog com = new Commlog();

            com.PatNum         = patNum;
            com.CommDateTime   = dateTimeNow;
            com.CommType       = recallType;
            com.Mode_          = _mode;
            com.SentOrReceived = CommSentOrReceived.Sent;
            com.Note           = "";
            if (numberOfReminders == 0)
            {
                com.Note = Lans.g("FormRecallList", "Recall reminder.");
            }
            else if (numberOfReminders == 1)
            {
                com.Note = Lans.g("FormRecallList", "Second recall reminder.");
            }
            else if (numberOfReminders == 2)
            {
                com.Note = Lans.g("FormRecallList", "Third recall reminder.");
            }
            else
            {
                com.Note = Lans.g("FormRecallList", "Recall reminder:") + " " + (numberOfReminders + 1).ToString();
            }
            if (defNumNewStatus == 0)
            {
                com.Note += "  " + Lans.g("Commlogs", "Status None");
            }
            else
            {
                com.Note += "  " + Defs.GetName(DefCat.RecallUnschedStatus, defNumNewStatus);
            }
            com.UserNum    = userNum;
            com.CommSource = commSource;
            com.CommlogNum = Insert(com);
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = com.CommDateTime;
            newMeasureEvent.EventType  = EhrMeasureEventType.ReminderSent;
            newMeasureEvent.PatNum     = com.PatNum;
            newMeasureEvent.MoreInfo   = com.Note;
            EhrMeasureEvents.Insert(newMeasureEvent);
            return(com);
        }
Exemplo n.º 27
0
		private void OnDelete_Click() {
			long selectedAptNum=ContrApptSingle.SelectedAptNum;
			Appointment apt = Appointments.GetOneApt(selectedAptNum);
			if(!Security.IsAuthorized(Permissions.AppointmentEdit)) {
				return;
			}
			int thisI=GetIndex(selectedAptNum);
			if(thisI==-1) {//selected appt is on a different day
				MsgBox.Show(this,"Please select an appointment first.");
				return;
			}
			if(apt.AptStatus == ApptStatus.PtNote | apt.AptStatus == ApptStatus.PtNoteCompleted) {
				if(!MsgBox.Show(this,true,"Delete Patient Note?")) {
					return;
				}
				if(apt.Note != "") {
					if(MessageBox.Show(Lan.g(this,"Save a copy of this note in CommLog? ") + "\r\n" + "\r\n" + apt.Note,"Question...",
							MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = apt.PatNum;
						CommlogCur.CommDateTime = apt.AptDateTime;
						CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Patient NOTE from schedule, saved copy: ";
						CommlogCur.Note += apt.Note;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
				SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,PatCur.PatNum,
					ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", "+"NOTE Deleted",
					PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
			}
			else {
				if(!MsgBox.Show(this,true,"Delete Appointment?")) {
					return;
				}
				if(apt.Note != "") {
					if(MessageBox.Show(Lan.g(this,"Save appointment note in CommLog? ") + "\r\n" + "\r\n" + apt.Note,"Question...",
							MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = apt.PatNum;
						CommlogCur.CommDateTime = apt.AptDateTime;
						CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Appointment & saved note: ";
						if(apt.ProcDescript != "") {
							CommlogCur.Note += apt.ProcDescript + ": ";
						}
						CommlogCur.Note += apt.Note;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
				SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,PatCur.PatNum,
					ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", "+"Deleted",
					PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
			}
			Appointments.Delete(selectedAptNum);
			ContrApptSingle.SelectedAptNum=-1;
			pinBoard.SelectedIndex=-1;
			DataRow row;
			for(int i=0;i<pinBoard.ApptList.Count;i++) {
				row=pinBoard.ApptList[i].DataRoww;
				if(selectedAptNum.ToString()==row["AptNum"].ToString()) {
					pinBoard.SelectedIndex=i;
					pinBoard.ClearSelected();
					pinBoard.SelectedIndex=-1;
				}
			}
			//ContrApptSingle.PinBoardIsSelected=false;
			//PatCurNum=0;
			if(PatCur==null) {
				ModuleSelected(0);
			}
			else {
				ModuleSelected(PatCur.PatNum);
			}
			SetInvalid();
			Recalls.SynchScheduledApptFull(apt.PatNum);
		}
Exemplo n.º 28
0
		private static void OnCreated(object source,FileSystemEventArgs e) {
			//MessageBox.Show("File created.  It will now be deleted.");
			Thread.Sleep(200);//just to make sure the other process is done writing.
			string[] lines=File.ReadAllLines(e.FullPath);
			File.Delete(e.FullPath);
			if(lines.Length!=1){
				MessageBox.Show(e.FullPath+" was supposed to have exactly one line.  Invalid file.");
				return;
			}
			string rawFieldNames="PAT_PK,PAT_LOGFK,PAT_LANFK,PAT_TITLE,PAT_FNAME,PAT_MI,PAT_LNAME,PAT_CALLED,PAT_ADDR1,PAT_ADDR2,PAT_CITY,PAT_ST,PAT_ZIP,PAT_HPHN,PAT_WPHN,PAT_EXT,PAT_FAX,PAT_PAGER,PAT_CELL,PAT_EMAIL,PAT_SEX,PAT_EDOCS,PAT_STATUS,PAT_TYPE,PAT_BIRTH,PAT_SSN,PAT_NOCALL,PAT_NOCORR,PAT_DISRES,PAT_LSTUPD,PAT_INSNM,PAT_INSGPL,PAT_INSAD1,PAT_INSAD2,PAT_INSCIT,PAT_INSST,PAT_INSZIP,PAT_INSPHN,PAT_INSEXT,PAT_INSCON,PAT_INSGNO,PAT_EMPNM,PAT_EMPAD1,PAT_EMPAD2,PAT_EMPCIT,PAT_EMPST,PAT_EMPZIP,PAT_EMPPHN,PAT_REFLNM,PAT_REFFNM,PAT_REFMI,PAT_REFPHN,PAT_REFEML,PAT_REFSPE,PAT_NOTES,PAT_NOTE1,PAT_NOTE2,PAT_NOTE3,PAT_NOTE4,PAT_NOTE5,PAT_NOTE6,PAT_NOTE7,PAT_NOTE8,PAT_NOTE9,PAT_NOTE10,PAT_FPSCAN,PAT_PREMED,PAT_MEDS,PAT_FTSTUD,PAT_PTSTUD,PAT_COLLEG,PAT_CHRTNO,PAT_OTHID,PAT_RESPRT,PAT_POLHLD,PAT_CUSCD,PAT_PMPID";
			fieldNames=rawFieldNames.Split(',');
			fieldVals=lines[0].Split(',');
			if(fieldNames.Length!=fieldVals.Length){
				MessageBox.Show(e.FullPath+" contains "+fieldNames.Length.ToString()+" field names, but "+fieldVals.Length.ToString()+" field values.  Invalid file.");
				return;
			}
			for(int i=0;i<fieldVals.Length;i++) {
				fieldVals[i]=fieldVals[i].Replace("\"","");//remove quotes
			}
			long patNum=PIn.Long(GetVal("PAT_OTHID"));
			if(patNum==0){
				MessageBox.Show(patNum.ToString()+" is not a recognized PatNum.");
				return;
			}
			Family fam=Patients.GetFamily(patNum);
			if(fam==null){
				MessageBox.Show("Could not find patient based on PatNum "+patNum.ToString());
				return;
			}
			Patient pat=fam.GetPatient(patNum);
			Patient patOld=pat.Copy();
			string txt;
			string note="PT Dental import processed.  Some information is shown below which was too complex to import automatically.\r\n";
			txt=GetVal("PAT_FNAME");
			if(txt!=""){
				pat.FName=txt;
			}
			txt=GetVal("PAT_MI");
			if(txt!=""){
				pat.MiddleI=txt;
			}
			txt=GetVal("PAT_LNAME");
			if(txt!=""){
				pat.LName=txt;
			}
			txt=GetVal("PAT_CALLED");
			if(txt!=""){
				pat.Preferred=txt;
			}
			txt=GetVal("PAT_ADDR1");
			if(txt!=""){
				pat.Address=txt;
			}
			txt=GetVal("PAT_ADDR2");
			if(txt!=""){
				pat.Address2=txt;
			}
			txt=GetVal("PAT_CITY");
			if(txt!=""){
				pat.City=txt;
			}
			txt=GetVal("PAT_ST");
			if(txt!=""){
				pat.State=txt;
			}
			txt=GetVal("PAT_ZIP");
			if(txt!=""){
				pat.Zip=txt;
			}
			txt=GetVal("PAT_HPHN");//No punct
			if(txt!=""){
				pat.HmPhone=TelephoneNumbers.ReFormat(txt);
			}
			txt=GetVal("PAT_WPHN");
			if(txt!=""){
				pat.WkPhone=TelephoneNumbers.ReFormat(txt);
			}
			//no matching fields for these three:
			txt=GetVal("PAT_EXT");
			if(txt!="") {
				note+="Ph extension: "+txt+"\r\n";
			}
			txt=GetVal("PAT_FAX");
			if(txt!="") {
				note+="Fax: "+txt+"\r\n";
			}
			txt=GetVal("PAT_PAGER");
			if(txt!="") {
				note+="Pager: "+txt+"\r\n";
			}
			txt=GetVal("PAT_CELL");
			if(txt!=""){
				pat.WirelessPhone=TelephoneNumbers.ReFormat(txt);
			}
			txt=GetVal("PAT_EMAIL");
			if(txt!=""){
				pat.Email=txt;
			}
			txt=GetVal("PAT_SEX");//M or F
			if(txt=="M"){
				pat.Gender=PatientGender.Male;
			}
			if(txt=="F"){
				pat.Gender=PatientGender.Male;
			}
			txt=GetVal("PAT_STATUS");//our patStatus, Any text allowed
			switch(txt){
				case "Archived": pat.PatStatus=PatientStatus.Archived; break;
				case "Deceased": pat.PatStatus=PatientStatus.Deceased; break;
				//case "Archived": pat.PatStatus=PatientStatus.Deleted; break;
				case "Inactive": pat.PatStatus=PatientStatus.Inactive; break;
				case "NonPatient": pat.PatStatus=PatientStatus.NonPatient; break;
				case "Patient": pat.PatStatus=PatientStatus.Patient; break;
			}
			txt=GetVal("PAT_TYPE");//our Position, Any text allowed
			switch(txt){
				case "Child": pat.Position=PatientPosition.Child; break;
				case "Divorced": pat.Position=PatientPosition.Divorced; break;
				case "Married": pat.Position=PatientPosition.Married; break;
				case "Single": pat.Position=PatientPosition.Single; break;
				case "Widowed": pat.Position=PatientPosition.Widowed; break;
			}
			txt=GetVal("PAT_BIRTH");// yyyyMMdd
			if(txt!=""){
				pat.Birthdate=PIn.Date(txt);
			}
			txt=GetVal("PAT_SSN");// No punct
			if(txt!=""){
				pat.SSN=txt;
			}
			txt=GetVal("PAT_NOCALL");// T if no call
			if(txt!=""){
				note+="No Call Patient: "+txt+"\r\n";
			}
			txt=GetVal("PAT_NOCORR");// T/F
			if(txt!="") {
				note+="No Correspondence: "+txt+"\r\n";
			}
			txt=GetVal("PAT_NOTES");// No limits.
			if(txt!=""){
				note+=txt+"\r\n";
			}
			txt=GetVal("PAT_PREMED");// F or T
			//I don't like giving the patient control of this field, but I guess the office has the option of not showing this on forms.
			if(txt=="T") {
				pat.Premed=true;
			}
			if(txt=="F") {
				pat.Premed=false;
			}
			txt=GetVal("PAT_MEDS");// The meds that they must premedicate with.
			if(txt!="") {
				note+="Patient Meds: "+txt+"\r\n";
			}
			string ft=GetVal("PAT_FTSTUD");// T/F
			string pt=GetVal("PAT_PTSTUD");//parttime
			if(ft=="T"){
				pat.StudentStatus="F";//fulltime
			}
			else if(pt=="T"){
				pat.StudentStatus="P";//parttime
			}
			else if(ft=="F" && pt=="F"){
				pat.StudentStatus="";//nonstudent
			}
			else if(ft=="F" && pat.StudentStatus=="F"){
				pat.StudentStatus="";
			}
			else if(pt=="F" && pat.StudentStatus=="P"){
				pat.StudentStatus="";
			}
			txt=GetVal("PAT_COLLEG");
			if(txt!="") {
				pat.SchoolName=txt;
			}
			txt=GetVal("PAT_CHRTNO");
			//I don't think patient should have control of this field.
			if(txt!="") {
				pat.ChartNumber=txt;
			}
			txt=GetVal("PAT_RESPRT");// Responsible party checkbox T/F
			if(txt=="T" && pat.PatNum!=pat.Guarantor) {
				note+="Responsible party: True\r\n";
			}
			if(txt=="F" && pat.PatNum==pat.Guarantor) {
				note+="Responsible party: False\r\n";
			}
			txt=GetVal("PAT_POLHLD");// Policy holder checkbox T/F
			if(txt=="T") {
				note+="Policy holder: True\r\n";
			}
			if(txt=="F") {
				note+="Policy holder: False\r\n";
			}
			txt=GetVal("PAT_INSNM");
			if(txt!="") {
				note+="Insurance name: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSGPL");
			if(txt!="") {
				note+="Ins group plan name: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSAD1");
			if(txt!="") {
				note+="Ins address: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSAD2");
			if(txt!="") {
				note+="Ins address2: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSCIT");
			if(txt!="") {
				note+="Ins city: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSST");
			if(txt!="") {
				note+="Ins state: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSZIP");
			if(txt!="") {
				note+="Ins zip: "+txt+"\r\n";
			}
			txt=GetVal("PAT_INSPHN");
			if(txt!="") {
				note+="Ins phone: "+TelephoneNumbers.ReFormat(txt)+"\r\n";
			}
			txt=GetVal("PAT_INSGNO");// Ins group number
			if(txt!="") {
				note+="Ins group number: "+txt+"\r\n";
			}
			txt=GetVal("PAT_EMPNM");
			if(txt!="") {
				note+="Employer name: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFLNM");
			if(txt!="") {
				note+="Referral last name: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFFNM");
			if(txt!="") {
				note+="Referral first name: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFMI");
			if(txt!="") {
				note+="Referral middle init: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFPHN");
			if(txt!="") {
				note+="Referral phone: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFEML");// Referral source email
			if(txt!="") {
				note+="Referral email: "+txt+"\r\n";
			}
			txt=GetVal("PAT_REFSPE");// Referral specialty. Customizable, so any allowed
			if(txt!="") {
				note+="Referral specialty: "+txt+"\r\n";
			}
			Patients.Update(pat,patOld);
			if(File.Exists(dir+"\\"+importMedCsv)){
				lines=File.ReadAllLines(dir+"\\"+importMedCsv);
				File.Delete(dir+"\\"+importMedCsv);
				if(lines.Length<1) {
					MessageBox.Show(e.FullPath+" was supposed to have at least one line.  Invalid file.");
					return;
				}
				fieldNames=lines[0].Split(',');
				long diseaseDefNum;
				Disease disease;
				string diseaseNote;
				for(int i=1;i<lines.Length;i++){
					fieldVals=lines[i].Split(',');
					txt=GetVal("PMA_MALDES");
					diseaseNote=GetVal("PMA_NOTES");
					if(txt==""){
						continue;
					}
					diseaseDefNum=DiseaseDefs.GetNumFromName(txt);
					if(diseaseDefNum==0){
						note+="Disease: "+txt+", "+diseaseNote+"\r\n";
					}
					disease=Diseases.GetSpecificDiseaseForPatient(patNum,diseaseDefNum);
					if(disease==null){
						disease=new Disease();
						disease.DiseaseDefNum=diseaseDefNum;
						disease.PatNum=patNum;
						disease.PatNote=diseaseNote;
						Diseases.Insert(disease);
					}
					else{
						if(txt!=""){
							if(disease.PatNote!=""){
								disease.PatNote+="  ";
							}
							disease.PatNote+=diseaseNote;
							Diseases.Update(disease);
						}
					}
				}
			}
			Commlog comm=new Commlog();
			comm.PatNum=patNum;
			comm.SentOrReceived=CommSentOrReceived.Received;
			comm.CommDateTime=DateTime.Now;
			comm.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
			comm.Mode_=CommItemMode.None;
			comm.Note=note;
			comm.UserNum=Security.CurUser.UserNum;
			Commlogs.Insert(comm);
			MessageBox.Show("PT Dental import complete.");
		}
Exemplo n.º 29
0
		private void butAddComm_Click(object sender,EventArgs e) {
			Commlog CommlogCur=new Commlog();
			CommlogCur.PatNum=AptCur.PatNum;
			CommlogCur.CommDateTime=DateTime.Now;
			CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
			CommlogCur.UserNum=Security.CurUser.UserNum;
			FormCommItem FormCI=new FormCommItem(CommlogCur);
			FormCI.IsNew=true;
			FormCI.ShowDialog();
			DS.Tables.Remove("Comm");
			DS.Tables.Add(Appointments.GetApptEdit(AptCur.AptNum).Tables["Comm"].Copy());
				//AppointmentL.GetApptEditComm(AptCur.AptNum));
			FillComm();
		}
Exemplo n.º 30
0
		private void phoneSmall_GoToChanged(object sender,EventArgs e) {
			if(phoneSmall.GotoPatNum==0) {
				return;
			}
			CurPatNum=phoneSmall.GotoPatNum;
			Patient pat=Patients.GetPat(CurPatNum);
			RefreshCurrentModule();
			FillPatientButton(pat);
			Commlog commlog=Commlogs.GetIncompleteEntry(Security.CurUser.UserNum,CurPatNum);
			PhoneEmpDefault ped=PhoneEmpDefaults.GetByExtAndEmp(phoneSmall.Extension,Security.CurUser.EmployeeNum);
			if(ped!=null && ped.IsTriageOperator) {
				if(Plugins.HookMethod(this,"FormOpenDental.phoneSmall_GoToChanged_IsTriage",pat,phoneSmall.Extension)) {
					return;
				}
				Task task=new Task();
				task.TaskListNum=-1;//don't show it in any list yet.
				Tasks.Insert(task);
				Task taskOld=task.Copy();
				task.KeyNum=CurPatNum;
				task.ObjectType=TaskObjectType.Patient;
				task.TaskListNum=1697;//Hardcoded for internal Triage task list.
				task.UserNum=Security.CurUser.UserNum;
				task.Descript=Phones.GetPhoneForExtension(Phones.GetPhoneList(),phoneSmall.Extension).CustomerNumberRaw+" ";//Prefill description with customers number.
				FormTaskEdit FormTE=new FormTaskEdit(task,taskOld);
				FormTE.IsNew=true;
				FormTE.Show();
			}
			else {//Not a triage operator.
				if(Plugins.HookMethod(this,"FormOpenDental.phoneSmall_GoToChanged_NotTriage",pat)) {
					return;
				}
				if(commlog==null) {
					commlog = new Commlog();
					commlog.PatNum = CurPatNum;
					commlog.CommDateTime = DateTime.Now;
					commlog.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
					commlog.Mode_=CommItemMode.Phone;
					commlog.SentOrReceived=CommSentOrReceived.Received;
					commlog.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(commlog);
					FormCI.IsNew = true;
					FormCI.ShowDialog();
					if(FormCI.DialogResult==DialogResult.OK) {
						RefreshCurrentModule();
					}
				}
				else {
					FormCommItem FormCI=new FormCommItem(commlog);
					FormCI.ShowDialog();
					if(FormCI.DialogResult==DialogResult.OK) {
						RefreshCurrentModule();
					}
				}
			}
		}
Exemplo n.º 31
0
		private void butDelete_Click(object sender,EventArgs e) {
			if (AptCur.AptStatus == ApptStatus.PtNote || AptCur.AptStatus == ApptStatus.PtNoteCompleted) {
				if (!MsgBox.Show(this, true, "Delete Patient Note?")) {
					return;
				}
				if(textNote.Text != "") {
					if(MessageBox.Show(Lan.g(this, "Save a copy of this note in CommLog? " + "\r\n" + "\r\n" + textNote.Text), "Question...",
							MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = AptCur.PatNum;
						CommlogCur.CommDateTime = DateTime.Now;
						CommlogCur.CommType = Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Pt NOTE from schedule, saved copy: ";
						CommlogCur.Note += textNote.Text;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
			}
			else {//ordinary appointment
				if (MessageBox.Show(Lan.g(this, "Delete appointment?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) {
					return;
				}
				if (textNote.Text != "") {
					if (MessageBox.Show(Lan.g(this, "Save appointment note in CommLog? " + "\r\n" + "\r\n" + textNote.Text), "Question...",
							MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = AptCur.PatNum;
						CommlogCur.CommDateTime = DateTime.Now;
						CommlogCur.CommType = Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Appt. & saved note: ";
						if (AptCur.ProcDescript != "") {
							CommlogCur.Note += AptCur.ProcDescript + ": ";
						}
						CommlogCur.Note += textNote.Text;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
			}
			Appointments.Delete(AptCur.AptNum);
			Recalls.SynchScheduledApptFull(AptCur.PatNum);
			SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,pat.PatNum,
				"Delete for date/time: "+AptCur.AptDateTime.ToString(),
				AptCur.AptNum);
			if(IsNew){
				//The dialog is considered cancelled when a new appointment is immediately deleted.
			  DialogResult=DialogResult.Cancel;
			}
			else{
				DialogResult=DialogResult.OK;
			}
		}
Exemplo n.º 32
0
		private void OnBreak_Click() {
			if(!PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment) && PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType)==0) {
				MsgBox.Show(this,"Broken appointment adjustment type is not setup yet.  Please go to Setup | Modules to fix this.");
				return;
			}
			int thisI=GetIndex(ContrApptSingle.SelectedAptNum);
			if(thisI==-1) {//selected appt is on a different day
				MsgBox.Show(this,"Please select an appointment first.");
				return;
			}
			Appointment apt = Appointments.GetOneApt(ContrApptSingle.SelectedAptNum);
			Patient pat=Patients.GetPat(PIn.Long(ContrApptSingle3[thisI].DataRoww["PatNum"].ToString()));
			if(!Security.IsAuthorized(Permissions.AppointmentEdit)) {
				return;
			}
			if(apt.AptStatus == ApptStatus.PtNote || apt.AptStatus == ApptStatus.PtNoteCompleted) {
				MsgBox.Show(this,"Only appointments may be broken, not notes.");
				return;
			}
			if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
				if(!MsgBox.Show(this,true,"Break appointment?")) {
					return;
				}
			}
			Appointments.SetAptStatus(ContrApptSingle.SelectedAptNum,ApptStatus.Broken);
			SecurityLogs.MakeLogEntry(Permissions.AppointmentMove,pat.PatNum,
				ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", Broken from the Appts module.",
				PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
			//If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
			if(HL7Defs.IsExistingHL7Enabled()) {
				//S15 - Appt Cancellation event
				MessageHL7 messageHL7=MessageConstructor.GenerateSIU(pat,Patients.GetPat(pat.Guarantor),EventTypeHL7.S15,apt);
				//Will be null if there is no outbound SIU message defined, so do nothing
				if(messageHL7!=null) {
					HL7Msg hl7Msg=new HL7Msg();
					hl7Msg.AptNum=apt.AptNum;
					hl7Msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
					hl7Msg.MsgText=messageHL7.ToString();
					hl7Msg.PatNum=pat.PatNum;
					HL7Msgs.Insert(hl7Msg);
#if DEBUG
					MessageBox.Show(this,messageHL7.ToString());
#endif
				}
			}
			long provNum=PIn.Long(ContrApptSingle3[thisI].DataRoww["ProvNum"].ToString());//remember before ModuleSelected
			ProcedureCode procCodeBrokenApt=ProcedureCodes.GetProcCode("D9986");
			if(procCodeBrokenApt.CodeNum!=0) {//ADA proc code D9986 exists
				Procedure procedureCur=new Procedure();
				procedureCur.PatNum=pat.PatNum;
				procedureCur.ProvNum=provNum;
				procedureCur.ProcFee=0;
				procedureCur.CodeNum=procCodeBrokenApt.CodeNum;
				procedureCur.ProcDate=DateTime.Today;
				procedureCur.DateEntryC=DateTime.Now;
				procedureCur.ProcStatus=ProcStat.C;
				procedureCur.ClinicNum=pat.ClinicNum;
				procedureCur.Note=Lan.g(this,"Appt BROKEN for ")+apt.ProcDescript+"  "+apt.AptDateTime.ToString();
				Procedures.Insert(procedureCur);
				//Now make a claimproc if the patient has insurance.  We do this now for consistency because a claimproc could get created in the future.
				List<InsSub> listInsSubs=InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum));
				List<InsPlan> listInsPlans=InsPlans.RefreshForSubList(listInsSubs);
				List<PatPlan> listPatPlans=PatPlans.Refresh(pat.PatNum);
				List<Benefit> listBenefits=Benefits.Refresh(listPatPlans,listInsSubs);
				List<ClaimProc> listClaimProcsForProc=ClaimProcs.RefreshForProc(procedureCur.ProcNum);
				Procedures.ComputeEstimates(procedureCur,pat.PatNum,listClaimProcsForProc,false,listInsPlans,listPatPlans,listBenefits,pat.Age,listInsSubs);
				FormProcEdit formP=new FormProcEdit(procedureCur,pat,Patients.GetFamily(pat.PatNum));
				formP.IsNew=false;
				formP.ShowDialog();
				if(PrefC.GetBool(PrefName.BrokenApptCommLogWithProcedure)) {
					Commlog CommlogCur=new Commlog();
					CommlogCur.PatNum=pat.PatNum;
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
					CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+apt.ProcDescript+"  "+apt.AptDateTime.ToString();
					CommlogCur.Mode_=CommItemMode.None;
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					FormCI.ShowDialog();
				}
			}
			else {//No D9986 present
				if(PrefC.GetBool(PrefName.BrokenApptCommLogNotAdjustment)) {
					Commlog CommlogCur=new Commlog();
					CommlogCur.PatNum=pat.PatNum;
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
					CommlogCur.Note=Lan.g(this,"Appt BROKEN for ")+apt.ProcDescript+"  "+apt.AptDateTime.ToString();
					CommlogCur.Mode_=CommItemMode.None;
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					FormCI.ShowDialog();
				}
				else {
					Adjustment AdjustmentCur=new Adjustment();
					AdjustmentCur.DateEntry=DateTime.Today;
					AdjustmentCur.AdjDate=DateTime.Today;
					AdjustmentCur.ProcDate=DateTime.Today;
					AdjustmentCur.ProvNum=provNum;
					AdjustmentCur.PatNum=pat.PatNum;
					AdjustmentCur.AdjType=PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType);
					AdjustmentCur.ClinicNum=pat.ClinicNum;
					FormAdjust FormA=new FormAdjust(pat,AdjustmentCur);
					FormA.IsNew=true;
					FormA.ShowDialog();
				}
			}
			ModuleSelected(pat.PatNum);//Must be ran after the "D9986" break logic due to the addition of a completed procedure.
			SetInvalid();
			AutomationL.Trigger(AutomationTrigger.BreakAppointment,null,pat.PatNum);
			Recalls.SynchScheduledApptFull(apt.PatNum);
		}
Exemplo n.º 33
0
 private void butPreview_Click(object sender, System.EventArgs e)
 {
     #if !DISABLE_MICROSOFT_OFFICE
     if(listLetters.SelectedIndex==-1){
         MsgBox.Show(this,"Please select a letter first.");
         return;
     }
     LetterMerge letterCur=ListForCat[listLetters.SelectedIndex];
     string templateFile=ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath),letterCur.TemplateName);
     string dataFile=ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath),letterCur.DataFileName);
     if(!File.Exists(templateFile)){
         MsgBox.Show(this,"Template file does not exist.");
         return;
     }
     if(!CreateDataFile(dataFile,letterCur)){
         return;
     }
     Word.MailMerge wrdMailMerge;
     //Create an instance of Word.
     Word.Application WrdApp;
     try{
         WrdApp=LetterMerges.WordApp;
     }
     catch{
         MsgBox.Show(this,"Error. Is Word installed?");
         return;
     }
     //Open a document.
     Object oName=templateFile;
     wrdDoc=WrdApp.Documents.Open(ref oName,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
     wrdDoc.Select();
     wrdMailMerge=wrdDoc.MailMerge;
     //Attach the data file.
     wrdDoc.MailMerge.OpenDataSource(dataFile,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
         ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
     wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
     wrdMailMerge.Execute(ref oFalse);
     //Close the original form document since just one record.
     wrdDoc.Saved=true;
     wrdDoc.Close(ref oFalse,ref oMissing,ref oMissing);
     //At this point, Word remains open with just one new document.
     WrdApp.Activate();
     if(WrdApp.WindowState==Word.WdWindowState.wdWindowStateMinimize){
         WrdApp.WindowState=Word.WdWindowState.wdWindowStateMaximize;
     }
     wrdMailMerge=null;
     wrdDoc=null;
     Commlog CommlogCur=new Commlog();
     CommlogCur.CommDateTime=DateTime.Now;
     CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
     CommlogCur.Mode_=CommItemMode.Mail;
     CommlogCur.SentOrReceived=CommSentOrReceived.Sent;
     CommlogCur.PatNum=PatCur.PatNum;
     CommlogCur.Note="Letter sent: "+letterCur.Description+". ";
     CommlogCur.UserNum=Security.CurUser.UserNum;
     Commlogs.Insert(CommlogCur);
     #else
     MessageBox.Show(this, "This version of Open Dental does not support Microsoft Word.");
     #endif
     //this window now closes regardless of whether the user saved the comm item.
     DialogResult=DialogResult.OK;
 }
Exemplo n.º 34
0
		private void OnDelete_Click() {
			long selectedAptNum=ContrApptSingle.SelectedAptNum;
			Appointment apt = Appointments.GetOneApt(selectedAptNum);
			if(!Security.IsAuthorized(Permissions.AppointmentEdit)) {
				return;
			}
			int thisI=GetIndex(selectedAptNum);
			if(thisI==-1) {//selected appt is on a different day
				MsgBox.Show(this,"Please select an appointment first.");
				return;
			}
			if(apt.AptStatus == ApptStatus.PtNote | apt.AptStatus == ApptStatus.PtNoteCompleted) {
				if(!MsgBox.Show(this,true,"Delete Patient Note?")) {
					return;
				}
				if(apt.Note != "") {
					if(MessageBox.Show(Commlogs.GetDeleteApptCommlogMessage(apt.Note,apt.AptStatus),"Question...",MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = apt.PatNum;
						CommlogCur.CommDateTime = apt.AptDateTime;
						CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Patient NOTE from schedule, saved copy: ";
						CommlogCur.Note += apt.Note;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
				SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,PatCur.PatNum,
					ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", "+"NOTE Deleted",
					PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
			}
			else {
				if(!MsgBox.Show(this,true,"Delete Appointment?")) {
					return;
				}
				if(apt.Note != "") {
					if(MessageBox.Show(Commlogs.GetDeleteApptCommlogMessage(apt.Note,apt.AptStatus),"Question...",MessageBoxButtons.YesNo) == DialogResult.Yes) {
						Commlog CommlogCur = new Commlog();
						CommlogCur.PatNum = apt.PatNum;
						CommlogCur.CommDateTime = apt.AptDateTime;
						CommlogCur.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.APPT);
						CommlogCur.Note = "Deleted Appointment & saved note: ";
						if(apt.ProcDescript != "") {
							CommlogCur.Note += apt.ProcDescript + ": ";
						}
						CommlogCur.Note += apt.Note;
						CommlogCur.UserNum=Security.CurUser.UserNum;
						//there is no dialog here because it is just a simple entry
						Commlogs.Insert(CommlogCur);
					}
				}
				SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit,PatCur.PatNum,
					ContrApptSingle3[thisI].DataRoww["procs"].ToString()+", "+ContrApptSingle3[thisI].DataRoww["AptDateTime"].ToString()+", "+"Deleted",
					PIn.Long(ContrApptSingle3[thisI].DataRoww["AptNum"].ToString()));
				//If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
				if(HL7Defs.IsExistingHL7Enabled()) {
					//S17 - Appt Deletion event
					MessageHL7 messageHL7=MessageConstructor.GenerateSIU(PatCur,Patients.GetPat(PatCur.Guarantor),EventTypeHL7.S17,apt);
					//Will be null if there is no outbound SIU message defined, so do nothing
					if(messageHL7!=null) {
						HL7Msg hl7Msg=new HL7Msg();
						hl7Msg.AptNum=apt.AptNum;
						hl7Msg.HL7Status=HL7MessageStatus.OutPending;//it will be marked outSent by the HL7 service.
						hl7Msg.MsgText=messageHL7.ToString();
						hl7Msg.PatNum=PatCur.PatNum;
						HL7Msgs.Insert(hl7Msg);
#if DEBUG
						MessageBox.Show(this,messageHL7.ToString());
#endif
					}
				}
			}
			Appointments.Delete(selectedAptNum);
			ContrApptSingle.SelectedAptNum=-1;
			pinBoard.SelectedIndex=-1;
			DataRow row;
			for(int i=0;i<pinBoard.ApptList.Count;i++) {
				row=pinBoard.ApptList[i].DataRoww;
				if(selectedAptNum.ToString()==row["AptNum"].ToString()) {
					pinBoard.SelectedIndex=i;
					pinBoard.ClearSelected();
					pinBoard.SelectedIndex=-1;
				}
			}
			//ContrApptSingle.PinBoardIsSelected=false;
			//PatCurNum=0;
			if(PatCur==null) {
				ModuleSelected(0);
			}
			else {
				ModuleSelected(PatCur.PatNum);
			}
			SetInvalid();
			Recalls.SynchScheduledApptFull(apt.PatNum);
		}
Exemplo n.º 35
0
        ///<summary>Used when printing or emailing recall to make a commlog entry without any display.</summary>
        public static void InsertForRecall(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patNum, _mode, numberOfReminders, defNumNewStatus);
                return;
            }
            long   recallType = Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
            string command;
            string datesql = "CURDATE()";

            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                datesql = "(SELECT CURRENT_DATE FROM dual)";
            }
            if (recallType != 0)
            {
                command  = "SELECT COUNT(*) FROM commlog WHERE ";
                command += DbHelper.DateColumn("CommDateTime") + " = " + datesql;
                command += " AND PatNum=" + POut.Long(patNum) + " AND CommType=" + POut.Long(recallType)
                           + " AND Mode_=" + POut.Long((int)_mode)
                           + " AND SentOrReceived=1";
                if (Db.GetCount(command) != "0")
                {
                    return;
                }
            }
            Commlog com = new Commlog();

            com.PatNum         = patNum;
            com.CommDateTime   = DateTime.Now;
            com.CommType       = recallType;
            com.Mode_          = _mode;
            com.SentOrReceived = CommSentOrReceived.Sent;
            com.Note           = "";
            if (numberOfReminders == 0)
            {
                com.Note = Lans.g("FormRecallList", "Recall reminder.");
            }
            else if (numberOfReminders == 1)
            {
                com.Note = Lans.g("FormRecallList", "Second recall reminder.");
            }
            else if (numberOfReminders == 2)
            {
                com.Note = Lans.g("FormRecallList", "Third recall reminder.");
            }
            else
            {
                com.Note = Lans.g("FormRecallList", "Recall reminder:") + " " + (numberOfReminders + 1).ToString();
            }
            if (defNumNewStatus == 0)
            {
                com.Note += "  " + Lans.g("Commlogs", "Status None");
            }
            else
            {
                com.Note += "  " + DefC.GetName(DefCat.RecallUnschedStatus, defNumNewStatus);
            }
            com.UserNum = Security.CurUser.UserNum;
            Insert(com);
        }
Exemplo n.º 36
0
		private void butSetStatus_Click(object sender, System.EventArgs e) {
			if(gridMain.SelectedIndices.Length==0) {
				MsgBox.Show(this,"Please select a patient first.");
				return;
			}
			//bool makeCommEntries=MsgBox.Show(this,MsgBoxButtons.OKCancel,"Add Commlog (reminder) entries for each patient?");
			long newStatus=0;
			if(comboStatus.SelectedIndex>0) {
				newStatus=DefC.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex-1].DefNum;
			}
			for(int i=0;i<gridMain.SelectedIndices.Length;i++){
				Recalls.UpdateStatus(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()),newStatus);
			}
			//show the first one, and then make all the others very similar
			Commlog CommlogCur=new Commlog();
			CommlogCur.PatNum=PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
			CommlogCur.CommDateTime=DateTime.Now;
			CommlogCur.SentOrReceived=CommSentOrReceived.Sent;
			CommlogCur.Mode_=CommItemMode.Phone;//user can change this, of course.
			CommlogCur.CommType=Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL);
			CommlogCur.UserNum=Security.CurUser.UserNum;
			CommlogCur.Note=Lan.g(this,"Recall reminder.");
			if(comboStatus.SelectedIndex>0) {
				CommlogCur.Note+="  "+DefC.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex-1].ItemName;
			}
			else{
				CommlogCur.Note+="  "+Lan.g(this,"Status None");
			}
			FormCommItem FormCI=new FormCommItem(CommlogCur);
			FormCI.IsNew=true;
			FormCI.ShowDialog();
			if(FormCI.DialogResult!=DialogResult.OK) {//if user cancels, then the other comm entries won't go in either
				FillMain(null);
				return;
			}
			for(int i=1;i<gridMain.SelectedIndices.Length;i++) {
				CommlogCur.PatNum=PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
				Commlogs.Insert(CommlogCur);
			}
			FillMain(null);
		}
Exemplo n.º 37
0
 private void phoneSmall_GoToChanged(object sender,EventArgs e)
 {
     if(phoneSmall.GotoPatNum==0) {
         return;
     }
     CurPatNum=phoneSmall.GotoPatNum;
     Patient pat=Patients.GetPat(CurPatNum);
     RefreshCurrentModule();
     FillPatientButton(CurPatNum,pat.GetNameLF(),pat.Email!="",pat.ChartNumber,pat.SiteNum);
     Commlog commlog=Commlogs.GetIncompleteEntry(Security.CurUser.UserNum,CurPatNum);
     if(commlog==null) {
         commlog = new Commlog();
         commlog.PatNum = CurPatNum;
         commlog.CommDateTime = DateTime.Now;
         commlog.CommType =Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);//support call
         commlog.Mode_=CommItemMode.Phone;
         commlog.SentOrReceived=CommSentOrReceived.Received;
         commlog.UserNum=Security.CurUser.UserNum;
         FormCommItem FormCI=new FormCommItem(commlog);
         FormCI.IsNew = true;
         FormCI.ShowDialog();
         if(FormCI.DialogResult==DialogResult.OK) {
             RefreshCurrentModule();
         }
     }
     else {
         FormCommItem FormCI=new FormCommItem(commlog);
         FormCI.ShowDialog();
         if(FormCI.DialogResult==DialogResult.OK) {
             RefreshCurrentModule();
         }
     }
 }
Exemplo n.º 38
0
		///<summary></summary>
		public FormCommItem(Commlog commlogCur){
			InitializeComponent();
			Lan.F(this);
			CommlogCur=commlogCur;
		}