Subversion Repository Public Repository

Pharmacy_09_03_18

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
/*
 * 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.bestray.healthcareemr.Views;

import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.DisabledGlassPane;
import com.bestray.healthcarecommonutil.vo.TDepartmentMaster;
import com.bestray.healthcareemr.Controller.AmbulatoryFeeController;
import com.bestray.healthcareinpatient.view.HealthCareInpatientHome;
import com.bestray.healthcareinpatient.view.IpBillingFeecollectionReport;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import org.apache.commons.beanutils.BeanUtils;

/**
 *
 * @author dell
 */
public class ambulatotyReports extends javax.swing.JPanel {
   
    /**
     * Creates new form ambulatotyReports
     */
    public ambulatotyReports() {
        initComponents();
        populate();
    }

    /**
     * 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() {

        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        dailyReport_button = new javax.swing.JButton();
        yearlyReport_button = new javax.swing.JButton();
        monthlyReport_button = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        datechooser = new com.toedter.calendar.JDateChooser();
        monthchooser = new com.toedter.calendar.JMonthChooser();
        detail_month_year_chosser = new com.toedter.calendar.JYearChooser();
        yearchooser = new com.toedter.calendar.JYearChooser();
        viewbutton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        reportTable = new javax.swing.JTable();

        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel1.setText("Report Name :");

        dailyReport_button.setText("Daily Report");
        dailyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dailyReport_buttonActionPerformed(evt);
            }
        });

        yearlyReport_button.setText("Yearly Report");
        yearlyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yearlyReport_buttonActionPerformed(evt);
            }
        });

        monthlyReport_button.setText("Monthly Report");
        monthlyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthlyReport_buttonActionPerformed(evt);
            }
        });

        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(71, 71, 71)
                .addComponent(dailyReport_button)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(monthlyReport_button)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(yearlyReport_button)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(yearlyReport_button)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(dailyReport_button, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(monthlyReport_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(204, 204, 255));

        datechooser.setDate(new Date());
        datechooser.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        datechooser.setOpaque(false);
        datechooser.setVisible(false);

        monthchooser.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        monthchooser.setOpaque(false);
        monthchooser.setVisible(false);

        detail_month_year_chosser.setVisible(false);
        detail_month_year_chosser.setOpaque(false);

        yearchooser.setOpaque(false);
        yearchooser.setVisible(false);

        viewbutton.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        viewbutton.setText("View");
        viewbutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                viewbuttonActionPerformed(evt);
            }
        });
        viewbutton.setVisible(false);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel2.setText("Date");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel3.setText("Month");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel4.setText("Year");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(datechooser, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(monthchooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(detail_month_year_chosser, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(yearchooser, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(88, 88, 88)
                .addComponent(viewbutton)
                .addContainerGap(365, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(viewbutton))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap(37, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(monthchooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_month_year_chosser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(yearchooser, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
                            .addComponent(datechooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(37, 37, 37))
        );

        reportTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(reportTable);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 17, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jScrollPane1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(190, 190, 190))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void dailyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dailyReport_buttonActionPerformed
         
        datechooser.setVisible(true);
        
        monthchooser.setVisible(false);
        
        yearchooser.setVisible(false);
       
        detail_month_year_chosser.setVisible(false);
        
        viewbutton.setVisible(true);
        
        jPanel1.setVisible(true);
        
        jScrollPane1.setVisible(true);
        
       
        jLabel4.setVisible(true);
        if(datechooser.getDate()!=null){
            viewbutton.doClick();
        }
    }//GEN-LAST:event_dailyReport_buttonActionPerformed

    private String getMonthFullName(int monthNumber){
        String monthName="";
        if(monthNumber>=0 && monthNumber<12){
            try{
                Calendar calendar = Calendar.getInstance();
                calendar.set(Calendar.MONTH, monthNumber);

                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMM");
                simpleDateFormat.setCalendar(calendar);
                monthName = simpleDateFormat.format(calendar.getTime());
            }catch (Exception e){}
        }
            return monthName;
    }
    private void viewbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewbuttonActionPerformed
      JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        glassPane.activateLoadingImage();
        
        SwingWorker s = new SwingWorker() {
          

            @Override
            protected Object doInBackground() throws Exception {
                Double fee = 0d;
                try {
                        Date date = null;
                        String month = "null";
                        int year = 0;
                        int monthyear = 0;
                        TDepartmentMaster dept = null;
                        
                        if(dailyReport_button.isSelected()){
                            if(datechooser.getDate()!=null){
                                date = datechooser.getDate();
                            }else{
                                JOptionPane.showMessageDialog(null,"Choose The Date");
                            }
                        }else if(monthlyReport_button.isSelected()){
                            if(monthchooser.getMonth()!=0){
                                 month = getMonthFullName(monthchooser.getMonth());
                                 monthyear = detail_month_year_chosser.getYear();
                            }else{
                                 JOptionPane.showMessageDialog(null,"Choose The Month");
                            }
                        }else if(yearlyReport_button.isSelected()){
                            if(yearchooser.getYear()!=0){
                                 year = yearchooser.getYear();
                            }else{
                                 JOptionPane.showMessageDialog(null,"Choose The Year");
                            }
                        }
                        jScrollPane1.setVisible(true);

                            data = ambulatoryFeeController.showReport(date, month,monthyear, year,dept);
                            reportTable.setModel(new javax.swing.table.DefaultTableModel(data,Header));
                            for(int row=0;row<reportTable.getRowCount();row++){
                                if(!reportTable.getValueAt(row, 4).toString().equalsIgnoreCase("")){
                                    fee+=Double.parseDouble(reportTable.getValueAt(row, 4).toString());
                                }
                            }
                            
                            if(data.isEmpty()){
                                JOptionPane.showMessageDialog(null,"No Data Available");
                            }
                        
                    

                }catch (ProcessingException ex) {
                    Logger.getLogger(IpBillingFeecollectionReport.class.getName()).log(Level.SEVERE, null, ex);
                }catch (Exception ex) {
                    Logger.getLogger(IpBillingFeecollectionReport.class.getName()).log(Level.SEVERE, null, ex);
                }
                return null;
            }

            @Override
            protected void done() {
                super.done();
                glassPane.deactivate();
            }
            
        };
        s.execute();


    }//GEN-LAST:event_viewbuttonActionPerformed

    private void yearlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearlyReport_buttonActionPerformed
        
        yearchooser.setVisible(true);
        
        datechooser.setVisible(false);
        
        monthchooser.setVisible(false);
        detail_month_year_chosser.setVisible(false);
        jPanel1.setVisible(true);
        
        jLabel4.setVisible(true);
        
        
        viewbutton.setVisible(true);
        if(yearchooser.getYear()!=0){
            viewbutton.doClick();
        }      
      
    }//GEN-LAST:event_yearlyReport_buttonActionPerformed

    private void monthlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReport_buttonActionPerformed
       
        monthchooser.setVisible(true);
        
        detail_month_year_chosser.setVisible(true);
        
        datechooser.setVisible(false);
        
        yearchooser.setVisible(false);
        
        jPanel1.setVisible(true);
        
        jLabel4.setVisible(true);
       
       
        viewbutton.setVisible(true);
        
        if(monthchooser.getMonth()!=0){
            viewbutton.doClick();
        }
    }//GEN-LAST:event_monthlyReport_buttonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton dailyReport_button;
    private com.toedter.calendar.JDateChooser datechooser;
    private com.toedter.calendar.JYearChooser detail_month_year_chosser;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private com.toedter.calendar.JMonthChooser monthchooser;
    private javax.swing.JButton monthlyReport_button;
    private javax.swing.JTable reportTable;
    private javax.swing.JButton viewbutton;
    private com.toedter.calendar.JYearChooser yearchooser;
    private javax.swing.JButton yearlyReport_button;
    // End of variables declaration//GEN-END:variables
private Vector<Vector<String>> data = new Vector<Vector<String>>();
private Vector<String> Header = new Vector<String>();
private DisabledGlassPane glassPane = new DisabledGlassPane();
private  AmbulatoryFeeController ambulatoryFeeController;

    private void populate() {
       ambulatoryFeeController=(AmbulatoryFeeController)HealthCareInpatientHome.context.getBean("ambulatoryFeeController");
       Header.add("Date");
       Header.add("Patient Nmae");
       Header.add("Doctor Name");
       Header.add("Dipartment");
       Header.add("Out Door Billing");
    }
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaEMR/src/main/java/com/bestray/healthcareemr/Views/ambulatotyReports.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:30:57 +0000