Ejemplo n.º 1
0
		///<summary>Adds a procedure to a group.</summary>
		public static long Insert(ProcGroupItem procGroupItem){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				procGroupItem.ProcGroupItemNum=Meth.GetLong(MethodBase.GetCurrentMethod(),procGroupItem);
				return procGroupItem.ProcGroupItemNum;
			}
			return Crud.ProcGroupItemCrud.Insert(procGroupItem);
		}
Ejemplo n.º 2
0
 ///<summary>Adds a procedure to a group.</summary>
 public static long Insert(ProcGroupItem procGroupItem)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         procGroupItem.ProcGroupItemNum = Meth.GetLong(MethodBase.GetCurrentMethod(), procGroupItem);
         return(procGroupItem.ProcGroupItemNum);
     }
     return(Crud.ProcGroupItemCrud.Insert(procGroupItem));
 }
Ejemplo n.º 3
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);
		}