cancellazione classe MyDialog non usata
ulteriore refactoring metodi per invocazione query, spostamento metodi in classe Utils
This commit is contained in:
		
							parent
							
								
									086dc95e49
								
							
						
					
					
						commit
						a6384a95d3
					
				@ -3,16 +3,11 @@ package puntocassa;
 | 
				
			|||||||
import SmartCard.ISO7816Response;
 | 
					import SmartCard.ISO7816Response;
 | 
				
			||||||
import SmartCard.SmartCard;
 | 
					import SmartCard.SmartCard;
 | 
				
			||||||
import SmartCard.StringUtil;
 | 
					import SmartCard.StringUtil;
 | 
				
			||||||
import java.sql.Connection;
 | 
					 | 
				
			||||||
import java.sql.DriverManager;
 | 
					 | 
				
			||||||
import java.sql.ResultSet;
 | 
					 | 
				
			||||||
import java.sql.SQLException;
 | 
					 | 
				
			||||||
import java.sql.Statement;
 | 
					 | 
				
			||||||
import java.text.DecimalFormat;
 | 
					 | 
				
			||||||
import javax.smartcardio.CardException;
 | 
					import javax.smartcardio.CardException;
 | 
				
			||||||
import javax.smartcardio.CommandAPDU;
 | 
					import javax.smartcardio.CommandAPDU;
 | 
				
			||||||
import javax.smartcardio.ResponseAPDU;
 | 
					import javax.smartcardio.ResponseAPDU;
 | 
				
			||||||
import javax.swing.JOptionPane;
 | 
					import javax.swing.JOptionPane;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * To change this license header, choose License Headers in Project Properties.
 | 
					 * To change this license header, choose License Headers in Project Properties.
 | 
				
			||||||
@ -26,8 +21,8 @@ import javax.swing.JOptionPane;
 | 
				
			|||||||
public class MyApplication {
 | 
					public class MyApplication {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static String path = "";// System.getProperty("user.dir") + "/db/MyFactoryDB.sqlite";
 | 
					    public static String path = "";// System.getProperty("user.dir") + "/db/MyFactoryDB.sqlite";
 | 
				
			||||||
    public static String elencoRigheDivisori = "";
 | 
					    //public static String elencoRigheDivisori = "";
 | 
				
			||||||
    public static String elencoColonneFloat = "";
 | 
					    //public static String elencoColonneFloat = "";
 | 
				
			||||||
    public static String elencoColonneReport = "";
 | 
					    public static String elencoColonneReport = "";
 | 
				
			||||||
    public static String reportColonnaGroupBy = "";
 | 
					    public static String reportColonnaGroupBy = "";
 | 
				
			||||||
    public static String reportColonnaSomma = "";
 | 
					    public static String reportColonnaSomma = "";
 | 
				
