package rnb.cell;
import java.awt.HeadlessException;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
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.view.JRViewer;
/**
*
* @author azhar
*/
public class Report_controler extends JFrame{
void Showreport(String tgl){
try {
Connection c = koneksi.getkoneksi();
Map parameter = new HashMap();
parameter.put("tgl", tgl); \\ Untuk mengirimkan parameter
parameter.put("Tglview", tgl);
JasperReport jasperReport = (JasperReport)JasperCompileManager.compileReport(System.getProperty("user.dir").toString()+"\\Report\\Laporantrx.jrxml");
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameter, c);
JRViewer viewer = new JRViewer(print);
this.add(viewer);
this.setVisible(true);
this.setSize(1000,700);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}catch(JRException | SecurityException | HeadlessException e){JOptionPane.showMessageDialog(null,e.toString());} finally {
}
}}
import java.awt.HeadlessException;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
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.view.JRViewer;
/**
*
* @author azhar
*/
public class Report_controler extends JFrame{
void Showreport(String tgl){
try {
Connection c = koneksi.getkoneksi();
Map parameter = new HashMap();
parameter.put("tgl", tgl); \\ Untuk mengirimkan parameter
parameter.put("Tglview", tgl);
JasperReport jasperReport = (JasperReport)JasperCompileManager.compileReport(System.getProperty("user.dir").toString()+"\\Report\\Laporantrx.jrxml");
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameter, c);
JRViewer viewer = new JRViewer(print);
this.add(viewer);
this.setVisible(true);
this.setSize(1000,700);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}catch(JRException | SecurityException | HeadlessException e){JOptionPane.showMessageDialog(null,e.toString());} finally {
}
}}
No comments:
Post a Comment