Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.claim.ui; import com.claim.controller.LogAppController; import com.claim.controller.OpType5Controller; import com.claim.dao.OpType5DAO; import com.claim.dao.UtilDao; import com.claim.object.HospitalService; import com.claim.object.OppReport; import com.claim.object.Stmp; import com.claim.support.FunctionUtil; import com.claim.constants.ConstantMessage; import com.claim.support.NetUtils; import com.claim.object.ProgrameStatus; import com.claim.dialog.DialogWaitProcess; import com.claim.support.CollectionUtil; import com.claim.support.FileUtil; import java.io.File; import java.net.UnknownHostException; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import org.apache.commons.collections.CollectionUtils; /** * * @author Poolsawat.a */ public class UiReportType5 extends javax.swing.JInternalFrame { /** * Creates new form UiReportType5 */ public static int PROCESS = 0; OpType5Controller type5Controller; List<HospitalService> listSelectHospital = null; List<Stmp> listStmpType5 = null; FunctionUtil baseFunction; public UiReportType5() { initComponents(); type5Controller = new OpType5Controller(); listSelectHospital = new ArrayList<HospitalService>(); listStmpType5 = new ArrayList<Stmp>(); baseFunction = new FunctionUtil(); this.loadCombo(); PROCESS = 1; } /** * 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. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { rGroupType5Type = new javax.swing.ButtonGroup(); rGroupType5Hospital = new javax.swing.ButtonGroup(); rGroupType5Attribute = new javax.swing.ButtonGroup(); rGroupTypeForUse = new javax.swing.ButtonGroup(); tabOpType5 = new javax.swing.JPanel(); jPanel14 = new javax.swing.JPanel(); jPanel15 = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); comboYearType5 = new javax.swing.JComboBox(); jLabel13 = new javax.swing.JLabel(); comboNumType5 = new javax.swing.JComboBox(); jPanel16 = new javax.swing.JPanel(); radioDetailType5 = new javax.swing.JRadioButton(); radioSumType5 = new javax.swing.JRadioButton(); jPanel17 = new javax.swing.JPanel(); radioAllHospitalType5 = new javax.swing.JRadioButton(); radioSingleHospitalType5 = new javax.swing.JRadioButton(); btnType5ChooseHospital = new javax.swing.JButton(); jScrollPane9 = new javax.swing.JScrollPane(); txtHnameType5 = new javax.swing.JTextArea(); jPanel18 = new javax.swing.JPanel(); jButtonFolder3 = new javax.swing.JButton(); txtPathFileType5 = new javax.swing.JTextField(); btnType5PathFileDesktop = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); radioTopic197 = new javax.swing.JRadioButton(); radioTopicHighcost = new javax.swing.JRadioButton(); jPanel33 = new javax.swing.JPanel(); txtTitleTimeType5 = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); btnType5GenReportAllFunction = new javax.swing.JButton(); btn197GenReport = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); radioForUse_Genaral = new javax.swing.JRadioButton(); radioForUse_Website = new javax.swing.JRadioButton(); jPanel13 = new javax.swing.JPanel(); comboLookupYear = new javax.swing.JComboBox(); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("? Type5"); setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/com/claim/util/images/Excel-icon.png"))); // NOI18N setPreferredSize(new java.awt.Dimension(1200, 550)); addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { formInternalFrameClosed(evt); } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { } }); tabOpType5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "?", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jLabel12.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N jLabel12.setText(""); comboYearType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N comboYearType5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { comboYearType5ItemStateChanged(evt); } }); jLabel13.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N jLabel13.setText(""); comboNumType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N comboNumType5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { comboNumType5ItemStateChanged(evt); } }); javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout .setHorizontalGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addGap(24, 24, 24) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(comboYearType5, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(comboNumType5, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel15Layout.setVerticalGroup(jPanel15Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap().addGroup(jPanel15Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel12) .addComponent(comboYearType5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13).addComponent(comboNumType5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "?", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N rGroupType5Type.add(radioDetailType5); radioDetailType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioDetailType5.setSelected(true); radioDetailType5.setText("?"); rGroupType5Type.add(radioSumType5); radioSumType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioSumType5.setText("?"); radioSumType5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { radioSumType5ItemStateChanged(evt); } }); javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16); jPanel16.setLayout(jPanel16Layout); jPanel16Layout .setHorizontalGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup().addGap(22, 22, 22) .addComponent(radioDetailType5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(57, 57, 57) .addComponent(radioSumType5, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(67, 67, 67))); jPanel16Layout.setVerticalGroup(jPanel16Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup().addGap(10, 10, 10) .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(radioDetailType5).addComponent(radioSumType5)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "?", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jPanel17.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); rGroupType5Hospital.add(radioAllHospitalType5); radioAllHospitalType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioAllHospitalType5.setSelected(true); radioAllHospitalType5.setText("?"); jPanel17.add(radioAllHospitalType5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 40, -1, -1)); rGroupType5Hospital.add(radioSingleHospitalType5); radioSingleHospitalType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioSingleHospitalType5.setText("??"); radioSingleHospitalType5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { radioSingleHospitalType5ItemStateChanged(evt); } }); jPanel17.add(radioSingleHospitalType5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, -1, -1)); btnType5ChooseHospital.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N btnType5ChooseHospital.setText("?"); btnType5ChooseHospital.setEnabled(false); btnType5ChooseHospital.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnType5ChooseHospitalActionPerformed(evt); } }); jPanel17.add(btnType5ChooseHospital, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 70, -1, -1)); jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); txtHnameType5.setColumns(20); txtHnameType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N txtHnameType5.setLineWrap(true); txtHnameType5.setRows(5); txtHnameType5.setEnabled(false); jScrollPane9.setViewportView(txtHnameType5); jPanel17.add(jScrollPane9, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 20, 550, 90)); jPanel18.setBorder( javax.swing.BorderFactory.createTitledBorder(null, "?", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jButtonFolder3.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N jButtonFolder3.setText("?"); jButtonFolder3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonFolder3ActionPerformed(evt); } }); txtPathFileType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N txtPathFileType5.setEnabled(false); btnType5PathFileDesktop.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N btnType5PathFileDesktop.setText("desktop"); btnType5PathFileDesktop.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnType5PathFileDesktopActionPerformed(evt); } }); javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18); jPanel18.setLayout(jPanel18Layout); jPanel18Layout.setHorizontalGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup().addContainerGap() .addComponent(btnType5PathFileDesktop) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonFolder3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtPathFileType5, javax.swing.GroupLayout.PREFERRED_SIZE, 720, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(70, 70, 70))); jPanel18Layout.setVerticalGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup().addGap(20, 20, 20).addGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonFolder3) .addComponent(txtPathFileType5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnType5PathFileDesktop)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "??", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N rGroupType5Attribute.add(radioTopic197); radioTopic197.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioTopic197.setSelected(true); radioTopic197.setText("197 ?"); rGroupType5Attribute.add(radioTopicHighcost); radioTopicHighcost.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioTopicHighcost.setText("Op High Cost"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(70, 70, 70) .addComponent(radioTopic197).addGap(42, 42, 42).addComponent(radioTopicHighcost) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(radioTopic197).addComponent(radioTopicHighcost)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel33.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "? ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N txtTitleTimeType5.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N javax.swing.GroupLayout jPanel33Layout = new javax.swing.GroupLayout(jPanel33); jPanel33.setLayout(jPanel33Layout); jPanel33Layout.setHorizontalGroup(jPanel33Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel33Layout.createSequentialGroup() .addContainerGap(31, Short.MAX_VALUE).addComponent(txtTitleTimeType5, javax.swing.GroupLayout.PREFERRED_SIZE, 813, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(41, 41, 41))); jPanel33Layout.setVerticalGroup(jPanel33Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel33Layout.createSequentialGroup() .addComponent(txtTitleTimeType5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap().addGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel33, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel18, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 897, Short.MAX_VALUE) .addComponent(jPanel17, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 897, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createSequentialGroup() .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap(13, Short.MAX_VALUE))); jPanel14Layout.setVerticalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(164, Short.MAX_VALUE))); tabOpType5.add(jPanel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 920, 620)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "??", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jPanel2.setPreferredSize(new java.awt.Dimension(215, 445)); btnType5GenReportAllFunction.setBackground(new java.awt.Color(255, 204, 0)); btnType5GenReportAllFunction.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N btnType5GenReportAllFunction.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/claim/util/images/Print-icon.png"))); // NOI18N btnType5GenReportAllFunction .setText("<html>??<br />+ Website</html>"); btnType5GenReportAllFunction.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnType5GenReportAllFunctionActionPerformed(evt); } }); btn197GenReport.setBackground(new java.awt.Color(153, 153, 255)); btn197GenReport.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N btn197GenReport.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/claim/util/images/Print-icon.png"))); // NOI18N btn197GenReport.setText("?"); btn197GenReport.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn197GenReportActionPerformed(evt); } }); jPanel3.setBackground(new java.awt.Color(255, 255, 204)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N rGroupTypeForUse.add(radioForUse_Genaral); radioForUse_Genaral.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioForUse_Genaral.setSelected(true); radioForUse_Genaral.setText(""); rGroupTypeForUse.add(radioForUse_Website); radioForUse_Website.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N radioForUse_Website.setText(" web site"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(radioForUse_Genaral).addComponent(radioForUse_Website)) .addContainerGap(33, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(radioForUse_Genaral) .addGap(18, 18, 18).addComponent(radioForUse_Website) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel13.setBackground(new java.awt.Color(255, 255, 204)); jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "??", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N comboLookupYear.setFont(new java.awt.Font("TH SarabunPSK", 1, 20)); // NOI18N comboLookupYear.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "?", "2015", "2014", "2013", "2012", "2011", "2010" })); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addGap(20, 20, 20) .addComponent(comboLookupYear, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel13Layout.setVerticalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap() .addComponent(comboLookupYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(29, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout .setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btn197GenReport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnType5GenReportAllFunction, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(16, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(7, 7, 7) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(17, Short.MAX_VALUE)))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(30, 30, 30) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE) .addComponent(btn197GenReport, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(32, 32, 32) .addComponent(btnType5GenReportAllFunction, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(161, 161, 161) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(162, Short.MAX_VALUE)))); tabOpType5.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(930, 0, 220, -1)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(tabOpType5, javax.swing.GroupLayout.PREFERRED_SIZE, 1064, Short.MAX_VALUE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(tabOpType5, javax.swing.GroupLayout.PREFERRED_SIZE, 635, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pack(); }// </editor-fold>//GEN-END:initComponents private void comboYearType5ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboYearType5ItemStateChanged if (PROCESS == 1) { if (comboYearType5.getSelectedItem() != null && comboNumType5.getSelectedItem() != null) { txtTitleTimeType5.setText(baseFunction.getTitleTimeReport( comboYearType5.getSelectedItem().toString(), comboNumType5.getSelectedItem().toString())); } comboNumType5.removeAllItems(); comboNumType5.addItem("-"); for (Stmp stmp : listStmpType5) { if (comboYearType5.getSelectedItem().equals(stmp.getStmpYM()) && comboNumType5.getSelectedItem() != stmp.getStmpN()) { comboNumType5.addItem(stmp.getStmpN()); } } } }//GEN-LAST:event_comboYearType5ItemStateChanged private void comboNumType5ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboNumType5ItemStateChanged if (PROCESS == 1) { txtTitleTimeType5.setText(baseFunction.getTitleTimeReport(comboYearType5.getSelectedItem(), comboNumType5.getSelectedItem())); } }//GEN-LAST:event_comboNumType5ItemStateChanged private void radioSumType5ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radioSumType5ItemStateChanged if (radioSumType5.isSelected()) { radioAllHospitalType5.setSelected(true); radioSingleHospitalType5.setEnabled(false); btnType5ChooseHospital.setEnabled(false); } else { //btn74ChooseHospital.setEnabled(true); radioSingleHospitalType5.setEnabled(true); } }//GEN-LAST:event_radioSumType5ItemStateChanged private void radioSingleHospitalType5ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radioSingleHospitalType5ItemStateChanged if (radioSingleHospitalType5.isSelected()) { btnType5ChooseHospital.setEnabled(true); } else { radioSingleHospitalType5.setEnabled(true); } }//GEN-LAST:event_radioSingleHospitalType5ItemStateChanged private void btnType5ChooseHospitalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnType5ChooseHospitalActionPerformed txtHnameType5.setText(""); HashMap mapParam = new HashMap(); mapParam.put("type", "type5"); //mapParam.put("code", txtHCodeType5); mapParam.put("name", txtHnameType5); mapParam.put("listHospital", listSelectHospital); DialogService dialog = new DialogService(); dialog.DialogServiceJInternalFrame(this, true, mapParam); dialog.setVisible(true); }//GEN-LAST:event_btnType5ChooseHospitalActionPerformed private void jButtonFolder3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFolder3ActionPerformed try { JFileChooser fc = new JFileChooser(); fc.setDialogTitle("Open Folder"); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setCurrentDirectory(new File("")); int result = fc.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File a = fc.getSelectedFile(); // Path File method in this class String temp = a.getPath(); txtPathFileType5.setText("."); if (temp != null) { txtPathFileType5.setText(temp); //txtPathFileOpaeIndv.setEnabled(true); } } } catch (Exception e) { e.printStackTrace(); } }//GEN-LAST:event_jButtonFolder3ActionPerformed private void btnType5PathFileDesktopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnType5PathFileDesktopActionPerformed txtPathFileType5.setText(FileUtil.getPathDesktop()); }//GEN-LAST:event_btnType5PathFileDesktopActionPerformed private void btn197GenReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn197GenReportActionPerformed final DialogWaitProcess wait = new DialogWaitProcess(); try { if (comboYearType5.getSelectedIndex() != 0) { if (comboNumType5.getSelectedIndex() != 0) { if (radioDetailType5.isSelected() || radioSumType5.isSelected()) { if (radioTopic197.isSelected() || radioTopicHighcost.isSelected()) { if (radioAllHospitalType5.isSelected() || radioSingleHospitalType5.isSelected()) { if (radioAllHospitalType5.isSelected() || radioSingleHospitalType5.isSelected() && listSelectHospital.size() > 0) { if (!txtPathFileType5.getText().isEmpty()) { int selectOption = JOptionPane.showConfirmDialog(null, ConstantMessage.MSG_REPORT_CONFIRM, ConstantMessage.MSG_REPORT_INFOMATION, JOptionPane.YES_NO_OPTION); if (selectOption == JOptionPane.YES_OPTION) { wait.setVisible(true); Thread thread = new Thread(new Runnable() { @Override public void run() { ProgrameStatus programeStatus = new ProgrameStatus(); try { wait.setTitle(ConstantMessage.MSG_PROGRAME_PROCESSSING); if (radioDetailType5.isSelected()) { // // status = individualController.op_individual_detail_MutiSheet(setInputFormReport()); programeStatus = type5Controller .type5_detail(setInputFormReport()); if (programeStatus.getProcessStatus()) { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.INFORMATION_MESSAGE); baseFunction.openDirectoryAutomatic( setInputFormReport().getPathFile()); } else { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.ERROR_MESSAGE); } } else { // programeStatus = type5Controller .type5_summary(setInputFormReport()); if (programeStatus.getProcessStatus()) { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.INFORMATION_MESSAGE); baseFunction.openDirectoryAutomatic( setInputFormReport().getPathFile()); } else { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.ERROR_MESSAGE); } } wait.setVisible(false); } catch (Exception e) { e.printStackTrace(); } /* * 17-08-2015 */ /*try { new LogAppController().createLog("??", "?? type5 ? ?? ", NetUtils.getIpAddress(), 1); } catch (UnknownHostException ex) { Logger.getLogger(UiMainClaim.class.getName()).log(Level.SEVERE, null, ex); }*/ } }); thread.start(); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_FILE_LOCATION_PLEASE, ConstantMessage.MSG_FILE_LOCATION, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_HOSPITAL_SELECT_PLEASE, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_HOSPITAL_ATTRIBUTE, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_197_HIGTHCOST, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_REPOTR_FORMAT, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_SELECT_NO, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_SELECT_DATE_PLEASE, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { e.printStackTrace(); } }//GEN-LAST:event_btn197GenReportActionPerformed private void btnType5GenReportAllFunctionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnType5GenReportAllFunctionActionPerformed try { final DialogWaitProcess wait = new DialogWaitProcess(); if (comboYearType5.getSelectedIndex() != 0) { if (comboNumType5.getSelectedIndex() != 0) { if (radioAllHospitalType5.isSelected() || radioSingleHospitalType5.isSelected()) { if (radioAllHospitalType5.isSelected() || radioSingleHospitalType5.isSelected() && listSelectHospital.size() > 0) { if (!txtPathFileType5.getText().isEmpty()) { int selectOption = JOptionPane.showConfirmDialog(null, ConstantMessage.MSG_REPORT_CONFIRM, ConstantMessage.MSG_REPORT_INFOMATION, JOptionPane.YES_NO_OPTION); if (selectOption == JOptionPane.YES_OPTION) { wait.setVisible(true); Thread thread = new Thread(new Runnable() { @Override public void run() { ProgrameStatus programeStatus = new ProgrameStatus(); try { wait.setTitle(ConstantMessage.MSG_PROGRAME_PROCESSSING); programeStatus = type5Controller .type5_genReportAllFunction(setInputFormReport()); if (programeStatus.getProcessStatus()) { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.INFORMATION_MESSAGE); baseFunction.openDirectoryAutomatic( setInputFormReport().getPathFile()); } else { JOptionPane.showMessageDialog(UiReportType5.this, programeStatus.getMessage(), programeStatus.getTitle(), JOptionPane.ERROR_MESSAGE); } wait.setVisible(false); } catch (Exception e) { e.printStackTrace(); } /* * 17-08-2015 */ /*try { new LogAppController().createLog("??", "?? type5 ? ?? ", NetUtils.getIpAddress(), 1); } catch (UnknownHostException ex) { Logger.getLogger(UiMainClaim.class.getName()).log(Level.SEVERE, null, ex); }*/ } }); thread.start(); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_FILE_LOCATION_PLEASE, ConstantMessage.MSG_FILE_LOCATION, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_HOSPITAL_SELECT_PLEASE, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_HOSPITAL_ATTRIBUTE, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_SELECT_NO, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(this, ConstantMessage.MSG_SELECT_NO, ConstantMessage.MSG_SELECT_DATA, JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { e.printStackTrace(); } }//GEN-LAST:event_btnType5GenReportAllFunctionActionPerformed private void formInternalFrameClosed(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosed PROCESS = 0; }//GEN-LAST:event_formInternalFrameClosed public void loadCombo() { try { //Tab OpType5 //get Stmp From Table RPT_OPBKK_TYPE5 comboYearType5.removeAllItems(); comboYearType5.addItem("-"); listStmpType5 = new UtilDao().getStmpDistinct("RPT_OPBKK_TYPE5", "STMP"); List<String> listType5 = new ArrayList<String>(); for (int i = 0; i < listStmpType5.size(); i++) { listType5.add(listStmpType5.get(i).getStmpYM()); } listType5 = CollectionUtil.removeDuplicatObjectOfList(listType5); Collections.sort(listType5); for (String string : listType5) { comboYearType5.addItem(string); } } catch (SQLException e) { e.printStackTrace(); } } public OppReport setInputFormReport() { OppReport report = new OppReport(); report.setYearMonth(comboYearType5.getSelectedItem().toString()); report.setNo(comboNumType5.getSelectedItem().toString()); report.setPathFile(txtPathFileType5.getText()); if (radioDetailType5.isSelected()) { report.setReportType(0); } else { report.setReportType(1); } if (radioTopic197.isSelected()) { report.setAttribute(OpType5DAO.IS197_197); report.setIs197("1,5"); } else if (radioTopicHighcost.isSelected()) { report.setAttribute(OpType5DAO.IS197_HC); report.setIs197("3,4"); } if (radioSingleHospitalType5.isSelected()) { //report.setServiceCode(txtHCodeType5.getText()); report.setListServiceCode(listSelectHospital); } report.setMonth( baseFunction.subStringYearMonth(comboYearType5.getSelectedItem().toString()).get("M").toString()); report.setYear( baseFunction.subStringYearMonth(comboYearType5.getSelectedItem().toString()).get("Y").toString()); report.setTitle1(txtTitleTimeType5.getText()); if (radioForUse_Genaral.isSelected()) { report.setFor_use(0); } else { report.setFor_use(1); } if (comboLookupYear.getSelectedIndex() == 0) { report.setBudget_year(""); } else { report.setBudget_year(String.valueOf(comboLookupYear.getSelectedItem())); } report.setBudget_date(comboYearType5.getSelectedItem().toString()); report.setBudget_stmp( comboYearType5.getSelectedItem().toString() + "-" + comboNumType5.getSelectedItem().toString()); return report; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn197GenReport; private javax.swing.JButton btnType5ChooseHospital; private javax.swing.JButton btnType5GenReportAllFunction; private javax.swing.JButton btnType5PathFileDesktop; private javax.swing.JComboBox comboLookupYear; private javax.swing.JComboBox comboNumType5; private javax.swing.JComboBox comboYearType5; private javax.swing.JButton jButtonFolder3; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel16; private javax.swing.JPanel jPanel17; private javax.swing.JPanel jPanel18; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel33; private javax.swing.JScrollPane jScrollPane9; private javax.swing.ButtonGroup rGroupType5Attribute; private javax.swing.ButtonGroup rGroupType5Hospital; private javax.swing.ButtonGroup rGroupType5Type; private javax.swing.ButtonGroup rGroupTypeForUse; private javax.swing.JRadioButton radioAllHospitalType5; private javax.swing.JRadioButton radioDetailType5; private javax.swing.JRadioButton radioForUse_Genaral; private javax.swing.JRadioButton radioForUse_Website; private javax.swing.JRadioButton radioSingleHospitalType5; private javax.swing.JRadioButton radioSumType5; private javax.swing.JRadioButton radioTopic197; private javax.swing.JRadioButton radioTopicHighcost; private javax.swing.JPanel tabOpType5; private javax.swing.JTextArea txtHnameType5; private javax.swing.JTextField txtPathFileType5; private javax.swing.JTextField txtTitleTimeType5; // End of variables declaration//GEN-END:variables }