@shisyamo4131/air-guard-v2-schemas 1.3.1-dev.5 → 1.3.1-dev.6
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 +25 -29
package/package.json
CHANGED
package/src/OperationResult.js
CHANGED
|
@@ -308,27 +308,9 @@ export default class OperationResult extends Operation {
|
|
|
308
308
|
return createInitialValues();
|
|
309
309
|
}
|
|
310
310
|
|
|
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
311
|
const result = createInitialValues();
|
|
326
312
|
|
|
327
|
-
//
|
|
328
|
-
result.unitPrice = unitPrice;
|
|
329
|
-
result.overtimeUnitPrice = overtimeUnitPrice;
|
|
330
|
-
|
|
331
|
-
// 調整値の使用判定
|
|
313
|
+
// agreementの有無に関わらず数量と残業時間を計算
|
|
332
314
|
if (this.useAdjustedQuantity) {
|
|
333
315
|
result.quantity = isQualified
|
|
334
316
|
? this.adjustedQuantityQualified || 0
|
|
@@ -337,12 +319,16 @@ export default class OperationResult extends Operation {
|
|
|
337
319
|
? this.adjustedOvertimeQualified || 0
|
|
338
320
|
: this.adjustedOvertimeBase || 0;
|
|
339
321
|
} else {
|
|
322
|
+
// agreementがある場合のみbillingUnitTypeとincludeBreakInBillingを使用
|
|
323
|
+
const isPerHour =
|
|
324
|
+
this.agreement?.billingUnitType === BILLING_UNIT_TYPE_PER_HOUR;
|
|
325
|
+
|
|
340
326
|
if (isPerHour) {
|
|
341
327
|
// 時間単位請求の場合
|
|
342
328
|
let totalMinutes = categoryStats.totalWorkMinutes || 0;
|
|
343
329
|
|
|
344
330
|
// 休憩時間を請求に含める場合は休憩時間を追加
|
|
345
|
-
if (this.agreement
|
|
331
|
+
if (this.agreement?.includeBreakInBilling) {
|
|
346
332
|
totalMinutes += categoryStats.breakMinutes || 0;
|
|
347
333
|
}
|
|
348
334
|
|
|
@@ -354,14 +340,24 @@ export default class OperationResult extends Operation {
|
|
|
354
340
|
result.overtimeMinutes = categoryStats.overtimeWorkMinutes || 0;
|
|
355
341
|
}
|
|
356
342
|
|
|
357
|
-
//
|
|
358
|
-
|
|
359
|
-
result.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
343
|
+
// agreementがある場合のみ単価と金額を計算
|
|
344
|
+
if (this.agreement) {
|
|
345
|
+
result.unitPrice = isQualified
|
|
346
|
+
? this.agreement.unitPriceQualified || 0
|
|
347
|
+
: this.agreement.unitPriceBase || 0;
|
|
348
|
+
result.overtimeUnitPrice = isQualified
|
|
349
|
+
? this.agreement.overtimeUnitPriceQualified || 0
|
|
350
|
+
: this.agreement.overtimeUnitPriceBase || 0;
|
|
351
|
+
|
|
352
|
+
// 金額計算(RoundSettingを適用)
|
|
353
|
+
result.regularAmount = RoundSetting.apply(
|
|
354
|
+
result.quantity * result.unitPrice
|
|
355
|
+
);
|
|
356
|
+
result.overtimeAmount = RoundSetting.apply(
|
|
357
|
+
(result.overtimeMinutes * result.overtimeUnitPrice) / 60
|
|
358
|
+
);
|
|
359
|
+
result.total = result.regularAmount + result.overtimeAmount;
|
|
360
|
+
}
|
|
365
361
|
|
|
366
362
|
return result;
|
|
367
363
|
};
|
|
@@ -435,7 +431,7 @@ export default class OperationResult extends Operation {
|
|
|
435
431
|
enumerable: true,
|
|
436
432
|
get() {
|
|
437
433
|
if (this.hasAgreement) return true;
|
|
438
|
-
return
|
|
434
|
+
return this.useAdjustedQuantity;
|
|
439
435
|
},
|
|
440
436
|
set(v) {},
|
|
441
437
|
},
|