alsmanager_lib 3.0.228 → 3.0.230

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.
Files changed (2) hide show
  1. package/lib/modules.js +97 -0
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -17373,6 +17373,96 @@ function deleteCountersPrinterRechargeUser(id_counteruser) {
17373
17373
  return query;
17374
17374
  }
17375
17375
 
17376
+ function selectPrinterCartridges() {
17377
+ /*
17378
+ -- ALS.printer_cartridges definition
17379
+
17380
+ CREATE TABLE `printer_cartridges` (
17381
+ `id` int(11) NOT NULL AUTO_INCREMENT,
17382
+ `tipo` text NOT NULL,
17383
+ `marca` varchar(50) DEFAULT NULL,
17384
+ `descrizione` varchar(50) DEFAULT NULL,
17385
+ `color` char(20) DEFAULT NULL,
17386
+ `numero` int(11) NOT NULL,
17387
+ `data_ultimo_acq` char(10) NOT NULL,
17388
+ `note` varchar(100) DEFAULT NULL,
17389
+ PRIMARY KEY (`id`)
17390
+ ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
17391
+ */
17392
+ var query = "select id, tipo, marca, modello, color, numero, data_ultimo_acq, note from printer_cartridges ";
17393
+ query += "order by marca, modello";
17394
+ return query;
17395
+ }
17396
+
17397
+ function selectPrinterCartridgeById(id_cart) {
17398
+ var query = "select id, tipo, marca, modello, color, numero, data_ultimo_acq, note from printer_cartridges ";
17399
+ query += "where id = " + id_cart;
17400
+ return query;
17401
+ }
17402
+
17403
+ function insertPrinterCartridge(tipo, marca, modello, color, numero, data_ultimo_acq, note) {
17404
+ var query = "insert into printer_cartridges (tipo, marca, modello, color, numero, data_ultimo_acq, note) values ";
17405
+ query += "(";
17406
+ query += "'" + tipo + "', ";
17407
+ query += "'" + marca + "', ";
17408
+ query += "'" + modello + "', ";
17409
+ query += "'" + color + "', ";
17410
+ query += numero + ", ";
17411
+ query += "'" + data_ultimo_acq + "', ";
17412
+ query += "'" + note + "' ";
17413
+ query += ")";
17414
+ return query;
17415
+
17416
+ }
17417
+
17418
+ function updatePrinterCartridge(id_cart, tipo, marca, modello, color, numero, data_ultimo_acq, note) {
17419
+ var query = "update printer_cartridges tipo, marca, modello, color, numero, data_ultimo_acq, note ";
17420
+ var dt_ultimo_acq_str = convertDateToStringDB(data_ultimo_acq);
17421
+ query += "set ";
17422
+ query += "tipo = '" + tipo + "', ";
17423
+ query += "marca = '" + marca + "', ";
17424
+ query += "modello = '" + modello + "', ";
17425
+ query += "color = '" + color + "', ";
17426
+ query += "numero = " + numero + ", ";
17427
+ query += "data_ultimo_acq = '" + dt_ultimo_acq_str + "', ";
17428
+ query += "note = '" + note + "' ";
17429
+ query += "where id = " + id_cart;
17430
+ return query;
17431
+ }
17432
+
17433
+ function removePrinterCartridge(id_cart) {
17434
+ var query = "delete from printer_cartridges ";
17435
+ query += "where id = " + id_cart;
17436
+ return query;
17437
+
17438
+ }
17439
+
17440
+ function installPrinterCartridge(id_cart, id_device, date_install) {
17441
+ /*
17442
+ -- ALS.printer_cart_install definition
17443
+
17444
+ CREATE TABLE `printer_cart_install` (
17445
+ `id` int(11) NOT NULL AUTO_INCREMENT,
17446
+ `id_cart` int(11) DEFAULT NULL,
17447
+ `id_device` int(11) DEFAULT NULL,
17448
+ `note` varchar(100) DEFAULT NULL,
17449
+ `date_install` char(10) DEFAULT NULL,
17450
+ PRIMARY KEY (`id`)
17451
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
17452
+ */
17453
+ var date_install_str = convertDateToStringDB(date_install);
17454
+ var query = "insert into printer_cart_install (id_cart, id_device, note, date_install) values ";
17455
+ query += "(";
17456
+ query += id_cart + ", ";
17457
+ query += id_device + ", ";
17458
+ query += "'" + note + "', ";
17459
+ query += "'" + date_install_str + "' ";
17460
+ query += ")";
17461
+ return query;
17462
+ }
17463
+
17464
+
17465
+
17376
17466
 
17377
17467
  // End Printer management
17378
17468
  // Notes for devices
@@ -17901,6 +17991,13 @@ module.exports = {
17901
17991
  updateCountersPrinterRechargeUser,
17902
17992
  deleteCountersPrinterRechargeUser,
17903
17993
  //
17994
+ selectPrinterCartridges,
17995
+ selectPrinterCartridgeById,
17996
+ insertPrinterCartridge,
17997
+ updatePrinterCartridge,
17998
+ removePrinterCartridge,
17999
+ installPrinterCartridge,
18000
+ //
17904
18001
  getNotesByIdDevice
17905
18002
  };
17906
18003
  // end of source
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.228",
7
+ "version": "3.0.230",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",