@shisyamo4131/air-guard-v2-schemas 1.1.0 → 1.2.1
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/package.json +1 -1
- package/src/OperationResult.js +53 -41
- package/src/utils/CutoffDate.js +8 -8
package/package.json
CHANGED
package/src/OperationResult.js
CHANGED
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
* - Provides comprehensive billing calculations including statistics, sales amounts, and tax.
|
|
9
9
|
* - Supports both daily and hourly billing with adjusted quantities.
|
|
10
10
|
* ---------------------------------------------------------------------------
|
|
11
|
-
* @
|
|
11
|
+
* @prop {string|null} siteOperationScheduleId - Associated SiteOperationSchedule document ID
|
|
12
12
|
* - If this OperationResult was created from a SiteOperationSchedule, this property holds that ID.
|
|
13
13
|
* - If this property is set, the instance cannot be deleted.
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
14
|
+
* @prop {boolean} useAdjustedQuantity - Flag to indicate if adjusted quantities are used for billing
|
|
15
|
+
* @prop {number} adjustedQuantityBase - Adjusted quantity for base workers
|
|
16
16
|
* - Quantity used for billing base workers when `useAdjustedQuantity` is true.
|
|
17
|
-
* @
|
|
17
|
+
* @prop {number} adjustedOvertimeBase - Adjusted overtime for base workers
|
|
18
18
|
* - Overtime used for billing base workers when `useAdjustedQuantity` is true.
|
|
19
|
-
* @
|
|
19
|
+
* @prop {number} adjustedQuantityQualified - Adjusted quantity for qualified workers
|
|
20
20
|
* - Quantity used for billing qualified workers when `useAdjustedQuantity` is true.
|
|
21
|
-
* @
|
|
21
|
+
* @prop {number} adjustedOvertimeQualified - Adjusted overtime for qualified workers
|
|
22
22
|
* - Overtime used for billing qualified workers when `useAdjustedQuantity` is true.
|
|
23
|
-
* @
|
|
23
|
+
* @prop {Date} billingDateAt - Billing date
|
|
24
24
|
* ---------------------------------------------------------------------------
|
|
25
25
|
* @computed {Object} statistics - Statistics of workers (read-only)
|
|
26
26
|
* - Contains counts and total work minutes for base and qualified workers, including OJT breakdowns.
|
|
@@ -40,39 +40,39 @@
|
|
|
40
40
|
* - Sum of `salesAmount` and `tax`.
|
|
41
41
|
* ---------------------------------------------------------------------------
|
|
42
42
|
* @inherited - The following properties are inherited from Operation:
|
|
43
|
-
* @
|
|
43
|
+
* @prop {string} siteId - Site document ID (trigger property)
|
|
44
44
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
45
|
-
* @
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
48
|
-
* @
|
|
49
|
-
* @
|
|
45
|
+
* @prop {number} requiredPersonnel - Required number of personnel
|
|
46
|
+
* @prop {boolean} qualificationRequired - Qualification required flag
|
|
47
|
+
* @prop {string} workDescription - Work description
|
|
48
|
+
* @prop {string} remarks - Remarks
|
|
49
|
+
* @prop {Array<OperationResultDetail>} employees - Assigned employees
|
|
50
50
|
* - Array of `OperationResultDetail` instances representing assigned employees
|
|
51
|
-
* @
|
|
51
|
+
* @prop {Array<OperationResultDetail>} outsourcers - Assigned outsourcers
|
|
52
52
|
* - Array of `OperationResultDetail` instances representing assigned outsourcers
|
|
53
53
|
* ---------------------------------------------------------------------------
|
|
54
54
|
* @inherited - The following properties are inherited from Agreement (via Operation):
|
|
55
|
-
* @
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
58
|
-
* @
|
|
59
|
-
* @
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
55
|
+
* @prop {number} unitPriceBase - Base unit price (JPY)
|
|
56
|
+
* @prop {number} overtimeUnitPriceBase - Overtime unit price (JPY/hour)
|
|
57
|
+
* @prop {number} unitPriceQualified - Qualified unit price (JPY)
|
|
58
|
+
* @prop {number} overtimeUnitPriceQualified - Qualified overtime unit price (JPY/hour)
|
|
59
|
+
* @prop {string} billingUnitType - Billing unit type
|
|
60
|
+
* @prop {boolean} includeBreakInBilling - Whether to include break time in billing if `billingUnitType` is `PER_HOUR`.
|
|
61
|
+
* @prop {number} cutoffDate - Cutoff date value from CutoffDate.VALUES
|
|
62
62
|
* - The cutoff date for billing, using values defined in the CutoffDate utility class.
|
|
63
63
|
* ---------------------------------------------------------------------------
|
|
64
64
|
* @inherited - The following properties are inherited from WorkingResult (via Operation):
|
|
65
|
-
* @
|
|
65
|
+
* @prop {Date} dateAt - Date of operation (placement date) (trigger property)
|
|
66
66
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
67
|
-
* @
|
|
68
|
-
* @
|
|
67
|
+
* @prop {string} dayType - Day type (e.g., `WEEKDAY`, `WEEKEND`, `HOLIDAY`)
|
|
68
|
+
* @prop {string} shiftType - `DAY` or `NIGHT` (trigger property)
|
|
69
69
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
70
|
-
* @
|
|
71
|
-
* @
|
|
70
|
+
* @prop {string} startTime - Start time (HH:MM format)
|
|
71
|
+
* @prop {boolean} isStartNextDay - Next day start flag
|
|
72
72
|
* - `true` if the actual work starts the day after the placement date `dateAt`
|
|
73
|
-
* @
|
|
74
|
-
* @
|
|
75
|
-
* @
|
|
73
|
+
* @prop {string} endTime - End time (HH:MM format)
|
|
74
|
+
* @prop {number} breakMinutes - Break time (minutes)
|
|
75
|
+
* @prop {number} regulationWorkMinutes - Regulation work minutes (trigger property)
|
|
76
76
|
* - Indicates the maximum working time treated as regular working hours.
|
|
77
77
|
* - Automatically synchronizes to all `employees` and `outsourcers` when changed.
|
|
78
78
|
* ---------------------------------------------------------------------------
|
|
@@ -188,18 +188,6 @@ import CutoffDate from "./utils/CutoffDate.js";
|
|
|
188
188
|
const classProps = {
|
|
189
189
|
...Operation.classProps,
|
|
190
190
|
...Agreement.classProps,
|
|
191
|
-
// Override Agreement's `cutoffDate` field to be hidden.
|
|
192
|
-
cutoffDate: defField("select", {
|
|
193
|
-
label: "締日区分",
|
|
194
|
-
default: CutoffDate.VALUES.END_OF_MONTH,
|
|
195
|
-
required: true,
|
|
196
|
-
hidden: true,
|
|
197
|
-
component: {
|
|
198
|
-
attrs: {
|
|
199
|
-
items: CutoffDate.OPTIONS,
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
}),
|
|
203
191
|
siteOperationScheduleId: defField("oneLine", { hidden: true }),
|
|
204
192
|
useAdjustedQuantity: defField("check", {
|
|
205
193
|
label: "調整数量を使用",
|
|
@@ -247,7 +235,25 @@ export default class OperationResult extends Operation {
|
|
|
247
235
|
super.afterInitialize();
|
|
248
236
|
|
|
249
237
|
/** Computed properties */
|
|
238
|
+
let _cutoffDate = this.cutoffDate;
|
|
250
239
|
Object.defineProperties(this, {
|
|
240
|
+
cutoffDate: {
|
|
241
|
+
configurable: true,
|
|
242
|
+
enumerable: true,
|
|
243
|
+
get() {
|
|
244
|
+
return _cutoffDate;
|
|
245
|
+
},
|
|
246
|
+
set(v) {
|
|
247
|
+
_cutoffDate = v;
|
|
248
|
+
// Update billingDateAt when cutoffDate changes
|
|
249
|
+
if (this.dateAt) {
|
|
250
|
+
this.billingDateAt = CutoffDate.calculateBillingDateAt(
|
|
251
|
+
this.dateAt,
|
|
252
|
+
this.cutoffDate
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
},
|
|
251
257
|
statistics: {
|
|
252
258
|
configurable: true,
|
|
253
259
|
enumerable: true,
|
|
@@ -423,6 +429,12 @@ export default class OperationResult extends Operation {
|
|
|
423
429
|
});
|
|
424
430
|
}
|
|
425
431
|
|
|
432
|
+
setDateAtCallback(v) {
|
|
433
|
+
super.setDateAtCallback(v);
|
|
434
|
+
if (!this.cutoffDate) return;
|
|
435
|
+
this.billingDateAt = CutoffDate.calculateBillingDateAt(v, this.cutoffDate);
|
|
436
|
+
}
|
|
437
|
+
|
|
426
438
|
/**
|
|
427
439
|
* Override `beforeDelete`.
|
|
428
440
|
* - Prevents deletion if the instance has `siteOperationScheduleId`.
|
package/src/utils/CutoffDate.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* @static {Array} OPTIONS - Options for selection components
|
|
12
12
|
* @static {function} calculateActualCutoffDay - Calculate actual cutoff day for given year/month
|
|
13
13
|
* @static {function} calculateBillingPeriod - Calculate billing period for given date and cutoff
|
|
14
|
-
* @static {function}
|
|
15
|
-
* @static {function}
|
|
14
|
+
* @static {function} calculateBillingDateAt - Calculate cutoff date as Date object for given sales date
|
|
15
|
+
* @static {function} calculateBillingDateAtString - Calculate cutoff date as string (YYYY-MM-DD) for given sales date
|
|
16
16
|
* @static {function} getDisplayText - Get display text for cutoff date value
|
|
17
17
|
* @static {function} isValidCutoffDate - Validate cutoff date value
|
|
18
18
|
*****************************************************************************/
|
|
@@ -179,14 +179,14 @@ export default class CutoffDate {
|
|
|
179
179
|
* @example
|
|
180
180
|
* // For JST 2024-03-15 with 10th cutoff
|
|
181
181
|
* // Input: UTC date representing JST 2024-03-15
|
|
182
|
-
* const cutoffDate = CutoffDate.
|
|
182
|
+
* const cutoffDate = CutoffDate.calculateBillingDateAt(new Date('2024-03-14T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
183
183
|
* // Returns: UTC date representing JST 2024-04-10
|
|
184
184
|
*
|
|
185
185
|
* // For JST 2024-03-05 with 10th cutoff
|
|
186
|
-
* const cutoffDate = CutoffDate.
|
|
186
|
+
* const cutoffDate = CutoffDate.calculateBillingDateAt(new Date('2024-03-04T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
187
187
|
* // Returns: UTC date representing JST 2024-03-10
|
|
188
188
|
*/
|
|
189
|
-
static
|
|
189
|
+
static calculateBillingDateAt(salesDate, cutoffDateValue) {
|
|
190
190
|
// Convert UTC to JST by adding 9 hours to get the JST date
|
|
191
191
|
const jstDate = new Date(salesDate.getTime() + 9 * 60 * 60 * 1000);
|
|
192
192
|
const year = jstDate.getUTCFullYear();
|
|
@@ -230,11 +230,11 @@ export default class CutoffDate {
|
|
|
230
230
|
* @returns {string} Cutoff date in YYYY-MM-DD format (JST)
|
|
231
231
|
* @example
|
|
232
232
|
* // For JST 2024-03-15 with 10th cutoff
|
|
233
|
-
* const cutoffDateString = CutoffDate.
|
|
233
|
+
* const cutoffDateString = CutoffDate.calculateBillingDateAtString(new Date('2024-03-14T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
234
234
|
* // Returns "2024-04-10"
|
|
235
235
|
*/
|
|
236
|
-
static
|
|
237
|
-
const cutoffDate = CutoffDate.
|
|
236
|
+
static calculateBillingDateAtString(salesDate, cutoffDateValue) {
|
|
237
|
+
const cutoffDate = CutoffDate.calculateBillingDateAt(
|
|
238
238
|
salesDate,
|
|
239
239
|
cutoffDateValue
|
|
240
240
|
);
|