@dhyasama/totem-models 11.19.0 → 11.21.0
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/Financials.js +19 -2
- package/lib/Organization.js +2 -3
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -901,14 +901,31 @@ module.exports = function(mongoose, config) {
|
|
|
901
901
|
|
|
902
902
|
};
|
|
903
903
|
|
|
904
|
-
Financials.statics.getForCustomer = function getForCustomer(customerId, cb) {
|
|
905
|
-
|
|
904
|
+
Financials.statics.getForCustomer = function getForCustomer(customerId, options, cb) {
|
|
905
|
+
|
|
906
906
|
var self = this;
|
|
907
907
|
|
|
908
908
|
var query = self.find({
|
|
909
909
|
'customer': customerId
|
|
910
910
|
});
|
|
911
911
|
|
|
912
|
+
var dateRangeQuery = {};
|
|
913
|
+
if (options.startDate) {
|
|
914
|
+
var startDate = new Date(options.startDate);
|
|
915
|
+
dateRangeQuery['$gte'] = startDate;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
if (options.endDate) {
|
|
919
|
+
var endDate = new Date(options.endDate);
|
|
920
|
+
dateRangeQuery['$lte'] = endDate;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if (options.startDate || options.endDate) {
|
|
924
|
+
query.where('snapshots').elemMatch({
|
|
925
|
+
submittedOn: dateRangeQuery
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
|
|
912
929
|
query.exec(cb);
|
|
913
930
|
|
|
914
931
|
};
|
package/lib/Organization.js
CHANGED
|
@@ -304,8 +304,7 @@ module.exports = function(mongoose, config) {
|
|
|
304
304
|
shared: [{ type: Schema.ObjectId, ref: 'Financials' }],
|
|
305
305
|
|
|
306
306
|
display: {
|
|
307
|
-
timeframe: { type: String, enum: ['All Years', 'Last 12 Months'], default: 'All Years' }
|
|
308
|
-
group: { type: String, enum: ['Financial Statements', 'Template'], default: 'Financial Statements' }
|
|
307
|
+
timeframe: { type: String, enum: ['All Years', 'Last 12 Months'], default: 'All Years' }
|
|
309
308
|
},
|
|
310
309
|
|
|
311
310
|
emails: [{
|
|
@@ -338,7 +337,7 @@ module.exports = function(mongoose, config) {
|
|
|
338
337
|
description: { type: String, trim: true },
|
|
339
338
|
format: { type: String, enum: [null, 'number', 'money', 'percentage', 'variance'] },
|
|
340
339
|
cumulative: { type: Boolean, default: false },
|
|
341
|
-
|
|
340
|
+
inverse: { type: Boolean, default: false },
|
|
342
341
|
}],
|
|
343
342
|
questions: [{
|
|
344
343
|
_id: false,
|