Exemplo n.º 1
0
		private void menuItemGroupSelected_Click(object sender,EventArgs e){
			DataRow row;
			if(gridProg.SelectedIndices.Length==0){
				MsgBox.Show(this,"Please select procedures to attach a group note to.");
				return;
			}
			for(int i=0;i<gridProg.SelectedIndices.Length;i++){
				row=(DataRow)gridProg.Rows[gridProg.SelectedIndices[i]].Tag;
				if(row["ProcNum"].ToString()=="0") { //This is not a procedure.
					MsgBox.Show(this,"You may only attach a group note to procedures.");
					return;
				}
			}
			List<Procedure> proclist=new List<Procedure>();
			Procedure proc;
			for(int i=0;i<gridProg.SelectedIndices.Length;i++){//Create proclist from selected items.
				row=(DataRow)gridProg.Rows[gridProg.SelectedIndices[i]].Tag;
				proc=Procedures.GetOneProc(PIn.Long(row["ProcNum"].ToString()),true);
				proclist.Add(proc);
			}
			//Validate the list of procedures------------------------------------------------------------------------------------
			DateTime procDate=proclist[0].ProcDate;
			long clinicNum=proclist[0].ClinicNum;
			long provNum=proclist[0].ProvNum;
			for(int i=0;i<proclist.Count;i++){//starts at 0 to check procStatus
				if(ProcedureCodes.GetStringProcCode(proclist[i].CodeNum)==ProcedureCodes.GroupProcCode){
					MsgBox.Show(this,"You cannot attach a group note to another group note.");
					return;
				}
				if(proclist[i].IsLocked) {
					MsgBox.Show(this,"Procedures cannot be locked.");
					return;
				}
				if(proclist[i].ProcDate!=procDate){
					MsgBox.Show(this,"Procedures must have the same date to attach a group note.");
					return;
				}
				if(proclist[i].ProcStatus!=ProcStat.C){
					MsgBox.Show(this,"Procedures must be complete to attach a group note.");
					return;
				}
				if(proclist[i].ClinicNum!=clinicNum){
					MsgBox.Show(this,"Procedures must have the same clinic to attach a group note.");
					return;
				}
				if(proclist[i].ProvNum!=provNum){
					MsgBox.Show(this,"Procedures must have the same provider to attach a group note.");
					return;
				}
			}
			//Procedures are valid. Create new Procedure "group" and ProcGroupItems-------------------------------------------------------
			Procedure group=new Procedure();
			group.PatNum=PatCur.PatNum;
			group.ProcStatus=ProcStat.EC;
			group.DateEntryC=DateTime.Now;
			group.ProcDate=procDate;
			group.ProvNum=provNum;
			group.ClinicNum=clinicNum;
			group.CodeNum=ProcedureCodes.GetCodeNum(ProcedureCodes.GroupProcCode);
			if(PrefC.GetBool(PrefName.ProcGroupNoteDoesAggregate)) {
				string aggNote="";
				for(int i=0;i<proclist.Count;i++) {
					if(i>0 && proclist[i-1].Note!="") {
						aggNote+="\r\n";
					}
					aggNote+=proclist[i].Note;
				}
				group.Note=aggNote;
			}
			else {
				group.Note=ProcCodeNotes.GetNote(group.ProvNum,group.CodeNum);
			}
			group.IsNew=true;
			Procedures.Insert(group);
			List<ProcGroupItem> groupItemList=new List<ProcGroupItem>();
			ProcGroupItem groupItem;
			for(int i=0;i<proclist.Count;i++){
				groupItem=new ProcGroupItem();
				groupItem.ProcNum=proclist[i].ProcNum;
				groupItem.GroupNum=group.ProcNum;
				ProcGroupItems.Insert(groupItem);
				groupItemList.Add(groupItem);
			}
			if(Programs.UsingOrion) {
				OrionProc op=new OrionProc();
				op.ProcNum=group.ProcNum;
				op.Status2=OrionStatus.C;
				OrionProcs.Insert(op);
			}
			FormProcGroup FormP=new FormProcGroup();
			FormP.GroupCur=group;
			FormP.GroupItemList=groupItemList;
			FormP.ProcList=proclist;
			FormP.ShowDialog();
			if(FormP.DialogResult!=DialogResult.OK){
				return;
			}
			if(PrefC.GetBool(PrefName.ProcGroupNoteDoesAggregate)) {
				//remove the notes from all the attached procs
				for(int i=0;i<proclist.Count;i++) {
					Procedure oldProc=proclist[i].Copy();
					Procedure changedProc=proclist[i].Copy();
					changedProc.Note="";
					Procedures.Update(changedProc,oldProc);
				}
			}
			ModuleSelected(PatCur.PatNum);
		}
