completamento modifiche
in caso di presenza di una prenotazione legata ad una tessera, il saldo non viene aggiornato se la stessa risulta già pagata. inoltre, se pagata, non sarà possibile modificare i prodotti presenti nel carrello. effettuata pulizia codice e creazione nuove funzioni per migliorare la leggibilità del sorgente
This commit is contained in:
parent
df62c97c24
commit
2cdc76f9a4
23
src/puntocassa/EventParameters.java
Normal file
23
src/puntocassa/EventParameters.java
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package puntocassa;
|
||||
|
||||
/**
|
||||
* Classe che descrive i parametri da passare agli oggetti di tipo java.awt.Event.ActionEvent
|
||||
* @author assis
|
||||
*/
|
||||
public class EventParameters {
|
||||
public final String idProdotto;
|
||||
public final String idCategoria;
|
||||
public final boolean flagPrenotazionePagata;
|
||||
public final String idPrenDettaglio;
|
||||
|
||||
public EventParameters(String idProdotto, String idCategoria, boolean flagPrenotazionePagata, String idPrenDettaglio){
|
||||
this.idProdotto = idProdotto;
|
||||
this.idCategoria = idCategoria;
|
||||
this.flagPrenotazionePagata = flagPrenotazionePagata;
|
||||
this.idPrenDettaglio = idPrenDettaglio;
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package puntocassa;
|
||||
|
||||
import java.awt.Font;
|
||||
@ -30,50 +29,52 @@ import puntocassa.utils.Utils;
|
||||
public class FrmStorno extends javax.swing.JFrame {
|
||||
|
||||
private PuntoCassa frmPuntoCassa;
|
||||
private Long idTessera=0L,idPuntoCassa=0L;
|
||||
public int HFont = 15;
|
||||
private int AltControlli = 100;
|
||||
private int LargControlli = 100;
|
||||
private int AltRigaGriglia = 0;
|
||||
private Boolean Azzera=false;
|
||||
private Boolean StornoEffettuato=false;
|
||||
private Long idTessera = 0L, idPuntoCassa = 0L;
|
||||
public int hFont = 15;
|
||||
private int altRigaGriglia = 0;
|
||||
private Boolean azzera = false;
|
||||
private Boolean stornoEffettuato = false;
|
||||
|
||||
/**
|
||||
* Creates new form frm
|
||||
*
|
||||
* @param frm
|
||||
* @param idTessera
|
||||
* @param idPuntoCassa
|
||||
* @param imgPath
|
||||
* @param azzera
|
||||
*/
|
||||
public FrmStorno(PuntoCassa frm,Long IDTessera,Long IDPuntoCassa,String imgPath,Boolean azzera) {
|
||||
public FrmStorno(PuntoCassa frm, Long idTessera, Long idPuntoCassa, String imgPath, Boolean azzera) {
|
||||
|
||||
frmPuntoCassa=frm;
|
||||
frmPuntoCassa = frm;
|
||||
frmPuntoCassa.setEnabled(false);
|
||||
//KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
|
||||
frmPuntoCassa.addRemoveKeyDispatcher(false);
|
||||
|
||||
idPuntoCassa=IDPuntoCassa;
|
||||
idTessera=IDTessera;
|
||||
Azzera=azzera;
|
||||
|
||||
this.idPuntoCassa = idPuntoCassa;
|
||||
this.idTessera = idTessera;
|
||||
this.azzera = azzera;
|
||||
initComponents();
|
||||
|
||||
String startDir = System.getProperty("user.dir");
|
||||
File IconaApp = new File(startDir + "/risorse/logo.png");
|
||||
if (IconaApp.exists()) {
|
||||
File iconaApp = new File(startDir + "/risorse/logo.png");
|
||||
if (iconaApp.exists()) {
|
||||
|
||||
ImageIcon icon = new ImageIcon(startDir + "/risorse/logo.png");
|
||||
this.setIconImage(icon.getImage());
|
||||
}
|
||||
|
||||
|
||||
ImageIcon icon = new ImageIcon(imgPath +"freccia_down.jpg");
|
||||
Image img = icon.getImage() ;
|
||||
Image newimg = img.getScaledInstance(50,50,java.awt.Image.SCALE_SMOOTH ) ;
|
||||
icon = new ImageIcon(newimg);
|
||||
|
||||
ImageIcon icon = new ImageIcon(imgPath + "freccia_down.jpg");
|
||||
Image img = icon.getImage();
|
||||
Image newimg = img.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
|
||||
icon = new ImageIcon(newimg);
|
||||
jbtnGiu.setIcon(icon);
|
||||
|
||||
ImageIcon icon2 = new ImageIcon(imgPath +"freccia_up.jpg");
|
||||
Image img2 = icon2.getImage() ;
|
||||
Image newimg2 = img2.getScaledInstance(50,50,java.awt.Image.SCALE_SMOOTH ) ;
|
||||
|
||||
ImageIcon icon2 = new ImageIcon(imgPath + "freccia_up.jpg");
|
||||
Image img2 = icon2.getImage();
|
||||
Image newimg2 = img2.getScaledInstance(50, 50, java.awt.Image.SCALE_SMOOTH);
|
||||
icon2 = new ImageIcon(newimg2);
|
||||
jbtnSu.setIcon(icon2);
|
||||
Aggiorna();
|
||||
aggiorna();
|
||||
|
||||
}
|
||||
|
||||
@ -210,319 +211,238 @@ public class FrmStorno extends javax.swing.JFrame {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
|
||||
// ClearTable((MyTableModel)jTblStudenti.getModel());
|
||||
|
||||
// frmPuntoCassa.setEnabled(true);
|
||||
// frmPuntoCassa=null;
|
||||
// if (Azzera){
|
||||
// frmPuntoCassa.AzzeraDopoStorno();
|
||||
// }
|
||||
this.dispose();
|
||||
|
||||
}//GEN-LAST:event_jbtnAnnullaActionPerformed
|
||||
private void ClearTable(MyTableModel model) {
|
||||
try {
|
||||
for (Integer i = model.getRowCount() - 1; i >= 0; i--) {
|
||||
model.deleteRow(i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
private void Tastiera(JTextField jTxt,Integer MyX,Integer MyY){
|
||||
|
||||
MyKeyBoard myk=new MyKeyBoard(this,false);
|
||||
myk.txt=jTxt;
|
||||
myk.parent=this;
|
||||
Rectangle s=this.getBounds();
|
||||
Rectangle s2=jTxt.getBounds();
|
||||
Integer l=s.x+s2.x+MyX;
|
||||
if(l+800>s.x+s.width){l=s.x+s.width-800;}
|
||||
myk.setBounds(l,s.y+s2.y+60+MyY, 800, 300);
|
||||
myk.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
|
||||
try{
|
||||
try {
|
||||
|
||||
frmPuntoCassa.setEnabled(true);
|
||||
//KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(frmPuntoCassa.keyDispatcher);
|
||||
frmPuntoCassa.addRemoveKeyDispatcher(true);
|
||||
frmPuntoCassa.toFront();
|
||||
frmPuntoCassa.repaint();
|
||||
if (Azzera && StornoEffettuato==false){
|
||||
if (azzera && stornoEffettuato == false) {
|
||||
frmPuntoCassa.azzeraDopoStorno();
|
||||
}
|
||||
frmPuntoCassa=null;
|
||||
frmPuntoCassa = null;
|
||||
|
||||
this.dispose();
|
||||
}catch(Exception ex){}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}//GEN-LAST:event_formWindowClosed
|
||||
|
||||
private void jBtnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnOKActionPerformed
|
||||
if (jTblStudenti.getSelectedRow() >= 0 ) {
|
||||
if (jTblStudenti.getSelectedRow() >= 0) {
|
||||
MyTableModel model = new MyTableModel();
|
||||
model = (MyTableModel) jTblStudenti.getModel();
|
||||
Object[]row = model.getRow(jTblStudenti.getSelectedRow());
|
||||
// QueryDati("select a.id 0,a.data 1,a.num_progressivo as Progressivo 2,p.nome as Prodotto,a.importo 4,a.punti 5,a.saldo_pre,a.saldo_post,a.punti_pre,a.punti_post,p.id as idProdotto " + From + Where + " order by a.data,a.num_progressivo", QueryCount, Col, ColType, jTblStudenti, false);
|
||||
|
||||
//Boolean Ok=MyInsert("insert into ristorni (ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO) " +
|
||||
// "values (" + idTessera + "," + row[1] + "," + idPuntoCassa + ",to_date('" + row[2] + "','dd/mm/yyyy HH24:MI:SS')," + row[3] + ","+ row[5] + "," + row[6] + "," + row[7] + "," + row[8] + ")");
|
||||
Boolean Ok=MyInsert("insert into ristorni (ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS) " +
|
||||
"SELECT ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS " +
|
||||
"FROM st_acquisti WHERE num_progressivo = " + row[3]);
|
||||
if(Ok){
|
||||
//MyInsert("Delete from St_Acquisti where id="+ row[0]);
|
||||
MyInsert("Delete from St_Acquisti where num_progressivo="+ row[3]);
|
||||
StornoEffettuato=true;
|
||||
Object[] row = model.getRow(jTblStudenti.getSelectedRow());
|
||||
|
||||
Boolean ok = Utils.myInsert("insert into ristorni (ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS,ID_PREN_DETTAGLIO) "
|
||||
+ "SELECT ID_TESSERA,ID_PRODOTTO,ID_PUNTO_CASSA,DATA,NUM_PROGRESSIVO,IMPORTO,PUNTI,ID_TIPO_PAGAMENTO,ID_TURNO,FLAG_IN_VASSOIO,SALDO_PRE,SALDO_POST,PUNTI_PRE,PUNTI_POST,FLAG_GRATUITA,FLAG_ASPORTO,FLAG_BONUS,ID_PREN_DETTAGLIO "
|
||||
+ "FROM st_acquisti WHERE num_progressivo = " + row[3], this.frmPuntoCassa);
|
||||
if (ok) {
|
||||
Utils.myInsert("Delete from St_Acquisti where num_progressivo=" + row[3], this.frmPuntoCassa);
|
||||
stornoEffettuato = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Azzera){
|
||||
// frmPuntoCassa.AzzeraDopoStorno();
|
||||
}else
|
||||
{
|
||||
if (!azzera) {
|
||||
frmPuntoCassa.aggiornaProgressivi();
|
||||
}
|
||||
//frmPuntoCassa.CercaTessera();
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
|
||||
}//GEN-LAST:event_jBtnOKActionPerformed
|
||||
|
||||
private void jbtnSuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if(jTblStudenti.getSelectedRow()>0){
|
||||
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()-1, jTblStudenti.getSelectedRow()-1);
|
||||
if (jTblStudenti.getSelectedRow() > 0) {
|
||||
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow() - 1, jTblStudenti.getSelectedRow() - 1);
|
||||
jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
|
||||
}
|
||||
}//GEN-LAST:event_jbtnSuActionPerformed
|
||||
|
||||
private void jbtnGiuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnGiuActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if(jTblStudenti.getSelectedRow()<jTblStudenti.getRowCount()-1){
|
||||
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow()+1, jTblStudenti.getSelectedRow()+1);
|
||||
if (jTblStudenti.getSelectedRow() < jTblStudenti.getRowCount() - 1) {
|
||||
jTblStudenti.setRowSelectionInterval(jTblStudenti.getSelectedRow() + 1, jTblStudenti.getSelectedRow() + 1);
|
||||
jTblStudenti.scrollRectToVisible(new Rectangle(jTblStudenti.getCellRect(jTblStudenti.getSelectedRow(), 0, true)));
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jbtnGiuActionPerformed
|
||||
private Boolean MyInsert(String Query) {
|
||||
Boolean res=false;
|
||||
|
||||
|
||||
private void queryDati(String query, String queryCount, String[] colonne, String[] colTypes, JTable jTbl) {
|
||||
try {
|
||||
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
|
||||
Statement st = dbConnection.createStatement();
|
||||
ResultSet rs = st.executeQuery(Query);
|
||||
rs.close();
|
||||
st.close();
|
||||
dbConnection.close();
|
||||
res=true;
|
||||
} catch (SQLException e) {
|
||||
JOptionPane.showMessageDialog(this, "Errore MySelect ['" + e.getMessage() + " " + Query + "']");
|
||||
|
||||
MyTableModel model = new MyTableModel();
|
||||
model.setColumname(colonne);
|
||||
|
||||
int rowCount = Integer.parseInt(Utils.mySelect(queryCount, "righe", frmPuntoCassa));
|
||||
Object[][] data = rowData(query, colonne, colTypes, rowCount);
|
||||
model.setData(data);
|
||||
|
||||
try {
|
||||
jTbl.setModel(model);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
jTbl.setAutoCreateColumnsFromModel(true);
|
||||
|
||||
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||
jTbl.setFont(new Font("Tahoma", 0, 16));
|
||||
|
||||
TableColumn column = jTbl.getColumn("id");
|
||||
column.setMinWidth(0);
|
||||
column.setMaxWidth(0);
|
||||
column.setWidth(0);
|
||||
column.setPreferredWidth(0);
|
||||
|
||||
TableColumn column2 = jTbl.getColumn("idProdotto");
|
||||
column2.setMinWidth(0);
|
||||
column2.setMaxWidth(0);
|
||||
column2.setWidth(0);
|
||||
column2.setPreferredWidth(0);
|
||||
|
||||
TableColumn column3 = jTbl.getColumn("id_Tipo_Pagamento");
|
||||
column3.setMinWidth(0);
|
||||
column3.setMaxWidth(0);
|
||||
column3.setWidth(0);
|
||||
column3.setPreferredWidth(0);
|
||||
|
||||
TableColumn column4 = jTbl.getColumn("id_Turno");
|
||||
column4.setMinWidth(0);
|
||||
column4.setMaxWidth(0);
|
||||
column4.setWidth(0);
|
||||
column4.setPreferredWidth(0);
|
||||
|
||||
TableColumn column1 = jTbl.getColumn("Prodotto");
|
||||
column1.setPreferredWidth(280);
|
||||
column1.setWidth(280);
|
||||
|
||||
TableColumn column11 = jTbl.getColumn("Data");
|
||||
column11.setPreferredWidth(180);
|
||||
column11.setWidth(180);
|
||||
|
||||
model.fireTableDataChanged();
|
||||
|
||||
doLayout();
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
System.out.println("Query: " + e.getMessage());
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
private void QueryDati(String Query,String QueryCount,String[] Colonne,String[] ColType, JTable jTbl,Boolean Editable){
|
||||
try{
|
||||
MyApplication MyA=new MyApplication();
|
||||
MyTableModel model = new MyTableModel( );
|
||||
model.setColumname(Colonne);
|
||||
|
||||
|
||||
// model.setEditable(Editable);
|
||||
// int [] colBool=new int[1];
|
||||
// colBool[0]=7;
|
||||
// model.setColBoolean(colBool);
|
||||
// int[] cols=new int[1];
|
||||
// cols[0]=7;
|
||||
// model.setColModificabile(cols);
|
||||
int rowCount=Integer.parseInt(Utils.mySelect(QueryCount, "righe", frmPuntoCassa));
|
||||
Object[][] data = RowData(Query, Colonne,ColType,rowCount);
|
||||
model.setData(data);
|
||||
|
||||
try{jTbl.setModel(model);}catch(Exception e){}
|
||||
jTbl.setAutoCreateColumnsFromModel(true);
|
||||
|
||||
jTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTbl.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||
jTbl.setFont(new Font("Tahoma", 0, 16));
|
||||
|
||||
|
||||
TableColumn column = jTbl.getColumn("id");
|
||||
column.setMinWidth(0);
|
||||
column.setMaxWidth(0);
|
||||
column.setWidth(0);
|
||||
column.setPreferredWidth(0);
|
||||
|
||||
TableColumn column2 = jTbl.getColumn("idProdotto");
|
||||
column2.setMinWidth(0);
|
||||
column2.setMaxWidth(0);
|
||||
column2.setWidth(0);
|
||||
column2.setPreferredWidth(0);
|
||||
|
||||
TableColumn column3 = jTbl.getColumn("id_Tipo_Pagamento");
|
||||
column3.setMinWidth(0);
|
||||
column3.setMaxWidth(0);
|
||||
column3.setWidth(0);
|
||||
column3.setPreferredWidth(0);
|
||||
|
||||
TableColumn column4 = jTbl.getColumn("id_Turno");
|
||||
column4.setMinWidth(0);
|
||||
column4.setMaxWidth(0);
|
||||
column4.setWidth(0);
|
||||
column4.setPreferredWidth(0);
|
||||
|
||||
TableColumn column1 = jTbl.getColumn("Prodotto");
|
||||
column1.setPreferredWidth(280);
|
||||
column1.setWidth(280);
|
||||
|
||||
TableColumn column11 = jTbl.getColumn("Data");
|
||||
column11.setPreferredWidth(180);
|
||||
column11.setWidth(180);
|
||||
|
||||
model.fireTableDataChanged();
|
||||
|
||||
doLayout();
|
||||
}catch(NumberFormatException e){
|
||||
|
||||
System.out.println("Query: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
private void Aggiorna() {
|
||||
private void aggiorna() {
|
||||
try {
|
||||
String From=" 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 ";
|
||||
String Where= "where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa ;
|
||||
// String Where= " and UPPER(Cognome) like '" + jtxtCognome.getText().trim().toUpperCase().replace("'", "''") + "%' ";
|
||||
// if (jtxtNome.getText().trim().length()>0) {Where=Where + " and UPPER(Nome) like '" + jtxtNome.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
|
||||
// if (jtxtCodFis.getText().trim().length()>0) {Where=Where + " and UPPER(Matricola) like '" + jtxtCodFis.getText().trim().toUpperCase().replace("'", "''") + "%'"; }
|
||||
String[] Col = {"id", "idProdotto", "Data","Progressivo","Prodotto","Importo","id_Tipo_Pagamento","id_Turno","Pagamento"};
|
||||
String[] ColType = {"long", "long", "data","integer", "text", "float", "long", "long", "text"};
|
||||
String QueryCount="Select count(*) as righe " + From + Where;
|
||||
QueryDati("select a.id,p.id as idProdotto,a.data,a.num_progressivo as Progressivo,p.nome as Prodotto,a.importo,a.id_tipo_pagamento,a.id_turno,tp.Nome as Pagamento " + From + Where + " order by a.data desc,a.num_progressivo desc", QueryCount, Col, ColType, jTblStudenti, false);
|
||||
|
||||
//jTblStudenti.getColumn("Drawing").setPreferredWidth(200);
|
||||
|
||||
String fromClause = " 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 ";
|
||||
String whereClause = "where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa;
|
||||
String[] colNames = {"id", "idProdotto", "Data", "Progressivo", "Prodotto", "Importo", "id_Tipo_Pagamento", "id_Turno", "Pagamento"};
|
||||
String[] colTypes = {"long", "long", "data", "integer", "text", "float", "long", "long", "text"};
|
||||
String QueryCount = "Select count(*) as righe " + fromClause + whereClause;
|
||||
queryDati("select a.id,p.id as idProdotto,a.data,a.num_progressivo as Progressivo,p.nome as Prodotto,a.importo,a.id_tipo_pagamento,a.id_turno,tp.Nome as Pagamento " + fromClause + whereClause + " order by a.data desc,a.num_progressivo desc", QueryCount, colNames, colTypes, jTblStudenti);
|
||||
|
||||
|
||||
Font f=new Font("Tahoma",0,18);
|
||||
Font f = new Font("Tahoma", 0, 18);
|
||||
jTblStudenti.setFont(f);
|
||||
if(AltRigaGriglia==0){AltRigaGriglia=jTblStudenti.getRowHeight();}
|
||||
// txtUsername.setSize(CalcolaLarghezzaAltezza(txtUsername.getWidth(),LargControlli), CalcolaLarghezzaAltezza(txtUsername.getHeight(),AltControlli));
|
||||
|
||||
if (altRigaGriglia == 0) {
|
||||
altRigaGriglia = jTblStudenti.getRowHeight();
|
||||
}
|
||||
|
||||
jTblStudenti.setRowHeight(25);
|
||||
|
||||
|
||||
//ClearTable((MyTableModel)jTblTessere.getModel());
|
||||
|
||||
if (jTblStudenti.getRowCount() > 0) {
|
||||
jTblStudenti.setRowSelectionInterval(0, 0);
|
||||
|
||||
}
|
||||
///AggiornaTessera(0);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
private Integer CalcolaLarghezzaAltezza(Integer LarControllo,Integer Percentuale){
|
||||
Integer D = Percentuale - 100;
|
||||
if (D == 0) {
|
||||
return LarControllo;
|
||||
} else {
|
||||
Integer N = LarControllo + ((LarControllo * D) / 100);
|
||||
return N;
|
||||
}
|
||||
|
||||
}
|
||||
public Object[][] RowData(String Query, String[] Cols, String[] ColType, int rowCount) {
|
||||
|
||||
|
||||
public Object[][] rowData(String query, String[] cols, String[] colTypes, int rowCount) {
|
||||
Object[][] rows = null;
|
||||
try {
|
||||
Connection dbConnection = DriverManager.getConnection(frmPuntoCassa.dbStringa, frmPuntoCassa.dbUsername, frmPuntoCassa.dbPassword);
|
||||
Statement st = dbConnection.createStatement();
|
||||
ResultSet rs = st.executeQuery(Query);
|
||||
ResultSet rs = st.executeQuery(query);
|
||||
rows = new Object[rowCount][];
|
||||
int r = 0;
|
||||
while (rs.next()) {
|
||||
Object[] row = new Object[Cols.length];
|
||||
for (int i = 0; i < Cols.length; i++) {
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
Object[] row = new Object[cols.length];
|
||||
for (int i = 0; i < cols.length; i++) {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = "";
|
||||
} else {
|
||||
row[i] = rs.getString(Cols[i].replace(" ", "_"));
|
||||
row[i] = rs.getString(cols[i].replace(" ", "_"));
|
||||
}
|
||||
switch (ColType[i]) {
|
||||
case "text":
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
switch (colTypes[i]) {
|
||||
case "text" -> {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = "";
|
||||
} else {
|
||||
row[i] = rs.getString(Cols[i].replace(" ", "_"));
|
||||
row[i] = rs.getString(cols[i].replace(" ", "_"));
|
||||
}
|
||||
break;
|
||||
case "integer":
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
}
|
||||
case "integer" -> {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = 0;
|
||||
} else {
|
||||
row[i] = rs.getInt(Cols[i].replace(" ", "_"));
|
||||
row[i] = rs.getInt(cols[i].replace(" ", "_"));
|
||||
}
|
||||
break;
|
||||
case "long":
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
}
|
||||
case "long" -> {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = 0;
|
||||
} else {
|
||||
row[i] = rs.getLong(Cols[i].replace(" ", "_"));
|
||||
row[i] = rs.getLong(cols[i].replace(" ", "_"));
|
||||
}
|
||||
break;
|
||||
case "boolean":
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
}
|
||||
case "boolean" -> {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = false;
|
||||
} else {
|
||||
row[i] = rs.getBoolean(Cols[i].replace(" ", "_"));
|
||||
row[i] = rs.getBoolean(cols[i].replace(" ", "_"));
|
||||
}
|
||||
break;
|
||||
case "float":
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) == null) {
|
||||
}
|
||||
case "float" -> {
|
||||
if (rs.getString(cols[i].replace(" ", "_")) == null) {
|
||||
row[i] = 0.00;
|
||||
} else {
|
||||
String v = rs.getString(Cols[i].replace(" ", "_"));
|
||||
String v = rs.getString(cols[i].replace(" ", "_"));
|
||||
|
||||
row[i] = Float.parseFloat(v.replace(",", "."));
|
||||
row[i] = Float.valueOf(v.replace(",", "."));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "data":
|
||||
case "data" -> {
|
||||
row[i] = "";
|
||||
if (rs.getString(Cols[i].replace(" ", "_")) != null) {
|
||||
// Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ITALY).parse(rs.getString(Cols[i]));
|
||||
//SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
||||
String[] d= rs.getString(Cols[i].replace(" ", "_")).split("-");
|
||||
if (d.length>=3){
|
||||
String Ora="";
|
||||
|
||||
if(d[2].length()>8){
|
||||
String O[]=d[2].trim().split(" ");
|
||||
if(O.length>1){
|
||||
if(O[1].length()>=8){
|
||||
Ora=O[1].substring(0, 8);
|
||||
if (rs.getString(cols[i].replace(" ", "_")) != null) {
|
||||
|
||||
String[] d = rs.getString(cols[i].replace(" ", "_")).split("-");
|
||||
if (d.length >= 3) {
|
||||
String Ora = "";
|
||||
|
||||
if (d[2].length() > 8) {
|
||||
String O[] = d[2].trim().split(" ");
|
||||
if (O.length > 1) {
|
||||
if (O[1].length() >= 8) {
|
||||
Ora = O[1].substring(0, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
row[i] = d[2].trim().substring(0, 2) + "/" + d[1] + "/" + d[0] + " " + Ora;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
rows[r] = row;
|
||||
r++;
|
||||
/*int id = rs.getInt("id");
|
||||
String name = rs.getString("name");
|
||||
int age = rs.getInt("age");
|
||||
String address = rs.getString("address");
|
||||
float salary = rs.getFloat("salary");*/
|
||||
|
||||
}
|
||||
rs.close();
|
||||
@ -536,7 +456,8 @@ public class FrmStorno extends javax.swing.JFrame {
|
||||
return rows;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
@ -574,7 +495,7 @@ public class FrmStorno extends javax.swing.JFrame {
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new FrmStorno(null,0L,0L,null,false).setVisible(true);
|
||||
new FrmStorno(null, 0L, 0L, null, false).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="0"/>
|
||||
<Property name="title" type="java.lang.String" value="Prova di titolo"/>
|
||||
@ -880,7 +880,7 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlLista">
|
||||
<Container class="javax.swing.JPanel" name="pnlListaProdotti">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="cc" green="ff" red="cc" type="rgb"/>
|
||||
@ -899,7 +899,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="scpLista">
|
||||
<Container class="javax.swing.JScrollPane" name="scpListaProdotti">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="14" style="0"/>
|
||||
@ -911,12 +911,18 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="tblLista">
|
||||
<Component class="javax.swing.JTable" name="tblListaProdotti">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="0" rowCount="4"/>
|
||||
</Property>
|
||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||
<TableColumnModel selectionModel="0"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="jtbl" noResource="true"/>
|
||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
@ -947,7 +953,7 @@
|
||||
<Property name="verticalGap" type="int" value="2"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlLista1">
|
||||
<Container class="javax.swing.JPanel" name="pnlListaComposizioni">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="cc" green="ff" red="cc" type="rgb"/>
|
||||
@ -969,7 +975,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="scpLista1">
|
||||
<Container class="javax.swing.JScrollPane" name="scpListaComposizioni">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="14" style="0"/>
|
||||
@ -981,7 +987,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="tblLista1">
|
||||
<Component class="javax.swing.JTable" name="tblListaComposizioni">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="0" rowCount="4"/>
|
||||
|
@ -90,7 +90,10 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private int colIDProdotto = 3;
|
||||
private int colImporto2 = 4;
|
||||
private int colCategoria = 5;
|
||||
private int colIdPrenDettaglio = 6;
|
||||
private int colIdPrenotazione = 3;
|
||||
public Long idPuntoCassa = 0L;
|
||||
//public Long idPrenDettaglio = 0L;
|
||||
private Boolean consentiCredito = false;
|
||||
private Long idProfiloTariffario = 0L;
|
||||
private Long idProfiloTariffarioDefault = 0L;
|
||||
@ -141,6 +144,8 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private static Boolean bottoneImposta = true;
|
||||
private static Boolean asporto = false;
|
||||
private static Boolean flagPrecaricaLista = false;
|
||||
private static Boolean flagPrenotazionePagata = false;
|
||||
private static final Object[] siNoOptions = {"Si", "No"};
|
||||
|
||||
//delta per la grafica (in px)
|
||||
private int deltaWidth = 14;
|
||||
@ -785,13 +790,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
jTBP2 = new javax.swing.JToggleButton();
|
||||
jTBP3 = new javax.swing.JToggleButton();
|
||||
jbtnEsci = new javax.swing.JButton();
|
||||
pnlLista = new javax.swing.JPanel();
|
||||
scpLista = new javax.swing.JScrollPane();
|
||||
tblLista = new javax.swing.JTable();
|
||||
pnlListaProdotti = new javax.swing.JPanel();
|
||||
scpListaProdotti = new javax.swing.JScrollPane();
|
||||
tblListaProdotti = new javax.swing.JTable();
|
||||
pnlProdotti = new javax.swing.JPanel();
|
||||
pnlLista1 = new javax.swing.JPanel();
|
||||
scpLista1 = new javax.swing.JScrollPane();
|
||||
tblLista1 = new javax.swing.JTable();
|
||||
pnlListaComposizioni = new javax.swing.JPanel();
|
||||
scpListaComposizioni = new javax.swing.JScrollPane();
|
||||
tblListaComposizioni = new javax.swing.JTable();
|
||||
pnlLogin = new javax.swing.JPanel();
|
||||
btnLogin = new javax.swing.JButton();
|
||||
txtUsername = new javax.swing.JTextField();
|
||||
@ -1314,13 +1319,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
pnlTop.add(pnlAzioni);
|
||||
pnlAzioni.setBounds(0, 153, 378, 73);
|
||||
|
||||
pnlLista.setBackground(new java.awt.Color(204, 255, 204));
|
||||
pnlLista.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
|
||||
pnlLista.setLayout(new javax.swing.BoxLayout(pnlLista, javax.swing.BoxLayout.LINE_AXIS));
|
||||
pnlListaProdotti.setBackground(new java.awt.Color(204, 255, 204));
|
||||
pnlListaProdotti.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
|
||||
pnlListaProdotti.setLayout(new javax.swing.BoxLayout(pnlListaProdotti, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
scpLista.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
scpListaProdotti.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
|
||||
tblLista.setModel(new javax.swing.table.DefaultTableModel(
|
||||
tblListaProdotti.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
{},
|
||||
{},
|
||||
@ -1331,13 +1336,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
}
|
||||
));
|
||||
tblLista.setName("jtbl"); // NOI18N
|
||||
scpLista.setViewportView(tblLista);
|
||||
tblListaProdotti.setName("jtbl"); // NOI18N
|
||||
scpListaProdotti.setViewportView(tblListaProdotti);
|
||||
|
||||
pnlLista.add(scpLista);
|
||||
pnlListaProdotti.add(scpListaProdotti);
|
||||
|
||||
pnlTop.add(pnlLista);
|
||||
pnlLista.setBounds(288, 0, 140, 144);
|
||||
pnlTop.add(pnlListaProdotti);
|
||||
pnlListaProdotti.setBounds(288, 0, 140, 144);
|
||||
|
||||
pnlProdotti.setBackground(new java.awt.Color(204, 255, 204));
|
||||
pnlProdotti.setBorder(javax.swing.BorderFactory.createTitledBorder("Prodotto"));
|
||||
@ -1345,13 +1350,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
pnlTop.add(pnlProdotti);
|
||||
pnlProdotti.setBounds(0, 0, 8, 33);
|
||||
|
||||
pnlLista1.setBackground(new java.awt.Color(204, 255, 204));
|
||||
pnlLista1.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
|
||||
pnlLista1.setLayout(new javax.swing.BoxLayout(pnlLista1, javax.swing.BoxLayout.LINE_AXIS));
|
||||
pnlListaComposizioni.setBackground(new java.awt.Color(204, 255, 204));
|
||||
pnlListaComposizioni.setBorder(javax.swing.BorderFactory.createTitledBorder("Lista"));
|
||||
pnlListaComposizioni.setLayout(new javax.swing.BoxLayout(pnlListaComposizioni, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
scpLista1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
scpListaComposizioni.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
|
||||
tblLista1.setModel(new javax.swing.table.DefaultTableModel(
|
||||
tblListaComposizioni.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
{},
|
||||
{},
|
||||
@ -1362,14 +1367,14 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
}
|
||||
));
|
||||
tblLista1.setName("jtbl"); // NOI18N
|
||||
scpLista1.setViewportView(tblLista1);
|
||||
tblListaComposizioni.setName("jtbl"); // NOI18N
|
||||
scpListaComposizioni.setViewportView(tblListaComposizioni);
|
||||
|
||||
pnlLista1.add(scpLista1);
|
||||
pnlListaComposizioni.add(scpListaComposizioni);
|
||||
|
||||
pnlTop.add(pnlLista1);
|
||||
pnlLista1.setBounds(288, 0, 140, 144);
|
||||
pnlLista1.getAccessibleContext().setAccessibleName("Lista1");
|
||||
pnlTop.add(pnlListaComposizioni);
|
||||
pnlListaComposizioni.setBounds(288, 0, 140, 144);
|
||||
pnlListaComposizioni.getAccessibleContext().setAccessibleName("Lista1");
|
||||
|
||||
getContentPane().add(pnlTop);
|
||||
pnlTop.setBounds(0, 188, 0, 0);
|
||||
@ -1665,14 +1670,14 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
w = tw - x;
|
||||
//h = (int) (25 * th / 100);
|
||||
h = pnlProdotti.getHeight() / 6 * 2;
|
||||
pnlLista.setLocation(x, y);
|
||||
pnlLista.setSize(w, h);
|
||||
scpLista.setLocation(0, 0);
|
||||
scpLista.setSize(w, h);
|
||||
scpLista.setBackground(Color.BLUE);
|
||||
tblLista.setLocation(0, 0);
|
||||
tblLista.setSize(w, h);
|
||||
tblLista.setShowGrid(true);
|
||||
pnlListaProdotti.setLocation(x, y);
|
||||
pnlListaProdotti.setSize(w, h);
|
||||
scpListaProdotti.setLocation(0, 0);
|
||||
scpListaProdotti.setSize(w, h);
|
||||
scpListaProdotti.setBackground(Color.BLUE);
|
||||
tblListaProdotti.setLocation(0, 0);
|
||||
tblListaProdotti.setSize(w, h);
|
||||
tblListaProdotti.setShowGrid(true);
|
||||
|
||||
int Col1 = (w / 100) * 80;
|
||||
MyTableModel model = new MyTableModel();
|
||||
@ -1681,28 +1686,28 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
Object[][] data = null;
|
||||
model.setRow(data);
|
||||
|
||||
tblLista.setModel(model);
|
||||
tblLista.getColumnModel().getColumn(0).setPreferredWidth(Col1);
|
||||
tblLista.getColumnModel().getColumn(1).setPreferredWidth(50);
|
||||
tblLista.getColumnModel().getColumn(1).setCellRenderer(new DecimalFormatRenderer());
|
||||
tblListaProdotti.setModel(model);
|
||||
tblListaProdotti.getColumnModel().getColumn(0).setPreferredWidth(Col1);
|
||||
tblListaProdotti.getColumnModel().getColumn(1).setPreferredWidth(50);
|
||||
tblListaProdotti.getColumnModel().getColumn(1).setCellRenderer(new DecimalFormatRenderer());
|
||||
|
||||
tblLista.getColumnModel().getColumn(2).setPreferredWidth(50);
|
||||
tblLista.setVisible(true);
|
||||
tblListaProdotti.getColumnModel().getColumn(2).setPreferredWidth(50);
|
||||
tblListaProdotti.setVisible(true);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// ** Panel Lista1
|
||||
// -----------------------------------------------------------------------
|
||||
y = h;
|
||||
pnlLista1.setBorder(javax.swing.BorderFactory.createTitledBorder("Composizione"));
|
||||
pnlLista1.setLocation(x, y);
|
||||
pnlListaComposizioni.setBorder(javax.swing.BorderFactory.createTitledBorder("Composizione"));
|
||||
pnlListaComposizioni.setLocation(x, y);
|
||||
//pnlLista1.setSize(w, 70);
|
||||
pnlLista1.setSize(w, pnlProdotti.getHeight() / 6);
|
||||
scpLista1.setLocation(0, 0);
|
||||
scpLista1.setSize(w, h);
|
||||
scpLista1.setBackground(Color.BLUE);
|
||||
tblLista1.setLocation(0, 0);
|
||||
tblLista1.setSize(w, h);
|
||||
tblLista1.setShowGrid(true);
|
||||
pnlListaComposizioni.setSize(w, pnlProdotti.getHeight() / 6);
|
||||
scpListaComposizioni.setLocation(0, 0);
|
||||
scpListaComposizioni.setSize(w, h);
|
||||
scpListaComposizioni.setBackground(Color.BLUE);
|
||||
tblListaComposizioni.setLocation(0, 0);
|
||||
tblListaComposizioni.setSize(w, h);
|
||||
tblListaComposizioni.setShowGrid(true);
|
||||
|
||||
MyTableModel model1 = new MyTableModel();
|
||||
String[] colVassoio = {"Vassoio", "Prezzo"};
|
||||
@ -1710,11 +1715,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
Object[][] data1 = null;
|
||||
model1.setRow(data1);
|
||||
|
||||
tblLista1.setModel(model1);
|
||||
tblLista1.getColumnModel().getColumn(0).setPreferredWidth(Col1);
|
||||
tblLista1.getColumnModel().getColumn(1).setPreferredWidth(50);
|
||||
tblListaComposizioni.setModel(model1);
|
||||
tblListaComposizioni.getColumnModel().getColumn(0).setPreferredWidth(Col1);
|
||||
tblListaComposizioni.getColumnModel().getColumn(1).setPreferredWidth(50);
|
||||
|
||||
tblLista1.setVisible(true);
|
||||
tblListaComposizioni.setVisible(true);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// ** Panel Cliente
|
||||
@ -1733,9 +1738,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
// -----------------------------------------------------------------------
|
||||
// ** Panel Conto
|
||||
// -----------------------------------------------------------------------
|
||||
x = pnlLista.getX();//pnlAzioni.getWidth();
|
||||
y = pnlLista.getHeight() + pnlLista1.getHeight();
|
||||
w = pnlLista.getWidth();
|
||||
x = pnlListaProdotti.getX();//pnlAzioni.getWidth();
|
||||
y = pnlListaProdotti.getHeight() + pnlListaComposizioni.getHeight();
|
||||
w = pnlListaProdotti.getWidth();
|
||||
|
||||
h = 220;//th-y;
|
||||
pnlConto.setLocation(x, y);
|
||||
@ -1791,7 +1796,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
// ==========================================================================
|
||||
// *** Metodo per gestire gli eventi sui button dinamici
|
||||
// ==========================================================================
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String cmd = e.getActionCommand();
|
||||
String tipo;
|
||||
String id;
|
||||
@ -1811,7 +1816,19 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
pulsantiCategoria(id, cmd);
|
||||
|
||||
case "PRODOTTO" -> {
|
||||
if (isCassaAperta) {
|
||||
//boolean prenotazionePagata = false;
|
||||
String idPrenDettaglio = "null";
|
||||
|
||||
Object src = e.getSource();
|
||||
if (src instanceof EventParameters evtParams) {
|
||||
flagPrenotazionePagata = evtParams.flagPrenotazionePagata;
|
||||
idPrenDettaglio = evtParams.idPrenDettaglio;
|
||||
}
|
||||
//inserisci i prodotti se la cassa è aperta e
|
||||
//non c'è una prenotazione da gestire oppure
|
||||
//c'è una prenotazione e si stanno inserendo i prodotti in lista (idPrenDettaglio viene valorizzato in inserisciPrenotazioni())
|
||||
if (isCassaAperta &&
|
||||
(idPrenotazione == 0 || !idPrenDettaglio.equals("null"))) {
|
||||
sql = "SELECT "
|
||||
+ "prodotti.id as idProdotto,"
|
||||
+ "prodotti.nome, "
|
||||
@ -1824,6 +1841,8 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
+ "left join tariffe on prodotti.id=tariffe.id_prodotto "
|
||||
+ "where prodotti.id = " + id + " and Tariffe.id_fascia=" + idProfiloTariffario;
|
||||
try {
|
||||
|
||||
|
||||
|
||||
//spengo altri togglebutton
|
||||
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
|
||||
@ -1843,7 +1862,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
Connection dbConnection = DriverManager.getConnection(dbStringa, dbUsername, dbPassword);
|
||||
st = dbConnection.createStatement();
|
||||
rs = st.executeQuery(sql);
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
|
||||
while (rs.next()) {
|
||||
Double prezzo = 0.0;
|
||||
@ -1870,17 +1889,20 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}
|
||||
}
|
||||
//21-12-8<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
model.addRow(new Object[]{rs.getString("nome"), prezzo, punti, rs.getLong("idProdotto"), prezzo, rs.getLong("id_Categoria")});
|
||||
model.addRow(new Object[]{rs.getString("nome"), prezzo, punti, rs.getLong("idProdotto"), prezzo, rs.getLong("id_Categoria"), idPrenDettaglio});
|
||||
}
|
||||
if (model.getRowCount() > 0) {
|
||||
tblLista.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
|
||||
tblListaProdotti.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
|
||||
}
|
||||
tblLista.setModel(model);
|
||||
tblListaProdotti.setModel(model);
|
||||
|
||||
controllaCompleti(model);
|
||||
if(idPrenotazione == 0)
|
||||
controllaCompleti(model, "null");
|
||||
else
|
||||
controllaCompleti(model, idPrenotazione.toString());
|
||||
controllaExtra(model);
|
||||
sommaColonne(model);
|
||||
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
|
||||
//inizio 21-12-18<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (jbtnChiudi.isEnabled()) {
|
||||
if (saldoAcquisti(0.0) == false
|
||||
@ -1908,6 +1930,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
else if(idPrenotazione > 0 && idPrenDettaglio.equals("null")){
|
||||
JOptionPane.showMessageDialog(this, "Non è possibile modificare prodotti e composizioni se è presente una prenotazione collegata alla tessera");
|
||||
}
|
||||
}
|
||||
|
||||
default -> {
|
||||
@ -1971,25 +1996,30 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
/**
|
||||
* funzione che calcola i prezzi dei prodotti e il totale in base alla
|
||||
* fascia dello studente oppure utilizza la fascia di default
|
||||
* fascia dello studente oppure utilizza la fascia di default.
|
||||
* Se flagPrenotazionePagata = true vuol dire che non va modificato il saldo
|
||||
* residuo della tessera perchè la somma delle colonne viene richiamata
|
||||
* a seguito della verifica di una prenotazione pagata
|
||||
*
|
||||
* @param model
|
||||
* @param flagPrenotazionePagata
|
||||
*/
|
||||
private void sommaColonne(MyTableModel model) {
|
||||
private void sommaColonne(MyTableModel model, boolean flagPrenotazionePagata) {
|
||||
Double t = model.somma(colImporto);
|
||||
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model2 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
if (model2.getRowCount() > 0) {
|
||||
t = t + model2.somma(1);
|
||||
}
|
||||
|
||||
DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00");
|
||||
txtTotaleCassa.setText("€ " + df2.format(t));
|
||||
if(!flagPrenotazionePagata)
|
||||
txtTotaleCassa.setText("€ " + df2.format(t));
|
||||
|
||||
int p = model.sommaInt(2);
|
||||
txtTotalePunti.setText("Punti " + p);
|
||||
|
||||
//if(idModoPagamento==0L){
|
||||
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare")) {
|
||||
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare") && !flagPrenotazionePagata) {
|
||||
Double saldoCarta = 0.0;
|
||||
if (lblSaldo.getText().trim().length() > 0) {
|
||||
String saldo = lblSaldo.getText().replace("€ ", "").trim().replace(".", "");
|
||||
@ -2031,12 +2061,12 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}
|
||||
|
||||
//02/09/2021
|
||||
private void controllaCompleti(MyTableModel model) {
|
||||
private void controllaCompleti(MyTableModel model, String idPrenotazione) {
|
||||
if (passaggiEsauritiNoComposizione == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
Boolean composizionePresente = false;
|
||||
@ -2053,15 +2083,15 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
if (gratuitaResidue > 0) {//Gratuita_ResidueProg
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3)});
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3), idPrenotazione});
|
||||
} else if (flagBonus == 1 && bonusResidui > 0) {
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3)});
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), 0.00, model.getValueAt(i, 3), idPrenotazione});
|
||||
} else {
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), model.getValueAt(i, 1), model.getValueAt(i, 3)});
|
||||
model1.addRow(new Object[]{model.getValueAt(i, 0), model.getValueAt(i, 1), model.getValueAt(i, 3), idPrenotazione});
|
||||
}
|
||||
|
||||
model.setValueAt(0.0, i, colImporto);
|
||||
@ -2092,11 +2122,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
if (gratuitaResidue > 0) {//Gratuita_ResidueProg
|
||||
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio});
|
||||
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio, idPrenotazione});
|
||||
} else if (flagBonus == 1 && bonusResidui > 0) {
|
||||
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio});
|
||||
model1.addRow(new Object[]{nomeVassoio, 0.00, idVassoio, idPrenotazione});
|
||||
} else {
|
||||
model1.addRow(new Object[]{nomeVassoio, prezzo, idVassoio});
|
||||
model1.addRow(new Object[]{nomeVassoio, prezzo, idVassoio, idPrenotazione});
|
||||
}
|
||||
|
||||
//azzero elemento appena inserito se fa parte di una composizione
|
||||
@ -2384,10 +2414,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
// ** Quando viene chiusa la form esce dall'applicazione
|
||||
// ==========================================================================
|
||||
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
|
||||
Object[] options = {"Si", "No"};
|
||||
|
||||
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi chiusura programma?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[1]);
|
||||
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
Utils.myInsert("UPDATE PARAMETRI set valore='NO' where chiave='FlagDownloadInCorso'", this);
|
||||
@ -2676,7 +2705,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
this);
|
||||
progressivoDifferito = Double.valueOf(progDI);
|
||||
aggiornaLabelInfo();
|
||||
|
||||
|
||||
if (cercaTestoModoPagamento().equalsIgnoreCase("A scalare") && jTxtTessera.getText().length() > 0) {
|
||||
verificaSaldo(jTxtTessera.getText());
|
||||
|
||||
@ -2746,17 +2775,17 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
private void jbtnSuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if (tblLista.getSelectedRow() > 0) {
|
||||
tblLista.setRowSelectionInterval(tblLista.getSelectedRow() - 1, tblLista.getSelectedRow() - 1);
|
||||
tblLista.scrollRectToVisible(new Rectangle(tblLista.getCellRect(tblLista.getSelectedRow(), 0, true)));
|
||||
if (tblListaProdotti.getSelectedRow() > 0) {
|
||||
tblListaProdotti.setRowSelectionInterval(tblListaProdotti.getSelectedRow() - 1, tblListaProdotti.getSelectedRow() - 1);
|
||||
tblListaProdotti.scrollRectToVisible(new Rectangle(tblListaProdotti.getCellRect(tblListaProdotti.getSelectedRow(), 0, true)));
|
||||
}
|
||||
}//GEN-LAST:event_jbtnSuActionPerformed
|
||||
|
||||
private void jbtnDuplicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnDuplicaActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if (tblLista.getSelectedRow() >= 0) {
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
Object row[] = model.getRow(tblLista.getSelectedRow());
|
||||
if (tblListaProdotti.getSelectedRow() >= 0) {
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
Object row[] = model.getRow(tblListaProdotti.getSelectedRow());
|
||||
Boolean isComposizione = false;
|
||||
if (Long.parseLong(row[5].toString()) == 0L) {
|
||||
isComposizione = true;
|
||||
@ -2767,21 +2796,21 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
} else {
|
||||
|
||||
model.addRow(row);
|
||||
tblLista.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
|
||||
tblLista.setModel(model);
|
||||
tblListaProdotti.setRowSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1);
|
||||
tblListaProdotti.setModel(model);
|
||||
|
||||
controllaCompleti(model);
|
||||
controllaCompleti(model, null);
|
||||
controllaExtra(model);
|
||||
sommaColonne(model);
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jbtnDuplicaActionPerformed
|
||||
|
||||
private void jbtnGiuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnGiuActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if (tblLista.getSelectedRow() < tblLista.getRowCount() - 1) {
|
||||
tblLista.setRowSelectionInterval(tblLista.getSelectedRow() + 1, tblLista.getSelectedRow() + 1);
|
||||
tblLista.scrollRectToVisible(new Rectangle(tblLista.getCellRect(tblLista.getSelectedRow(), 0, true)));
|
||||
if (tblListaProdotti.getSelectedRow() < tblListaProdotti.getRowCount() - 1) {
|
||||
tblListaProdotti.setRowSelectionInterval(tblListaProdotti.getSelectedRow() + 1, tblListaProdotti.getSelectedRow() + 1);
|
||||
tblListaProdotti.scrollRectToVisible(new Rectangle(tblListaProdotti.getCellRect(tblListaProdotti.getSelectedRow(), 0, true)));
|
||||
}
|
||||
}//GEN-LAST:event_jbtnGiuActionPerformed
|
||||
|
||||
@ -2799,51 +2828,55 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}//GEN-LAST:event_jbtnStampaActionPerformed
|
||||
private void cancellaComposizioni() {
|
||||
try {
|
||||
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
//clearTable(model1);
|
||||
model1.clearTable();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
private void jbtnEliminaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEliminaActionPerformed
|
||||
cancellaComposizioni();
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
Integer riga = tblLista.getSelectedRow();
|
||||
if (riga >= 0) {
|
||||
model.deleteRow(riga);
|
||||
//ripristino i prezzi
|
||||
for (Integer i = 0; i < model.getRowCount(); i++) {
|
||||
model.setValueAt(model.getValueAt(i, colImporto2), i, colImporto);
|
||||
}
|
||||
//doLayout();
|
||||
if (tblLista.getRowCount() > 0) {
|
||||
if (riga > 0) {
|
||||
tblLista.setRowSelectionInterval(riga - 1, riga - 1);
|
||||
} else {
|
||||
tblLista.setRowSelectionInterval(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
controllaCompleti(model);
|
||||
controllaExtra(model);
|
||||
sommaColonne(model);
|
||||
|
||||
//spengo altri togglebutton
|
||||
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
|
||||
JToggleButton bt = (JToggleButton) this.pnlProdotti.getComponent(y);
|
||||
bt.setSelected(false);
|
||||
}
|
||||
if (model.getRowCount() <= 0) {
|
||||
jbtnSu.setEnabled(false);
|
||||
jbtnGiu.setEnabled(false);
|
||||
jbtnElimina.setEnabled(false);
|
||||
jbtnAnnulla.setEnabled(false);
|
||||
jbtnDuplica.setEnabled(false);
|
||||
|
||||
}
|
||||
doLayout();
|
||||
if(idPrenotazione > 0){
|
||||
JOptionPane.showMessageDialog(this, "Non è possibile modificare prodotti e composizioni se è presente una prenotazione collegata alla tessera");
|
||||
}
|
||||
else {
|
||||
cancellaComposizioni();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
Integer riga = tblListaProdotti.getSelectedRow();
|
||||
if (riga >= 0) {
|
||||
model.deleteRow(riga);
|
||||
//ripristino i prezzi
|
||||
for (Integer i = 0; i < model.getRowCount(); i++) {
|
||||
model.setValueAt(model.getValueAt(i, colImporto2), i, colImporto);
|
||||
}
|
||||
//doLayout();
|
||||
if (tblListaProdotti.getRowCount() > 0) {
|
||||
if (riga > 0) {
|
||||
tblListaProdotti.setRowSelectionInterval(riga - 1, riga - 1);
|
||||
} else {
|
||||
tblListaProdotti.setRowSelectionInterval(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
controllaCompleti(model, null);
|
||||
controllaExtra(model);
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
|
||||
//spengo altri togglebutton
|
||||
for (Integer y = 0; y < this.pnlProdotti.getComponentCount(); y++) {
|
||||
JToggleButton bt = (JToggleButton) this.pnlProdotti.getComponent(y);
|
||||
bt.setSelected(false);
|
||||
}
|
||||
if (model.getRowCount() <= 0) {
|
||||
jbtnSu.setEnabled(false);
|
||||
jbtnGiu.setEnabled(false);
|
||||
jbtnElimina.setEnabled(false);
|
||||
jbtnAnnulla.setEnabled(false);
|
||||
jbtnDuplica.setEnabled(false);
|
||||
|
||||
}
|
||||
doLayout();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jbtnEliminaActionPerformed
|
||||
|
||||
private void jbtnChiudiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnChiudiActionPerformed
|
||||
@ -2856,7 +2889,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private boolean verificaPrenotazioni() {
|
||||
boolean ok = true;
|
||||
if (idTessera > 0L && idPrenotazione > 0L) {
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
StringBuilder elencoIdProdotti = new StringBuilder();
|
||||
for (int i = model.getRowCount() - 1; i >= 0; i--) {
|
||||
Long idCateg = Long.valueOf(model.getValueAt(i, colCategoria).toString());
|
||||
@ -2940,9 +2973,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
|
||||
private void jbtnEsciActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEsciActionPerformed
|
||||
Object[] options = {"Si", "No"};
|
||||
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi chiusura sessione?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
pnlErrore.setVisible(false);
|
||||
pnlLogin.setVisible(true);
|
||||
@ -3033,10 +3066,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private void aggiornaDB(Boolean messaggio) {
|
||||
try {
|
||||
Boolean aggiorna = false;
|
||||
if (messaggio) {
|
||||
Object[] options = {"Si", "No"};
|
||||
if (messaggio) {
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Confermi aggiornamento del database locale?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) != 0) {
|
||||
return;
|
||||
} else {
|
||||
@ -3133,23 +3165,36 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}//GEN-LAST:event_btnImpostaClienteActionPerformed
|
||||
|
||||
private void jbtnAnnullaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAnnullaActionPerformed
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
if (model.getRowCount() > 0) {
|
||||
Object[] options = {"Si", "No"};
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Desideri annullare tutte le righe?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if(idPrenotazione > 0)
|
||||
{
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Desideri bypassare la prenotazione?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
annulla();
|
||||
doLayout();
|
||||
idPrenotazione = 0L;
|
||||
flagPrenotazionePagata = false;
|
||||
}
|
||||
//JOptionPane.showMessageDialog(this, "Non è possibile modificare prodotti e composizioni se è presente una prenotazione collegata alla tessera");
|
||||
}
|
||||
else
|
||||
{
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
if (model.getRowCount() > 0) {
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Desideri annullare tutte le righe?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
annulla();
|
||||
doLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jbtnAnnullaActionPerformed
|
||||
private void annulla() {
|
||||
try {
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
|
||||
//clearTable(model);
|
||||
//clearTable(model1);
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
|
||||
model.clearTable();
|
||||
model1.clearTable();
|
||||
jbtnSu.setEnabled(false);
|
||||
@ -3157,7 +3202,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
jbtnElimina.setEnabled(false);
|
||||
jbtnAnnulla.setEnabled(false);
|
||||
jbtnDuplica.setEnabled(false);
|
||||
sommaColonne(model);
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
|
||||
if (idTessera == 0L) {
|
||||
jbtnChiudi.setEnabled(false);
|
||||
@ -3340,8 +3385,8 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
jTBP3.setEnabled(true);
|
||||
selezionaTipoPagamento(0);
|
||||
|
||||
MyTableModel modelX = (MyTableModel) tblLista.getModel();
|
||||
sommaColonne(modelX);
|
||||
MyTableModel modelX = (MyTableModel) tblListaProdotti.getModel();
|
||||
sommaColonne(modelX, flagPrenotazionePagata);
|
||||
|
||||
} catch (Exception ex) {
|
||||
LogManager.getLogger(PuntoCassa.class).error(ex);
|
||||
@ -3437,15 +3482,23 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00");
|
||||
lblSaldo.setText("€ " + df2.format(saldo));
|
||||
|
||||
//24-01-2020--------------------------
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
Double t = model.somma(colImporto);
|
||||
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
|
||||
if (model2.getRowCount() > 0) {
|
||||
t = t + model2.somma(1);
|
||||
//l'aggiornamento del residuo va fatto solo se non c'è una prenotazione in corso
|
||||
//oppure se la prenotazione in corso non risulta pagata, altrimenti il residuo
|
||||
//resta pari al saldo della tessera
|
||||
if(idPrenotazione == 0 || !flagPrenotazionePagata){
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
Double t = model.somma(colImporto);
|
||||
MyTableModel model2 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
if (model2.getRowCount() > 0) {
|
||||
t = t + model2.somma(1);
|
||||
}
|
||||
//---------------------------
|
||||
lblResiduo.setText("€ " + df2.format(saldo - t));
|
||||
}
|
||||
//---------------------------
|
||||
lblResiduo.setText("€ " + df2.format(saldo - t));
|
||||
else {
|
||||
lblResiduo.setText("€ " + df2.format(saldo));
|
||||
}
|
||||
|
||||
lblPunti.setText(punti);
|
||||
String tipo = cercaTestoModoPagamento();
|
||||
lblTipoPagamento.setText(tipo);
|
||||
@ -3571,10 +3624,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void chiudi() {
|
||||
|
||||
//04-02-2019---------------------------------------------
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
if (model.getRowCount() > 0) {
|
||||
String numTessera = jTxtTessera.getText();
|
||||
|
||||
@ -3660,7 +3714,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
//09-05-2019
|
||||
String composizione = Utils.spaziBianchi("", 20, false);
|
||||
MyTableModel model2 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model2 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
for (int i = 0; i < model2.getRowCount(); i++) {
|
||||
String completo = model2.getValueAt(i, 0).toString();
|
||||
String pasto = "";
|
||||
@ -3705,13 +3759,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
String vassoio = "1";
|
||||
Utils.myInsert("Insert into Acquisti "
|
||||
+ "(id,id_Tessera,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,"
|
||||
+ "Num_Progressivo,id_Tipo_Pagamento,flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera)"
|
||||
+ "Num_Progressivo,id_Tipo_Pagamento,flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera, id_pren_dettaglio)"
|
||||
+ "values(-1," + tessera + "," + model.getValueAt(i, colIDProdotto) + ","
|
||||
//+ idPuntoCassa + "," + formattaDataOra(adesso) + ","
|
||||
+ idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
|
||||
+ model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti) + ","
|
||||
+ progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + ","
|
||||
+ flagAsporto + "," + flagPassaggioTessera + ")",
|
||||
+ flagAsporto + "," + flagPassaggioTessera + "," + model.getValueAt(i, colIdPrenDettaglio) + ")",
|
||||
this);
|
||||
|
||||
aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
|
||||
@ -3733,19 +3787,21 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
Utils.myInsert("Insert into Acquisti "
|
||||
+ "(id,id_Tessera,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
|
||||
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera)"
|
||||
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera, id_pren_dettaglio)"
|
||||
+ "values(-1," + tessera + "," + model2.getValueAt(i, 2) + "," + idPuntoCassa + ","
|
||||
+ //formattaDataOra(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + "," +
|
||||
formatLocalDateTime(adesso) + "," + model2.getValueAt(i, 1) + ",0," + progressivo + ","
|
||||
formatLocalDateTime(adesso) + ","
|
||||
+ model2.getValueAt(i, 1)
|
||||
+ ",0," + progressivo + ","
|
||||
+ idModoPagamento + "," + idTurno + "," + flagGratuita + "," + flagBonus + ","
|
||||
+ flagAsporto + "," + flagPassaggioTessera + ")",
|
||||
+ flagAsporto + "," + flagPassaggioTessera + "," + model2.getValueAt(i, colIdPrenotazione) + ")",
|
||||
this);
|
||||
aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
|
||||
model2.deleteRow(i);
|
||||
spiaProgressivo = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
} /*else {
|
||||
StringBuilder elencoIdProdotti = new StringBuilder();
|
||||
for (int i = model.getRowCount() - 1; i >= 0; i--) {
|
||||
Long idCateg = Long.valueOf(model.getValueAt(i, colCategoria).toString());
|
||||
@ -3753,12 +3809,12 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
//04/03/2022 non e possibile acquistare prodotti che non siano partedi una composizione
|
||||
String vassoio = "1";
|
||||
Utils.myInsert("Insert into Acquisti (id,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
|
||||
+ "flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera)values(-1,"
|
||||
+ "flag_in_vassoio,id_Turno,flag_asporto,flag_passaggio_tessera, id_pren_dettaglio)values(-1,"
|
||||
//+ model.getValueAt(i, colIDProdotto) + "," + idPuntoCassa + "," + formattaDataOra(adesso) + ","
|
||||
+ model.getValueAt(i, colIDProdotto) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
|
||||
+ model.getValueAt(i, colImporto) + "," + model.getValueAt(i, colPunti)
|
||||
+ "," + progressivo + "," + idModoPagamento + "," + vassoio + "," + idTurno + ","
|
||||
+ flagAsporto + "," + flagPassaggioTessera + ")",
|
||||
+ flagAsporto + "," + flagPassaggioTessera + "," + "null" + ")",
|
||||
this);
|
||||
|
||||
aggiornaProgressivoPagamentiTurno(Double.valueOf(model.getValueAt(i, colImporto).toString()));
|
||||
@ -3781,11 +3837,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
}
|
||||
|
||||
Utils.myInsert("Insert into Acquisti (id,id_Prodotto,id_Punto_Cassa,Data,Importo,Punti,Num_Progressivo,id_Tipo_Pagamento,"
|
||||
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera)values(-1,"
|
||||
+ "id_Turno,flag_gratuita,flag_bonus,flag_asporto,flag_passaggio_tessera, id_pren_dettaglio)values(-1,"
|
||||
//+ model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formattaDataOra(adesso) + ","
|
||||
+ model2.getValueAt(i, 2) + "," + idPuntoCassa + "," + formatLocalDateTime(adesso) + ","
|
||||
+ model2.getValueAt(i, 1) + ",0," + progressivo + "," + idModoPagamento + "," + idTurno
|
||||
+ "," + flagGratuita + "," + flagBonusPerInsert + "," + flagAsporto + "," + flagPassaggioTessera + ")",
|
||||
+ "," + flagGratuita + "," + flagBonusPerInsert + "," + flagAsporto + "," + flagPassaggioTessera + "," + "null" + ")",
|
||||
this);
|
||||
aggiornaProgressivoPagamentiTurno(Double.valueOf(model2.getValueAt(i, 1).toString()));
|
||||
model2.deleteRow(i);
|
||||
@ -3793,7 +3849,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
//aggiorno progressivi-------------
|
||||
if (spiaProgressivo) {
|
||||
@ -3845,6 +3901,13 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se i prodotti selezionati differiscono da quelli presenti
|
||||
* nella prenotazione collegata alla tessera. L'utente può scegliere di
|
||||
* modificare i prodotti, oppure di azzerare la lista
|
||||
* @param elencoIdProdotto
|
||||
* @return
|
||||
*/
|
||||
private boolean controllaDiscrepanzePrenotazioni(String elencoIdProdotto) {
|
||||
boolean ok = true;
|
||||
if (elencoIdProdotto.length() > 0) {
|
||||
@ -3871,15 +3934,15 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Object[] options = {"Si", "No"};
|
||||
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this,
|
||||
"I prodotti selezionati sono diversi dai prenotati!\nVuoi proseguire?", "Prenotazione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, siNoOptions, null);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 1) {
|
||||
azzeraDopoStorno();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -3930,8 +3993,8 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
private void azzera() {
|
||||
try {
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
model.clearTable();
|
||||
model1.clearTable();
|
||||
} catch (Exception e) {
|
||||
@ -3939,6 +4002,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
messaggioSaldoUnaVolta = false;
|
||||
idTessera = 0L;
|
||||
idPrenotazione = 0L;
|
||||
flagPrenotazionePagata = false;
|
||||
idProfiloTariffario = 0L;
|
||||
setModoPagamento(modoPagamentoDefault);
|
||||
isCassaAperta = false;
|
||||
@ -4118,7 +4182,7 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
if (scadenzaTessera.after(now) && idStato != 2) {
|
||||
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
|
||||
String modoPagamento = cercaTestoModoPagamento();
|
||||
lblCategoria.setText(dati[0]);
|
||||
@ -4166,9 +4230,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
forzaPrezzi(model);
|
||||
}
|
||||
|
||||
controllaCompleti(model);
|
||||
controllaCompleti(model, null);
|
||||
controllaExtra(model);
|
||||
sommaColonne(model);
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
|
||||
stoCalcolando = true;
|
||||
//comprende la verifica del saldo
|
||||
@ -4233,10 +4297,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
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", this);
|
||||
//fine----
|
||||
if (flagEsegueStorni && numeroPassaggi > 0) {
|
||||
Object[] options = {"Si", "No"};
|
||||
if (flagEsegueStorni && numeroPassaggi > 0) {
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!\nSi desidera effettuare uno storno per un pasto erroneamente addebitato?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[1]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
apriStorno(true);
|
||||
} else {
|
||||
@ -4256,10 +4319,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
// controllo abilitazione tessera
|
||||
String controlloPunto = "Select controlla_abilitazione('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
|
||||
Long abilitato = Utils.mySelectInteger(controlloPunto, "T", this);
|
||||
if (abilitato == 0) {
|
||||
Object[] options = {"Si", "No"};
|
||||
if (abilitato == 0) {
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, siNoOptions, siNoOptions[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
@ -4282,10 +4344,9 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
+ "order by id_prenotazione) "
|
||||
+ "where rownum = 1";
|
||||
String idP = Utils.mySelect(query, "nr", this);
|
||||
if (idP.length() > 0) {
|
||||
Long rowCount = Long.valueOf(idP);
|
||||
idPrenotazione = rowCount;
|
||||
if (rowCount > 0L) {
|
||||
if (idP.length() > 0) {
|
||||
idPrenotazione = Long.valueOf(idP);
|
||||
if (idPrenotazione > 0L) {
|
||||
query = "SELECT Distinct Nome FROM VIEW_PRENOTAZIONI_TURNO v join prodotti p on v.ID_PRODOTTO=p.ID "
|
||||
+ "WHERE id_Modalita in (2,3) "
|
||||
+ "and id_stato in (0,1) "
|
||||
@ -4322,11 +4383,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private void inserisciPrenotazioni() {
|
||||
try {
|
||||
|
||||
MyTableModel model = (MyTableModel) tblLista.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblLista1.getModel();
|
||||
MyTableModel model = (MyTableModel) tblListaProdotti.getModel();
|
||||
MyTableModel model1 = (MyTableModel) tblListaComposizioni.getModel();
|
||||
model.clearTable();
|
||||
model1.clearTable();
|
||||
sommaColonne(model);
|
||||
sommaColonne(model, flagPrenotazionePagata);
|
||||
|
||||
String query = "SELECT * FROM VIEW_PRENOTAZIONI_TURNO "
|
||||
+ "WHERE id_Modalita in (2,3) "
|
||||
@ -4340,9 +4401,17 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
ResultSet rs = st.executeQuery(query);
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
java.awt.event.ActionEvent evt;
|
||||
evt = new java.awt.event.ActionEvent(new Object(), 0, "PRODOTTO[" + rs.getString("ID_PRODOTTO") + "]");
|
||||
//l'ID nella VIEW_PRENOTAZIONI_TURNO corrisponde all'ID della tabella SIR.PRENOTAZIONI_PASTI_DETTAGLIO
|
||||
//idPrenDettaglio = Long.valueOf(rs.getString("ID"));
|
||||
|
||||
boolean flagPagato = Double.parseDouble(rs.getString("IMPORTO_PAGATO")) > 0.0;
|
||||
EventParameters evtParams = new EventParameters(rs.getString("ID_PRODOTTO"),
|
||||
null,
|
||||
flagPagato,
|
||||
rs.getString("ID"));
|
||||
|
||||
java.awt.event.ActionEvent evt;
|
||||
evt = new java.awt.event.ActionEvent(evtParams, 0, "PRODOTTO[" + rs.getString("ID_PRODOTTO") + "]");
|
||||
actionPerformed(evt);
|
||||
|
||||
}
|
||||
@ -5026,17 +5095,17 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
private javax.swing.JPanel pnlCliente;
|
||||
private javax.swing.JPanel pnlConto;
|
||||
private javax.swing.JPanel pnlErrore;
|
||||
private javax.swing.JPanel pnlLista;
|
||||
private javax.swing.JPanel pnlLista1;
|
||||
private javax.swing.JPanel pnlListaComposizioni;
|
||||
private javax.swing.JPanel pnlListaProdotti;
|
||||
private javax.swing.JPanel pnlLogin;
|
||||
private javax.swing.JPanel pnlProdotti;
|
||||
protected javax.swing.JPanel pnlTop;
|
||||
private javax.swing.JScrollPane scpLista;
|
||||
private javax.swing.JScrollPane scpLista1;
|
||||
private javax.swing.JScrollPane scpListaComposizioni;
|
||||
private javax.swing.JScrollPane scpListaProdotti;
|
||||
private javax.swing.JPanel subPnlCliente;
|
||||
private javax.swing.JPanel subPnlTessera;
|
||||
private javax.swing.JTable tblLista;
|
||||
private javax.swing.JTable tblLista1;
|
||||
private javax.swing.JTable tblListaComposizioni;
|
||||
private javax.swing.JTable tblListaProdotti;
|
||||
private javax.swing.JPasswordField txtPassword;
|
||||
private javax.swing.JTextField txtTotaleCassa;
|
||||
private javax.swing.JTextField txtTotalePunti;
|
||||
|
Loading…
Reference in New Issue
Block a user