@resolveio/server-lib 6.4.3 → 6.4.5-newrole
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/collections/report-builder-report.collection.js +1 -2
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user.collection.js +39 -32
- package/collections/user.collection.js.map +1 -1
- package/methods/accounts.js.map +1 -1
- package/methods/cron-jobs.js +243 -190
- package/methods/cron-jobs.js.map +1 -1
- package/methods/report-builder.js +101 -805
- package/methods/report-builder.js.map +1 -1
- package/models/report-builder-report.model.d.ts +4 -1
- package/models/report-builder-report.model.js.map +1 -1
- package/models/user.model.d.ts +25 -14
- package/models/user.model.js.map +1 -1
- package/package.json +1 -1
- package/publications/report-builder-libraries.js +3 -4
- package/publications/report-builder-libraries.js.map +1 -1
package/methods/cron-jobs.js
CHANGED
|
@@ -200,116 +200,134 @@ function loadCronJobMethods(methodManager) {
|
|
|
200
200
|
sort: sortObj_1
|
|
201
201
|
};
|
|
202
202
|
filters_1 = [];
|
|
203
|
-
report.fields_filter.
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
203
|
+
report.fields_filter.forEach(function (filterAnd) {
|
|
204
|
+
var ors = [];
|
|
205
|
+
filterAnd.ors.filter(function (a) { return !a.field.includes('.$.'); }).forEach(function (filter) {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
207
|
+
if (filter.condition && filter.field && ((filter.value !== null && (!Array.isArray(filter.value) || filter.value.length)) || filter.condition === 'null' || filter.condition === 'nnull')) {
|
|
208
|
+
if (filter.condition === 'bw') {
|
|
209
|
+
if (filter.fieldType === 'Date' && filter.is_rolling) {
|
|
210
|
+
var startDate = null;
|
|
211
|
+
var endDate = null;
|
|
212
|
+
if (filter.rolling_interval === 'Q1') {
|
|
213
|
+
startDate = moment().startOf('year').toDate();
|
|
214
|
+
endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
|
|
215
|
+
}
|
|
216
|
+
else if (filter.rolling_interval === 'Q2') {
|
|
217
|
+
startDate = moment().startOf('year').quarter(2).toDate();
|
|
218
|
+
endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
|
|
219
|
+
}
|
|
220
|
+
else if (filter.rolling_interval === 'Q3') {
|
|
221
|
+
startDate = moment().startOf('year').quarter(3).toDate();
|
|
222
|
+
endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
|
|
223
|
+
}
|
|
224
|
+
else if (filter.rolling_interval === 'Q4') {
|
|
225
|
+
startDate = moment().startOf('year').quarter(4).toDate();
|
|
226
|
+
endDate = moment().endOf('year').toDate();
|
|
227
|
+
}
|
|
228
|
+
else if (filter.rolling_interval === 'Today') {
|
|
229
|
+
startDate = moment().startOf('day').toDate();
|
|
230
|
+
endDate = moment().endOf('day').toDate();
|
|
231
|
+
}
|
|
232
|
+
else if (filter.rolling_interval === 'Yesterday') {
|
|
233
|
+
startDate = moment().subtract(1, 'days').startOf('day').toDate();
|
|
234
|
+
endDate = moment().subtract(1, 'days').endOf('day').toDate();
|
|
235
|
+
}
|
|
236
|
+
else if (filter.rolling_interval === 'Week') {
|
|
237
|
+
startDate = moment().startOf('isoWeek').toDate();
|
|
238
|
+
endDate = moment().endOf('day').toDate();
|
|
239
|
+
}
|
|
240
|
+
else if (filter.rolling_interval === 'Last Week') {
|
|
241
|
+
endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
|
|
242
|
+
startDate = moment(endDate).startOf('isoWeek').toDate();
|
|
243
|
+
}
|
|
244
|
+
else if (filter.rolling_interval === 'Month') {
|
|
245
|
+
startDate = moment().startOf('month').toDate();
|
|
246
|
+
endDate = moment().endOf('day').toDate();
|
|
247
|
+
}
|
|
248
|
+
else if (filter.rolling_interval === 'Last Month') {
|
|
249
|
+
endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
|
|
250
|
+
startDate = moment(endDate).startOf('month').toDate();
|
|
251
|
+
}
|
|
252
|
+
else if (filter.rolling_interval === 'Last 30 Days') {
|
|
253
|
+
endDate = moment().endOf('day').toDate();
|
|
254
|
+
startDate = moment().subtract(30, 'days').startOf('day').toDate();
|
|
255
|
+
}
|
|
256
|
+
else if (filter.rolling_interval === 'Quarter') {
|
|
257
|
+
startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
|
|
258
|
+
endDate = moment().endOf('day').toDate();
|
|
259
|
+
}
|
|
260
|
+
else if (filter.rolling_interval === 'Last Quarter') {
|
|
261
|
+
endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
|
|
262
|
+
startDate = moment(endDate).startOf('quarter').toDate();
|
|
263
|
+
}
|
|
264
|
+
else if (filter.rolling_interval === 'Year') {
|
|
265
|
+
startDate = moment().startOf('year').toDate();
|
|
266
|
+
endDate = moment().endOf('day').toDate();
|
|
267
|
+
}
|
|
268
|
+
else if (filter.rolling_interval === 'Last Year') {
|
|
269
|
+
endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
|
|
270
|
+
startDate = moment(endDate).startOf('year').toDate();
|
|
271
|
+
}
|
|
272
|
+
else if (filter.rolling_interval === 'All') {
|
|
273
|
+
startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
|
|
274
|
+
endDate = moment().endOf('day').toDate();
|
|
275
|
+
}
|
|
276
|
+
ors.push({ $and: [(_a = {}, _a[filter.field] = { '$gte': startDate }, _a), (_b = {}, _b[filter.field] = { '$lte': endDate }, _b)] });
|
|
269
277
|
}
|
|
270
|
-
else
|
|
271
|
-
|
|
272
|
-
endDate = moment().endOf('day').toDate();
|
|
278
|
+
else {
|
|
279
|
+
ors.push({ $and: [(_c = {}, _c[filter.field] = { '$gte': filter.value }, _c), (_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d)] });
|
|
273
280
|
}
|
|
274
|
-
filters_1.push((_a = {}, _a[filter.field] = { '$gte': startDate }, _a));
|
|
275
|
-
filters_1.push((_b = {}, _b[filter.field] = { '$lte': endDate }, _b));
|
|
276
281
|
}
|
|
277
|
-
else if (filter.
|
|
278
|
-
|
|
279
|
-
|
|
282
|
+
else if (filter.condition === 'nnull') {
|
|
283
|
+
var and = [];
|
|
284
|
+
and.push((_e = {}, _e[filter.field] = { '$exists': true }, _e));
|
|
285
|
+
and.push((_f = {}, _f[filter.field] = { '$ne': null }, _f));
|
|
286
|
+
if (filter.fieldType === 'String') {
|
|
287
|
+
and.push((_g = {}, _g[filter.field] = { '$ne': '' }, _g));
|
|
288
|
+
}
|
|
289
|
+
ors.push({ $and: and });
|
|
280
290
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
filters_1.push((_e = {}, _e[filter.field] = { '$exists': true }, _e));
|
|
284
|
-
filters_1.push((_f = {}, _f[filter.field] = { '$ne': null }, _f));
|
|
285
|
-
if (filter.fieldType === 'String') {
|
|
286
|
-
filters_1.push((_g = {}, _g[filter.field] = { '$ne': '' }, _g));
|
|
291
|
+
else if (filter.condition === 'null') {
|
|
292
|
+
ors.push((_h = {}, _h[filter.field] = { '$eq': null }, _h));
|
|
287
293
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
294
|
+
else {
|
|
295
|
+
if (Array.isArray(filter.value)) {
|
|
296
|
+
if (filter.condition === 'ne') {
|
|
297
|
+
var and_1 = [];
|
|
298
|
+
filter.value.forEach(function (filt) {
|
|
299
|
+
var _a, _b;
|
|
300
|
+
and_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
301
|
+
});
|
|
302
|
+
if (and_1.length > 1) {
|
|
303
|
+
ors.push({ $and: and_1 });
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
ors.push(and_1[0]);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
var or_1 = [];
|
|
311
|
+
filter.value.forEach(function (filt) {
|
|
312
|
+
var _a, _b;
|
|
313
|
+
or_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
314
|
+
});
|
|
315
|
+
if (or_1.length > 1) {
|
|
316
|
+
ors.push({ $or: or_1 });
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
ors.push(or_1[0]);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
299
322
|
}
|
|
300
323
|
else {
|
|
301
|
-
|
|
302
|
-
filter.value.forEach(function (filt) {
|
|
303
|
-
var _a, _b;
|
|
304
|
-
or_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
305
|
-
});
|
|
306
|
-
filters_1.push({ $or: or_1 });
|
|
324
|
+
ors.push((_j = {}, _j[filter.field] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
|
|
307
325
|
}
|
|
308
326
|
}
|
|
309
|
-
else {
|
|
310
|
-
filters_1.push((_j = {}, _j[filter.field] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
|
|
311
|
-
}
|
|
312
327
|
}
|
|
328
|
+
});
|
|
329
|
+
if (ors.length) {
|
|
330
|
+
filters_1.push({ $or: ors });
|
|
313
331
|
}
|
|
314
332
|
});
|
|
315
333
|
this.callMethodInternal.call(this, 'reportBuilderBuildTree', report.collection_root, function (errCollTree, collectionTree) {
|
|
@@ -321,104 +339,139 @@ function loadCronJobMethods(methodManager) {
|
|
|
321
339
|
getTreeLeaves(collectionTree.children, allLeaves_1, true);
|
|
322
340
|
var filterArrayFields_1 = [];
|
|
323
341
|
var filterArrays_1 = [];
|
|
324
|
-
report.fields_filter.
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
342
|
+
report.fields_filter.forEach(function (filterAnd) {
|
|
343
|
+
var ors = [];
|
|
344
|
+
filterAnd.ors.filter(function (a) { return a.field.includes('.$.'); }).forEach(function (filter) {
|
|
345
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
346
|
+
filterArrayFields_1.push(allLeaves_1.filter(function (a) { return a.fieldPath === filter.field; })[0]);
|
|
347
|
+
if (filter.condition && filter.field && filter.value !== null) {
|
|
348
|
+
if (filter.condition === 'bw') {
|
|
349
|
+
if (filter.fieldType === 'Date' && filter.is_rolling) {
|
|
350
|
+
var startDate = null;
|
|
351
|
+
var endDate = null;
|
|
352
|
+
if (filter.rolling_interval === 'Q1') {
|
|
353
|
+
startDate = moment().startOf('year').toDate();
|
|
354
|
+
endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
|
|
355
|
+
}
|
|
356
|
+
else if (filter.rolling_interval === 'Q2') {
|
|
357
|
+
startDate = moment().startOf('year').quarter(2).toDate();
|
|
358
|
+
endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
|
|
359
|
+
}
|
|
360
|
+
else if (filter.rolling_interval === 'Q3') {
|
|
361
|
+
startDate = moment().startOf('year').quarter(3).toDate();
|
|
362
|
+
endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
|
|
363
|
+
}
|
|
364
|
+
else if (filter.rolling_interval === 'Q4') {
|
|
365
|
+
startDate = moment().startOf('year').quarter(4).toDate();
|
|
366
|
+
endDate = moment().endOf('year').toDate();
|
|
367
|
+
}
|
|
368
|
+
else if (filter.rolling_interval === 'Today') {
|
|
369
|
+
startDate = moment().startOf('day').toDate();
|
|
370
|
+
endDate = moment().endOf('day').toDate();
|
|
371
|
+
}
|
|
372
|
+
else if (filter.rolling_interval === 'Yesterday') {
|
|
373
|
+
startDate = moment().subtract(1, 'days').startOf('day').toDate();
|
|
374
|
+
endDate = moment().subtract(1, 'days').endOf('day').toDate();
|
|
375
|
+
}
|
|
376
|
+
else if (filter.rolling_interval === 'Week') {
|
|
377
|
+
startDate = moment().startOf('isoWeek').toDate();
|
|
378
|
+
endDate = moment().endOf('day').toDate();
|
|
379
|
+
}
|
|
380
|
+
else if (filter.rolling_interval === 'Last Week') {
|
|
381
|
+
endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
|
|
382
|
+
startDate = moment(endDate).startOf('isoWeek').toDate();
|
|
383
|
+
}
|
|
384
|
+
else if (filter.rolling_interval === 'Month') {
|
|
385
|
+
startDate = moment().startOf('month').toDate();
|
|
386
|
+
endDate = moment().endOf('day').toDate();
|
|
387
|
+
}
|
|
388
|
+
else if (filter.rolling_interval === 'Last Month') {
|
|
389
|
+
endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
|
|
390
|
+
startDate = moment(endDate).startOf('month').toDate();
|
|
391
|
+
}
|
|
392
|
+
else if (filter.rolling_interval === 'Last 30 Days') {
|
|
393
|
+
endDate = moment().endOf('day').toDate();
|
|
394
|
+
startDate = moment().subtract(30, 'days').startOf('day').toDate();
|
|
395
|
+
}
|
|
396
|
+
else if (filter.rolling_interval === 'Quarter') {
|
|
397
|
+
startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
|
|
398
|
+
endDate = moment().endOf('day').toDate();
|
|
399
|
+
}
|
|
400
|
+
else if (filter.rolling_interval === 'Last Quarter') {
|
|
401
|
+
endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
|
|
402
|
+
startDate = moment(endDate).startOf('quarter').toDate();
|
|
403
|
+
}
|
|
404
|
+
else if (filter.rolling_interval === 'Year') {
|
|
405
|
+
startDate = moment().startOf('year').toDate();
|
|
406
|
+
endDate = moment().endOf('day').toDate();
|
|
407
|
+
}
|
|
408
|
+
else if (filter.rolling_interval === 'Last Year') {
|
|
409
|
+
endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
|
|
410
|
+
startDate = moment(endDate).startOf('year').toDate();
|
|
411
|
+
}
|
|
412
|
+
else if (filter.rolling_interval === 'All') {
|
|
413
|
+
startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
|
|
414
|
+
endDate = moment().endOf('day').toDate();
|
|
415
|
+
}
|
|
416
|
+
ors.push({ $and: [(_a = {}, _a[filter.field] = { '$gte': startDate }, _a), (_b = {}, _b[filter.field] = { '$lte': endDate }, _b)] });
|
|
391
417
|
}
|
|
392
|
-
else
|
|
393
|
-
|
|
394
|
-
endDate = moment().endOf('day').toDate();
|
|
418
|
+
else {
|
|
419
|
+
filterArrays_1.push({ $and: [(_c = {}, _c[filter.field] = { '$gte': filter.value }, _c), (_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d)] });
|
|
395
420
|
}
|
|
396
|
-
filterArrays_1.push((_a = {}, _a[filter.field] = { '$gte': startDate }, _a));
|
|
397
|
-
filterArrays_1.push((_b = {}, _b[filter.field] = { '$lte': endDate }, _b));
|
|
398
421
|
}
|
|
399
|
-
else {
|
|
400
|
-
|
|
401
|
-
|
|
422
|
+
else if (filter.condition === 'nnull') {
|
|
423
|
+
var and = [];
|
|
424
|
+
and.push((_e = {}, _e[filter.field.replace(/\.\$/g, '')] = { '$exists': true }, _e));
|
|
425
|
+
and.push((_f = {}, _f[filter.field.replace(/\.\$/g, '')] = { '$ne': null }, _f));
|
|
426
|
+
if (filter.fieldType === 'String') {
|
|
427
|
+
and.push((_g = {}, _g[filter.field.replace(/\.\$/g, '')] = { '$ne': '' }, _g));
|
|
428
|
+
}
|
|
429
|
+
ors.push({ $and: and });
|
|
402
430
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (Array.isArray(filter.value)) {
|
|
406
|
-
var or_2 = [];
|
|
407
|
-
filter.value.forEach(function (filt) {
|
|
408
|
-
var _a, _b;
|
|
409
|
-
or_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
410
|
-
});
|
|
411
|
-
filterArrays_1.push({ $or: or_2 });
|
|
431
|
+
else if (filter.condition === 'null') {
|
|
432
|
+
ors.push((_h = {}, _h[filter.field.replace(/\.\$/g, '')] = { '$eq': null }, _h));
|
|
412
433
|
}
|
|
413
434
|
else {
|
|
414
|
-
|
|
435
|
+
if (Array.isArray(filter.value)) {
|
|
436
|
+
if (filter.condition === 'ne') {
|
|
437
|
+
var and_2 = [];
|
|
438
|
+
filter.value.forEach(function (filt) {
|
|
439
|
+
var _a, _b;
|
|
440
|
+
and_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
441
|
+
});
|
|
442
|
+
if (and_2.length > 1) {
|
|
443
|
+
ors.push({ $and: and_2 });
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
ors.push(and_2[0]);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
var or_2 = [];
|
|
451
|
+
filter.value.forEach(function (filt) {
|
|
452
|
+
var _a, _b;
|
|
453
|
+
or_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
|
|
454
|
+
});
|
|
455
|
+
if (or_2.length > 1) {
|
|
456
|
+
ors.push({ $or: or_2 });
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
ors.push(or_2[0]);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
ors.push((_j = {}, _j[filter.field.replace(/\.\$/g, '')] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
|
|
465
|
+
}
|
|
415
466
|
}
|
|
416
467
|
}
|
|
468
|
+
});
|
|
469
|
+
if (ors.length) {
|
|
470
|
+
filterArrays_1.push({ $or: ors });
|
|
417
471
|
}
|
|
418
472
|
});
|
|
419
|
-
_this.callMethodInternal.call(_this, 'reportBuilderGetResults', report.type, report.collection_root, rootOptions_1, filters_1, filterArrays_1, filterArrayFields_1, report.fields_selected, report.groups_row, report.fields_total, report.fields_link, report.id_date_field || null, report.date_interval || null, report.group_type, function (err, res) {
|
|
473
|
+
_this.callMethodInternal.call(_this, 'reportBuilderGetResults', report.type, report.collection_root, rootOptions_1, filters_1, filterArrays_1, filterArrayFields_1, report.fields_selected, report.fields_custom, report.groups_row, report.fields_total, report.fields_link, report.id_date_field || null, report.date_interval || null, report.group_type, function (err, res) {
|
|
420
474
|
if (res && res[0]) {
|
|
421
|
-
var fields = [];
|
|
422
475
|
var results_1 = res[0].results;
|
|
423
476
|
var reportTotals = res[0].totals;
|
|
424
477
|
if (report.type === 'Tabular') {
|
|
@@ -527,7 +580,7 @@ function loadCronJobMethods(methodManager) {
|
|
|
527
580
|
XLSX.utils.book_append_sheet(wb, ws, 'RB Data');
|
|
528
581
|
var wbout_1 = XLSX.write(wb, { bookType: 'xlsx', type: 'base64' });
|
|
529
582
|
data['emails'].forEach(function (email) {
|
|
530
|
-
_this.sendEmail(email, '
|
|
583
|
+
_this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
|
|
531
584
|
{
|
|
532
585
|
filename: report.report_name + '-' + moment().format('MM-DD-YYYY-hh-mm-A') + '.xlsx',
|
|
533
586
|
content: wbout_1,
|
|
@@ -585,7 +638,7 @@ function loadCronJobMethods(methodManager) {
|
|
|
585
638
|
var now_1 = new Date();
|
|
586
639
|
wb.xlsx.writeBuffer().then(function (buffer) {
|
|
587
640
|
data['emails'].forEach(function (email) {
|
|
588
|
-
_this.sendEmail(email, '
|
|
641
|
+
_this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
|
|
589
642
|
{
|
|
590
643
|
filename: 'Tabular_Group_Report_' + report.report_name + '_' + now_1.getFullYear() + '_' + (now_1.getMonth() + 1) + '_' + now_1.getDate() + '.xlsx',
|
|
591
644
|
content: buffer
|
|
@@ -901,7 +954,7 @@ function loadCronJobMethods(methodManager) {
|
|
|
901
954
|
}
|
|
902
955
|
});
|
|
903
956
|
data['emails'].forEach(function (email) {
|
|
904
|
-
_this.sendEmail(email, '
|
|
957
|
+
_this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
|
|
905
958
|
{
|
|
906
959
|
filename: report.report_name + '-' + moment().format('MM-DD-YYYY-hh-mm-A') + '.csv',
|
|
907
960
|
content: newCSV_1
|