shareneus 1.4.34 → 1.4.35
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/dist/aggregation/aggregation.js +13 -13
- package/dist/excel-files/GSTR-RO-excel.service.js +3 -3
- package/dist/excel-files/GSTR1-excel.service.js +7 -7
- package/dist/excel-files/GSTR2-excel.service.js +6 -6
- package/dist/excel-files/analysis-excel.service.js +4 -4
- package/dist/excel-files/category-wise-item-excel.service.js +10 -10
- package/dist/excel-files/cust-balance-excel.service.js +5 -5
- package/dist/excel-files/cust-wise-sales-details.js +5 -5
- package/dist/excel-files/cust-wise-sales-summary-excel.service.js +5 -5
- package/dist/excel-files/expiring-drugs-excel.service.js +7 -7
- package/dist/excel-files/insurance-expire-excel.service.js +4 -4
- package/dist/excel-files/invoice-wise-excel.service.js +3 -3
- package/dist/excel-files/item-wise-doctor-sale-excel.service.js +7 -7
- package/dist/excel-files/item-wise-mout-details.js +4 -4
- package/dist/excel-files/item-wise-mout-summary.js +4 -4
- package/dist/excel-files/items-wise-sales-excel.service.js +10 -10
- package/dist/excel-files/manf-wise-sales-excel.service.js +4 -4
- package/dist/excel-files/next-service-date-excel.service.js +5 -5
- package/dist/excel-files/operator-wise-details.js +4 -4
- package/dist/excel-files/operator-wise-summary.js +4 -4
- package/dist/excel-files/payment-receive-excel.service.js +6 -6
- package/dist/excel-files/payments-made-excel.service.js +6 -6
- package/dist/excel-files/repair-orders-excel.service.js +10 -10
- package/dist/excel-files/sa-wise-labor-sales-excel.service.js +6 -6
- package/dist/excel-files/sa-wise-part-sales-excel.service.js +6 -6
- package/dist/excel-files/sale-summary-excel.service.js +3 -3
- package/dist/excel-files/sales-by-service-summary-excel.service.js +14 -14
- package/dist/excel-files/scheduled-drug-summary-excel.service.js +8 -8
- package/dist/excel-files/scheduled-drugs-excel.service.js +10 -10
- package/dist/excel-files/spares-issue-excel.service.js +14 -14
- package/dist/excel-files/stock-excel.service.js +3 -3
- package/dist/excel-files/tally-sales-import.service.js +3 -3
- package/dist/excel-files/ven-balance-excel.service.js +3 -3
- package/dist/index.js +9 -9
- package/dist/services/analysis-pdf.service.js +8 -8
- package/dist/services/appointment-total.service.js +37 -37
- package/dist/services/auto-sales-receipt-pdf.service.js +24 -24
- package/dist/services/category-wise-item-pdf.service.js +6 -6
- package/dist/services/checklist-pdf.js +3 -3
- package/dist/services/cn-print.service.js +33 -33
- package/dist/services/consultation-fee-receipt.service.js +16 -16
- package/dist/services/consultation-full-pdf.service.js +10 -10
- package/dist/services/consultation-letterhead-pdf.service.js +15 -15
- package/dist/services/consultation-pdf.service.js +15 -15
- package/dist/services/credit-note-pdf.service.js +16 -16
- package/dist/services/credit-note-totals.service.js +31 -31
- package/dist/services/cust-wise-sales-details-pdf.service.js +8 -8
- package/dist/services/cust-wise-sales-summary-pdf.service.js +7 -7
- package/dist/services/customer-balances-pdf.service.js +7 -7
- package/dist/services/dc-landscape-pdf.service.js +28 -28
- package/dist/services/dc-landscape-without-price-pdf.service.js +24 -24
- package/dist/services/dc-without-price-pdf.service.js +15 -15
- package/dist/services/debit-note-pdf.service.js +14 -14
- package/dist/services/debit-note-print.service.js +33 -33
- package/dist/services/debit-note-totals.service.js +28 -28
- package/dist/services/delivery-challan-pdf.service.js +16 -16
- package/dist/services/delivery-challan-print.service.js +26 -26
- package/dist/services/delivery-challan-totals.js +32 -32
- package/dist/services/equipment-design-pdf.service.js +10 -10
- package/dist/services/est.print-service.js +150 -150
- package/dist/services/expiring-drugs-pdf.service.js +6 -6
- package/dist/services/hc-inv-pdf.service.js +42 -42
- package/dist/services/insurance-expire-pdf.service.js +1 -1
- package/dist/services/inv-pdf.service.js +54 -54
- package/dist/services/inv-print.service.js +59 -59
- package/dist/services/invoice-landscape-pdf.service.js +29 -29
- package/dist/services/invoice-letterhead-pdf.service.js +54 -54
- package/dist/services/invoice-portrait-pdf.js +51 -51
- package/dist/services/invoice-total.service.js +78 -78
- package/dist/services/issue-parts-pdf.service.js +43 -43
- package/dist/services/item-bar-code-label-pdf.js +2 -2
- package/dist/services/item-price-for-pricelist.js +178 -0
- package/dist/services/item-wise-doctor-sale-pdf.service.js +3 -3
- package/dist/services/item-wise-mout-details-pdf.js +3 -3
- package/dist/services/item-wise-mout-summary-pdf.js +2 -2
- package/dist/services/item-wise-sales-pdf.service.js +6 -6
- package/dist/services/manf-wise-sales-pdf.service.js +5 -5
- package/dist/services/meeting-pdf.js +14 -14
- package/dist/services/mout-pdf.service.js +17 -17
- package/dist/services/next-service-date-pdf.service.js +1 -1
- package/dist/services/operator-wise-details-pdf.service.js +8 -8
- package/dist/services/operator-wise-summary-pdf.js +7 -7
- package/dist/services/pack-ship-pdf.service.js +3 -3
- package/dist/services/pack-ship-print.service.js +26 -26
- package/dist/services/payment-pdf.service.js +4 -4
- package/dist/services/payment-report-pdf.service.js +3 -3
- package/dist/services/po-totals.service.js +28 -28
- package/dist/services/pos-receipt-pdf.js +19 -19
- package/dist/services/purchase-order-pdf.service.js +40 -40
- package/dist/services/purchase-order-print.service.js +43 -43
- package/dist/services/purchase-order-totals.service.js +53 -53
- package/dist/services/receipt-print.service.js +5 -5
- package/dist/services/reorder-point-pdf.service.js +3 -3
- package/dist/services/repair-orders-pdf.service.js +3 -3
- package/dist/services/ro-pdf.service.js +80 -80
- package/dist/services/ro-print-service.js +87 -87
- package/dist/services/ro-totals.service.js +123 -123
- package/dist/services/sales-by-service-pdf.service.js +6 -6
- package/dist/services/sales-pdf.service.js +23 -23
- package/dist/services/sales-print.service.js +54 -54
- package/dist/services/sales-receipt-pdf.service.js +25 -25
- package/dist/services/sales-receipt-print.service.js +62 -62
- package/dist/services/sales-totals.service.js +33 -33
- package/dist/services/scheduled-drug-pdf.service.js +7 -7
- package/dist/services/scheduled-drug-summary-pdf.service.js +4 -4
- package/dist/services/separate-wo-print.service.js +9 -9
- package/dist/services/shared-inv-pdf.service.js +44 -44
- package/dist/services/shared-pdf.service.js +119 -119
- package/dist/services/shared-print.service.js +68 -68
- package/dist/services/task-pdf.service.js +10 -10
- package/dist/services/task-reports-pdf.service.js +9 -9
- package/dist/services/technician-pdf.service.js +10 -10
- package/dist/services/technician-print.service.js +9 -9
- package/dist/services/vendor-balances-pdf.service.js +6 -6
- package/dist/services/vendor-credit-note-pdf.service.js +27 -27
- package/dist/services/vendor-credit-note-print.service.js +29 -29
- package/dist/services/vendor-credit-note-totals.service.js +37 -37
- package/dist/services/vendor-debit-note-pdf.service.js +16 -16
- package/dist/services/vendor-debit-note-print.service.js +29 -29
- package/dist/services/vendor-debit-note-totals.service.js +30 -30
- package/dist/{utils → shared}/my-date.js +31 -31
- package/package.json +1 -1
- package/dist/services/pricelist-item-final-price.service.js +0 -177
- /package/dist/{utils/tr-utils.js → shared/utils.js} +0 -0
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MyDate = void 0;
|
|
7
|
-
const
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
8
|
const startOfDay_1 = __importDefault(require("date-fns/startOfDay"));
|
|
9
9
|
const endOfDay_1 = __importDefault(require("date-fns/endOfDay"));
|
|
10
10
|
const subDays_1 = __importDefault(require("date-fns/subDays"));
|
|
@@ -61,7 +61,7 @@ class MyDate {
|
|
|
61
61
|
return (0, differenceInMilliseconds_1.default)(new Date(arg1UTC), new Date(arg2UTC));
|
|
62
62
|
}
|
|
63
63
|
static ConvertUTCDateToUserTZ(UTCDateTime) {
|
|
64
|
-
if (
|
|
64
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
67
|
let utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
@@ -69,25 +69,25 @@ class MyDate {
|
|
|
69
69
|
return converteddate;
|
|
70
70
|
}
|
|
71
71
|
static IsArg1DateBeforeArg2Date(arg1UTCDate, arg2UTCDate) {
|
|
72
|
-
if (
|
|
72
|
+
if (utils_1.TrUtils.IsEmpty(arg1UTCDate) || utils_1.TrUtils.IsEmpty(arg2UTCDate)) {
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
return (0, isBefore_1.default)(new Date(this.GetEndOfArgDay(arg1UTCDate)), new Date(this.GetEndOfArgDay(arg2UTCDate)));
|
|
76
76
|
}
|
|
77
77
|
static IsArg1DateBeforeArg2Month(arg1UTCDate) {
|
|
78
|
-
if (
|
|
78
|
+
if (utils_1.TrUtils.IsEmpty(arg1UTCDate)) {
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
81
|
return (0, isBefore_1.default)(new Date(arg1UTCDate), new Date(this.GetStartOfMonth()));
|
|
82
82
|
}
|
|
83
83
|
static IsArg1DateAndArg2DateSame(arg1UTCDate, arg2UTCDate) {
|
|
84
|
-
if (
|
|
84
|
+
if (utils_1.TrUtils.IsEmpty(arg1UTCDate) || utils_1.TrUtils.IsEmpty(arg2UTCDate)) {
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
return (0, isEqual_1.default)(new Date(arg1UTCDate), new Date(arg2UTCDate));
|
|
88
88
|
}
|
|
89
89
|
static AddToGivenDate(UTCDateTime, IncrementCount, IncrementType) {
|
|
90
|
-
if (
|
|
90
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
return (0, add_1.default)(new Date(UTCDateTime), {
|
|
@@ -95,7 +95,7 @@ class MyDate {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
static SubtractToGivenDate(UTCDateTime, DecrementCount, DecrementType) {
|
|
98
|
-
if (
|
|
98
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
return (0, sub_1.default)(new Date(UTCDateTime), { [DecrementType]: DecrementCount });
|
|
@@ -117,7 +117,7 @@ class MyDate {
|
|
|
117
117
|
return (0, getYear_1.default)(utcDate);
|
|
118
118
|
}
|
|
119
119
|
static ConvertUTCDateToReadable(UTCDateTime) {
|
|
120
|
-
if (
|
|
120
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
let Month = (0, format_1.default)(new Date(UTCDateTime), 'MMM');
|
|
@@ -126,7 +126,7 @@ class MyDate {
|
|
|
126
126
|
return Day + '-' + Month + '-' + Year;
|
|
127
127
|
}
|
|
128
128
|
static ConvertUTCDateToReadableExDate(UTCDateTime) {
|
|
129
|
-
if (
|
|
129
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
132
|
let Month = (0, format_1.default)(new Date(UTCDateTime), 'MM');
|
|
@@ -134,7 +134,7 @@ class MyDate {
|
|
|
134
134
|
return Month + '/' + Year;
|
|
135
135
|
}
|
|
136
136
|
static ConvertUTCDateToReadableExDateTxt(UTCDateTime) {
|
|
137
|
-
if (
|
|
137
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
140
|
let Month = (0, format_1.default)(new Date(UTCDateTime), 'MMM');
|
|
@@ -142,7 +142,7 @@ class MyDate {
|
|
|
142
142
|
return Month + '/' + Year;
|
|
143
143
|
}
|
|
144
144
|
static ConvertUTCDateTimeToReadable(UTCDateTime) {
|
|
145
|
-
if (
|
|
145
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
// console.log(UTCDateTime, this.UserTimeZone);
|
|
@@ -157,7 +157,7 @@ class MyDate {
|
|
|
157
157
|
return Day + '-' + Month + '-' + Year + ', ' + strTime;
|
|
158
158
|
}
|
|
159
159
|
static ConvertUTCToReadable(UTCDateTime) {
|
|
160
|
-
if (
|
|
160
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
161
161
|
return null;
|
|
162
162
|
}
|
|
163
163
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
@@ -172,7 +172,7 @@ class MyDate {
|
|
|
172
172
|
return Day + '-' + Month + '-' + Year + ' , ' + strTime;
|
|
173
173
|
}
|
|
174
174
|
static ConvertUTCDateTimeToTime(UTCDateTime) {
|
|
175
|
-
if (
|
|
175
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
176
176
|
return null;
|
|
177
177
|
}
|
|
178
178
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
@@ -187,21 +187,21 @@ class MyDate {
|
|
|
187
187
|
return (0, getHours_1.default)(utcDate);
|
|
188
188
|
}
|
|
189
189
|
static GetHourFromUTCDateTime(UTCDateTime) {
|
|
190
|
-
if (
|
|
190
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
193
193
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
194
194
|
return (0, getHours_1.default)(utcDate);
|
|
195
195
|
}
|
|
196
196
|
static GetMinutesFromUTCDateTime(UTCDateTime) {
|
|
197
|
-
if (
|
|
197
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
198
198
|
return null;
|
|
199
199
|
}
|
|
200
200
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
201
201
|
return (0, getMinutes_1.default)(utcDate);
|
|
202
202
|
}
|
|
203
203
|
static SetHourAndMinutes(UTCDateTime, Hours, Minutes) {
|
|
204
|
-
if (
|
|
204
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
205
205
|
return null;
|
|
206
206
|
}
|
|
207
207
|
UTCDateTime = (0, setHours_1.default)(new Date(UTCDateTime), Hours);
|
|
@@ -216,7 +216,7 @@ class MyDate {
|
|
|
216
216
|
}
|
|
217
217
|
static ConvertUserTZToUTC(selectedDate, time) {
|
|
218
218
|
// console.log(selectedDate,this.UserTimeZone, new Date(selectedDate));
|
|
219
|
-
if (
|
|
219
|
+
if (utils_1.TrUtils.IsEmpty(selectedDate)) {
|
|
220
220
|
return null;
|
|
221
221
|
}
|
|
222
222
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(selectedDate), this.UserTimeZone);
|
|
@@ -237,7 +237,7 @@ class MyDate {
|
|
|
237
237
|
Day = '0' + Day;
|
|
238
238
|
}
|
|
239
239
|
let date = year + '-' + month + '-' + Day;
|
|
240
|
-
if (
|
|
240
|
+
if (utils_1.TrUtils.IsEmpty(time)) {
|
|
241
241
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(), this.UserTimeZone);
|
|
242
242
|
// console.log(utcDate);
|
|
243
243
|
time = (0, format_1.default)(new Date(utcDate), 'HH:mm:ss.SSS');
|
|
@@ -257,13 +257,13 @@ class MyDate {
|
|
|
257
257
|
return [startDate, endDate];
|
|
258
258
|
}
|
|
259
259
|
static GetMinutesDiffBetween(startutcdate, endutcdate) {
|
|
260
|
-
if (
|
|
260
|
+
if (utils_1.TrUtils.IsEmpty(startutcdate) || utils_1.TrUtils.IsEmpty(endutcdate)) {
|
|
261
261
|
return 0;
|
|
262
262
|
}
|
|
263
263
|
return (0, differenceInMinutes_1.default)(new Date(endutcdate), new Date(startutcdate));
|
|
264
264
|
}
|
|
265
265
|
static GetDaysDiffBetween(startutcdate, endutcdate) {
|
|
266
|
-
if (
|
|
266
|
+
if (utils_1.TrUtils.IsEmpty(startutcdate) || utils_1.TrUtils.IsEmpty(endutcdate)) {
|
|
267
267
|
return 0;
|
|
268
268
|
}
|
|
269
269
|
// var start = moment(startutcdate, 'YYYY-MM-DD');
|
|
@@ -272,7 +272,7 @@ class MyDate {
|
|
|
272
272
|
return (0, differenceInDays_1.default)(new Date(endutcdate), new Date(startutcdate));
|
|
273
273
|
}
|
|
274
274
|
static GetWeekDateAndTime(UTCDateTime) {
|
|
275
|
-
if (
|
|
275
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
276
276
|
return null;
|
|
277
277
|
}
|
|
278
278
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
@@ -285,7 +285,7 @@ class MyDate {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
static GetWeekAndDate(UTCDateTime) {
|
|
288
|
-
if (
|
|
288
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
289
289
|
return null;
|
|
290
290
|
}
|
|
291
291
|
const utcDate = (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone), this.UserTimeZone);
|
|
@@ -360,14 +360,14 @@ class MyDate {
|
|
|
360
360
|
return (0, date_fns_tz_1.zonedTimeToUtc)(utcDate, this.UserTimeZone);
|
|
361
361
|
}
|
|
362
362
|
static GetStartOfYearFromSelectedMonth(Month) {
|
|
363
|
-
if (
|
|
363
|
+
if (utils_1.TrUtils.IsNull(Month)) {
|
|
364
364
|
Month = 0;
|
|
365
365
|
}
|
|
366
366
|
const utcDate = (0, setMonth_1.default)((0, startOfMonth_1.default)(new Date()), Month);
|
|
367
367
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)(utcDate, this.UserTimeZone), this.UserTimeZone);
|
|
368
368
|
}
|
|
369
369
|
static GetEndOfYearFromSelectedMonth(Month) {
|
|
370
|
-
if (
|
|
370
|
+
if (utils_1.TrUtils.IsNull(Month)) {
|
|
371
371
|
Month = 0;
|
|
372
372
|
}
|
|
373
373
|
const utcDate = (0, setMonth_1.default)((0, endOfYear_1.default)(new Date()), 11 + Month);
|
|
@@ -392,14 +392,14 @@ class MyDate {
|
|
|
392
392
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)(utcDate, this.UserTimeZone), this.UserTimeZone);
|
|
393
393
|
}
|
|
394
394
|
static GetTime(argDate) {
|
|
395
|
-
if (
|
|
395
|
+
if (utils_1.TrUtils.IsEmpty(argDate)) {
|
|
396
396
|
return null;
|
|
397
397
|
}
|
|
398
398
|
let utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(argDate), this.UserTimeZone);
|
|
399
399
|
return (0, format_1.default)(utcDate, 'hh:mm a');
|
|
400
400
|
}
|
|
401
401
|
static GetTimeForCalendar(argDate) {
|
|
402
|
-
if (
|
|
402
|
+
if (utils_1.TrUtils.IsEmpty(argDate)) {
|
|
403
403
|
return null;
|
|
404
404
|
}
|
|
405
405
|
let utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(argDate), this.UserTimeZone);
|
|
@@ -428,7 +428,7 @@ class MyDate {
|
|
|
428
428
|
return (0, isSameMonth_1.default)(new Date(arg1Date), new Date(arg2Date)) && (0, isSameYear_1.default)(new Date(arg1Date), new Date(arg2Date));
|
|
429
429
|
}
|
|
430
430
|
static ConvertUTCDateToUserTZCalendar(UTCDateTime) {
|
|
431
|
-
if (
|
|
431
|
+
if (utils_1.TrUtils.IsEmpty(UTCDateTime)) {
|
|
432
432
|
return null;
|
|
433
433
|
}
|
|
434
434
|
const utcDate = (0, date_fns_tz_1.utcToZonedTime)(new Date(UTCDateTime), this.UserTimeZone);
|
|
@@ -472,14 +472,14 @@ class MyDate {
|
|
|
472
472
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)((0, endOfMonth_1.default)(utcDate), this.UserTimeZone), this.UserTimeZone);
|
|
473
473
|
}
|
|
474
474
|
static GetStartOfPrevYearFromSelectedMonth(argDate, Month) {
|
|
475
|
-
if (
|
|
475
|
+
if (utils_1.TrUtils.IsNull(Month)) {
|
|
476
476
|
Month = 0;
|
|
477
477
|
}
|
|
478
478
|
const utcDate = (0, setMonth_1.default)((0, startOfMonth_1.default)((0, date_fns_1.subYears)(new Date(argDate), 1)), Month);
|
|
479
479
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)(utcDate, this.UserTimeZone), this.UserTimeZone);
|
|
480
480
|
}
|
|
481
481
|
static GetEndOfPrevYearFromSelectedMonth(argDate, Month) {
|
|
482
|
-
if (
|
|
482
|
+
if (utils_1.TrUtils.IsNull(Month)) {
|
|
483
483
|
Month = 0;
|
|
484
484
|
}
|
|
485
485
|
const utcDate = (0, setMonth_1.default)((0, endOfMonth_1.default)((0, date_fns_1.subYears)(new Date(argDate), 1)), 11 + Month);
|
|
@@ -536,13 +536,13 @@ class MyDate {
|
|
|
536
536
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)((0, endOfWeek_1.default)(argDate), this.UserTimeZone), this.UserTimeZone);
|
|
537
537
|
}
|
|
538
538
|
static GetStarOfWeek(Day) {
|
|
539
|
-
if (
|
|
539
|
+
if (utils_1.TrUtils.IsNull(Day)) {
|
|
540
540
|
Day = 0;
|
|
541
541
|
}
|
|
542
542
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)((0, date_fns_1.setDay)((0, startOfDay_1.default)(new Date()), Day), this.UserTimeZone), this.UserTimeZone);
|
|
543
543
|
}
|
|
544
544
|
static GetEndOfWeek(Day) {
|
|
545
|
-
if (
|
|
545
|
+
if (utils_1.TrUtils.IsNull(Day)) {
|
|
546
546
|
Day = 0;
|
|
547
547
|
}
|
|
548
548
|
return (0, date_fns_tz_1.zonedTimeToUtc)((0, date_fns_tz_1.utcToZonedTime)((0, date_fns_1.setDay)((0, endOfDay_1.default)(new Date()), 6 + Day), this.UserTimeZone), this.UserTimeZone);
|
package/package.json
CHANGED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PricelistItemFinalPriceService = void 0;
|
|
4
|
-
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
-
const tr_utils_1 = require("../utils/tr-utils");
|
|
6
|
-
class PricelistItemFinalPriceService {
|
|
7
|
-
static GetItemPriceForPriceList(item, priceList, includeMargin) {
|
|
8
|
-
let salePricesByPriceListId = [];
|
|
9
|
-
if ((0, tr_utils_1.IsNotNull)(item.SalePrices) && item.SalePrices.length > 0) {
|
|
10
|
-
salePricesByPriceListId = item.SalePrices.filter((price) => priceList._id.toString() == price.PrListId.toString());
|
|
11
|
-
}
|
|
12
|
-
if (salePricesByPriceListId.length > 0) {
|
|
13
|
-
item.SalePrices = salePricesByPriceListId;
|
|
14
|
-
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
15
|
-
item.Sale["MRP"] = item.Sale.Price;
|
|
16
|
-
if ((0, tr_utils_1.IsNotNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNotNull)(item.SalePrices[0].Disc)) {
|
|
17
|
-
const calculatedPrice = this.CalcDiscPrice(item.SalePrices[0].Price, item.SalePrices[0].Disc);
|
|
18
|
-
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
19
|
-
}
|
|
20
|
-
else if ((0, tr_utils_1.IsNotNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNull)(item.SalePrices[0].Disc)) {
|
|
21
|
-
item.Sale.Price = this.applyRounding(item.SalePrices[0].Price, priceList);
|
|
22
|
-
}
|
|
23
|
-
else if ((0, tr_utils_1.IsNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNotNull)(item.SalePrices[0].Disc)) {
|
|
24
|
-
const calculatedPrice = this.CalcDiscPrice(item.Sale.Price, item.SalePrices[0].Disc);
|
|
25
|
-
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
26
|
-
}
|
|
27
|
-
if (includeMargin) {
|
|
28
|
-
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if (item.Track == 'BN') {
|
|
32
|
-
for (let index = 0; index < item.Batches.length; index++) {
|
|
33
|
-
const element = item.Batches[index];
|
|
34
|
-
let batchSalePrice = item.SalePrices.filter((batch) => priceList._id.toString() == batch.PrListId.toString() && element.BN == batch.BN);
|
|
35
|
-
if (batchSalePrice.length == 0) {
|
|
36
|
-
batchSalePrice = item.SalePrices.filter((batch) => priceList._id.toString() == batch.PrListId.toString() && batch.BN == null);
|
|
37
|
-
}
|
|
38
|
-
element.MRP = element.Price;
|
|
39
|
-
if (batchSalePrice.length > 0) {
|
|
40
|
-
if ((0, tr_utils_1.IsNotNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNotNull)(batchSalePrice[0].Disc)) {
|
|
41
|
-
const calculatedPrice = this.CalcDiscPrice(batchSalePrice[0].Price, batchSalePrice[0].Disc);
|
|
42
|
-
element.Price = this.applyRounding(calculatedPrice, priceList);
|
|
43
|
-
}
|
|
44
|
-
else if ((0, tr_utils_1.IsNotNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNull)(batchSalePrice[0].Disc)) {
|
|
45
|
-
element.Price = this.applyRounding(batchSalePrice[0].Price, priceList);
|
|
46
|
-
}
|
|
47
|
-
else if ((0, tr_utils_1.IsNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNotNull)(batchSalePrice[0].Disc)) {
|
|
48
|
-
const calculatedPrice = this.CalcDiscPrice(element.Price, batchSalePrice[0].Disc);
|
|
49
|
-
element.Price = this.applyRounding(calculatedPrice, priceList);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (includeMargin) {
|
|
53
|
-
element.Margin = this.GetMarginValue(element.Price, element.Cost);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return item;
|
|
58
|
-
}
|
|
59
|
-
return this.calculatePriceBasedOnPriceList(item, priceList, includeMargin);
|
|
60
|
-
}
|
|
61
|
-
static calculatePriceBasedOnPriceList(item, priceList, includeMargin) {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
if (priceList != null) {
|
|
64
|
-
if (priceList.PrCalc == "FIXED") {
|
|
65
|
-
if (priceList.Fixed && (0, tr_utils_1.IsNotNull)(priceList.Fixed.Price)) {
|
|
66
|
-
const fixedPrice = priceList.Fixed.Price;
|
|
67
|
-
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
68
|
-
item.Sale["MRP"] = item.Sale.Price;
|
|
69
|
-
item.Sale.Price = this.applyRounding(fixedPrice, priceList);
|
|
70
|
-
if (includeMargin) {
|
|
71
|
-
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else if (item.Track == 'BN') {
|
|
75
|
-
for (let batch of item.Batches) {
|
|
76
|
-
batch.MRP = batch.Price;
|
|
77
|
-
batch.Price = this.applyRounding(fixedPrice, priceList);
|
|
78
|
-
if (includeMargin) {
|
|
79
|
-
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else if (priceList.PrCalc == "DISC") {
|
|
86
|
-
const calcDisc = (_a = priceList.CalcDisc) !== null && _a !== void 0 ? _a : {};
|
|
87
|
-
let discPerc = calcDisc.Perc || 0;
|
|
88
|
-
let markUp = (_b = calcDisc.Mark) !== null && _b !== void 0 ? _b : false;
|
|
89
|
-
if (priceList.BasedOn == "SP") {
|
|
90
|
-
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
91
|
-
item.Sale["MRP"] = item.Sale.Price;
|
|
92
|
-
const calculatedPrice = this.CalcDiscPrice(item.Sale.Price, discPerc, markUp);
|
|
93
|
-
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
94
|
-
if (includeMargin) {
|
|
95
|
-
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else if (item.Track == 'BN') {
|
|
99
|
-
for (let batch of item.Batches) {
|
|
100
|
-
batch.MRP = batch.Price;
|
|
101
|
-
const calculatedPrice = this.CalcDiscPrice(batch.Price, discPerc, markUp);
|
|
102
|
-
batch.Price = this.applyRounding(calculatedPrice, priceList);
|
|
103
|
-
if (includeMargin) {
|
|
104
|
-
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else if (priceList.BasedOn == "PC") {
|
|
110
|
-
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
111
|
-
item.Sale["MRP"] = item.Sale.Price;
|
|
112
|
-
if ((0, tr_utils_1.IsNotNull)(item.Pur) && (0, tr_utils_1.IsNotNull)(item.Pur.Cost)) {
|
|
113
|
-
const calculatedPrice = this.CalcDiscPrice(item.Pur.Cost, discPerc, markUp);
|
|
114
|
-
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
115
|
-
if (includeMargin) {
|
|
116
|
-
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else if (item.Track == 'BN') {
|
|
121
|
-
for (let batch of item.Batches) {
|
|
122
|
-
batch.MRP = batch.Price;
|
|
123
|
-
if ((0, tr_utils_1.IsNotNull)(batch.Cost)) {
|
|
124
|
-
const calculatedPrice = this.CalcDiscPrice(batch.Cost, discPerc, markUp);
|
|
125
|
-
batch.Price = this.applyRounding(calculatedPrice, priceList);
|
|
126
|
-
if (includeMargin) {
|
|
127
|
-
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return item;
|
|
136
|
-
}
|
|
137
|
-
static applyRounding(price, priceList) {
|
|
138
|
-
if (!priceList || !priceList.Round)
|
|
139
|
-
return price;
|
|
140
|
-
switch (priceList.Round) {
|
|
141
|
-
case "-1":
|
|
142
|
-
return price;
|
|
143
|
-
case "0":
|
|
144
|
-
return Math.round(price);
|
|
145
|
-
case "0.99":
|
|
146
|
-
return Math.floor(price) + 0.99;
|
|
147
|
-
case "0.50":
|
|
148
|
-
return Math.round(price * 2) / 2;
|
|
149
|
-
case "0.49":
|
|
150
|
-
return Math.floor(price) + 0.49;
|
|
151
|
-
case "Dec":
|
|
152
|
-
if ((0, tr_utils_1.IsNotNull)(priceList.Deci)) {
|
|
153
|
-
const factor = Math.pow(10, priceList.Deci);
|
|
154
|
-
return Math.round(price * factor) / factor;
|
|
155
|
-
}
|
|
156
|
-
return price;
|
|
157
|
-
default:
|
|
158
|
-
return price;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
static CalcDiscPrice(Price, Disc, MarkUp = false) {
|
|
162
|
-
let PriceValue = 0;
|
|
163
|
-
if (MarkUp) {
|
|
164
|
-
PriceValue = (0, aggregation_1.addition)(Price, (0, aggregation_1.division)((0, aggregation_1.multiply)(Price, Disc), 100));
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
PriceValue = (0, aggregation_1.subtraction)(Price, (0, aggregation_1.division)((0, aggregation_1.multiply)(Price, Disc), 100));
|
|
168
|
-
}
|
|
169
|
-
return PriceValue;
|
|
170
|
-
}
|
|
171
|
-
static GetMarginValue(price, cost) {
|
|
172
|
-
let Margin = 0;
|
|
173
|
-
Margin = (0, aggregation_1.multiply)((0, aggregation_1.division)((0, aggregation_1.subtraction)(price, cost), price), 100);
|
|
174
|
-
return Margin;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
exports.PricelistItemFinalPriceService = PricelistItemFinalPriceService;
|
|
File without changes
|