Exemplo n.º 2
0
		private void gridProg_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Chartscrollval=gridProg.ScrollValue;
			DataRow row=(DataRow)gridProg.Rows[e.Row].Tag;
			if(row["ProcNum"].ToString()!="0"){
				if(checkAudit.Checked){
					MsgBox.Show(this,"Not allowed to edit procedures when in audit mode.");
					return;
				}
				Procedure proc=Procedures.GetOneProc(PIn.Long(row["ProcNum"].ToString()),true);
				if(ProcedureCodes.GetStringProcCode(proc.CodeNum)==ProcedureCodes.GroupProcCode){
					FormProcGroup FormP=new FormProcGroup();		
					List<ProcGroupItem> groupItemList=ProcGroupItems.GetForGroup(proc.ProcNum);
					List<Procedure> procList=new List<Procedure>();
					for(int i=0;i<groupItemList.Count;i++){
						procList.Add(Procedures.GetOneProc(groupItemList[i].ProcNum,false));
					}
					FormP.GroupCur=proc;
					FormP.GroupItemList=groupItemList;
					FormP.ProcList=procList;
					FormP.ShowDialog();
					if(FormP.DialogResult==DialogResult.OK){
						ModuleSelected(PatCur.PatNum);
						FillProgNotes();
					}
					return;
				}
				else{
					FormProcEdit FormP=new FormProcEdit(proc,PatCur,FamCur);
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc", proc, FormP);
					if(!FormP.IsDisposed) { //Form might be disposed by the above hook.
						FormP.ShowDialog();
					} 
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc2", proc, FormP);
					if(FormP.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["CommlogNum"].ToString()!="0"){
				Commlog comm=Commlogs.GetOne(PIn.Long(row["CommlogNum"].ToString()));
				FormCommItem FormC=new FormCommItem(comm);
				FormC.ShowDialog();
				if(FormC.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["RxNum"].ToString()!="0") {
				RxPat rx=RxPats.GetRx(PIn.Long(row["RxNum"].ToString()));
				FormRxEdit FormRxE=new FormRxEdit(PatCur,rx);
				FormRxE.ShowDialog();
				if(FormRxE.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["LabCaseNum"].ToString()!="0") {
				LabCase lab=LabCases.GetOne(PIn.Long(row["LabCaseNum"].ToString()));
				FormLabCaseEdit FormL=new FormLabCaseEdit();
				FormL.CaseCur=lab;
				FormL.ShowDialog();
				//needs to always refresh due to complex ok/cancel
			}
			else if(row["TaskNum"].ToString()!="0") {
				Task task=Tasks.GetOne(PIn.Long(row["TaskNum"].ToString()));
				if(task==null) {
					MsgBox.Show(this,"This task has been deleted by another user.");
				}
				else {
					FormTaskEdit FormT=new FormTaskEdit(task,task.Copy());
					FormT.Closing+=new CancelEventHandler(TaskGoToEvent);
					FormT.Show();//non-modal
				}
			}
			else if(row["AptNum"].ToString()!="0") {
				//Appointment apt=Appointments.GetOneApt(
				FormApptEdit FormA=new FormApptEdit(PIn.Long(row["AptNum"].ToString()));
				//PinIsVisible=false
				FormA.IsInChartModule=true;
				FormA.ShowDialog();
				if(FormA.CloseOD) {
					((Form)this.Parent).Close();
					return;
				}
				if(FormA.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["EmailMessageNum"].ToString()!="0") {
				EmailMessage msg=EmailMessages.GetOne(PIn.Long(row["EmailMessageNum"].ToString()));
				if(msg.SentOrReceived==EmailSentOrReceived.WebMailReceived
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailRecdRead
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSent
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSentRead) 
				{
					//web mail uses special secure messaging portal
					FormWebMailMessageEdit FormWMME=new FormWebMailMessageEdit(PatCur.PatNum,msg.EmailMessageNum);
					if(FormWMME.ShowDialog()!=DialogResult.OK) {
						return;
					}
				}
				else {
					FormEmailMessageEdit FormE=new FormEmailMessageEdit(msg);
					FormE.ShowDialog();
					if(FormE.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["SheetNum"].ToString()!="0") {
				Sheet sheet=Sheets.GetSheet(PIn.Long(row["SheetNum"].ToString()));
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.ShowDialog();
				if(FormSFE.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["FormPatNum"].ToString()!="0"){
				FormPat form=FormPats.GetOne(PIn.Long(row["FormPatNum"].ToString()));
				FormFormPatEdit FormP=new FormFormPatEdit();
				FormP.FormPatCur=form;
				FormP.ShowDialog();
				if(FormP.DialogResult==DialogResult.OK)
				{
					ModuleSelected(PatCur.PatNum);//Why is this called here and down 3 lines? Do we need the Allocator, or should we return here?
				}
			}
			ModuleSelected(PatCur.PatNum);
			Reporting.Allocators.MyAllocator1_ProviderPayment.AllocateWithToolCheck(this.PatCur.Guarantor);
		}