gemcap-be-common 1.5.74 → 1.5.75
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/classes/sales-item.d.ts +3 -1
- package/classes/sales-item.js +8 -1
- package/classes/sales-item.ts +8 -1
- package/helpers/column-desciptions.helper.js +2 -2
- package/helpers/column-desciptions.helper.ts +2 -2
- package/package.json +1 -1
- package/services/uploads.service.js +1 -1
- package/services/uploads.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/classes/sales-item.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class SalesItem implements ISalesLocal {
|
|
|
17
17
|
unitSalePrice: number;
|
|
18
18
|
salesPeriodStart: Date | null;
|
|
19
19
|
salesPeriodEnd: Date | null;
|
|
20
|
-
constructor(item: Partial<SalesItem>, bbcDate
|
|
20
|
+
constructor(item: Partial<SalesItem>, bbcDate: any, options: {
|
|
21
|
+
[extraOption: string]: string;
|
|
22
|
+
});
|
|
21
23
|
}
|
|
22
24
|
export {};
|
package/classes/sales-item.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SalesItem = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
9
|
const column_desciptions_helper_1 = require("../helpers/column-desciptions.helper");
|
|
9
10
|
const collaterals_enum_1 = require("../enums/collaterals.enum");
|
|
10
11
|
class SalesItem {
|
|
@@ -16,7 +17,13 @@ class SalesItem {
|
|
|
16
17
|
unitSalePrice = 0;
|
|
17
18
|
salesPeriodStart = null;
|
|
18
19
|
salesPeriodEnd = null;
|
|
19
|
-
constructor(item, bbcDate = null) {
|
|
20
|
+
constructor(item, bbcDate = null, options) {
|
|
21
|
+
if (options && options.salesPeriodStart) {
|
|
22
|
+
item.salesPeriodStart = dayjs_1.default.utc(options.salesPeriodStart).toDate();
|
|
23
|
+
}
|
|
24
|
+
if (options && options.salesPeriodEnd) {
|
|
25
|
+
item.salesPeriodEnd = dayjs_1.default.utc(options.salesPeriodEnd).toDate();
|
|
26
|
+
}
|
|
20
27
|
const itemWithDates = (0, column_desciptions_helper_1.convertIntoDates)(item, collaterals_enum_1.ECollaterals.SALES);
|
|
21
28
|
const itemWithoutNulls = lodash_1.default.omitBy(itemWithDates, (value) => value === null);
|
|
22
29
|
Object.assign(this, itemWithoutNulls);
|
package/classes/sales-item.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
2
3
|
|
|
3
4
|
import { convertIntoDates } from '../helpers/column-desciptions.helper';
|
|
4
5
|
import { ECollaterals } from '../enums/collaterals.enum';
|
|
@@ -25,7 +26,13 @@ export class SalesItem implements ISalesLocal {
|
|
|
25
26
|
salesPeriodStart: Date | null = null;
|
|
26
27
|
salesPeriodEnd: Date | null = null;
|
|
27
28
|
|
|
28
|
-
constructor(item: Partial<SalesItem>, bbcDate = null) {
|
|
29
|
+
constructor(item: Partial<SalesItem>, bbcDate = null, options: { [extraOption: string]: string }) {
|
|
30
|
+
if (options && options.salesPeriodStart) {
|
|
31
|
+
item.salesPeriodStart = dayjs.utc(options.salesPeriodStart).toDate();
|
|
32
|
+
}
|
|
33
|
+
if (options && options.salesPeriodEnd) {
|
|
34
|
+
item.salesPeriodEnd = dayjs.utc(options.salesPeriodEnd).toDate();
|
|
35
|
+
}
|
|
29
36
|
const itemWithDates = convertIntoDates(item, ECollaterals.SALES);
|
|
30
37
|
const itemWithoutNulls = _.omitBy(itemWithDates, (value) => value === null);
|
|
31
38
|
Object.assign(this, itemWithoutNulls);
|
|
@@ -260,14 +260,14 @@ exports.COLLATERALS = {
|
|
|
260
260
|
title: 'Sales period start',
|
|
261
261
|
required: true,
|
|
262
262
|
items: [],
|
|
263
|
-
validators: [validators_enums_1.EValidators.
|
|
263
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
db_title: 'salesPeriodEnd',
|
|
267
267
|
title: 'Sales period end',
|
|
268
268
|
required: true,
|
|
269
269
|
items: [],
|
|
270
|
-
validators: [validators_enums_1.EValidators.
|
|
270
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
271
271
|
},
|
|
272
272
|
],
|
|
273
273
|
[collaterals_enum_1.ECollaterals.LOAN_TRANSACTIONS]: [
|
|
@@ -260,14 +260,14 @@ COLLATERALS = {
|
|
|
260
260
|
title: 'Sales period start',
|
|
261
261
|
required: true,
|
|
262
262
|
items: [],
|
|
263
|
-
validators: [EValidators.
|
|
263
|
+
validators: [EValidators.IS_DATE],
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
db_title: 'salesPeriodEnd',
|
|
267
267
|
title: 'Sales period end',
|
|
268
268
|
required: true,
|
|
269
269
|
items: [],
|
|
270
|
-
validators: [EValidators.
|
|
270
|
+
validators: [EValidators.IS_DATE],
|
|
271
271
|
},
|
|
272
272
|
],
|
|
273
273
|
[ECollaterals.LOAN_TRANSACTIONS]: [
|
package/package.json
CHANGED
|
@@ -458,7 +458,7 @@ class UploadsService {
|
|
|
458
458
|
[collaterals_enum_1.ECollaterals.INVENTORY]: () => new inventory_item_1.InventoryItem(row, bbcDate, skuDates),
|
|
459
459
|
[collaterals_enum_1.ECollaterals.RECEIVABLE]: () => new receivable_item_1.ReceivableItem(row, bbcDate),
|
|
460
460
|
[collaterals_enum_1.ECollaterals.ACCOUNT_PAYABLE]: () => new payable_account_item_1.PayableAccountItem(row, bbcDate),
|
|
461
|
-
[collaterals_enum_1.ECollaterals.SALES]: () => new sales_item_1.SalesItem(row, bbcDate),
|
|
461
|
+
[collaterals_enum_1.ECollaterals.SALES]: () => new sales_item_1.SalesItem(row, bbcDate, mapData.extraOptions),
|
|
462
462
|
[collaterals_enum_1.ECollaterals.LOAN_TRANSACTIONS]: async () => {
|
|
463
463
|
const newItem = new bank_transaction_item_1.LoanTransactionItem(row, this.borrowersDB);
|
|
464
464
|
const classErrors = await newItem.initialize();
|
|
@@ -515,7 +515,7 @@ export class UploadsService {
|
|
|
515
515
|
[ECollaterals.INVENTORY]: () => new InventoryItem(row, bbcDate, skuDates),
|
|
516
516
|
[ECollaterals.RECEIVABLE]: () => new ReceivableItem(row, bbcDate),
|
|
517
517
|
[ECollaterals.ACCOUNT_PAYABLE]: () => new PayableAccountItem(row, bbcDate),
|
|
518
|
-
[ECollaterals.SALES]: () => new SalesItem(row, bbcDate),
|
|
518
|
+
[ECollaterals.SALES]: () => new SalesItem(row, bbcDate, mapData.extraOptions),
|
|
519
519
|
[ECollaterals.LOAN_TRANSACTIONS]: async () => {
|
|
520
520
|
const newItem = new LoanTransactionItem(row, this.borrowersDB);
|
|
521
521
|
const classErrors = await newItem.initialize();
|