private void butOK_Click(object sender, EventArgs e) { SaveSignature(); //"saves" signature to TPCur, does not save to DB. TreatPlans.Update(TPcur); //save signature to DB. TPcur.ListProcTPs = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); if (DoPrintUsingSheets) { SheetParameter.SetParameter(SheetTP, "TreatPlan", TPcur); //update TP on sheet to have new signature for generating pdfs } if (TPcur.Signature.Length > 0 && TPcur.DocNum == 0 && PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf)) { SigChanged = true; } else if (TPcur.DocNum > 0 && !Documents.DocExists(TPcur.DocNum) && PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf)) { //Setting SigChanged to True will resave document below. SigChanged = MsgBox.Show(this, MsgBoxButtons.YesNo, "Cannot find saved copy of signed PDF, would you like to resave the document?"); } if (PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf) && SaveDocDelegate != null && SigChanged && TPcur.Signature.Length > 0) { List <Document> docs = SaveDocDelegate(true, SheetTP); if (docs.Count > 0) { TPcur.DocNum = docs[0].DocNum; //attach first Doc to TP. TreatPlans.Update(TPcur); //update docnum. must be called after signature is updated. } } SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, TPcur.PatNum, "Sign TP"); DialogResult = DialogResult.OK; }
private void butDocumentView_Click(object sender, EventArgs e) { Document doc = Documents.GetByNum(PlanCur.DocNum); if (doc.DocNum == 0) { MsgBox.Show(this, "Error locating document."); return; } if (!Documents.DocExists(doc.DocNum)) { MsgBox.Show(this, "Unable to open document."); return; } Documents.OpenDoc(doc.DocNum); }
private void FormTreatPlanEdit_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanEdit, PlanCur.DateTP)) { butOK.Enabled = false; butDelete.Enabled = false; butPickResponsParty.Enabled = false; butClearResponsParty.Enabled = false; butSigClear.Enabled = false; butDocumentDetach.Enabled = false; textHeading.ReadOnly = true; textDateTP.ReadOnly = true; textNote.ReadOnly = true; if (Security.IsAuthorized(Permissions.TreatPlanSign, PlanCur.DateTP)) //User has permission to edit the heading field. { textHeading.ReadOnly = false; butOK.Enabled = true; } } if (!Security.IsAuthorized(Permissions.TreatPlanPresenterEdit, true)) { butPickPresenter.Visible = false; } if (PlanCur.UserNumPresenter > 0) { _presenterCur = Userods.GetUser(PlanCur.UserNumPresenter); _presenterOld = _presenterCur.Copy(); textPresenter.Text = _presenterCur.UserName; } textUserEntry.Text = Userods.GetName(PlanCur.SecUserNumEntry); textDateTP.Text = PlanCur.DateTP.ToShortDateString(); textHeading.Text = PlanCur.Heading; textNote.Text = PlanCur.Note; if (PrefC.GetBool(PrefName.EasyHidePublicHealth)) { labelResponsParty.Visible = false; textResponsParty.Visible = false; butPickResponsParty.Visible = false; butClearResponsParty.Visible = false; } if (PlanCur.ResponsParty != 0) { textResponsParty.Text = Patients.GetLim(PlanCur.ResponsParty).GetNameLF(); } if (PlanCur.Signature != "") //Per Nathan 01 OCT 2015: In addition to invalidating signature (old behavior) we will also block editing signed TPs. { butOK.Enabled = false; textHeading.ReadOnly = true; textDateTP.ReadOnly = true; textNote.ReadOnly = true; butClearResponsParty.Enabled = false; butPickResponsParty.Enabled = false; butSigClear.Visible = true; butDocumentDetach.Enabled = false; } else { butSigClear.Visible = false; butSigClear.Enabled = false; } if (PlanCur.DocNum > 0) //Was set at some point in the past. { Document doc = Documents.GetByNum(PlanCur.DocNum); if (doc.DocNum == 0) { textDocument.Text = "(" + Lan.g(this, "Missing Document") + ")"; //Invalid Fkey to document.DocNum butDocumentView.Enabled = false; } else { textDocument.Text = doc.Description; if (!Documents.DocExists(doc.DocNum)) { textDocument.Text += " (" + Lan.g(this, "Unreachable File") + ")"; //Document points to unreachable file butDocumentView.Enabled = false; } } } else //hide document controls because there is no attached document { labelDocument.Visible = false; textDocument.Visible = false; butDocumentView.Visible = false; butDocumentDetach.Visible = false; } }