alsmanager_lib 3.0.24 → 3.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/modules.js +342 -6
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -6648,7 +6648,7 @@ function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
|
6648
6648
|
}
|
|
6649
6649
|
|
|
6650
6650
|
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
6651
|
-
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
6651
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
|
|
6652
6652
|
query += " where (removed is null or removed = 0) ";
|
|
6653
6653
|
if (data_da || data_a) {
|
|
6654
6654
|
query += " and ";
|
|
@@ -6680,7 +6680,7 @@ function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
|
6680
6680
|
}
|
|
6681
6681
|
|
|
6682
6682
|
function queryConsegneMySQL(data_da, data_a, data_filter) {
|
|
6683
|
-
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
6683
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
|
|
6684
6684
|
query += " where (removed is null or removed = 0) ";
|
|
6685
6685
|
if (data_da || data_a) {
|
|
6686
6686
|
query += " and ";
|
|
@@ -6760,6 +6760,8 @@ function queryConsegnaById(db_used,id_consegna) {
|
|
|
6760
6760
|
return query;
|
|
6761
6761
|
}
|
|
6762
6762
|
|
|
6763
|
+
|
|
6764
|
+
// Beni in consegna
|
|
6763
6765
|
function queryConsegneByIdDeviceSQLite(id_device) {
|
|
6764
6766
|
var query = "select c.data_consegna as Consegna, ";
|
|
6765
6767
|
query += "case ";
|
|
@@ -6810,6 +6812,59 @@ function queryConsegneByIdDevice(db_used, id_device) {
|
|
|
6810
6812
|
return query;
|
|
6811
6813
|
}
|
|
6812
6814
|
|
|
6815
|
+
//
|
|
6816
|
+
function queryConsegneByIdBeneSQLite(id_bene, tipo_bene) {
|
|
6817
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
6818
|
+
query += "case ";
|
|
6819
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
6820
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
6821
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
6822
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
6823
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
6824
|
+
query += "else '' ";
|
|
6825
|
+
query += "end as Stato, ";
|
|
6826
|
+
query += "c.note as Note from consegna beni ";
|
|
6827
|
+
query += "inner join consegne c on c.id = dc.id_consegna ";
|
|
6828
|
+
query += "where cb.id_bene = " + id_bene + " ";
|
|
6829
|
+
query += "and cb.tipo_bene = '" + tipo_bene + "' ";
|
|
6830
|
+
return query;
|
|
6831
|
+
}
|
|
6832
|
+
|
|
6833
|
+
function queryConsegneByIdBeneMySQL(id_bene, tipo_bene) {
|
|
6834
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
6835
|
+
query += "case ";
|
|
6836
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
6837
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
6838
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
6839
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
6840
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
6841
|
+
query += "else '' ";
|
|
6842
|
+
query += "end as Stato, ";
|
|
6843
|
+
query += "c.note as Note from consegna_beni cb ";
|
|
6844
|
+
query += "inner join consegne c on c.id = cb.id_consegna ";
|
|
6845
|
+
query += "where cb.id_bene = :id_bene and cb.tipo_bene = :tipo_bene";
|
|
6846
|
+
return query;
|
|
6847
|
+
}
|
|
6848
|
+
|
|
6849
|
+
function queryConsegneByIdBene(db_used, id_bene, tipo_bene) {
|
|
6850
|
+
var query = "";
|
|
6851
|
+
if (db_used) {
|
|
6852
|
+
switch (db_used) {
|
|
6853
|
+
case 'SQLITE':
|
|
6854
|
+
query = queryConsegneByIdBeneSQLite(id_bene, tipo_bene);
|
|
6855
|
+
break;
|
|
6856
|
+
case 'MYSQL':
|
|
6857
|
+
query = queryConsegneByIdBeneMySQL(id_bene, tipo_bene);
|
|
6858
|
+
break;
|
|
6859
|
+
case 'MYSQL2':
|
|
6860
|
+
query = queryConsegneByIdBeneSQLite(id_bene, tipo_bene);
|
|
6861
|
+
break;
|
|
6862
|
+
}
|
|
6863
|
+
}
|
|
6864
|
+
return query;
|
|
6865
|
+
}
|
|
6866
|
+
|
|
6867
|
+
|
|
6813
6868
|
|
|
6814
6869
|
function queryDeviceStatusCombo() {
|
|
6815
6870
|
var query = "SELECT id, name from status_description order by id";
|
|
@@ -7161,6 +7216,8 @@ function createConsegnaObj(consegna) {
|
|
|
7161
7216
|
consegnaObj.alunno = "";
|
|
7162
7217
|
consegnaObj.genitore = "";
|
|
7163
7218
|
consegnaObj.note = "";
|
|
7219
|
+
consegnaObj.email_adulto = "";
|
|
7220
|
+
consegnaObj.email_genitore = "";
|
|
7164
7221
|
consegnaObj.is_home = 0;
|
|
7165
7222
|
consegnaObj.stato_res = 0;
|
|
7166
7223
|
consegnaObj.data_ric_str = "";
|
|
@@ -7207,6 +7264,10 @@ function createConsegnaObj(consegna) {
|
|
|
7207
7264
|
consegnaObj.is_home = consegna.is_home;
|
|
7208
7265
|
if (consegna.note)
|
|
7209
7266
|
consegnaObj.note = consegna.note;
|
|
7267
|
+
if (consegna.email_adulto)
|
|
7268
|
+
consegnaObj.email_adulto = consegna.email_adulto;
|
|
7269
|
+
if (consegna.email_genitore)
|
|
7270
|
+
consegnaObj.email_genitore = consegna.email_genitore;
|
|
7210
7271
|
}
|
|
7211
7272
|
return consegnaObj;
|
|
7212
7273
|
}
|
|
@@ -7219,6 +7280,8 @@ function createConsegnaMySQLObj(consegna) {
|
|
|
7219
7280
|
consegnaMySQLObj.genitore = consegnaObj.genitore;
|
|
7220
7281
|
consegnaMySQLObj.alunno = consegnaObj.alunno;
|
|
7221
7282
|
consegnaMySQLObj.note = consegnaObj.note;
|
|
7283
|
+
consegnaMySQLObj.email_adulto = consegnaObj.email_adulto;
|
|
7284
|
+
consegnaMySQLObj.email_genitore = consegnaObj.email_genitore;
|
|
7222
7285
|
consegnaMySQLObj.is_home = consegnaObj.is_home;
|
|
7223
7286
|
consegnaMySQLObj.stato_res = consegnaObj.stato_res;
|
|
7224
7287
|
consegnaMySQLObj.data_ric_str = consegnaObj.data_ric_str;
|
|
@@ -7236,7 +7299,7 @@ function insertConsegnaSQLite(consegna) {
|
|
|
7236
7299
|
var consegnaObj = createConsegnaObj(consegna);
|
|
7237
7300
|
if (consegnaObj) {
|
|
7238
7301
|
query = "insert into consegne ";
|
|
7239
|
-
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
7302
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
|
|
7240
7303
|
query += " values ('" + consegnaObj.data_ric_str + "',";
|
|
7241
7304
|
query += "'" + consegnaObj.data_cons_str + "',";
|
|
7242
7305
|
query += consegnaObj.stato_res + ",";
|
|
@@ -7247,7 +7310,9 @@ function insertConsegnaSQLite(consegna) {
|
|
|
7247
7310
|
query += "'" + consegnaObj.id_place + "',";
|
|
7248
7311
|
query += consegnaObj.id_site + ",";
|
|
7249
7312
|
query += consegnaObj.is_home + ",";
|
|
7250
|
-
query += "'" + consegnaObj.note + "'
|
|
7313
|
+
query += "'" + consegnaObj.note + "', ";
|
|
7314
|
+
query += "'" + consegnaObj.email_adulto + "', ";
|
|
7315
|
+
query += "'" + consegnaObj.email_genitore + "')";
|
|
7251
7316
|
}
|
|
7252
7317
|
return query;
|
|
7253
7318
|
}
|
|
@@ -7256,7 +7321,7 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
7256
7321
|
var query = "";
|
|
7257
7322
|
if (consegnaObj) {
|
|
7258
7323
|
query = "insert into consegne ";
|
|
7259
|
-
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
7324
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
|
|
7260
7325
|
query += " values (:data_ric_str,";
|
|
7261
7326
|
query += ":data_cons_str,";
|
|
7262
7327
|
query += ":stato_res,";
|
|
@@ -7267,7 +7332,9 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
7267
7332
|
query += ":id_place,";
|
|
7268
7333
|
query += ":id_site,";
|
|
7269
7334
|
query += ":is_home,";
|
|
7270
|
-
query += ":note
|
|
7335
|
+
query += ":note,";
|
|
7336
|
+
query += ":email_adulto,";
|
|
7337
|
+
query += ":email_genitore)";
|
|
7271
7338
|
}
|
|
7272
7339
|
return query;
|
|
7273
7340
|
}
|
|
@@ -7313,6 +7380,8 @@ function updateConsegnaSQLite(consegna) {
|
|
|
7313
7380
|
query += ", is_home = " + consegnaObj.is_home;
|
|
7314
7381
|
if (consegnaObj.note.trim() != '')
|
|
7315
7382
|
query += ", note = '" + consegnaObj.note + "'";
|
|
7383
|
+
query += ", email_adulto = '" + consegnaObj.email_adulto + "'";
|
|
7384
|
+
query += ", email_genitore = '" + consegnaObj.email_genitore + "'";
|
|
7316
7385
|
query += " where id = " + consegnaObj.id;
|
|
7317
7386
|
}
|
|
7318
7387
|
return query;
|
|
@@ -7341,6 +7410,8 @@ function updateConsegnaMySQL(consegna) {
|
|
|
7341
7410
|
query += ", is_home = :is_home ";
|
|
7342
7411
|
if (consegnaObj.note.trim() != '')
|
|
7343
7412
|
query += ", note = :note ";
|
|
7413
|
+
query += ", email_adulto = :email_adulto";
|
|
7414
|
+
query += ", email_genitore = :email_genitore";
|
|
7344
7415
|
query += " where id = :id ";
|
|
7345
7416
|
}
|
|
7346
7417
|
return query;
|
|
@@ -7521,6 +7592,266 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
|
|
|
7521
7592
|
}
|
|
7522
7593
|
return query;
|
|
7523
7594
|
}
|
|
7595
|
+
// Consegna beni
|
|
7596
|
+
function insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7597
|
+
var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
|
|
7598
|
+
query += "(" + id_consegna + ", ";
|
|
7599
|
+
query += id_bene + ", ";
|
|
7600
|
+
query += "'" + tipo_bene + "', ";
|
|
7601
|
+
query += "'" + data_consegna + "', ";
|
|
7602
|
+
query += numero + ", "
|
|
7603
|
+
query += "0, "
|
|
7604
|
+
query += "'" + note + "'";
|
|
7605
|
+
query += ")";
|
|
7606
|
+
return query;
|
|
7607
|
+
}
|
|
7608
|
+
|
|
7609
|
+
function insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7610
|
+
var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
|
|
7611
|
+
query += "(:id_consegna, ";
|
|
7612
|
+
query += ":id_bene, ";
|
|
7613
|
+
query += ":tipo_bene, ";
|
|
7614
|
+
query += ":data_consegna, ";
|
|
7615
|
+
query += ":numero, ";
|
|
7616
|
+
query += "0, ";
|
|
7617
|
+
query += ":note ";
|
|
7618
|
+
query += ")";
|
|
7619
|
+
return query;
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7622
|
+
function insertConsegnaBene(db_used, id_consegna, id_bene, tipo_bene, data_consegna, numero, note) {
|
|
7623
|
+
var query = "";
|
|
7624
|
+
if (db_used) {
|
|
7625
|
+
switch (db_used) {
|
|
7626
|
+
case 'SQLITE':
|
|
7627
|
+
query = insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7628
|
+
break;
|
|
7629
|
+
case 'MYSQL':
|
|
7630
|
+
query = insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7631
|
+
break;
|
|
7632
|
+
case 'MYSQL2':
|
|
7633
|
+
query = insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7634
|
+
break;
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
return query;
|
|
7638
|
+
}
|
|
7639
|
+
|
|
7640
|
+
function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7641
|
+
var query = "update consegna_beni set ";
|
|
7642
|
+
query += "id_consegna = " + id_consegna + ", ";
|
|
7643
|
+
query += "id_bene = " + id_bene + ", ";
|
|
7644
|
+
query += "tipo_bene = '" + tipo_bene + "', ";
|
|
7645
|
+
query += "data_consegna = '" + data_consegna + "', ";
|
|
7646
|
+
query += "numero = " + numero + ", ";
|
|
7647
|
+
query += "note = '" + note + "' ";
|
|
7648
|
+
query += "where id = " + id_benecons;
|
|
7649
|
+
return query;
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7652
|
+
function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
|
|
7653
|
+
var query = "update consegna_beni set ";
|
|
7654
|
+
query += "id_consegna = :id_consegna, ";
|
|
7655
|
+
query += "id_bene = :id_bene, ";
|
|
7656
|
+
query += "tipo_bene = :tipo_bene, ";
|
|
7657
|
+
query += "data_consegna = :data_consegna, ";
|
|
7658
|
+
query += "numero = :numero, ";
|
|
7659
|
+
query += "note = :note ";
|
|
7660
|
+
query += "where id = :id_benecons";
|
|
7661
|
+
return query;
|
|
7662
|
+
}
|
|
7663
|
+
|
|
7664
|
+
function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note) {
|
|
7665
|
+
var query = "";
|
|
7666
|
+
if (db_used) {
|
|
7667
|
+
switch (db_used) {
|
|
7668
|
+
case 'SQLITE':
|
|
7669
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7670
|
+
break;
|
|
7671
|
+
case 'MYSQL':
|
|
7672
|
+
query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7673
|
+
break;
|
|
7674
|
+
case 'MYSQL2':
|
|
7675
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, note);
|
|
7676
|
+
break;
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
return query;
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
function removeConsegnaBeneSQLite(id_benecons){
|
|
7683
|
+
var query = "DELETE from consegna_beni ";
|
|
7684
|
+
query += "where id = " + id_benecons;
|
|
7685
|
+
return query;
|
|
7686
|
+
}
|
|
7687
|
+
function removeConsegnaBeneMySQL(id_benecons){
|
|
7688
|
+
var query = "DELETE from consegna_beni ";
|
|
7689
|
+
query += "where id = :id_benecons";
|
|
7690
|
+
return query;
|
|
7691
|
+
}
|
|
7692
|
+
function removeConsegnaBene(db_used, id_benecons) {
|
|
7693
|
+
var query = "";
|
|
7694
|
+
if (db_used) {
|
|
7695
|
+
switch (db_used) {
|
|
7696
|
+
case 'SQLITE':
|
|
7697
|
+
query = removeConsegnaBeneSQLite(id_benecons);
|
|
7698
|
+
break;
|
|
7699
|
+
case 'MYSQL':
|
|
7700
|
+
query = removeConsegnaBeneMySQL(id_benecons);
|
|
7701
|
+
break;
|
|
7702
|
+
case 'MYSQL2':
|
|
7703
|
+
query = removeConsegnaBeneSQLite(id_benecons);
|
|
7704
|
+
break;
|
|
7705
|
+
}
|
|
7706
|
+
}
|
|
7707
|
+
return query;
|
|
7708
|
+
}
|
|
7709
|
+
function selectBeniPerConsegnaSQLite(id_consegna) {
|
|
7710
|
+
var query = "select cb.id_bene as id, cb.numero as Numero, cb.tipo_bene as Tipologia, ";
|
|
7711
|
+
query += "case ";
|
|
7712
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.type ";
|
|
7713
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.type ";
|
|
7714
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.type ";
|
|
7715
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.type ";
|
|
7716
|
+
query += "else '' "
|
|
7717
|
+
query += "end as Tipo, ";
|
|
7718
|
+
query += "case ";
|
|
7719
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.manifacturer ";
|
|
7720
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.maker ";
|
|
7721
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.Marca ";
|
|
7722
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.manifacturer ";
|
|
7723
|
+
query += "else '' "
|
|
7724
|
+
query += "end as Marca, ";
|
|
7725
|
+
query += "case ";
|
|
7726
|
+
query += "when cd.tipo_bene = 'DEVICE' then d.model ";
|
|
7727
|
+
query += "when cd.tipo_bene = 'SOFTWARE' then s.model ";
|
|
7728
|
+
query += "when cd.tipo_bene = 'BENE_CONSUMO' then bc.Modello ";
|
|
7729
|
+
query += "when cd.tipo_bene = 'ALTRO' then a.model ";
|
|
7730
|
+
query += "else '' "
|
|
7731
|
+
query += "end as Modello, ";
|
|
7732
|
+
query += "case ";
|
|
7733
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7734
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7735
|
+
query += "when cd.tipo_bene = 'DEVICE' and when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7736
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7737
|
+
query += "when cd.tipo_bene = 'DEVICE' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7738
|
+
//
|
|
7739
|
+
query += "when cd.tipo_bene = 'SOFTWARE' and s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
|
|
7740
|
+
query += "when cd.tipo_bene = 'SOFTWARE' and s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
|
|
7741
|
+
//
|
|
7742
|
+
// Temporaneamente non considerato
|
|
7743
|
+
//query += "when cd.tipo_bene = 'BENE_CONSUMO' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7744
|
+
//query += "when cd.tipo_bene = 'BENE_CONSUMO' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7745
|
+
//
|
|
7746
|
+
//query += "when cd.tipo_bene = 'SOFTWARE' and d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7747
|
+
//query += "when cd.tipo_bene = 'SOFTWARE' and d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7748
|
+
//
|
|
7749
|
+
query += "end as Codice, ";
|
|
7750
|
+
query += "case ";
|
|
7751
|
+
query += "when cd.tipo_bene = 'DEVICE' and trim(d.inv_pnrr_number) is null then '' ";
|
|
7752
|
+
query += "when cd.tipo_bene = 'DEVICE' and trim(d.inv_pnrr_number) = '' then '' ";
|
|
7753
|
+
query += "else 'SI' ";
|
|
7754
|
+
query += "end as PNRR, cb.note_consegna as Note_cons ";
|
|
7755
|
+
query += " from consegna_beni cb";
|
|
7756
|
+
query += " left join devices d on cb.id_bene = d.id";
|
|
7757
|
+
query += " left join softwares s on cb.id_bene = s.id";
|
|
7758
|
+
query += " left join beni_consumo bc on cb.id_bene = bc.id";
|
|
7759
|
+
query += " where cb.id_consegna = " + id_consegna;
|
|
7760
|
+
return query;
|
|
7761
|
+
}
|
|
7762
|
+
|
|
7763
|
+
function selectBeniPerConsegnaMySQL(id_consegna) {
|
|
7764
|
+
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
7765
|
+
query += "case ";
|
|
7766
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7767
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7768
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7769
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7770
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7771
|
+
query += "end as Codice, ";
|
|
7772
|
+
query += "case ";
|
|
7773
|
+
query += "when trim(d.inv_pnrr_number) is null then '' ";
|
|
7774
|
+
query += "when trim(d.inv_pnrr_number) = '' then '' ";
|
|
7775
|
+
query += "else 'SI' ";
|
|
7776
|
+
query += "end as PNRR, dc.note as Note_cons ";
|
|
7777
|
+
query += " from devices d";
|
|
7778
|
+
query += " left join device_consegne dc on dc.id_device = d.id";
|
|
7779
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
7780
|
+
return query;
|
|
7781
|
+
}
|
|
7782
|
+
function selectBeniPerConsegna(db_used, id_consegna) {
|
|
7783
|
+
var query = "";
|
|
7784
|
+
if (db_used) {
|
|
7785
|
+
switch (db_used) {
|
|
7786
|
+
case 'SQLITE':
|
|
7787
|
+
query = selectBeniPerConsegnaSQLite(id_consegna);
|
|
7788
|
+
break;
|
|
7789
|
+
case 'MYSQL':
|
|
7790
|
+
query = selectBeniPerConsegnaMySQL(id_consegna);
|
|
7791
|
+
break;
|
|
7792
|
+
case 'MYSQL2':
|
|
7793
|
+
query = selectBeniPerConsegnaSQLite(id_consegna);
|
|
7794
|
+
break;
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
return query;
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7800
|
+
function selectDeviceConsegnaSQLite(id_consegna, id_device) {
|
|
7801
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
7802
|
+
query += "case ";
|
|
7803
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7804
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7805
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7806
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7807
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7808
|
+
query += "end as codice ";
|
|
7809
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
7810
|
+
query += " join devices d on d.id = dc.id_device";
|
|
7811
|
+
query += " where dc.id_consegna = " + id_consegna;
|
|
7812
|
+
query += " and d.id = " + id_device;
|
|
7813
|
+
return query;
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7816
|
+
function selectDeviceConsegnaMySQL(id_consegna, id_device) {
|
|
7817
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
7818
|
+
query += "case ";
|
|
7819
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
7820
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
7821
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
7822
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
7823
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
7824
|
+
query += "end as codice ";
|
|
7825
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
7826
|
+
query += " join devices d on d.id = dc.id_device";
|
|
7827
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
7828
|
+
query += " and d.id :id_device";
|
|
7829
|
+
return query;
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
|
|
7833
|
+
function selectDeviceConsegna(db_used, id_consegna, id_device) {
|
|
7834
|
+
var query = "";
|
|
7835
|
+
if (db_used) {
|
|
7836
|
+
switch (db_used) {
|
|
7837
|
+
case 'SQLITE':
|
|
7838
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
7839
|
+
break;
|
|
7840
|
+
case 'MYSQL':
|
|
7841
|
+
query = selectDeviceConsegnaMySQL(id_consegna, id_device);
|
|
7842
|
+
break;
|
|
7843
|
+
case 'MYSQL2':
|
|
7844
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
7845
|
+
break;
|
|
7846
|
+
}
|
|
7847
|
+
}
|
|
7848
|
+
return query;
|
|
7849
|
+
}
|
|
7850
|
+
// End Consegna beni
|
|
7851
|
+
|
|
7852
|
+
|
|
7853
|
+
|
|
7854
|
+
|
|
7524
7855
|
|
|
7525
7856
|
function selectDevicePerConsegnaSQLite(id_consegna) {
|
|
7526
7857
|
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
@@ -13642,6 +13973,7 @@ module.exports = {
|
|
|
13642
13973
|
assignCategoryFromDB,
|
|
13643
13974
|
getBeniConsumoByIdDevice,
|
|
13644
13975
|
queryConsegneByIdDevice,
|
|
13976
|
+
queryConsegneByIdBene,
|
|
13645
13977
|
queryFornitoriGestoriCombo,
|
|
13646
13978
|
selectGestoreById,
|
|
13647
13979
|
queryCloseGestioneDevice,
|
|
@@ -13659,6 +13991,10 @@ module.exports = {
|
|
|
13659
13991
|
insertConsegnaDevice,
|
|
13660
13992
|
updateConsegnaDevice,
|
|
13661
13993
|
removeConsegnaDevice,
|
|
13994
|
+
insertConsegnaBene,
|
|
13995
|
+
updateConsegnaBene,
|
|
13996
|
+
removeConsegnaBene,
|
|
13997
|
+
selectBeniPerConsegna,
|
|
13662
13998
|
selectDevicePerConsegna,
|
|
13663
13999
|
selectDeviceConsegna,
|
|
13664
14000
|
selectSoftwarePerConsegna,
|