/*
* DialogSicklistCreate.java
*
* Created on 20 Март 2008 г., 17:23
*/
package clips.doctor.sicklist.dialogs;
import TimeTable.Day;
import cli_fmw.utils.SelectorEditableExceptional;
import cli_fmw.utils.chooser.ChoosePanelData;
import clips.delegate.client.ClientLocal;
import cli_fmw.delegate.directory.DirectoryItemRO;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import clips.delegate.directory.simple.disablilityType.DirectoryDisabilityTypeItem;
import clips.delegate.doctor.sicklist.SicklistLocal;
import cli_fmw.main.ClipsException;
import clips.delegate.job.JobLocal;
import cli_fmw.delegate.utils.TimeLocal;
import clips.directory.dialogs.collaborators.DirectoryDialogCollaborators;
import cli_fmw.main.CheckableDocListener;
import cli_fmw.main.audit.AuditManager;
import cli_fmw.utils.Selector;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.ModalDialog;
import cli_fmw.utils.table_config_states.StateSaver;
import clips.delegate.directory.complex.DirectoryEnterprise;
import clips.delegate.directory.complex.DirectoryEnterpriseItem;
import clips.delegate.directory.ro.DirectoryCollaborator;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import clips.delegate.directory.ro.DirectoryLpu;
import clips.delegate.directory.simple.disablilityType.DirectoryDisabilityType;
import clips.delegate.service.SerRenLocal;
import clips.login.UserInfo;
import framework.utils.CollectionUtils;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import framework.utils.DateTimeUtils;
import framework.utils.FormatChecker;
import java.util.ArrayList;
import org.infotechservice.ICalendar.DateEvent;
import org.infotechservice.ICalendar.DateHandler;
import org.infotechservice.ICalendar.DateListener;
/**
*
* @author axe
*/
public class DialogSicklistCreate extends ModalDialog {
private static final long serialVersionUID = 1;
private ClientLocal clientLocal;
private Calendar today = TimeLocal.getCurrentTime();
private SicklistLocal sicklist;
// private DiagnosisLocal diagnosisLocal;
/**МАП больничных которые можно продлить */
private HashMap<String, SicklistLocal> mapSickList;
private SicklistDiagnosComboboxModel diagOpenModel;
private SicklistDiagnosComboboxModel diagCloseModel;
SerRenLocal serren;
private void disableControls() {
cbContinue.setEnabled(false);
serialNumber.setEnabled(false);
closedSerialNumber.setEnabled(false);
}
private enum Mode{
newSicklist,
continueExist,
registerOther,
registerClosed,
}
/** Creates new form DialogSicklistCreate
* @param parent
* @param clientLocal
* @param serren
* @param am
* @throws ClipsException
*/
public DialogSicklistCreate(java.awt.Frame parent, ClientLocal clientLocal, SerRenLocal serren, AuditManager am) throws ClipsException {
super(parent, "Выписка больничного листа", am);
initComponents();
Calendar t = (Calendar) today.clone();
t.set(Calendar.HOUR, 0);
t.set(Calendar.MINUTE, 0);
t.set(Calendar.SECOND, 0);
t.roll(Calendar.DAY_OF_MONTH, true);
DCDateTill.setMinSelectableDate(t.getTime());
this.clientLocal = clientLocal;
this.serren = serren;
otherDate.setDate(today.getTime());
diagOpenModel = new SicklistDiagnosComboboxModel(clientLocal);
cbDiagOpen.setModel(diagOpenModel);
diagCloseModel = new SicklistDiagnosComboboxModel(diagOpenModel);
cbDiagClose.setModel(diagCloseModel);
mapSickList = new HashMap<String, SicklistLocal>();
List<SicklistLocal> s = clientLocal.getSicklistList();
ArrayList<String> list = new ArrayList<String>();
// разварачиваю список, так как больничные приходят отсортированными, самые последние в низу
for (int i = s.size() - 1; i >= 0; i--) {
SicklistLocal sicklistLocal = s.get(i);
if (sicklistLocal.isClosed()){
mapSickList.put(sicklistLocal.getSerial(), sicklistLocal);
list.add(sicklistLocal.getSerial());
}
}
if (!mapSickList.isEmpty()){
cbContinue.setModel(new DefaultComboBoxModel(list.toArray()));
} else {
typeContinueListRadio.setEnabled(false);
}
for (int i = 2; i <= 30; i++) {
Integer i2 = new Integer(i);
daysCombo.addItem(i2);
}
daysCombo.setSelectedItem(null);
MouseListener ml = new MouseListener();
typePanel.addMouseListener(ml);
collabPanel.addMouseListener(ml);
datePanel.addMouseListener(ml);
diagnosisPanel.addMouseListener(ml);
directionPanel.addMouseListener(ml);
serialNumber.getDocument().addDocumentListener(new CheckableDocListener(serialNumber, FormatChecker.SICK_LIST_SERIAL) {
@Override
public void setField(String doc) {
updateSummaryText();
}
});
closedSerialNumber.getDocument().addDocumentListener(new CheckableDocListener(closedSerialNumber, FormatChecker.SICK_LIST_SERIAL) {
@Override
public void setField(String doc) {
updateSummaryText();
}
});
DocumentListener dl = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
updateSummaryText();
}
@Override
public void removeUpdate(DocumentEvent e) {
updateSummaryText();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateSummaryText();
}
};
tfAltLpu.getDocument().addDocumentListener(dl);
tfAltCollaborator.getDocument().addDocumentListener(dl);
description.getDocument().addDocumentListener(dl);
tfOtherDirection.getDocument().addDocumentListener(dl);
daysCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//Смена количества дней - пересчет конечной даты соответственно дням
System.out.println("Попытка изменить количество дней");
Date from = otherDate.getDate();
Calendar gc = Calendar.getInstance();
gc.setTime(from);
Integer selectedItem = (Integer) daysCombo.getSelectedItem();
if (selectedItem != null) {
gc.add(Calendar.DAY_OF_YEAR, selectedItem - 1);
if (DCDateTill.getDate() == null || DateTimeUtils.daysBetween(DCDateTill.getDate(), gc.getTime()) != 0) {
DCDateTill.setCalendar(gc);
updateSummaryText();
}
}
}
});
otherDate.addDateListener(new DateListener() {
@Override
public void dateChanged(DateEvent evt) {
System.out.println("Попытка изменить Начальную дату");
Date from = evt.getNewValue();
if (DateTimeUtils.daysBetween(today.getTime(), from) == 0) {
dateTodayRadio.setSelected(true);
} else {
dateOtherRadio.setSelected(true);
}
Calendar gc = Calendar.getInstance();
gc.setTime(from);
Integer selectedItem = (Integer) daysCombo.getSelectedItem();
if (selectedItem != null) {
gc.add(Calendar.DAY_OF_YEAR, selectedItem - 1);
if (DateTimeUtils.daysBetween(DCDateTill.getDate(), gc.getTime()) != 0) {
DCDateTill.setCalendar(gc);
updateSummaryText();
}
}
}
});
DCDateTill.addDateListener(new DateListener() {
@Override
public void dateChanged(DateEvent evt) {
//Смена конечной даты - пересчет количества дней (конечная - начальная)
System.out.println("Попытка изменить конечную дату");
Date to = evt.getNewValue();
Date from = otherDate.getDate();
Integer daysBetween = new Integer((int)DateTimeUtils.daysBetween(from, to)) + 1;
if (daysBetween <= 0) {
MessageBox.showWarning("Дата окончания должна быть больше даты начала");
DCDateTill.setDate(evt.getOldValue());
} else if (daysCombo.getSelectedItem() == null || !daysCombo.getSelectedItem().equals(daysBetween)) {
if (daysBetween > 30) {
MessageBox.showWarning("Срок продления составляет " + daysBetween + " суток");
}
daysCombo.setEditable(true);
daysCombo.setSelectedItem(daysBetween);
daysCombo.setEditable(false);
updateSummaryText();
}
}
});
//center dialog
Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle dlgSize = this.getBounds();
this.setLocation((scrSize.width - dlgSize.width) / 2, (scrSize.height - dlgSize.height) / 2);
initCollaboratorPage();
initDirectionPage();
initDiagnosisPage();
updateSummaryText();
StateSaver.attachTo(this);
}
/**
* Возвращает созданный и сохраненный больничный лист.
* @return
*/
public SicklistLocal getSicklist() {
return sicklist;
}
/**
* Заполняет комбо с сотрудниками
* @throws cli_fmw.delegate.exception.ClipsException
*/
private void initCollaboratorPage() throws ClipsException {
DirectoryCollaboratorItem coll = UserInfo.get().getCollaborator();
currentCollaborator.setText(coll.getTitle());
spCollaboratorSellect.setSelectedCollaborator(coll);
}
/**
*
* @throws cli_fmw.delegate.exception.ClipsException
*/
private void initDirectionPage() throws ClipsException {
//заполнить комбо с работами
int count = 0;
directionCombo.removeAllItems();
List jobs = clientLocal.getJobList();
for (int i = 0; i < jobs.size(); i++) {
JobLocal job = (JobLocal) jobs.get(i);
if (!job.isFired()) {
DirectoryEnterpriseItem item = job.getEnterprise();
EnterpriseInfo entInfo = new EnterpriseInfo(item);
directionCombo.addItem(entInfo);
count++;
}
}
if (count == 0) {
directionCombo.setEnabled(false);
directionWorkRadio.setEnabled(false);
directionOtherRadio.setSelected(true);
tfOtherDirection.setEnabled(true);
}
}
/**
*
* @param item
* @throws cli_fmw.delegate.exception.ClipsException
*/
private void initDiagnosisPage() throws ClipsException {
disabilityCombo.removeAllItems();
DirectoryDisabilityType directoryDisab = DirectoryLocator.getDirectory(DirectoryDisabilityType.class);
SelectorEditableExceptional<DirectoryDisabilityTypeItem> ii = directoryDisab.getItems();
for (int i = 0; i < ii.size(); i++) {
disabilityCombo.addItem(ii.get(i));
}
disabilityCombo.setSelectedItem(directoryDisab.getItemFromID(0));
}
/**
* Обновляет текст
* @return true если нет ошибок
* @throws cli_fmw.delegate.exception.ClipsException
*/
private boolean updateSummaryText() {
boolean ok = true;
String txt = new String("<html>");
String undefined = new String("<span color=red>НЕ УКАЗАНО!</span>");
if (typeOpenedListRadio.isSelected()) {
txt += "<h3><u>Регистрация открытого больничного листа</u></h3>";
String serial = serialNumber.getText().trim();
if (FormatChecker.checkSickList(serial) != null) {
serial = "";
}
txt += "<p><u>Серийный номер:</u>" + (serial.length() > 0 ? serial : undefined) + "</p>";
if (serial.length() == 0) {
ok = false;
}
} else if (typeClosedListRadio.isSelected()) {
txt += "<h3><u>Регистрация ЗАКРЫТОГО больничного листа</u></h3>";
String serial = closedSerialNumber.getText().trim();
if (FormatChecker.checkSickList(serial) != null) {
serial = "";
}
txt += "<p><u>Серийный номер:</u>" + (serial.length() > 0 ? serial : undefined) + "</p>";
if (serial.length() == 0) {
ok = false;
}
} else {
txt += "<h3><u>Открытие больничного листа</u></h3>";
}
String fio = null;
fio = clientLocal.getFIO();
txt += "<p><u>Пациент:</u>" + (fio != null ? fio : undefined) + "</p>";
txt += "<p><u>ТАП: </u>";
if (serren != null) {
txt += serren.toString() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
txt += "<p><u>Диагноз открытия: </u>";
if (diagOpenModel.getSelectedDiagnosis() != null) {
try {
txt += diagOpenModel.getSelectedDiagnosis().getMkbAndStage() + "</p>";
} catch (ClipsException ex) {
MessageBox.showException(ex);
txt += "</p>";
}
} else {
txt += undefined + "</p>";
ok = false;
}
if (typeClosedListRadio.isSelected()){
txt += "<p><u>Диагноз закрытия: </u>";
if (diagCloseModel.getSelectedDiagnosis() != null) {
try {
txt += diagCloseModel.getSelectedDiagnosis().getMkbAndStage();
}
catch (ClipsException ex) {
MessageBox.showException(ex);
}
txt += "</p>";
}
else {
txt += undefined + "</p>";
ok = false;
}
}
txt += "<p><u>Тип нетрудоспособности: </u>";
DirectoryDisabilityTypeItem disType = null;
if (disabilityCombo.getSelectedIndex() >= 0) {
disType = (DirectoryDisabilityTypeItem) disabilityCombo.getSelectedItem();
}
if (disType != null && disType.getID() != 0) {
txt += disType.toString() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
txt += "<p><u>Дата открытия: </u>";
if (dateTodayRadio.isSelected()) {
Day day = new Day(today.getTimeInMillis());
txt += day.toString() + "</p>";
} else {
Calendar cal = otherDate.getCalendar();
if (cal != null) {
Day day = new Day(cal.getTimeInMillis());
txt += day.toString() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
}
txt += "<p><u>Длительность: </u>";
Calendar cal = DCDateTill.getCalendar();
if (cal != null) {
Day day = new Day(cal.getTimeInMillis());
txt += day.toString() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
if (collaboratorClinicRadio.isSelected()) {
DirectoryCollaboratorItem coolab = spCollaboratorSellect.getSelectedItem();
if (coolab == null){
txt += "<p><u>Выдавший врач: </u>" + undefined + "</p>";
ok = false;
}
else{
txt += "<p><u>Выдан клинкой: </u>";
try {
txt += coolab.getLpu();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
txt += "<p><u>Выдавший врач: </u>" + coolab + "</p>";
}
} else {
txt += "<p><u>Выдан организацией: </u>";
String lpu = tfAltLpu.getText();
if (lpu.length() > 4) {
txt += lpu + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
txt += "<p><u>Выдавший врач: </u>";
String collab = tfAltCollaborator.getText().trim();
if (collab.length() > 4) {
txt += collab + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
}
txt += "<p><u>Направление: </u>";
if (directionWorkRadio.isSelected()) {
if (directionCombo.getSelectedItem() != null) {
Object item = directionCombo.getSelectedItem();
txt += item.toString() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
} else {
if (!tfOtherDirection.getText().equals("")) {
txt += tfOtherDirection.getText() + "</p>";
} else {
txt += undefined + "</p>";
ok = false;
}
}
summaryText.setText(txt);
return ok;
}
/**
*
*/
class MouseListener implements java.awt.event.MouseListener {
Color savedColor = Color.getColor("TitledBorder.foreground");
@Override
public void mouseClicked(MouseEvent arg0) {
}
@Override
public void mousePressed(MouseEvent arg0) {
}
@Override
public void mouseReleased(MouseEvent arg0) {
}
@Override
public void mouseEntered(MouseEvent evt) {
JPanel panel = (JPanel) evt.getSource();
TitledBorder border = (TitledBorder) panel.getBorder();
border.setTitleColor(Color.BLUE);
repaint();
}
@Override
public void mouseExited(MouseEvent evt) {
JPanel panel = (JPanel) evt.getSource();
TitledBorder border = (TitledBorder) panel.getBorder();
Point pt = evt.getPoint();
if (!panel.contains(pt)) {
border.setTitleColor(savedColor);
}
repaint();
}
}
class EnterpriseInfo {
DirectoryEnterpriseItem item;
EnterpriseInfo(DirectoryEnterpriseItem item) {
this.item = item;
}
@Override
public String toString() {
try {
return item.getFullTitle(false);
} catch (ClipsException ex) {
return "Error occured";
}
}
public DirectoryEnterpriseItem get() {
return item;
}
}
void setMode(Mode mode){
if (Mode.registerClosed == mode || Mode.registerOther == mode){
collaboratorOtherRadio.setSelected(true);
}else{
collaboratorClinicRadio.setSelected(true);
}
if (mode == Mode.registerClosed){
pnDiagGridPanel.add(pnDiagClosePanel, 1);
}else{
pnDiagGridPanel.remove(pnDiagClosePanel);
}
diagnosisPanel.revalidate();
updateSummaryText();
}
/** 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() {
buttonGroupType = new javax.swing.ButtonGroup();
pnDiagClosePanel = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
cbDiagClose = new javax.swing.JComboBox();
buttonGroupDate = new javax.swing.ButtonGroup();
buttonGroupDirection = new javax.swing.ButtonGroup();
buttonGroupCollaborator = new javax.swing.ButtonGroup();
clientPanel = new javax.swing.JPanel();
summaryText = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
buttonsPanel = new javax.swing.JPanel();
createBtn = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jTabbedPane1 = new javax.swing.JTabbedPane();
typePanel = new javax.swing.JPanel();
typeNewListRadio = new javax.swing.JRadioButton();
typeOpenedListRadio = new javax.swing.JRadioButton();
serialNumber = new javax.swing.JTextField();
typeClosedListRadio = new javax.swing.JRadioButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
closedSerialNumber = new javax.swing.JTextField();
typeContinueListRadio = new javax.swing.JRadioButton();
jLabel3 = new javax.swing.JLabel();
cbContinue = new javax.swing.JComboBox();
diagnosisPanel = new javax.swing.JPanel();
pnDiagGridPanel = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
cbDiagOpen = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
disabilityCombo = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel13 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
description = new javax.swing.JTextArea();
datePanel = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
dateTodayRadio = new javax.swing.JRadioButton();
dateOtherRadio = new javax.swing.JRadioButton();
otherDate = new org.infotechservice.ICalendar.components.ICDateChooser();
jLabel10 = new javax.swing.JLabel();
panelDateTill = new javax.swing.JPanel();
panelWest = new javax.swing.JPanel();
jLabel12 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
PanelCenter = new javax.swing.JPanel();
daysCombo = new javax.swing.JComboBox();
DCDateTill = new org.infotechservice.ICalendar.components.ICDateChooser();
collabPanel = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
collaboratorClinicRadio = new javax.swing.JRadioButton();
collaboratorOtherRadio = new javax.swing.JRadioButton();
tfAltCollaborator = new javax.swing.JTextField();
currentCollaborator = new javax.swing.JTextField();
jLabel14 = new javax.swing.JLabel();
spCollaboratorSellect = new clips.accountant.PanelCollaboratorSelect();
jLabel15 = new javax.swing.JLabel();
tfAltLpu = new javax.swing.JTextField();
directionPanel = new javax.swing.JPanel();
directionOtherRadio = new javax.swing.JRadioButton();
directionWorkRadio = new javax.swing.JRadioButton();
directionCombo = new javax.swing.JComboBox();
tfOtherDirection = new javax.swing.JTextField();
pnDiagClosePanel.setLayout(new java.awt.BorderLayout());
jLabel7.setText("Диагноз закрытия");
pnDiagClosePanel.add(jLabel7, java.awt.BorderLayout.PAGE_START);
cbDiagClose.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
cbDiagClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbDiagCloseActionPerformed(evt);
}
});
pnDiagClosePanel.add(cbDiagClose, java.awt.BorderLayout.CENTER);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Открытие больничого листа");
clientPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
summaryText.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
javax.swing.GroupLayout clientPanelLayout = new javax.swing.GroupLayout(clientPanel);
clientPanel.setLayout(clientPanelLayout);
clientPanelLayout.setHorizontalGroup(
clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(summaryText, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
);
clientPanelLayout.setVerticalGroup(
clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(clientPanelLayout.createSequentialGroup()
.addComponent(summaryText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(555, 555, 555))
);
getContentPane().add(clientPanel, java.awt.BorderLayout.WEST);
jPanel1.setLayout(new java.awt.BorderLayout());
createBtn.setText("Создать новый больничный лист");
createBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
createBtnActionPerformed(evt);
}
});
buttonsPanel.add(createBtn);
jButton1.setText("Отмена");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
buttonsPanel.add(jButton1);
jPanel1.add(buttonsPanel, java.awt.BorderLayout.SOUTH);
typePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Тип больничного листа", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 1, 14))); // NOI18N
buttonGroupType.add(typeNewListRadio);
typeNewListRadio.setSelected(true);
typeNewListRadio.setText("Новый больничный лист");
typeNewListRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
typeNewListRadioActionPerformed(evt);
}
});
buttonGroupType.add(typeOpenedListRadio);
typeOpenedListRadio.setText("Открытый больничный лист из другой клиники");
typeOpenedListRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
typeOpenedListRadioActionPerformed(evt);
}
});
serialNumber.setEnabled(false);
buttonGroupType.add(typeClosedListRadio);
typeClosedListRadio.setText("Закрытый больничный лист из другой клиники");
typeClosedListRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
typeClosedListRadioActionPerformed(evt);
}
});
jLabel1.setText("Номер");
jLabel2.setText("Номер");
closedSerialNumber.setEnabled(false);
buttonGroupType.add(typeContinueListRadio);
typeContinueListRadio.setText("Продолжение больничного листа");
typeContinueListRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
typeContinueListRadioActionPerformed(evt);
}
});
jLabel3.setText("Номер предыдущего");
cbContinue.setEnabled(false);
cbContinue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbContinueActionPerformed(evt);
}
});
javax.swing.GroupLayout typePanelLayout = new javax.swing.GroupLayout(typePanel);
typePanel.setLayout(typePanelLayout);
typePanelLayout.setHorizontalGroup(
typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(typePanelLayout.createSequentialGroup()
.addGroup(typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(typePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(typeNewListRadio)
.addComponent(typeOpenedListRadio)
.addGroup(typePanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbContinue, 0, 405, Short.MAX_VALUE))
.addComponent(typeContinueListRadio)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, typePanelLayout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(serialNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
.addGroup(typePanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(typeClosedListRadio))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, typePanelLayout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(closedSerialNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)))
.addContainerGap())
);
typePanelLayout.setVerticalGroup(
typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(typePanelLayout.createSequentialGroup()
.addComponent(typeNewListRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(typeContinueListRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(cbContinue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(typeOpenedListRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(serialNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(typeClosedListRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(typePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(closedSerialNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(180, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Больничный лист", typePanel);
diagnosisPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Диагноз", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 1, 14))); // NOI18N
diagnosisPanel.setLayout(new java.awt.BorderLayout());
pnDiagGridPanel.setLayout(new java.awt.GridLayout(0, 1));
jPanel2.setLayout(new java.awt.BorderLayout());
cbDiagOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbDiagOpenActionPerformed(evt);
}
});
jPanel2.add(cbDiagOpen, java.awt.BorderLayout.CENTER);
jLabel6.setText("Диагноз открытия");
jPanel2.add(jLabel6, java.awt.BorderLayout.NORTH);
pnDiagGridPanel.add(jPanel2);
jPanel3.setLayout(new java.awt.BorderLayout());
disabilityCombo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
disabilityComboActionPerformed(evt);
}
});
jPanel3.add(disabilityCombo, java.awt.BorderLayout.CENTER);
jLabel8.setText("Вид нетрудоспособности");
jPanel3.add(jLabel8, java.awt.BorderLayout.PAGE_START);
pnDiagGridPanel.add(jPanel3);
diagnosisPanel.add(pnDiagGridPanel, java.awt.BorderLayout.PAGE_START);
jPanel4.setLayout(new java.awt.BorderLayout());
jLabel13.setText("Примечания");
jPanel4.add(jLabel13, java.awt.BorderLayout.PAGE_START);
description.setColumns(20);
description.setLineWrap(true);
description.setRows(5);
jScrollPane1.setViewportView(description);
jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);
diagnosisPanel.add(jPanel4, java.awt.BorderLayout.CENTER);
jTabbedPane1.addTab("Диагноз", diagnosisPanel);
datePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Освобождение от нетрудоспособности", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 1, 14))); // NOI18N
jLabel9.setText("С какого числа");
buttonGroupDate.add(dateTodayRadio);
dateTodayRadio.setSelected(true);
dateTodayRadio.setText("сегодняшнее число");
dateTodayRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dateTodayRadioActionPerformed(evt);
}
});
buttonGroupDate.add(dateOtherRadio);
dateOtherRadio.setText("другая дата");
dateOtherRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dateOtherRadioActionPerformed(evt);
}
});
otherDate.setEnabled(false);
jLabel10.setText("По какое число включительно");
panelDateTill.setLayout(new java.awt.BorderLayout(5, 0));
panelWest.setLayout(new java.awt.GridLayout(2, 1, 0, 5));
jLabel12.setText("Дни");
panelWest.add(jLabel12);
jLabel11.setText("Дата");
panelWest.add(jLabel11);
panelDateTill.add(panelWest, java.awt.BorderLayout.WEST);
PanelCenter.setLayout(new java.awt.GridLayout(2, 0, 0, 5));
PanelCenter.add(daysCombo);
PanelCenter.add(DCDateTill);
panelDateTill.add(PanelCenter, java.awt.BorderLayout.CENTER);
javax.swing.GroupLayout datePanelLayout = new javax.swing.GroupLayout(datePanel);
datePanel.setLayout(datePanelLayout);
datePanelLayout.setHorizontalGroup(
datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(datePanelLayout.createSequentialGroup()
.addGroup(datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(datePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(datePanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addGroup(datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(dateTodayRadio)
.addComponent(dateOtherRadio)))
.addComponent(jLabel9)))
.addGroup(datePanelLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(otherDate, javax.swing.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE))
.addGroup(datePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(datePanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(panelDateTill, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
.addComponent(jLabel10))))
.addContainerGap())
);
datePanelLayout.setVerticalGroup(
datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(datePanelLayout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(dateTodayRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(dateOtherRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(otherDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelDateTill, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(197, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Даты", datePanel);
collabPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Специалист", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 1, 14))); // NOI18N
jLabel4.setText("Создавший больничный лист");
jLabel5.setText("Открывший больничный лист");
buttonGroupCollaborator.add(collaboratorClinicRadio);
collaboratorClinicRadio.setSelected(true);
collaboratorClinicRadio.setText("специалист клиники региона");
collaboratorClinicRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
collaboratorClinicRadioActionPerformed(evt);
}
});
buttonGroupCollaborator.add(collaboratorOtherRadio);
collaboratorOtherRadio.setText("специалист другой организации");
collaboratorOtherRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
collaboratorOtherRadioActionPerformed(evt);
}
});
tfAltCollaborator.setEnabled(false);
tfAltCollaborator.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfAltCollaboratorActionPerformed(evt);
}
});
currentCollaborator.setEditable(false);
jLabel14.setText("ФИО специалиста");
jLabel15.setText("Название клиники");
tfAltLpu.setEnabled(false);
javax.swing.GroupLayout collabPanelLayout = new javax.swing.GroupLayout(collabPanel);
collabPanel.setLayout(collabPanelLayout);
collabPanelLayout.setHorizontalGroup(
collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(collabPanelLayout.createSequentialGroup()
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(collabPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(collabPanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(currentCollaborator, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
.addComponent(jLabel4)
.addComponent(jLabel5)
.addGroup(collabPanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, collabPanelLayout.createSequentialGroup()
.addComponent(collaboratorOtherRadio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(314, 314, 314))
.addGroup(collabPanelLayout.createSequentialGroup()
.addComponent(collaboratorClinicRadio)
.addGap(317, 317, 317))
.addComponent(spCollaboratorSellect, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 515, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(collabPanelLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(collabPanelLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel14))
.addComponent(jLabel15))
.addGap(5, 5, 5)
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfAltLpu, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
.addComponent(tfAltCollaborator, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE))))
.addContainerGap())
);
collabPanelLayout.setVerticalGroup(
collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(collabPanelLayout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentCollaborator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(collaboratorClinicRadio)
.addGap(9, 9, 9)
.addComponent(spCollaboratorSellect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(collaboratorOtherRadio)
.addGap(6, 6, 6)
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel15)
.addComponent(tfAltLpu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(collabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(tfAltCollaborator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(154, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Специалист", collabPanel);
directionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Направление", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 1, 14))); // NOI18N
buttonGroupDirection.add(directionOtherRadio);
directionOtherRadio.setText("другое:");
directionOtherRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
directionOtherRadioActionPerformed(evt);
}
});
buttonGroupDirection.add(directionWorkRadio);
directionWorkRadio.setSelected(true);
directionWorkRadio.setText("по месту работы");
directionWorkRadio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
directionWorkRadioActionPerformed(evt);
}
});
directionCombo.setEnabled(false);
tfOtherDirection.setEnabled(false);
javax.swing.GroupLayout directionPanelLayout = new javax.swing.GroupLayout(directionPanel);
directionPanel.setLayout(directionPanelLayout);
directionPanelLayout.setHorizontalGroup(
directionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, directionPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(directionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(tfOtherDirection, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
.addComponent(directionOtherRadio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(directionWorkRadio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, directionPanelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(directionCombo, 0, 527, Short.MAX_VALUE)))
.addContainerGap())
);
directionPanelLayout.setVerticalGroup(
directionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(directionPanelLayout.createSequentialGroup()
.addComponent(directionWorkRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(directionCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addComponent(directionOtherRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfOtherDirection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(265, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Направление", directionPanel);
jPanel1.add(jTabbedPane1, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
private void createBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createBtnActionPerformed
try {
if (!updateSummaryText()) {
MessageBox.showWarning(MessageBox.W_NEED_TO_SET_FIELDS);
} else {
if (sicklist != null) {
throw new ClipsException("Больничный лист уже создан");
}
sicklist = new SicklistLocal(clientLocal);
//main page
if (typeOpenedListRadio.isSelected()) {
sicklist.setSerial(serialNumber.getText());
sicklist.setRegistrator(UserInfo.get().getCollaborator());
}
else if (typeClosedListRadio.isSelected()) {
sicklist.setSerial(closedSerialNumber.getText());
sicklist.setRegistrator(UserInfo.get().getCollaborator());
sicklist.setCloser(UserInfo.get().getCollaborator());
Calendar calendar = DCDateTill.getCalendar();
calendar.add(Calendar.DAY_OF_YEAR, 1);
sicklist.setDateToWork(calendar);
sicklist.setDiagnosisClose(diagCloseModel.getSelectedDiagnosis());
}
else if (typeContinueListRadio.isSelected()){
sicklist.setPreviousSicklist(mapSickList.get(cbContinue.getSelectedItem()));
}
//date page
sicklist.setDateOpen(otherDate.getCalendar());
//collaborator page
if (collaboratorClinicRadio.isSelected()) {
sicklist.setOpener(spCollaboratorSellect.getSelectedItem());
} else {
sicklist.setAltLpu(tfAltLpu.getText());
sicklist.setAltOpener(tfAltCollaborator.getText());
}
//page direction
if (directionWorkRadio.isSelected()) {
Object selObj = directionCombo.getSelectedItem();
if (selObj == null || !(selObj instanceof EnterpriseInfo)) {
throw new ClipsException("Не выбрано направление по месту работы.");
}
EnterpriseInfo entInfo = (DialogSicklistCreate.EnterpriseInfo) selObj;
sicklist.setEnterprise(entInfo.get());
} else {
sicklist.setOtherDirection(tfOtherDirection.getText());
}
//page duration
Calendar cal = DCDateTill.getCalendar();
if (cal == null) {
throw new ClipsException("Не выбрана дата окончания больничного");
}
sicklist.prolongate(cal, serren);
//diagnosis page
sicklist.setDisability((DirectoryDisabilityTypeItem) disabilityCombo.getSelectedItem());
sicklist.setDiagnosisOpen(diagOpenModel.getSelectedDiagnosis());
//description
sicklist.setDescription(description.getText());
sicklist.save1();
setDlgResult(DLG_OK);
dispose();
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
sicklist = null;
}
}//GEN-LAST:event_createBtnActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
setDlgResult(DLG_CANCEL);
dispose();
}//GEN-LAST:event_jButton1ActionPerformed
private void typeContinueListRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeContinueListRadioActionPerformed
disableControls();
try {
dateOtherRadio.setSelected(true);
SicklistLocal oldSll = mapSickList.get(cbContinue.getSelectedItem());
Calendar dateTill = (Calendar) oldSll.getDateToWork().clone();
otherDate.setCalendar(dateTill);
setMode(Mode.continueExist);
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
cbContinue.setEnabled(true);
}//GEN-LAST:event_typeContinueListRadioActionPerformed
private void cbContinueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbContinueActionPerformed
try {
if (dateOtherRadio.isSelected() ) {
SicklistLocal oldSll = mapSickList.get(cbContinue.getSelectedItem());
Calendar dateClose = (Calendar) oldSll.getDateToWork().clone();
otherDate.setCalendar(dateClose);
}
updateSummaryText();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}//GEN-LAST:event_cbContinueActionPerformed
private void dateTodayRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateTodayRadioActionPerformed
otherDate.setEnabled(false);
try {
Date date = TimeLocal.getCurrentTime().getTime();
otherDate.setDate(date);
updateSummaryText();
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}//GEN-LAST:event_dateTodayRadioActionPerformed
private void typeNewListRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeNewListRadioActionPerformed
disableControls();
setMode(Mode.newSicklist);
}//GEN-LAST:event_typeNewListRadioActionPerformed
private void typeOpenedListRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeOpenedListRadioActionPerformed
disableControls();
setMode(Mode.registerOther);
serialNumber.setEnabled(true);
}//GEN-LAST:event_typeOpenedListRadioActionPerformed
private void typeClosedListRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeClosedListRadioActionPerformed
disableControls();
setMode(Mode.registerClosed);
closedSerialNumber.setEnabled(true);
}//GEN-LAST:event_typeClosedListRadioActionPerformed
private void disabilityComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disabilityComboActionPerformed
updateSummaryText();
}//GEN-LAST:event_disabilityComboActionPerformed
private void cbDiagOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDiagOpenActionPerformed
updateSummaryText();
}//GEN-LAST:event_cbDiagOpenActionPerformed
private void cbDiagCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDiagCloseActionPerformed
updateSummaryText();
}//GEN-LAST:event_cbDiagCloseActionPerformed
private void collaboratorOtherRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_collaboratorOtherRadioActionPerformed
updateSummaryText();
spCollaboratorSellect.setEnabled(false);
tfAltLpu.setEnabled(true);
tfAltCollaborator.setEnabled(true);
}//GEN-LAST:event_collaboratorOtherRadioActionPerformed
private void collaboratorClinicRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_collaboratorClinicRadioActionPerformed
updateSummaryText();
spCollaboratorSellect.setEnabled(true);
tfAltLpu.setEnabled(false);
tfAltCollaborator.setEnabled(false);
}//GEN-LAST:event_collaboratorClinicRadioActionPerformed
private void tfAltCollaboratorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfAltCollaboratorActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_tfAltCollaboratorActionPerformed
private void dateOtherRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateOtherRadioActionPerformed
otherDate.setEnabled(true);
}//GEN-LAST:event_dateOtherRadioActionPerformed
private void directionWorkRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directionWorkRadioActionPerformed
directionCombo.setEnabled(true);
tfOtherDirection.setEnabled(false);
}//GEN-LAST:event_directionWorkRadioActionPerformed
private void directionOtherRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directionOtherRadioActionPerformed
directionCombo.setEnabled(false);
tfOtherDirection.setEnabled(true);
}//GEN-LAST:event_directionOtherRadioActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.infotechservice.ICalendar.components.ICDateChooser DCDateTill;
private javax.swing.JPanel PanelCenter;
private javax.swing.ButtonGroup buttonGroupCollaborator;
private javax.swing.ButtonGroup buttonGroupDate;
private javax.swing.ButtonGroup buttonGroupDirection;
private javax.swing.ButtonGroup buttonGroupType;
private javax.swing.JPanel buttonsPanel;
private javax.swing.JComboBox cbContinue;
private javax.swing.JComboBox cbDiagClose;
private javax.swing.JComboBox cbDiagOpen;
private javax.swing.JPanel clientPanel;
private javax.swing.JTextField closedSerialNumber;
private javax.swing.JPanel collabPanel;
private javax.swing.JRadioButton collaboratorClinicRadio;
private javax.swing.JRadioButton collaboratorOtherRadio;
private javax.swing.JButton createBtn;
private javax.swing.JTextField currentCollaborator;
private javax.swing.JRadioButton dateOtherRadio;
private javax.swing.JPanel datePanel;
private javax.swing.JRadioButton dateTodayRadio;
private javax.swing.JComboBox daysCombo;
private javax.swing.JTextArea description;
private javax.swing.JPanel diagnosisPanel;
private javax.swing.JComboBox directionCombo;
private javax.swing.JRadioButton directionOtherRadio;
private javax.swing.JPanel directionPanel;
private javax.swing.JRadioButton directionWorkRadio;
private javax.swing.JComboBox disabilityCombo;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private org.infotechservice.ICalendar.components.ICDateChooser otherDate;
private javax.swing.JPanel panelDateTill;
private javax.swing.JPanel panelWest;
private javax.swing.JPanel pnDiagClosePanel;
private javax.swing.JPanel pnDiagGridPanel;
private javax.swing.JTextField serialNumber;
private clips.accountant.PanelCollaboratorSelect spCollaboratorSellect;
private javax.swing.JLabel summaryText;
private javax.swing.JTextField tfAltCollaborator;
private javax.swing.JTextField tfAltLpu;
private javax.swing.JTextField tfOtherDirection;
private javax.swing.JRadioButton typeClosedListRadio;
private javax.swing.JRadioButton typeContinueListRadio;
private javax.swing.JRadioButton typeNewListRadio;
private javax.swing.JRadioButton typeOpenedListRadio;
private javax.swing.JPanel typePanel;
// End of variables declaration//GEN-END:variables
}