From 5f0b2ae79844b25f0e7c7d2677a62005365bbaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Fri, 27 Feb 2026 14:19:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[payroll]=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=20=EA=B3=B5=EC=A0=9C=ED=95=AD=EB=AA=A9=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EA=B3=84=EC=82=B0=EA=B0=92=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=ED=91=9C=EC=8B=9C=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 수정 모달 열 때 DB 저장값 대신 자동계산값으로 공제항목 표시 - 계산 방식 변경(round→floor, 구상수→DB조회)으로 인한 수동표시 오작동 해결 - 비교 API 호출에 user_id 추가하여 가족수 반영 --- resources/views/hr/payrolls/index.blade.php | 29 +++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/resources/views/hr/payrolls/index.blade.php b/resources/views/hr/payrolls/index.blade.php index e76289ff..a82b43d4 100644 --- a/resources/views/hr/payrolls/index.blade.php +++ b/resources/views/hr/payrolls/index.blade.php @@ -452,22 +452,13 @@ function openEditPayrollModal(id, data) { data.deductions.forEach(d => addDeductionRow(d.name, d.amount)); } - // 법정공제 항목 값 복원 (서버 저장값으로 설정하고 수동 표시) - const deductionFields = { - 'calcPension': data.pension, 'calcHealth': data.health_insurance, - 'calcLongTermCare': data.long_term_care, 'calcEmployment': data.employment_insurance, - 'calcIncomeTax': data.income_tax, 'calcResidentTax': data.resident_tax, - }; - Object.entries(deductionFields).forEach(([id, val]) => { - const el = document.getElementById(id); - setMoneyValue(el, val || 0); - }); - - // 자동 계산하여 서버 저장값과 다르면 수동 수정 표시 + // 법정공제 항목: 자동 계산값으로 설정 (수동 수정 표시 없음) + // 사용자가 직접 필드를 수정할 때만 수동 표시됨 (oninput → markManualOverride) const calcData = { base_salary: parseMoneyValue(document.getElementById('payrollBaseSalary')), overtime_pay: parseMoneyValue(document.getElementById('payrollOvertimePay')), bonus: parseMoneyValue(document.getElementById('payrollBonus')), + user_id: parseInt(document.getElementById('payrollUserId').value) || null, }; fetch('{{ route("api.admin.hr.payrolls.calculate") }}', { method: 'POST', @@ -478,20 +469,20 @@ function openEditPayrollModal(id, data) { .then(result => { if (result.success) { const d = result.data; - const autoMap = { + const autoFields = { 'calcPension': d.pension, 'calcHealth': d.health_insurance, 'calcLongTermCare': d.long_term_care, 'calcEmployment': d.employment_insurance, 'calcIncomeTax': d.income_tax, 'calcResidentTax': d.resident_tax, }; - Object.entries(autoMap).forEach(([id, autoVal]) => { - const el = document.getElementById(id); - const savedVal = parseMoneyValue(el); - if (savedVal !== autoVal) { - markManualOverride(el); - } + Object.entries(autoFields).forEach(([id, val]) => { + setMoneyValue(document.getElementById(id), val); }); document.getElementById('calcGross').textContent = numberFormat(d.gross_salary); document.getElementById('calcTaxableBase').textContent = numberFormat(d.taxable_base); + if (d.family_count) { + const fcEl = document.getElementById('calcFamilyCount'); + if (fcEl) fcEl.textContent = d.family_count + '명'; + } updateDeductionTotals(); } })