@shisyamo4131/air-guard-v2-schemas 1.3.1-dev.5 → 1.3.1-dev.7
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 +30 -45
package/package.json
CHANGED
package/src/OperationResult.js
CHANGED
|
@@ -205,12 +205,14 @@ const classProps = {
|
|
|
205
205
|
customClass: OperationResultDetail,
|
|
206
206
|
}),
|
|
207
207
|
isLocked: defField("check", {
|
|
208
|
-
label: "
|
|
208
|
+
label: "実績確定",
|
|
209
209
|
default: false,
|
|
210
210
|
}),
|
|
211
|
-
|
|
212
|
-
/** add */
|
|
213
211
|
agreement: defField("object", { label: "取極め", customClass: Agreement }),
|
|
212
|
+
ignoreEmptyAgreement: defField("check", {
|
|
213
|
+
label: "取極めなしを無視",
|
|
214
|
+
default: false,
|
|
215
|
+
}),
|
|
214
216
|
};
|
|
215
217
|
|
|
216
218
|
export default class OperationResult extends Operation {
|
|
@@ -308,27 +310,9 @@ export default class OperationResult extends Operation {
|
|
|
308
310
|
return createInitialValues();
|
|
309
311
|
}
|
|
310
312
|
|
|
311
|
-
// agreementがfalsyの場合は初期値を返す
|
|
312
|
-
if (!this.agreement) {
|
|
313
|
-
return createInitialValues();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const unitPrice = isQualified
|
|
317
|
-
? this.agreement.unitPriceQualified || 0
|
|
318
|
-
: this.agreement.unitPriceBase || 0;
|
|
319
|
-
const overtimeUnitPrice = isQualified
|
|
320
|
-
? this.agreement.overtimeUnitPriceQualified || 0
|
|
321
|
-
: this.agreement.overtimeUnitPriceBase || 0;
|
|
322
|
-
const isPerHour =
|
|
323
|
-
this.agreement.billingUnitType === BILLING_UNIT_TYPE_PER_HOUR;
|
|
324
|
-
|
|
325
313
|
const result = createInitialValues();
|
|
326
314
|
|
|
327
|
-
//
|
|
328
|
-
result.unitPrice = unitPrice;
|
|
329
|
-
result.overtimeUnitPrice = overtimeUnitPrice;
|
|
330
|
-
|
|
331
|
-
// 調整値の使用判定
|
|
315
|
+
// agreementの有無に関わらず数量と残業時間を計算
|
|
332
316
|
if (this.useAdjustedQuantity) {
|
|
333
317
|
result.quantity = isQualified
|
|
334
318
|
? this.adjustedQuantityQualified || 0
|
|
@@ -337,12 +321,16 @@ export default class OperationResult extends Operation {
|
|
|
337
321
|
? this.adjustedOvertimeQualified || 0
|
|
338
322
|
: this.adjustedOvertimeBase || 0;
|
|
339
323
|
} else {
|
|
324
|
+
// agreementがある場合のみbillingUnitTypeとincludeBreakInBillingを使用
|
|
325
|
+
const isPerHour =
|
|
326
|
+
this.agreement?.billingUnitType === BILLING_UNIT_TYPE_PER_HOUR;
|
|
327
|
+
|
|
340
328
|
if (isPerHour) {
|
|
341
329
|
// 時間単位請求の場合
|
|
342
330
|
let totalMinutes = categoryStats.totalWorkMinutes || 0;
|
|
343
331
|
|
|
344
332
|
// 休憩時間を請求に含める場合は休憩時間を追加
|
|
345
|
-
if (this.agreement
|
|
333
|
+
if (this.agreement?.includeBreakInBilling) {
|
|
346
334
|
totalMinutes += categoryStats.breakMinutes || 0;
|
|
347
335
|
}
|
|
348
336
|
|
|
@@ -354,14 +342,24 @@ export default class OperationResult extends Operation {
|
|
|
354
342
|
result.overtimeMinutes = categoryStats.overtimeWorkMinutes || 0;
|
|
355
343
|
}
|
|
356
344
|
|
|
357
|
-
//
|
|
358
|
-
|
|
359
|
-
result.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
345
|
+
// agreementがある場合のみ単価と金額を計算
|
|
346
|
+
if (this.agreement) {
|
|
347
|
+
result.unitPrice = isQualified
|
|
348
|
+
? this.agreement.unitPriceQualified || 0
|
|
349
|
+
: this.agreement.unitPriceBase || 0;
|
|
350
|
+
result.overtimeUnitPrice = isQualified
|
|
351
|
+
? this.agreement.overtimeUnitPriceQualified || 0
|
|
352
|
+
: this.agreement.overtimeUnitPriceBase || 0;
|
|
353
|
+
|
|
354
|
+
// 金額計算(RoundSettingを適用)
|
|
355
|
+
result.regularAmount = RoundSetting.apply(
|
|
356
|
+
result.quantity * result.unitPrice
|
|
357
|
+
);
|
|
358
|
+
result.overtimeAmount = RoundSetting.apply(
|
|
359
|
+
(result.overtimeMinutes * result.overtimeUnitPrice) / 60
|
|
360
|
+
);
|
|
361
|
+
result.total = result.regularAmount + result.overtimeAmount;
|
|
362
|
+
}
|
|
365
363
|
|
|
366
364
|
return result;
|
|
367
365
|
};
|
|
@@ -435,7 +433,7 @@ export default class OperationResult extends Operation {
|
|
|
435
433
|
enumerable: true,
|
|
436
434
|
get() {
|
|
437
435
|
if (this.hasAgreement) return true;
|
|
438
|
-
return
|
|
436
|
+
return this.ignoreEmptyAgreement;
|
|
439
437
|
},
|
|
440
438
|
set(v) {},
|
|
441
439
|
},
|
|
@@ -474,19 +472,6 @@ export default class OperationResult extends Operation {
|
|
|
474
472
|
this.refreshBillingDateAt();
|
|
475
473
|
}
|
|
476
474
|
|
|
477
|
-
/**
|
|
478
|
-
* Override `beforeDelete`.
|
|
479
|
-
* - Prevents deletion if the instance has `siteOperationScheduleId`.
|
|
480
|
-
*/
|
|
481
|
-
async beforeDelete() {
|
|
482
|
-
await super.beforeDelete();
|
|
483
|
-
if (this.siteOperationScheduleId) {
|
|
484
|
-
throw new Error(
|
|
485
|
-
"この稼働実績は現場稼働予定から作成されているため、削除できません。"
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
475
|
/**
|
|
491
476
|
* Override update method to prevent editing if isLocked is true
|
|
492
477
|
* @param {*} options
|