@things-factory/operato-wms 4.3.708 → 4.3.725
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/client/pages/order/release-order/b2c/b2c-order-requests.js +30 -13
- package/client/pages/report/analysis-picking-packing-report.js +76 -79
- package/client/pages/report/billing-module-report.js +46 -49
- package/client/pages/report/costing-report.js +22 -14
- package/client/pages/report/inbound-order-details-report.js +18 -14
- package/client/pages/report/inbound-serial-number-report.js +24 -16
- package/client/pages/report/inventory-pallet-report.js +17 -12
- package/client/pages/report/inventory-pallet-storage-report.js +17 -12
- package/client/pages/report/inventory-report.js +28 -19
- package/client/pages/report/inventory-summary-report.js +20 -11
- package/client/pages/report/job-sheet-list.js +26 -15
- package/client/pages/report/manifest-report.js +20 -14
- package/client/pages/report/order-vas-report.js +18 -23
- package/client/pages/report/outbound-order-details-report.js +27 -34
- package/client/pages/report/outbound-serial-number-report.js +25 -17
- package/client/pages/report/product-label-report.js +17 -12
- package/client/pages/report/shortage-report.js +13 -6
- package/client/pages/report/tote-loading-qc-report.js +23 -21
- package/client/pages/report/vas-report.js +15 -10
- package/client/pages/report/volume-summary-report.js +23 -21
- package/config.development.js +117 -85
- package/package.json +50 -50
|
@@ -28,6 +28,13 @@ const HEADER_JSON = {
|
|
|
28
28
|
Accept: 'application/json'
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
function formatLocalDate(date = new Date()) {
|
|
32
|
+
const year = date.getFullYear()
|
|
33
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
34
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
35
|
+
return `${year}-${month}-${day}`
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
|
|
32
39
|
static get styles() {
|
|
33
40
|
return [
|
|
@@ -124,16 +131,29 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
|
|
|
124
131
|
let { params } = lifecycle
|
|
125
132
|
if (params && this._searchFields) {
|
|
126
133
|
if (params.range) {
|
|
127
|
-
|
|
134
|
+
const today = new Date()
|
|
135
|
+
params.toDate = formatLocalDate(today)
|
|
128
136
|
switch (params.range) {
|
|
129
137
|
case '1d':
|
|
130
|
-
|
|
138
|
+
{
|
|
139
|
+
const from = new Date()
|
|
140
|
+
from.setDate(from.getDate() - 1)
|
|
141
|
+
params.fromDate = formatLocalDate(from)
|
|
142
|
+
}
|
|
131
143
|
break
|
|
132
144
|
case '1w':
|
|
133
|
-
|
|
145
|
+
{
|
|
146
|
+
const from = new Date()
|
|
147
|
+
from.setDate(from.getDate() - 7)
|
|
148
|
+
params.fromDate = formatLocalDate(from)
|
|
149
|
+
}
|
|
134
150
|
break
|
|
135
151
|
case '1m':
|
|
136
|
-
|
|
152
|
+
{
|
|
153
|
+
const from = new Date()
|
|
154
|
+
from.setMonth(from.getMonth() - 1)
|
|
155
|
+
params.fromDate = formatLocalDate(from)
|
|
156
|
+
}
|
|
137
157
|
break
|
|
138
158
|
default:
|
|
139
159
|
break
|
|
@@ -207,7 +227,7 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
|
|
|
207
227
|
value: (() => {
|
|
208
228
|
let date = new Date()
|
|
209
229
|
date.setMonth(date.getMonth() - 1)
|
|
210
|
-
return date
|
|
230
|
+
return formatLocalDate(date)
|
|
211
231
|
})(),
|
|
212
232
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
213
233
|
},
|
|
@@ -220,15 +240,15 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
|
|
|
220
240
|
min: (() => {
|
|
221
241
|
let date = new Date()
|
|
222
242
|
date.setMonth(date.getMonth() - 1)
|
|
223
|
-
return date
|
|
243
|
+
return formatLocalDate(date)
|
|
224
244
|
})(),
|
|
225
245
|
max: (() => {
|
|
226
246
|
let date = new Date()
|
|
227
247
|
date.setDate(date.getDate())
|
|
228
|
-
return date
|
|
248
|
+
return formatLocalDate(date)
|
|
229
249
|
})()
|
|
230
250
|
},
|
|
231
|
-
value: new Date()
|
|
251
|
+
value: formatLocalDate(new Date())
|
|
232
252
|
},
|
|
233
253
|
{
|
|
234
254
|
label: i18next.t('field.transporter'),
|
|
@@ -981,14 +1001,11 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
|
|
|
981
1001
|
if (this._toDateInput?.value < fromDate) this._toDateInput.value = fromDate
|
|
982
1002
|
|
|
983
1003
|
let min = new Date(fromDate)
|
|
984
|
-
let today = new Date()
|
|
985
1004
|
let oneMonthRange = new Date(fromDate)
|
|
986
1005
|
oneMonthRange.setMonth(oneMonthRange.getMonth() + 1)
|
|
987
|
-
oneMonthRange = oneMonthRange
|
|
988
|
-
|
|
989
|
-
today.setHours(0, 0, 0, 0)
|
|
1006
|
+
oneMonthRange = formatLocalDate(oneMonthRange)
|
|
990
1007
|
|
|
991
|
-
min = min
|
|
1008
|
+
min = formatLocalDate(min)
|
|
992
1009
|
|
|
993
1010
|
this._toDateInput.min = min
|
|
994
1011
|
this._toDateInput.value = oneMonthRange
|
|
@@ -2,24 +2,20 @@ import '@things-factory/form-ui'
|
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
3
|
|
|
4
4
|
import gql from 'graphql-tag'
|
|
5
|
-
import {
|
|
6
|
-
css,
|
|
7
|
-
html
|
|
8
|
-
} from 'lit-element'
|
|
5
|
+
import { css, html } from 'lit-element'
|
|
9
6
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
10
7
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
localize
|
|
14
|
-
} from '@things-factory/i18n-base'
|
|
15
|
-
import {
|
|
16
|
-
client,
|
|
17
|
-
gqlContext,
|
|
18
|
-
PageView,
|
|
19
|
-
store
|
|
20
|
-
} from '@things-factory/shell'
|
|
8
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
9
|
+
import { client, gqlContext, PageView, store } from '@things-factory/shell'
|
|
21
10
|
import { isMobileDevice } from '@things-factory/utils'
|
|
22
11
|
|
|
12
|
+
function formatLocalDate(date = new Date()) {
|
|
13
|
+
const year = date.getFullYear()
|
|
14
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
15
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
16
|
+
return `${year}-${month}-${day}`
|
|
17
|
+
}
|
|
18
|
+
|
|
23
19
|
class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(PageView)) {
|
|
24
20
|
static get styles() {
|
|
25
21
|
return css`
|
|
@@ -123,12 +119,12 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
123
119
|
type: 'date',
|
|
124
120
|
props: {
|
|
125
121
|
searchOper: 'eq',
|
|
126
|
-
max: new Date()
|
|
122
|
+
max: formatLocalDate(new Date())
|
|
127
123
|
},
|
|
128
124
|
value: (() => {
|
|
129
|
-
|
|
125
|
+
const date = new Date()
|
|
130
126
|
date.setMonth(date.getMonth() - 1)
|
|
131
|
-
return date
|
|
127
|
+
return formatLocalDate(date)
|
|
132
128
|
})(),
|
|
133
129
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
134
130
|
},
|
|
@@ -139,13 +135,13 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
139
135
|
props: {
|
|
140
136
|
searchOper: 'eq',
|
|
141
137
|
min: (() => {
|
|
142
|
-
|
|
138
|
+
const date = new Date()
|
|
143
139
|
date.setMonth(date.getMonth() - 1)
|
|
144
|
-
return date
|
|
140
|
+
return formatLocalDate(date)
|
|
145
141
|
})(),
|
|
146
|
-
max: new Date()
|
|
142
|
+
max: formatLocalDate(new Date())
|
|
147
143
|
},
|
|
148
|
-
value: new Date()
|
|
144
|
+
value: formatLocalDate(new Date()),
|
|
149
145
|
handlers: { change: this._submit.bind(this) }
|
|
150
146
|
},
|
|
151
147
|
{
|
|
@@ -322,8 +318,8 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
322
318
|
const data = {
|
|
323
319
|
total: response.data.analysisPickingPackingReport.total,
|
|
324
320
|
records:
|
|
325
|
-
response.data.analysisPickingPackingReport.items.map(i=> {
|
|
326
|
-
let hourlyData = JSON.parse(i.hourlyData)
|
|
321
|
+
response.data.analysisPickingPackingReport.items.map(i => {
|
|
322
|
+
let hourlyData = JSON.parse(i.hourlyData)
|
|
327
323
|
return {
|
|
328
324
|
...i,
|
|
329
325
|
...hourlyData
|
|
@@ -339,7 +335,6 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
339
335
|
} catch (e) {
|
|
340
336
|
this._showToast(e)
|
|
341
337
|
}
|
|
342
|
-
|
|
343
338
|
}
|
|
344
339
|
|
|
345
340
|
async _fetchPartners() {
|
|
@@ -396,7 +391,10 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
396
391
|
|
|
397
392
|
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
398
393
|
|
|
399
|
-
|
|
394
|
+
const minDate = new Date(fromDate)
|
|
395
|
+
if (Number.isNaN(minDate.getTime())) return
|
|
396
|
+
|
|
397
|
+
const min = formatLocalDate(minDate)
|
|
400
398
|
this._toDateInput.min = min
|
|
401
399
|
this._submit()
|
|
402
400
|
}
|
|
@@ -408,72 +406,71 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
|
|
|
408
406
|
|
|
409
407
|
async _exportableData() {
|
|
410
408
|
try {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
409
|
+
const getTimeRangeHeader = hour => {
|
|
410
|
+
const now = new Date()
|
|
411
|
+
now.setHours(hour)
|
|
412
|
+
const next = new Date(now)
|
|
413
|
+
next.setHours(now.getHours() + 1)
|
|
414
|
+
return `${now.toLocaleString('en-US', { hour: 'numeric', hour12: true })} - ${next.toLocaleString('en-US', {
|
|
415
|
+
hour: 'numeric',
|
|
416
|
+
hour12: true
|
|
417
|
+
})}`
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const timeRangeColumns = Array.from({ length: 12 }, (_, i) => {
|
|
421
|
+
const startHour = i + 7
|
|
422
|
+
const header = getTimeRangeHeader(startHour)
|
|
423
|
+
const key = `${startHour}`
|
|
424
|
+
return {
|
|
425
|
+
type: 'number',
|
|
426
|
+
name: `${startHour}`,
|
|
427
|
+
header: header,
|
|
428
|
+
key: key,
|
|
429
|
+
record: { editable: false, align: 'center' },
|
|
430
|
+
width: 20
|
|
431
|
+
}
|
|
432
|
+
})
|
|
433
|
+
|
|
434
|
+
const headerSetting = [
|
|
435
|
+
{ header: i18next.t('field.name'), key: 'name', width: 30, type: 'string' },
|
|
436
|
+
...timeRangeColumns,
|
|
437
|
+
{ header: i18next.t('field.total_days_worked'), key: 'totalDaysWorked', width: 30, type: 'float' },
|
|
438
|
+
{ header: i18next.t('field.total_pack'), key: 'totalPacks', width: 30, type: 'float' },
|
|
439
|
+
{ header: i18next.t('field.total_hours_worked'), key: 'totalHoursWorked', width: 30, type: 'float' },
|
|
440
|
+
{ header: i18next.t('field.packing_rate'), key: 'packingRate', width: 30, type: 'float' }
|
|
441
|
+
]
|
|
442
|
+
|
|
443
|
+
let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
|
|
444
|
+
const hourlyData = JSON.parse(itm.hourlyData) // Parse the hourly data from JSON
|
|
445
|
+
const timeRangeData = Array.from({ length: 12 }, (_, i) => {
|
|
446
|
+
const startHour = i + 7
|
|
447
|
+
const key = `${startHour}`
|
|
448
|
+
const value = parseFloat(hourlyData[startHour.toString()]) || 0 // Convert to number
|
|
426
449
|
return {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
key: key,
|
|
431
|
-
record: { editable: false, align: 'center' },
|
|
432
|
-
width: 20
|
|
433
|
-
};
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
const headerSetting = [
|
|
437
|
-
{ header: i18next.t('field.name'), key: 'name', width: 30, type: 'string' },
|
|
438
|
-
...timeRangeColumns,
|
|
439
|
-
{ header: i18next.t('field.total_days_worked'), key: 'totalDaysWorked', width: 30, type: 'float' },
|
|
440
|
-
{ header: i18next.t('field.total_pack'), key: 'totalPacks', width: 30, type: 'float' },
|
|
441
|
-
{ header: i18next.t('field.total_hours_worked'), key: 'totalHoursWorked', width: 30, type: 'float' },
|
|
442
|
-
{ header: i18next.t('field.packing_rate'), key: 'packingRate', width: 30, type: 'float' }
|
|
443
|
-
];
|
|
444
|
-
|
|
445
|
-
let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
|
|
446
|
-
const hourlyData = JSON.parse(itm.hourlyData); // Parse the hourly data from JSON
|
|
447
|
-
const timeRangeData = Array.from({ length: 12 }, (_, i) => {
|
|
448
|
-
const startHour = i + 7;
|
|
449
|
-
const key = `${startHour}`;
|
|
450
|
-
const value = parseFloat(hourlyData[startHour.toString()]) || 0; // Convert to number
|
|
451
|
-
return {
|
|
452
|
-
[key]: value
|
|
453
|
-
};
|
|
454
|
-
}).reduce((obj, item) => ({ ...obj, ...item }), {});
|
|
450
|
+
[key]: value
|
|
451
|
+
}
|
|
452
|
+
}).reduce((obj, item) => ({ ...obj, ...item }), {})
|
|
455
453
|
|
|
456
454
|
return {
|
|
457
|
-
...timeRangeData,
|
|
458
|
-
name: itm.name,
|
|
455
|
+
...timeRangeData,
|
|
456
|
+
name: itm.name,
|
|
459
457
|
totalDaysWorked: itm.totalDaysWorked,
|
|
460
458
|
totalPacks: itm.totalPacks,
|
|
461
459
|
totalHoursWorked: itm.totalHoursWorked,
|
|
462
460
|
packingRate: itm.packingRate
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
|
|
466
464
|
var exportData = {
|
|
467
465
|
header: [...headerSetting],
|
|
468
466
|
data
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
return exportData
|
|
472
|
-
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return exportData
|
|
473
470
|
} catch (e) {
|
|
474
|
-
|
|
471
|
+
this._showToast(e)
|
|
475
472
|
}
|
|
476
|
-
}
|
|
473
|
+
}
|
|
477
474
|
|
|
478
475
|
_showToast({ type, message }) {
|
|
479
476
|
document.dispatchEvent(
|
|
@@ -11,6 +11,13 @@ import { client, gqlContext, PageView, store } from '@things-factory/shell'
|
|
|
11
11
|
import { flattenObject, isMobileDevice } from '@things-factory/utils'
|
|
12
12
|
import { LOCATION_TYPE } from '../constants/location'
|
|
13
13
|
|
|
14
|
+
function formatLocalDate(date = new Date()) {
|
|
15
|
+
const year = date.getFullYear()
|
|
16
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
17
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
18
|
+
return `${year}-${month}-${day}`
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
15
22
|
static get styles() {
|
|
16
23
|
return css`
|
|
@@ -120,12 +127,12 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
120
127
|
type: 'date',
|
|
121
128
|
props: {
|
|
122
129
|
searchOper: 'eq',
|
|
123
|
-
max: new Date()
|
|
130
|
+
max: formatLocalDate(new Date())
|
|
124
131
|
},
|
|
125
132
|
value: (() => {
|
|
126
|
-
|
|
133
|
+
const date = new Date()
|
|
127
134
|
date.setMonth(date.getMonth() - 1)
|
|
128
|
-
return date
|
|
135
|
+
return formatLocalDate(date)
|
|
129
136
|
})(),
|
|
130
137
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
131
138
|
},
|
|
@@ -136,39 +143,35 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
136
143
|
props: {
|
|
137
144
|
searchOper: 'eq',
|
|
138
145
|
min: (() => {
|
|
139
|
-
|
|
146
|
+
const date = new Date()
|
|
140
147
|
date.setMonth(date.getMonth() - 1)
|
|
141
|
-
return date
|
|
148
|
+
return formatLocalDate(date)
|
|
142
149
|
})(),
|
|
143
|
-
max: new Date()
|
|
150
|
+
max: formatLocalDate(new Date())
|
|
144
151
|
},
|
|
145
|
-
value: new Date()
|
|
152
|
+
value: formatLocalDate(new Date())
|
|
146
153
|
},
|
|
147
154
|
{
|
|
148
155
|
label: i18next.t('field.location_type'),
|
|
149
156
|
name: 'locationType',
|
|
150
157
|
type: 'select',
|
|
151
|
-
options: [
|
|
152
|
-
|
|
153
|
-
...Object.values(LOCATION_TYPE)
|
|
154
|
-
],
|
|
155
|
-
props: { searchOper: 'eq'}
|
|
158
|
+
options: [{ value: '' }, ...Object.values(LOCATION_TYPE)],
|
|
159
|
+
props: { searchOper: 'eq' }
|
|
156
160
|
}
|
|
157
161
|
]
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
get reportConfig() {
|
|
161
|
-
|
|
162
165
|
this._gristData.records.forEach((record, i) => {
|
|
163
166
|
console.log(`Record ${i}:`, Object.keys(record))
|
|
164
167
|
})
|
|
165
|
-
|
|
168
|
+
|
|
166
169
|
const dataKeys = this._gristData.records.reduce((keys, item) => {
|
|
167
170
|
Object.keys(item).forEach(key => keys.add(key))
|
|
168
171
|
return keys
|
|
169
172
|
}, new Set())
|
|
170
173
|
|
|
171
|
-
let columns = [
|
|
174
|
+
let columns = [
|
|
172
175
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
173
176
|
{
|
|
174
177
|
type: 'string',
|
|
@@ -183,7 +186,7 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
183
186
|
dataKeys.forEach(key => {
|
|
184
187
|
if (!excludedKeys.has(key)) {
|
|
185
188
|
columns.push({
|
|
186
|
-
type: 'string',
|
|
189
|
+
type: 'string',
|
|
187
190
|
name: key,
|
|
188
191
|
header: key,
|
|
189
192
|
width: 170,
|
|
@@ -193,15 +196,15 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
193
196
|
})
|
|
194
197
|
|
|
195
198
|
const filteredColumns = columns
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
.filter(column => column.imex && dataKeys.has(column.imex.key))
|
|
200
|
+
.sort((a, b) => {
|
|
201
|
+
const aStartsWithTotal = a.header.toLowerCase().startsWith('total')
|
|
202
|
+
const bStartsWithTotal = b.header.toLowerCase().startsWith('total')
|
|
203
|
+
|
|
204
|
+
if (aStartsWithTotal && !bStartsWithTotal) return 1 // Move 'Total' headers down
|
|
205
|
+
if (!aStartsWithTotal && bStartsWithTotal) return -1 // Keep non-'Total' headers first
|
|
206
|
+
return 0
|
|
207
|
+
})
|
|
205
208
|
|
|
206
209
|
return {
|
|
207
210
|
columns: filteredColumns,
|
|
@@ -294,7 +297,6 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
294
297
|
if (existingRecord) {
|
|
295
298
|
existingRecord[propertyName] = itm.quantity
|
|
296
299
|
} else {
|
|
297
|
-
|
|
298
300
|
const propertyName = itm.packingType
|
|
299
301
|
|
|
300
302
|
acc.push({
|
|
@@ -374,38 +376,33 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
374
376
|
|
|
375
377
|
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
376
378
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
today.setHours(0, 0, 0, 0)
|
|
380
|
-
|
|
381
|
-
min = min.toISOString().split('T')[0]
|
|
379
|
+
const minDate = new Date(fromDate)
|
|
380
|
+
if (Number.isNaN(minDate.getTime())) return
|
|
382
381
|
|
|
382
|
+
const min = formatLocalDate(minDate)
|
|
383
383
|
this._toDateInput.min = min
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
async _exportableData() {
|
|
387
387
|
try {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
388
|
+
let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records
|
|
389
|
+
|
|
390
|
+
let header = this.dataGrist._config.columns
|
|
391
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
392
|
+
.map(column => {
|
|
393
|
+
return {
|
|
394
|
+
header: column.imex.header ?? column.imex.key, // Assign key if header is missing
|
|
395
|
+
key: column.imex.key
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
return { header, data }
|
|
400
400
|
} catch (e) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
401
|
+
console.error('Export error:', e)
|
|
402
|
+
this._showToast(e)
|
|
403
|
+
}
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
406
|
_showToast({ type, message }) {
|
|
410
407
|
document.dispatchEvent(
|
|
411
408
|
new CustomEvent('notify', {
|
|
@@ -11,6 +11,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
|
|
|
11
11
|
import { client, gqlContext, PageView, store } from '@things-factory/shell'
|
|
12
12
|
import { flattenObject, isMobileDevice } from '@things-factory/utils'
|
|
13
13
|
|
|
14
|
+
function formatLocalDate(date = new Date()) {
|
|
15
|
+
const year = date.getFullYear()
|
|
16
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
17
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
18
|
+
return `${year}-${month}-${day}`
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
class CostingReport extends connect(store)(localize(i18next)(PageView)) {
|
|
15
22
|
static get styles() {
|
|
16
23
|
return css`
|
|
@@ -107,12 +114,12 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
107
114
|
type: 'date',
|
|
108
115
|
props: {
|
|
109
116
|
searchOper: 'eq',
|
|
110
|
-
max: new Date()
|
|
117
|
+
max: formatLocalDate(new Date())
|
|
111
118
|
},
|
|
112
119
|
value: (() => {
|
|
113
|
-
|
|
120
|
+
const date = new Date()
|
|
114
121
|
date.setMonth(date.getMonth() - 1)
|
|
115
|
-
return date
|
|
122
|
+
return formatLocalDate(date)
|
|
116
123
|
})(),
|
|
117
124
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
118
125
|
},
|
|
@@ -123,17 +130,17 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
123
130
|
props: {
|
|
124
131
|
searchOper: 'eq',
|
|
125
132
|
min: (() => {
|
|
126
|
-
|
|
133
|
+
const date = new Date()
|
|
127
134
|
date.setMonth(date.getMonth() - 1)
|
|
128
|
-
return date
|
|
135
|
+
return formatLocalDate(date)
|
|
129
136
|
})(),
|
|
130
137
|
max: (() => {
|
|
131
|
-
|
|
138
|
+
const max = new Date()
|
|
132
139
|
max.setMonth(max.getMonth() + 1)
|
|
133
|
-
return max
|
|
140
|
+
return formatLocalDate(max)
|
|
134
141
|
})()
|
|
135
142
|
},
|
|
136
|
-
value: new Date()
|
|
143
|
+
value: formatLocalDate(new Date())
|
|
137
144
|
// handlers: { change: this._submit.bind(this) }
|
|
138
145
|
}
|
|
139
146
|
]
|
|
@@ -387,15 +394,16 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
387
394
|
_modifyDateRange(e) {
|
|
388
395
|
const fromDate = e.currentTarget.value
|
|
389
396
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
max.setMonth(max.getMonth() + 2)
|
|
397
|
+
const minDate = new Date(fromDate)
|
|
398
|
+
if (Number.isNaN(minDate.getTime())) return
|
|
393
399
|
|
|
394
|
-
|
|
395
|
-
|
|
400
|
+
const maxDate = new Date(minDate)
|
|
401
|
+
maxDate.setMonth(maxDate.getMonth() + 2)
|
|
396
402
|
|
|
397
|
-
|
|
403
|
+
const min = formatLocalDate(minDate)
|
|
404
|
+
const max = formatLocalDate(maxDate)
|
|
398
405
|
|
|
406
|
+
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
399
407
|
if (this._toDateInput.value > max) this._toDateInput.value = max
|
|
400
408
|
|
|
401
409
|
this._toDateInput.max = max
|
|
@@ -10,6 +10,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
|
|
|
10
10
|
import { client, gqlContext, PageView, store } from '@things-factory/shell'
|
|
11
11
|
import { flattenObject, isMobileDevice } from '@things-factory/utils'
|
|
12
12
|
|
|
13
|
+
function formatLocalDate(date = new Date()) {
|
|
14
|
+
const year = date.getFullYear()
|
|
15
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
16
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
17
|
+
return `${year}-${month}-${day}`
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageView)) {
|
|
14
21
|
static get styles() {
|
|
15
22
|
return css`
|
|
@@ -118,12 +125,12 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
|
|
|
118
125
|
type: 'date',
|
|
119
126
|
props: {
|
|
120
127
|
searchOper: 'eq',
|
|
121
|
-
max: new Date()
|
|
128
|
+
max: formatLocalDate(new Date())
|
|
122
129
|
},
|
|
123
130
|
value: (() => {
|
|
124
|
-
|
|
131
|
+
const date = new Date()
|
|
125
132
|
date.setMonth(date.getMonth() - 1)
|
|
126
|
-
return date
|
|
133
|
+
return formatLocalDate(date)
|
|
127
134
|
})(),
|
|
128
135
|
handlers: { change: this._modifyDateRange.bind(this) }
|
|
129
136
|
},
|
|
@@ -134,17 +141,16 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
|
|
|
134
141
|
props: {
|
|
135
142
|
searchOper: 'eq',
|
|
136
143
|
min: (() => {
|
|
137
|
-
|
|
144
|
+
const date = new Date()
|
|
138
145
|
date.setMonth(date.getMonth() - 1)
|
|
139
|
-
return date
|
|
146
|
+
return formatLocalDate(date)
|
|
140
147
|
})(),
|
|
141
148
|
max: (() => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return max.toISOString().split('T')[0]
|
|
149
|
+
const max = new Date()
|
|
150
|
+
return formatLocalDate(max)
|
|
145
151
|
})()
|
|
146
152
|
},
|
|
147
|
-
value: new Date()
|
|
153
|
+
value: formatLocalDate(new Date()),
|
|
148
154
|
handlers: { change: this._submit.bind(this) }
|
|
149
155
|
},
|
|
150
156
|
{
|
|
@@ -753,12 +759,10 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
|
|
|
753
759
|
|
|
754
760
|
if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
|
|
755
761
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
today.setHours(0, 0, 0, 0)
|
|
759
|
-
|
|
760
|
-
min = min.toISOString().split('T')[0]
|
|
762
|
+
const minDate = new Date(fromDate)
|
|
763
|
+
if (Number.isNaN(minDate.getTime())) return
|
|
761
764
|
|
|
765
|
+
const min = formatLocalDate(minDate)
|
|
762
766
|
this._toDateInput.min = min
|
|
763
767
|
this._submit()
|
|
764
768
|
}
|