diff --git a/system1-factory/api/controllers/vacationBalanceController.js b/system1-factory/api/controllers/vacationBalanceController.js index 420e2d7..069f322 100644 --- a/system1-factory/api/controllers/vacationBalanceController.js +++ b/system1-factory/api/controllers/vacationBalanceController.js @@ -213,7 +213,7 @@ const vacationBalanceController = { let errorCount = 0; for (const balance of balances) { - const { user_id, vacation_type_id, year, total_days, notes } = balance; + const { user_id, vacation_type_id, year, total_days, notes, balance_type } = balance; if (!user_id || !vacation_type_id || !year || total_days === undefined) { errorCount++; @@ -221,17 +221,17 @@ const vacationBalanceController = { } try { + const btype = balance_type || 'AUTO'; const query = ` - INSERT INTO vacation_balance_details - (user_id, vacation_type_id, year, total_days, used_days, notes, created_by) - VALUES (?, ?, ?, ?, 0, ?, ?) + INSERT INTO sp_vacation_balances + (user_id, vacation_type_id, year, total_days, used_days, notes, created_by, balance_type, expires_at) + VALUES (?, ?, ?, ?, 0, ?, ?, ?, NULL) ON DUPLICATE KEY UPDATE total_days = VALUES(total_days), - notes = VALUES(notes), - updated_at = NOW() + notes = VALUES(notes) `; - await db.query(query, [user_id, vacation_type_id, year, total_days, notes || null, created_by]); + await db.query(query, [user_id, vacation_type_id, year, total_days, notes || null, created_by, btype]); successCount++; } catch (err) { logger.error('휴가 잔액 저장 오류:', err); diff --git a/system1-factory/web/pages/attendance/annual-overview.html b/system1-factory/web/pages/attendance/annual-overview.html index f11e006..2ede310 100644 --- a/system1-factory/web/pages/attendance/annual-overview.html +++ b/system1-factory/web/pages/attendance/annual-overview.html @@ -829,7 +829,8 @@ user_id: w.user_id, vacation_type_id: typeIdMap['CARRYOVER'], year: currentYear, - total_days: d.carryover + total_days: d.carryover, + balance_type: 'CARRY_OVER' }); } if (typeIdMap['ANNUAL']) { @@ -837,7 +838,8 @@ user_id: w.user_id, vacation_type_id: typeIdMap['ANNUAL'], year: currentYear, - total_days: d.annual + total_days: d.annual, + balance_type: 'AUTO' }); } if (typeIdMap['LONG_SERVICE']) { @@ -845,7 +847,8 @@ user_id: w.user_id, vacation_type_id: typeIdMap['LONG_SERVICE'], year: currentYear, - total_days: d.longService + total_days: d.longService, + balance_type: 'LONG_SERVICE' }); } @@ -883,7 +886,8 @@ vacation_type_id: specialTypeId, year: currentYear, total_days: special.days, - notes: special.typeName || special.type + notes: special.typeName || special.type, + balance_type: 'COMPANY_GRANT' }); } }