private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanSign, TPcur.DateTP)) { butOK.Enabled = false; signatureBoxWrapper.Enabled = false; } LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } SetSize(); previewContr.Document = Document; ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); signatureBoxWrapper.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; string keyData = TreatPlans.GetKeyDataForSignatureHash(TPcur, proctpList); signatureBoxWrapper.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.Signature); }
private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanSign, TPcur.DateTP)) { butOK.Enabled = false; signatureBoxWrapper.Enabled = false; signatureBoxWrapperPractice.Enabled = false; textTypeSig.Enabled = false; textTypeSigPractice.Enabled = false; } _hasSigPractice = (SheetTP == null ? false : (SheetTP.SheetFields.Any(x => x.FieldType == SheetFieldType.SigBoxPractice) && DoPrintUsingSheets)); LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document == null) //Only set when not pringing using sheets, shet via a MigraDoc. //TODO:Implement ODprintout pattern - MigraDoc //Just signing the TP, there is no way to print a Treat' Plan from the Sign TP window so suppress the printer dialogs. //Users will click the Print TP button from the Treat' Plan module when they want to print. { PrinterL.ControlPreviewOverride = previewContr; //Sets the printdoc to previewContr.Document after validation. Otherwise shows error. SheetPrinting.Print(SheetTP, isPrintDocument: false, isPreviewMode: true); if (ODprintout.CurPrintout.SettingsErrorCode != PrintoutErrorCode.Success) { DialogResult = DialogResult.Cancel; return; } Document = ODprintout.CurPrintout.PrintDoc; } else //MigraDoc { if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } previewContr.Document = Document; } SetSize(); ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); //Fill TP signature signatureBoxWrapper.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; string keyData = TreatPlans.GetKeyDataForSignatureHash(TPcur, proctpList); signatureBoxWrapper.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.Signature); SheetField sheetField; if (SheetTP != null) { sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBox); if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName)) { labelSig.Text = $"{sheetField.FieldName} sign here --->"; } sheetField = SheetTP.GetSheetFieldByName("SignatureText"); if (sheetField != null) { textTypeSig.Text = TPcur.SignatureText; labelTypeSig.Visible = true; textTypeSig.Visible = true; } } //Fill TP practice signature if printing using sheets if (_hasSigPractice) { signatureBoxWrapperPractice.Visible = true; labelSigPractice.Visible = true; signatureBoxWrapperPractice.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; signatureBoxWrapperPractice.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.SignaturePractice); sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBoxPractice); if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName)) { labelSigPractice.Text = $"{sheetField.FieldName} sign here --->"; } sheetField = SheetTP.GetSheetFieldByName("SignaturePracticeText"); if (sheetField != null) { textTypeSigPractice.Text = TPcur.SignaturePracticeText; labelTypeSigPractice.Visible = true; //defaulted to be hidden textTypeSigPractice.Visible = true; } } }