alsmanager_lib 1.0.29 → 1.0.30
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 +769 -119
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -2836,6 +2836,21 @@ function queryCloseGestioneDeviceMySQL(id_gestione, id_device, id_gestore) {
|
|
|
2836
2836
|
query += "and date_start < CURDATE()";
|
|
2837
2837
|
return query;
|
|
2838
2838
|
}
|
|
2839
|
+
function queryCloseGestioneDevice(db_used,id_gestione) {
|
|
2840
|
+
var query = "";
|
|
2841
|
+
if (db_used) {
|
|
2842
|
+
switch (db_used) {
|
|
2843
|
+
case 'SQLITE':
|
|
2844
|
+
query = queryCloseGestioneDeviceSQLite(id_gestione);
|
|
2845
|
+
break;
|
|
2846
|
+
case 'MYSQL':
|
|
2847
|
+
query = queryCloseGestioneDeviceMySQL(id_gestione);
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
return query;
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2839
2854
|
|
|
2840
2855
|
|
|
2841
2856
|
function queryFornitoriGestoriCombo()
|
|
@@ -2861,6 +2876,21 @@ function queryInsertGestioneDeviceMySQL(id_device, id_gestore) {
|
|
|
2861
2876
|
return query;
|
|
2862
2877
|
}
|
|
2863
2878
|
|
|
2879
|
+
function queryInsertGestioneDevice(db_used, id_device, id_gestore) {
|
|
2880
|
+
var query = "";
|
|
2881
|
+
if (db_used) {
|
|
2882
|
+
switch (db_used) {
|
|
2883
|
+
case 'SQLITE':
|
|
2884
|
+
query = queryInsertGestioneDeviceSQLite(id_device, id_gestore);
|
|
2885
|
+
break;
|
|
2886
|
+
case 'MYSQL':
|
|
2887
|
+
query = queryInsertGestioneDeviceMySQL(id_device, id_gestore);
|
|
2888
|
+
break;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
return query;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2864
2894
|
function querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione, date_ref) {
|
|
2865
2895
|
|
|
2866
2896
|
}
|
|
@@ -2872,6 +2902,22 @@ function querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione, date
|
|
|
2872
2902
|
return query;
|
|
2873
2903
|
}
|
|
2874
2904
|
|
|
2905
|
+
|
|
2906
|
+
function querySelectExistsGestioneDeviceByIds(db_used,id_device, id_gestione) {
|
|
2907
|
+
var query = "";
|
|
2908
|
+
if (db_used) {
|
|
2909
|
+
switch (db_used) {
|
|
2910
|
+
case 'SQLITE':
|
|
2911
|
+
query = querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione);
|
|
2912
|
+
break;
|
|
2913
|
+
case 'MYSQL':
|
|
2914
|
+
query = querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione);
|
|
2915
|
+
break;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
return query;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2875
2921
|
function querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref) {
|
|
2876
2922
|
var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
|
|
2877
2923
|
query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
|
|
@@ -2913,7 +2959,20 @@ function querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
|
2913
2959
|
query += " order by date_start desc"
|
|
2914
2960
|
return query;
|
|
2915
2961
|
}
|
|
2916
|
-
|
|
2962
|
+
function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
2963
|
+
var query = "";
|
|
2964
|
+
if (db_used) {
|
|
2965
|
+
switch (db_used) {
|
|
2966
|
+
case 'SQLITE':
|
|
2967
|
+
query = querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref);
|
|
2968
|
+
break;
|
|
2969
|
+
case 'MYSQL':
|
|
2970
|
+
query = querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref);
|
|
2971
|
+
break;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
return query;
|
|
2975
|
+
}
|
|
2917
2976
|
|
|
2918
2977
|
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
2919
2978
|
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";
|
|
@@ -2975,7 +3034,20 @@ function queryConsegneMySQL(data_da, data_a, data_filter) {
|
|
|
2975
3034
|
|
|
2976
3035
|
return query;
|
|
2977
3036
|
}
|
|
2978
|
-
|
|
3037
|
+
function queryConsegne(db_used,data_da, data_a, data_filter) {
|
|
3038
|
+
var query = "";
|
|
3039
|
+
if (db_used) {
|
|
3040
|
+
switch (db_used) {
|
|
3041
|
+
case 'SQLITE':
|
|
3042
|
+
query = queryConsegneSQLite(data_da, data_a, data_filter);
|
|
3043
|
+
break;
|
|
3044
|
+
case 'MYSQL':
|
|
3045
|
+
query = queryConsegneMySQL(data_da, data_a, data_filter);
|
|
3046
|
+
break;
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return query;
|
|
3050
|
+
}
|
|
2979
3051
|
|
|
2980
3052
|
function queryConsegnaByIdSQLite(id_consegna) {
|
|
2981
3053
|
var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
|
|
@@ -2994,7 +3066,20 @@ function queryConsegnaByIdMySQL(id_consegna) {
|
|
|
2994
3066
|
query += " where id = :id_consegna";
|
|
2995
3067
|
return query;
|
|
2996
3068
|
}
|
|
2997
|
-
|
|
3069
|
+
function queryConsegnaById(db_used,id_consegna) {
|
|
3070
|
+
var query = "";
|
|
3071
|
+
if (db_used) {
|
|
3072
|
+
switch (db_used) {
|
|
3073
|
+
case 'SQLITE':
|
|
3074
|
+
query = queryConsegnaByIdSQLite(id_consegna);
|
|
3075
|
+
break;
|
|
3076
|
+
case 'MYSQL':
|
|
3077
|
+
query = queryConsegnaByIdMySQL(id_consegna);
|
|
3078
|
+
break;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
return query;
|
|
3082
|
+
}
|
|
2998
3083
|
|
|
2999
3084
|
function queryConsegneByIdDeviceSQLite(id_device) {
|
|
3000
3085
|
var query = "select c.data_consegna as Consegna, ";
|
|
@@ -3028,6 +3113,21 @@ function queryConsegneByIdDeviceMySQL(id_device) {
|
|
|
3028
3113
|
return query;
|
|
3029
3114
|
}
|
|
3030
3115
|
|
|
3116
|
+
function queryConsegneByIdDevice(db_used, id_device) {
|
|
3117
|
+
var query = "";
|
|
3118
|
+
if (db_used) {
|
|
3119
|
+
switch (db_used) {
|
|
3120
|
+
case 'SQLITE':
|
|
3121
|
+
query = queryConsegneByIdDeviceSQLite(id_device);
|
|
3122
|
+
break;
|
|
3123
|
+
case 'MYSQL':
|
|
3124
|
+
query = queryConsegneByIdDeviceMySQL(id_device);
|
|
3125
|
+
break;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
return query;
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3031
3131
|
|
|
3032
3132
|
function queryDeviceStatusCombo() {
|
|
3033
3133
|
var query = "SELECT id, name from status_description order by id";
|
|
@@ -3065,6 +3165,22 @@ function queryInterventoByIdMySQL(id_interv) {
|
|
|
3065
3165
|
return query;
|
|
3066
3166
|
}
|
|
3067
3167
|
|
|
3168
|
+
function queryInterventoById(db_used,id_interv) {
|
|
3169
|
+
var query = "";
|
|
3170
|
+
if (db_used) {
|
|
3171
|
+
switch (db_used) {
|
|
3172
|
+
case 'SQLITE':
|
|
3173
|
+
query = queryInterventoByIdSQLite(id_interv);
|
|
3174
|
+
break;
|
|
3175
|
+
case 'MYSQL':
|
|
3176
|
+
query = queryInterventoByIdSQLite(id_interv);
|
|
3177
|
+
break;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
return query;
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
|
|
3068
3184
|
|
|
3069
3185
|
// Device intervento
|
|
3070
3186
|
function insertDeviceInterventoSQLite(id_intervento, id_device, note) {
|
|
@@ -3077,6 +3193,20 @@ function insertDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
|
3077
3193
|
query += "values (:id_intervento, :id_device, :note)";
|
|
3078
3194
|
return query;
|
|
3079
3195
|
}
|
|
3196
|
+
function insertDeviceIntervento(db_used,id_intervento, id_device, note) {
|
|
3197
|
+
var query = "";
|
|
3198
|
+
if (db_used) {
|
|
3199
|
+
switch (db_used) {
|
|
3200
|
+
case 'SQLITE':
|
|
3201
|
+
query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
|
|
3202
|
+
break;
|
|
3203
|
+
case 'MYSQL':
|
|
3204
|
+
query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
|
|
3205
|
+
break;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
return query;
|
|
3209
|
+
}
|
|
3080
3210
|
// Update
|
|
3081
3211
|
function updateDeviceInterventoSQLite(id_dev_interv, id_device, note) {
|
|
3082
3212
|
var query = "update device_interventi set ";
|
|
@@ -3092,6 +3222,20 @@ function updateDeviceInterventoMySQL(id_dev_interv, id_device, note) {
|
|
|
3092
3222
|
query += "where id = :id_dev_interv";
|
|
3093
3223
|
return query;
|
|
3094
3224
|
}
|
|
3225
|
+
function updateDeviceIntervento(db_used, id_dev_interv, id_device, note) {
|
|
3226
|
+
var query = "";
|
|
3227
|
+
if (db_used) {
|
|
3228
|
+
switch (db_used) {
|
|
3229
|
+
case 'SQLITE':
|
|
3230
|
+
query = updateDeviceInterventoSQLite(id_dev_interv, id_device, note);
|
|
3231
|
+
break;
|
|
3232
|
+
case 'MYSQL':
|
|
3233
|
+
query = updateDeviceInterventoMySQL(id_dev_interv, id_device, note);
|
|
3234
|
+
break;
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
return query;
|
|
3238
|
+
}
|
|
3095
3239
|
// Remove
|
|
3096
3240
|
function removeDeviceInterventoSQLite(id_dev_interv) {
|
|
3097
3241
|
var query = "delete from device_interventi ";
|
|
@@ -3103,6 +3247,20 @@ function removeDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
|
3103
3247
|
query += "values (:id_intervento, :id_device, :note)";
|
|
3104
3248
|
return query;
|
|
3105
3249
|
}
|
|
3250
|
+
function removeDeviceIntervento(db_used, id_intervento, id_device, note) {
|
|
3251
|
+
var query = "";
|
|
3252
|
+
if (db_used) {
|
|
3253
|
+
switch (db_used) {
|
|
3254
|
+
case 'SQLITE':
|
|
3255
|
+
query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
|
|
3256
|
+
break;
|
|
3257
|
+
case 'MYSQL':
|
|
3258
|
+
query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
|
|
3259
|
+
break;
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
return query;
|
|
3263
|
+
}
|
|
3106
3264
|
//End device intervento
|
|
3107
3265
|
|
|
3108
3266
|
|
|
@@ -3234,7 +3392,20 @@ function insertConsegnaMySQL(consegnaObj) {
|
|
|
3234
3392
|
return query;
|
|
3235
3393
|
}
|
|
3236
3394
|
|
|
3237
|
-
|
|
3395
|
+
function insertConsegna(db_used, consegna){
|
|
3396
|
+
var query = "";
|
|
3397
|
+
if (db_used) {
|
|
3398
|
+
switch (db_used) {
|
|
3399
|
+
case 'SQLITE':
|
|
3400
|
+
query = insertConsegnaSQLite(consegna);
|
|
3401
|
+
break;
|
|
3402
|
+
case 'MYSQL':
|
|
3403
|
+
query = insertConsegnaMySQL(consegna);
|
|
3404
|
+
break;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
return query;
|
|
3408
|
+
}
|
|
3238
3409
|
|
|
3239
3410
|
function updateConsegnaSQLite(consegna) {
|
|
3240
3411
|
var query = "";
|
|
@@ -3292,6 +3463,21 @@ function updateConsegnaMySQL(consegna) {
|
|
|
3292
3463
|
return query;
|
|
3293
3464
|
}
|
|
3294
3465
|
|
|
3466
|
+
function updateConsegna(db_used, consegna) {
|
|
3467
|
+
var query = "";
|
|
3468
|
+
var db_used = global.get("db_used");
|
|
3469
|
+
if (db_used) {
|
|
3470
|
+
switch (db_used) {
|
|
3471
|
+
case 'SQLITE':
|
|
3472
|
+
query = updateConsegnaSQLite(consegna);
|
|
3473
|
+
break;
|
|
3474
|
+
case 'MYSQL':
|
|
3475
|
+
query = updateConsegnaMySQL(consegna);
|
|
3476
|
+
break;
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
return query;
|
|
3480
|
+
}
|
|
3295
3481
|
|
|
3296
3482
|
function removeConsegnaSQLite(id_consegna) {
|
|
3297
3483
|
var query = "update consegne";
|
|
@@ -3307,6 +3493,20 @@ function removeConsegnaMySQL(id_consegna) {
|
|
|
3307
3493
|
return query;
|
|
3308
3494
|
}
|
|
3309
3495
|
|
|
3496
|
+
function removeConsegna(db_used,id_consegna) {
|
|
3497
|
+
var query = "";
|
|
3498
|
+
if (db_used) {
|
|
3499
|
+
switch (db_used) {
|
|
3500
|
+
case 'SQLITE':
|
|
3501
|
+
query = removeConsegnaSQLite(id_consegna);
|
|
3502
|
+
break;
|
|
3503
|
+
case 'MYSQL':
|
|
3504
|
+
query = removeConsegnaMySQL(id_consegna);
|
|
3505
|
+
break;
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
return query;
|
|
3509
|
+
}
|
|
3310
3510
|
|
|
3311
3511
|
function queryLastConsegnaIdSQLite() {
|
|
3312
3512
|
return "select seq as id from sqlite_sequence where name = 'consegne'";
|
|
@@ -3314,7 +3514,20 @@ function queryLastConsegnaIdSQLite() {
|
|
|
3314
3514
|
function queryLastConsegnaIdMySQL() {
|
|
3315
3515
|
return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'consegne'";
|
|
3316
3516
|
}
|
|
3317
|
-
|
|
3517
|
+
function queryLastConsegnaId(db_used) {
|
|
3518
|
+
var query = "";
|
|
3519
|
+
if (db_used) {
|
|
3520
|
+
switch (db_used) {
|
|
3521
|
+
case 'SQLITE':
|
|
3522
|
+
query = queryLastConsegnaIdSQLite();
|
|
3523
|
+
break;
|
|
3524
|
+
case 'MYSQL':
|
|
3525
|
+
query = queryLastConsegnaIdMySQL();
|
|
3526
|
+
break;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
return query;
|
|
3530
|
+
}
|
|
3318
3531
|
|
|
3319
3532
|
//get connection types
|
|
3320
3533
|
function getConnectionTypesSQLite() {
|
|
@@ -3325,6 +3538,20 @@ function getConnectionTypesMySQL() {
|
|
|
3325
3538
|
var query = "select id, conn_type from connection_types";
|
|
3326
3539
|
return query;
|
|
3327
3540
|
}
|
|
3541
|
+
function getConnectionTypes(db_used) {
|
|
3542
|
+
var query = "";
|
|
3543
|
+
if (db_used) {
|
|
3544
|
+
switch (db_used) {
|
|
3545
|
+
case 'SQLITE':
|
|
3546
|
+
query = getConnectionTypesSQLite();
|
|
3547
|
+
break;
|
|
3548
|
+
case 'MYSQL':
|
|
3549
|
+
query = getConnectionTypesMySQL();
|
|
3550
|
+
break;
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
return query;
|
|
3554
|
+
}
|
|
3328
3555
|
//end get connection types
|
|
3329
3556
|
//get connection protocols
|
|
3330
3557
|
function getConnectionProtocolsSQLite() {
|
|
@@ -3335,6 +3562,20 @@ function getConnectionProtocolsMySQL() {
|
|
|
3335
3562
|
var query = "select id, name from connection_protocols";
|
|
3336
3563
|
return query;
|
|
3337
3564
|
}
|
|
3565
|
+
function getConnectionProtocols(db_used) {
|
|
3566
|
+
var query = "";
|
|
3567
|
+
if (db_used) {
|
|
3568
|
+
switch (db_used) {
|
|
3569
|
+
case 'SQLITE':
|
|
3570
|
+
query = getConnectionProtocolsSQLite();
|
|
3571
|
+
break;
|
|
3572
|
+
case 'MYSQL':
|
|
3573
|
+
query = getConnectionProtocolsMySQL();
|
|
3574
|
+
break;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
return query;
|
|
3578
|
+
}
|
|
3338
3579
|
//end get connection protocols
|
|
3339
3580
|
//Get Storage types
|
|
3340
3581
|
function getStorageTypesSQLite() {
|
|
@@ -3345,6 +3586,20 @@ function getStorageTypesMySQL() {
|
|
|
3345
3586
|
var query = "select id, name from storage_types order by exp_order";
|
|
3346
3587
|
return query;
|
|
3347
3588
|
}
|
|
3589
|
+
function getStorageTypes(db_used) {
|
|
3590
|
+
var query = "";
|
|
3591
|
+
if (db_used) {
|
|
3592
|
+
switch (db_used) {
|
|
3593
|
+
case 'SQLITE':
|
|
3594
|
+
query = getStorageTypesSQLite();
|
|
3595
|
+
break;
|
|
3596
|
+
case 'MYSQL':
|
|
3597
|
+
query = getStorageTypesMySQL();
|
|
3598
|
+
break;
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
return query;
|
|
3602
|
+
}
|
|
3348
3603
|
//end get storage types
|
|
3349
3604
|
|
|
3350
3605
|
|
|
@@ -3363,6 +3618,20 @@ function getAdapterTypesMySQL() {
|
|
|
3363
3618
|
|
|
3364
3619
|
return query;
|
|
3365
3620
|
}
|
|
3621
|
+
function getAdapterTypes(db_used) {
|
|
3622
|
+
var query = "";
|
|
3623
|
+
if (db_used) {
|
|
3624
|
+
switch (db_used) {
|
|
3625
|
+
case 'SQLITE':
|
|
3626
|
+
query = getAdapterTypesSQLite();
|
|
3627
|
+
break;
|
|
3628
|
+
case 'MYSQL':
|
|
3629
|
+
query = getAdapterTypesMySQL();
|
|
3630
|
+
break;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
return query;
|
|
3634
|
+
}
|
|
3366
3635
|
//end get adapter types
|
|
3367
3636
|
|
|
3368
3637
|
function getLaboratorioByIdSiteSQLite(id_site, id_place) {
|
|
@@ -3419,6 +3688,20 @@ function getLaboratorioByIdSiteMySQL(id_site, id_place) {
|
|
|
3419
3688
|
query += "order by pl.Bancata asc, pl.num_pos desc ";
|
|
3420
3689
|
return query;
|
|
3421
3690
|
}
|
|
3691
|
+
function getLaboratorioByIdSite(db_used,id_site, id_place) {
|
|
3692
|
+
var query = "";
|
|
3693
|
+
if (db_used) {
|
|
3694
|
+
switch (db_used) {
|
|
3695
|
+
case 'SQLITE':
|
|
3696
|
+
query = getLaboratorioByIdSiteSQLite(id_site, id_place);
|
|
3697
|
+
break;
|
|
3698
|
+
case 'MYSQL':
|
|
3699
|
+
query = getLaboratorioByIdSiteMySQL(id_site, id_place);
|
|
3700
|
+
break;
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
return query;
|
|
3704
|
+
}
|
|
3422
3705
|
// Manage categories
|
|
3423
3706
|
function getCategories() {
|
|
3424
3707
|
var query = "select DISTINCT categoria from categorie_device ";
|
|
@@ -3435,6 +3718,22 @@ function assignCategoryFromDBMySQL(dev_type) {
|
|
|
3435
3718
|
query += "where tipo = :dev_type";
|
|
3436
3719
|
return query;
|
|
3437
3720
|
}
|
|
3721
|
+
|
|
3722
|
+
function assignCategoryFromDB(db_used,dev_type) {
|
|
3723
|
+
var query = "";
|
|
3724
|
+
if (db_used) {
|
|
3725
|
+
switch (db_used) {
|
|
3726
|
+
case 'SQLITE':
|
|
3727
|
+
query = assignCategoryFromDBSQLite(dev_type);
|
|
3728
|
+
break;
|
|
3729
|
+
case 'MYSQL':
|
|
3730
|
+
query = assignCategoryFromDBMySQL(dev_type);
|
|
3731
|
+
break;
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
return query;
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3438
3737
|
// end manage categories
|
|
3439
3738
|
function getBeniConsumoByIdDeviceSQLite(id_device) {
|
|
3440
3739
|
var query = "select Tipo, Marca, Modello from beniconsumo bc ";
|
|
@@ -3452,6 +3751,21 @@ function getBeniConsumoByIdDeviceMySQL(id_device) {
|
|
|
3452
3751
|
return query;
|
|
3453
3752
|
}
|
|
3454
3753
|
|
|
3754
|
+
function getBeniConsumoByIdDevice(db_used,id_device) {
|
|
3755
|
+
var query = "";
|
|
3756
|
+
if (db_used) {
|
|
3757
|
+
switch (db_used) {
|
|
3758
|
+
case 'SQLITE':
|
|
3759
|
+
query = getBeniConsumoByIdDeviceSQLite(id_device);
|
|
3760
|
+
break;
|
|
3761
|
+
case 'MYSQL':
|
|
3762
|
+
query = getBeniConsumoByIdDeviceMySQL(id_device);
|
|
3763
|
+
break;
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
return query;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3455
3769
|
//Manage dismissioni
|
|
3456
3770
|
function selectDismissioniByYearSQLite(sel_year) {
|
|
3457
3771
|
var query = "select id, data, descrizione from dismissioni ";
|
|
@@ -3528,6 +3842,7 @@ function insertDismissioneMySQL(data, descrizione, is_closed) {
|
|
|
3528
3842
|
return query;
|
|
3529
3843
|
}
|
|
3530
3844
|
|
|
3845
|
+
|
|
3531
3846
|
function insertDismissione(db_used, data, descrizione, is_closed) {
|
|
3532
3847
|
var query = "";
|
|
3533
3848
|
if (db_used) {
|
|
@@ -4209,6 +4524,20 @@ function getCategoriesByIdDeviceMySQL(id_device) {
|
|
|
4209
4524
|
query += "where d.id = :id_device";
|
|
4210
4525
|
return query;
|
|
4211
4526
|
}
|
|
4527
|
+
function getCategoriesByIdDevice(db_used,id_device) {
|
|
4528
|
+
var query = "";
|
|
4529
|
+
if (db_used) {
|
|
4530
|
+
switch (db_used) {
|
|
4531
|
+
case 'SQLITE':
|
|
4532
|
+
query = getCategoriesByIdDeviceSQLite(id_device);
|
|
4533
|
+
break;
|
|
4534
|
+
case 'MYSQL':
|
|
4535
|
+
query = getCategoriesByIdDeviceMySQL(id_device);
|
|
4536
|
+
break;
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
return query;
|
|
4540
|
+
}
|
|
4212
4541
|
//End Get Categories by IdDevice
|
|
4213
4542
|
//Get details by type
|
|
4214
4543
|
function queryDetailsByIdDeviceSQLite(id_device) {
|
|
@@ -4223,7 +4552,20 @@ function queryDetailsByIdDeviceMySQL(id_device) {
|
|
|
4223
4552
|
query += "where d.id = :id_device";
|
|
4224
4553
|
return query;
|
|
4225
4554
|
}
|
|
4226
|
-
|
|
4555
|
+
function queryDetailsByIdDevice(db_used,id_device) {
|
|
4556
|
+
var query = "";
|
|
4557
|
+
if (db_used) {
|
|
4558
|
+
switch (db_used) {
|
|
4559
|
+
case 'SQLITE':
|
|
4560
|
+
query = queryDetailsByIdDeviceSQLite(id_device);
|
|
4561
|
+
break;
|
|
4562
|
+
case 'MYSQL':
|
|
4563
|
+
query = queryDetailsByIdDeviceMySQL(id_device);
|
|
4564
|
+
break;
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
4567
|
+
return query;
|
|
4568
|
+
}
|
|
4227
4569
|
//End Get details by type
|
|
4228
4570
|
// Define getConnectionSetById
|
|
4229
4571
|
function getConnectionSetByIdSQLite(id_conn_set) {
|
|
@@ -4233,6 +4575,21 @@ function getConnectionSetByIdSQLite(id_conn_set) {
|
|
|
4233
4575
|
}
|
|
4234
4576
|
function getConnectionSetByIdMySQL(id_conn_set) {
|
|
4235
4577
|
|
|
4578
|
+
}
|
|
4579
|
+
function getConnectionSetById(db_used, id_conn_set) {
|
|
4580
|
+
var query = "";
|
|
4581
|
+
if (db_used) {
|
|
4582
|
+
switch (db_used) {
|
|
4583
|
+
case 'SQLITE':
|
|
4584
|
+
query = getConnectionSetByIdSQLite(id_conn_set);
|
|
4585
|
+
break;
|
|
4586
|
+
case 'MYSQL':
|
|
4587
|
+
query = getConnectionSetByIdMySQL(id_conn_set);
|
|
4588
|
+
break;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
return query;
|
|
4592
|
+
|
|
4236
4593
|
}
|
|
4237
4594
|
// End define getConnectionSetById
|
|
4238
4595
|
// Define getConnectionByIdSet
|
|
@@ -4263,6 +4620,20 @@ function getConnectionByIdSetMySQL(id_set) {
|
|
|
4263
4620
|
query += "left join connection_types ac2 on at.adapt_type_out = ac2.id ";
|
|
4264
4621
|
query += "where id_set = :id_set";
|
|
4265
4622
|
}
|
|
4623
|
+
function getConnectionByIdSet(db_used, id_set) {
|
|
4624
|
+
var query = "";
|
|
4625
|
+
if (db_used) {
|
|
4626
|
+
switch (db_used) {
|
|
4627
|
+
case 'SQLITE':
|
|
4628
|
+
query = getConnectionByIdSetSQLite(id_set);
|
|
4629
|
+
break;
|
|
4630
|
+
case 'MYSQL':
|
|
4631
|
+
query = getConnectionByIdSetMySQL(id_set);
|
|
4632
|
+
break;
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4635
|
+
return query;
|
|
4636
|
+
}
|
|
4266
4637
|
//End Define getConnectionByIdSet
|
|
4267
4638
|
// Define updateConnectionSet
|
|
4268
4639
|
function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
@@ -4284,6 +4655,20 @@ function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapt
|
|
|
4284
4655
|
}
|
|
4285
4656
|
function updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
4286
4657
|
|
|
4658
|
+
}
|
|
4659
|
+
function updateConnectionSet(db_used, id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
4660
|
+
var query = "";
|
|
4661
|
+
if (db_used) {
|
|
4662
|
+
switch (db_used) {
|
|
4663
|
+
case 'SQLITE':
|
|
4664
|
+
query = updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
4665
|
+
break;
|
|
4666
|
+
case 'MYSQL':
|
|
4667
|
+
query = updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter);
|
|
4668
|
+
break;
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
return query;
|
|
4287
4672
|
}
|
|
4288
4673
|
// end define updateConnectionSet
|
|
4289
4674
|
// Define insertConnectionSet
|
|
@@ -4294,9 +4679,23 @@ function insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter) {
|
|
|
4294
4679
|
query += id_adapter + ", ";
|
|
4295
4680
|
query += "'" + verse + "')";
|
|
4296
4681
|
return query;
|
|
4297
|
-
}
|
|
4298
|
-
function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
|
|
4299
|
-
|
|
4682
|
+
}
|
|
4683
|
+
function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
|
|
4684
|
+
|
|
4685
|
+
}
|
|
4686
|
+
function insertConnectionSet(db_used, id_set, id_conn, verse, id_adapter) {
|
|
4687
|
+
var query = "";
|
|
4688
|
+
if (db_used) {
|
|
4689
|
+
switch (db_used) {
|
|
4690
|
+
case 'SQLITE':
|
|
4691
|
+
query = insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter);
|
|
4692
|
+
break;
|
|
4693
|
+
case 'MYSQL':
|
|
4694
|
+
query = insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter);
|
|
4695
|
+
break;
|
|
4696
|
+
}
|
|
4697
|
+
}
|
|
4698
|
+
return query;
|
|
4300
4699
|
}
|
|
4301
4700
|
// end define insertConnectionSet
|
|
4302
4701
|
// Define removeConnectionSet
|
|
@@ -4309,6 +4708,21 @@ function removeConnectionSetSQLite(id_set, id_conn_set) {
|
|
|
4309
4708
|
function removeConnectionSetMySQL(id_set, id_conn_set, id_conn, id_adapter, verse) {
|
|
4310
4709
|
|
|
4311
4710
|
}
|
|
4711
|
+
function removeConnectionSet(db_used, id_set, id_conn_set) {
|
|
4712
|
+
var query = "";
|
|
4713
|
+
if (db_used) {
|
|
4714
|
+
switch (db_used) {
|
|
4715
|
+
case 'SQLITE':
|
|
4716
|
+
query = removeConnectionSetSQLite(id_set, id_conn_set);
|
|
4717
|
+
break;
|
|
4718
|
+
case 'MYSQL':
|
|
4719
|
+
query = removeConnectionSetMySQL(id_set, id_conn_set);
|
|
4720
|
+
break;
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4723
|
+
return query;
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4312
4726
|
// end define removeConnectionSet
|
|
4313
4727
|
// Code added here will be run once
|
|
4314
4728
|
// whenever the node is started.
|
|
@@ -4340,6 +4754,20 @@ function getBeneConsumoUsatoMySQL(id_device, id_bene) {
|
|
|
4340
4754
|
query += "where db.id_bene = :id_bene and db.id_device = :id_device";
|
|
4341
4755
|
return query;
|
|
4342
4756
|
}
|
|
4757
|
+
function getBeneConsumoUsato(db_used, id_device, id_bene) {
|
|
4758
|
+
var query = "";
|
|
4759
|
+
if (db_used) {
|
|
4760
|
+
switch (db_used) {
|
|
4761
|
+
case 'SQLITE':
|
|
4762
|
+
query = removeConnectionSetSQLite(id_device, id_bene);
|
|
4763
|
+
break;
|
|
4764
|
+
case 'MYSQL':
|
|
4765
|
+
query = removeConnectionSetMySQL(id_device, id_bene);
|
|
4766
|
+
break;
|
|
4767
|
+
}
|
|
4768
|
+
}
|
|
4769
|
+
return query;
|
|
4770
|
+
}
|
|
4343
4771
|
//
|
|
4344
4772
|
function getBeneConsumoByIdSQLite(id_bene) {
|
|
4345
4773
|
var query = "select id, tipo, marca, modello, quantitativo from beniconsumo ";
|
|
@@ -4351,6 +4779,20 @@ function getBeneConsumoByIdMySQL(id_bene) {
|
|
|
4351
4779
|
query += "where id :id_bene";
|
|
4352
4780
|
return query;
|
|
4353
4781
|
}
|
|
4782
|
+
function getBeneConsumoById(db_used, id_bene) {
|
|
4783
|
+
var query = "";
|
|
4784
|
+
if (db_used) {
|
|
4785
|
+
switch (db_used) {
|
|
4786
|
+
case 'SQLITE':
|
|
4787
|
+
query = getBeneConsumoByIdSQLite(id_bene);
|
|
4788
|
+
break;
|
|
4789
|
+
case 'MYSQL':
|
|
4790
|
+
query = getBeneConsumoByIdMySQL(id_bene);
|
|
4791
|
+
break;
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
return query;
|
|
4795
|
+
}
|
|
4354
4796
|
//
|
|
4355
4797
|
function insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
4356
4798
|
var query = "insert into device_beniconsumo (id_device, id_bene, numero) values ";
|
|
@@ -4362,6 +4804,20 @@ function insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
|
4362
4804
|
query += "(:id_device, :id_bene, :numero)";
|
|
4363
4805
|
return query;
|
|
4364
4806
|
}
|
|
4807
|
+
function insertBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
4808
|
+
var query = "";
|
|
4809
|
+
if (db_used) {
|
|
4810
|
+
switch (db_used) {
|
|
4811
|
+
case 'SQLITE':
|
|
4812
|
+
query = insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
4813
|
+
break;
|
|
4814
|
+
case 'MYSQL':
|
|
4815
|
+
query = insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
4816
|
+
break;
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
return query;
|
|
4820
|
+
}
|
|
4365
4821
|
//
|
|
4366
4822
|
function updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
4367
4823
|
var query = "update device_beniconsumo ";
|
|
@@ -4375,6 +4831,20 @@ function updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
|
4375
4831
|
query += "where id_device = :id_device and id_bene = :id_bene";
|
|
4376
4832
|
return query;
|
|
4377
4833
|
}
|
|
4834
|
+
function updateBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
|
|
4835
|
+
var query = "";
|
|
4836
|
+
if (db_used) {
|
|
4837
|
+
switch (db_used) {
|
|
4838
|
+
case 'SQLITE':
|
|
4839
|
+
query = updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
|
|
4840
|
+
break;
|
|
4841
|
+
case 'MYSQL':
|
|
4842
|
+
query = updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
|
|
4843
|
+
break;
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
return query;
|
|
4847
|
+
}
|
|
4378
4848
|
//
|
|
4379
4849
|
function existBeneAbbinatoSQLite(id_device, id_bene) {
|
|
4380
4850
|
var query = "select count(id_device) as numero from device_beniconsumo ";
|
|
@@ -4386,6 +4856,20 @@ function existBeneAbbinatoMySQL(id_device, id_bene) {
|
|
|
4386
4856
|
query += "where id_device :id_device and id_bene = :id_bene";
|
|
4387
4857
|
return query;
|
|
4388
4858
|
}
|
|
4859
|
+
function existBeneAbbinato(db_used, id_device, id_bene) {
|
|
4860
|
+
var query = "";
|
|
4861
|
+
if (db_used) {
|
|
4862
|
+
switch (db_used) {
|
|
4863
|
+
case 'SQLITE':
|
|
4864
|
+
query = existBeneAbbinatoSQLite(id_device, id_bene);
|
|
4865
|
+
break;
|
|
4866
|
+
case 'MYSQL':
|
|
4867
|
+
query = existBeneAbbinatoMySQL(id_device, id_bene);
|
|
4868
|
+
break;
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
return query;
|
|
4872
|
+
}
|
|
4389
4873
|
// end of source
|
|
4390
4874
|
|
|
4391
4875
|
|
|
@@ -4745,7 +5229,20 @@ function removeDeviceSiteSQLite(id_site, id_place, id_device) {
|
|
|
4745
5229
|
function removeDeviceSiteMySQL(id_site, id_place, id_device) {
|
|
4746
5230
|
|
|
4747
5231
|
}
|
|
4748
|
-
|
|
5232
|
+
function removeDeviceSite(db_used,id_site, id_place, id_device) {
|
|
5233
|
+
var query = "";
|
|
5234
|
+
if (db_used) {
|
|
5235
|
+
switch (db_used) {
|
|
5236
|
+
case 'SQLITE':
|
|
5237
|
+
query = removeDeviceSiteSQLite(id_site, id_place, id_device);
|
|
5238
|
+
break;
|
|
5239
|
+
case 'MYSQL':
|
|
5240
|
+
query = removeDeviceSiteMySQL(id_site, id_place, id_device);
|
|
5241
|
+
break;
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
return query;
|
|
5245
|
+
}
|
|
4749
5246
|
|
|
4750
5247
|
function updateDeviceSiteSQLite(id_device) {
|
|
4751
5248
|
var query = "update device_site set date_out = date('now','-1 day') ";
|
|
@@ -4757,6 +5254,20 @@ function updateDeviceSiteMySQL(id_device) {
|
|
|
4757
5254
|
query += "where id_device = :id_device and date_in = (select max(date_in) from device_site where id_device = :id_device)";
|
|
4758
5255
|
return query;
|
|
4759
5256
|
}
|
|
5257
|
+
function updateDeviceSite(db_used,id_device) {
|
|
5258
|
+
var query = "";
|
|
5259
|
+
if (db_used) {
|
|
5260
|
+
switch (db_used) {
|
|
5261
|
+
case 'SQLITE':
|
|
5262
|
+
query = updateDeviceSiteSQLite(id_device);
|
|
5263
|
+
break;
|
|
5264
|
+
case 'MYSQL':
|
|
5265
|
+
query = updateDeviceSiteMySQL(id_device);
|
|
5266
|
+
break;
|
|
5267
|
+
}
|
|
5268
|
+
}
|
|
5269
|
+
return query;
|
|
5270
|
+
}
|
|
4760
5271
|
// end manage updateDevicesSite
|
|
4761
5272
|
// Manage insertDeviceSite
|
|
4762
5273
|
function insertDeviceSiteSQLite(id_device, id_place, id_site, start_date) {
|
|
@@ -4791,6 +5302,20 @@ function insertDeviceSiteMySQL(id_device, id_place, id_site, start_date) {
|
|
|
4791
5302
|
query += ")";
|
|
4792
5303
|
return query;
|
|
4793
5304
|
}
|
|
5305
|
+
function insertDeviceSite(db_used,id_device, id_place, id_site, start_date) {
|
|
5306
|
+
var query = "";
|
|
5307
|
+
if (db_used) {
|
|
5308
|
+
switch (db_used) {
|
|
5309
|
+
case 'SQLITE':
|
|
5310
|
+
query = insertDeviceSiteSQLite(id_device, id_place, id_site, start_date);
|
|
5311
|
+
break;
|
|
5312
|
+
case 'MYSQL':
|
|
5313
|
+
query = insertDeviceSiteMySQL(id_device, id_place, id_site, start_date);
|
|
5314
|
+
break;
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
return query;
|
|
5318
|
+
}
|
|
4794
5319
|
// end manage updateDevicesSite
|
|
4795
5320
|
//Get Sites for Combo
|
|
4796
5321
|
function getSitesSelectComboSQLite(id_place, tipo_aula) {
|
|
@@ -4834,7 +5359,20 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
|
|
|
4834
5359
|
query += "order by p.name, s.floor, sd.name ";
|
|
4835
5360
|
return query;
|
|
4836
5361
|
}
|
|
4837
|
-
|
|
5362
|
+
function getSitesSelectCombo(db_used,id_place, tipo_aula) {
|
|
5363
|
+
var query = "";
|
|
5364
|
+
if (db_used) {
|
|
5365
|
+
switch (db_used) {
|
|
5366
|
+
case 'SQLITE':
|
|
5367
|
+
query = getSitesSelectComboSQLite(id_place, tipo_aula);
|
|
5368
|
+
break;
|
|
5369
|
+
case 'MYSQL':
|
|
5370
|
+
query = getSitesSelectComboMySQL(id_place, tipo_aula);
|
|
5371
|
+
break;
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
return query;
|
|
5375
|
+
}
|
|
4838
5376
|
//End get sites for combo
|
|
4839
5377
|
//Get Sites by Id
|
|
4840
5378
|
function getSiteByIdSQLite(id_site) {
|
|
@@ -4854,7 +5392,20 @@ function getSiteByIdMySQL(id_site) {
|
|
|
4854
5392
|
query += "and s.id = :id_site";
|
|
4855
5393
|
return query;
|
|
4856
5394
|
}
|
|
4857
|
-
|
|
5395
|
+
function getSiteById(db_used,id_site) {
|
|
5396
|
+
var query = "";
|
|
5397
|
+
if (db_used) {
|
|
5398
|
+
switch (db_used) {
|
|
5399
|
+
case 'SQLITE':
|
|
5400
|
+
query = getSiteByIdSQLite(id_site);
|
|
5401
|
+
break;
|
|
5402
|
+
case 'MYSQL':
|
|
5403
|
+
query = getSiteByIdMySQL(id_site);
|
|
5404
|
+
break;
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
return query;
|
|
5408
|
+
}
|
|
4858
5409
|
//End get site by id
|
|
4859
5410
|
// Get Labs from Place
|
|
4860
5411
|
function querySitesLabSQLite(id_place) {
|
|
@@ -4870,7 +5421,20 @@ function querySitesLabMySQL(id_place) {
|
|
|
4870
5421
|
query += "where s.id_place = :id_place ";
|
|
4871
5422
|
query += "and s.id in (select id_site from postazione_lab where id_place = :id_place) ";
|
|
4872
5423
|
}
|
|
4873
|
-
|
|
5424
|
+
function querySitesLab(db_used,id_place) {
|
|
5425
|
+
var query = "";
|
|
5426
|
+
if (db_used) {
|
|
5427
|
+
switch (db_used) {
|
|
5428
|
+
case 'SQLITE':
|
|
5429
|
+
query = querySitesLabSQLite(id_place);
|
|
5430
|
+
break;
|
|
5431
|
+
case 'MYSQL':
|
|
5432
|
+
query = querySitesLabMySQL(id_place);
|
|
5433
|
+
break;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
return query;
|
|
5437
|
+
}
|
|
4874
5438
|
//end get labs from place
|
|
4875
5439
|
//Define removeSiteBySet
|
|
4876
5440
|
function removeSiteBySetSQLite(id_device) {
|
|
@@ -4891,6 +5455,20 @@ function removeSiteBySetMySQL(id_device) {
|
|
|
4891
5455
|
query += ")";
|
|
4892
5456
|
return query;
|
|
4893
5457
|
}
|
|
5458
|
+
function removeSiteBySet(db_used, id_device) {
|
|
5459
|
+
var query = "";
|
|
5460
|
+
if (db_used) {
|
|
5461
|
+
switch (db_used) {
|
|
5462
|
+
case 'SQLITE':
|
|
5463
|
+
query = removeSiteBySetSQLite(id_device);
|
|
5464
|
+
break;
|
|
5465
|
+
case 'MYSQL':
|
|
5466
|
+
query = emoveSiteBySetMySQL(id_device);
|
|
5467
|
+
break;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
return query;
|
|
5471
|
+
}
|
|
4894
5472
|
//End define removeSiteBySet
|
|
4895
5473
|
|
|
4896
5474
|
// Define updateSiteBySet
|
|
@@ -4907,6 +5485,20 @@ function updateSiteBySetMySQL(id_device) {
|
|
|
4907
5485
|
query += "where dt.id_maindevice = :id_device)";
|
|
4908
5486
|
return query;
|
|
4909
5487
|
}
|
|
5488
|
+
function updateSiteBySet(db_used,id_device) {
|
|
5489
|
+
var query = "";
|
|
5490
|
+
if (db_used) {
|
|
5491
|
+
switch (db_used) {
|
|
5492
|
+
case 'SQLITE':
|
|
5493
|
+
query = updateSiteBySetSQLite(id_device);
|
|
5494
|
+
break;
|
|
5495
|
+
case 'MYSQL':
|
|
5496
|
+
query = updateSiteBySetMySQL(id_device);
|
|
5497
|
+
break;
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
return query;
|
|
5501
|
+
}
|
|
4910
5502
|
// End define updateSiteBySet
|
|
4911
5503
|
// Define insertSiteBySet
|
|
4912
5504
|
function insertSiteBySetSQLite(id_device) {
|
|
@@ -4925,6 +5517,20 @@ function insertSiteBySetMySQL(id_device) {
|
|
|
4925
5517
|
query += "where ds.id_maindevice = :id_device";
|
|
4926
5518
|
return query;
|
|
4927
5519
|
}
|
|
5520
|
+
function insertSiteBySet(db_used,id_device) {
|
|
5521
|
+
var query = "";
|
|
5522
|
+
if (db_used) {
|
|
5523
|
+
switch (db_used) {
|
|
5524
|
+
case 'SQLITE':
|
|
5525
|
+
query = insertSiteBySetSQLite(id_device);
|
|
5526
|
+
break;
|
|
5527
|
+
case 'MYSQL':
|
|
5528
|
+
query = insertSiteBySetMySQL(id_device);
|
|
5529
|
+
break;
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
return query;
|
|
5533
|
+
}
|
|
4928
5534
|
//End define insertSiteBySet
|
|
4929
5535
|
// Define insertSiteBySet
|
|
4930
5536
|
function insertSiteBySetParamSQLite(id_device, id_site, id_place, start_date) {
|
|
@@ -4941,6 +5547,20 @@ function insertSiteBySetParamMySQL(id_device) {
|
|
|
4941
5547
|
query += "where ds.id_maindevice = :id_device";
|
|
4942
5548
|
return query;
|
|
4943
5549
|
}
|
|
5550
|
+
function insertSiteBySetParam(db_used,id_device) {
|
|
5551
|
+
var query = "";
|
|
5552
|
+
if (db_used) {
|
|
5553
|
+
switch (db_used) {
|
|
5554
|
+
case 'SQLITE':
|
|
5555
|
+
query = insertSiteBySetParamSQLite(id_device);
|
|
5556
|
+
break;
|
|
5557
|
+
case 'MYSQL':
|
|
5558
|
+
query = insertSiteBySetParamMySQL(id_device);
|
|
5559
|
+
break;
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
return query;
|
|
5563
|
+
}
|
|
4944
5564
|
//End define insertSiteBySetParam
|
|
4945
5565
|
//Define getDeviceAsSite
|
|
4946
5566
|
function getDeviceAsSiteSQLite(id_device) {
|
|
@@ -4953,6 +5573,20 @@ function getDeviceAsSiteMySQL(id_device) {
|
|
|
4953
5573
|
query += "where das.id_device = :id_device";
|
|
4954
5574
|
return query;
|
|
4955
5575
|
}
|
|
5576
|
+
function getDeviceAsSite(db_used,id_device) {
|
|
5577
|
+
var query = "";
|
|
5578
|
+
if (db_used) {
|
|
5579
|
+
switch (db_used) {
|
|
5580
|
+
case 'SQLITE':
|
|
5581
|
+
query = getDeviceAsSiteSQLite(id_device);
|
|
5582
|
+
break;
|
|
5583
|
+
case 'MYSQL':
|
|
5584
|
+
query = getDeviceAsSiteMySQL(id_device);
|
|
5585
|
+
break;
|
|
5586
|
+
}
|
|
5587
|
+
}
|
|
5588
|
+
return query;
|
|
5589
|
+
}
|
|
4956
5590
|
//End define getDeviceAsSite
|
|
4957
5591
|
// Define getLastSiteForDevice
|
|
4958
5592
|
function getLastSiteForDeviceSQLite(id_device) {
|
|
@@ -4967,6 +5601,20 @@ function getLastSiteForDeviceMySQL(id_device) {
|
|
|
4967
5601
|
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
|
|
4968
5602
|
return query;
|
|
4969
5603
|
}
|
|
5604
|
+
function getLastSiteForDevice(db_used,id_device) {
|
|
5605
|
+
var query = "";
|
|
5606
|
+
if (db_used) {
|
|
5607
|
+
switch (db_used) {
|
|
5608
|
+
case 'SQLITE':
|
|
5609
|
+
query = getLastSiteForDeviceSQLite(id_device);
|
|
5610
|
+
break;
|
|
5611
|
+
case 'MYSQL':
|
|
5612
|
+
query = getLastSiteForDeviceMySQL(id_device);
|
|
5613
|
+
break;
|
|
5614
|
+
}
|
|
5615
|
+
}
|
|
5616
|
+
return query;
|
|
5617
|
+
}
|
|
4970
5618
|
// End define getLastSiteForDevice
|
|
4971
5619
|
|
|
4972
5620
|
|
|
@@ -4997,6 +5645,20 @@ function queryStatisticMySQL(list_types) {
|
|
|
4997
5645
|
query += "group by Tipo";
|
|
4998
5646
|
return query;
|
|
4999
5647
|
}
|
|
5648
|
+
function queryStatistic(db_used,list_types) {
|
|
5649
|
+
var query = "";
|
|
5650
|
+
if (db_used) {
|
|
5651
|
+
switch (db_used) {
|
|
5652
|
+
case 'SQLITE':
|
|
5653
|
+
query = queryStatisticSQLite(list_types);
|
|
5654
|
+
break;
|
|
5655
|
+
case 'MYSQL':
|
|
5656
|
+
query = queryStatisticMySQL(list_types);
|
|
5657
|
+
break;
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
return query;
|
|
5661
|
+
}
|
|
5000
5662
|
//End Get Devices for Statistics
|
|
5001
5663
|
//Get Inventary for Statistics
|
|
5002
5664
|
function queryStatisticInventarySQLite() {
|
|
@@ -5009,6 +5671,20 @@ function queryStatisticInventaryMySQL() {
|
|
|
5009
5671
|
query += "where (is_removed is null or is_removed = 0) ";
|
|
5010
5672
|
return query;
|
|
5011
5673
|
}
|
|
5674
|
+
function queryStatisticInventary(db_used) {
|
|
5675
|
+
var query = "";
|
|
5676
|
+
if (db_used) {
|
|
5677
|
+
switch (db_used) {
|
|
5678
|
+
case 'SQLITE':
|
|
5679
|
+
query = queryStatisticInventarySQLite();
|
|
5680
|
+
break;
|
|
5681
|
+
case 'MYSQL':
|
|
5682
|
+
query = queryStatisticInventaryMySQL();
|
|
5683
|
+
break;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
return query;
|
|
5687
|
+
}
|
|
5012
5688
|
//End Get Inventary for Statistics
|
|
5013
5689
|
//Get Devices Statistics bt Status
|
|
5014
5690
|
function queryStatisticsDeviceStatusSQLite() {
|
|
@@ -5022,6 +5698,20 @@ function queryStatisticsDeviceStatusSQLite() {
|
|
|
5022
5698
|
}
|
|
5023
5699
|
function queryStatisticsDeviceStatusMySQL() {
|
|
5024
5700
|
}
|
|
5701
|
+
function queryStatisticsDeviceStatus(db_used) {
|
|
5702
|
+
var query = "";
|
|
5703
|
+
if (db_used) {
|
|
5704
|
+
switch (db_used) {
|
|
5705
|
+
case 'SQLITE':
|
|
5706
|
+
query = queryStatisticsDeviceStatusSQLite();
|
|
5707
|
+
break;
|
|
5708
|
+
case 'MYSQL':
|
|
5709
|
+
query = queryStatisticsDeviceStatusMySQL();
|
|
5710
|
+
break;
|
|
5711
|
+
}
|
|
5712
|
+
}
|
|
5713
|
+
return query;
|
|
5714
|
+
}
|
|
5025
5715
|
|
|
5026
5716
|
function tokenizer(marker, input, marker2) {
|
|
5027
5717
|
var retValue = "";
|
|
@@ -5227,9 +5917,6 @@ function getDevicesInUse(db_used) {
|
|
|
5227
5917
|
break;
|
|
5228
5918
|
}
|
|
5229
5919
|
}
|
|
5230
|
-
else {
|
|
5231
|
-
query = getDevicesInUseSQLite();
|
|
5232
|
-
}
|
|
5233
5920
|
return query;
|
|
5234
5921
|
}
|
|
5235
5922
|
|
|
@@ -5267,9 +5954,6 @@ function getDevicesInUseByPlaces(db_used) {
|
|
|
5267
5954
|
break;
|
|
5268
5955
|
}
|
|
5269
5956
|
}
|
|
5270
|
-
else {
|
|
5271
|
-
query = getDevicesInUseByPlacesSQLite();
|
|
5272
|
-
}
|
|
5273
5957
|
return query;
|
|
5274
5958
|
}
|
|
5275
5959
|
|
|
@@ -5285,6 +5969,22 @@ function getDatiAcquistoDeviceMySQL(id_device) {
|
|
|
5285
5969
|
return query;
|
|
5286
5970
|
}
|
|
5287
5971
|
|
|
5972
|
+
function getDatiAcquistoDevice(db_used,id_device) {
|
|
5973
|
+
var query = "";
|
|
5974
|
+
if (db_used) {
|
|
5975
|
+
switch (db_used) {
|
|
5976
|
+
case 'SQLITE':
|
|
5977
|
+
query = getDatiAcquistoDeviceSQLite(id_device);
|
|
5978
|
+
break;
|
|
5979
|
+
case 'MYSQL':
|
|
5980
|
+
query = getDatiAcquistoDeviceMySQL(id_device);
|
|
5981
|
+
break;
|
|
5982
|
+
}
|
|
5983
|
+
}
|
|
5984
|
+
return query;
|
|
5985
|
+
}
|
|
5986
|
+
|
|
5987
|
+
|
|
5288
5988
|
//End reports
|
|
5289
5989
|
function getPackageJsVersion() {
|
|
5290
5990
|
var pjson = require('../package.json');
|
|
@@ -5368,28 +6068,17 @@ module.exports = {
|
|
|
5368
6068
|
getDevicesSelectForInventarioRawById,
|
|
5369
6069
|
getBeniConsumo,
|
|
5370
6070
|
getBeniConsumoNotNull,
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
insertConnectionSetMySQL,
|
|
5383
|
-
updateConnectionSetSQLite,
|
|
5384
|
-
updateConnectionSetMySQL,
|
|
5385
|
-
removeConnectionSetSQLite,
|
|
5386
|
-
removeConnectionSetMySQL,
|
|
5387
|
-
getConnectionByIdSetSQLite,
|
|
5388
|
-
getConnectionByIdSetMySQL,
|
|
5389
|
-
getConnectionSetByIdSQLite,
|
|
5390
|
-
getConnectionSetByIdMySQL,
|
|
5391
|
-
queryDetailsByIdDeviceSQLite,
|
|
5392
|
-
queryDetailsByIdDeviceMySQL,
|
|
6071
|
+
getBeneConsumoUsato,
|
|
6072
|
+
getBeneConsumoById,
|
|
6073
|
+
existBeneAbbinato,
|
|
6074
|
+
insertBeneConsumoAbbinato,
|
|
6075
|
+
updateBeneConsumoAbbinato,
|
|
6076
|
+
insertConnectionSet,
|
|
6077
|
+
updateConnectionSet,
|
|
6078
|
+
removeConnectionSet,
|
|
6079
|
+
getConnectionByIdSet,
|
|
6080
|
+
getConnectionSetById,
|
|
6081
|
+
queryDetailsByIdDevice,
|
|
5393
6082
|
//
|
|
5394
6083
|
queryDocumentsIdDevice,
|
|
5395
6084
|
selectDocumentoById,
|
|
@@ -5418,86 +6107,51 @@ module.exports = {
|
|
|
5418
6107
|
removeDismissioneDeviceFromDismissione,
|
|
5419
6108
|
queryLastDismissioneId,
|
|
5420
6109
|
//
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
getBeniConsumoByIdDeviceMySQL,
|
|
5425
|
-
queryConsegneByIdDeviceSQLite,
|
|
5426
|
-
queryConsegneByIdDeviceMySQL,
|
|
6110
|
+
assignCategoryFromDB,
|
|
6111
|
+
getBeniConsumoByIdDevice,
|
|
6112
|
+
queryConsegneByIdDevice,
|
|
5427
6113
|
queryFornitoriGestoriCombo,
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
querySelectGestioniDeviceByIdDeviceSQLite,
|
|
5435
|
-
querySelectGestioniDeviceByIdDeviceMySQL,
|
|
5436
|
-
queryConsegneSQLite,
|
|
5437
|
-
queryConsegneMySQL,
|
|
5438
|
-
queryConsegnaByIdSQLite,
|
|
5439
|
-
queryConsegnaByIdMySQL,
|
|
6114
|
+
queryCloseGestioneDevice,
|
|
6115
|
+
queryInsertGestioneDevice,
|
|
6116
|
+
querySelectExistsGestioneDeviceByIds,
|
|
6117
|
+
querySelectGestioniDeviceByIdDevice,
|
|
6118
|
+
queryConsegne,
|
|
6119
|
+
queryConsegnaById,
|
|
5440
6120
|
queryDeviceStatusCombo,
|
|
5441
6121
|
queryUsers,
|
|
5442
6122
|
queryFunctions,
|
|
5443
6123
|
queryAllFunctions,
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
updateDeviceInterventoSQLite,
|
|
5449
|
-
updateDeviceInterventoMySQL,
|
|
5450
|
-
removeDeviceInterventoSQLite,
|
|
5451
|
-
removeDeviceInterventoMySQL,
|
|
6124
|
+
queryInterventoById,
|
|
6125
|
+
insertDeviceIntervento,
|
|
6126
|
+
updateDeviceIntervento,
|
|
6127
|
+
removeDeviceIntervento,
|
|
5452
6128
|
//
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
getAdapterTypesMySQL,
|
|
5459
|
-
getStorageTypesSQLite,
|
|
5460
|
-
getStorageTypesMySQL,
|
|
5461
|
-
getLaboratorioByIdSiteSQLite,
|
|
5462
|
-
getLaboratorioByIdSiteMySQL,
|
|
6129
|
+
getConnectionTypes,
|
|
6130
|
+
getConnectionProtocols,
|
|
6131
|
+
getAdapterTypes,
|
|
6132
|
+
getStorageTypes,
|
|
6133
|
+
getLaboratorioByIdSite,
|
|
5463
6134
|
getCategories,
|
|
5464
|
-
|
|
5465
|
-
getCategoriesByIdDeviceMySQL,
|
|
6135
|
+
getCategoriesByIdDevice,
|
|
5466
6136
|
createConsegnaMySQLObj,
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
removeConsegnaSQLite,
|
|
5472
|
-
removeConsegnaMySQL,
|
|
5473
|
-
queryLastConsegnaIdSQLite,
|
|
5474
|
-
queryLastConsegnaIdMySQL,
|
|
6137
|
+
insertConsegna,
|
|
6138
|
+
updateConsegna,
|
|
6139
|
+
removeConsegna,
|
|
6140
|
+
queryLastConsegnaId,
|
|
5475
6141
|
//
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
getDeviceAsSiteMySQL,
|
|
5486
|
-
getLastSiteForDeviceSQLite,
|
|
5487
|
-
getLastSiteForDeviceMySQL,
|
|
5488
|
-
querySitesLabSQLite,
|
|
5489
|
-
querySitesLabMySQL,
|
|
5490
|
-
getSiteByIdSQLite,
|
|
5491
|
-
getSiteByIdMySQL,
|
|
5492
|
-
getSitesSelectComboSQLite,
|
|
5493
|
-
getSitesSelectComboMySQL,
|
|
6142
|
+
removeSiteBySet,
|
|
6143
|
+
updateSiteBySet,
|
|
6144
|
+
insertSiteBySet,
|
|
6145
|
+
insertSiteBySetParam,
|
|
6146
|
+
getDeviceAsSite,
|
|
6147
|
+
getLastSiteForDevice,
|
|
6148
|
+
querySitesLab,
|
|
6149
|
+
getSiteById,
|
|
6150
|
+
getSitesSelectCombo,
|
|
5494
6151
|
verifyPrevDeviceSite,
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
updateDeviceSiteMySQL,
|
|
5499
|
-
removeDeviceSiteSQLite,
|
|
5500
|
-
removeDeviceSiteMySQL,
|
|
6152
|
+
insertDeviceSite,
|
|
6153
|
+
updateDeviceSite,
|
|
6154
|
+
removeDeviceSite,
|
|
5501
6155
|
queryPlaces,
|
|
5502
6156
|
queryFloorsByPlace,
|
|
5503
6157
|
queryFunzioneByPlaceAndFloor,
|
|
@@ -5507,17 +6161,13 @@ module.exports = {
|
|
|
5507
6161
|
querySitesWithDefaults,
|
|
5508
6162
|
getPorteByIdSite,
|
|
5509
6163
|
//
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
queryStatisticInventaryMySQL,
|
|
5514
|
-
queryStatisticsDeviceStatusSQLite,
|
|
5515
|
-
queryStatisticsDeviceStatusMySQL,
|
|
6164
|
+
queryStatistic,
|
|
6165
|
+
queryStatisticInventary,
|
|
6166
|
+
queryStatisticsDeviceStatus,
|
|
5516
6167
|
getPropertiesFromBLOB,
|
|
5517
6168
|
getOpSystemFromBLOB,
|
|
5518
6169
|
getAllPropertiesFromBLOB,
|
|
5519
|
-
|
|
5520
|
-
getDatiAcquistoDeviceMySQL,
|
|
6170
|
+
getDatiAcquistoDevice,
|
|
5521
6171
|
getPackageJsVersion
|
|
5522
6172
|
};
|
|
5523
6173
|
// end of source
|