risoluzione bug controllo saldo
se una tessera ha una prenotazione, viene controllato il saldo prima del caricamento completo della tessera (e del saldo), per cui risulta sempre negativo e viene mostrato il messaggio di errore "saldo insufficiente. Spostato il metodo pulsantiModoPagamento() per permettere il caricamento del saldo prima del controllo dello stesso. pulizia codice
This commit is contained in:
parent
45209fa973
commit
00faae60ab
@ -4075,60 +4075,23 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
logTessera();
|
||||
|
||||
try {
|
||||
// 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"};
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) != 0) {
|
||||
return;
|
||||
} else {
|
||||
Utils.myInsert("Insert into Forzature (id,id_account,id_Punto_Cassa,id_Tessera,id_Tipo_Forzatura) values (-1,"
|
||||
+ idAccount + "," + idPuntoCassa + "," + idTessera + ",1)",
|
||||
this);
|
||||
if (!controlloAbilitazioneTessera(numeroTessera))
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//controllo passaggi
|
||||
String controlloPassaggi = "Select controlla_passaggi('" + numeroTessera + "'," + idPuntoCassa + ") as T from dual";
|
||||
Long abilitatoPassaggi = Utils.mySelectInteger(controlloPassaggi, "T", this);
|
||||
|
||||
if (abilitatoPassaggi == 0L) {
|
||||
//05/09/2022
|
||||
String queryPassaggi = "select count(*) as NRec from st_acquisti a inner join prodotti p on a.id_prodotto=p.id inner join Tipi_Pagamenti tp on a.id_tipo_pagamento=tp.id where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa;
|
||||
Long numeroPassaggi = Utils.mySelectInteger(queryPassaggi, "NRec", this);
|
||||
//fine----
|
||||
if (flagEsegueStorni && numeroPassaggi > 0) {
|
||||
Object[] options = {"Si", "No"};
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!\nSi desidera effettuare uno storno per un pasto erroneamente addebitato?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
apriStorno(true);
|
||||
} else {
|
||||
azzeraDopoStorno();
|
||||
return;
|
||||
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!");
|
||||
azzeraDopoStorno();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!controlloPassaggi(abilitatoPassaggi, numeroTessera))
|
||||
return;
|
||||
|
||||
//aggiungo un giorno altrimenti in caso di scadenza nello stesso giorno
|
||||
//considera le ore
|
||||
Date scadenza = formatter.parse(dati[9]);
|
||||
Date scadenzaTessera = formatter.parse(dati[9]);
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(scadenza);
|
||||
c.setTime(scadenzaTessera);
|
||||
c.add(Calendar.DATE, 1);
|
||||
scadenza = c.getTime();
|
||||
scadenzaTessera = c.getTime();
|
||||
|
||||
if (scadenza.after(now) && idStato != 2) {
|
||||
if (scadenzaTessera.after(now) && idStato != 2) {
|
||||
|
||||
String modoPagamento = cercaTestoModoPagamento();
|
||||
lblCategoria.setText(dati[0]);
|
||||
@ -4172,25 +4135,19 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
lblScadTessera.setText("" + bonusResidui);
|
||||
|
||||
if (modoPagamento.equalsIgnoreCase("A scalare")) {
|
||||
//modifica 09-11-18
|
||||
if (calcolaTotale() >= 0.00 && flagPrecaricaLista == false) {
|
||||
//verificaSaldo(numeroTessera);
|
||||
}
|
||||
//fine modifica
|
||||
|
||||
} else {
|
||||
//MyApplication myApplication = new MyApplication();
|
||||
//String punti = myApplication.mySelect(this, "Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti");
|
||||
stoCalcolando = true;
|
||||
pulsantiModoPagamento();
|
||||
stoCalcolando = false;
|
||||
|
||||
if (!modoPagamento.equalsIgnoreCase("A scalare")) {
|
||||
String punti = Utils.mySelect("Select Punti from Tessere where numero='" + numeroTessera + "'", "Punti",
|
||||
this);
|
||||
lblPunti.setText(punti);
|
||||
String tipo = cercaTestoModoPagamento();
|
||||
lblTipoPagamento.setText(tipo);
|
||||
|
||||
}
|
||||
|
||||
//statoTesseraLetta(gratuitaResidue, bonusResidui);
|
||||
|
||||
//28-09-2016 quando c'è una sola categoria faccio click
|
||||
if (numeroCategorie == 1) {
|
||||
@ -4213,21 +4170,11 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
controllaCompleti(model);
|
||||
controllaExtra(model);
|
||||
sommaColonne(model);
|
||||
//modifica 09-11-18
|
||||
if (modoPagamento.equalsIgnoreCase("A scalare")) {
|
||||
if (calcolaTotale() >= 0.00 && flagPrecaricaLista) {
|
||||
//verificaSaldo(numeroTessera);
|
||||
}
|
||||
}
|
||||
//fine modifica
|
||||
//05-06-2020
|
||||
|
||||
if (abilitatoPassaggi != 0L) {
|
||||
controllaPrenotazioni();
|
||||
}
|
||||
|
||||
stoCalcolando = true;
|
||||
pulsantiModoPagamento();
|
||||
stoCalcolando = false;
|
||||
this.caricaPannello();
|
||||
abilitaPulsanti(pnlCategorie, true, true);
|
||||
|
||||
@ -4252,6 +4199,51 @@ public class PuntoCassa extends JFrame implements ActionListener {
|
||||
|
||||
}
|
||||
|
||||
private boolean controlloPassaggi(Long abilitatoPassaggi, String numeroTessera) throws HeadlessException, NumberFormatException {
|
||||
|
||||
if (abilitatoPassaggi == 0L) {
|
||||
//05/09/2022
|
||||
String queryPassaggi = "select count(*) as NRec from st_acquisti a inner join prodotti p on a.id_prodotto=p.id inner join Tipi_Pagamenti tp on a.id_tipo_pagamento=tp.id where TRUNC(data) = TRUNC(SYSDATE) and id_tessera=" + idTessera + " and flag_in_vassoio=0 and id_punto_cassa=" + idPuntoCassa;
|
||||
Long numeroPassaggi = Utils.mySelectInteger(queryPassaggi, "NRec", this);
|
||||
//fine----
|
||||
if (flagEsegueStorni && numeroPassaggi > 0) {
|
||||
Object[] options = {"Si", "No"};
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!\nSi desidera effettuare uno storno per un pasto erroneamente addebitato?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);
|
||||
if (Integer.parseInt(selectedValue.toString()) == 0) {
|
||||
apriStorno(true);
|
||||
} else {
|
||||
azzeraDopoStorno();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(this, "N° passaggi giornalieri esauriti. Non è possibile usufruire del pasto!");
|
||||
azzeraDopoStorno();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean controlloAbilitazioneTessera(String numeroTessera) throws NumberFormatException, HeadlessException {
|
||||
// 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"};
|
||||
Object selectedValue = JOptionPane.showOptionDialog(this, "Tessera non abilitata per questo punto di distribuzione!\nConsenti passaggio?", "Attenzione",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if (Integer.parseInt(selectedValue.toString()) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
Utils.myInsert("Insert into Forzature (id,id_account,id_Punto_Cassa,id_Tessera,id_Tipo_Forzatura) values (-1,"
|
||||
+ idAccount + "," + idPuntoCassa + "," + idTessera + ",1)",
|
||||
this);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void controllaPrenotazioni() {
|
||||
try {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user