public void print() {
try {
if (readyForPrint()) {
DirectoryCollaboratorFunctionsItem collab = null;
DiseaseLocal diseaseLocal = medexamLocal.getDiseaseLocal();
ArrayList<DirectoryCollaboratorFunctionsItem> collabs = diseaseLocal.getCollabsIn();
if (collabs.isEmpty()) {
JOptionPane.showMessageDialog(this, "В заболевании нет оказанных услуг");
return;
}
if (collabs.size() > 1) {
DirectoryCollaboratorFunctionsItem[] a = new DirectoryCollaboratorFunctionsItem[collabs.size()];
a = collabs.toArray(a);
collab =
(DirectoryCollaboratorFunctionsItem) JOptionPane.showInputDialog(this,
"В заболевании несколько ТАПов.\nВыберите сотрудника (специальность), по которому печатать ТАП.",
"Выберите сотрудника", JOptionPane.PLAIN_MESSAGE, null, a, null);
if (collab == null) {
return;
}
}
else {
collab = collabs.get(0);
}
CombinedReportCreator parCreator = ReporterFactory.createCombinedReporter(getClass(), 1);
CombinedReportOptions ops = new CombinedReportOptions();
ops.topMargin =0;
ops.bottomMargin = 0;
ops.leftMargin =0;
ops.rightMargin = 0;
ops.setPageA5();
ops.setOrentation(PageOrentation.horizontal);
parCreator.setUpReport(null, ops, null);
diseaseLocal.formPrintFields(collab);
diseaseLocal.print(parCreator);
parCreator.finish();
}
} catch (ClipsException ex) {
MessageBox.showException(ex);