diff --git a/.classpath b/.classpath
new file mode 100644
index 000000000..7ac68b057
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 000000000..e52e8c096
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ IntegracaoReceitaDespesa
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..54e493c07
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/db.properties b/db.properties
new file mode 100644
index 000000000..1cf95984b
--- /dev/null
+++ b/db.properties
@@ -0,0 +1,4 @@
+url=jdbc:oracle:thin:@192.168.0.164:1521:ORCL
+username=vtabol
+password=vtax05
+
diff --git a/log4j.properties b/log4j.properties
new file mode 100644
index 000000000..d4e7fed1d
--- /dev/null
+++ b/log4j.properties
@@ -0,0 +1,16 @@
+# Root logger option
+log4j.rootLogger=DEBUG, stdout, file
+
+# Redirect log messages to console
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+
+# Redirect log messages to a log file, support file rolling.
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=${user.home}/integracaoReceitaDespesa.log
+log4j.appender.file.MaxFileSize=5MB
+log4j.appender.file.MaxBackupIndex=10
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/Application.java b/src/com/rjconsultores/integracaoreceitadespesa/Application.java
new file mode 100644
index 000000000..033f297ac
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/Application.java
@@ -0,0 +1,34 @@
+package com.rjconsultores.integracaoreceitadespesa;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+public class Application {
+ private static Application instance = null;
+
+ private static final Logger log = Logger.getLogger(Application.class);
+
+ private Application(){
+
+ }
+
+ public static Application getInstance(){
+ if (instance == null){
+ instance = new Application();
+ }
+ return instance;
+ }
+
+ public Properties getApplicationProperties(){
+ Properties props = new Properties();
+ try {
+ props.load(new FileInputStream("db.properties"));
+ } catch (IOException e) {
+ log.error("", e);
+ }
+ return props;
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/Arquivo.java b/src/com/rjconsultores/integracaoreceitadespesa/Arquivo.java
new file mode 100644
index 000000000..fa4ddd7f6
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/Arquivo.java
@@ -0,0 +1,23 @@
+package com.rjconsultores.integracaoreceitadespesa;
+
+import java.io.FileWriter;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+public class Arquivo {
+ private static final Logger log = Logger.getLogger(Arquivo.class);
+
+ public static void GravaArquivo(String filename, List rows){
+ try{
+
+ FileWriter writer = new FileWriter(filename);
+ for(String str: rows) {
+ writer.write(str);
+ }
+ writer.close();
+ } catch (Exception e){
+ log.error("", e);
+ }
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java
new file mode 100644
index 000000000..01778b3b3
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java
@@ -0,0 +1,196 @@
+package com.rjconsultores.integracaoreceitadespesa.dao;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+import com.rjconsultores.integracaoreceitadespesa.Application;
+import com.rjconsultores.integracaoreceitadespesa.entidades.DepositoBean;
+import com.rjconsultores.integracaoreceitadespesa.entidades.Empresa;
+import com.rjconsultores.integracaoreceitadespesa.entidades.PuntoVenta;
+
+
+public class Totalbus {
+
+ private static final Logger log = Logger.getLogger(Totalbus.class);
+
+ private static Totalbus instance = null;
+
+ private Connection conn;
+
+ private List pontosVenda = new ArrayList();
+ private List empresas = new ArrayList();
+
+ private Totalbus(){
+ try {
+ Properties props = Application.getInstance().getApplicationProperties();
+
+ String DRIVER = "oracle.jdbc.driver.OracleDriver";
+
+ Class.forName(DRIVER);
+ this.conn = DriverManager.getConnection(
+ props.getProperty("url"),
+ props.getProperty("username").trim(),
+ props.getProperty("password").trim());
+
+ loadEmpresas();
+ loadPuntosVenta();
+
+ } catch (Exception e){
+ log.error("", e);
+ }
+ }
+
+ private void loadPuntosVenta(){
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+
+ try{
+ pstmt = getConnection().prepareStatement("Select puntoventa_id, nombpuntoventa from punto_venta order by nombpuntoventa");
+ rs = pstmt.executeQuery();
+ while (rs.next()){
+ PuntoVenta puntoVenta = new PuntoVenta();
+ puntoVenta.codigo = rs.getInt(1);
+ puntoVenta.nombpuntoventa = rs.getString(2);
+ pontosVenda.add(puntoVenta);
+ }
+ } catch (Exception e){
+ log.error("", e);
+ } finally {
+ try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
+ try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); }
+ }
+ }
+
+ private void loadEmpresas(){
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+
+ try{
+ pstmt = getConnection().prepareStatement("Select empresa_id, nombempresa from empresa order by nombempresa");
+ rs = pstmt.executeQuery();
+ while (rs.next()){
+ Empresa empresa = new Empresa();
+ empresa.codigo = rs.getInt(1);
+ empresa.nombempresa = rs.getString(2);
+ empresas.add(empresa);
+ }
+ } catch (Exception e){
+ log.error("", e);
+ } finally {
+ try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
+ try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); }
+ }
+ }
+
+ public static Totalbus getInstance(){
+ if (instance == null){
+ instance = new Totalbus();
+ }
+ return instance;
+ }
+
+ public Connection getConnection(){
+ return this.conn;
+ }
+
+ public List getDepositos(Integer puntoventaId, Integer empresaId){
+ List depositos = new ArrayList();
+ StringBuilder sb = new StringBuilder();
+ sb.append("Select d.fecha_deposito, fc.empresa_id, fc.puntoventa_id, fd.valor_pago, ");
+ sb.append("(select valorconstante from constante where nombconstante = 'CODIGO_RECEITA_DESPESA_GLOBUS') as codigoReceitaDespesa ");
+ sb.append("from fechamento_deposito d ");
+ sb.append("inner join fechamento_cntcorrente fc on fc.fechamentocntcorrente_id = d.fechamentocntcorrente_id ");
+ sb.append("inner join fechamento_cct_deposito fd on fd.fechamentodeposito_id = d.fechamentodeposito_id ");
+ sb.append("where d.fecha_deposito = :fecha ");
+ if (puntoventaId != null){
+ sb.append("and fc.puntoventa_id = :puntoventaId ");
+ }
+ if (empresaId != null){
+ sb.append("and fc.empresa_id = :empresaId ");
+ }
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new Date());
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ Date fecha = cal.getTime();
+
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+
+ try{
+ pstmt = getConnection().prepareStatement(sb.toString());
+ pstmt.setDate(1, new java.sql.Date(fecha.getTime()));
+ if (puntoventaId != null){
+ pstmt.setInt(2, puntoventaId);
+ }
+ if (empresaId != null){
+ pstmt.setInt(3, empresaId);
+ }
+
+ rs = pstmt.executeQuery();
+ while (rs.next()){
+ DepositoBean deposito = new DepositoBean();
+ deposito.setCodigoEmpresa(rs.getInt(2));
+ deposito.setCodigoReceitaDespesa(rs.getInt(5));
+ deposito.setDataLancamento(rs.getDate(1));
+ deposito.setDataMovimento(rs.getDate(1));
+ deposito.setLocalArrecadação(rs.getInt(3));
+ deposito.setValorLançamento(rs.getBigDecimal(4).toString());
+ depositos.add(deposito);
+ }
+ } catch (Exception e){
+ log.error("", e);
+ } finally {
+ try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
+ try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); }
+ }
+ return depositos;
+ }
+
+ public Integer getCodigoReceitaDespesaGlobus(){
+ StringBuilder sb = new StringBuilder();
+ sb.append("Select valorconstante from constante where nombconstante = 'CODIGO_RECEITA_DESPESA_GLOBUS' ");
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+ Integer result = null;
+ try{
+ pstmt = getConnection().prepareStatement(sb.toString());
+ rs = pstmt.executeQuery();
+ if (rs.next()){
+ result = rs.getInt(1);
+ }
+ } catch (Exception e){
+ log.error("", e);
+ } finally {
+ try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
+ try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); }
+ }
+ return result;
+
+ }
+
+ public List getPontosVenda() {
+ return pontosVenda;
+ }
+
+ public void setPontosVenda(List pontosVenda) {
+ this.pontosVenda = pontosVenda;
+ }
+
+ public List getEmpresas() {
+ return empresas;
+ }
+
+ public void setEmpresas(List empresas) {
+ this.empresas = empresas;
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/entidades/DepositoBean.java b/src/com/rjconsultores/integracaoreceitadespesa/entidades/DepositoBean.java
new file mode 100644
index 000000000..de2695a17
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/entidades/DepositoBean.java
@@ -0,0 +1,91 @@
+package com.rjconsultores.integracaoreceitadespesa.entidades;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
+
+public class DepositoBean {
+ private String dataLancamento; // DD/MM/YYYY
+ private String codigoEmpresa; // 011 003 Numérico
+ private final String codigoFilial = "001"; // 014 003 Numérico
+ private String localArrecadação; // 017 005 Alfanumérico
+ private final String numeroDaGuia = " "; // 022 025 Alfanumérico
+ private String dataMovimento; // 047 010 Alfanumérico
+ private final String usuarioGlobus = "TOTALBUS ";// 057 015 Alfanumérico
+ private final String turno = "01";// 072 002 Numérico
+ private String codigoReceitaDespesa;// 074 010 Numérico CONSTANTE CODIGO_RECEITA_DESPESA_GLOBUS
+ private final String identificadorReceitaDespesa = "R";// 084 001 Alfanumérico
+ private String valorLançamento;// 085 013 Numérico
+ private final String numeroContratoTurismo = "0000000000";// 098 010 Numérico
+ private final String numeroReciboTurismo = " ";// 108 010 Alfanumérico
+ private final String formaPagamentoTurismo = "00";// 118 002 Numérico
+ private final String tipoPagamentoTurismo = "00";// 120 002 Numérico
+ private final String descricaoDetalhada = " ";// 122 100 Alfanumérico
+ private final String documentoVenda = "000000";// 222 6 Numérico
+ private final String tipoDocumentoVenda = " ";// 228 1 Alfanumérico
+ private final String numerodocumentoCPG = "0000000000";// 229 10 Numérico
+ private final String finalLinha = "*";// 239 1 Alfanumérico
+
+ private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
+
+ public DepositoBean(){
+ setCodigoReceitaDespesa(Totalbus.getInstance().getCodigoReceitaDespesaGlobus());
+ }
+
+ public void preencheLinha(List rows){
+ rows.add(dataLancamento + codigoEmpresa + codigoFilial +
+ localArrecadação.toUpperCase() +
+ numeroDaGuia + dataMovimento + usuarioGlobus +
+ turno + codigoReceitaDespesa +
+ identificadorReceitaDespesa.toUpperCase() + valorLançamento +
+ numeroContratoTurismo + numeroReciboTurismo +
+ formaPagamentoTurismo + tipoPagamentoTurismo +
+ descricaoDetalhada + documentoVenda + tipoDocumentoVenda +
+ numerodocumentoCPG + finalLinha);
+ }
+
+ public void setDataLancamento(Date dataLancamento) {
+ this.dataLancamento = sdf.format(dataLancamento);
+ }
+
+ public void setCodigoEmpresa(Integer codigoEmpresa) {
+ this.codigoEmpresa = lpad(codigoEmpresa.toString(), "0", 3);
+ }
+
+ public void setLocalArrecadação(Integer localArrecadação) {
+ this.localArrecadação = lpad(localArrecadação.toString(), "0", 5).substring(0,4);
+ }
+
+ public void setDataMovimento(Date dataMovimento) {
+ this.dataMovimento = sdf.format(dataMovimento);
+ }
+
+ public void setCodigoReceitaDespesa(Integer codigoReceitaDespesa) {
+ if (codigoReceitaDespesa != null){
+ this.codigoReceitaDespesa = lpad(codigoReceitaDespesa.toString(), "0", 10);
+ } else {
+ this.codigoReceitaDespesa = lpad("0", "0", 10);
+ }
+ }
+
+ public void setValorLançamento(String valorLançamento) {
+ this.valorLançamento = lpad(valorLançamento.toString().replace(",", "").replace(".", ""), "0", 13);
+ }
+
+ private static String lpad(String valueToPad, String filler, int size) {
+ while (valueToPad.length() < size) {
+ valueToPad = filler + valueToPad;
+ }
+ return valueToPad;
+ }
+
+ private static String rpad(String valueToPad, String filler, int size) {
+ while (valueToPad.length() < size) {
+ valueToPad = valueToPad+filler;
+ }
+ return valueToPad;
+ }
+
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/entidades/Empresa.java b/src/com/rjconsultores/integracaoreceitadespesa/entidades/Empresa.java
new file mode 100644
index 000000000..e5af44183
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/entidades/Empresa.java
@@ -0,0 +1,11 @@
+package com.rjconsultores.integracaoreceitadespesa.entidades;
+
+public class Empresa {
+ public Integer codigo;
+ public String nombempresa;
+
+ @Override
+ public String toString(){
+ return nombempresa;
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/entidades/PuntoVenta.java b/src/com/rjconsultores/integracaoreceitadespesa/entidades/PuntoVenta.java
new file mode 100644
index 000000000..1973ab7e5
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/entidades/PuntoVenta.java
@@ -0,0 +1,11 @@
+package com.rjconsultores.integracaoreceitadespesa.entidades;
+
+public class PuntoVenta {
+ public Integer codigo;
+ public String nombpuntoventa;
+
+ @Override
+ public String toString(){
+ return nombpuntoventa;
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/view/FrmMain.java b/src/com/rjconsultores/integracaoreceitadespesa/view/FrmMain.java
new file mode 100644
index 000000000..2faa45d26
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/view/FrmMain.java
@@ -0,0 +1,127 @@
+package com.rjconsultores.integracaoreceitadespesa.view;
+import java.awt.BorderLayout;
+import java.awt.Cursor;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JFileChooser;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+import com.rjconsultores.integracaoreceitadespesa.Arquivo;
+import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
+import com.rjconsultores.integracaoreceitadespesa.entidades.DepositoBean;
+
+
+/**
+* This code was edited or generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
+* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
+* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
+*/
+public class FrmMain extends javax.swing.JFrame implements MenuListener {
+ private JDesktopPane jDesktopPane1;
+ private JMenuBar jMenuBar1;
+ private JMenuItem mnuGerarArquivo;
+ private JMenu jMenu1;
+
+ /**
+ * Auto-generated main method to display this JFrame
+ */
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ FrmMain inst = new FrmMain();
+ inst.setLocationRelativeTo(null);
+ inst.setVisible(true);
+ }
+ });
+ }
+
+ public FrmMain() {
+ super();
+ initGUI();
+ setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
+ }
+
+ private void initGUI() {
+ try {
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ {
+ jMenuBar1 = new JMenuBar();
+ setJMenuBar(jMenuBar1);
+ {
+ jMenu1 = new JMenu();
+ jMenuBar1.add(jMenu1);
+ jMenu1.setText("Gerar Arquivo");
+ jMenu1.addMenuListener(this);
+ }
+ }
+ {
+ jDesktopPane1 = new JDesktopPane();
+ getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
+ }
+ pack();
+ setSize(400, 300);
+ } catch (Exception e) {
+ //add your error handling code here
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void menuCanceled(MenuEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void menuDeselected(MenuEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void menuSelected(MenuEvent e) {
+ if (e.getSource() == jMenu1){
+ PnlPeriodo pnl = new PnlPeriodo();
+
+ int answer = JOptionPane.showConfirmDialog(null, pnl, "Executar Exportação", JOptionPane.OK_CANCEL_OPTION);
+ if (answer == JOptionPane.OK_OPTION) {
+ List depositos = Totalbus.getInstance().getDepositos(pnl.getPuntoventa(), pnl.getEmpresa());
+ List rows = new ArrayList();
+
+ for (DepositoBean deposito : depositos){
+ deposito.preencheLinha(rows);
+ }
+
+ this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ final JFileChooser fc = new JFileChooser();
+ int returnVal = fc.showOpenDialog(this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ Arquivo arquivo = new Arquivo();
+ arquivo.GravaArquivo(file.getAbsolutePath(), rows);
+ }
+ } else {
+ JOptionPane.showMessageDialog(null, "Operação cancelada pelo usuário");
+ }
+ this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+}
diff --git a/src/com/rjconsultores/integracaoreceitadespesa/view/PnlPeriodo.java b/src/com/rjconsultores/integracaoreceitadespesa/view/PnlPeriodo.java
new file mode 100644
index 000000000..89d4a53cf
--- /dev/null
+++ b/src/com/rjconsultores/integracaoreceitadespesa/view/PnlPeriodo.java
@@ -0,0 +1,113 @@
+package com.rjconsultores.integracaoreceitadespesa.view;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.WindowConstants;
+
+import org.apache.log4j.Logger;
+
+import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
+import com.rjconsultores.integracaoreceitadespesa.entidades.Empresa;
+import com.rjconsultores.integracaoreceitadespesa.entidades.PuntoVenta;
+
+/**
+* This code was edited or generated using CloudGarden's Jigloo
+* SWT/Swing GUI Builder, which is free for non-commercial
+* use. If Jigloo is being used commercially (ie, by a corporation,
+* company or business for any purpose whatever) then you
+* should purchase a license for each developer using Jigloo.
+* Please visit www.cloudgarden.com for details.
+* Use of Jigloo implies acceptance of these licensing terms.
+* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
+* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
+* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
+*/
+public class PnlPeriodo extends javax.swing.JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger log = Logger.getLogger(PnlPeriodo.class);
+
+ private JLabel lblPuntoventa;
+ private JComboBox txtPuntoventa;
+ private JLabel lblEmpresa;
+ private JComboBox txtEmpresa;
+
+ /**
+ * Auto-generated main method to display this
+ * JPanel inside a new JFrame.
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(new PnlPeriodo());
+ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ public PnlPeriodo() {
+ super();
+ initGUI();
+ }
+
+ private void initGUI() {
+ try {
+ this.setPreferredSize(new java.awt.Dimension(425, 72));
+ this.setLayout(null);
+
+
+ this.add(getLblPuntoventa());
+ this.add(getTxtPuntoventa());
+ this.add(getLblEmpresa());
+ this.add(getTxtEmpresa());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public JLabel getLblPuntoventa() {
+ if (lblPuntoventa == null){
+ lblPuntoventa = new JLabel();
+ lblPuntoventa.setText("Ponto de Venda");
+ lblPuntoventa.setBounds(12, 12, 93, 16);
+ }
+ return lblPuntoventa;
+ }
+
+ public JComboBox getTxtPuntoventa() {
+ if (txtPuntoventa == null){
+ txtPuntoventa = new JComboBox(new DefaultComboBoxModel(Totalbus.getInstance().getPontosVenda().toArray()));
+ txtPuntoventa.setBounds(105, 9, 308, 23);
+ }
+ return txtPuntoventa;
+ }
+
+ public JLabel getLblEmpresa() {
+ if (lblEmpresa == null){
+ lblEmpresa = new JLabel();
+ lblEmpresa.setText("Empresa");
+ lblEmpresa.setBounds(12, 40, 81, 16);
+ }
+ return lblEmpresa;
+ }
+
+ public JComboBox getTxtEmpresa() {
+ if (txtEmpresa == null){
+ txtEmpresa = new JComboBox(new DefaultComboBoxModel(Totalbus.getInstance().getEmpresas().toArray()));
+ txtEmpresa.setBounds(105, 37, 308, 23);
+ }
+ return txtEmpresa;
+ }
+
+ public Integer getPuntoventa(){
+ return ((PuntoVenta)txtPuntoventa.getSelectedItem()).codigo;
+ }
+
+ public Integer getEmpresa(){
+ return ((Empresa)txtEmpresa.getSelectedItem()).codigo;
+ }
+}