/*
* PanelServiceInfo.java
*
* Created on 18 Декабрь 2007 г., 12:33
*/
package clips.doctor;
import cli_fmw.utils.Selector;
import clips.delegate.directory.complex.DirectoryCollaboratorFunctionsItem;
import beans.contract.entity.Contract;
import clips.administrator.expenditure.PanelExpenTable;
import clips.delegate.contract.ContractLocal;
import clips.delegate.directory.complex.DirectoryDoctorActionItem;
import clips.delegate.directory.filtered.DirectoryServiceItem;
import cli_fmw.delegate.DelegateLine2;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.main.PageContainer;
import cli_fmw.utils.SelectorEditableExceptional;
import java.awt.Color;
import cli_fmw.main.ClipsException;
import clips.delegate.service.SerRenLocal;
import cli_fmw.main.ActivateSensitive;
import cli_fmw.main.CheckableDocListener;
import cli_fmw.main.MainWindow;
import cli_fmw.main.PageException;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.Persistentable;
import cli_fmw.main.Printable;
import cli_fmw.report.CombinedReportCreator;
import cli_fmw.report.CombinedReportOptions;
import cli_fmw.report.PageOptions.PageOrentation;
import cli_fmw.report.ReporterFactory;
import cli_fmw.report.panels.model.delegate.DirectoryComboBoxModel;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.ModalDialog;
import cli_fmw.utils.table_config_states.StateSaver;
import clips.delegate.config.ConfigLocal;
import clips.delegate.directory.complex.DirectoryCollaboratorFunctions;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import clips.delegate.directory.simple.medicalAidType.DirectoryMedicalAidTypeItem;
import clips.delegate.directory.simple.servicingPlace.DirectoryServicingPlace;
import clips.delegate.directory.simple.servicingPlace.DirectoryServicingPlaceItem;
import clips.delegate.directory.simple.receptionType.DirectoryReceptionTypeItem;
import clips.delegate.directory.simple.speciality.DirectorySpecialityItem;
import clips.delegate.doctor.DiseaseLocal;
import clips.login.UserInfo;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JPanel;
import framework.utils.Converter;
import framework.utils.FormatChecker;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
/**
*
* @author Администратор
*/
public class PanelServiceInfo extends PageGeneric implements PageContainer, Persistentable, Printable {
private SerRenLocal serRenLocal;
private PageGeneric expenPage = null; //панель, которая отображается внизу
private PanelExpenTable panel;
private DefaultListModel listModel;
private String uetNew;
private String uetOld;
/** Creates new form PanelServiceInfo
* @param container
* @param serRenLocal
* @throws ClipsException
*/
public PanelServiceInfo(PageContainer container, SerRenLocal serRen) throws ClipsException {
super(container);
initComponents();
this.serRenLocal = serRen;
panel = new PanelExpenTable(serRenLocal, this);
addNewPage(panel, null);
refreshList();
DirectoryServicingPlace servicingPlace = DirectoryLocator.getDirectory(DirectoryServicingPlace.class);
new DirectoryComboBoxModel<SerRenLocal, DirectoryServicingPlaceItem>(cbServPlace, servicingPlace, serRenLocal) {
@Override
public DirectoryServicingPlaceItem getSelectedDirectoryItem() throws ClipsException {
return getObject().getServicingPlace();
}
@Override
public void setSelectedDirectoryItem(DirectoryServicingPlaceItem item) throws ClipsException {
getObject().setServicingPlace(item);
}
@Override
public boolean isEnabled() {
try {
return super.isEnabled() && (!serRenLocal.isRendered() || UserInfo.get().isSuperUser());
} catch (ClipsException ex) {
ex.printStackTrace();
return false;
}
}
};
tfUet.getDocument().addDocumentListener(
new CheckableDocListener(tfUet, FormatChecker.UET) {
@Override
public void setField(String doc) {
uetNew = doc;
fireContainerEventStateChanged();
}
});
cbServPlace.setEnabled(serRenLocal.canModify());
tfUet.setEditable(serRenLocal.canModify());
setScreenFields();
/** тест
System.out.println("Other serrens:");
Iterator<ServiceRenderDetails> it = serRenLocal.getPacketSerrenList(false).iterator();
while (it.hasNext()) {
ServiceRenderDetails srd = it.next();
System.out.println("Serren id: " + srd.id);
}*/
StateSaver.attachTo(this);
}
private ArrayList<DirectoryCollaboratorFunctionsItem> getAvailableFunctionList() throws ClipsException {
String clinicType = UserInfo.get().getCollaborator().getLpu().getClinicType().getExtKey().trim();
ArrayList<DirectoryCollaboratorFunctionsItem> availableFunctions = new ArrayList<DirectoryCollaboratorFunctionsItem>();
DirectoryCollaboratorItem collaborator = UserInfo.get().getCollaborator();
DirectoryCollaboratorFunctions dcf = DirectoryLocator.getDirectory(DirectoryCollaboratorFunctions.class);
Selector<DirectoryCollaboratorFunctionsItem> functions = dcf.getFilteredItems(collaborator);
DirectorySpecialityItem spec = serRenLocal.getSpeciality();
DirectoryReceptionTypeItem recType = null;
if (serRenLocal.getContractService() != null
&& serRenLocal.getContractService().getReceptionType() != null
&& !serRenLocal.getContractService().getReceptionType().isNullItem()) {
recType = serRenLocal.getContractService().getReceptionType();
}
for (int i = 0; i < functions.size(); i++) {
boolean validRecType = recType == null || recType.getID() == 0 || functions.get(i).getReceptionType().equals(recType);
boolean validSpec = spec == null || spec.getID() == 0 || functions.get(i).getSpeciality().equals(spec);
if (validRecType && validSpec) {
if (functions.get(i).getReceptionType().getExtKey().trim().startsWith(clinicType)) {
availableFunctions.add(functions.get(i));
}
}
}
return availableFunctions;
}
private void refreshList() throws ClipsException {
if (listModel == null) {
listModel = new DefaultListModel();
jList1.setModel(listModel);
}
listModel.clear();
SelectorEditableExceptional<DirectoryDoctorActionItem> doctorActions = serRenLocal.getService().getDoctorActions();
for (int i = 0; i < doctorActions.size(); i++) {
DirectoryDoctorActionItem action = doctorActions.get(i);
listModel.addElement(action);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel7 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
panelTitle = new javax.swing.JPanel();
labService = new javax.swing.JLabel();
labReceptionType = new javax.swing.JLabel();
labVMU = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
panelTitles = new javax.swing.JPanel();
labAssigned = new javax.swing.JLabel();
labPayed = new javax.swing.JLabel();
labContract = new javax.swing.JLabel();
labRendered = new javax.swing.JLabel();
labPacket = new javax.swing.JLabel();
labUet = new javax.swing.JLabel();
panelValues = new javax.swing.JPanel();
tfAssigned = new javax.swing.JTextField();
tfPayed = new javax.swing.JTextField();
tfContract = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
tfRendered = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
cbServPlace = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
tfPacket = new javax.swing.JTextField();
jPanel6 = new javax.swing.JPanel();
tfUet = new javax.swing.JTextField();
btRenderService = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
panelAction = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
panelExpen = new javax.swing.JPanel();
setMinimumSize(new java.awt.Dimension(530, 132));
setPreferredSize(new java.awt.Dimension(530, 132));
jPanel7.setLayout(new java.awt.BorderLayout());
panelTitle.setLayout(new java.awt.GridLayout(0, 1));
labService.setText("Услуга: Название услуги (Анализ)");
panelTitle.add(labService);
labReceptionType.setText("Тип приема");
panelTitle.add(labReceptionType);
labVMU.setText("Вид первичной МС помощи");
panelTitle.add(labVMU);
jPanel3.setLayout(new java.awt.BorderLayout(5, 0));
panelTitles.setLayout(new java.awt.GridLayout(6, 0, 0, 2));
labAssigned.setText("Назначена");
panelTitles.add(labAssigned);
labPayed.setText("Оплата");
panelTitles.add(labPayed);
labContract.setText("Контракт");
panelTitles.add(labContract);
labRendered.setText("Оказана");
panelTitles.add(labRendered);
labPacket.setText("Пакет");
panelTitles.add(labPacket);
labUet.setText("УЕТ");
panelTitles.add(labUet);
jPanel3.add(panelTitles, java.awt.BorderLayout.WEST);
panelValues.setLayout(new java.awt.GridLayout(6, 1, 0, 2));
tfAssigned.setEditable(false);
panelValues.add(tfAssigned);
tfPayed.setEditable(false);
panelValues.add(tfPayed);
tfContract.setEditable(false);
panelValues.add(tfContract);
jPanel4.setLayout(new java.awt.BorderLayout(5, 0));
tfRendered.setEditable(false);
jPanel4.add(tfRendered, java.awt.BorderLayout.CENTER);
jPanel5.setLayout(new java.awt.BorderLayout(5, 0));
cbServPlace.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jPanel5.add(cbServPlace, java.awt.BorderLayout.EAST);
jLabel1.setText("Место обслуживания:");
jPanel5.add(jLabel1, java.awt.BorderLayout.CENTER);
jPanel4.add(jPanel5, java.awt.BorderLayout.EAST);
panelValues.add(jPanel4);
tfPacket.setEditable(false);
panelValues.add(tfPacket);
jPanel6.setLayout(new java.awt.BorderLayout());
tfUet.setColumns(8);
jPanel6.add(tfUet, java.awt.BorderLayout.WEST);
btRenderService.setText("Оказать услугу");
btRenderService.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btRenderServiceActionPerformed(evt);
}
});
jPanel6.add(btRenderService, java.awt.BorderLayout.EAST);
panelValues.add(jPanel6);
jPanel3.add(panelValues, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 5, 0));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(panelTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel7.add(jPanel1, java.awt.BorderLayout.NORTH);
jScrollPane1.setViewportView(jList1);
javax.swing.GroupLayout panelActionLayout = new javax.swing.GroupLayout(panelAction);
panelAction.setLayout(panelActionLayout);
panelActionLayout.setHorizontalGroup(
panelActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelActionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 654, Short.MAX_VALUE)
.addContainerGap())
);
panelActionLayout.setVerticalGroup(
panelActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelActionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane1.addTab("Состав услуги", panelAction);
panelExpen.setLayout(new java.awt.BorderLayout());
jTabbedPane1.addTab("Расходные материалы", panelExpen);
jPanel7.add(jTabbedPane1, java.awt.BorderLayout.CENTER);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void btRenderServiceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRenderServiceActionPerformed
try {
String checkUET = FormatChecker.checkUet(uetNew);
if (checkUET == null) {
try {
Number v = NumberFormat.getInstance().parse(uetNew);
double d = v.doubleValue();
int uetI = (int) (d * 100);
serRenLocal.setUet(uetI);
} catch (ParseException pex) {
throw new ClipsException(pex.getLocalizedMessage());
}
}
else {
throw new ClipsException(checkUET);
}
DirectoryCollaboratorFunctionsItem item = null;
ArrayList<DirectoryCollaboratorFunctionsItem> availableFunctionList = getAvailableFunctionList();
if (availableFunctionList.size() == 0){
MessageBox.showWarning("У вас нет типа приема, соответствующего услуге");
return;
}
if (availableFunctionList.size() == 1){
item = availableFunctionList.get(0);
}else{
DialogSelectFunctions dsf = new DialogSelectFunctions(MainWindow.mainWindow, availableFunctionList);
dsf.setVisible(true);
if (dsf.getDlgResult() == ModalDialog.DLG_OK){
item = dsf.getResult();
}
}
if (item != null){
serRenLocal.setRendered(item);
}
((Persistentable)getContainer()).save();
} catch (ClipsException ex) {
ex.printStackTrace();
serRenLocal.restore();
tfUet.setText(uetOld);
MessageBox.showException(ex);
}
}//GEN-LAST:event_btRenderServiceActionPerformed
public void setScreenFields() throws ClipsException {
//Заголовок
try {
DirectoryServiceItem service = serRenLocal.getService();
labService.setText(service.toString());
} catch (ClipsException ex) {
labService.setText("Информация недоступна");
labService.setToolTipText(MessageBox.parseException(ex));
}
//Тип приема
try {
DirectoryReceptionTypeItem recType = null;
if (serRenLocal.getCollaboratorFunctions() != null) {
recType = serRenLocal.getCollaboratorFunctions().getReceptionType();
}
if (recType == null || recType.getID() == 0) {
labReceptionType.setText("");
} else {
labReceptionType.setText(recType.toString());
}
} catch (ClipsException ex) {
labReceptionType.setText("Информация недоступна");
labReceptionType.setToolTipText(MessageBox.parseException(ex));
}
//Вид первичной МС помощи
try {
DirectoryMedicalAidTypeItem vmu = null;
if (serRenLocal.getCollaboratorFunctions() != null) {
vmu = serRenLocal.getCollaboratorFunctions().getFirstMedicalAid();
}
if (vmu == null || vmu.getID() == 0) {
labVMU.setText("Вид первичной МС помощи : не указано");
} else {
labVMU.setText("Вид первичной МС помощи : " + vmu.toString());
}
} catch (ClipsException ex) {
labVMU.setText("Вид первичной МС помощи : Информация недоступна");
labVMU.setToolTipText(MessageBox.parseException(ex));
}
//Назначена
try {
DirectoryCollaboratorItem director = serRenLocal.getSerRenDirector();
tfAssigned.setText(director.toString() + " [" + Converter.dateToString(serRenLocal.getSerDate()) + "]");
} catch (ClipsException ex) {
tfAssigned.setText("Информация недоступна");
tfAssigned.setToolTipText(MessageBox.parseException(ex));
}
//Оплачена
try {
SerRenLocal serRenRef = serRenLocal.getReferencedSerRen();
if (serRenRef != null) {
tfPayed.setText("Бесплатно в рамках услуги: " + serRenRef.getService().getTitle());
} else if (serRenLocal.getPolisData().getContract().getType() == Contract.TYPE_OMI){
tfPayed.setText("Посещение оплачивается по ОМС");
} else if (serRenLocal.isSerPayed()) {
tfPayed.setText("Оплачена");
} else {
tfPayed.setBackground(Color.RED);
float discount = (float) serRenLocal.getCalculatedDiscount() / 100;
//сумма к оплате в копейках
float lack = serRenLocal.getContractService().getLack() * (1 - discount) / 100;
float payed = ((float) serRenLocal.getTransactionSumm()) / 100;
tfPayed.setText(String.format("%.2f", payed) + " из " + String.format("%.2f", lack));
}
} catch (ClipsException ex) {
tfPayed.setText("Информация недоступна");
tfPayed.setToolTipText(MessageBox.parseException(ex));
}
//Договор
try {
ContractLocal contract = serRenLocal.getPolisData().getContract();
String type = Contract.TYPES_ARRAY[contract.getType()].toString();
tfContract.setText(contract.getIndex() + " (" + type + ")");
} catch (ClipsException ex) {
tfContract.setText("Информация недоступна");
tfContract.setToolTipText(MessageBox.parseException(ex));
}
//Оказана
try {
if (serRenLocal.isRendered()) {
DirectoryCollaboratorItem collaborator = serRenLocal.getCollaboratorFunctions().getCollaborator();
tfRendered.setText(collaborator.toString() + " [" + Converter.dateToString(serRenLocal.getSerRenderDate()) + "]");
btRenderService.setEnabled(false);
} else {
tfRendered.setText("Не оказана");
String text = serRenLocal.canBeRenderedByCurrentCollaborator();
btRenderService.setEnabled(text == null);
btRenderService.setToolTipText(text != null ? text : "Оказать услугу");
}
} catch (ClipsException ex) {
tfRendered.setText("Информация недоступна");
tfRendered.setToolTipText(MessageBox.parseException(ex));
btRenderService.setEnabled(false);
}
//Пакет
try {
if (serRenLocal.getPacketServiceID() != 0) {
tfPacket.setText("В пакете");
} else {
tfPacket.setText("");
}
} catch (ClipsException ex) {
tfPacket.setText("Информация недоступна");
tfPacket.setToolTipText(MessageBox.parseException(ex));
}
Double dUet = (double) serRenLocal.getUet();
String sUet = String.format("%.2f",dUet/100);
uetOld = new String(sUet);
tfUet.setText(sUet);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btRenderService;
private javax.swing.JComboBox cbServPlace;
private javax.swing.JLabel jLabel1;
private javax.swing.JList jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JLabel labAssigned;
private javax.swing.JLabel labContract;
private javax.swing.JLabel labPacket;
private javax.swing.JLabel labPayed;
private javax.swing.JLabel labReceptionType;
private javax.swing.JLabel labRendered;
private javax.swing.JLabel labService;
private javax.swing.JLabel labUet;
private javax.swing.JLabel labVMU;
private javax.swing.JPanel panelAction;
private javax.swing.JPanel panelExpen;
private javax.swing.JPanel panelTitle;
private javax.swing.JPanel panelTitles;
private javax.swing.JPanel panelValues;
private javax.swing.JTextField tfAssigned;
private javax.swing.JTextField tfContract;
private javax.swing.JTextField tfPacket;
private javax.swing.JTextField tfPayed;
private javax.swing.JTextField tfRendered;
private javax.swing.JTextField tfUet;
// End of variables declaration//GEN-END:variables
@Override
public String getPageTitle() {
return "Информация о услуге";
}
@Override
public PageGeneric addNewPage(PageGeneric pageToAdd, PageGeneric afterPage) throws PageException {
if (expenPage == null) {
expenPage = pageToAdd;
panelExpen.add((JPanel) pageToAdd);
panelExpen.revalidate();
return pageToAdd;
} else {
throw new PageException("Страница не может быть добавлена");
}
}
@Override
public void removePage(PageGeneric page, boolean forced) throws PageException {
if (page == null) {
return;
}
if (this.expenPage == page) {
if (page instanceof ActivateSensitive) {
ActivateSensitive as = (ActivateSensitive) page;
as.beforeDeactivate();
}
if (forced || !((Persistentable)page).isDirty()) {
panelExpen.removeAll();
repaint();
//this.expenPage = null;
}
} else {
throw new PageException("Попытка удалить неизвестную страницу");
}
}
@Override
public void activatePage(PageGeneric page) throws PageException {
throw new PageException("Не должно быть реализовано");
}
@Override
public PageGeneric getActivePage() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void contentStateChanged() {
}
@Override
public boolean isDirty() {
boolean res = serRenLocal.isDirty();
return res || !uetNew.equals(uetOld);
}
@Override
public void save() throws ClipsException {
String checkUET = FormatChecker.checkUet(uetNew);
if (checkUET == null) {
try {
Number v = NumberFormat.getInstance().parse(uetNew);
double d = v.doubleValue();
int uetI = (int) (d * 100);
serRenLocal.setUet(uetI);
} catch (ParseException pex) {
throw new ClipsException(pex.getLocalizedMessage());
}
}
else {
throw new ClipsException(checkUET);
}
uetOld = new String(uetNew);
serRenLocal.save1();
}
@Override
public void restore() {
serRenLocal.restore();
panelExpen.repaint();
tfUet.setText(uetOld);
}
@Override
public int getPageCount() {
return (expenPage == null) ? 0:1;
}
@Override
public PageGeneric getPage(int index) {
return expenPage;
}
@Override
public boolean readyForPrint() {
return !isDirty();
}
@Override
public void print() {
try {
if (readyForPrint()) {
if (!serRenLocal.isRendered()) {
MessageBox.showInfo("Услуга не оказана");
return;
}
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 diseaseLocal = serRenLocal.getDiseaseLocal();
diseaseLocal.formPrintFields(serRenLocal.getCollaboratorFunctions());
diseaseLocal.print(parCreator);
parCreator.finish();
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
@Override
public DelegateLine2 getDelegate() {
return serRenLocal;
}
}