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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareemr.Views;

import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareemr.Util.ConnectionFactory;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.InputStream;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.swing.JRViewer;

/**
 *
 * @author User1
 */
public class VisitReportPanel extends javax.swing.JPanel {

    /**
     * Creates new form VisitReportPanel
     */
    public VisitReportPanel(TPatientEncounter encounter) {
        this.patientEncounter=encounter;
        initComponents();
        showVisitReport(patientEncounter);
         
    }

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

        jPanel1 = new javax.swing.JPanel();

        setLayout(new java.awt.BorderLayout());

        jPanel1.setLayout(new java.awt.BorderLayout());
        add(jPanel1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables

  private TPatientEncounter patientEncounter;

    private void showVisitReport(TPatientEncounter patientEncounter){
        try {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("ReportTitle", "OutPatient Encounter Report");
        params.put("encounterId",patientEncounter.getEncId());
        System.out.println("ENCX ID :::"+patientEncounter.getEncId());
        InputStream jasperIS = getClass().getResourceAsStream("/reports/OpEncounterReport.jrxml"); 
        JasperReport report=JasperCompileManager.compileReport(jasperIS);
        Connection con=ConnectionFactory.getCon();
        JasperPrint print = JasperFillManager.fillReport(report,params,con);
        JRViewer jrv = new JRViewer(print);
        jrv.setPreferredSize(new Dimension(getSize()));
        JPanel p = new SimpleGradientPanel();
        p.setLayout(new java.awt.BorderLayout());
        p.add(jrv);
        jPanel1.removeAll();
        //jPanel1.setLayout(new java.awt.BorderLayout());
        jPanel1.add(p,BorderLayout.CENTER);
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.repaint();
        jPanel1.revalidate();
      } catch (Exception ex) {
          ex.printStackTrace();
            Logger.getLogger(VisitReportPanel.class.getName()).log(Level.SEVERE, null, ex);
        }  
    }
}

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

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