			||||||
@ -37,43 +32,11 @@ public class MyApplication {
 | 
				
			|||||||
    public static Boolean tastieraVideo = true;
 | 
					    public static Boolean tastieraVideo = true;
 | 
				
			||||||
    public static Boolean unaVolta = false;
 | 
					    public static Boolean unaVolta = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean isNumeric(String s) {
 | 
					 | 
				
			||||||
        return s.matches("[-+]?\\d*\\.?\\d+");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public String numericMonth(String month) {
 | 
					 | 
				
			||||||
        String num = "";
 | 
					 | 
				
			||||||
        switch (month) {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            case "Jan" ->
 | 
					 | 
				
			||||||
                num = "01";
 | 
					 | 
				
			||||||
            case "Feb" ->
 | 
					 | 
				
			||||||
                num = "02";
 | 
					 | 
				
			||||||
            case "Mar" ->
 | 
					 | 
				
			||||||
                num = "03";
 | 
					 | 
				
			||||||
            case "Apr" ->
 | 
					 | 
				
			||||||
                num = "04";
 | 
					 | 
				
			||||||
            case "May" ->
 | 
					 | 
				
			||||||
                num = "05";
 | 
					 | 
				
			||||||
            case "Jun" ->
 | 
					 | 
				
			||||||
                num = "06";
 | 
					 | 
				
			||||||
            case "Jul" ->
 | 
					 | 
				
			||||||
                num = "07";
 | 
					 | 
				
			||||||
            case "Aug" ->
 | 
					 | 
				
			||||||
                num = "08";
 | 
					 | 
				
			||||||
            case "Sep" ->
 | 
					 | 
				
			||||||
                num = "09";
 | 
					 | 
				
			||||||
            case "Oct" ->
 | 
					 | 
				
			||||||
                num = "10";
 | 
					 | 
				
			||||||
            case "Nov" ->
 | 
					 | 
				
			||||||
                num = "11";
 | 
					 | 
				
			||||||
            case "Dec" ->
 | 
					 | 
				
			||||||
                num = "12";
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return num;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    public String mySelect(PuntoCassa frmA, String query, String campo) {
 | 
					
 | 
				
			||||||
 | 
					    /*public String mySelect(PuntoCassa frmA, String query, String campo) {
 | 
				
			||||||
        String res = "";
 | 
					        String res = "";
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Connection dbConnection = DriverManager.getConnection(frmA.dbStringa, frmA.dbUsername, frmA.dbPassword);
 | 
					            Connection dbConnection = DriverManager.getConnection(frmA.dbStringa, frmA.dbUsername, frmA.dbPassword);
 | 
				
			||||||
@ -94,23 +57,21 @@ public class MyApplication {
 | 
				
			|||||||
            res = "";
 | 
					            res = "";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
    }
 | 
					    }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String ExportCSV(Object[][] data, String[] cols, String[] colType, int colInizio) {
 | 
					    /*public String exportCSV(Object[][] data, String[] cols, String[] colType, int colInizio) {
 | 
				
			||||||
        StringBuilder s = new StringBuilder("");
 | 
					        StringBuilder s = new StringBuilder("");
 | 
				
			||||||
        DecimalFormat df = new DecimalFormat("#0.00");
 | 
					        DecimalFormat df = new DecimalFormat("#0.00");
 | 
				
			||||||
        for (int i = colInizio; i < cols.length; i++) {
 | 
					        for (int i = colInizio; i < cols.length; i++) {
 | 
				
			||||||
            s.append(cols[i]).append(";");
 | 
					            s.append(cols[i]).append(";");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        s.append("\r");
 | 
					        s.append("\r");
 | 
				
			||||||
        for (int i = 0; i < data.length; i++) {
 | 
					        for (Object[] data1 : data) {
 | 
				
			||||||
            for (int c = colInizio; c < cols.length; c++) {
 | 
					            for (int c = colInizio; c < cols.length; c++) {
 | 
				
			||||||
                if (data[i][c] == null) {
 | 
					                if (data1[c] == null) {
 | 
				
			||||||
                    s.append(";");
 | 
					                    s.append(";");
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
 | 
					                    String field = data1[c].toString().replace("\r", " ");
 | 
				
			||||||
                    String field = data[i][c].toString().replace("\r", " ");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (colType[c].equalsIgnoreCase("integer")) {
 | 
					                    if (colType[c].equalsIgnoreCase("integer")) {
 | 
				
			||||||
                        Integer in = Integer.valueOf(field);
 | 
					                        Integer in = Integer.valueOf(field);
 | 
				
			||||||
                        if (in == 0) {
 | 
					                        if (in == 0) {
 | 
				
			||||||
@ -145,7 +106,7 @@ public class MyApplication {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return s.toString();
 | 
					        return s.toString();
 | 
				
			||||||
    }
 | 
					    }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static String sendAPDU(PuntoCassa frmATT, String sData, String sCla, String sIns, 
 | 
					    public static String sendAPDU(PuntoCassa frmATT, String sData, String sCla, String sIns, 
 | 
				
			||||||
                                    String sP1, String sP2, String sP3, String sLe) throws CardException {
 | 
					                                    String sP1, String sP2, String sP3, String sLe) throws CardException {
 | 
				
			||||||
@ -205,7 +166,7 @@ public class MyApplication {
 | 
				
			|||||||
            if (dati.length() >= 47) {
 | 
					            if (dati.length() >= 47) {
 | 
				
			||||||
                idTesseraA = dati.substring(12, 26).replace(".", "");
 | 
					                idTesseraA = dati.substring(12, 26).replace(".", "");
 | 
				
			||||||
                CF = dati.substring(31, 47);
 | 
					                CF = dati.substring(31, 47);
 | 
				
			||||||
                DS = trovaScadenza(dati);//data scadenza
 | 
					                DS = Utils.trovaScadenza(dati);//data scadenza
 | 
				
			||||||
                CF = CF + "|" + DS;
 | 
					                CF = CF + "|" + DS;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return CF;
 | 
					            return CF;
 | 
				
			||||||
@ -215,24 +176,15 @@ public class MyApplication {
 | 
				
			|||||||
            StringBuilder s = new StringBuilder();
 | 
					            StringBuilder s = new StringBuilder();
 | 
				
			||||||
            if (dati.length() >= 16) {
 | 
					            if (dati.length() >= 16) {
 | 
				
			||||||
                s.append(dati.substring(4, 16)).append("\n");
 | 
					                s.append(dati.substring(4, 16)).append("\n");
 | 
				
			||||||
                idTesseraA = idTesseraA + dati.substring(4, 13) + luhn(idTesseraA + dati.substring(4, 13));
 | 
					                idTesseraA = idTesseraA + dati.substring(4, 13) + Utils.luhn(idTesseraA + dati.substring(4, 13));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return idTesseraA;
 | 
					        return idTesseraA;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static String trovaScadenza(String testo) {
 | 
					 | 
				
			||||||
        String scadenza = "";
 | 
					 | 
				
			||||||
        String tag = "#";
 | 
					 | 
				
			||||||
        Integer pi = testo.lastIndexOf(tag);
 | 
					 | 
				
			||||||
        if (pi > 0) {
 | 
					 | 
				
			||||||
            scadenza = testo.substring(pi - 9, pi - 1);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        return scadenza;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String aggiustaDateTessera(String data) {
 | 
					    /*public String aggiustaDateTessera(String data) {
 | 
				
			||||||
        String newData = "";
 | 
					        String newData = "";
 | 
				
			||||||
        if (data.length() >= 8) {
 | 
					        if (data.length() >= 8) {
 | 
				
			||||||
            String m, d, a;
 | 
					            String m, d, a;
 | 
				
			||||||
@ -245,30 +197,7 @@ public class MyApplication {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return newData;
 | 
					        return newData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static String luhn(String Dati) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Integer s = 0;
 | 
					 | 
				
			||||||
        for (Integer i = 0; i < Dati.length(); i++) {
 | 
					 | 
				
			||||||
            Integer d = Integer.valueOf(Dati.substring(i, i + 1));
 | 
					 | 
				
			||||||
            if (i % 2 == 0) {
 | 
					 | 
				
			||||||
                Integer doppio = d * 2;
 | 
					 | 
				
			||||||
                if (doppio >= 10) {
 | 
					 | 
				
			||||||
                    doppio = 1 + (doppio % 10);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                s = s + doppio;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                s = s + d;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Integer resto = s % 10;
 | 
					 | 
				
			||||||
        if (resto == 0) {
 | 
					 | 
				
			||||||
            return "0";
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            Integer ris = 10 - resto;
 | 
					 | 
				
			||||||
            return "" + ris;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,89 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * To change this license header, choose License Headers in Project Properties.
 | 
					 | 
				
			||||||
 * To change this template file, choose Tools | Templates
 | 
					 | 
				
			||||||
 * and open the template in the editor.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
package puntocassa;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.awt.event.ActionEvent;
 | 
					 | 
				
			||||||
import java.awt.event.ActionListener;
 | 
					 | 
				
			||||||
import java.sql.Connection;
 | 
					 | 
				
			||||||
import java.sql.DriverManager;
 | 
					 | 
				
			||||||
import java.sql.ResultSet;
 | 
					 | 
				
			||||||
import java.sql.SQLException;
 | 
					 | 
				
			||||||
import java.sql.Statement;
 | 
					 | 
				
			||||||
import javax.swing.JButton;
 | 
					 | 
				
			||||||
import javax.swing.JComboBox;
 | 
					 | 
				
			||||||
import javax.swing.JDialog;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @author Marco
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
public class MyDialog extends JDialog {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    PuntoCassa frmPuntoCassa;
 | 
					 | 
				
			||||||
    JPnlPagamenti panel = new JPnlPagamenti();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public MyDialog() {
 | 
					 | 
				
			||||||
        super();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public MyDialog(PuntoCassa puntoC, String title, boolean modal) {
 | 
					 | 
				
			||||||
        super(puntoC, title, modal);
 | 
					 | 
				
			||||||
        frmPuntoCassa = puntoC;
 | 
					 | 
				
			||||||
        this.getContentPane().add(panel);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        caricaCombo("Select nome,id from tipi_pagamenti where id<>0 order by nome", "nome", "id", panel.jCmbCat);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        JButton btn = panel.jBtnAggiorna;
 | 
					 | 
				
			||||||
        btn.addActionListener(new ActionListener() {
 | 
					 | 
				
			||||||
            public void actionPerformed(ActionEvent e) {
 | 
					 | 
				
			||||||
                ComboItem c = new ComboItem(null, null);
 | 
					 | 
				
			||||||
                c = (ComboItem) panel.jCmbCat.getSelectedItem();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                frmPuntoCassa.idModoPagamento = c.getKey();
 | 
					 | 
				
			||||||
                frmPuntoCassa.clickModoPagamento(c.getValue().toString());
 | 
					 | 
				
			||||||
                MyDialog.this.dispose();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        JButton jBtnAnnulla = panel.jBtnAnnulla;
 | 
					 | 
				
			||||||
        jBtnAnnulla.addActionListener(new ActionListener() {
 | 
					 | 
				
			||||||
            public void actionPerformed(ActionEvent e) {
 | 
					 | 
				
			||||||
                frmPuntoCassa.clickCarta();
 | 
					 | 
				
			||||||
                MyDialog.this.dispose();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private void caricaCombo(String query, String itemValue, String itemId, JComboBox cmb) {
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
 | 
					 | 
				
			||||||
            Connection c = dbConnection;
 | 
					 | 
				
			||||||
            Statement stmt = null;
 | 
					 | 
				
			||||||
            cmb.removeAllItems();
 | 
					 | 
				
			||||||
            stmt = c.createStatement();
 | 
					 | 
				
			||||||
            ResultSet rs = stmt.executeQuery(query);
 | 
					 | 
				
			||||||
            int r = 0;
 | 
					 | 
				
			||||||
            while (rs.next()) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                ComboItem row = new ComboItem(rs.getLong(itemId), rs.getString(itemValue));
 | 
					 | 
				
			||||||
                cmb.addItem(row);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                r++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            rs.close();
 | 
					 | 
				
			||||||
            stmt.close();
 | 
					 | 
				
			||||||
            dbConnection.close();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        } catch (SQLException e) {
 | 
					 | 
				
			||||||
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -227,12 +227,12 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    //idPuntoCassa = Long.valueOf(myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'IdPuntoCassa'", "valore"));
 | 
					                    //idPuntoCassa = Long.valueOf(myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'IdPuntoCassa'", "valore"));
 | 
				
			||||||
                    idPuntoCassa = Long.valueOf(Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'IdPuntoCassa'", 
 | 
					                    idPuntoCassa = Long.valueOf(Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'IdPuntoCassa'", 
 | 
				
			||||||
                            "valore",
 | 
					                            "valore",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this));
 | 
					                            this));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //String credito = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagIgnoraSaldoStop'", "valore");
 | 
					                    //String credito = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagIgnoraSaldoStop'", "valore");
 | 
				
			||||||
                    String credito = Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'FlagIgnoraSaldoStop'", 
 | 
					                    String credito = Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'FlagIgnoraSaldoStop'", 
 | 
				
			||||||
                            "valore",
 | 
					                            "valore",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
                    if (credito.equalsIgnoreCase("SI")) {
 | 
					                    if (credito.equalsIgnoreCase("SI")) {
 | 
				
			||||||
                        consentiCredito = true;
 | 
					                        consentiCredito = true;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -247,7 +247,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                            + "inner join tipi_pagamenti tp on pd.id_tipo_paga_default = tp.id "
 | 
					                            + "inner join tipi_pagamenti tp on pd.id_tipo_paga_default = tp.id "
 | 
				
			||||||
                            + "where pc.id=" + idPuntoCassa, 
 | 
					                            + "where pc.id=" + idPuntoCassa, 
 | 
				
			||||||
                            "valore",
 | 
					                            "valore",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    String[] arrayDatiPagamento = stringDatiPagamento.split("\\|", -1);
 | 
					                    String[] arrayDatiPagamento = stringDatiPagamento.split("\\|", -1);
 | 
				
			||||||
                    if (arrayDatiPagamento.length >= 2) {
 | 
					                    if (arrayDatiPagamento.length >= 2) {
 | 
				
			||||||
@ -313,7 +313,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            //String ultimiMovimenti = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagVisualizzaUltimiPassaggi'", "valore");
 | 
					            //String ultimiMovimenti = myApp.mySelect(this, "SELECT valore FROM parametri WHERE chiave = 'FlagVisualizzaUltimiPassaggi'", "valore");
 | 
				
			||||||
            String ultimiMovimenti = Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'FlagVisualizzaUltimiPassaggi'", 
 | 
					            String ultimiMovimenti = Utils.mySelect("SELECT valore FROM parametri WHERE chiave = 'FlagVisualizzaUltimiPassaggi'", 
 | 
				
			||||||
                    "valore",
 | 
					                    "valore",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
            if (ultimiMovimenti.equalsIgnoreCase("NO")) {
 | 
					            if (ultimiMovimenti.equalsIgnoreCase("NO")) {
 | 
				
			||||||
                jBtnMovimenti.setEnabled(false);
 | 
					                jBtnMovimenti.setEnabled(false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -323,29 +323,29 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            statoAttivoNonLoggato();
 | 
					            statoAttivoNonLoggato();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String flagRicevutaValue = Utils.mySelect("Select Valore from Parametri where Chiave='FlagRicevuta'", "Valore",dbStringa, dbUsername, dbPassword, this);
 | 
					            String flagRicevutaValue = Utils.mySelect("Select Valore from Parametri where Chiave='FlagRicevuta'", "Valore",this);
 | 
				
			||||||
            PuntoCassa.flagRicevuta = !flagRicevutaValue.equalsIgnoreCase("NO");
 | 
					            PuntoCassa.flagRicevuta = !flagRicevutaValue.equalsIgnoreCase("NO");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String flagDataNascita = Utils.mySelect("Select Valore from Parametri where Chiave='FlagMostraDataDiNascita'", "Valore",dbStringa, dbUsername, dbPassword, this);
 | 
					            String flagDataNascita = Utils.mySelect("Select Valore from Parametri where Chiave='FlagMostraDataDiNascita'", "Valore", this);
 | 
				
			||||||
            flagMostraDataDiNascita = !flagDataNascita.equalsIgnoreCase("NO");
 | 
					            flagMostraDataDiNascita = !flagDataNascita.equalsIgnoreCase("NO");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String flagEsegueStorniValue = Utils.mySelect("Select Valore from Parametri where Chiave='FlagEsegueStorni'", "Valore", dbStringa, dbUsername, dbPassword, this);
 | 
					            String flagEsegueStorniValue = Utils.mySelect("Select Valore from Parametri where Chiave='FlagEsegueStorni'", "Valore", this);
 | 
				
			||||||
            this.flagEsegueStorni = !flagEsegueStorniValue.equalsIgnoreCase("NO");
 | 
					            this.flagEsegueStorni = !flagEsegueStorniValue.equalsIgnoreCase("NO");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String timeoutSwipCard = Utils.mySelect("Select Valore from Parametri where Chiave='TimeoutSwipCard'", "Valore",dbStringa, dbUsername, dbPassword, this);
 | 
					            String timeoutSwipCard = Utils.mySelect("Select Valore from Parametri where Chiave='TimeoutSwipCard'", "Valore",this);
 | 
				
			||||||
            //if (myApp.isNumeric(timeoutSwipCard)) {
 | 
					            //if (myApp.isNumeric(timeoutSwipCard)) {
 | 
				
			||||||
            if (Utils.isNumeric(timeoutSwipCard)) {
 | 
					            if (Utils.isNumeric(timeoutSwipCard)) {
 | 
				
			||||||
                delaySwipCard = Integer.valueOf(timeoutSwipCard);
 | 
					                delaySwipCard = Integer.valueOf(timeoutSwipCard);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", dbStringa, dbUsername, dbPassword, this);
 | 
					            Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String flagDefaultAsporto = Utils.mySelect("Select Valore from Parametri where Chiave='FlagDefaultAsporto'", "Valore",dbStringa, dbUsername, dbPassword, this);
 | 
					            String flagDefaultAsporto = Utils.mySelect("Select Valore from Parametri where Chiave='FlagDefaultAsporto'", "Valore", this);
 | 
				
			||||||
            if (flagDefaultAsporto.equalsIgnoreCase("SI")) {
 | 
					            if (flagDefaultAsporto.equalsIgnoreCase("SI")) {
 | 
				
			||||||
                asporto = true;
 | 
					                asporto = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String flagPrecarica = Utils.mySelect("Select Valore from Parametri where Chiave='FlagPrecaricaLista'", "Valore", dbStringa, dbUsername, dbPassword, this);
 | 
					            String flagPrecarica = Utils.mySelect("Select Valore from Parametri where Chiave='FlagPrecaricaLista'", "Valore",  this);
 | 
				
			||||||
            flagPrecaricaLista = !flagPrecarica.equalsIgnoreCase("NO");
 | 
					            flagPrecaricaLista = !flagPrecarica.equalsIgnoreCase("NO");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            keyDispatcher = creaKeyEventDispatcher();
 | 
					            keyDispatcher = creaKeyEventDispatcher();
 | 
				
			||||||
@ -556,9 +556,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private void verificaAggiornamentoDB() {
 | 
					    private void verificaAggiornamentoDB() {
 | 
				
			||||||
        Long dbAggiornato = Utils.mySelectInteger("Select DB_locale_aggiornato as Agg from dual", "Agg", 
 | 
					        Long dbAggiornato = Utils.mySelectInteger("Select DB_locale_aggiornato as Agg from dual", "Agg", 
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        String flagProponiAggiornamentoDB = Utils.mySelect("Select Valore from Parametri where chiave='FlagProponiAggiornamentoDB' ", "Valore",
 | 
					        String flagProponiAggiornamentoDB = Utils.mySelect("Select Valore from Parametri where chiave='FlagProponiAggiornamentoDB' ", "Valore",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if(dbAggiornato == 0){            
 | 
					        if(dbAggiornato == 0){            
 | 
				
			||||||
            if (flagProponiAggiornamentoDB.equals("SI")) {
 | 
					            if (flagProponiAggiornamentoDB.equals("SI")) {
 | 
				
			||||||
                aggiornaDB(true);
 | 
					                aggiornaDB(true);
 | 
				
			||||||
@ -571,7 +571,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void verificaModoPagamento() {        
 | 
					    private void verificaModoPagamento() {        
 | 
				
			||||||
        flagImpostaTipoPagamento = Utils.mySelect("Select Valore from Parametri where chiave='FlagImpostaTipoPagamento' ", "Valore",
 | 
					        flagImpostaTipoPagamento = Utils.mySelect("Select Valore from Parametri where chiave='FlagImpostaTipoPagamento' ", "Valore",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this).equals("NO");
 | 
					                this).equals("NO");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void logTessera() {
 | 
					    private void logTessera() {
 | 
				
			||||||
@ -584,7 +584,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        + "','" + logNumeroTessera 
 | 
					                        + "','" + logNumeroTessera 
 | 
				
			||||||
                        + "','" + logIDTessera 
 | 
					                        + "','" + logIDTessera 
 | 
				
			||||||
                        + "','" + logTesseraErrore.replace("'", "''") 
 | 
					                        + "','" + logTesseraErrore.replace("'", "''") 
 | 
				
			||||||
                        + "')", dbStringa, dbUsername, dbPassword, this);
 | 
					                        + "')", this);
 | 
				
			||||||
                logIDTessera = "";
 | 
					                logIDTessera = "";
 | 
				
			||||||
                logNumeroTessera = "";
 | 
					                logNumeroTessera = "";
 | 
				
			||||||
                logTestoTessera = new StringBuilder();
 | 
					                logTestoTessera = new StringBuilder();
 | 
				
			||||||
@ -597,7 +597,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
    private void verificaAggiornamentiJAR() {
 | 
					    private void verificaAggiornamentiJAR() {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            String pathURLAggiornamento = Utils.mySelect("Select Valore from Parametri where chiave='UrlJAR' ", "Valore", 
 | 
					            String pathURLAggiornamento = Utils.mySelect("Select Valore from Parametri where chiave='UrlJAR' ", "Valore", 
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (pathURLAggiornamento.length() > 0) {
 | 
					            if (pathURLAggiornamento.length() > 0) {
 | 
				
			||||||
                String startDir = System.getProperty("user.dir");
 | 
					                String startDir = System.getProperty("user.dir");
 | 
				
			||||||
@ -1996,13 +1996,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            String idVassoio = Utils.mySelect("SELECT seleziona_composizione('" + sb.toString().substring(0, sb.toString().length() - 1) + "') "
 | 
					            String idVassoio = Utils.mySelect("SELECT seleziona_composizione('" + sb.toString().substring(0, sb.toString().length() - 1) + "') "
 | 
				
			||||||
                    + "as idCompleto from dual",
 | 
					                    + "as idCompleto from dual",
 | 
				
			||||||
                    "idCompleto",
 | 
					                    "idCompleto",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
            if (Long.parseLong(idVassoio) != -1) {
 | 
					            if (Long.parseLong(idVassoio) != -1) {
 | 
				
			||||||
                String nomeVassoio = Utils.mySelect("Select nome from vassoi where id=" + idVassoio, "nome", 
 | 
					                String nomeVassoio = Utils.mySelect("Select nome from vassoi where id=" + idVassoio, "nome", 
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
                String prezzo = Utils.mySelect("Select prezzo from tariffe where id_fascia=" + idProfiloTariffario + " "
 | 
					                String prezzo = Utils.mySelect("Select prezzo from tariffe where id_fascia=" + idProfiloTariffario + " "
 | 
				
			||||||
                        + "and id_prodotto=" + idVassoio, "prezzo",
 | 
					                        + "and id_prodotto=" + idVassoio, "prezzo",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //clearTable(model1);
 | 
					                //clearTable(model1);
 | 
				
			||||||
                model1.clearTable();
 | 
					                model1.clearTable();
 | 
				
			||||||
@ -2145,11 +2145,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                + " AND c.id_prodotto = p.id AND c.id_punto_cassa =" + idPuntoCassa;
 | 
					                + " AND c.id_prodotto = p.id AND c.id_punto_cassa =" + idPuntoCassa;
 | 
				
			||||||
        //MyApplication myApp = new MyApplication();
 | 
					        //MyApplication myApp = new MyApplication();
 | 
				
			||||||
        String nrec = Utils.mySelect("SELECT count(*) as nrec " + sql2, "nrec", 
 | 
					        String nrec = Utils.mySelect("SELECT count(*) as nrec " + sql2, "nrec", 
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if (Integer.parseInt(nrec) <= 0) {
 | 
					        if (Integer.parseInt(nrec) <= 0) {
 | 
				
			||||||
            menuGiornoPresente = false;
 | 
					            menuGiornoPresente = false;
 | 
				
			||||||
            String idComposizione = Utils.mySelect("select id from Categorie_Prodotti where Upper(Nome)='COMPOSIZIONE'", "id",
 | 
					            String idComposizione = Utils.mySelect("select id from Categorie_Prodotti where Upper(Nome)='COMPOSIZIONE'", "id",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
            caricaDati("PRODOTTI", idComposizione);
 | 
					            caricaDati("PRODOTTI", idComposizione);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
@ -2293,9 +2293,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
 | 
					                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (Integer.parseInt(selectedValue.toString()) == 0) {
 | 
					        if (Integer.parseInt(selectedValue.toString()) == 0) {
 | 
				
			||||||
            Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", dbStringa, dbUsername, dbPassword, this);
 | 
					            Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", this);
 | 
				
			||||||
            Long nrec = Utils.mySelectInteger("SELECT count(*) as nrec FROM acquisti", "nrec",
 | 
					            Long nrec = Utils.mySelectInteger("SELECT count(*) as nrec FROM acquisti", "nrec",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
            if (nrec > 0) {
 | 
					            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) {
 | 
					                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();
 | 
					                    statoAttivoNonLoggato();
 | 
				
			||||||
@ -2322,7 +2322,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            String[] nowString = Utils.mySelect("Select sysdate as mo from dual", "mo",
 | 
					            String[] nowString = Utils.mySelect("Select sysdate as mo from dual", "mo",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this).split(" ");
 | 
					                    this).split(" ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Statement st;
 | 
					            Statement st;
 | 
				
			||||||
            ResultSet rs;
 | 
					            ResultSet rs;
 | 
				
			||||||
@ -2367,7 +2367,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            String[] mo = Utils.mySelect("Select sysdate as mo from dual", "mo",
 | 
					            String[] mo = Utils.mySelect("Select sysdate as mo from dual", "mo",
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this).split(" ");
 | 
					                    this).split(" ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Statement st;
 | 
					            Statement st;
 | 
				
			||||||
            ResultSet rs;
 | 
					            ResultSet rs;
 | 
				
			||||||
@ -2410,7 +2410,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // ** id punto cassa
 | 
					        // ** id punto cassa
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        idPuntoCassa = Utils.mySelectInteger("select Punti_Cassa.id as idPC from Punti_Cassa where Punti_Cassa.id=" + idPuntoCassa, "idPC",
 | 
					        idPuntoCassa = Utils.mySelectInteger("select Punti_Cassa.id as idPC from Punti_Cassa where Punti_Cassa.id=" + idPuntoCassa, "idPC",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        // ** Imposta l'ambiente
 | 
					        // ** Imposta l'ambiente
 | 
				
			||||||
@ -2442,7 +2442,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        String pulsante = Utils.mySelect("SELECT p.flag_imposta_tessera as Pulsante "
 | 
					        String pulsante = Utils.mySelect("SELECT p.flag_imposta_tessera as Pulsante "
 | 
				
			||||||
                + "FROM punti_distribuzione p, punti_cassa c "
 | 
					                + "FROM punti_distribuzione p, punti_cassa c "
 | 
				
			||||||
                + "WHERE c.id_punto_distribuzione = p.id AND c.id =" + idPuntoCassa, "Pulsante",
 | 
					                + "WHERE c.id_punto_distribuzione = p.id AND c.id =" + idPuntoCassa, "Pulsante",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if (Integer.parseInt(pulsante) == 1) {
 | 
					        if (Integer.parseInt(pulsante) == 1) {
 | 
				
			||||||
            bottoneImposta = true;
 | 
					            bottoneImposta = true;
 | 
				
			||||||
            btnImpostaCliente.setVisible(true);
 | 
					            btnImpostaCliente.setVisible(true);
 | 
				
			||||||
@ -2479,7 +2479,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                abilitaPulsanti(pnlCategorie, true, true);
 | 
					                abilitaPulsanti(pnlCategorie, true, true);
 | 
				
			||||||
                abilitaPulsanti(pnlProdotti, true, true);
 | 
					                abilitaPulsanti(pnlProdotti, true, true);
 | 
				
			||||||
                idProfiloTariffarioDefault = Utils.mySelectInteger("select Valore from Parametri where upper(chiave)='IDFASCIADEFAULT'", "Valore",
 | 
					                idProfiloTariffarioDefault = Utils.mySelectInteger("select Valore from Parametri where upper(chiave)='IDFASCIADEFAULT'", "Valore",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
                System.out.print("" + idProfiloTariffarioDefault);
 | 
					                System.out.print("" + idProfiloTariffarioDefault);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                apriCassaDefault();
 | 
					                apriCassaDefault();
 | 
				
			||||||
@ -2496,7 +2496,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void run() {
 | 
					            public void run() {
 | 
				
			||||||
                Long res = Utils.mySelectInteger("SELECT db_remoto_connesso as Stato FROM dual", "Stato",
 | 
					                Long res = Utils.mySelectInteger("SELECT db_remoto_connesso as Stato FROM dual", "Stato",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, PuntoCassa.this);
 | 
					                        PuntoCassa.this);
 | 
				
			||||||
                if (res == 1) {
 | 
					                if (res == 1) {
 | 
				
			||||||
                    lblDB.setBackground(Color.green);
 | 
					                    lblDB.setBackground(Color.green);
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
@ -2517,7 +2517,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String prog = Utils.mySelect("select nvl(max(prog_assoluto),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa, "Prog",
 | 
					        String prog = Utils.mySelect("select nvl(max(prog_assoluto),0) as Prog from Progressivi where id_Punto_cassa=" + idPuntoCassa, "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//        if(progressivo < Long.parseLong(prog)){
 | 
					//        if(progressivo < Long.parseLong(prog)){
 | 
				
			||||||
        progressivo = Long.valueOf(prog);
 | 
					        progressivo = Long.valueOf(prog);
 | 
				
			||||||
@ -2530,21 +2530,21 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        String progT = Utils.mySelect("select nvl(max(prog_turno),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progT = Utils.mySelect("select nvl(max(prog_turno),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
				
			||||||
                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), 
 | 
					                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), 
 | 
				
			||||||
                "Prog",
 | 
					                "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoTurno = Long.valueOf(progT);
 | 
					        progressivoTurno = Long.valueOf(progT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String progG = Utils.mySelect("select nvl(max(prog_giorno),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progG = Utils.mySelect("select nvl(max(prog_giorno),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
				
			||||||
                + idPuntoCassa + " and data=" + formattaData(now), "Prog",
 | 
					                + idPuntoCassa + " and data=" + formattaData(now), "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoGiorno = Long.valueOf(progG);
 | 
					        progressivoGiorno = Long.valueOf(progG);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String controlloTurno = Utils.mySelect("select count(*) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String controlloTurno = Utils.mySelect("select count(*) as Prog from Progressivi where id_Punto_cassa=" 
 | 
				
			||||||
                + idPuntoCassa + " and data=" + formattaData(now) + " and id_Turno=" + idTurno, "Prog",
 | 
					                + idPuntoCassa + " and data=" + formattaData(now) + " and id_Turno=" + idTurno, "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if (Long.parseLong(controlloTurno) <= 0) {
 | 
					        if (Long.parseLong(controlloTurno) <= 0) {
 | 
				
			||||||
            Utils.myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
 | 
					            Utils.myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
 | 
				
			||||||
                    + " values (" + formattaData(now) + "," + idPuntoCassa + "," + idTurno + "," + progressivo + "," + progressivoGiorno + ",0)", 
 | 
					                    + " values (" + formattaData(now) + "," + idPuntoCassa + "," + idTurno + "," + progressivo + "," + progressivoGiorno + ",0)", 
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);          
 | 
					                    this);          
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
@ -2552,7 +2552,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        String progPS = Utils.mySelect("select nvl(sum(incasso_turno_scalare),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progPS = Utils.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",
 | 
					                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoScalare = Double.valueOf(progPS);
 | 
					        progressivoScalare = Double.valueOf(progPS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
@ -2560,7 +2560,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        String progPC = Utils.mySelect("select nvl(sum(incasso_turno_contanti),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progPC = Utils.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",
 | 
					                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoContanti = Double.valueOf(progPC);
 | 
					        progressivoContanti = Double.valueOf(progPC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
@ -2568,7 +2568,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        String progPT = Utils.mySelect("select nvl(sum(incasso_turno_ticket),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progPT = Utils.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",
 | 
					                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoTicket = Double.valueOf(progPT);
 | 
					        progressivoTicket = Double.valueOf(progPT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
@ -2576,7 +2576,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
        // -----------------------------------------------------------
 | 
					        // -----------------------------------------------------------
 | 
				
			||||||
        String progDI = Utils.mySelect("select nvl(sum(incasso_turno_differito),0) as Prog from Progressivi where id_Punto_cassa=" 
 | 
					        String progDI = Utils.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",
 | 
					                + idPuntoCassa + " and id_Turno=" + idTurno + " and data=" + formattaData(now), "Prog",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        progressivoDifferito = Double.valueOf(progDI);
 | 
					        progressivoDifferito = Double.valueOf(progDI);
 | 
				
			||||||
        aggiornaLabelInfo();
 | 
					        aggiornaLabelInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2627,7 +2627,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void meteo() {
 | 
					    private void meteo() {
 | 
				
			||||||
        String spia = Utils.mySelect("select controlla_meteo(" + idPuntoCassa + ") as res from dual", "res",
 | 
					        String spia = Utils.mySelect("select controlla_meteo(" + idPuntoCassa + ") as res from dual", "res",
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if (Integer.parseInt(spia) == 1) {
 | 
					        if (Integer.parseInt(spia) == 1) {
 | 
				
			||||||
            if (myMeteoForm == null) {
 | 
					            if (myMeteoForm == null) {
 | 
				
			||||||
                myMeteoForm = new FrmMeteo(this, idPuntoCassa, true);
 | 
					                myMeteoForm = new FrmMeteo(this, idPuntoCassa, true);
 | 
				
			||||||
@ -2691,7 +2691,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
    private void jbtnStampaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnStampaActionPerformed
 | 
					    private void jbtnStampaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnStampaActionPerformed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Boolean ok = Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", 
 | 
					        Boolean ok = Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", 
 | 
				
			||||||
                dbStringa, dbUsername, dbPassword, this);
 | 
					                this);
 | 
				
			||||||
        if (ok) {
 | 
					        if (ok) {
 | 
				
			||||||
            JOptionPane.showOptionDialog(this, "Operazione correttamente eseguita.", "Attenzione",
 | 
					            JOptionPane.showOptionDialog(this, "Operazione correttamente eseguita.", "Attenzione",
 | 
				
			||||||
                    JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
 | 
					                    JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
 | 
				
			||||||
@ -2983,7 +2983,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            String esito = Utils.mySelect("SELECT esito FROM esiti where id = (select max(id) from esiti)", "esito",
 | 
					                            String esito = Utils.mySelect("SELECT esito FROM esiti where id = (select max(id) from esiti)", "esito",
 | 
				
			||||||
                                    dbStringa, dbUsername, dbPassword, PuntoCassa.this);
 | 
					                                    PuntoCassa.this);
 | 
				
			||||||
                            JOptionPane.showOptionDialog(PuntoCassa.this, esito, "Aggiornamento Database", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
 | 
					                            JOptionPane.showOptionDialog(PuntoCassa.this, esito, "Aggiornamento Database", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
 | 
				
			||||||
                        } catch (Exception e) {
 | 
					                        } catch (Exception e) {
 | 
				
			||||||
                            JOptionPane.showMessageDialog(PuntoCassa.this, "Errore " + e.getMessage());
 | 
					                            JOptionPane.showMessageDialog(PuntoCassa.this, "Errore " + e.getMessage());
 | 
				
			||||||
@ -3170,7 +3170,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            // =======================================================================
 | 
					            // =======================================================================
 | 
				
			||||||
            sql = "SELECT count(*) as counter FROM accounts WHERE username = '" + this.txtUsername.getText() + "'";
 | 
					            sql = "SELECT count(*) as counter FROM accounts WHERE username = '" + this.txtUsername.getText() + "'";
 | 
				
			||||||
            //MyApplication myApp = new MyApplication();
 | 
					            //MyApplication myApp = new MyApplication();
 | 
				
			||||||
            counter = Integer.parseInt(Utils.mySelect(sql, "Counter", dbStringa, dbUsername, dbPassword, this));
 | 
					            counter = Integer.parseInt(Utils.mySelect(sql, "Counter", this));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // ====================================================================
 | 
					            // ====================================================================
 | 
				
			||||||
            // ** Verifica la password
 | 
					            // ** Verifica la password
 | 
				
			||||||
@ -3181,14 +3181,14 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                sql = "SELECT id || '|' || id_Stato as res FROM accounts WHERE username = '" + this.txtUsername.getText() + "' "
 | 
					                sql = "SELECT id || '|' || id_Stato as res FROM accounts WHERE username = '" + this.txtUsername.getText() + "' "
 | 
				
			||||||
                        + "and password = '" + Encoding.encodeString(pwd) + "'";
 | 
					                        + "and password = '" + Encoding.encodeString(pwd) + "'";
 | 
				
			||||||
                //String[] el = myApp.mySelect(this, sql, "res").split("\\|");
 | 
					                //String[] el = myApp.mySelect(this, sql, "res").split("\\|");
 | 
				
			||||||
                String[] el = Utils.mySelect(sql, "res",dbStringa, dbUsername, dbPassword, this).split("\\|");
 | 
					                String[] el = Utils.mySelect(sql, "res",this).split("\\|");
 | 
				
			||||||
                //if (myApp.isNumeric(el[0])) {
 | 
					                //if (myApp.isNumeric(el[0])) {
 | 
				
			||||||
                if (Utils.isNumeric(el[0])) {
 | 
					                if (Utils.isNumeric(el[0])) {
 | 
				
			||||||
                    idAccount = Long.valueOf(el[0]);
 | 
					                    idAccount = Long.valueOf(el[0]);
 | 
				
			||||||
                    if (Integer.parseInt(el[1]) == 2) {
 | 
					                    if (Integer.parseInt(el[1]) == 2) {
 | 
				
			||||||
                        //String messaggio = myApp.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + el[1], "descrizione");
 | 
					                        //String messaggio = myApp.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + el[1], "descrizione");
 | 
				
			||||||
                        String messaggio = Utils.mySelect("Select Descrizione from Stati_Accounts where id=" + el[1], "descrizione",
 | 
					                        String messaggio = Utils.mySelect("Select Descrizione from Stati_Accounts where id=" + el[1], "descrizione",
 | 
				
			||||||
                                dbStringa, dbUsername, dbPassword, this);
 | 
					                                this);
 | 
				
			||||||
                        JOptionPane.showMessageDialog(this, messaggio + ".");
 | 
					                        JOptionPane.showMessageDialog(this, messaggio + ".");
 | 
				
			||||||
                        return;
 | 
					                        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3200,7 +3200,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                if (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)";
 | 
					                    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"));
 | 
					                    //counter = Integer.parseInt(myApp.mySelect(this, sql, "Counter"));
 | 
				
			||||||
                    counter = Integer.parseInt(Utils.mySelect(sql, "Counter", dbStringa, dbUsername, dbPassword, this));
 | 
					                    counter = Integer.parseInt(Utils.mySelect(sql, "Counter", this));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (counter > 0) {
 | 
					                    if (counter > 0) {
 | 
				
			||||||
                        impostaAmbiente();
 | 
					                        impostaAmbiente();
 | 
				
			||||||
@ -3319,7 +3319,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                + " where t.numero = '" + numeroTessera + "' and t.id_utente = u.id"
 | 
					                + " where t.numero = '" + numeroTessera + "' and t.id_utente = u.id"
 | 
				
			||||||
                + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
					                + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String[] saldoMinimo = Utils.mySelect(querySaldo, "saldi", dbStringa, dbUsername, dbPassword, this).split("\\|");
 | 
					        String[] saldoMinimo = Utils.mySelect(querySaldo, "saldi", this).split("\\|");
 | 
				
			||||||
        Double saldo = 0.0;
 | 
					        Double saldo = 0.0;
 | 
				
			||||||
        if (saldoMinimo.length > 0 && saldoMinimo[0].length() > 0) {
 | 
					        if (saldoMinimo.length > 0 && saldoMinimo[0].length() > 0) {
 | 
				
			||||||
            saldo = Double.valueOf(saldoMinimo[0].replace(",", "."));
 | 
					            saldo = Double.valueOf(saldoMinimo[0].replace(",", "."));
 | 
				
			||||||
@ -3483,7 +3483,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        + " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
 | 
					                        + " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
 | 
				
			||||||
                        + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
					                        + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                String[] saldoMinimo = Utils.mySelect(querySaldo, "saldi",dbStringa, dbUsername, dbPassword, this).split("\\|");
 | 
					                String[] saldoMinimo = Utils.mySelect(querySaldo, "saldi",this).split("\\|");
 | 
				
			||||||
                Double saldo = 0.0;
 | 
					                Double saldo = 0.0;
 | 
				
			||||||
                String residuo = lblResiduo.getText().trim().replace("?", "");
 | 
					                String residuo = lblResiduo.getText().trim().replace("?", "");
 | 
				
			||||||
                if (residuo.equalsIgnoreCase("[...]")) {
 | 
					                if (residuo.equalsIgnoreCase("[...]")) {
 | 
				
			||||||
@ -3521,7 +3521,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        + " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
 | 
					                        + " where t.numero = '" + numTessera + "' and t.id_utente = u.id"
 | 
				
			||||||
                        + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
					                        + " and u.id_categoria = c.id and cf.id_categoria_utenti = c.id";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Double saldo = Double.valueOf(Utils.mySelect(querySaldo, "saldo", dbStringa, dbUsername, dbPassword, this));
 | 
					                Double saldo = Double.valueOf(Utils.mySelect(querySaldo, "saldo", this));
 | 
				
			||||||
                Double costoPasto = Double.valueOf(txtTotaleCassa.getText().replace("?", "").trim().replace(",", "."));
 | 
					                Double costoPasto = Double.valueOf(txtTotaleCassa.getText().replace("?", "").trim().replace(",", "."));
 | 
				
			||||||
                if (saldo > costoPasto) {
 | 
					                if (saldo > costoPasto) {
 | 
				
			||||||
                    Object[] options = {"A Scalare", "Contanti"};
 | 
					                    Object[] options = {"A Scalare", "Contanti"};
 | 
				
			||||||
@ -3580,7 +3580,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    + "AND st.id_tessera = " + idTessera 
 | 
					                    + "AND st.id_tessera = " + idTessera 
 | 
				
			||||||
                    + " AND st.id_turno=" + idTurno;
 | 
					                    + " AND st.id_turno=" + idTurno;
 | 
				
			||||||
            Long abilitatoPassaggi = Utils.mySelectInteger(controlloPassaggi, "passaggi",
 | 
					            Long abilitatoPassaggi = Utils.mySelectInteger(controlloPassaggi, "passaggi",
 | 
				
			||||||
                                                            dbStringa, dbUsername, dbPassword, this);
 | 
					                                                            this);
 | 
				
			||||||
            if (abilitatoPassaggi > 0) {
 | 
					            if (abilitatoPassaggi > 0) {
 | 
				
			||||||
                abilitatoPassaggi = abilitatoPassaggi + 1;
 | 
					                abilitatoPassaggi = abilitatoPassaggi + 1;
 | 
				
			||||||
                if (JOptionPane.showConfirmDialog(null, 
 | 
					                if (JOptionPane.showConfirmDialog(null, 
 | 
				
			||||||
@ -3609,7 +3609,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                            + model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) + "," 
 | 
					                            + model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) + "," 
 | 
				
			||||||
                            + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + "," 
 | 
					                            + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + "," 
 | 
				
			||||||
                            + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
					                            + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
 | 
					                    aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
 | 
				
			||||||
                    elencoIdProdotti.append(model.getValueAt(i, colIDProdotto));
 | 
					                    elencoIdProdotti.append(model.getValueAt(i, colIDProdotto));
 | 
				
			||||||
@ -3636,7 +3636,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        formatLocalDateTime(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + "," + 
 | 
					                        formatLocalDateTime(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + "," + 
 | 
				
			||||||
                        idModoPagamento + "," + idTurno + "," + flagGratuita + "," + flagBonus + "," + 
 | 
					                        idModoPagamento + "," + idTurno + "," + flagGratuita + "," + flagBonus + "," + 
 | 
				
			||||||
                        flagAsporto + "," + flagPassaggioTessera + ")",
 | 
					                        flagAsporto + "," + flagPassaggioTessera + ")",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
                aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));                
 | 
					                aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));                
 | 
				
			||||||
                model2.deleteRow(i);
 | 
					                model2.deleteRow(i);
 | 
				
			||||||
                spiaProgressivo = true;
 | 
					                spiaProgressivo = true;
 | 
				
			||||||
@ -3656,7 +3656,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                            + model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) 
 | 
					                            + model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) 
 | 
				
			||||||
                            + "," + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + "," 
 | 
					                            + "," + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + "," 
 | 
				
			||||||
                            + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
					                            + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
 | 
					                    aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3683,7 +3683,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        + model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + "," 
 | 
					                        + model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + "," 
 | 
				
			||||||
                        + model2.getValueAt(i, 1) + ",0," + progressivo + "," + idModoPagamento + "," + idTurno 
 | 
					                        + model2.getValueAt(i, 1) + ",0," + progressivo + "," + idModoPagamento + "," + idTurno 
 | 
				
			||||||
                        + "," + flagGratuita + "," + flagBonusPerInsert + "," + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
					                        + "," + flagGratuita + "," + flagBonusPerInsert + "," + flagAsporto + "," + flagPassaggioTessera + ")",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
                aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
 | 
					                aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
 | 
				
			||||||
                model2.deleteRow(i);
 | 
					                model2.deleteRow(i);
 | 
				
			||||||
                spiaProgressivo = true;
 | 
					                spiaProgressivo = true;
 | 
				
			||||||
@ -3703,7 +3703,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    + ",incasso_turno_differito=" + progressivoDifferito 
 | 
					                    + ",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=" + formattaData(adesso));
 | 
				
			||||||
                    + " where id_Punto_cassa=" + idPuntoCassa + " and id_turno=" + idTurno + " and data=" + formatLocalDateTime(adesso),
 | 
					                    + " where id_Punto_cassa=" + idPuntoCassa + " and id_turno=" + idTurno + " and data=" + formatLocalDateTime(adesso),
 | 
				
			||||||
                    dbStringa, dbUsername, dbPassword, this);
 | 
					                    this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3753,7 +3753,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    + "AND id_turno =" + idTurnoAttuale 
 | 
					                    + "AND id_turno =" + idTurnoAttuale 
 | 
				
			||||||
                    + " AND id_tessera = " + idTessera 
 | 
					                    + " AND id_tessera = " + idTessera 
 | 
				
			||||||
                    + " and id_Prenotazione=" + idPrenotazione;
 | 
					                    + " and id_Prenotazione=" + idPrenotazione;
 | 
				
			||||||
            int rowCount = Integer.parseInt(Utils.mySelect(query, "nr", dbStringa, dbUsername, dbPassword, this));
 | 
					            int rowCount = Integer.parseInt(Utils.mySelect(query, "nr", this));
 | 
				
			||||||
            if (rowCount > 0) {
 | 
					            if (rowCount > 0) {
 | 
				
			||||||
                if (rowCount == el.length) {
 | 
					                if (rowCount == el.length) {
 | 
				
			||||||
                    query = "SELECT count(*) as nr FROM VIEW_PRENOTAZIONI_TURNO "
 | 
					                    query = "SELECT count(*) as nr FROM VIEW_PRENOTAZIONI_TURNO "
 | 
				
			||||||
@ -3763,7 +3763,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                            + " AND id_tessera = " + idTessera 
 | 
					                            + " AND id_tessera = " + idTessera 
 | 
				
			||||||
                            + " AND id_Prodotto in (" + elencoIdProdotto + ") "
 | 
					                            + " AND id_Prodotto in (" + elencoIdProdotto + ") "
 | 
				
			||||||
                            + "and id_Prenotazione=" + idPrenotazione;
 | 
					                            + "and id_Prenotazione=" + idPrenotazione;
 | 
				
			||||||
                    rowCount = Integer.parseInt(Utils.mySelect(query, "nr", dbStringa, dbUsername, dbPassword, this));
 | 
					                    rowCount = Integer.parseInt(Utils.mySelect(query, "nr", this));
 | 
				
			||||||
                    if (rowCount == el.length) {
 | 
					                    if (rowCount == el.length) {
 | 
				
			||||||
                        return true;
 | 
					                        return true;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -3796,7 +3796,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                ResultSet rs = st.executeQuery(query);
 | 
					                ResultSet rs = st.executeQuery(query);
 | 
				
			||||||
                while (rs.next()) {
 | 
					                while (rs.next()) {
 | 
				
			||||||
                    Utils.myInsert("Update PRENOTAZIONI_PASTI set id_Stato=2 where id=" + rs.getString("id"), 
 | 
					                    Utils.myInsert("Update PRENOTAZIONI_PASTI set id_Stato=2 where id=" + rs.getString("id"), 
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                rs.close();
 | 
					                rs.close();
 | 
				
			||||||
                st.close();
 | 
					                st.close();
 | 
				
			||||||
@ -3933,12 +3933,12 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        + "where id_Punto_cassa=" + idPuntoCassa 
 | 
					                        + "where id_Punto_cassa=" + idPuntoCassa 
 | 
				
			||||||
                        + " and data=" + formattaData(adesso) 
 | 
					                        + " and data=" + formattaData(adesso) 
 | 
				
			||||||
                        + " and id_Turno=" + idTurno, "Prog",
 | 
					                        + " and id_Turno=" + idTurno, "Prog",
 | 
				
			||||||
                        dbStringa, dbUsername, dbPassword, this);
 | 
					                        this);
 | 
				
			||||||
                if (Long.parseLong(controlloTurno) <= 0) {
 | 
					                if (Long.parseLong(controlloTurno) <= 0) {
 | 
				
			||||||
                    Utils.myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
 | 
					                    Utils.myInsert("Insert into Progressivi (data,id_Punto_cassa,id_Turno,prog_assoluto,prog_giorno,prog_turno) "
 | 
				
			||||||
                            + " values (" + formattaData(adesso) + "," + idPuntoCassa + "," + idTurno + "," 
 | 
					                            + " values (" + formattaData(adesso) + "," + idPuntoCassa + "," + idTurno + "," 
 | 
				
			||||||
                            + progressivo + "," + progressivoGiorno + ",0)",
 | 
					                            + progressivo + "," + progressivoGiorno + ",0)",
 | 
				
			||||||
                            dbStringa, dbUsername, dbPassword, this);
 | 
					                            this);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                aggiornaLabelInfo();
 | 
					                aggiornaLabelInfo();
 | 
				
			||||||
@ -3973,7 +3973,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                + "AND cf.id_fascia = f.ID "
 | 
					                + "AND cf.id_fascia = f.ID "
 | 
				
			||||||
                + "AND t.numero = '" + numeroTessera + "'";
 | 
					                + "AND t.numero = '" + numeroTessera + "'";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String res = Utils.mySelect(query, "ris", dbStringa, dbUsername, dbPassword, this);
 | 
					        String res = Utils.mySelect(query, "ris", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (res.length() > 0) {
 | 
					        if (res.length() > 0) {
 | 
				
			||||||
            String dati[] = res.split("\\|", -1);
 | 
					            String dati[] = res.split("\\|", -1);
 | 
				
			||||||
@ -3997,7 +3997,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            try {
 | 
					            try {
 | 
				
			||||||
                // controllo abilitazione tessera
 | 
					                // controllo abilitazione tessera
 | 
				
			||||||
                String controlloPunto = "Select controlla_abilitazione('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
 | 
					                String controlloPunto = "Select controlla_abilitazione('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
 | 
				
			||||||
                Long abilitato = Utils.mySelectInteger(controlloPunto, "T", dbStringa, dbUsername, dbPassword, this);
 | 
					                Long abilitato = Utils.mySelectInteger(controlloPunto, "T", this);
 | 
				
			||||||
                if (abilitato == 0) {
 | 
					                if (abilitato == 0) {
 | 
				
			||||||
                    Object[] options = {"Si", "No"};
 | 
					                    Object[] options = {"Si", "No"};
 | 
				
			||||||
                    Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
 | 
					                    Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
 | 
				
			||||||
@ -4007,7 +4007,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        Utils.myInsert("Insert into Forzature (id,id_account,id_Punto_Cassa,id_Tessera,id_Tipo_Forzatura) values (-1," 
 | 
					                        Utils.myInsert("Insert into Forzature (id,id_account,id_Punto_Cassa,id_Tessera,id_Tipo_Forzatura) values (-1," 
 | 
				
			||||||
                                       + idAccount + "," + idPuntoCassa + "," + idTessera + ",1)",
 | 
					                                       + idAccount + "," + idPuntoCassa + "," + idTessera + ",1)",
 | 
				
			||||||
                                       dbStringa, dbUsername, dbPassword, this);
 | 
					                                       this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4015,12 +4015,12 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                //controllo passaggi
 | 
					                //controllo passaggi
 | 
				
			||||||
                String controlloPassaggi = "Select controlla_passaggi('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
 | 
					                String controlloPassaggi = "Select controlla_passaggi('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
 | 
				
			||||||
                Long abilitatoPassaggi = Utils.mySelectInteger(controlloPassaggi, "T", dbStringa, dbUsername, dbPassword, this);
 | 
					                Long abilitatoPassaggi = Utils.mySelectInteger(controlloPassaggi, "T", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (abilitatoPassaggi == 0L) {
 | 
					                if (abilitatoPassaggi == 0L) {
 | 
				
			||||||
                    //05/09/2022
 | 
					                    //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;
 | 
					                    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 = Utils.mySelectInteger(queryPassaggi, "NRec", dbStringa, dbUsername, dbPassword, this);
 | 
					                    Long numeroPassaggi = Utils.mySelectInteger(queryPassaggi, "NRec", this);
 | 
				
			||||||
                    //fine----
 | 
					                    //fine----
 | 
				
			||||||
                    if (flagEsegueStorni && numeroPassaggi > 0) {
 | 
					                    if (flagEsegueStorni && numeroPassaggi > 0) {
 | 
				
			||||||
                        Object[] options = {"Si", "No"};
 | 
					                        Object[] options = {"Si", "No"};
 | 
				
			||||||
@ -4103,7 +4103,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                        //MyApplication myApplication = new MyApplication();
 | 
					                        //MyApplication myApplication = new MyApplication();
 | 
				
			||||||
                        //String punti = myApplication.mySelect(this, "Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti");
 | 
					                        //String punti = myApplication.mySelect(this, "Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti");
 | 
				
			||||||
                        String punti = Utils.mySelect("Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti",
 | 
					                        String punti = Utils.mySelect("Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti",
 | 
				
			||||||
                                dbStringa, dbUsername, dbPassword, this);
 | 
					                                this);
 | 
				
			||||||
                        lblPunti.setText(punti);
 | 
					                        lblPunti.setText(punti);
 | 
				
			||||||
                        String tipo = cercaTestoModoPagamento();
 | 
					                        String tipo = cercaTestoModoPagamento();
 | 
				
			||||||
                        lblTipoPagamento.setText(tipo);
 | 
					                        lblTipoPagamento.setText(tipo);
 | 
				
			||||||
@ -4179,7 +4179,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                                + "AND id_tessera = " + idTessera + " "
 | 
					                                + "AND id_tessera = " + idTessera + " "
 | 
				
			||||||
                                + "order by id_prenotazione) "
 | 
					                                + "order by id_prenotazione) "
 | 
				
			||||||
                            + "where rownum = 1";
 | 
					                            + "where rownum = 1";
 | 
				
			||||||
            String idP = Utils.mySelect(query, "nr", dbStringa, dbUsername, dbPassword, this);
 | 
					            String idP = Utils.mySelect(query, "nr", this);
 | 
				
			||||||
            if (idP.length() > 0) {
 | 
					            if (idP.length() > 0) {
 | 
				
			||||||
                Long rowCount = Long.valueOf(idP);
 | 
					                Long rowCount = Long.valueOf(idP);
 | 
				
			||||||
                idPrenotazione = rowCount;
 | 
					                idPrenotazione = rowCount;
 | 
				
			||||||
@ -4290,7 +4290,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
            String query = "SELECT Punti || '|' || prezzo as res FROM tariffe "
 | 
					            String query = "SELECT Punti || '|' || prezzo as res FROM tariffe "
 | 
				
			||||||
                    + "where id_Prodotto = " + idProdotto 
 | 
					                    + "where id_Prodotto = " + idProdotto 
 | 
				
			||||||
                    + " and id_fascia=" + idProfiloTariffario;
 | 
					                    + " and id_fascia=" + idProfiloTariffario;
 | 
				
			||||||
            String res = Utils.mySelect(query, "res", dbStringa, dbUsername, dbPassword, this);
 | 
					            String res = Utils.mySelect(query, "res", this);
 | 
				
			||||||
            if (res.length() > 0) {
 | 
					            if (res.length() > 0) {
 | 
				
			||||||
                String[] el = res.split("\\|", -1);
 | 
					                String[] el = res.split("\\|", -1);
 | 
				
			||||||
                Double prezzo;
 | 
					                Double prezzo;
 | 
				
			||||||
@ -4591,7 +4591,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    + "  and t.numero = '" + nTessera + "'";  //*** Numero della tessera letto su smartcard ***
 | 
					                    + "  and t.numero = '" + nTessera + "'";  //*** Numero della tessera letto su smartcard ***
 | 
				
			||||||
            //MyApplication myApp = new MyApplication();
 | 
					            //MyApplication myApp = new MyApplication();
 | 
				
			||||||
            //String[] res = myApp.mySelect(this, query, "res").split("\\|");
 | 
					            //String[] res = myApp.mySelect(this, query, "res").split("\\|");
 | 
				
			||||||
            String[] res = Utils.mySelect(query, "res", dbStringa, dbUsername, dbPassword, this).split("\\|");
 | 
					            String[] res = Utils.mySelect(query, "res", this).split("\\|");
 | 
				
			||||||
            if (res.length >= 3) {
 | 
					            if (res.length >= 3) {
 | 
				
			||||||
                utenteLoggato = res[0];
 | 
					                utenteLoggato = res[0];
 | 
				
			||||||
                idAccount = Long.valueOf(res[1]);
 | 
					                idAccount = Long.valueOf(res[1]);
 | 
				
			||||||
@ -4599,7 +4599,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                if (utenteLoggato.length() > 0 && idAccount > 0L && stato == 1) {
 | 
					                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";
 | 
					                    String sql = "SELECT count(*) as Counter FROM profili p WHERE p.id_account = " + idAccount + " AND p.id_ruolo = 10000000004";
 | 
				
			||||||
                    //Integer counter = Integer.valueOf(myApp.mySelect(this, sql, "Counter"));
 | 
					                    //Integer counter = Integer.valueOf(myApp.mySelect(this, sql, "Counter"));
 | 
				
			||||||
                    Integer counter = Integer.valueOf(Utils.mySelect(sql, "Counter", dbStringa, dbUsername, dbPassword, this));
 | 
					                    Integer counter = Integer.valueOf(Utils.mySelect(sql, "Counter", this));
 | 
				
			||||||
                    if (counter == 1) {
 | 
					                    if (counter == 1) {
 | 
				
			||||||
                        impostaAmbiente();
 | 
					                        impostaAmbiente();
 | 
				
			||||||
                        verificaAggiornamentoDB();
 | 
					                        verificaAggiornamentoDB();
 | 
				
			||||||
@ -4615,7 +4615,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
 | 
				
			|||||||
                    if (stato == 2) {
 | 
					                    if (stato == 2) {
 | 
				
			||||||
                        //String messaggio = myApp.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + stato, "descrizione");
 | 
					                        //String messaggio = myApp.mySelect(this, "Select Descrizione from Stati_Accounts where id=" + stato, "descrizione");
 | 
				
			||||||
                        String messaggio = Utils.mySelect("Select Descrizione from Stati_Accounts where id=" + stato, "descrizione", 
 | 
					                        String messaggio = Utils.mySelect("Select Descrizione from Stati_Accounts where id=" + stato, "descrizione", 
 | 
				
			||||||
                                dbStringa, dbUsername, dbPassword, this);
 | 
					                                this);
 | 
				
			||||||
                        JOptionPane.showMessageDialog(this, messaggio + ".");
 | 
					                        JOptionPane.showMessageDialog(this, messaggio + ".");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ import javax.swing.JTable;
 | 
				
			|||||||
import javax.swing.JTextField;
 | 
					import javax.swing.JTextField;
 | 
				
			||||||
import javax.swing.ListSelectionModel;
 | 
					import javax.swing.ListSelectionModel;
 | 
				
			||||||
import javax.swing.table.TableColumn;
 | 
					import javax.swing.table.TableColumn;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -515,7 +516,7 @@ private JTextField jtxtTessera;
 | 
				
			|||||||
//        int[] cols=new int[1];
 | 
					//        int[] cols=new int[1];
 | 
				
			||||||
//        cols[0]=7;
 | 
					//        cols[0]=7;
 | 
				
			||||||
//        model.setColModificabile(cols);
 | 
					//        model.setColModificabile(cols);
 | 
				
			||||||
        int rowCount=Integer.parseInt(MyA.mySelect(frmPuntoCassa,QueryCount, "righe"));
 | 
					        int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
 | 
				
			||||||
        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
					        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
				
			||||||
        model.setData(data);
 | 
					        model.setData(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -747,8 +748,8 @@ private JTextField jtxtTessera;
 | 
				
			|||||||
    private void CercaValoriDefault() {
 | 
					    private void CercaValoriDefault() {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            MyApplication MyA = new MyApplication();
 | 
					            MyApplication MyA = new MyApplication();
 | 
				
			||||||
            String txtbox = MyA.mySelect(frmPuntoCassa, "Select Valore from PARAMETRI where chiave='ImpostaTesseraCampo'", "Valore");
 | 
					            String txtbox = Utils.mySelect("Select Valore from PARAMETRI where chiave='ImpostaTesseraCampo'", "Valore", frmPuntoCassa);
 | 
				
			||||||
            String txtboxValore = MyA.mySelect(frmPuntoCassa, "Select Valore from PARAMETRI where chiave='ImpostaTesseraStringa'", "Valore");
 | 
					            String txtboxValore = Utils.mySelect("Select Valore from PARAMETRI where chiave='ImpostaTesseraStringa'", "Valore", frmPuntoCassa);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (txtbox.equalsIgnoreCase("COGNOME")) {
 | 
					            if (txtbox.equalsIgnoreCase("COGNOME")) {
 | 
				
			||||||
                jtxtCognome.requestFocus();
 | 
					                jtxtCognome.requestFocus();
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,7 @@ import javax.swing.JTable;
 | 
				
			|||||||
import javax.swing.JTextField;
 | 
					import javax.swing.JTextField;
 | 
				
			||||||
import javax.swing.ListSelectionModel;
 | 
					import javax.swing.ListSelectionModel;
 | 
				
			||||||
import javax.swing.table.TableColumn;
 | 
					import javax.swing.table.TableColumn;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -212,7 +213,7 @@ public class FrmMeteo extends javax.swing.JFrame {
 | 
				
			|||||||
//        int[] cols=new int[1];
 | 
					//        int[] cols=new int[1];
 | 
				
			||||||
//        cols[0]=7;
 | 
					//        cols[0]=7;
 | 
				
			||||||
//        model.setColModificabile(cols);
 | 
					//        model.setColModificabile(cols);
 | 
				
			||||||
        int rowCount=Integer.parseInt(MyA.mySelect(frmPuntoCassa,QueryCount, "righe"));
 | 
					        int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
 | 
				
			||||||
        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
					        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
				
			||||||
        model.setData(data);
 | 
					        model.setData(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ import javax.swing.JTable;
 | 
				
			|||||||
import javax.swing.JTextField;
 | 
					import javax.swing.JTextField;
 | 
				
			||||||
import javax.swing.ListSelectionModel;
 | 
					import javax.swing.ListSelectionModel;
 | 
				
			||||||
import javax.swing.table.TableColumn;
 | 
					import javax.swing.table.TableColumn;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -282,7 +283,7 @@ public class FrmMovimenti extends javax.swing.JFrame {
 | 
				
			|||||||
//        int[] cols=new int[1];
 | 
					//        int[] cols=new int[1];
 | 
				
			||||||
//        cols[0]=7;
 | 
					//        cols[0]=7;
 | 
				
			||||||
//        model.setColModificabile(cols);
 | 
					//        model.setColModificabile(cols);
 | 
				
			||||||
        int rowCount=Integer.parseInt(MyA.mySelect(frmPuntoCassa,QueryCount, "righe"));
 | 
					        int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
 | 
				
			||||||
        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
					        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
				
			||||||
        model.setData(data);
 | 
					        model.setData(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ import javax.swing.JTable;
 | 
				
			|||||||
import javax.swing.JTextField;
 | 
					import javax.swing.JTextField;
 | 
				
			||||||
import javax.swing.ListSelectionModel;
 | 
					import javax.swing.ListSelectionModel;
 | 
				
			||||||
import javax.swing.table.TableColumn;
 | 
					import javax.swing.table.TableColumn;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -485,7 +486,7 @@ private PuntoCassa frmPuntoCassa;
 | 
				
			|||||||
//        int[] cols=new int[1];
 | 
					//        int[] cols=new int[1];
 | 
				
			||||||
//        cols[0]=7;
 | 
					//        cols[0]=7;
 | 
				
			||||||
//        model.setColModificabile(cols);
 | 
					//        model.setColModificabile(cols);
 | 
				
			||||||
        int rowCount=Integer.parseInt(MyA.mySelect(frmPuntoCassa,QueryCount, "righe"));
 | 
					        int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
 | 
				
			||||||
        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
					        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
				
			||||||
        model.setData(data);
 | 
					        model.setData(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ import javax.swing.JTable;
 | 
				
			|||||||
import javax.swing.JTextField;
 | 
					import javax.swing.JTextField;
 | 
				
			||||||
import javax.swing.ListSelectionModel;
 | 
					import javax.swing.ListSelectionModel;
 | 
				
			||||||
import javax.swing.table.TableColumn;
 | 
					import javax.swing.table.TableColumn;
 | 
				
			||||||
 | 
					import puntocassa.utils.Utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -335,7 +336,7 @@ public class FrmStorno extends javax.swing.JFrame {
 | 
				
			|||||||
//        int[] cols=new int[1];
 | 
					//        int[] cols=new int[1];
 | 
				
			||||||
//        cols[0]=7;
 | 
					//        cols[0]=7;
 | 
				
			||||||
//        model.setColModificabile(cols);
 | 
					//        model.setColModificabile(cols);
 | 
				
			||||||
        int rowCount=Integer.parseInt(MyA.mySelect(frmPuntoCassa,QueryCount, "righe"));
 | 
					        int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
 | 
				
			||||||
        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
					        Object[][] data = RowData(Query, Colonne,ColType,rowCount);
 | 
				
			||||||
        model.setData(data);
 | 
					        model.setData(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,10 +19,10 @@ public class Utils {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static String mySelect(String query, String campo, String dbStringa, String dbUsername, String dbPassword, PuntoCassa puntoCassa) {
 | 
					    public static String mySelect(String query, String campo, PuntoCassa puntoCassa) {
 | 
				
			||||||
        String res = "";
 | 
					        String res = "";
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
 | 
					            Connection dbConnection = DriverManager.getConnection(puntoCassa.dbStringa, puntoCassa.dbUsername, puntoCassa.dbPassword);
 | 
				
			||||||
            Statement st = dbConnection.createStatement();
 | 
					            Statement st = dbConnection.createStatement();
 | 
				
			||||||
            ResultSet rs = st.executeQuery(query);
 | 
					            ResultSet rs = st.executeQuery(query);
 | 
				
			||||||
            while (rs.next()) {
 | 
					            while (rs.next()) {
 | 
				
			||||||
@ -42,11 +42,11 @@ public class Utils {
 | 
				
			|||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static Boolean myInsert(String query, String dbStringa, String dbUsername, String dbPassword, PuntoCassa puntoCassa) {
 | 
					    public static Boolean myInsert(String query, PuntoCassa puntoCassa) {
 | 
				
			||||||
        //System.out.println(query);
 | 
					        //System.out.println(query);
 | 
				
			||||||
        Boolean res = false;
 | 
					        Boolean res = false;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
 | 
					            Connection dbConnection = DriverManager.getConnection(puntoCassa.dbStringa, puntoCassa.dbUsername, puntoCassa.dbPassword);
 | 
				
			||||||
            Statement st = dbConnection.createStatement();
 | 
					            Statement st = dbConnection.createStatement();
 | 
				
			||||||
            ResultSet rs = st.executeQuery(query);
 | 
					            ResultSet rs = st.executeQuery(query);
 | 
				
			||||||
            rs.close();
 | 
					            rs.close();
 | 
				
			||||||
@ -60,11 +60,11 @@ public class Utils {
 | 
				
			|||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static Long mySelectInteger(String query, String campo, String dbStringa, String dbUsername, String dbPassword, PuntoCassa puntoCassa) {
 | 
					    public static Long mySelectInteger(String query, String campo, PuntoCassa puntoCassa) {
 | 
				
			||||||
        System.out.println(query);
 | 
					        System.out.println(query);
 | 
				
			||||||
        Long res = 0L;
 | 
					        Long res = 0L;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
 | 
					            Connection dbConnection = DriverManager.getConnection(puntoCassa.dbStringa, puntoCassa.dbUsername, puntoCassa.dbPassword);
 | 
				
			||||||
            Statement st = dbConnection.createStatement();
 | 
					            Statement st = dbConnection.createStatement();
 | 
				
			||||||
            ResultSet rs = st.executeQuery(query);
 | 
					            ResultSet rs = st.executeQuery(query);
 | 
				
			||||||
            while (rs.next()) {
 | 
					            while (rs.next()) {
 | 
				
			||||||
@ -100,4 +100,40 @@ public class Utils {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public static String trovaScadenza(String testo) {
 | 
				
			||||||
 | 
					        String scadenza = "";
 | 
				
			||||||
 | 
					        String tag = "#";
 | 
				
			||||||
 | 
					        Integer pi = testo.lastIndexOf(tag);
 | 
				
			||||||
 | 
					        if (pi > 0) {
 | 
				
			||||||
 | 
					            scadenza = testo.substring(pi - 9, pi - 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return scadenza;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public static String luhn(String dati) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Integer s = 0;
 | 
				
			||||||
 | 
					        for (Integer i = 0; i < dati.length(); i++) {
 | 
				
			||||||
 | 
					            Integer d = Integer.valueOf(dati.substring(i, i + 1));
 | 
				
			||||||
 | 
					            if (i % 2 == 0) {
 | 
				
			||||||
 | 
					                Integer doppio = d * 2;
 | 
				
			||||||
 | 
					                if (doppio >= 10) {
 | 
				
			||||||
 | 
					                    doppio = 1 + (doppio % 10);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                s = s + doppio;
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                s = s + d;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Integer resto = s % 10;
 | 
				
			||||||
 | 
					        if (resto == 0) {
 | 
				
			||||||
 | 
					            return "0";
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            Integer ris = 10 - resto;
 | 
				
			||||||
 | 
					            return "" + ris;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user