Cassa-DSU/src/puntocassa/PuntoCassa.java

5038 lines
219 KiB
Java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package puntocassa;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.*;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import jssc.SerialPort;
import jssc.SerialPortException;
import org.apache.log4j.LogManager;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
//******************************************************************************
// *
// * @author Master
// *
//******************************************************************************
public class PuntoCassa extends JFrame implements ActionListener {
// ==========================================================================
// *** Variabili globali relative alle connessioni
// ==========================================================================
public static String versione = "2.4";
public static String dbStringa = "";
private String dbTipo = "";
private String dbDriver = "";
public static String dbUsername = "";
public static String dbPassword = "";
private String utenteLoggato = "";
private String imgPath = "";// "L:\\Lavoro\\Goffredo\\risorse\\";
private int displayWidth = 1024;
private int displayHeight = 768;
private Long progressivo = 0L;
private Long progressivoTurno = 0L;
private Long progressivoGiorno = 0L;
private Double progressivoScalare = 0.0;
private Double progressivoContanti = 0.0;
private Double progressivoTicket = 0.0;
private Double progressivoDifferito = 0.0;
private Double saldoMinimoStop = 0.0;
private Long idTurno = 0L;
private String nomeTurno = "";
private Long idTurnoAttuale = 0L;
private String nomeTurnoAttuale = "";
private int colImporto = 1;
private int colPunti = 2;
private int colIDProdotto = 3;
private int colImporto2 = 4;
private int colCategoria = 5;
public Long idPuntoCassa = 0L;
private Boolean consentiCredito = false;
private Long idProfiloTariffario = 0L;
private Long idProfiloTariffarioDefault = 0L;
public static Long idModoPagamento = 0L;
public static String modoPagamentoDefault = "A scalare";
public static Integer flagBonus = 0;
private Long idTessera = 0L;
private Long idPrenotazione = 0L;
private Boolean isCassaAperta = false;
private Long idAccount = 0L;
Timer timerCard;
private int numeroCategorie = 0;
private Boolean statoCardLettore = false;
StringBuilder testoSwipCard = new StringBuilder();
StringBuilder testoRFIDCard = new StringBuilder();
StringBuilder logTestoTessera = new StringBuilder();
String logNumeroTessera = "", logIDTessera = "", logTesseraErrore = "";
private Boolean unSoloTipoPagamento = false;
private Boolean menuGiornoPresente = false, messaggioSaldoUnaVolta = false;
private Boolean flagMostraDataDiNascita = true;
private Boolean stoCalcolando = false;
private Boolean flagEsegueStorni = true;
enum StatiCarta {
ASSENTE, INSERITA, RIMOSSA
}
public StatiCarta statoCarta;
public Boolean cartaLetta = false;
public static KeyEventDispatcher keyDispatcher;
public int hFont = 15;
private int altControlli = 100;
private int largControlli = 100;
public FrmProgress myProgressForm;
public FrmMeteo myMeteoForm;
private int gratuitaResidue = 0;
private int bonusResidui = 0;
private StringBuilder modiPagamento = new StringBuilder("");
private static Boolean keyDespatcherAttivo = false;
public Boolean passaggioTessera = false;
private Boolean passaggiEsauritiNoComposizione = false;
private static Boolean visualizzaMessaggiDisplay = true;
private static String messageDisplay = "";
public static Boolean flagExtra = false;
public static Boolean flagRicevuta = false;
Timer timerDisplay = new Timer();
private static Integer delaySwipCard = 100;
private static Boolean bottoneImposta = true;
private static Boolean asporto = false;
private static Boolean flagPrecaricaLista = false;
private void verificaAggiornamentoDB() {
String flagProponiAggiornamentoDB = mySelect("Select Valore from Parametri where chiave='FlagProponiAggiornamentoDB' ", "Valore");
if (flagProponiAggiornamentoDB.equals("NO")) {
return;
}
Long agg = mySelectInteger("Select DB_locale_aggiornato as Agg from dual", "Agg");
if (flagProponiAggiornamentoDB.equals("SI")) {
if (agg == 0) {
aggiornaDB(true);
}
} else {
if (agg == 0) {
aggiornaDB(false);
}
}
}
private void verificaModoPagamento() {
String flagImpostaTipoPagamento = mySelect("Select Valore from Parametri where chiave='FlagImpostaTipoPagamento' ", "Valore");
unSoloTipoPagamento = flagImpostaTipoPagamento.equals("NO");
}
private void logTessera() {
try {
/*if(!"".equals(logIDTessera) ||
!"".equals(logNumeroTessera) ||
logTestoTessera.toString().length() > 0){*/
if (!logIDTessera.isEmpty()
|| !logNumeroTessera.isEmpty()
|| logTestoTessera.length() > 0) {
myInsert("Insert into LETTURE_TESSERE (STRINGA_LETTA,NUMERO_TESSERA,ID_TESSERA,ERRORE) values "
+ "('" + logTestoTessera.toString().replace("'", "''")
+ "','" + logNumeroTessera
+ "','" + logIDTessera
+ "','" + logTesseraErrore.replace("'", "''")
+ "')");
logIDTessera = "";
logNumeroTessera = "";
logTestoTessera = new StringBuilder();
}
} catch (Exception ex) {
}
}
private void clearTable(MyTableModel model) {
try {
for (Integer i = model.getRowCount() - 1; i >= 0; i--) {
model.deleteRow(i);
}
} catch (Exception e) {
}
}
// ==========================================================================
// *** Constructor della classe PuntoCassa
// ==========================================================================
public PuntoCassa() {
// -----------------------------------------------------------------------
// *** Esegue le impostazioni di base
// -----------------------------------------------------------------------
initComponents();
// -----------------------------------------------------------------------
// *** Legge la configurazione dal file XML
// -----------------------------------------------------------------------
try {
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = documentFactory.newDocumentBuilder();
String startDir = System.getProperty("user.dir");
Document document = builder.parse(new File(startDir + "/risorse/puntocassa.xml"));
File iconaApp = new File(startDir + "/risorse/logo.png");
if (iconaApp.exists()) {
ImageIcon icon = new ImageIcon(startDir + "/risorse/logo.png");
this.setIconImage(icon.getImage());
}
// --------------------------------------------------------------------
// ** Accesso al database
// --------------------------------------------------------------------
NodeList database = document.getElementsByTagName("database");
for (int i = 0; i < database.getLength(); i++) {
Node nodo = database.item(i);
if (nodo.getNodeType() == Node.ELEMENT_NODE) {
Element db = (Element) nodo;
String attivo = db.getElementsByTagName("attivo").item(0).getFirstChild().getNodeValue();
String tipo = db.getElementsByTagName("tipo").item(0).getFirstChild().getNodeValue();
String driver = db.getElementsByTagName("driver").item(0).getFirstChild().getNodeValue();
String server = db.getElementsByTagName("server").item(0).getFirstChild().getNodeValue();
String porta = db.getElementsByTagName("porta").item(0).getFirstChild().getNodeValue();
String istanza = db.getElementsByTagName("istanza").item(0).getFirstChild().getNodeValue();
String username = db.getElementsByTagName("username").item(0).getFirstChild().getNodeValue();
String password = db.getElementsByTagName("password").item(0).getFirstChild().getNodeValue();
if (attivo.equals("SI")) {
Encoding en = new Encoding();
dbUsername = username;
dbPassword = Encoding.decodeString(password);
dbTipo = tipo;
dbDriver = driver;
if (tipo.equals("MySQL")) {
dbStringa = "jdbc:mysql://" + server + ":" + porta + "/" + istanza;
} else if (tipo.equals("Oracle")) {
dbStringa = "jdbc:oracle:thin:@" + server + ":" + porta + ":" + istanza;
}
}
}
}
// --------------------------------------------------------------------
// ** Path
// --------------------------------------------------------------------
NodeList paths = document.getElementsByTagName("path");
for (int i = 0; i < paths.getLength(); i++) {
Node path = paths.item(i);
if (path.getNodeType() == Node.ELEMENT_NODE) {
Element p = (Element) path;
imgPath = p.getElementsByTagName("img_path").item(0).getFirstChild().getNodeValue();
if (imgPath.equalsIgnoreCase("..\\risorse\\")) {
imgPath = startDir + "/risorse/";
}
}
}
// --------------------------------------------------------------------
// ** Etichette
// --------------------------------------------------------------------
NodeList etichette = document.getElementsByTagName("etichette");
String titolo = "";
MyApplication myApp = new MyApplication();
for (int i = 0; i < paths.getLength(); i++) {
Node etichetta = etichette.item(i);
if (etichetta.getNodeType() == Node.ELEMENT_NODE) {
Element p = (Element) etichetta;
titolo = p.getElementsByTagName("titolo").item(0).getFirstChild().getNodeValue();
idPuntoCassa = Long.valueOf(myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'IdPuntoCassa'", "valore"));
String credito = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagIgnoraSaldoStop'", "valore");
if (credito.equalsIgnoreCase("SI")) {
consentiCredito = true;
}
titolo = titolo + " " + idPuntoCassa;
this.setTitle(titolo);
//Aggiornamento 14-01-2019
String stringDatiPagamento = myApp.mySelect(this, "select tp.id || '|' || tp.nome || '|' || pd.flag_bonus || '|' || "
+ "pd.flag_extra as valore from punti_cassa pc "
+ "inner join punti_distribuzione pd on pc.id_punto_distribuzione = pd.id "
+ "inner join tipi_pagamenti tp on pd.id_tipo_paga_default = tp.id "
+ "where pc.id=" + idPuntoCassa, "valore");
String[] arrayDatiPagamento = stringDatiPagamento.split("\\|", -1);
if (arrayDatiPagamento.length >= 2) {
idModoPagamento = Long.valueOf(arrayDatiPagamento[0]);
modoPagamentoDefault = arrayDatiPagamento[1];
lblTipoPagamento.setText(arrayDatiPagamento[1]);
//Aggiornamento 14-01-2019
flagBonus = Integer.valueOf(arrayDatiPagamento[2]);
flagExtra = false;
if (arrayDatiPagamento[3].equalsIgnoreCase("1")) {
flagExtra = true;
}
pulsantiModoPagamento();
}
}
}
// --------------------------------------------------------------------
// ** display
// --------------------------------------------------------------------
NodeList disp = document.getElementsByTagName("display");
for (int i = 0; i < disp.getLength(); i++) {
Node display = disp.item(i);
if (display.getNodeType() == Node.ELEMENT_NODE) {
Element p = (Element) display;
displayWidth = Integer.parseInt(p.getElementsByTagName("larghezza").item(0).getFirstChild().getNodeValue());
displayHeight = Integer.parseInt(p.getElementsByTagName("altezza").item(0).getFirstChild().getNodeValue());
hFont = Integer.parseInt(p.getElementsByTagName("fontSize").item(0).getFirstChild().getNodeValue());
altControlli = Integer.parseInt(p.getElementsByTagName("altezzaControlli").item(0).getFirstChild().getNodeValue());
largControlli = Integer.parseInt(p.getElementsByTagName("larghezzaControlli").item(0).getFirstChild().getNodeValue());
String tastiera = p.getElementsByTagName("TastieraVideo").item(0).getFirstChild().getNodeValue();
myApp.tastieraVideo = !tastiera.equals("NO");
}
}
//adatto panel login
Font f = new Font("Tahoma", 0, hFont);
UIManager.put("OptionPane.messageFont",
new FontUIResource(new Font("Tahoma", Font.BOLD, hFont))
);
UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("Tahoma", Font.BOLD, 25)));
btnLogin.setFont(f);
pnlLogin.setSize(calcolaLarghezzaAltezza(pnlLogin.getWidth(), largControlli), calcolaLarghezzaAltezza(pnlLogin.getHeight(), altControlli));
lblPassword.setFont(f);
lblUsername.setFont(f);
txtUsername.setFont(f);
txtPassword.setFont(f);
jTxtTessera.setFont(f);
jChLogin.setFont(f);
jBtnReadCard.setVisible(false);
// --------------------------------------------------------------------
// ** ID_PUNTO_CASSA
// --------------------------------------------------------------------
jcmbSC.setVisible(false);
String VMD = document.getElementsByTagName("Visualizza_Messaggi_Display").item(0).getFirstChild().getNodeValue();
visualizzaMessaggiDisplay = VMD.equalsIgnoreCase("SI");
messageDisplay = document.getElementsByTagName("Messaggio_Display").item(0).getFirstChild().getNodeValue();
updateReaderCombo();
String ultimiMovimenti = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagVisualizzaUltimiPassaggi'", "valore");
if (ultimiMovimenti.equalsIgnoreCase("NO")) {
jBtnMovimenti.setEnabled(false);
}
timerCard = new java.util.Timer();
timerCard.schedule(new CardTask(this), 0, 1 * 1000);
statoAttivoNonLoggato();
String flagRicevutaValue = mySelect("Select Valore from Parametri where Chiave='FlagRicevuta'", "Valore");
PuntoCassa.flagRicevuta = !flagRicevutaValue.equalsIgnoreCase("NO");
String flagDataNascita = mySelect("Select Valore from Parametri where Chiave='FlagMostraDataDiNascita'", "Valore");
flagMostraDataDiNascita = !flagDataNascita.equalsIgnoreCase("NO");
String flagEsegueStorniValue = mySelect("Select Valore from Parametri where Chiave='FlagEsegueStorni'", "Valore");
this.flagEsegueStorni = !flagEsegueStorniValue.equalsIgnoreCase("NO");
String timeoutSwipCard = mySelect("Select Valore from Parametri where Chiave='TimeoutSwipCard'", "Valore");
if (myApp.isNumeric(timeoutSwipCard)) {
delaySwipCard = Integer.valueOf(timeoutSwipCard);
}
myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'");
String flagDefaultAsporto = mySelect("Select Valore from Parametri where Chiave='FlagDefaultAsporto'", "Valore");
if (flagDefaultAsporto.equalsIgnoreCase("SI")) {
asporto = true;
}
String flagPrecarica = mySelect("Select Valore from Parametri where Chiave='FlagPrecaricaLista'", "Valore");
flagPrecaricaLista = !flagPrecarica.equalsIgnoreCase("NO");
keyDispatcher = new KeyEventDispatcher() {
Boolean swip = false;
Boolean spiaAltreCarte = false;
Boolean timerUnaVolta = false;
MyApplication myApp = new MyApplication();
public boolean dispatchKeyEvent(KeyEvent e) {
int id = e.getID();
if (jbtnChiudi.isEnabled() && pnlLogin.isVisible() == false && jTxtTessera.getText().length() > 0) {
e.consume();
if (myApp.unaVolta == false) {
myApp.unaVolta = true;
}
return false;
}
myApp.unaVolta = false;
int keyCode = e.getKeyCode();
if (id == KeyEvent.KEY_RELEASED) {
String tasto = "" + e.getKeyChar();
System.out.println(keyCode + " - " + tasto);
logTestoTessera.append(e.getKeyChar());
if (tasto.equalsIgnoreCase("ò")) { //144
swip = true;
}
//05-12-2017
if (keyCode == 16 || keyCode == 45 || tasto.equalsIgnoreCase("ò")) {
spiaAltreCarte = true;
}
if (tasto.equalsIgnoreCase("ò") == false && keyCode != 16 && keyCode != 45 && swip) { //keyCode != 144 && keyCode != 17
testoSwipCard.append(tasto);
System.out.println(testoSwipCard.toString());
}
if (keyCode == 45 && swip) { //keyCode != 144
swip = false;
System.out.println(testoSwipCard.toString());
warn();
}
//30-11-2017 modifica per rfid
if (keyCode != 16) {
testoRFIDCard.append(tasto);
}
if (keyCode == 10 && swip == false && spiaAltreCarte == false) { //keyCode != 144
System.out.println(testoRFIDCard.toString());
testoSwipCard = testoRFIDCard;
testoRFIDCard = new StringBuilder();
warn();
}
//29-10-18------------------------------------------------------
if (timerUnaVolta == false) {
timerUnaVolta = true;
final Timer timer = new Timer();
final TimerTask task = new TimerTask() {
@Override
public void run() {
if (testoRFIDCard.toString().length() > 2) {
System.out.println("Timer: " + testoRFIDCard.toString());
testoSwipCard = testoRFIDCard;
testoRFIDCard = new StringBuilder();
warn();
}
timer.cancel();
timer.purge();
timerUnaVolta = false;
}
};
timer.schedule(task, 5000);
}
//fine 29-10-18------------------------------------------------------
}
return true;
}
public void warn() {
if (statoCardLettore) {
return;
}
//29-10-2018
testoRFIDCard = new StringBuilder();
//fine 29-10-2018
if (testoSwipCard.toString().length() > 0) {
statoCardLettore = true;
final Timer timer = new Timer();
final TimerTask task = new TimerTask() {
@Override
public void run() {
String tessera = "";
//per tessere tipo 8 e 9
if (testoSwipCard.toString().contains("ì")) {
String[] txt = testoSwipCard.toString().split("ì");
// per tessera MASTERCARD CARDHOLDER
if (testoSwipCard.toString().length() > 30) {
tessera = txt[0].trim().replace("_", "");
} else {
tessera = txt[1].trim().replace("_", "");
}
} else if (testoSwipCard.toString().contains("&")) {
// per tessera MASTERCARD CARDHOLDER
String[] txt = testoSwipCard.toString().split("&");
tessera = txt[0].trim().replace("%B", "");
} else {
tessera = testoSwipCard.toString().trim().replace("_", "");
}
//per tessera tipo 3
if (tessera.length() >= 17 && tessera.length() <= 19) {
tessera = tessera.substring(0, 7);
}
//per tessere tipo 6 e 7
if (tessera.length() == 21) {
tessera = tessera.substring(0, 10);
int posI = 0;
for (int i = 0; i <= tessera.length(); i++) {
if (tessera.substring(i, i + 1).equalsIgnoreCase("0") == false) {
posI = i;
break;
}
}
tessera = tessera.substring(posI);
}
spiaAltreCarte = false;
swip = false;
if (pnlLogin.isVisible()) {
controllaLogInCarta(tessera);
} else {
//05/11/2018 le nuove tessere con CF a volte leggono solo la matricola
jTxtTessera.setText(tessera);
passaggioTessera = true;
logNumeroTessera = tessera;
cercaTessera();
}
testoSwipCard = new StringBuilder();
timer.cancel();
timer.purge();
statoCardLettore = false;
}
};
timer.schedule(task, delaySwipCard);
}
}
};
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(keyDispatcher);
keyDespatcherAttivo = true;
verificaDB();
} catch (Exception e) {
e.printStackTrace();
}
// -----------------------------------------------------------------------
// *** Aggiunge un timer con relativa schedulazione a 5 secondi
// -----------------------------------------------------------------------
timerDBConn mt = new timerDBConn(this);
java.util.Timer timer = new java.util.Timer();
timer.schedule(mt, 0, 5000);
verificaAggiornamentiJAR();
}
private void verificaAggiornamentiJAR() {
try {
String pathURLAggiornamento = mySelect("Select Valore from Parametri where chiave='UrlJAR' ", "Valore");
if (pathURLAggiornamento.length() > 0) {
String startDir = System.getProperty("user.dir");
URL url = new URL(pathURLAggiornamento);
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
Date d = new Date(httpCon.getLastModified());
System.out.println(' ' + d.toString());
File fileAttuale = new File(startDir + "/Cassa.jar");
Date dataUltimaModificaJarCorrente = new Date(fileAttuale.lastModified());
if (d.after(dataUltimaModificaJarCorrente)) {
if (JOptionPane.showConfirmDialog(null, "Aggiornamento disponibile. Aggiornare?", "Aggiornamento",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
System.out.print("Aggiorna.............");
Runtime.getRuntime().exec("java -jar " + startDir + "/Aggiornamento.jar " + startDir + " " + pathURLAggiornamento);
System.exit(0);
}
}
}
} catch (IOException ex) {
LogManager.getLogger(PuntoCassa.class.getName()).error(ex);
}
}
private void updateReaderCombo() {
try {
MyApplication myApp = new MyApplication();
jcmbSC.setModel(new DefaultComboBoxModel(myApp.smartCard.listReaders()));
} catch (Exception ex) {
LogManager.getLogger(PuntoCassa.class.getName()).error(ex);
}
}
/*private void scaricaImmagini() {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
Statement st;
ResultSet rs;
String sql = "SELECT distinct prodotti.id FROM prodotti "
+ "inner join catalogo_punti_cassa on prodotti.id=CATALOGO_PUNTI_CASSA.ID_Prodotto "
+ "WHERE prodotti.nome IS NOT NULL "
+ "and CATALOGO_PUNTI_CASSA.id_Punto_Cassa=" + idPuntoCassa;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
getImage(rs.getString("id"));
}
st.close();
rs.close();
dbConnection.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Errore Scarico Immagini " + e.getMessage(), "scaricaImmagini", JOptionPane.ERROR_MESSAGE);
}
this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}*/
private Integer calcolaLarghezzaAltezza(Integer larControllo, Integer percentuale) {
Integer d = percentuale - 100;
if (d == 0) {
return larControllo;
} else {
Integer n = larControllo + ((larControllo * d) / 100);
return n;
}
}
/**
* 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
pnlErrore = new javax.swing.JPanel();
lblMessaggioErrore = new javax.swing.JLabel();
pnlTop = new javax.swing.JPanel();
pnlCliente = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
lblCodice1 = new javax.swing.JLabel();
lblSaldo = new javax.swing.JLabel();
lblCodice2 = new javax.swing.JLabel();
lblPunti = new javax.swing.JLabel();
jTxtTessera = new javax.swing.JTextField();
btnImpostaCliente = new javax.swing.JButton();
jBtnReadCard = new javax.swing.JButton();
jcmbSC = new javax.swing.JComboBox();
lblCodice3 = new javax.swing.JLabel();
lblTipoPagamento = new javax.swing.JLabel();
lblCodice4 = new javax.swing.JLabel();
lblResiduo = new javax.swing.JLabel();
lblCodice5 = new javax.swing.JLabel();
lblGratuita = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
lblCodice = new javax.swing.JLabel();
lblCategoria = new javax.swing.JLabel();
lblDenominazione = new javax.swing.JLabel();
lblCognome = new javax.swing.JLabel();
lblOrganizzazione = new javax.swing.JLabel();
lblNome = new javax.swing.JLabel();
lblOrganizzazione1 = new javax.swing.JLabel();
lblNascita = new javax.swing.JLabel();
lblOrganizzazione2 = new javax.swing.JLabel();
lblScadTessera = new javax.swing.JLabel();
lblOrganizzazione3 = new javax.swing.JLabel();
lblAzienda = new javax.swing.JLabel();
lblOrganizzazione4 = new javax.swing.JLabel();
lblConvenzione = new javax.swing.JLabel();
lblOrganizzazione5 = new javax.swing.JLabel();
lblFascia = new javax.swing.JLabel();
pnlCategorie = new javax.swing.JPanel();
pnlConto = new javax.swing.JPanel();
jbtnDuplica = new javax.swing.JButton();
jbtnElimina = new javax.swing.JButton();
jbtnAnnulla = new javax.swing.JButton();
jbtnSu = new javax.swing.JButton();
jbtnGiu = new javax.swing.JButton();
txtTotaleCassa = new javax.swing.JTextField();
jbtnChiudi = new javax.swing.JButton();
jbtnStampa = new javax.swing.JButton();
txtTotalePunti = new javax.swing.JTextField();
pnlAzioni = new javax.swing.JPanel();
jBtnStorno = new javax.swing.JButton();
jBtnAsporto = new javax.swing.JToggleButton();
jBtnprodotti = new javax.swing.JButton();
jBtnMovimenti = new javax.swing.JButton();
jBtnBuoni = new javax.swing.JButton();
jTBP0 = new javax.swing.JToggleButton();
jTBP1 = new javax.swing.JToggleButton();
jTBP2 = new javax.swing.JToggleButton();
jTBP3 = new javax.swing.JToggleButton();
jbtnEsci = new javax.swing.JButton();
pnlLista = new javax.swing.JPanel();
scpLista = new javax.swing.JScrollPane();
tblLista = new javax.swing.JTable();
pnlProdotti = new javax.swing.JPanel();
pnlLista1 = new javax.swing.JPanel();
scpLista1 = new javax.swing.JScrollPane();
tblLista1 = new javax.swing.JTable();
pnlLogin = new javax.swing.JPanel();
btnLogin = new javax.swing.JButton();
txtUsername = new javax.swing.JTextField();
lblUsername = new javax.swing.JLabel();
lblPassword = new javax.swing.JLabel();
txtPassword = new javax.swing.JPasswordField();
btnTermina = new javax.swing.JButton();
jChLogin = new javax.swing.JCheckBox();
jBtnDB1 = new javax.swing.JButton();
lblUtenteLoggato = new javax.swing.JLabel();
lblStatoConnessione = new javax.swing.JLabel();
lblInfo = new javax.swing.JLabel();
lblInfo2 = new javax.swing.JLabel();
lblDB = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Prova di titolo");
setName("frmPrincipale"); // NOI18N
setResizable(false);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
resizeRules(evt);
}
});
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
public void windowDeiconified(java.awt.event.WindowEvent evt) {
formWindowDeiconified(evt);
}
});
getContentPane().setLayout(null);
pnlErrore.setBackground(new java.awt.Color(255, 255, 153));
pnlErrore.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
pnlErrore.setLayout(null);
lblMessaggioErrore.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblMessaggioErrore.setText("lblMessaggioErrore");
lblMessaggioErrore.setToolTipText("");
lblMessaggioErrore.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
lblMessaggioErrore.setName("lblMessaggioErrore"); // NOI18N
pnlErrore.add(lblMessaggioErrore);
lblMessaggioErrore.setBounds(96, 24, 600, 240);
getContentPane().add(pnlErrore);
pnlErrore.setBounds(0, 0, 0, 0);
pnlTop.setName("pnlTop"); // NOI18N
pnlTop.setLayout(null);
pnlCliente.setToolTipText("");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Tessera"));
lblCodice1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblCodice1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice1.setText("Saldo:");
lblSaldo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblSaldo.setText("[...]");
lblCodice2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblCodice2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice2.setText("Punti:");
lblPunti.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblPunti.setText("[...]");
jTxtTessera.setToolTipText("");
jTxtTessera.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTxtTesseraFocusGained(evt);
}
});
btnImpostaCliente.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnImpostaCliente.setText("Imposta");
btnImpostaCliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnImpostaClienteActionPerformed(evt);
}
});
jBtnReadCard.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jBtnReadCard.setText("Leggi Tessera");
jBtnReadCard.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnReadCardActionPerformed(evt);
}
});
jcmbSC.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
lblCodice3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblCodice3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice3.setText("Tipo Pagamento:");
lblTipoPagamento.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblTipoPagamento.setText("[...]");
lblCodice4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblCodice4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice4.setText("Residuo:");
lblResiduo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblResiduo.setText("[...]");
lblCodice5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblCodice5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice5.setText("Gratuità Residue:");
lblGratuita.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblGratuita.setText("[...]");
lblGratuita.setName(""); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblCodice2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCodice1, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))
.addGap(8, 8, 8)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPunti, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblSaldo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblCodice3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCodice4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCodice5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblResiduo, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
.addComponent(lblTipoPagamento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblGratuita, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)))
.addComponent(btnImpostaCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
.addComponent(jTxtTessera)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(jBtnReadCard, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jcmbSC, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jcmbSC, javax.swing.GroupLayout.PREFERRED_SIZE, 3, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBtnReadCard, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTxtTessera, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnImpostaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblSaldo)
.addComponent(lblCodice1, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblPunti)
.addComponent(lblCodice2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblTipoPagamento)
.addComponent(lblCodice3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblResiduo)
.addComponent(lblCodice4, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCodice5)
.addComponent(lblGratuita)))
);
lblCodice5.getAccessibleContext().setAccessibleName("Gtratuità Residue:");
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Cliente"));
lblCodice.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblCodice.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblCodice.setText("Categoria:");
lblCategoria.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblCategoria.setText("[...]");
lblDenominazione.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblDenominazione.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblDenominazione.setText("Cognome:");
lblCognome.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblCognome.setText("[...]");
lblOrganizzazione.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblOrganizzazione.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione.setText("Nome:");
lblNome.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblNome.setText("[...]");
lblOrganizzazione1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblOrganizzazione1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione1.setText("Data Nascita:");
lblNascita.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblNascita.setText("[...]");
lblOrganizzazione2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblOrganizzazione2.setForeground(new java.awt.Color(255, 0, 0));
lblOrganizzazione2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione2.setText("Bonus Residui:");
lblScadTessera.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblScadTessera.setForeground(new java.awt.Color(255, 0, 0));
lblScadTessera.setText("[...]");
lblOrganizzazione3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblOrganizzazione3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione3.setText("Azienda:");
lblAzienda.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblAzienda.setText("[...]");
lblOrganizzazione4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblOrganizzazione4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione4.setText("Convenzione:");
lblConvenzione.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
lblConvenzione.setText("[...]");
lblOrganizzazione5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblOrganizzazione5.setForeground(new java.awt.Color(255, 0, 0));
lblOrganizzazione5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblOrganizzazione5.setText("Fascia:");
lblFascia.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
lblFascia.setForeground(new java.awt.Color(255, 0, 0));
lblFascia.setText("[...]");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(lblOrganizzazione5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblOrganizzazione4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblOrganizzazione3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblOrganizzazione2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCodice, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblDenominazione, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblOrganizzazione, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblOrganizzazione1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblConvenzione, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
.addComponent(lblAzienda, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblScadTessera, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblNascita, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblNome, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCognome, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCategoria, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblFascia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCodice)
.addComponent(lblCategoria))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblDenominazione)
.addComponent(lblCognome))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblNome)
.addComponent(lblOrganizzazione))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblOrganizzazione1)
.addComponent(lblNascita))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblOrganizzazione3)
.addComponent(lblAzienda))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblOrganizzazione4)
.addComponent(lblConvenzione))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblOrganizzazione5)
.addComponent(lblFascia))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblOrganizzazione2)
.addComponent(lblScadTessera))
.addGap(6, 6, 6))
);
javax.swing.GroupLayout pnlClienteLayout = new javax.swing.GroupLayout(pnlCliente);
pnlCliente.setLayout(pnlClienteLayout);
pnlClienteLayout.setHorizontalGroup(
pnlClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlClienteLayout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pnlClienteLayout.setVerticalGroup(
pnlClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pnlTop.add(pnlCliente);
pnlCliente.setBounds(0, 0, 660, 140);
pnlCliente.getAccessibleContext().setAccessibleDescription("Cliente");
pnlCliente.getAccessibleContext().setAccessibleParent(pnlCliente);
pnlCategorie.setBackground(new java.awt.Color(255, 204, 204));
pnlCategorie.setBorder(javax.swing.BorderFactory.createTitledBorder("Categoria"));
pnlCategorie.setLayout(new java.awt.GridLayout(10, 1, 1, 1));
pnlTop.add(pnlCategorie);
pnlCategorie.setBounds(0, 0, 9, 32);
pnlConto.setBackground(new java.awt.Color(255, 255, 153));
pnlConto.setBorder(javax.swing.BorderFactory.createTitledBorder("Conto"));
pnlConto.setLayout(new java.awt.GridLayout(3, 0, 2, 2));
jbtnDuplica.setBackground(new java.awt.Color(140, 240, 240));
jbtnDuplica.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jbtnDuplica.setEnabled(false);
jbtnDuplica.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnDuplicaActionPerformed(evt);
}
});
pnlConto.add(jbtnDuplica);
jbtnElimina.setBackground(new java.awt.Color(140, 240, 240));
jbtnElimina.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jbtnElimina.setToolTipText("");
jbtnElimina.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnEliminaActionPerformed(evt);
}
});
pnlConto.add(jbtnElimina);
jbtnAnnulla.setBackground(new java.awt.Color(140, 240, 240));
jbtnAnnulla.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jbtnAnnulla.setText("Annulla");
jbtnAnnulla.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnAnnullaActionPerformed(evt);
}
});
pnlConto.add(jbtnAnnulla);
jbtnSu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnSuActionPerformed(evt);
}
});
pnlConto.add(jbtnSu);
jbtnGiu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnGiuActionPerformed(evt);
}
});
pnlConto.add(jbtnGiu);
txtTotaleCassa.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
txtTotaleCassa.setForeground(new java.awt.Color(242, 0, 0));
txtTotaleCassa.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTotaleCassa.setText("€ 0,00");
txtTotaleCassa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtTotaleCassaActionPerformed(evt);
}
});
pnlConto.add(txtTotaleCassa);
jbtnChiudi.setBackground(new java.awt.Color(51, 255, 51));
jbtnChiudi.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jbtnChiudi.setText("Chiudi");
jbtnChiudi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnChiudiActionPerformed(evt);
}
});
pnlConto.add(jbtnChiudi);
jbtnStampa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnStampaActionPerformed(evt);
}
});
pnlConto.add(jbtnStampa);
txtTotalePunti.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
txtTotalePunti.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTotalePunti.setText("Punti 0");
txtTotalePunti.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtTotalePuntiActionPerformed(evt);
}
});
pnlConto.add(txtTotalePunti);
pnlTop.add(pnlConto);
pnlConto.setBounds(286, 150, 257, 120);
pnlAzioni.setBackground(new java.awt.Color(255, 204, 204));
pnlAzioni.setBorder(javax.swing.BorderFactory.createTitledBorder("Azioni"));
pnlAzioni.setLayout(new java.awt.GridLayout(2, 6, 2, 2));
jBtnStorno.setToolTipText("Storno");
jBtnStorno.setMargin(new java.awt.Insets(2, 2, 2, 2));
jBtnStorno.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
jBtnStorno.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnStornoActionPerformed(evt);
}
});
pnlAzioni.add(jBtnStorno);
jBtnAsporto.setToolTipText("Modalità");
jBtnAsporto.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnAsportoActionPerformed(evt);
}
});
pnlAzioni.add(jBtnAsporto);
jBtnprodotti.setToolTipText("Prodotti");
jBtnprodotti.setMargin(new java.awt.Insets(2, 2, 2, 2));
jBtnprodotti.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnprodottiActionPerformed(evt);
}
});
pnlAzioni.add(jBtnprodotti);
jBtnMovimenti.setToolTipText("Ultimi movimenti");
jBtnMovimenti.setMargin(new java.awt.Insets(2, 2, 2, 2));
jBtnMovimenti.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnMovimentiActionPerformed(evt);
}
});
pnlAzioni.add(jBtnMovimenti);
jBtnBuoni.setToolTipText("");
jBtnBuoni.setMargin(new java.awt.Insets(2, 2, 2, 2));
jBtnBuoni.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnBuoniActionPerformed(evt);
}
});
pnlAzioni.add(jBtnBuoni);
jTBP0.setToolTipText("A Scalare");
jTBP0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTBP0ActionPerformed(evt);
}
});
pnlAzioni.add(jTBP0);
jTBP1.setToolTipText("Contanti");
jTBP1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTBP1ActionPerformed(evt);
}
});
pnlAzioni.add(jTBP1);
jTBP2.setToolTipText("Ticket");
jTBP2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTBP2ActionPerformed(evt);
}
});
pnlAzioni.add(jTBP2);
jTBP3.setToolTipText("Differito");
jTBP3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTBP3ActionPerformed(evt);
}
});
pnlAzioni.add(jTBP3);
jbtnEsci.setBackground(new java.awt.Color(255, 255, 0));
jbtnEsci.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jbtnEsci.setText("Esci");
jbtnEsci.setToolTipText("Esci");
jbtnEsci.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnEsciActionPerformed(evt);
}
});
pnlAzioni.add(jbtnEsci);
pnlTop.add(pnlAzioni);
pnlAzioni.setBounds(0, 153, 378, 73);
pnlLista.setBackground(new java.awt.Color(204, 255, 204));
pnlLista.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
pnlLista.setLayout(new javax.swing.BoxLayout(pnlLista, javax.swing.BoxLayout.LINE_AXIS));
scpLista.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
tblLista.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tblLista.setName("jtbl"); // NOI18N
scpLista.setViewportView(tblLista);
pnlLista.add(scpLista);
pnlTop.add(pnlLista);
pnlLista.setBounds(288, 0, 140, 144);
pnlProdotti.setBackground(new java.awt.Color(204, 255, 204));
pnlProdotti.setBorder(javax.swing.BorderFactory.createTitledBorder("Prodotto"));
pnlProdotti.setLayout(new java.awt.GridLayout(6, 2, 2, 2));
pnlTop.add(pnlProdotti);
pnlProdotti.setBounds(0, 0, 8, 33);
pnlLista1.setBackground(new java.awt.Color(204, 255, 204));
pnlLista1.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
pnlLista1.setLayout(new javax.swing.BoxLayout(pnlLista1, javax.swing.BoxLayout.LINE_AXIS));
scpLista1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
tblLista1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tblLista1.setName("jtbl"); // NOI18N
scpLista1.setViewportView(tblLista1);
pnlLista1.add(scpLista1);
pnlTop.add(pnlLista1);
pnlLista1.setBounds(288, 0, 140, 144);
pnlLista1.getAccessibleContext().setAccessibleName("Lista1");
getContentPane().add(pnlTop);
pnlTop.setBounds(0, 188, 0, 0);
pnlTop.getAccessibleContext().setAccessibleName("pnlTop");
pnlTop.getAccessibleContext().setAccessibleDescription("");
pnlLogin.setBackground(new java.awt.Color(255, 255, 153));
pnlLogin.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Accesso al sistema", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N
pnlLogin.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnLogin.setText("Login");
btnLogin.setEnabled(false);
btnLogin.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnLogin.setName("btnLogin"); // NOI18N
btnLogin.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
btnLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLoginActionPerformed(evt);
}
});
txtUsername.setEnabled(false);
txtUsername.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtUsernameFocusGained(evt);
}
});
txtUsername.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtUsernameMouseClicked(evt);
}
});
lblUsername.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblUsername.setText("Username");
lblUsername.setToolTipText("");
lblPassword.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
lblPassword.setText("Password");
txtPassword.setEnabled(false);
txtPassword.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
txtPasswordFocusGained(evt);
}
});
txtPassword.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtPasswordMouseClicked(evt);
}
});
btnTermina.setIcon(new javax.swing.ImageIcon(getClass().getResource("/puntocassa/esci2.jpg"))); // NOI18N
btnTermina.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
btnTermina.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnTermina.setLabel(" Termina Programma");
btnTermina.setName("btnTermina"); // NOI18N
btnTermina.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnTerminaActionPerformed(evt);
}
});
jChLogin.setBackground(new java.awt.Color(255, 255, 153));
jChLogin.setSelected(true);
jChLogin.setText("Login con tessera");
jChLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jChLoginActionPerformed(evt);
}
});
jBtnDB1.setToolTipText("DB");
jBtnDB1.setMargin(new java.awt.Insets(2, 2, 2, 2));
jBtnDB1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnDB1ActionPerformed(evt);
}
});
javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin);
pnlLogin.setLayout(pnlLoginLayout);
pnlLoginLayout.setHorizontalGroup(
pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlLoginLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblUsername, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPassword)
.addComponent(txtUsername)
.addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(pnlLoginLayout.createSequentialGroup()
.addComponent(jChLogin)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jBtnDB1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnTermina, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 262, Short.MAX_VALUE))
.addContainerGap())
);
pnlLoginLayout.setVerticalGroup(
pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlLoginLayout.createSequentialGroup()
.addComponent(jChLogin)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblUsername))
.addGap(10, 10, 10)
.addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPassword))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBtnDB1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnTermina, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
getContentPane().add(pnlLogin);
pnlLogin.setBounds(0, 70, 360, 220);
pnlLogin.getAccessibleContext().setAccessibleName("pnlLogin");
pnlLogin.getAccessibleContext().setAccessibleDescription("");
lblUtenteLoggato.setText("[Nessun utente connesso]");
lblUtenteLoggato.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblUtenteLoggato.setAlignmentY(0.0F);
lblUtenteLoggato.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblUtenteLoggato.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
getContentPane().add(lblUtenteLoggato);
lblUtenteLoggato.setBounds(20, 310, 130, 20);
lblStatoConnessione.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblStatoConnessione.setText("[Nessuna connessione]");
lblStatoConnessione.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblStatoConnessione.setAlignmentY(0.0F);
lblStatoConnessione.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblStatoConnessione.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
getContentPane().add(lblStatoConnessione);
lblStatoConnessione.setBounds(425, 340, 120, 20);
lblInfo.setText("[Info Turno]");
lblInfo.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblInfo.setAlignmentY(0.0F);
lblInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblInfo.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
getContentPane().add(lblInfo);
lblInfo.setBounds(180, 340, 130, 20);
lblInfo2.setText("[Info Incassi]");
lblInfo2.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblInfo2.setAlignmentY(0.0F);
lblInfo2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
lblInfo2.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
getContentPane().add(lblInfo2);
lblInfo2.setBounds(160, 310, 130, 20);
lblDB.setBackground(new java.awt.Color(51, 255, 0));
lblDB.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblDB.setText("DB");
lblDB.setOpaque(true);
getContentPane().add(lblDB);
lblDB.setBounds(604, 360, 20, 20);
getAccessibleContext().setAccessibleName("frmPrincipale");
getAccessibleContext().setAccessibleDescription("");
getAccessibleContext().setAccessibleParent(this);
setBounds(0, 0, 857, 531);
}// </editor-fold>//GEN-END:initComponents
// ==========================================================================
// ** Imposta dimensioni e posizione dei panel
// ==========================================================================
private void resize() {
int x, y, w, h, tw, th;
// -----------------------------------------------------------------------
// *** Dimensioni del frame
// -----------------------------------------------------------------------
this.setSize(displayWidth, displayHeight);
tw = this.getWidth();
th = this.getHeight();
// -----------------------------------------------------------------------
// *** Posizione della status bar
// -----------------------------------------------------------------------
x = 0;
y = th - 50;
w = (tw / 8);
h = 50;
lblUtenteLoggato.setLocation(x, y);
lblUtenteLoggato.setSize(w, h);
lblInfo.setLocation(w, y);
lblInfo.setSize(w * 2 + 60 - lblDB.getWidth(), h);
lblInfo2.setLocation(w * 3 + 60 - lblDB.getWidth(), y);
// lblInfo2.setSize(tw - (w * 2 + 10) - 131, h);
int larg = tw - (w * 2 + 10) - 359;
lblInfo2.setSize(larg, h);
lblStatoConnessione.setLocation(tw - 181 - lblDB.getWidth(), y);
lblStatoConnessione.setSize(175, h);
lblDB.setLocation(tw - 181 - lblDB.getWidth() + lblStatoConnessione.getWidth(), y);
// -----------------------------------------------------------------------
// *** Posizione del panel Errore
// -----------------------------------------------------------------------
x = 0;
y = 0;
w = tw;
h = th - lblUtenteLoggato.getHeight();
pnlErrore.setLocation(x, y);
pnlErrore.setSize(w, h);
// -----------------------------------------------------------------------
// *** Posizione del panel Login
// -----------------------------------------------------------------------
x = 0;
y = 0;
w = pnlLogin.getWidth();
h = pnlLogin.getHeight();
pnlLogin.setLocation((int) (tw - w) / 2, (int) (th - h) / 2);
pnlLogin.setSize(w, h);
// -----------------------------------------------------------------------
// *** Posizione del panel Top (operativo)
// -----------------------------------------------------------------------
x = 0;
y = 0;
w = tw + 5;
h = th - lblUtenteLoggato.getHeight();
pnlTop.setLocation(x, y);
pnlTop.setSize(w, h);
// -----------------------------------------------------------------------
// *** Posizionamento degli oggetti nel panel Top (operativo)
// -----------------------------------------------------------------------
tw = pnlTop.getWidth();
th = pnlTop.getHeight();
// -----------------------------------------------------------------------
// ** Panel Categorie
// -----------------------------------------------------------------------
x = 0;
y = 0;
w = (int) (13 * tw / 100);
h = (int) (68 * th / 100);
pnlCategorie.setLocation(x, y);
pnlCategorie.setSize(w, h);
// -----------------------------------------------------------------------
// ** Panel Prodotti
// -----------------------------------------------------------------------
x = w;
y = 0;
w = (int) (57 * tw / 100);
h = (int) (68 * th / 100);
pnlProdotti.setLocation(x, y);
pnlProdotti.setSize(w, h);
// -----------------------------------------------------------------------
// ** Panel Lista
// -----------------------------------------------------------------------
x = x + w;
y = 0;
w = tw - x - 10;
h = (int) (25 * th / 100);
pnlLista.setLocation(x, y);
pnlLista.setSize(w, h);
scpLista.setLocation(0, 0);
scpLista.setSize(w, h);
scpLista.setBackground(Color.BLUE);
tblLista.setLocation(0, 0);
tblLista.setSize(w, h);
tblLista.setShowGrid(true);
int Col1 = (w / 100) * 80;
MyTableModel model = new MyTableModel();
String[] col = {"Prodotto", "Prezzo", "Punti"};
model.setColumname(col);
Object[][] data = null;
model.setRow(data);
tblLista.setModel(model);
tblLista.getColumnModel().getColumn(0).setPreferredWidth(Col1);
tblLista.getColumnModel().getColumn(1).setPreferredWidth(50);
tblLista.getColumnModel().getColumn(1).setCellRenderer(new DecimalFormatRenderer());
tblLista.getColumnModel().getColumn(2).setPreferredWidth(50);
tblLista.setVisible(true);
// -----------------------------------------------------------------------
// ** Panel Lista1
// -----------------------------------------------------------------------
y = h;
pnlLista1.setBorder(javax.swing.BorderFactory.createTitledBorder("Composizione"));
pnlLista1.setLocation(x, y);
pnlLista1.setSize(w, 70);
scpLista1.setLocation(0, 0);
scpLista1.setSize(w, h);
scpLista1.setBackground(Color.BLUE);
tblLista1.setLocation(0, 0);
tblLista1.setSize(w, h);
tblLista1.setShowGrid(true);
MyTableModel model1 = new MyTableModel();
String[] colVassoio = {"Vassoio", "Prezzo"};
model1.setColumname(colVassoio);
Object[][] data1 = null;
model1.setRow(data1);
tblLista1.setModel(model1);
tblLista1.getColumnModel().getColumn(0).setPreferredWidth(Col1);
tblLista1.getColumnModel().getColumn(1).setPreferredWidth(50);
tblLista1.setVisible(true);
// -----------------------------------------------------------------------
// ** Panel Cliente
// -----------------------------------------------------------------------
x = 0;
y = pnlCategorie.getHeight();
w = pnlCategorie.getWidth() + pnlProdotti.getWidth() - 120;
//h = pnlConto.getHeight();
h = th - pnlProdotti.getHeight();
pnlCliente.setLocation(x, y);
pnlCliente.setSize(w, h);
// -----------------------------------------------------------------------
// ** Panel Conto
// -----------------------------------------------------------------------
x = pnlLista.getX();//pnlAzioni.getWidth();
y = pnlLista.getHeight() + pnlLista1.getHeight();
w = pnlLista.getWidth();
h = 220;//th-y;
pnlConto.setLocation(x, y);
pnlConto.setSize(w, h - 10);
ImageIcon icon = new ImageIcon(imgPath + "freccia_down.jpg");
Image img = icon.getImage();
Image newimg = img.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
icon = new ImageIcon(newimg);
jbtnGiu.setIcon(icon);
ImageIcon icon2 = new ImageIcon(imgPath + "freccia_up.jpg");
Image img2 = icon2.getImage();
Image newimg2 = img2.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
icon2 = new ImageIcon(newimg2);
jbtnSu.setIcon(icon2);
ImageIcon icon3 = new ImageIcon(imgPath + "ticket2.png");
Image img3 = icon3.getImage();
Image newimg3 = img3.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
icon3 = new ImageIcon(newimg3);
jBtnBuoni.setIcon(icon3);
ImageIcon iconFulmine = new ImageIcon(imgPath + "fulmine.jpg");
Image imgF = iconFulmine.getImage();
Image newimgF = imgF.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
iconFulmine = new ImageIcon(newimgF);
jbtnStampa.setIcon(iconFulmine);
// -----------------------------------------------------------------------
// ** Panel Azioni
// -----------------------------------------------------------------------
//x = 0;
x = pnlLista.getX() - 120;
y = pnlConto.getY() + pnlConto.getHeight();//pnlProdotti.getHeight() + pnlCliente.getHeight();
w = pnlLista.getWidth() + 120; //pnlCategorie.getWidth() + pnlProdotti.getWidth();
h = th - (pnlLista.getHeight() + pnlLista1.getHeight() + pnlConto.getHeight()); //th-y;
pnlAzioni.setLocation(x, y);
pnlAzioni.setSize(w, h);
// -----------------------------------------------------------------------
// *** Refresh dell'interfaccia
// -----------------------------------------------------------------------
this.revalidate();
this.repaint();
}
// ==========================================================================
// *** Metodo per gestire gli eventi sui button dinamici
// ==========================================================================
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
String tipo;
String id;
String sql = "";
Statement st;
ResultSet rs;
int i, j, k;
// JButton b;
i = cmd.indexOf("[");
j = cmd.indexOf("]");
id = cmd.substring(i + 1, j);
tipo = cmd.substring(0, i);
switch (tipo) {
case "CATEGORIA":
pulsantiCategoria(id, cmd);
break;
case "PRODOTTO":
if (isCassaAperta) {
sql = "SELECT "
+ "prodotti.id as idProdotto,"
+ "prodotti.nome, "
+ "prodotti.prezzo_base,"
+ "tariffe.Punti as Punti_Base,"
+ "tariffe.prezzo as Prezzo,"
+ "tariffe.punti as Punti,"
+ "prodotti.id_Categoria "
+ "FROM prodotti "
+ "left join tariffe on prodotti.id=tariffe.id_prodotto "
+ "where prodotti.id = " + id + " and Tariffe.id_fascia=" + idProfiloTariffario;
try {
//spengo altri togglebutton
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
JToggleButton bt = (JToggleButton) this.pnlProdotti.getComponent(y);
if (!bt.getActionCommand().equals(cmd)) {
bt.setSelected(false);
}
}
jbtnSu.setEnabled(true);
jbtnGiu.setEnabled(true);
jbtnElimina.setEnabled(true);
jbtnAnnulla.setEnabled(true);
doLayout();
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement();
rs = st.executeQuery(sql);
MyTableModel model = (MyTableModel) tblLista.getModel();
while (rs.next()) {
Double prezzo = 0.0;
Integer punti = 0;
if (rs.getDouble("Prezzo") > 0) {
prezzo = rs.getDouble("Prezzo");
} else {
prezzo = rs.getDouble("prezzo_base");
}
if (rs.getDouble("Punti") > 0) {
punti = rs.getInt("Punti");
} else {
punti = rs.getInt("Punti_Base");
}
//14-01-2019
if (model.getRowCount() > 0) {
//è una composizione non la metto
if (rs.getLong("id_Categoria") == 0L) {
JOptionPane.showOptionDialog(this, "Composizione gia presente!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
return;
}
}
//21-12-8<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
model.addRow(new Object[]{rs.getString("nome"), prezzo, punti, rs.getLong("idProdotto"), prezzo, rs.getLong("id_Categoria")});
}
if (model.getRowCount() > 0) {
tblLista.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
}
tblLista.setModel(model);
controllaCompleti(model);
controllaExtra(model);
sommaColonne(model);
//inizio 21-12-18<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if (jbtnChiudi.isEnabled()) {
if (saldoAcquisti(0.0) == false
&& cercaTestoModoPagamento().equalsIgnoreCase("A scalare")
&& gratuitaResidue <= 0
&& (bonusResidui <= 0 || flagBonus == 0)
&& consentiCredito == false) {
JOptionPane.showOptionDialog(this, "Saldo tessera insufficiente!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
jbtnEliminaActionPerformed(null);
return;
}
} else {
if (idTessera != 0L) {
jbtnChiudi.setEnabled(true);
}
}
//fine 21-12-18<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//stessa procedura in Cercates
//prendo l'ultimo valore della griglia
if (model.getRowCount() > 0) {//
Double totAcquisto = 0.0;
try {
if (txtTotaleCassa.getText().length() > 0) {
String saldo = txtTotaleCassa.getText().replace("? ", "").replace(".", "");
saldo = saldo.replace(",", ".");
totAcquisto = Double.valueOf(saldo);
}
} catch (Exception ex) {
LogManager.getLogger(PuntoCassa.class).error(ex);
}
//DecimalFormat df2 = new DecimalFormat("##0.00");
//String prezzoDisplay = ("E " + df2.format(totAcquisto));
/*String fa = "FASCIA " + lblFascia.getText().replaceAll("Fascia", "").trim();
if (fa.length() >= 10) {
fa = fa.substring(fa.length() - 10, fa.length());
} else {
fa = spaziBianchi(fa, 10, true);
}*/
//String uProd = spaziBianchi("Totale ", 20, true);
}
rs.close();
st.close();
dbConnection.close();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
break;
default:
break;
}
}
private void pulsantiCategoria(String id, String cmd) {
for (Integer k = this.pnlProdotti.getComponentCount(); k > 0; k--) {
this.pnlProdotti.remove(k - 1);
}
this.caricaDati("PRODOTTI", id);
//spengo altri togglebutton
if (this.pnlCategorie.getComponentCount() > 2) {
for (Integer y = 0; y < this.pnlCategorie.getComponentCount(); y++) {
JToggleButton bt = (JToggleButton) this.pnlCategorie.getComponent(y);
if (!bt.getActionCommand().equals(cmd)) {
bt.setSelected(false);
} else {
if (bt.isSelected() == false) {
this.caricaPannello();
}
}
}
}
}
private Boolean saldoAcquisti(Double prezzo) {
Boolean ok = false;
Double saldoTessera = 0.0;
Double totAcquisto = 0.0;
try {
if (lblSaldo.getText().length() > 0) {
String saldo = lblSaldo.getText().replace("? ", "").trim().replace(".", "");
saldo = saldo.replace("[", "");
saldo = saldo.replace("]", "");
saldo = saldo.replace(",", ".");
if (saldo.length() > 0) {
saldoTessera = Double.valueOf(saldo);
}
}
if (txtTotaleCassa.getText().length() > 0) {
String totaleCassa = txtTotaleCassa.getText().replace("? ", "").replace(".", "");
totaleCassa = totaleCassa.replace(",", ".");
totAcquisto = Double.valueOf(totaleCassa);
}
} catch (Exception e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
Double s = saldoTessera - (totAcquisto + prezzo);
if (s >= saldoMinimoStop) {
ok = true;
}
return ok;
}
private void sommaColonne(MyTableModel model) {
Double t = model.somma(colImporto);
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
if (model2.getRowCount() > 0) {
t = t + model2.somma(1);
}
DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00");
txtTotaleCassa.setText("? " + df2.format(t));
int p = model.sommaInt(2);
txtTotalePunti.setText("Punti " + p);
//if(idModoPagamento==0L){
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare")) {
Double saldoCarta = 0.0;
if (lblSaldo.getText().trim().length() > 0) {
String saldo = lblSaldo.getText().replace("? ", "").trim().replace(".", "");
saldo = saldo.replace("[", "");
saldo = saldo.replace("]", "");
saldo = saldo.replace(",", ".");
if (saldo.length() > 0) {
saldoCarta = Double.valueOf(saldo);
}
}
saldoCarta = saldoCarta - t;
lblResiduo.setText("? " + df2.format(saldoCarta));
}
}
private void controllaExtra(MyTableModel model) {
if (flagExtra == false) {
for (int i = 0; i < model.getRowCount(); i++) {
Object row[] = model.getRow(i);
Double p = Double.valueOf(row[colImporto].toString());
if (p != 0) {
JOptionPane.showMessageDialog(this, "Composizione errata, questo prodotto sarà eliminato!");
jbtnEliminaActionPerformed(null);
break;
}
}
} else {
for (int i = 0; i < model.getRowCount(); i++) {
Object row[] = model.getRow(i);
Double p = Double.valueOf(row[colImporto].toString());
if (p != 0) {
JOptionPane.showMessageDialog(this, "Nella lista sono presenti degli extra!");
break;
}
}
}
}
//02/09/2021
private void controllaCompleti(MyTableModel model) {
if (passaggiEsauritiNoComposizione == true) {
return;
}
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
clearTable(model1);
Boolean composizionePresente = false;
StringBuilder sb = new StringBuilder();
//verifico se sono presenti composizioni
for (int i = 0; i < model.getRowCount(); i++) {
Object row[] = model.getRow(i);
Double p = Double.valueOf(row[4].toString());
model.setValueAt(p, i, colImporto);
sb.append(model.getValueAt(i, 3));
sb.append(",");
if (Long.parseLong(row[5].toString()) == 0L) {
composizionePresente = true;
if (gratuitaResidue > 0) {//Gratuita_ResidueProg
clearTable(model1);
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3)});
} else if (flagBonus == 1 && bonusResidui > 0) {
clearTable(model1);
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3)});
} else {
clearTable(model1);
model1.addRow(new Object[]{model.getValueAt(i, 0), model.getValueAt(i, 1), model.getValueAt(i, 3)});
}
model.setValueAt(0.0, i, colImporto);
}
}
doLayout();
if (composizionePresente == false && sb.toString().length() > 0) {
//azzero prezzi dei componenti della composizione
//23-09-22
for (int i = 0; i < model.getRowCount(); i++) {
model.setValueAt(0.00, i, colImporto);
}
String idVassoio = mySelect("SELECT seleziona_composizione('" + sb.toString().substring(0, sb.toString().length() - 1) + "') "
+ "as idCompleto from dual",
"idCompleto");
if (Long.parseLong(idVassoio) != -1) {
String nomeVassoio = mySelect("Select nome from vassoi where id=" + idVassoio, "nome");
String prezzo = mySelect("Select prezzo from tariffe where id_fascia=" + idProfiloTariffario + " "
+ "and id_prodotto=" + idVassoio, "prezzo");
clearTable(model1);
if (gratuitaResidue > 0) {//Gratuita_ResidueProg
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio});
} else if (flagBonus == 1 && bonusResidui > 0) {
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio});
} else {
model1.addRow(new Object[]{nomeVassoio, prezzo, idVassoio});
}
//azzero elemento appena inserito se fa parte di una composizione
model.setValueAt(0.00, model.getRowCount() - 1, colImporto);
doLayout();
} else {
JOptionPane.showMessageDialog(this, "Composizione errata, questo prodotto sarà eliminato!");
jbtnEliminaActionPerformed(null);
}
// }
}
if (composizionePresente == true && sb.toString().length() > 0 && model.getRowCount() > 1) {
JOptionPane.showMessageDialog(this, "Composizione presente, questo prodotto sarà eliminato!");
jbtnEliminaActionPerformed(null);
}
}
// ======================Com====================================================
// ** Carica i dati di base per la maschera principale
// ==========================================================================
public void caricaDati(String tipo, String id) {
String sql = "";
String azione = "";
String nome = "";
Statement st;
ResultSet rs;
JToggleButton b;
JPanel pnl = this.pnlCategorie;
switch (tipo) {
case "CATEGORIE" -> {
sql = "SELECT distinct c.id, c.nome, c.descrizione FROM categorie_prodotti c "
+ " INNER JOIN prodotti p ON p.id_categoria = c.ID "
+ " INNER JOIN catalogo_punti_cassa l ON l.id_prodotto = p.ID "
+ " INNER JOIN punti_cassa x ON l.id_punto_cassa = x.ID "
+ " WHERE x.id =" + idPuntoCassa + " order by c.descrizione";
System.out.println(sql);
azione = "CATEGORIA";
pnl = this.pnlCategorie;
}
case "PRODOTTI" -> {
sql = "SELECT p.ID, p.nome, NVL (t.prezzo, p.prezzo_base) AS prezzo,NVL (t.punti, 0) AS punti FROM prodotti p , tariffe t, catalogo_punti_cassa c "
+ " WHERE p.id_categoria = " + id
+ " AND t.id_prodotto = p.id "
+ " AND t.id_fascia = " + idProfiloTariffario
+ " AND c.id_prodotto = p.id AND c.id_punto_cassa =" + idPuntoCassa
+ " ORDER BY p.flag_catalogo_variabile desc, p.nome";
System.out.println(sql);
azione = "PRODOTTO";
pnl = this.pnlProdotti;
}
}
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = st.executeQuery(sql);
if (tipo.equalsIgnoreCase("CATEGORIE")) {
int rowcount = 0;
while (rs.next()) {
rowcount++;
}
if (rowcount > 0) {
numeroCategorie = rowcount;
rs.beforeFirst();
pnl.setLayout(new GridLayout(rowcount + 1, 1, 1, 1));
}
}
pnl.removeAll();
while (rs.next()) {
nome = "<html>" + rs.getString("nome") + "</html>";
b = new JToggleButton(nome);
b.setEnabled(isCassaAperta);
b.setHorizontalAlignment(SwingConstants.CENTER);
b.setVerticalAlignment(SwingConstants.CENTER);
b.setVerticalTextPosition(SwingConstants.CENTER);
b.setText(nome);
b.setName(rs.getString("id"));
b.setActionCommand(azione + "[" + rs.getString("id") + "]");
b.addActionListener(this);
b.setVisible(true);
if (tipo.equalsIgnoreCase("CATEGORIE")) {
Font f = new Font("Tahoma", Font.BOLD, 14);
b.setFont(f);
b.setForeground(Color.RED);
}
pnl.add(b);
}
if (tipo.equalsIgnoreCase("CATEGORIE")) {
JToggleButton bGost = new JToggleButton("[DEFAULT]");
bGost.setName("btnDefault");
Font f = new Font("Tahoma", Font.BOLD, 14);
bGost.setFont(f);
bGost.setForeground(Color.RED);
bGost.setActionCommand("CATEGORIA[0]");
bGost.addActionListener(this);
bGost.setVisible(false);
pnl.add(bGost);
}
this.revalidate();
this.repaint();
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
}
}
public void caricaPannello() {
String azione = "PRODOTTO";
String where = "";
Statement st;
ResultSet rs;
String sql = "select * from (SELECT p.ID, p.nome, NVL (t.prezzo, p.prezzo_base) AS prezzo,NVL (t.punti, 0) AS punti,cat.nome as Categoria ";
String sql2 = " FROM prodotti p , tariffe t, catalogo_punti_cassa c,categorie_prodotti cat "
+ " WHERE p.flag_catalogo_variabile = 1"
+ " AND p.id_categoria = cat.id "
+ " AND t.id_prodotto = p.id "
+ " AND t.id_fascia = " + idProfiloTariffario
+ " AND c.id_prodotto = p.id AND c.id_punto_cassa =" + idPuntoCassa;
MyApplication myApp = new MyApplication();
String nrec = myApp.mySelect(this, "SELECT count(*) as nrec " + sql2, "nrec");
if (Integer.parseInt(nrec) <= 0) {
menuGiornoPresente = false;
String idComposizione = myApp.mySelect(this, "select id from Categorie_Prodotti where Upper(Nome)='COMPOSIZIONE'", "id");
caricaDati("PRODOTTI", idComposizione);
} else {
menuGiornoPresente = true;
sql = sql + sql2;
}
JPanel pnl = this.pnlProdotti;
pnl.setLayout(new GridLayout(6, 5, 1, 1));
pnl.removeAll();
for (Integer r = 0; r < 6; r++) {
Color c2 = new Color(255, 153, 255);
switch (r) {
case 0 -> where = " and upper(cat.CODICE)='PRIM' ";
case 1 -> {
where = " and upper(cat.CODICE)='SECO' ";
c2 = Color.CYAN;
}
case 2 -> {
where = " and upper(cat.CODICE)='CONT' ";
c2 = new Color(146, 208, 80);
}
case 3 -> {
where = " and upper(cat.CODICE)='DESS' ";
c2 = Color.yellow;
}
case 4 -> {
where = " and (upper(cat.CODICE)='INSA' OR upper(cat.CODICE)='UNI' OR upper(cat.CODICE)='UNR2') ";
c2 = Color.GREEN;
}
case 5 -> {
where = " and (upper(cat.CODICE)='SALA' OR upper(cat.CODICE)='PIZZ') ";
c2 = new Color(255, 217, 102);
}
}
Integer np = 0;
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = st.executeQuery(sql + where + " order by p.id) where ROWNUM <= 7");
Font f = new Font("Tahoma", Font.BOLD, 13);
String jolly = "";
String idJolly = "";
while (rs.next()) {
if (rs.getString("nome").toUpperCase().indexOf("JOLLY") >= 0) {
jolly = "<html>" + rs.getString("nome") + "</html>";
idJolly = rs.getString("id");
} else {
String nome = "<html>" + rs.getString("nome") + "</html>";
JToggleButton bt = new JToggleButton(nome);
bt.setBackground(c2);
bt.setEnabled(isCassaAperta);
bt.setFont(f);
Insets ins = new Insets(0, 0, 0, 0);
bt.setMargin(ins);
bt.setHorizontalAlignment(SwingConstants.LEFT);
bt.setVerticalAlignment(SwingConstants.TOP);
bt.setVerticalTextPosition(SwingConstants.TOP);
bt.setName(rs.getString("id"));
bt.setActionCommand(azione + "[" + rs.getString("id") + "]");
bt.addActionListener(this);
bt.setVisible(true);
pnl.add(bt);
np++;
if (np == 5) {
break;
}
}
}
for (Integer c = np; c < 6; c++) {
JToggleButton bt;
if (c == 5 && jolly.length() > 1) {
bt = new JToggleButton(jolly);
bt.setName(idJolly);
bt.setActionCommand(azione + "[" + idJolly + "]");
} else {
bt = new JToggleButton("");
bt.setName("0");
bt.setActionCommand(azione + "[0]");
}
bt.setBackground(c2);
bt.setFont(f);
bt.setEnabled(isCassaAperta);
Insets ins = new Insets(0, 0, 0, 0);
bt.setMargin(ins);
bt.setHorizontalAlignment(SwingConstants.LEFT);
bt.setVerticalAlignment(SwingConstants.TOP);
bt.setVerticalTextPosition(SwingConstants.TOP);
bt.addActionListener(this);
bt.setVisible(true);
pnl.add(bt);
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
}
this.revalidate();
this.repaint();
}
private void caricaModiPagamento() {
try {
Statement st;
ResultSet rs;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement();
rs = st.executeQuery("Select * from Tipi_Pagamenti order by id");
while (rs.next()) {
modiPagamento.append(rs.getString("id")).append(';').append(rs.getString("nome")).append("|");
}
this.revalidate();
this.repaint();
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
}
// ==========================================================================
// ** Quando viene chiusa la form esce dall'applicazione
// ==========================================================================
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi chiusura programma?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
if (Integer.parseInt(selectedValue.toString()) == 0) {
myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'");
Long nrec = mySelectInteger("SELECT count(*) as nrec FROM acquisti", "nrec");
if (nrec > 0) {
if (JOptionPane.showConfirmDialog(null, "Attenzione, ci sono " + nrec + " passaggi non ancora trasferiti al database centrale,\nconferma chiusura programma?", "Acquisti", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
statoAttivoNonLoggato();
System.exit(0);
} else {
return;
}
}
statoAttivoNonLoggato();
System.exit(0);
}
}//GEN-LAST:event_exitForm
// ==========================================================================
// ** Click sul btnLogin
// ==========================================================================
private Boolean turno() {
Boolean ok = false;
String query = "select t.dalle, t.alle, t.id, t.nome from turni t, turni_punti_distribuzione x, punti_distribuzione p, punti_cassa c "
+ "where x.id_turno = t.id "
+ "and x.id_punto_distribuzione = p.id "
+ "and c.id_punto_distribuzione = p.id and c.id =" + idPuntoCassa;
try {
String[] nowString = mySelect("Select sysdate as mo from dual", "mo").split(" ");
Statement st;
ResultSet rs;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement();
rs = st.executeQuery(query);
while (rs.next()) {
String dalle = rs.getString("dalle");
String alle = rs.getString("alle");
try {
Date now = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(nowString[0] + " " + nowString[1]);
Date da = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(nowString[0] + " " + dalle);
Date a = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(nowString[0] + " " + alle);
if (now.after(da) && now.before(a)) {
idTurno = rs.getLong("id");
nomeTurno = rs.getString("nome");
idTurnoAttuale = idTurno;
nomeTurnoAttuale = nomeTurno;
ok = true;
break;
}
} catch (Exception e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore DB ['" + query + "']");
}
return ok;
}
private void turnoAttuale() {
String query = "select t.dalle, t.alle, t.id, t.nome from turni t, turni_punti_distribuzione x, punti_distribuzione p, punti_cassa c "
+ "where x.id_turno = t.id and x.id_punto_distribuzione = p.id "
+ "and c.id_punto_distribuzione = p.id and c.id =" + idPuntoCassa;
try {
String[] mo = mySelect("Select sysdate as mo from dual", "mo").split(" ");
Statement st;
ResultSet rs;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
st = dbConnection.createStatement();
rs = st.executeQuery(query);
while (rs.next()) {
String dalle = rs.getString("dalle");
String alle = rs.getString("alle");
try {
Date adesso = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(mo[0] + " " + mo[1]);
Date da = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(mo[0] + " " + dalle);
Date a = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ENGLISH).parse(mo[0] + " " + alle);
//JOptionPane.showMessageDialog(this, da + " e " + now.compareTo(a));
if (adesso.after(da) && adesso.before(a)) {
idTurnoAttuale = rs.getLong("id");
nomeTurnoAttuale = rs.getString("nome");
break;
}
} catch (Exception e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore DB ['" + query + "']");
}
}
private void impostaAmbiente() {
// -----------------------------------------------------------
// ** id punto cassa
// -----------------------------------------------------------
idPuntoCassa = mySelectInteger("select Punti_Cassa.id as idPC from Punti_Cassa where Punti_Cassa.id=" + idPuntoCassa, "idPC");
// -----------------------------------------------------------
// ** Imposta l'ambiente
// -----------------------------------------------------------
txtUsername.setEnabled(false);
txtPassword.setEnabled(false);
btnLogin.setEnabled(false);
addRemoveKeyDispatcher(true);
aggiungiImmaginiPulsanti();
if (jChLogin.isSelected() == false && utenteLoggato.length() <= 0) {
utenteLoggato = txtUsername.getText();
}
lblUtenteLoggato.setText("LogIn: [" + utenteLoggato + "]");
this.resize();
this.caricaDati("CATEGORIE", "0");
pnlErrore.setVisible(false);
pnlLogin.setVisible(false);
pnlTop.setVisible(true);
pnlProdotti.setVisible(true);
jBtnStorno.setEnabled(false);
jBtnAsporto.setEnabled(false);
jbtnSu.setEnabled(false);
jbtnGiu.setEnabled(false);
jbtnElimina.setEnabled(false);
jbtnAnnulla.setEnabled(false);
jbtnDuplica.setEnabled(false);
String pulsante = mySelect("SELECT p.flag_imposta_tessera as Pulsante "
+ "FROM punti_distribuzione p, punti_cassa c "
+ "WHERE c.id_punto_distribuzione = p.id AND c.id =" + idPuntoCassa, "Pulsante");
if (Integer.parseInt(pulsante) == 1) {
bottoneImposta = true;
btnImpostaCliente.setVisible(true);
btnImpostaCliente.setEnabled(true);
jTxtTessera.setEnabled(true);
} else {
bottoneImposta = false;
btnImpostaCliente.setEnabled(false);
jTxtTessera.setEnabled(false);
}
if (idPuntoCassa != 0) {
aggiornaProgressivi();
if (btnImpostaCliente.isVisible()) {
btnImpostaCliente.setEnabled(false);
}
jBtnprodotti.setEnabled(false);
meteo();
if (btnImpostaCliente.isVisible()) {
btnImpostaCliente.setEnabled(bottoneImposta);
}
jBtnprodotti.setEnabled(true);
jbtnDuplica.setText("<html>Duplica<br />Prodotto</html>");
jbtnElimina.setText("<html>Elimina<br />Prodotto</html>");
caricaModiPagamento();
verificaModoPagamento();
pulsantiModoPagamento();
//modifica 09-5-2018------------------------------------
if (flagPrecaricaLista) {
abilitaPulsanti(pnlCategorie, true, true);
abilitaPulsanti(pnlProdotti, true, true);
idProfiloTariffarioDefault = mySelectInteger("select Valore from Parametri where upper(chiave)='IDFASCIADEFAULT'", "Valore");
System.out.print("" + idProfiloTariffarioDefault);
apriCassaDefault();
}
} else {
JOptionPane.showMessageDialog(this, "ID Punto Cassa non configurato!");
}
}
private void verificaDB() {
final Timer timer = new Timer();
final TimerTask task = new TimerTask() {
@Override
public void run() {
Long res = mySelectInteger("SELECT db_remoto_connesso as Stato FROM dual", "Stato");
if (res == 1) {
lblDB.setBackground(Color.green);
} else {
lblDB.setBackground(Color.red);
}
lblDB.setOpaque(true);
lblDB.repaint();
}
};
timer.schedule(task, 1000, 10000);
}
public void aggiornaProgressivi() {
// -----------------------------------------------------------
// ** progressivo assoluto scontrino
// -----------------------------------------------------------
String prog = mySelect("select nvl(max(prog_assoluto),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa, "Prog");
// if(progressivo < Long.parseLong(prog)){
progressivo = Long.valueOf(prog);
// }
// -----------------------------------------------------------
// ** progressivo giorno turno scontrino
// -----------------------------------------------------------
Date now = new Date();
String progT = mySelect("select nvl(max(prog_turno),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog");
progressivoTurno = Long.valueOf(progT);
String progG = mySelect("select nvl(max(prog_giorno),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and data=" + formattaData(now), "Prog");
progressivoGiorno = Long.valueOf(progG);
String controlloTurno = mySelect("select count(*) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and data=" + formattaData(now) + " and id_Turno=" + idTurno, "Prog");
if (Long.parseLong(controlloTurno) <= 0) {
myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
+ " values (" + formattaData(now) + "," + idPuntoCassa + "," + idTurno + "," + progressivo + "," + progressivoGiorno + ",0)");
}
// -----------------------------------------------------------
// ** incassi turno pagamento a scalare
// -----------------------------------------------------------
String progPS = mySelect("select nvl(sum(incasso_turno_scalare),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog");
progressivoScalare = Double.valueOf(progPS);
// -----------------------------------------------------------
// ** incassi turno pagamento a contanti
// -----------------------------------------------------------
String progPC = mySelect("select nvl(sum(incasso_turno_contanti),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog");
progressivoContanti = Double.valueOf(progPC);
// -----------------------------------------------------------
// ** incassi turno pagamento ticket
// -----------------------------------------------------------
String progPT = mySelect("select nvl(sum(incasso_turno_ticket),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog");
progressivoTicket = Double.valueOf(progPT);
// -----------------------------------------------------------
// ** incassi turno pagamento differito
// -----------------------------------------------------------
String progDI = mySelect("select nvl(sum(incasso_turno_differito),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog");
progressivoDifferito = Double.valueOf(progDI);
aggiornaLabelInfo();
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare") && jTxtTessera.getText().length() > 0) {
verificaSaldo(jTxtTessera.getText());
}
}
private void aggiornaLabelInfo() {
Long prog = progressivo;// - 1;
Long progGG = progressivoGiorno;// - 1;
Long progTurno = progressivoTurno;// - 1;
if (progressivo <= 0) {
prog = 0L;
}
if (progressivoGiorno <= 0) {
progGG = 0L;
}
if (progressivoTurno <= 0) {
progTurno = 0L;
}
lblInfo.setText("Passaggi: Tot. [" + prog + "], giorno [" + progGG + "], turno [" + progTurno + "]");
DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00");
lblInfo2.setText("Incassi [" + nomeTurno + "]: Tot. [" +
df2.format(progressivoScalare + progressivoContanti + progressivoTicket + progressivoDifferito) + "] SC [" +
df2.format(progressivoScalare) + "], CO [" +
df2.format(progressivoContanti) + "], TI [" +
df2.format(progressivoTicket) + "], DI [" +
df2.format(progressivoDifferito) + "]");
}
public void addRemoveKeyDispatcher(Boolean aggiungi) {
if (aggiungi) {
if (keyDespatcherAttivo == false) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(keyDispatcher);
keyDespatcherAttivo = true;
}
} else {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyDispatcher);
keyDespatcherAttivo = false;
}
}
private void meteo() {
String spia = mySelect("select controlla_meteo(" + idPuntoCassa + ") as res from dual", "res");
if (Integer.parseInt(spia) == 1) {
if (myMeteoForm == null) {
myMeteoForm = new FrmMeteo(this, idPuntoCassa, true);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(300, largControlli);
Integer h = calcolaLarghezzaAltezza(70, altControlli);
myMeteoForm.setSize(w, h);
myMeteoForm.setLocationRelativeTo(null);
myMeteoForm.setVisible(true);
}
}
}
private void resizeRules(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_resizeRules
resize();
}//GEN-LAST:event_resizeRules
private void jbtnSuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuActionPerformed
// TODO add your handling code here:
if (tblLista.getSelectedRow() > 0) {
tblLista.setRowSelectionInterval(tblLista.getSelectedRow() - 1, tblLista.getSelectedRow() - 1);
tblLista.scrollRectToVisible(new Rectangle(tblLista.getCellRect(tblLista.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnSuActionPerformed
private void jbtnDuplicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnDuplicaActionPerformed
// TODO add your handling code here:
if (tblLista.getSelectedRow() >= 0) {
MyTableModel model = (MyTableModel) tblLista.getModel();
Object row[] = model.getRow(tblLista.getSelectedRow());
Boolean isComposizione = false;
if (Long.parseLong(row[5].toString()) == 0L) {
isComposizione = true;
}
if (isComposizione) {
JOptionPane.showOptionDialog(this, "Composizione già presente!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
} else {
model.addRow(row);
tblLista.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
tblLista.setModel(model);
controllaCompleti(model);
controllaExtra(model);
sommaColonne(model);
}
}
}//GEN-LAST:event_jbtnDuplicaActionPerformed
private void jbtnGiuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnGiuActionPerformed
// TODO add your handling code here:
if (tblLista.getSelectedRow() < tblLista.getRowCount() - 1) {
tblLista.setRowSelectionInterval(tblLista.getSelectedRow() + 1, tblLista.getSelectedRow() + 1);
tblLista.scrollRectToVisible(new Rectangle(tblLista.getCellRect(tblLista.getSelectedRow(), 0, true)));
}
}//GEN-LAST:event_jbtnGiuActionPerformed
private void jbtnStampaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnStampaActionPerformed
Boolean ok = myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'");
if (ok) {
JOptionPane.showOptionDialog(this, "Operazione correttamente eseguita.", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
} else {
JOptionPane.showOptionDialog(this, "Errore nell'aggiornamento del parametro!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
}
}//GEN-LAST:event_jbtnStampaActionPerformed
private void cancellaComposizioni() {
try {
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
clearTable(model1);
} catch (Exception e) {
}
}
private void jbtnEliminaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEliminaActionPerformed
cancellaComposizioni();
MyTableModel model = (MyTableModel) tblLista.getModel();
Integer riga = tblLista.getSelectedRow();
if (riga >= 0) {
model.deleteRow(riga);
//ripristino i prezzi
for (Integer i = 0; i < model.getRowCount(); i++) {
model.setValueAt(model.getValueAt(i, colImporto2), i, colImporto);
}
//doLayout();
if (tblLista.getRowCount() > 0) {
if (riga > 0) {
tblLista.setRowSelectionInterval(riga - 1, riga - 1);
} else {
tblLista.setRowSelectionInterval(0, 0);
}
}
controllaCompleti(model);
controllaExtra(model);
sommaColonne(model);
//spengo altri togglebutton
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
JToggleButton bt = (JToggleButton) this.pnlProdotti.getComponent(y);
bt.setSelected(false);
}
if (model.getRowCount() <= 0) {
jbtnSu.setEnabled(false);
jbtnGiu.setEnabled(false);
jbtnElimina.setEnabled(false);
jbtnAnnulla.setEnabled(false);
jbtnDuplica.setEnabled(false);
}
doLayout();
}
}//GEN-LAST:event_jbtnEliminaActionPerformed
private void jbtnChiudiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnChiudiActionPerformed
if (verificaPrenotazioni()) {
chiudi();
}
}//GEN-LAST:event_jbtnChiudiActionPerformed
private boolean verificaPrenotazioni() {
boolean ok = true;
if (idTessera > 0L && idPrenotazione > 0L) {
MyTableModel model = (MyTableModel) tblLista.getModel();
StringBuilder elencoIdProdotti = new StringBuilder();
for (int i = model.getRowCount() - 1; i >= 0; i--) {
Long idCateg = Long.valueOf(model.getValueAt(i, colCategoria).toString());
if (idCateg != 0L) {
elencoIdProdotti.append(model.getValueAt(i, colIDProdotto));
elencoIdProdotti.append(",");
}
}
ok = controllaDiscrepanzePrenotazioni(elencoIdProdotti.toString());
aggiornaPrenotazioni(elencoIdProdotti.toString());
}
return ok;
}
private String getNumeroTessera() {
MyApplication myApp = new MyApplication();
String nTessera = "";
try {
myApp.idTesseraA = "";
String[] listReader;
listReader = myApp.smartCard.listReaders();
myApp.smartCard.setReader(listReader[0]);
myApp.smartCard.connect("T=1");
myApp.smartCard.getCurrentCardATR();
String nTess = "";
myApp.sendAPDU(this, "d000", "00", "A4", "00", "00", "02", "");
myApp.sendAPDU(this, "d100", "00", "A4", "00", "00", "02", "");
myApp.sendAPDU(this, "d101", "00", "A4", "00", "00", "02", "");
String[] CF = myApp.sendAPDU(this, "", "00", "B0", "00", "00", "00", "140").split("\\|");
myApp.sendAPDU(this, "3f00", "00", "A4", "00", "00", "02", "");
myApp.sendAPDU(this, "1000", "00", "A4", "00", "00", "02", "");
myApp.sendAPDU(this, "1003", "00", "A4", "00", "00", "02", "");
nTess = myApp.sendAPDU(this, "", "00", "B0", "00", "00", "00", "14");
myApp.smartCard.disconnect();
if (CF.length > 1) {
nTessera = nTess;
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Card Reader non collegato o errore di lettura!",
"jBtnReadCardActionPerformed", JOptionPane.ERROR_MESSAGE);
} finally {
return nTessera;
}
}
private void formWindowDeiconified(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowDeiconified
// TODO add your handling code here:
resize();
}//GEN-LAST:event_formWindowDeiconified
private void tastiera2(java.awt.event.MouseEvent evt) {
MyApplication myApp = new MyApplication();
if (jChLogin.isSelected() == false) {
if (myApp.tastieraVideo) {
if (myApp.ultimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
myApp.ultimoTxt = " ";
} else {
myApp.ultimoTxt = evt.getComponent().toString();
Rectangle pnl = pnlLogin.getBounds();
tastiera((JTextField) evt.getComponent(), pnl.x, pnl.y);
}
}
}
}
private void tastiera2(java.awt.event.FocusEvent evt) {
MyApplication myApp = new MyApplication();
if (jChLogin.isSelected() == false) {
if (myApp.tastieraVideo) {
if (myApp.ultimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
myApp.ultimoTxt = " ";
} else {
myApp.ultimoTxt = evt.getComponent().toString();
Rectangle pnl = pnlLogin.getBounds();
tastiera((JTextField) evt.getComponent(), pnl.x, pnl.y);
}
}
}
}
private void jbtnEsciActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEsciActionPerformed
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi chiusura sessione?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
if (Integer.parseInt(selectedValue.toString()) == 0) {
pnlErrore.setVisible(false);
pnlLogin.setVisible(true);
pnlTop.setVisible(false);
pnlProdotti.setVisible(false);
utenteLoggato = "";
idAccount = 0L;
lblUtenteLoggato.setText("[Nessun Utente Connesso]");
lblInfo.setText("[Info Turno]");
lblInfo2.setText("[Info Incassi]");
txtPassword.setEnabled(true);
txtUsername.setEnabled(true);
btnLogin.setEnabled(true);
pnlCategorie.removeAll();
pnlProdotti.removeAll();
addRemoveKeyDispatcher(false);
jChLoginActionPerformed(null);
azzera();
statoAttivoNonLoggato();
}
}//GEN-LAST:event_jbtnEsciActionPerformed
private void jBtnStornoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnStornoActionPerformed
apriStorno(false);
}//GEN-LAST:event_jBtnStornoActionPerformed
private void apriStorno(Boolean daPassaggi) {
FrmStorno jFrameStorno = new FrmStorno(this, idTessera, idPuntoCassa, imgPath, daPassaggi);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(550, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
jFrameStorno.setSize(w, h);
jFrameStorno.setLocationRelativeTo(null);
jFrameStorno.setVisible(true);
}
private void jBtnprodottiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnprodottiActionPerformed
FrmProdotti jFrameProdotti = new FrmProdotti(this, imgPath);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(550, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
jFrameProdotti.setSize(w, h);
jFrameProdotti.setLocationRelativeTo(null);
jFrameProdotti.setVisible(true);
}//GEN-LAST:event_jBtnprodottiActionPerformed
private void selezionaTipoPagamento(int idTipo) {
String tipo = setModoPagamento(idTipo);
lblTipoPagamento.setText(tipo);
if (tipo.equalsIgnoreCase("A scalare") && jTxtTessera.getText().length() > 0) {
verificaSaldo(jTxtTessera.getText());
}
}
public void clickModoPagamento(String ModoPagamento) {
if (isCassaAperta == false) {
isCassaAperta = true;
idProfiloTariffario = 0L;
idTessera = 0L;
}
lblResiduo.setText("[...]");
lblSaldo.setText("[...]");
lblTipoPagamento.setText(ModoPagamento);
}
public void clickCarta() {
if (saldoAcquisti(0.0) == false && consentiCredito == false) {
JOptionPane.showOptionDialog(this, "Saldo tessera insufficiente!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
return;
}
if (isCassaAperta == true) {
lblResiduo.setText("[...]");
setModoPagamento("A scalare");
String tipo = cercaTestoModoPagamento();
lblTipoPagamento.setText(tipo);
}
}
private void aggiornaDB(Boolean messaggio) {
try {
Boolean aggiorna = false;
if (messaggio) {
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi aggiornamento del database locale?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
if (Integer.parseInt(selectedValue.toString()) != 0) {
return;
} else {
aggiorna = true;
}
} else {
aggiorna = true;
}
if (aggiorna) {
myProgressForm = new FrmProgress(this);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(300, largControlli);
Integer h = calcolaLarghezzaAltezza(100, altControlli);
myProgressForm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
myProgressForm.setResizable(false);
myProgressForm.setTitle("Aggiornamento Database...");
myProgressForm.setSize(w, h);
myProgressForm.setLocationRelativeTo(null);
myProgressForm.setVisible(true);
myProgressForm.repaint();
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
String plsql = "begin lancia_aggiorna_tabelle('S'); end;";
CallableStatement st = dbConnection.prepareCall(plsql);
st.execute();
st.close();
dbConnection.close();
PuntoCassa.this.myProgressForm.dispose();
//12/09/2016
if (PuntoCassa.this.pnlLogin.isVisible() == false) {
//23-12-15
PuntoCassa.this.impostaAmbiente();
PuntoCassa.this.setEnabled(true);
}
String esito = mySelect("SELECT esito FROM esiti where id = (select max(id) from esiti)", "esito");
JOptionPane.showOptionDialog(PuntoCassa.this, esito, "Aggiornamento Database", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
} catch (Exception e) {
JOptionPane.showMessageDialog(PuntoCassa.this, "Errore " + e.getMessage());
}
}
});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Errore " + e.getMessage());
}
}
private void txtTotaleCassaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTotaleCassaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtTotaleCassaActionPerformed
private void jBtnReadCardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnReadCardActionPerformed
// TODO add your handling code here:
jTxtTessera.setText("");
String nTessera = getNumeroTessera();
jTxtTessera.setText(nTessera);
}//GEN-LAST:event_jBtnReadCardActionPerformed
private void jTxtTesseraFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTxtTesseraFocusGained
MyApplication myApp = new MyApplication();
if (myApp.tastieraVideo) {
if (myApp.ultimoTxt.equalsIgnoreCase(evt.getComponent().toString())) {
myApp.ultimoTxt = " ";
} else {
myApp.ultimoTxt = evt.getComponent().toString();
Rectangle pnl = pnlLogin.getBounds();
tastiera((JTextField) evt.getComponent(), pnl.x, pnl.y);
}
}
}//GEN-LAST:event_jTxtTesseraFocusGained
private void btnImpostaClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImpostaClienteActionPerformed
FrmCerca jFrameCerca = new FrmCerca(this, jTxtTessera, imgPath, "", flagMostraDataDiNascita);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
jFrameCerca.setSize(w, h);
jFrameCerca.setLocationRelativeTo(null);
jFrameCerca.setVisible(true);
}//GEN-LAST:event_btnImpostaClienteActionPerformed
private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
MyTableModel model = (MyTableModel) tblLista.getModel();
if (model.getRowCount() > 0) {
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "Desideri annullare tutte le righe?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
if (Integer.parseInt(selectedValue.toString()) == 0) {
annulla();
doLayout();
}
}
}//GEN-LAST:event_jbtnAnnullaActionPerformed
private void annulla() {
try {
MyTableModel model = (MyTableModel) tblLista.getModel();
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
clearTable(model);
clearTable(model1);
jbtnSu.setEnabled(false);
jbtnGiu.setEnabled(false);
jbtnElimina.setEnabled(false);
jbtnAnnulla.setEnabled(false);
jbtnDuplica.setEnabled(false);
sommaColonne(model);
if (idTessera == 0L) {
jbtnChiudi.setEnabled(false);
} else {
jbtnChiudi.setEnabled(true);
}
//spengo altri togglebutton
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
JToggleButton bt = (JToggleButton) this.pnlProdotti.getComponent(y);
bt.setSelected(false);
}
} catch (Exception e) {
LogManager.getLogger(PuntoCassa.class).error(e);
}
}
private void jBtnAsportoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAsportoActionPerformed
if (jBtnAsporto.isSelected()) {
aggiungImmagini(jBtnAsporto, "da asporto.jpg", 50, 50);
} else {
aggiungImmagini(jBtnAsporto, "coltello e forchetta.jpg", 50, 50);
}
}//GEN-LAST:event_jBtnAsportoActionPerformed
private void txtTotalePuntiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTotalePuntiActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtTotalePuntiActionPerformed
private void jBtnMovimentiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnMovimentiActionPerformed
FrmMovimenti jFrameMovimenti = new FrmMovimenti(this, idTessera, idPuntoCassa, imgPath);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(680, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
jFrameMovimenti.setSize(w, h);
jFrameMovimenti.setLocationRelativeTo(null);
jFrameMovimenti.setVisible(true);
}//GEN-LAST:event_jBtnMovimentiActionPerformed
private void jBtnBuoniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnBuoniActionPerformed
FrmCerca jFrameCerca = new FrmCerca(this, jTxtTessera, imgPath, "BP", flagMostraDataDiNascita);
this.setEnabled(false);
Integer w = calcolaLarghezzaAltezza(650, largControlli);
Integer h = calcolaLarghezzaAltezza(250, altControlli);
jFrameCerca.setSize(w, h);
jFrameCerca.setLocationRelativeTo(null);
jFrameCerca.setVisible(true);
}//GEN-LAST:event_jBtnBuoniActionPerformed
private void jBtnDB1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnDB1ActionPerformed
// TODO add your handling code here:
aggiornaDB(true);
}//GEN-LAST:event_jBtnDB1ActionPerformed
private void jChLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jChLoginActionPerformed
// TODO add your handling code here:
txtUsername.setEnabled(!jChLogin.isSelected());
txtPassword.setEnabled(!jChLogin.isSelected());
btnLogin.setEnabled(!jChLogin.isSelected());
addRemoveKeyDispatcher(jChLogin.isSelected());
}//GEN-LAST:event_jChLoginActionPerformed
private void btnTerminaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTerminaActionPerformed
// TODO add your handling code here:
exitForm(null);
}//GEN-LAST:event_btnTerminaActionPerformed
private void txtPasswordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtPasswordMouseClicked
tastiera2(evt);
}//GEN-LAST:event_txtPasswordMouseClicked
private void txtPasswordFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPasswordFocusGained
tastiera2(evt);
}//GEN-LAST:event_txtPasswordFocusGained
private void txtUsernameMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtUsernameMouseClicked
tastiera2(evt);
}//GEN-LAST:event_txtUsernameMouseClicked
private void txtUsernameFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsernameFocusGained
tastiera2(evt);
}//GEN-LAST:event_txtUsernameFocusGained
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
if (turno()) {
String sql, pwd;
int counter;
//int hash = 0;
//Statement st;
//ResultSet rs;
//pwd = new String();
//sql = new String();
// =======================================================================
// *** Verifica la correttezza delle credenziali inserite - Account
// =======================================================================
sql = "SELECT count(*) as counter FROM accounts WHERE username = '" + this.txtUsername.getText() + "'";
MyApplication myApp = new MyApplication();
counter = Integer.parseInt(myApp.mySelect(this, sql, "Counter"));
// ====================================================================
// ** Verifica la password
// ====================================================================
if (counter == 1) {
//Encoding en = new Encoding();
pwd = new String(txtPassword.getPassword());
sql = "SELECT id || '|' || id_Stato as res FROM accounts WHERE username = '" + this.txtUsername.getText() + "' "
+ "and password = '" + Encoding.encodeString(pwd) + "'";
String[] el = myApp.mySelect(this, sql, "res").split("\\|");
if (myApp.isNumeric(el[0])) {
idAccount = Long.valueOf(el[0]);
if (Integer.parseInt(el[1]) == 2) {
String messaggio = myApp.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + el[1], "descrizione");
JOptionPane.showMessageDialog(this, messaggio + ".");
return;
}
} else {
idAccount = 0L;
}
if (idAccount > 0L) {
sql = "SELECT count(*) as Counter FROM profili p WHERE p.id_account = " + idAccount + " AND p.id_ruolo IN (3, 10000000004)";
counter = Integer.parseInt(myApp.mySelect(this, sql, "Counter"));
if (counter > 0) {
impostaAmbiente();
txtUsername.setText("");
txtPassword.setText("");
statoAttivoLoggato();
verificaAggiornamentoDB();
} else {
JOptionPane.showMessageDialog(this, "L'utente non dispone dei privilegi per l'utilizzo del modulo cassa.");
}
} else {
JOptionPane.showMessageDialog(this, "Password errata.");
}
// --------------------------------------------------------------
// *** Errore SQL in verifica password
// --------------------------------------------------------------
// =================================================================
// ** Caso account sconosciuto
// =================================================================
} else {
JOptionPane.showMessageDialog(this, "Account sconosciuto.");
}
} else {
JOptionPane.showMessageDialog(this, "Impossibile eseguire il Login al sistema:\nNessun Turno Attivo!");
}
}//GEN-LAST:event_btnLoginActionPerformed
//a scalare
private void jTBP0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBP0ActionPerformed
if (jTBP0.isSelected()) {
try {
jTBP0.setEnabled(false);
jTBP1.setSelected(false);
jTBP1.setEnabled(true);
jTBP2.setSelected(false);
jTBP2.setEnabled(true);
jTBP3.setSelected(false);
jTBP3.setEnabled(true);
selezionaTipoPagamento(0);
MyTableModel modelX = (MyTableModel) tblLista.getModel();
sommaColonne(modelX);
} catch (Exception ex) {
LogManager.getLogger(PuntoCassa.class).error(ex);
}
}
}//GEN-LAST:event_jTBP0ActionPerformed
//contanti
private void jTBP1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBP1ActionPerformed
if (jTBP1.isSelected()) {
jTBP1.setEnabled(false);
jTBP0.setSelected(false);
jTBP0.setEnabled(true);
jTBP2.setSelected(false);
jTBP2.setEnabled(true);
jTBP3.setSelected(false);
jTBP3.setEnabled(true);
selezionaTipoPagamento(1);
}
}//GEN-LAST:event_jTBP1ActionPerformed
//ticket
private void jTBP2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBP2ActionPerformed
if (jTBP2.isSelected()) {
jTBP2.setEnabled(false);
jTBP1.setSelected(false);
jTBP1.setEnabled(true);
jTBP0.setSelected(false);
jTBP0.setEnabled(true);
jTBP3.setSelected(false);
jTBP3.setEnabled(true);
selezionaTipoPagamento(2);
}
}//GEN-LAST:event_jTBP2ActionPerformed
//differito
private void jTBP3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBP3ActionPerformed
if (jTBP3.isSelected()) {
jTBP3.setEnabled(false);
jTBP1.setSelected(false);
jTBP1.setEnabled(true);
jTBP2.setSelected(false);
jTBP2.setEnabled(true);
jTBP0.setSelected(false);
jTBP0.setEnabled(true);
selezionaTipoPagamento(3);
}
}//GEN-LAST:event_jTBP3ActionPerformed
private void tastiera(JTextField jTxt, Integer MyX, Integer MyY) {
MyKeyBoard keyboard = new MyKeyBoard(this, false);
keyboard.txt = jTxt;
keyboard.parent = this;
Rectangle s = this.getBounds();
Rectangle s2 = jTxt.getBounds();
Integer l = s.x + s2.x + MyX;
if (l + 800 > s.x + s.width) {
l = s.x + s.width - 800;
}
keyboard.setBounds(l, s.y + s2.y + 60 + MyY, 800, 300);
keyboard.setVisible(true);
}
private Boolean verificaSaldo(String numeroTessera) {
Boolean OK = false;
//andare su viewtessere
String querySaldo = "select t.saldo || '|' || cf.saldo_minimo_alert || '|' || cf.saldo_minimo_stop || '|' || t.punti || '|' as saldi "
+ " from tessere t, utenti u, categorie_utenti c, categorie_utenti_fasce cf"
+ " where t.numero = '" + numeroTessera + "' and t.id_utente = u.id"
+ " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
String[] saldoMinimo = mySelect(querySaldo, "saldi").split("\\|");
Double saldo = 0.0;
if (saldoMinimo.length > 0 && saldoMinimo[0].length() > 0) {
saldo = Double.valueOf(saldoMinimo[0].replace(",", "."));
}
Double saldoAlert = 0.0;
if (saldoMinimo.length > 1 && saldoMinimo[1].length() > 0) {
saldoAlert = Double.valueOf(saldoMinimo[1].replace(",", "."));
}
Double saldoStop = 0.0;
if (saldoMinimo.length > 2 && saldoMinimo[2].length() > 0) {
saldoStop = Double.valueOf(saldoMinimo[2].replace(",", "."));
}
saldoMinimoStop = saldoStop;
String punti = "";
if (saldoMinimo.length >= 4) {
punti = saldoMinimo[3];
}
DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00");
lblSaldo.setText("? " + df2.format(saldo));
//24-01-2020--------------------------
MyTableModel model = (MyTableModel) tblLista.getModel();
Double t = model.somma(colImporto);
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
if (model2.getRowCount() > 0) {
t = t + model2.somma(1);
}
//---------------------------
lblResiduo.setText("? " + df2.format(saldo - t));
lblPunti.setText(punti);
String tipo = cercaTestoModoPagamento();
lblTipoPagamento.setText(tipo);
//21/12/2016 if (gratuitaResidue <= 0) {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if (gratuitaResidue <= 0 && (flagBonus == 0 || bonusResidui <= 0)) {
if ((saldo - calcolaTotale()) <= saldoStop) {
//31-10-2019 se lista precaricata e saldo <0 devo chudere
if (stoCalcolando == false) {
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare")) {
if ((saldo - calcolaTotale()) < 0) {
JOptionPane.showMessageDialog(this, "Saldo insufficiente!", "Saldo", JOptionPane.OK_OPTION);
logTessera();
azzera();
return true;
}
}
}
OK = true;
} else if (saldo <= saldoAlert) {
JOptionPane.showMessageDialog(this,
"Saldo ridotto, potrebbero non essere disponibili tutti i prodotti!",
"Saldo Alert", JOptionPane.ERROR_MESSAGE);
OK = true;
} else {
OK = true;
}
}
return OK;
}
private String cercaTestoModoPagamento() {
String testo = "";
String[] el = modiPagamento.toString().split("\\|");
for (String el1 : el) {
String[] t = el1.split(";");
if (t[0].equalsIgnoreCase(idModoPagamento.toString())) {
testo = t[1];
break;
}
}
return testo;
}
private void setModoPagamento(String Modo) {
String[] el = modiPagamento.toString().split("\\|");
for (String el1 : el) {
String[] t = el1.split(";");
if (t[1].equalsIgnoreCase(Modo)) {
idModoPagamento = Long.valueOf(t[0]);
break;
}
}
}
private String setModoPagamento(Integer Tipo) {
String testo = "";
if (modiPagamento.toString().length() > 5) {
String[] el = modiPagamento.toString().split("\\|");
int i = Tipo;
String[] t = el[i].split(";");
testo = t[1];
idModoPagamento = Long.valueOf(Tipo.toString());
lblResiduo.setText("[...]");
lblSaldo.setText("[...]");
}
return testo;
}
private void pulsantiModoPagamento() {
switch (Integer.parseInt(idModoPagamento.toString())) {
case 0 -> {
jTBP0.setEnabled(true);
jTBP0.setSelected(true);
jTBP0ActionPerformed(null);
if (unSoloTipoPagamento) {
jTBP1.setEnabled(false);
jTBP2.setEnabled(false);
jTBP3.setEnabled(false);
}
}
case 1 -> {
jTBP1.setEnabled(true);
jTBP1.setSelected(true);
jTBP1ActionPerformed(null);
if (unSoloTipoPagamento) {
jTBP0.setEnabled(false);
jTBP2.setEnabled(false);
jTBP3.setEnabled(false);
}
}
case 2 -> {
jTBP2.setEnabled(true);
jTBP2.setSelected(true);
jTBP2ActionPerformed(null);
if (unSoloTipoPagamento) {
jTBP1.setEnabled(false);
jTBP0.setEnabled(false);
jTBP3.setEnabled(false);
}
}
case 3 -> {
jTBP3.setEnabled(true);
jTBP3.setSelected(true);
jTBP3ActionPerformed(null);
if (unSoloTipoPagamento) {
jTBP1.setEnabled(false);
jTBP2.setEnabled(false);
jTBP0.setEnabled(false);
}
}
}
}
private void chiudi() {
//04-02-2019---------------------------------------------
MyTableModel model = (MyTableModel) tblLista.getModel();
if (model.getRowCount() > 0) {
String numTessera = jTxtTessera.getText();
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare")) {
String querySaldo = "select t.saldo || '|' || cf.saldo_minimo_alert || '|' || cf.saldo_minimo_stop || '|' || t.punti || '|' as saldi "
+ " from tessere t, utenti u, categorie_utenti c, categorie_utenti_fasce cf"
+ " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
+ " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
String[] saldoMinimo = mySelect(querySaldo, "saldi").split("\\|");
Double saldo = 0.0;
String residuo = lblResiduo.getText().trim().replace("?", "");
if (residuo.equalsIgnoreCase("[...]")) {
residuo = "0";
}
residuo = residuo.replace(".", "");
residuo = residuo.replace(",", ".");
saldo = Double.valueOf(residuo);
Double saldoAlert = 0.0;
if (saldoMinimo.length > 1 && saldoMinimo[1].length() > 0) {
saldoAlert = Double.valueOf(saldoMinimo[1].replace(",", "."));
}
if (gratuitaResidue <= 0 && (flagBonus == 0 || bonusResidui <= 0)) {
if (saldo <= saldoAlert) {
if (consentiCredito == true) {
if (messaggioSaldoUnaVolta == false) {
if (JOptionPane.showConfirmDialog(null, "Saldo insufficiente. Vuoi autorizzare comunque la transazione?",
"Saldo", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
messaggioSaldoUnaVolta = true;
} else {
return;
}
}
}
}
}
//--------------------------------------------------------
} else {
//Pagamento non a Scalare
String querySaldo = "select t.saldo "
+ " from tessere t, utenti u, categorie_utenti c, categorie_utenti_fasce cf"
+ " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
+ " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
Double saldo = Double.valueOf(mySelect(querySaldo, "saldo"));
Double costoPasto = Double.valueOf(txtTotaleCassa.getText().replace("?", "").trim().replace(",", "."));
if (saldo > costoPasto) {
Object[] options = {"A Scalare", "Contanti"};
Object selectedValue = JOptionPane.showOptionDialog(this,
"Attenzione, c'è saldo sufficiente sulla tessera,\nscegli la modalità di pagamento da utilizzare", "Modalità Pagamento",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);
if (Integer.parseInt(selectedValue.toString()) == 0) {
jTBP0.setSelected(true);
jTBP0ActionPerformed(null);
} else {
jTBP1.setSelected(true);
jTBP1ActionPerformed(null);
}
}
}
}
Boolean spiaProgressivo = false;
//Date adesso = new Date();
LocalDateTime adesso = LocalDateTime.now();
String flagPassaggioTessera = "0";
if (passaggioTessera) {
flagPassaggioTessera = "1";
}
String tessera = idTessera.toString();
String flagAsporto = "0";
if (jBtnAsporto.isSelected()) {
flagAsporto = "1";
}
//09-05-2019
String composizione = spaziBianchi("", 20, false);
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
for (int i = 0; i < model2.getRowCount(); i++) {
String completo = model2.getValueAt(i, 0).toString();
String pasto = "";
if (completo.length() > 0) {
String TT[] = completo.split("]", -1);
if (TT.length > 0) {
pasto = "Pasto:" + TT[0].replace("[", "");
}
}
composizione = spaziBianchi(pasto, 10, true);
break;
}
//controllo passaggi
if (model.getRowCount() > 0) {
String controlloPassaggi = "SELECT count(*) as passaggi FROM st_acquisti st "
+ "INNER JOIN prodotti pr ON st.id_prodotto = pr.id "
+ "WHERE pr.id_categoria = 0 "
+ "AND trunc(st.data) = trunc(sysdate) "
+ "AND st.id_tessera = " + idTessera
+ " AND st.id_turno=" + idTurno;
Long abilitatoPassaggi = mySelectInteger(controlloPassaggi, "passaggi");
if (abilitatoPassaggi > 0) {
abilitatoPassaggi = abilitatoPassaggi + 1;
if (JOptionPane.showConfirmDialog(null,
"Sei sicuro di voler registrare il passaggio n° " + abilitatoPassaggi + " sulla tessera " + jTxtTessera.getText() + "?",
"Secondo Passaggio", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
azzera();
aggiornaLabelInfo();
return;
}
}
}
if (idTessera > 0L) {
StringBuilder elencoIdProdotti = new StringBuilder();
for (int i = model.getRowCount() - 1; i >= 0; i--) {
Long idCateg = Long.valueOf(model.getValueAt(i, colCategoria).toString());
if (idCateg != 0L) {
//04/03/2022 non e possibile acquistare prodotti che non siano partedi una composizione
String vassoio = "1";
myInsert("Insert into Acquisti "
+ "(id,id_Tessera,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,"
+ "Num_Progressivo,id_Tipo_Pagamento,flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera)"
+ "values(-1," + tessera + "," + model.getValueAt(i, colIDProdotto) + ","
//+ idPuntoCassa + "," + formattaDataOra(adesso) + ","
+ idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
+ model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) + ","
+ progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + ","
+ flagAsporto + "," + flagPassaggioTessera + ")");
aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
elencoIdProdotti.append(model.getValueAt(i, colIDProdotto));
elencoIdProdotti.append(",");
}
model.deleteRow(i);
spiaProgressivo = true;
}
for (int i = model2.getRowCount() - 1; i >= 0; i--) {
String flagGratuita = "0";
String flagBonus = "0";
if (gratuitaResidue > 0) {// && gratuitaResidue>Gratuita_ResidueProg){
flagGratuita = "1";
} else if (bonusResidui > 0) {
flagBonus = "1";
}
myInsert("Insert into Acquisti "
+ "(id,id_Tessera,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera)"
+ "values(-1," + tessera + "," + model2.getValueAt(i, 2) + "," + idPuntoCassa + "," +
//formattaDataOra(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + "," +
formatLocalDateTime(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + "," +
idModoPagamento + "," + idTurno + "," + flagGratuita + "," + flagBonus + "," +
flagAsporto + "," + flagPassaggioTessera + ")");
aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
model2.deleteRow(i);
spiaProgressivo = true;
}
} else {
StringBuilder elencoIdProdotti = new StringBuilder();
for (int i = model.getRowCount() - 1; i >= 0; i--) {
Long idCateg = Long.valueOf(model.getValueAt(i, colCategoria).toString());
if (idCateg != 0L) {
//04/03/2022 non e possibile acquistare prodotti che non siano partedi una composizione
String vassoio = "1";
myInsert("Insert into Acquisti (id,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
+ "flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera)values(-1,"
//+ model.getValueAt(i, colIDProdotto) + "," + idPuntoCassa + "," + formattaDataOra(adesso) + ","
+ model.getValueAt(i, colIDProdotto) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
+ model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti)
+ "," + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + ","
+ flagAsporto + "," + flagPassaggioTessera + ")");
aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
elencoIdProdotti.append(model.getValueAt(i, colIDProdotto));
elencoIdProdotti.append(",");
}
model.deleteRow(i);
spiaProgressivo = true;
}
for (int i = model2.getRowCount() - 1; i >= 0; i--) {
String flagGratuita = "0";
String flagBonusPerInsert = "0";
if (gratuitaResidue > 0) {// && gratuitaResidue>Gratuita_ResidueProg){
flagGratuita = "1";
} else if (flagBonus == 1 && bonusResidui > 0) {
flagBonusPerInsert = "1";
}
myInsert("Insert into Acquisti (id,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera)values(-1,"
//+ model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formattaDataOra(adesso) + ","
+ model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
+ model2.getValueAt(i, 1) + ",0," + progressivo + "," + idModoPagamento + "," + idTurno
+ "," + flagGratuita + "," + flagBonusPerInsert + "," + flagAsporto + "," + flagPassaggioTessera + ")");
aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
model2.deleteRow(i);
spiaProgressivo = true;
}
}
//aggiorno progressivi-------------
if (spiaProgressivo) {
progressivo++;
progressivoGiorno++;
progressivoTurno++;
myInsert("Update Progressivi set Prog_assoluto=" + progressivo + ",prog_giorno=" + progressivoGiorno
+ ",prog_Turno=" + progressivoTurno + ",incasso_turno_contanti=" + progressivoContanti
+ ",incasso_turno_ticket=" + progressivoTicket + ",incasso_turno_scalare=" + progressivoScalare
+ ",incasso_turno_differito=" + progressivoDifferito
//+ " where id_Punto_cassa=" + idPuntoCassa + " and id_turno=" + idTurno + " and data=" + formattaData(adesso));
+ " where id_Punto_cassa=" + idPuntoCassa + " and id_turno=" + idTurno + " and data=" + formatLocalDateTime(adesso));
}
String residuo = lblResiduo.getText().replace("?", "").trim();
if (residuo.equalsIgnoreCase("[...]")) {
residuo = "0";
}
if (residuo.length() > 6) {
residuo = residuo.substring(0, 5);
} else {
residuo = spaziBianchi(residuo, 6, false);
}
//Aggiornamento 12-04-2019
Integer bonus = 0;
if (flagBonus == 1 && bonusResidui > 0) {
bonus = bonusResidui--;
}
composizione = spaziBianchi(composizione + "Bonus:" + bonus, 20, true);
String Riga2 = "Saldo " + residuo;
display(composizione + Riga2, null);
timerDisplay.schedule(new TimerTask() {
@Override
public void run() {
statoAttivoLoggato();
}
}, 8000);
azzera();
aggiornaLabelInfo();
}
private boolean controllaDiscrepanzePrenotazioni(String elencoIdProdotto) {
boolean ok = true;
if (elencoIdProdotto.length() > 0) {
elencoIdProdotto = elencoIdProdotto.substring(0, elencoIdProdotto.length() - 1);
String[] el = elencoIdProdotto.split(",");
String query = "SELECT count(*) as nr FROM VIEW_PRENOTAZIONI_TURNO "
+ "WHERE id_Modalita in (2,3) "
+ "and id_stato in (0,1) "
+ "AND id_turno =" + idTurnoAttuale
+ " AND id_tessera = " + idTessera
+ " and id_Prenotazione=" + idPrenotazione;
int rowCount = Integer.parseInt(mySelect(query, "nr"));
if (rowCount > 0) {
if (rowCount == el.length) {
query = "SELECT count(*) as nr FROM VIEW_PRENOTAZIONI_TURNO "
+ "WHERE id_Modalita in (2,3) "
+ "and id_stato in (0,1) "
+ "AND id_turno =" + idTurnoAttuale
+ " AND id_tessera = " + idTessera
+ " AND id_Prodotto in (" + elencoIdProdotto + ") "
+ "and id_Prenotazione=" + idPrenotazione;
rowCount = Integer.parseInt(mySelect(query, "nr"));
if (rowCount == el.length) {
return true;
}
}
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this,
"I prodotti selezionati sono diversi dai prenotati!\nVuoi proseguire?", "Prenotazione",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);
if (Integer.parseInt(selectedValue.toString()) == 1) {
azzeraDopoStorno();
return false;
}
}
}
return ok;
}
private void aggiornaPrenotazioni(String elencoIdProdotto) {
try {
if (elencoIdProdotto.length() > 0) {
String query = "SELECT id FROM VIEW_PRENOTAZIONI_TURNO "
+ "WHERE id_Modalita in (2,3) "
+ "and id_stato in (0,1) "
+ "AND id_turno =" + idTurnoAttuale
+ " AND id_tessera = " + idTessera
+ " and id_Prenotazione=" + idPrenotazione;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
myInsert("Update PRENOTAZIONI_PASTI set id_Stato=2 where id=" + rs.getString("id"));
}
rs.close();
st.close();
dbConnection.close();
}
} catch (SQLException | NumberFormatException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
private void aggiornaProgressivoPagamentiTurno(Double importo) {
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare")) {
progressivoScalare = progressivoScalare + importo;
}
if (cercaTestoModoPagamento().equalsIgnoreCase("Contanti")) {
progressivoContanti = progressivoContanti + importo;
}
if (cercaTestoModoPagamento().equalsIgnoreCase("Ticket")) {
progressivoTicket = progressivoTicket + importo;
}
if (cercaTestoModoPagamento().equalsIgnoreCase("Differito")) {
progressivoDifferito = progressivoDifferito + importo;
}
}
private void azzera() {
try {
MyTableModel model = (MyTableModel) tblLista.getModel();
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
clearTable(model);
clearTable(model1);
} catch (Exception e) {
}
messaggioSaldoUnaVolta = false;
idTessera = 0L;
idPrenotazione = 0L;
idProfiloTariffario = 0L;
setModoPagamento(modoPagamentoDefault);
isCassaAperta = false;
txtTotaleCassa.setText("? 0,00");
txtTotalePunti.setText("Punti 0");
pnlCategorie.setVisible(false);
pnlProdotti.setVisible(false);
if (flagPrecaricaLista == false) {
abilitaPulsanti(pnlCategorie, false, false);
abilitaPulsanti(pnlProdotti, false, false);
}
pnlCategorie.setVisible(true);
pnlProdotti.setVisible(true);
bonusResidui = 0;
jTxtTessera.setText("");
pnlProdotti.removeAll();
pnlProdotti.repaint();
lblCategoria.setText("");
lblCognome.setText("");
lblNome.setText("");
lblNascita.setText("");
lblScadTessera.setText("");
lblAzienda.setText("");
lblConvenzione.setText("");
lblFascia.setText("");
jBtnStorno.setEnabled(false);
jBtnAsporto.setEnabled(false);
jbtnSu.setEnabled(false);
jbtnGiu.setEnabled(false);
jbtnElimina.setEnabled(false);
jbtnAnnulla.setEnabled(false);
jbtnDuplica.setEnabled(false);
lblSaldo.setText("[...]");
lblPunti.setText("[...]");
lblTipoPagamento.setText("[...]");
testoRFIDCard = new StringBuilder();
testoSwipCard = new StringBuilder();
statoCardLettore = false;
if (btnImpostaCliente.isVisible()) {
btnImpostaCliente.setEnabled(bottoneImposta);
}
jBtnBuoni.setEnabled(true);
lblResiduo.setText("[...]");
lblGratuita.setText("[...]");
jBtnAsporto.setSelected(false);
jBtnAsportoActionPerformed(null);
passaggioTessera = false;
passaggiEsauritiNoComposizione = false;
saldoMinimoStop = 0.0;
MyApplication myApp = new MyApplication();
myApp.unaVolta = false;
gratuitaResidue = 0;
//9-5-18<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if (flagPrecaricaLista) {
apriCassaDefault();
}
}
public void apriCassaDefault() {
lblCategoria.setText("");
lblCognome.setText("");
lblNome.setText("");
lblNascita.setText("");
lblScadTessera.setText("");
lblAzienda.setText("");
lblConvenzione.setText("");
lblFascia.setText("");
if (isCassaAperta == false) {
turnoAttuale();
if ((idTurnoAttuale - idTurno) != 0) {
progressivoTurno = 1L;
progressivoContanti = 0.00;
progressivoScalare = 0.00;
progressivoTicket = 0.00;
progressivoDifferito = 0.00;
if (nomeTurnoAttuale.equalsIgnoreCase("Pranzo")) {
progressivoGiorno = 1L;
}
idTurno = idTurnoAttuale;
nomeTurno = nomeTurnoAttuale;
Date adesso = new Date();
String controlloTurno = mySelect("select count(*) as Prog from Progressivi "
+ "where id_Punto_cassa=" + idPuntoCassa
+ " and data=" + formattaData(adesso)
+ " and id_Turno=" + idTurno, "Prog");
if (Long.parseLong(controlloTurno) <= 0) {
myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
+ " values (" + formattaData(adesso) + "," + idPuntoCassa + "," + idTurno + ","
+ progressivo + "," + progressivoGiorno + ",0)");
}
aggiornaLabelInfo();
}
isCassaAperta = true;
idProfiloTariffario = idProfiloTariffarioDefault;//0L
setModoPagamento(modoPagamentoDefault);
this.caricaPannello();
abilitaPulsanti(pnlCategorie, true, true);
jbtnChiudi.setEnabled(false);
}
}
public void cercaTessera() {//String QueryCF) {
MyApplication myApp = new MyApplication();
myApp.unaVolta = false;
setModoPagamento(modoPagamentoDefault);
String numeroTessera = jTxtTessera.getText();
String query = "SELECT DISTINCT c.nome || '|' || u.cognome || '|' || u.nome || '|' || "
+ "TO_CHAR (u.data_di_nascita, 'dd/mm/yyyy') || '|' || u.matricola || '|' || a.nome || '|' "
+ "|| c.nome || '|' || f.nome || '|' || t.ID || '|' || "
+ "TO_CHAR (t.data_scadenza, 'dd/mm/yyyy') || '|' || t.id_stato || '|' || u.ID || '|' || f.ID || '|' "
+ "|| t.gratuita_residue || '|' || t.bonus_residui AS ris "
+ " FROM categorie_utenti c, tessere t, utenti u, categorie_utenti_fasce cf, fasce f, aziende a "
+ "WHERE t.id_utente = u.ID "
+ "AND u.id_categoria = c.ID "
+ "AND c.id_azienda = a.ID "
+ "AND cf.id_categoria_utenti = c.ID "
+ "AND cf.id_fascia = f.ID "
+ "AND t.numero = '" + numeroTessera + "'";
String res = mySelect(query, "ris");
if (res.length() > 0) {
String dati[] = res.split("\\|", -1);
Date now = new Date();
Date scadenza = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
idProfiloTariffario = Long.valueOf(dati[12]);
if (idProfiloTariffario.equals(idProfiloTariffarioDefault)) {
JOptionPane.showOptionDialog(this, "Impostato Profilo Tariffario di default!", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
}
Integer idStato = Integer.valueOf(dati[10]);
idTessera = Long.valueOf(dati[8]);
logIDTessera = idTessera.toString();
logTessera();
try {
// controllo abilitazione tessera
String controlloPunto = "Select controlla_abilitazione('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
Long abilitato = mySelectInteger(controlloPunto, "T");
if (abilitato == 0) {
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
if (Integer.parseInt(selectedValue.toString()) != 0) {
return;
} else {
myInsert("Insert into Forzature (id,id_account,id_Punto_Cassa,id_Tessera,id_Tipo_Forzatura) values (-1," + idAccount + "," + idPuntoCassa + "," + idTessera + ",1)");
}
}
//controllo passaggi
String controlloPassaggi = "Select controlla_passaggi('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
Long abilitatoPassaggi = mySelectInteger(controlloPassaggi, "T");
if (abilitatoPassaggi == 0L) {
//05/09/2022
String queryPassaggi = "select count(*) as NRec from st_acquisti a inner join prodotti p on a.id_prodotto=p.id inner join Tipi_Pagamenti tp on a.id_tipo_pagamento=tp.id where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa;
Long numeroPassaggi = mySelectInteger(queryPassaggi, "NRec");
//fine----
if (flagEsegueStorni && numeroPassaggi > 0) {
Object[] options = {"Si", "No"};
Object selectedValue = JOptionPane.showOptionDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!\nSi desidera effettuare uno storno per un pasto erroneamente addebitato?", "Attenzione",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
if (Integer.parseInt(selectedValue.toString()) == 0) {
apriStorno(true);
} else {
azzeraDopoStorno();
return;
}
} else {
JOptionPane.showMessageDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!");
azzeraDopoStorno();
return;
}
}
//aggiungo un giorno altrimenti in caso di scadenza nello stesso giorno
//considera le ore
scadenza = formatter.parse(dati[9]);
Calendar c = Calendar.getInstance();
c.setTime(scadenza);
c.add(Calendar.DATE, 1);
scadenza = c.getTime();
if (scadenza.after(now) && idStato != 2) {
String modoPagamento = cercaTestoModoPagamento();
lblCategoria.setText(dati[0]);
lblCognome.setText(dati[1]);
lblNome.setText(dati[2]);
if (flagMostraDataDiNascita) {
lblNascita.setText(dati[3]);
}
lblAzienda.setText(dati[5]);
lblConvenzione.setText(dati[6]);
lblFascia.setText(dati[7]);
jBtnStorno.setEnabled(flagEsegueStorni);
jBtnAsporto.setEnabled(true);
jbtnChiudi.setEnabled(true);
if (btnImpostaCliente.isVisible()) {
btnImpostaCliente.setEnabled(false);
jBtnBuoni.setEnabled(false);
}
if (flagPrecaricaLista == false) {
isCassaAperta = true;
abilitaPulsanti(pnlCategorie, true, true);
abilitaPulsanti(pnlProdotti, true, true);
}
if (dati.length > 13) {
if (dati[13].length() > 0) {
gratuitaResidue = Integer.parseInt(dati[13]);
}
lblGratuita.setText(dati[13]);
}
bonusResidui = 0;
if (dati.length > 14) {
if (dati[14].length() > 0) {
bonusResidui = Integer.parseInt(dati[14]);
}
}
lblScadTessera.setText("" + bonusResidui);
if (modoPagamento.equalsIgnoreCase("A scalare")) {
//modifica 09-11-18
if (calcolaTotale() > 0.00 && flagPrecaricaLista == false) {
verificaSaldo(numeroTessera);
}
//fine modifica
} else {
MyApplication MyA = new MyApplication();
String punti = MyA.mySelect(this, "Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti");
lblPunti.setText(punti);
String tipo = cercaTestoModoPagamento();
lblTipoPagamento.setText(tipo);
}
stoCalcolando = true;
pulsantiModoPagamento();
stoCalcolando = false;
this.caricaPannello();
abilitaPulsanti(pnlCategorie, true, true);
statoTesseraLetta(gratuitaResidue, bonusResidui);
//28-09-2016 quando c'è una sola categoria faccio click
if (numeroCategorie == 1) {
Component[] components = pnlCategorie.getComponents();
JToggleButton bt = (JToggleButton) components[0];
}
//FlagDefaultAsporto
if (asporto) {
jBtnAsporto.setSelected(true);
jBtnAsportoActionPerformed(null);
}
MyTableModel model = (MyTableModel) tblLista.getModel();
if (flagPrecaricaLista) {
forzaPrezzi(model);
}
controllaCompleti(model);
controllaExtra(model);
sommaColonne(model);
//modifica 09-11-18
if (modoPagamento.equalsIgnoreCase("A scalare")) {
if (calcolaTotale() > 0.00 && flagPrecaricaLista) {
verificaSaldo(numeroTessera);
}
}
//fine modifica
//05-06-2020
if (abilitatoPassaggi != 0L) {
controllaPrenotazioni();
}
} else {
JOptionPane.showMessageDialog(this, "Tessera Scaduta o Disabilitata!");
logTessera();
azzera();
}
} catch (ParseException e) {
logTesseraErrore = e.getMessage();
logTessera();
azzera();
}
} else {
JOptionPane.showMessageDialog(this, "Errore in lettura della tessera!");
logTessera();
azzera();
}
}
private void controllaPrenotazioni() {
try {
String query = "SELECT * FROM (SELECT id_Prenotazione as nr FROM VIEW_PRENOTAZIONI_TURNO "
+ "WHERE id_modalita in (2,3) "
+ "AND id_stato IN (0,1) "
+ "AND id_turno = " + idTurnoAttuale + " "
+ "AND id_tessera = " + idTessera + " "
+ "order by id_prenotazione) "
+ "where rownum = 1";
String idP = mySelect(query, "nr");
if (idP.length() > 0) {
Long rowCount = Long.valueOf(idP);
idPrenotazione = rowCount;
if (rowCount > 0L) {
query = "SELECT Distinct Nome FROM VIEW_PRENOTAZIONI_TURNO v join prodotti p on v.ID_PRODOTTO=p.ID "
+ "WHERE id_Modalita in (2,3) "
+ "and id_stato in (0,1) "
+ "AND id_turno =" + idTurnoAttuale
+ " AND id_tessera = " + idTessera
+ " and id_prenotazione=" + idPrenotazione
+ " order by Nome";
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(query);
StringBuilder s = new StringBuilder("");
while (rs.next()) {
s.append(rs.getString("Nome"));
s.append("\n");
}
rs.close();
st.close();
dbConnection.close();
if (JOptionPane.showConfirmDialog(null, "Prenotazione presente:\n" + s.toString() + "Inserisco i prodotti?", "Prenotazione", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
inserisciPrenotazioni();
}
}
}
} catch (SQLException | NumberFormatException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
} finally {
}
}
private void inserisciPrenotazioni() {
try {
MyTableModel model = (MyTableModel) tblLista.getModel();
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
clearTable(model);
clearTable(model1);
sommaColonne(model);
String query = "SELECT * FROM VIEW_PRENOTAZIONI_TURNO "
+ "WHERE id_Modalita in (2,3) "
+ "and id_stato in (0,1) "
+ "AND id_turno =" + idTurnoAttuale
+ " AND id_tessera = " + idTessera
+ " and id_prenotazione=" + idPrenotazione;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
java.awt.event.ActionEvent evt;
evt = new java.awt.event.ActionEvent(new Object(), 0, "PRODOTTO[" + rs.getString("ID_PRODOTTO") + "]");
actionPerformed(evt);
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException | NumberFormatException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
} finally {
}
}
public void azzeraDopoStorno() {
annulla();
timerDisplay.schedule(new TimerTask() {
@Override
public void run() {
azzera();
aggiornaProgressivi();
}
}, 500);
passaggiEsauritiNoComposizione = true;
}
private Double calcolaTotale() {
Double totAcquisto = 0.00;
if (txtTotaleCassa.getText().length() > 0) {
String Saldo = txtTotaleCassa.getText().replace("? ", "").replace(".", "");
Saldo = Saldo.replace(",", ".");
totAcquisto = Double.parseDouble(Saldo);
}
return totAcquisto;
}
private void forzaPrezzi(MyTableModel model) {
for (int y = 0; y < model.getRowCount(); y++) {
Object row[] = model.getRow(y);
String idProdotto = row[3].toString();
String query = "SELECT Punti || '|' || prezzo as res FROM tariffe "
+ "where id_Prodotto = " + idProdotto
+ " and id_fascia=" + idProfiloTariffario;
String res = mySelect(query, "res");
if (res.length() > 0) {
String[] el = res.split("\\|", -1);
Double prezzo;
Integer punti;
punti = Integer.valueOf(el[0]);
prezzo = Double.valueOf(el[1].replace(",", "."));
model.setValueAt(prezzo, y, colImporto);
model.setValueAt(prezzo, y, colImporto2);
model.setValueAt(punti, y, colPunti);
doLayout();
}
}
}
private void abilitaPulsanti(JPanel aPanel, Boolean abilita, Boolean apertura) {
Component c;
Component[] components = aPanel.getComponents();
if (components != null) {
int numComponents = components.length;
for (int i = 0; i < numComponents; i++) {
c = components[i];
if (c != null) {
JToggleButton bt = (JToggleButton) c;
if (bt == null) {
c.setEnabled(abilita);
} else {
try {
if (bt.getText().equalsIgnoreCase("<html>Composizione</html>") && passaggiEsauritiNoComposizione && aPanel.getName().equalsIgnoreCase("pnlCategorie")) {
bt.setEnabled(false);
} else {
bt.setEnabled(abilita);
}
if (bt.getText().equalsIgnoreCase("<html>Composizione</html>") && menuGiornoPresente == false && apertura) {
bt.setEnabled(true);
bt.setSelected(true);
pulsantiCategoria("0", "Categoria[0]");
} else {
bt.setSelected(false);
}
} catch (Exception ex) {
}
}
}
}
}
}
/*private void stampa() {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
JInternalReport P = new JInternalReport();
P.TitoloReport = "Scontrino";
String Query = "Select Prodotti.Nome as Prodotto,Importo,Acquisti.id from Acquisti inner join Prodotti on Acquisti.id_prodotto=prodotti.id where Num_Progressivo=" + (progressivo - 1) + " and id_Punto_cassa=" + idPuntoCassa;
String[] ColReport = {"Prodotto", "Importo"};
String[] ColTypeReport = {"text", "float"};
String SelectRows = "Select count(*) as nr from Acquisti where Num_Progressivo=" + (progressivo - 1) + " and id_Punto_cassa=" + idPuntoCassa;
int rowCount = Integer.parseInt(mySelect(SelectRows, "nr"));
Object[][] dataReport = rowData(Query, ColReport, ColTypeReport, rowCount);
P.CreaReport(ColReport, ColTypeReport, dataReport);
P.setVisible(true);
P.show();
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}*/
public Object[][] rowData(String Query, String[] Cols, String[] ColType, int rowCount) {
Object[][] rows = null;
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
rows = new Object[rowCount][];
int r = 0;
while (rs.next()) {
Object[] row = new Object[Cols.length];
for (int i = 0; i < Cols.length; i++) {
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
row[i] = "";
} else {
row[i] = rs.getString(Cols[i].replace(" ", "_"));
}
switch (ColType[i]) {
case "text" -> {
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
row[i] = "";
} else {
row[i] = rs.getString(Cols[i].replace(" ", "_"));
}
}
case "integer" -> {
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
row[i] = 0;
} else {
row[i] = rs.getInt(Cols[i].replace(" ", "_"));
}
}
case "boolean" -> {
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
row[i] = false;
} else {
row[i] = rs.getBoolean(Cols[i].replace(" ", "_"));
}
}
case "float" -> {
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
row[i] = 0.00;
} else {
String v = rs.getString(Cols[i].replace(" ", "_"));
row[i] = Float.valueOf(v.replace(",", "."));
}
}
}
}
rows[r] = row;
r++;
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException | NumberFormatException e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
} finally {
return rows;
}
}
private String mySelect(String Query, String Campo) {
String res = "";
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(Query);
while (rs.next()) {
res = rs.getString(Campo);
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
}
if (res == null) {
res = "";
}
return res;
}
private Boolean myInsert(String query) {
System.out.println(query);
Boolean res = false;
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(query);
rs.close();
st.close();
dbConnection.close();
res = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + query + "']");
}
return res;
}
private Long mySelectInteger(String query, String campo) {
Long res = 0L;
try {
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement st = dbConnection.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
res = rs.getLong(campo);
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, "Errore MySelectInteger ['" + e.getMessage() + " " + query + "']");
}
return res;
}
public void insertImage() {
String filenamepath = new String("L:\\Lavoro\\Goffredo\\risorse\\Brioche.jpg");
try {
File file = new File(filenamepath);
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement stat = dbConnection.createStatement();
PreparedStatement ps = dbConnection.prepareStatement("Update Prodotti set icona=?");
// bind the data......
System.out.println("Lenght:" + file.getAbsolutePath());
InputStream inputimage = new FileInputStream(file);
ps.setBinaryStream(1, inputimage, (int) file.length());
ps.execute();
ps.close();
dbConnection.close();
} catch (Exception e) {
System.out.println("Error at Image Insert:" + e);
e.printStackTrace();
}
}
public void getImage(String idProdotto) {
String FullName = null;
InputStream gifdata = null;
try {
String Query = "select icona from Prodotti where id=" + idProdotto;
// create prepare Statement pst
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
PreparedStatement pst = dbConnection.prepareStatement(Query);
ResultSet result = pst.executeQuery();
if (result.next()) {
FullName = imgPath + idProdotto + ".jpg";
//using Srteam Method'''''
gifdata = result.getBinaryStream(1);
//create file
if (gifdata != null) {
File giffile = new File(FullName);
//write the byte array into a local file.
FileOutputStream file = new FileOutputStream(giffile);
int chunk = 0;
while ((chunk = gifdata.read()) != -1) {
file.write(chunk);
}
file.flush();
file.close();
}
}
result.close();
pst.close();
dbConnection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private byte[] getPhoto(String Query)
throws Exception, SQLException {
String req = "";
Blob img;
byte[] imgData = null;
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
Statement stmt = dbConnection.createStatement();
// query
req = Query;
ResultSet rset = stmt.executeQuery(req);
while (rset.next()) {
img = rset.getBlob(1);
imgData = img.getBytes(1, (int) img.length());
}
rset.close();
stmt.close();
dbConnection.close();
return imgData;
}
private String formattaDataOra(Date data) {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
return "to_date('" + formatter.format(data) + "','dd/mm/yyyy HH24:MI:SS')";
}
private String formatLocalDateTime(LocalDateTime data){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
return data.format(formatter);
}
private String formattaData(Date data) {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
return "to_date('" + formatter.format(data) + "','dd/mm/yyyy')";
}
private void aggiungiImmaginiPulsanti() {
aggiungImmagini(jBtnStorno, "Storno.png", 70, 70);
aggiungImmagini(jBtnAsporto, "coltello e forchetta.jpg", 50, 50);
aggiungImmagini(jTBP0, "a scalare.png", 50, 50);
aggiungImmagini(jTBP1, "Contanti.png", 50, 50);
aggiungImmagini(jTBP2, "Ticket.png", 50, 50);
aggiungImmagini(jTBP3, "differito.png", 50, 50);
aggiungImmagini(jBtnprodotti, "Prodotti.png", 50, 50);
SwingUtilities.updateComponentTreeUI(jTBP0);
aggiungImmagini(jBtnMovimenti, "Movimenti.png", 50, 50);
}
private void aggiungImmagini(JButton btn, String Immagine, int width, int height) {
ImageIcon icon = new ImageIcon(imgPath + Immagine);
Image img = icon.getImage();
Image newimg = img.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);
icon = new ImageIcon(newimg);
btn.setIcon(icon);
}
private void aggiungImmagini(JToggleButton btn, String Immagine, int width, int height) {
ImageIcon icon = new ImageIcon(imgPath + Immagine);
Image img = icon.getImage();
Image newimg = img.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);
icon = new ImageIcon(newimg);
btn.setIcon(icon);
btn.setDisabledIcon(null);
btn.setDisabledIcon(icon);
}
// ==========================================================================
// * Metodo main()
// *
// * @param args the command line arguments
// *
// ==========================================================================
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
// =================================================================
// *** Crea la form base
// =================================================================
PuntoCassa p = new PuntoCassa();
p.aggiungImmagini(p.jBtnDB1, "DB.png", 50, 50);
// =================================================================
// *** Esegue il resize a seconda delle impostazioni video per
// *** occupare tutto lo schermo utile
// =================================================================
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
p.setSize(1024, 768);
p.setLocation((int) (screenSize.width - 1024) / 2, (int) (screenSize.height - 768) / 2);
p.resize();
// =================================================================
// *** Mostra la form nello stato iniziale
// =================================================================
p.pnlErrore.setVisible(false);
p.pnlLogin.setVisible(true);
p.lblUtenteLoggato.setVisible(true);
p.lblInfo.setVisible(true);
p.lblStatoConnessione.setVisible(true);
p.pnlTop.setVisible(false);
p.setVisible(true);
}
});
}
public void controllaLogInCarta(String nTessera) {
if (turno()) {
String Query = "select a.username || '|' || a.id || '|' || a.id_stato as res"
+ " from accounts a, utenti u, tessere t, profili p, ruoli r where a.id_utente = u.id"
+ " and t.id_utente = u.id"
+ " and p.id_account = a.id"
+ " and p.id_ruolo = r.id"
//+ " and r.id = 10000000004" + //*** Operatore di cassa ***/
+ " and t.numero = '" + nTessera + "'"; //*** Numero della tessera letto su smartcard ***
MyApplication MyA = new MyApplication();
String[] res = MyA.mySelect(this, Query, "res").split("\\|");
if (res.length >= 3) {
utenteLoggato = res[0];
idAccount = Long.parseLong(res[1]);
Integer Stato = Integer.parseInt(res[2]);
if (utenteLoggato.length() > 0 && idAccount > 0L && Stato == 1) {
String sql = "SELECT count(*) as Counter FROM profili p WHERE p.id_account = " + idAccount + " AND p.id_ruolo = 10000000004";
Integer counter = Integer.parseInt(MyA.mySelect(this, sql, "Counter"));
if (counter == 1) {
impostaAmbiente();
verificaAggiornamentoDB();
} else {
idAccount = 0L;
utenteLoggato = "";
JOptionPane.showMessageDialog(this, "L'utente non dispone dei privilegi per l'utilizzo del modulo cassa.");
}
} else {
utenteLoggato = "";
idAccount = 0L;
if (Stato == 2) {
String Messaggio = MyA.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + Stato, "descrizione");
JOptionPane.showMessageDialog(this, Messaggio + ".");
} else {
JOptionPane.showMessageDialog(this, "Tessera sconosciuta!");
}
}
} else {
JOptionPane.showMessageDialog(this, "Tessera sconosciuta!");
}
cartaLetta = true;
} else {
JOptionPane.showMessageDialog(this, "Impossibile eseguire il Login al sistema:\nNessun Turno Attivo!");
}
}
private void display(String Titolo, String Prezzo) {
System.out.println("Display: " + Titolo);
if (visualizzaMessaggiDisplay) {
try {
SerialPort serialPort = new SerialPort("COM3");
try {
serialPort.openPort();//Open serial port
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);//Set params. Also you can set params by this string: serialPort.setParams(9600, 8, 1, 0);
String Testo = Titolo;
if (Prezzo != null) {
Testo = Titolo + spaziBianchi(Prezzo, 40 - Titolo.length(), false);
}
serialPort.writeBytes(Testo.getBytes());//Write data to port
serialPort.closePort();//Close serial port
} catch (SerialPortException ex) {
if (serialPort.isOpened()) {
serialPort.closePort();
}
JOptionPane.showMessageDialog(this, ex.getMessage());
}
} catch (SerialPortException | HeadlessException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage());
}
}
}
String spaziBianchi(String Testo, Integer Num, Boolean Suffisso) {
String res = Testo;
StringBuilder Suff = new StringBuilder();
if (Testo.length() < Num) {
Integer Delta = Num - Testo.length();
for (Integer i = 0; i < Delta; i++) {
Suff.append(" ");
}
if (Suffisso == false) {
res = Suff.toString() + Testo;
} else {
res = Testo + Suff.toString();
}
}
return res;
}
private void statoAttivoNonLoggato() {
String PC = idPuntoCassa.toString();
if (PC.length() >= 5) {
PC = PC.substring(PC.length() - 5, PC.length());
} else {
PC = spaziBianchi(PC, 5, false);
}
String Riga = spaziBianchi(messageDisplay, 20, true) + "POS " + PC + " CHIUSO";
display(Riga, null);
}
private void statoAttivoLoggato() {
//per evitare che inserendo la tessera successiva mi cancelli il num tessera
if (jTxtTessera.getText().trim().length() <= 0) {
String PC = idPuntoCassa.toString();
if (PC.length() >= 5) {
PC = PC.substring(PC.length() - 5, PC.length());
} else {
PC = spaziBianchi(PC, 5, false);
}
String Riga = spaziBianchi(messageDisplay, 20, true) + "POS " + PC + " APERTO";
display(Riga, null);
}
}
private void statoTesseraLetta(int Gratuita, int Bonus) {
String tess = jTxtTessera.getText();
if (tess.length() >= 12) {
tess = tess.substring(tess.length() - 12, tess.length());
} else {
tess = spaziBianchi(tess, 12, false);
}
String fa = "";
fa = spaziBianchi(fa, 13, true);
if (Gratuita > 0) {
} else if (Bonus > 0) {
fa = "BONUS ";
}
}
class MyCanvas extends JComponent {
private String texto = "";
public MyCanvas(String Testo) {
texto = Testo;
}
@Override
public void paintComponent(Graphics g) {
if (g instanceof Graphics2D) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.drawString(texto, 70, 20);
}
}
}
class CardTask extends TimerTask {
PuntoCassa frmA;
public CardTask(PuntoCassa frmx) {
frmA = frmx;
}
public void run() {
MyApplication myApp = new MyApplication();
try {
myApp.smartCard.setReader(jcmbSC.getSelectedItem());
myApp.smartCard.connect("T=1");
statoCarta = StatiCarta.INSERITA;
if (pnlLogin.isVisible() == false && cartaLetta == false) {
jBtnReadCardActionPerformed(null);
passaggioTessera = true;
frmA.cercaTessera();
cartaLetta = true;
} else if (pnlLogin.isVisible() == true && cartaLetta == false) {
frmA.controllaLogInCarta(getNumeroTessera());
}
} catch (Exception e) {
if (statoCarta == StatiCarta.INSERITA) {
statoCarta = StatiCarta.RIMOSSA;
} else {
statoCarta = StatiCarta.ASSENTE;
}
cartaLetta = false;
}
}
}
// ==========================================================================
// *** Sottoclasse per la gestione degli eventi a timer
// ==========================================================================
public class timerDBConn extends java.util.TimerTask {
// =======================================================================
// ** Implementazione del riferimento alla classe contenitore
// =======================================================================
private PuntoCassa pc;
Connection dbConnection;
timerDBConn(PuntoCassa pc) {
this.pc = pc;
}
PuntoCassa getPuntoCassa() {
return pc;
}
// =======================================================================
// ** Contiene il processo da eseguire in background
// =======================================================================
public void run() {
String sql;
Statement st = null;
ResultSet rs;
// ====================================================================
// * Se non c'è connessione al DB prova a connettersi
// ====================================================================
try {
Class.forName(dbDriver);
dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
} catch (Exception ex) {
this.pc.utenteLoggato = "";
this.pc.lblStatoConnessione.setText("Errore di connessione al db");
}
//}
// ====================================================================
// * Se c'e connessione
// ====================================================================
// -----------------------------------------------------------------
// *** Verifica lo stato di attivita della connessione
// -----------------------------------------------------------------
if (dbTipo.equals("Oracle")) {
sql = "Select Valore as now from Parametri where chiave='UltimoAggTabelle'";
} else {
sql = "SELECT now() AS now FROM dual";
}
try {
st = dbConnection.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
String strRiga = rs.getString("now");
this.pc.lblStatoConnessione.setText(strRiga + " Vers. " + versione);
}
// --------------------------------------------------------------
// ** Verifica se c'e un utente loggato
// --------------------------------------------------------------
this.pc.pnlErrore.setVisible(false);
// --------------------------------------------------------------
// ** Verifica se c'e un utente loggato
// --------------------------------------------------------------
if (this.pc.utenteLoggato == "") {
this.pc.pnlLogin.setVisible(true);
} else {
this.pc.pnlLogin.setVisible(false);
}
rs.close();
st.close();
dbConnection.close();
} catch (SQLException e) {
this.pc.pnlErrore.setVisible(true);
this.pc.lblMessaggioErrore.setText("Errore di connessione al database!");//Errore query " + sql);
}
}
}
// ==========================================================================
// *** Sottoclasse per i button categoria
// ==========================================================================
public class buttonCategoria extends javax.swing.JButton {
}
// ==========================================================================
// *** Sottoclasse per i button prodotto
// ==========================================================================
public class buttonProdotto extends javax.swing.JButton {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton btnImpostaCliente;
private javax.swing.JButton btnLogin;
private javax.swing.JButton btnTermina;
private javax.swing.JToggleButton jBtnAsporto;
private javax.swing.JButton jBtnBuoni;
private javax.swing.JButton jBtnDB1;
private javax.swing.JButton jBtnMovimenti;
private javax.swing.JButton jBtnReadCard;
private javax.swing.JButton jBtnStorno;
private javax.swing.JButton jBtnprodotti;
private javax.swing.JCheckBox jChLogin;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JToggleButton jTBP0;
private javax.swing.JToggleButton jTBP1;
private javax.swing.JToggleButton jTBP2;
private javax.swing.JToggleButton jTBP3;
private javax.swing.JTextField jTxtTessera;
private javax.swing.JButton jbtnAnnulla;
private javax.swing.JButton jbtnChiudi;
private javax.swing.JButton jbtnDuplica;
private javax.swing.JButton jbtnElimina;
private javax.swing.JButton jbtnEsci;
private javax.swing.JButton jbtnGiu;
private javax.swing.JButton jbtnStampa;
private javax.swing.JButton jbtnSu;
private javax.swing.JComboBox jcmbSC;
private javax.swing.JLabel lblAzienda;
private javax.swing.JLabel lblCategoria;
private javax.swing.JLabel lblCodice;
private javax.swing.JLabel lblCodice1;
private javax.swing.JLabel lblCodice2;
private javax.swing.JLabel lblCodice3;
private javax.swing.JLabel lblCodice4;
private javax.swing.JLabel lblCodice5;
private javax.swing.JLabel lblCognome;
private javax.swing.JLabel lblConvenzione;
private javax.swing.JLabel lblDB;
private javax.swing.JLabel lblDenominazione;
private javax.swing.JLabel lblFascia;
private javax.swing.JLabel lblGratuita;
private javax.swing.JLabel lblInfo;
private javax.swing.JLabel lblInfo2;
private javax.swing.JLabel lblMessaggioErrore;
private javax.swing.JLabel lblNascita;
private javax.swing.JLabel lblNome;
private javax.swing.JLabel lblOrganizzazione;
private javax.swing.JLabel lblOrganizzazione1;
private javax.swing.JLabel lblOrganizzazione2;
private javax.swing.JLabel lblOrganizzazione3;
private javax.swing.JLabel lblOrganizzazione4;
private javax.swing.JLabel lblOrganizzazione5;
private javax.swing.JLabel lblPassword;
private javax.swing.JLabel lblPunti;
private javax.swing.JLabel lblResiduo;
private javax.swing.JLabel lblSaldo;
private javax.swing.JLabel lblScadTessera;
private javax.swing.JLabel lblStatoConnessione;
private javax.swing.JLabel lblTipoPagamento;
private javax.swing.JLabel lblUsername;
private javax.swing.JLabel lblUtenteLoggato;
private javax.swing.JPanel pnlAzioni;
private javax.swing.JPanel pnlCategorie;
private javax.swing.JPanel pnlCliente;
private javax.swing.JPanel pnlConto;
private javax.swing.JPanel pnlErrore;
private javax.swing.JPanel pnlLista;
private javax.swing.JPanel pnlLista1;
private javax.swing.JPanel pnlLogin;
private javax.swing.JPanel pnlProdotti;
protected javax.swing.JPanel pnlTop;
private javax.swing.JScrollPane scpLista;
private javax.swing.JScrollPane scpLista1;
private javax.swing.JTable tblLista;
private javax.swing.JTable tblLista1;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtTotaleCassa;
private javax.swing.JTextField txtTotalePunti;
private javax.swing.JTextField txtUsername;
// End of variables declaration//GEN-END:variables
}