This plugin code has been working fine for several years but broke recently as of 13.1.16. What this code block does is split the default note for procedures with a delimiter in this case '+-+' . It added this functionality to allow us OMSs to have a different note appear for an upper vs. a lower tooth because the default note is almost always different for upper vs. lower.
So if the default note for, say a D7240 looks like
Code: Select all
This is the upper note
+-+
This is the lower note
The three hooks that call this block are
Code: Select all
case
"ContrChart.menuItemSetComplete_Click_procLoop"://with delimiter '+-+' between notes for upper and lower, enters appropriate note according to tooth #
ProcList = Procedures.Refresh(FormOpenDental.CurPatNum);
Procedure oldProc = new Procedure();
textNotes = new ODtextBox();
FormOpenDentalA.UpperLowerNoteFixFromMenu((object)sender, (Procedure)parameters[0], (Procedure)parameters[1], (ODtextBox)textNotes);
return true;
case "FormProcEdit.butSetComplete_Click_end": //with delimiter '+-+' between notes for upper and lower, enters appropriate note according to tooth #. Also used to release ProcLock.
ProcList = Procedures.Refresh(FormOpenDental.CurPatNum);
oldProc = new Procedure();
textNotes = new ODtextBox();
FormOpenDentalA.UpperLowerNoteFixFromMenu((object)sender,(Procedure)parameters[0], (Procedure)parameters[1], (ODtextBox)parameters[2]);
FormOpenDentalA.ReleaseProcLock((object)sender, (Procedure)parameters[0]);
return true;
case "Procedures.SetCompleteInAppt_procLoop": //with delimiter '+-+' between notes for upper and lower, enters appropriate note according to tooth #
ProcList = Procedures.Refresh(FormOpenDental.CurPatNum);
FormOpenDentalA.UpperLowerNoteFix((Procedures)sender, (Procedure)parameters[0], (Procedure)parameters[1]);
return true;
Code: Select all
/// <summary>
/// Adds appropriate note for upper vs. lower teeth if delimiter '+-+' is used between note for upper and lower
/// </summary>
/// <param name="sender"></param>
/// <param name="procCur"></param>
/// <param name="procOld"></param>
public static void UpperLowerNoteFixFromMenu(object sender, Procedure procCur, Procedure procOld, ODtextBox textNotes) { //setting 'Complete' from ContrAppr or FormProcEdit uses this method
string test = textNotes.Text;
Procedure procOrig = procOld;
if (procOld.Note == String.Empty || procCur.Note == String.Empty || procOld.Note == null) {
procCur.Note = ProcCodeNotes.GetNote(procCur.ProvNum, procCur.CodeNum);
beforeDelim = procCur.Note;
afterDelim = procCur.Note;
string[] parts = beforeDelim.Split(new string[] { "\r\n+-+\r\n" }, StringSplitOptions.None);
for (int j = 0; j < parts.Length; j++) {
if (j == 0)
{
beforeDelim = (parts[j]);
}
if (j == 1)
{
afterDelim = (parts[j]);
}
}
if (procCur.ToothNum == String.Empty) {
Procedures.Update(procCur, procOld);
textNotes.Text = procOrig.Note;
return;
}
}
else if (procOld.Note == null) {
beforeDelim = procCur.Note;
afterDelim = procCur.Note;
}
else {
beforeDelim = procOld.Note;
afterDelim = procOld.Note;
}
string upperNote = beforeDelim;
string lowerNote = afterDelim;
Regex isPedoUpper = new Regex("^[a-jA-J]*$");
Regex isPedoLower = new Regex("^[k-tK-T]*$");
if (procCur.ToothNum != "") { //because some Proc don't have a toothNum, eg., exams
if (isPedoUpper.IsMatch(procCur.ToothNum)) { //primary upper teeth
if (procCur.Note != procOld.Note)
procCur.Note = upperNote;
if (procCur.Note != "") {//prevents double note getting added from ContrChart
procOld.Note = String.Empty;
}
}
else if (isPedoLower.IsMatch(procCur.ToothNum)) { //primary lower teeth
if (procCur.Note != procOld.Note)
procCur.Note = lowerNote;
if (procCur.Note != "") {//prevents double note getting added from ContrChart
procOld.Note = String.Empty;
}
}
else if (Convert.ToInt64(procCur.ToothNum) <= 16 || ((Convert.ToInt64(procCur.ToothNum) >= 51 && (Convert.ToInt64(procCur.ToothNum) <= 66)))) { //check if permanent or supernumerary upper
if (procCur.Note != procOld.Note)
procCur.Note = upperNote;
if (procCur.Note != "") {//prevents double note getting added from ContrChart
procOld.Note = String.Empty;
}
}
else if (Convert.ToInt64(procCur.ToothNum) >= 17 | ((Convert.ToInt64(procCur.ToothNum) >= 67 && (Convert.ToInt64(procCur.ToothNum) <= 82)))) { //check if permanent or supernumerary lower
if (procCur.Note != procOld.Note)
procCur.Note = lowerNote;
if (procCur.Note != "") {//prevents double note getting added from ContrChart
procOld.Note = String.Empty;
}
}
}
else if (procCur.Note != "") {
procCur.Note = procOld.Note; //prevents template note from overwriting changes to note
}
Procedures.Update(procCur, procOld);
textNotes.Text = procCur.Note; //only needed when completing note on FormProcEdit
}
Any suggestions?