alsmanager_lib 1.0.0 → 1.0.1

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ Raccolta funzioni per ALSManager/Node-Red
2
+
3
+ 1.0.0 - Implementazione libreria
@@ -3527,9 +3527,35 @@ function getAllPropertiesFromBLOB(text) {
3527
3527
  }
3528
3528
 
3529
3529
  //end complete parser
3530
+ // Reports
3531
+ function getDevicesInUse() {
3532
+ var query = "select d.type as Tipo, count(*) as Numero from devices d ";
3533
+ query += "left join device_site ds on d.id = ds.id_device ";
3534
+ query += "left join site_destinations sd on ds.id_site = sd.id_site ";
3535
+ query += "where ds.id_place is not null ";
3536
+ query += "and ds.date_in <= date('now') and ds.date_out >= date('now') ";
3537
+ query += "and sd.type not in ('MAGAZZINO') ";
3538
+ query += "group by d.type";
3539
+ return query;
3540
+ }
3541
+
3542
+ function getDevicesInUseByPlaces() {
3543
+ var query = "select ds.id_place as Plesso, d.type as Tipo, count(*) as Numero from devices d ";
3544
+ query += "left join device_site ds on d.id = ds.id_device ";
3545
+ query += "left join site_destinations sd on ds.id_site = sd.id_site ";
3546
+ query += "where ds.id_place is not null ";
3547
+ query += "and ds.date_in <= date('now') and ds.date_out >= date('now') ";
3548
+ query += "and sd.type not in ('MAGAZZINO') ";
3549
+ query += "group by ds.id_place, d.type";
3550
+ return query;
3551
+ }
3552
+
3553
+ //End reports
3530
3554
  // Exports
3531
3555
 
3532
3556
  module.exports = {
3557
+ getDevicesInUse,
3558
+ getDevicesInUseByPlaces,
3533
3559
  getDevicesAllocatedComboSQLite,
3534
3560
  getDevicesAllocatedComboMySQL,
3535
3561
  getDevicesNotAllocatedCombo,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.0",
4
- "description": "Funzioni per ALSManager",
5
- "main": "index.js",
3
+ "version": "1.0.1",
4
+ "description": "Funzioni per ALSNManager",
5
+ "license": "ISC",
6
+ "author": "Luca Cattani",
7
+ "type": "commonjs",
8
+ "main": "./lib/modules.js",
6
9
  "scripts": {
7
10
  "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "Luca Cattani",
10
- "license": "ISC"
11
+ }
11
12
  }