fix: [finance] 전체 하드코딩 계정코드 3자리→5자리 수정
- 급여전표: 801→80100, 207→20700, 205→20500 - 카드전표: 135→13500, 826→82600, 205→20500 - 홈택스분개: 108→10800, 401→40100, 208→20800, 501→50100, 117→11700, 201→20100 - 일반전표: 135→13500, 253→25300, 103→10300
This commit is contained in:
@@ -842,11 +842,11 @@ public function generateJournalEntry(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
// 계정과목 조회
|
||||
$accountCodes = AccountCode::whereIn('code', ['801', '207', '205'])
|
||||
$accountCodes = AccountCode::whereIn('code', ['80100', '20700', '20500'])
|
||||
->where('is_active', true)
|
||||
->pluck('name', 'code');
|
||||
|
||||
$missingCodes = array_diff(['801', '207', '205'], $accountCodes->keys()->toArray());
|
||||
$missingCodes = array_diff(['80100', '20700', '20500'], $accountCodes->keys()->toArray());
|
||||
if (! empty($missingCodes)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
@@ -885,12 +885,12 @@ public function generateJournalEntry(Request $request): JsonResponse
|
||||
}
|
||||
}
|
||||
|
||||
// 1. 차변: 801 급여 / 임직원 — 총지급액
|
||||
// 1. 차변: 80100 급여 / 임직원 — 총지급액
|
||||
if ($grossAmount > 0) {
|
||||
$lines[] = [
|
||||
'dc_type' => 'debit',
|
||||
'account_code' => '801',
|
||||
'account_name' => $accountCodes['801'],
|
||||
'account_code' => '80100',
|
||||
'account_name' => $accountCodes['80100'],
|
||||
'trading_partner_id' => $partners['임직원'],
|
||||
'trading_partner_name' => '임직원',
|
||||
'debit_amount' => $grossAmount,
|
||||
@@ -916,8 +916,8 @@ public function generateJournalEntry(Request $request): JsonResponse
|
||||
} else {
|
||||
$creditLines[$mergeKey] = [
|
||||
'dc_type' => 'credit',
|
||||
'account_code' => '207',
|
||||
'account_name' => $accountCodes['207'],
|
||||
'account_code' => '20700',
|
||||
'account_name' => $accountCodes['20700'],
|
||||
'trading_partner_id' => $partners[$partnerName],
|
||||
'trading_partner_name' => $partnerName,
|
||||
'debit_amount' => 0,
|
||||
@@ -935,12 +935,12 @@ public function generateJournalEntry(Request $request): JsonResponse
|
||||
$lines[] = $creditLine;
|
||||
}
|
||||
|
||||
// 최종: 대변 205 미지급비용 / 임직원 — 실수령액 (DB 값)
|
||||
// 최종: 대변 20500 미지급비용 / 임직원 — 실수령액 (DB 값)
|
||||
if ($netSalary > 0) {
|
||||
$lines[] = [
|
||||
'dc_type' => 'credit',
|
||||
'account_code' => '205',
|
||||
'account_name' => $accountCodes['205'],
|
||||
'account_code' => '20500',
|
||||
'account_name' => $accountCodes['20500'],
|
||||
'trading_partner_id' => $partners['임직원'],
|
||||
'trading_partner_name' => '임직원',
|
||||
'debit_amount' => 0,
|
||||
|
||||
@@ -1882,8 +1882,8 @@ private function syncJournalAmounts(int $tenantId, string $uniqueKey, float $new
|
||||
|
||||
if ($isDeductible && $debitLines->count() >= 2) {
|
||||
// 공제: 비용 계정(공급가액) + 부가세대급금(세액)
|
||||
$expenseLine = $debitLines->first(fn ($l) => $l->account_code !== '135') ?? $debitLines[0];
|
||||
$taxLine = $debitLines->first(fn ($l) => $l->account_code === '135') ?? $debitLines[1];
|
||||
$expenseLine = $debitLines->first(fn ($l) => $l->account_code !== '13500') ?? $debitLines[0];
|
||||
$taxLine = $debitLines->first(fn ($l) => $l->account_code === '13500') ?? $debitLines[1];
|
||||
|
||||
JournalEntryLine::create([
|
||||
'tenant_id' => $tenantId,
|
||||
@@ -1919,7 +1919,7 @@ private function syncJournalAmounts(int $tenantId, string $uniqueKey, float $new
|
||||
'journal_entry_id' => $journal->id,
|
||||
'line_no' => $lineNo++,
|
||||
'dc_type' => 'debit',
|
||||
'account_code' => $expenseAccount?->account_code ?? '826',
|
||||
'account_code' => $expenseAccount?->account_code ?? '82600',
|
||||
'account_name' => $expenseAccount?->account_name ?? '잡비',
|
||||
'debit_amount' => $supplyInt,
|
||||
'credit_amount' => 0,
|
||||
@@ -1932,7 +1932,7 @@ private function syncJournalAmounts(int $tenantId, string $uniqueKey, float $new
|
||||
'journal_entry_id' => $journal->id,
|
||||
'line_no' => $lineNo++,
|
||||
'dc_type' => 'debit',
|
||||
'account_code' => '135',
|
||||
'account_code' => '13500',
|
||||
'account_name' => '부가세대급금',
|
||||
'debit_amount' => $taxInt,
|
||||
'credit_amount' => 0,
|
||||
@@ -1945,7 +1945,7 @@ private function syncJournalAmounts(int $tenantId, string $uniqueKey, float $new
|
||||
'journal_entry_id' => $journal->id,
|
||||
'line_no' => $lineNo++,
|
||||
'dc_type' => 'debit',
|
||||
'account_code' => $expenseAccount?->account_code ?? '826',
|
||||
'account_code' => $expenseAccount?->account_code ?? '82600',
|
||||
'account_name' => $expenseAccount?->account_name ?? '잡비',
|
||||
'debit_amount' => $totalAmount,
|
||||
'credit_amount' => 0,
|
||||
@@ -1962,7 +1962,7 @@ private function syncJournalAmounts(int $tenantId, string $uniqueKey, float $new
|
||||
'journal_entry_id' => $journal->id,
|
||||
'line_no' => $lineNo,
|
||||
'dc_type' => 'credit',
|
||||
'account_code' => $creditAccount?->account_code ?? '205',
|
||||
'account_code' => $creditAccount?->account_code ?? '20500',
|
||||
'account_name' => $creditAccount?->account_name ?? '미지급비용',
|
||||
'debit_amount' => 0,
|
||||
'credit_amount' => $totalAmount,
|
||||
|
||||
Reference in New Issue
Block a user