Ola, estou querendo um relatorio filtrado por data. ex: do dia 01/01/2015 a 10/01/2015.
esto com essa tela:
[code]public class ViewRelatorioVendas extends javax.swing.JFrame {
ArrayList<ModelCliente> listaModelClientes = new ArrayList<>();
ControllerCliente controllerCliente = new ControllerCliente();
ControllerVendas controllerVendas = new ControllerVendas();
ArrayList<ModelVendas> listaModelVendas = new ArrayList<>();
/**
* Creates new form ViewRelatorioVendas
*/
public ViewRelatorioVendas() {
initComponents();
listarClientes();
setLocationRelativeTo(null);
}
/**
* 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">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jbCancelar = new javax.swing.JButton();
jbGerarRelatorio = new javax.swing.JButton();
jrbData = new javax.swing.JRadioButton();
jrbCliente = new javax.swing.JRadioButton();
jcbCliente = new componentes.UJComboBox();
jdInicial = new com.toedter.calendar.JDateChooser();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jdFinal = new com.toedter.calendar.JDateChooser();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Relatório de vendas");
jbCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/No.png"))); // NOI18N
jbCancelar.setText("Cancelar");
jbCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCancelarActionPerformed(evt);
}
});
jbGerarRelatorio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/18x18/Report.png"))); // NOI18N
jbGerarRelatorio.setText("Gerar relatório");
jbGerarRelatorio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbGerarRelatorioActionPerformed(evt);
}
});
buttonGroup1.add(jrbData);
jrbData.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jrbData.setSelected(true);
jrbData.setText("Por data:");
jrbData.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jrbDataActionPerformed(evt);
}
});
buttonGroup1.add(jrbCliente);
jrbCliente.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jrbCliente.setText("Por cliente:");
jcbCliente.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel1.setText("Data inicial:");
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel2.setText("Data final:");
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jbCancelar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbGerarRelatorio))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jrbCliente)
.addComponent(jrbData))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jcbCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jdInicial, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jdFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jrbData)
.addComponent(jdInicial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jdFinal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addComponent(jLabel2))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jrbCliente)
.addComponent(jcbCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jbCancelar)
.addComponent(jbGerarRelatorio))
.addContainerGap())
);
pack();
}// </editor-fold>
private void jbGerarRelatorioActionPerformed(java.awt.event.ActionEvent evt) {
ControllerVendas controllerVendas = new ControllerVendas();
Datas bl = new Datas();
if (jrbData.isSelected()) {
Date data = null;
try {
data = bl.converterDataParaDateUS(bl.converterDataParaDateUS(jdcData.getDate()));
} catch (Exception ex) {
Logger.getLogger(ViewVenda.class.getName()).log(Level.SEVERE, null, ex);
}
controllerVendas.gerarRelatorioVendaData(data);
}else {
controllerVendas.gerarRelatorioVendaCliente(jcbCliente.getSelectedItem().toString());
}
}
private void jbCancelarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jrbDataActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void listarClientes(){
listaModelClientes = controllerCliente.getListaClienteController();
jcbCliente.removeAllItems();
for (int i = 0; i < listaModelClientes.size(); i++){
jcbCliente.addItem(listaModelClientes.get(i).getNome());
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ViewRelatorioVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ViewRelatorioVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ViewRelatorioVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ViewRelatorioVendas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ViewRelatorioVendas().setVisible(true);
}
});
}
private com.toedter.calendar.JDateChooser jdcData;
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JButton jbCancelar;
private javax.swing.JButton jbGerarRelatorio;
private componentes.UJComboBox jcbCliente;
private com.toedter.calendar.JDateChooser jdFinal;
private com.toedter.calendar.JDateChooser jdInicial;
private javax.swing.JRadioButton jrbCliente;
private javax.swing.JRadioButton jrbData;
// End of variables declaration
}
[/code]
gostaria de saber como crio um relatorio para essa tela.
alguem pode mim ajudar!
como fica tb no sql?
agradeço desde já!