feat: [ecard] 카드사용내역 복식부기 분개 시스템 추가

- EcardController에 storeJournal/getJournal/deleteJournal/getJournalStatuses 4개 메서드 추가
- journal_entries + journal_entry_lines 통합 (source_type='ecard_transaction')
- CardJournalModal 차변/대변 복식부기 UI 추가
- 거래 테이블에 분개완료/구버전/미분개 3단계 상태 표시
- 기존 splits 데이터 자동 전환 지원
This commit is contained in:
김보곤
2026-02-24 13:08:33 +09:00
parent e12d0d1607
commit 7954c24aa4
3 changed files with 856 additions and 164 deletions

View File

@@ -10,6 +10,8 @@
use App\Models\Barobill\CardTransactionAmountLog;
use App\Models\Barobill\CardTransactionHide;
use App\Models\Barobill\CardTransactionSplit;
use App\Models\Finance\JournalEntry;
use App\Models\Finance\JournalEntryLine;
use App\Models\Tenants\Tenant;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -28,9 +30,13 @@ class EcardController extends Controller
* 바로빌 SOAP 설정
*/
private ?string $certKey = null;
private ?string $corpNum = null;
private bool $isTestMode = false;
private ?string $soapUrl = null;
private ?\SoapClient $soapClient = null;
// 바로빌 파트너사 (본사) 테넌트 ID
@@ -75,8 +81,8 @@ private function initSoapClient(): void
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
'allow_self_signed' => true,
],
]);
$this->soapClient = new \SoapClient($this->soapUrl, [
@@ -85,7 +91,7 @@ private function initSoapClient(): void
'exceptions' => true,
'connection_timeout' => 30,
'stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE
'cache_wsdl' => WSDL_CACHE_NONE,
]);
} catch (\Throwable $e) {
Log::error('바로빌 카드 SOAP 클라이언트 생성 실패: '.$e->getMessage());
@@ -178,14 +184,14 @@ public function cards(Request $request): JsonResponse
$availOnly = $request->input('availOnly', 0);
$result = $this->callSoap('GetCardEx2', [
'AvailOnly' => (int)$availOnly
'AvailOnly' => (int) $availOnly,
]);
if (! $result['success']) {
return response()->json([
'success' => false,
'error' => $result['error'],
'error_code' => $result['error_code'] ?? null
'error_code' => $result['error_code'] ?? null,
]);
}
@@ -199,7 +205,9 @@ public function cards(Request $request): JsonResponse
}
foreach ($cardList as $card) {
if (!is_object($card)) continue;
if (! is_object($card)) {
continue;
}
$cardNum = $card->CardNum ?? '';
// 에러 체크: CardNum이 음수면 에러 코드
@@ -228,13 +236,14 @@ public function cards(Request $request): JsonResponse
return response()->json([
'success' => true,
'cards' => $cards,
'count' => count($cards)
'count' => count($cards),
]);
} catch (\Throwable $e) {
Log::error('카드 목록 조회 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '서버 오류: ' . $e->getMessage()
'error' => '서버 오류: '.$e->getMessage(),
]);
}
}
@@ -249,8 +258,9 @@ private function getCardStatusName(string $status): string
'1' => '정상',
'2' => '해지',
'3' => '수집오류',
'4' => '일시중지'
'4' => '일시중지',
];
return $statuses[$status] ?? $status;
}
@@ -312,7 +322,7 @@ public function transactions(Request $request): JsonResponse
'EndDate' => $endDate,
'CountPerPage' => 10000,
'CurrentPage' => 1,
'OrderDirection' => 2 // 2:내림차순
'OrderDirection' => 2, // 2:내림차순
];
Log::info('[ECard] GetPeriodCardApprovalLog 호출', $params);
@@ -330,7 +340,7 @@ public function transactions(Request $request): JsonResponse
return response()->json([
'success' => false,
'error' => $result['error'],
'error_code' => $result['error_code'] ?? null
'error_code' => $result['error_code'] ?? null,
]);
}
@@ -344,7 +354,7 @@ public function transactions(Request $request): JsonResponse
return response()->json([
'success' => false,
'error' => $this->getErrorMessage($errorCode),
'error_code' => $errorCode
'error_code' => $errorCode,
]);
}
@@ -353,13 +363,14 @@ public function transactions(Request $request): JsonResponse
Log::info('[ECard] 데이터 없음 (에러코드로 판단)');
// API 데이터 없어도 수동 건은 표시
$manualLogs = $this->convertManualToLogs($manualTransactions);
return response()->json([
'success' => true,
'data' => [
'logs' => $manualLogs['logs'],
'summary' => $manualLogs['summary'],
'pagination' => ['currentPage' => 1, 'maxPageNum' => 1]
]
'pagination' => ['currentPage' => 1, 'maxPageNum' => 1],
],
]);
}
@@ -404,18 +415,19 @@ public function transactions(Request $request): JsonResponse
'currentPage' => $page,
'countPerPage' => $limit,
'maxPageNum' => $maxPageNum,
'maxIndex' => $totalCount
'maxIndex' => $totalCount,
],
'summary' => $mergedSummary,
],
'summary' => $mergedSummary
]
]);
} catch (\Throwable $e) {
Log::error('카드 사용내역 조회 오류: '.$e->getMessage(), [
'trace' => $e->getTraceAsString()
'trace' => $e->getTraceAsString(),
]);
return response()->json([
'success' => false,
'error' => '서버 오류: ' . $e->getMessage()
'error' => '서버 오류: '.$e->getMessage(),
]);
}
}
@@ -442,7 +454,7 @@ private function getAllCardsTransactions(string $userId, string $startDate, stri
if (! $cardResult['success']) {
return response()->json([
'success' => false,
'error' => $cardResult['error']
'error' => $cardResult['error'],
]);
}
@@ -473,10 +485,14 @@ private function getAllCardsTransactions(string $userId, string $startDate, stri
$totalTax = 0;
foreach ($cardList as $card) {
if (!is_object($card)) continue;
if (! is_object($card)) {
continue;
}
$cardNum = $card->CardNum ?? '';
if (empty($cardNum) || (is_numeric($cardNum) && $cardNum < 0)) continue;
if (empty($cardNum) || (is_numeric($cardNum) && $cardNum < 0)) {
continue;
}
$params = [
'ID' => $userId,
@@ -485,7 +501,7 @@ private function getAllCardsTransactions(string $userId, string $startDate, stri
'EndDate' => $endDate,
'CountPerPage' => 1000,
'CurrentPage' => 1,
'OrderDirection' => 2
'OrderDirection' => 2,
];
Log::info('[ECard] 카드별 사용내역 조회', ['cardNum' => $cardNum, 'params' => $params]);
@@ -589,7 +605,7 @@ private function getAllCardsTransactions(string $userId, string $startDate, stri
'currentPage' => $page,
'countPerPage' => $limit,
'maxPageNum' => $maxPageNum,
'maxIndex' => $totalCount
'maxIndex' => $totalCount,
],
'summary' => [
'totalAmount' => $totalAmount,
@@ -601,8 +617,8 @@ private function getAllCardsTransactions(string $userId, string $startDate, stri
'deductibleCount' => $deductibleCount,
'nonDeductibleAmount' => $nonDeductibleAmount,
'nonDeductibleCount' => $nonDeductibleCount,
]
]
],
],
]);
}
@@ -757,7 +773,7 @@ private function parseTransactionLogs($resultData, $savedData = null): array
'deductibleCount' => $deductibleCount,
'nonDeductibleAmount' => $nonDeductibleAmount,
'nonDeductibleCount' => $nonDeductibleCount,
]
],
];
}
@@ -772,6 +788,7 @@ private function checkErrorCode($data): ?int
if (isset($data->CardNum) && is_numeric($data->CardNum) && $data->CardNum < 0) {
return (int) $data->CardNum;
}
return null;
}
@@ -788,6 +805,7 @@ private function getErrorMessage(int $errorCode): string
-25006 => '카드번호가 잘못되었습니다 (-25006).',
-25007 => '조회 기간이 잘못되었습니다 (-25007).',
];
return $messages[$errorCode] ?? '바로빌 API 오류: '.$errorCode;
}
@@ -796,7 +814,10 @@ private function getErrorMessage(int $errorCode): string
*/
private function maskCardNumber(string $cardNum): string
{
if (strlen($cardNum) < 8) return $cardNum;
if (strlen($cardNum) < 8) {
return $cardNum;
}
return substr($cardNum, 0, 4).'-****-****-'.substr($cardNum, -4);
}
@@ -830,8 +851,9 @@ private function getCardCompanyName(string $code): string
'30' => '우체국',
'31' => '카카오뱅크',
'32' => 'K뱅크',
'33' => '토스뱅크'
'33' => '토스뱅크',
];
return $companies[$code] ?? $code;
}
@@ -843,6 +865,7 @@ private function getPaymentPlanName(string $plan): string
if (empty($plan) || $plan === '0' || $plan === '00') {
return '일시불';
}
return $plan.'개월';
}
@@ -861,7 +884,7 @@ public function accountCodes(): JsonResponse
'code' => $c->code,
'name' => $c->name,
'category' => $c->category,
])
]),
]);
}
@@ -877,7 +900,7 @@ public function save(Request $request): JsonResponse
if (empty($transactions)) {
return response()->json([
'success' => false,
'error' => '저장할 데이터가 없습니다.'
'error' => '저장할 데이터가 없습니다.',
]);
}
@@ -996,14 +1019,15 @@ public function save(Request $request): JsonResponse
'success' => true,
'message' => "저장 완료: 신규 {$saved}건, 수정 {$updated}",
'saved' => $saved,
'updated' => $updated
'updated' => $updated,
]);
} catch (\Throwable $e) {
DB::rollBack();
Log::error('카드 사용내역 저장 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '저장 오류: ' . $e->getMessage()
'error' => '저장 오류: '.$e->getMessage(),
]);
}
}
@@ -1023,7 +1047,7 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
if (empty($logs)) {
return response()->json([
'success' => false,
'error' => '내보낼 데이터가 없습니다.'
'error' => '내보낼 데이터가 없습니다.',
]);
}
@@ -1052,7 +1076,7 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
'승인번호',
'계정과목코드',
'계정과목명',
'메모'
'메모',
]);
// 데이터
@@ -1110,7 +1134,7 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
$approvalNum,
'-',
'분개됨 ('.count($splits).'건)',
''
'',
]);
// 각 분개 행 출력
@@ -1142,7 +1166,7 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
'',
$splitAccountCode,
$splitAccountName,
$splitMemo
$splitMemo,
]);
}
} else {
@@ -1163,7 +1187,7 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
$approvalNum,
$log['accountCode'] ?? '',
$log['accountName'] ?? '',
''
'',
]);
}
}
@@ -1175,9 +1199,10 @@ public function exportExcel(Request $request): StreamedResponse|JsonResponse
]);
} catch (\Throwable $e) {
Log::error('엑셀 다운로드 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '다운로드 오류: ' . $e->getMessage()
'error' => '다운로드 오류: '.$e->getMessage(),
]);
}
}
@@ -1196,13 +1221,14 @@ public function splits(Request $request): JsonResponse
return response()->json([
'success' => true,
'data' => $splits
'data' => $splits,
]);
} catch (\Throwable $e) {
Log::error('분개 내역 조회 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '조회 오류: ' . $e->getMessage()
'error' => '조회 오류: '.$e->getMessage(),
]);
}
}
@@ -1221,7 +1247,7 @@ public function saveSplits(Request $request): JsonResponse
if (empty($uniqueKey)) {
return response()->json([
'success' => false,
'error' => '고유키가 없습니다.'
'error' => '고유키가 없습니다.',
]);
}
@@ -1231,13 +1257,14 @@ public function saveSplits(Request $request): JsonResponse
if (isset($s['supplyAmount']) && isset($s['tax'])) {
return floatval($s['supplyAmount']) + floatval($s['tax']);
}
return floatval($s['amount'] ?? 0);
}, $splits));
if (abs($originalAmount - $splitTotal) > 0.01) {
return response()->json([
'success' => false,
'error' => "분개 금액 합계({$splitTotal})가 원본 금액({$originalAmount})과 일치하지 않습니다."
'error' => "분개 금액 합계({$splitTotal})가 원본 금액({$originalAmount})과 일치하지 않습니다.",
]);
}
@@ -1250,14 +1277,15 @@ public function saveSplits(Request $request): JsonResponse
return response()->json([
'success' => true,
'message' => '분개가 저장되었습니다.',
'splitCount' => count($splits)
'splitCount' => count($splits),
]);
} catch (\Throwable $e) {
DB::rollBack();
Log::error('분개 저장 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '저장 오류: ' . $e->getMessage()
'error' => '저장 오류: '.$e->getMessage(),
]);
}
}
@@ -1274,7 +1302,7 @@ public function deleteSplits(Request $request): JsonResponse
if (empty($uniqueKey)) {
return response()->json([
'success' => false,
'error' => '고유키가 없습니다.'
'error' => '고유키가 없습니다.',
]);
}
@@ -1283,13 +1311,14 @@ public function deleteSplits(Request $request): JsonResponse
return response()->json([
'success' => true,
'message' => '분개가 삭제되었습니다.',
'deleted' => $deleted
'deleted' => $deleted,
]);
} catch (\Throwable $e) {
Log::error('분개 삭제 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '삭제 오류: ' . $e->getMessage()
'error' => '삭제 오류: '.$e->getMessage(),
]);
}
}
@@ -1354,19 +1383,20 @@ public function storeManual(Request $request): JsonResponse
return response()->json([
'success' => true,
'message' => '수동 거래가 등록되었습니다.',
'data' => ['id' => $transaction->id]
'data' => ['id' => $transaction->id],
]);
} catch (\Illuminate\Validation\ValidationException $e) {
return response()->json([
'success' => false,
'error' => '입력 데이터가 올바르지 않습니다.',
'errors' => $e->errors()
'errors' => $e->errors(),
], 422);
} catch (\Throwable $e) {
Log::error('수동 거래 등록 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '등록 오류: ' . $e->getMessage()
'error' => '등록 오류: '.$e->getMessage(),
]);
}
}
@@ -1434,19 +1464,20 @@ public function updateManual(Request $request, int $id): JsonResponse
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
return response()->json([
'success' => false,
'error' => '해당 거래를 찾을 수 없거나 수동 입력 건이 아닙니다.'
'error' => '해당 거래를 찾을 수 없거나 수동 입력 건이 아닙니다.',
], 404);
} catch (\Illuminate\Validation\ValidationException $e) {
return response()->json([
'success' => false,
'error' => '입력 데이터가 올바르지 않습니다.',
'errors' => $e->errors()
'errors' => $e->errors(),
], 422);
} catch (\Throwable $e) {
Log::error('수동 거래 수정 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '수정 오류: ' . $e->getMessage()
'error' => '수정 오류: '.$e->getMessage(),
]);
}
}
@@ -1473,13 +1504,14 @@ public function destroyManual(int $id): JsonResponse
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
return response()->json([
'success' => false,
'error' => '해당 거래를 찾을 수 없거나 수동 입력 건이 아닙니다.'
'error' => '해당 거래를 찾을 수 없거나 수동 입력 건이 아닙니다.',
], 404);
} catch (\Throwable $e) {
Log::error('수동 거래 삭제 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '삭제 오류: ' . $e->getMessage()
'error' => '삭제 오류: '.$e->getMessage(),
]);
}
}
@@ -1506,7 +1538,7 @@ private function convertManualToLogs($manualTransactions): array
'totalAmount' => 0, 'count' => 0, 'approvalCount' => 0, 'cancelCount' => 0,
'totalTax' => 0, 'deductibleAmount' => 0, 'deductibleCount' => 0,
'nonDeductibleAmount' => 0, 'nonDeductibleCount' => 0,
]
],
];
}
@@ -1600,7 +1632,7 @@ private function convertManualToLogs($manualTransactions): array
'deductibleCount' => $deductibleCount,
'nonDeductibleAmount' => $nonDeductibleAmount,
'nonDeductibleCount' => $nonDeductibleCount,
]
],
];
}
@@ -1684,7 +1716,7 @@ private function filterHiddenLogs(array $parsed, $hiddenSet): array
'deductibleCount' => $deductibleCount,
'nonDeductibleAmount' => $nonDeductibleAmount,
'nonDeductibleCount' => $nonDeductibleCount,
]
],
];
}
@@ -1701,7 +1733,7 @@ public function hideTransaction(Request $request): JsonResponse
if (empty($uniqueKey)) {
return response()->json([
'success' => false,
'error' => '고유키가 없습니다.'
'error' => '고유키가 없습니다.',
]);
}
@@ -1713,7 +1745,7 @@ public function hideTransaction(Request $request): JsonResponse
if ($exists) {
return response()->json([
'success' => false,
'error' => '이미 숨김 처리된 거래입니다.'
'error' => '이미 숨김 처리된 거래입니다.',
]);
}
@@ -1721,13 +1753,14 @@ public function hideTransaction(Request $request): JsonResponse
return response()->json([
'success' => true,
'message' => '거래가 숨김 처리되었습니다.'
'message' => '거래가 숨김 처리되었습니다.',
]);
} catch (\Throwable $e) {
Log::error('거래 숨김 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '숨김 처리 오류: ' . $e->getMessage()
'error' => '숨김 처리 오류: '.$e->getMessage(),
]);
}
}
@@ -1744,7 +1777,7 @@ public function restoreTransaction(Request $request): JsonResponse
if (empty($uniqueKey)) {
return response()->json([
'success' => false,
'error' => '고유키가 없습니다.'
'error' => '고유키가 없습니다.',
]);
}
@@ -1753,19 +1786,20 @@ public function restoreTransaction(Request $request): JsonResponse
if ($deleted === 0) {
return response()->json([
'success' => false,
'error' => '숨김 데이터를 찾을 수 없습니다.'
'error' => '숨김 데이터를 찾을 수 없습니다.',
]);
}
return response()->json([
'success' => true,
'message' => '거래가 복원되었습니다.'
'message' => '거래가 복원되었습니다.',
]);
} catch (\Throwable $e) {
Log::error('거래 복원 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '복원 오류: ' . $e->getMessage()
'error' => '복원 오류: '.$e->getMessage(),
]);
}
}
@@ -1800,17 +1834,238 @@ public function hiddenTransactions(Request $request): JsonResponse
return response()->json([
'success' => true,
'data' => $hidden,
'count' => $hidden->count()
'count' => $hidden->count(),
]);
} catch (\Throwable $e) {
Log::error('숨김 목록 조회 오류: '.$e->getMessage());
return response()->json([
'success' => false,
'error' => '조회 오류: ' . $e->getMessage()
'error' => '조회 오류: '.$e->getMessage(),
]);
}
}
// ================================================================
// 카드거래 복식부기 분개 API (journal_entries 통합)
// ================================================================
/**
* 카드 거래 분개 생성/수정
*/
public function storeJournal(Request $request): JsonResponse
{
$request->validate([
'source_key' => 'required|string|max:255',
'entry_date' => 'required|date',
'description' => 'nullable|string|max:500',
'lines' => 'required|array|min:2',
'lines.*.dc_type' => 'required|in:debit,credit',
'lines.*.account_code' => 'required|string|max:10',
'lines.*.account_name' => 'required|string|max:100',
'lines.*.debit_amount' => 'required|integer|min:0',
'lines.*.credit_amount' => 'required|integer|min:0',
'lines.*.description' => 'nullable|string|max:300',
]);
$tenantId = session('selected_tenant_id', self::HEADQUARTERS_TENANT_ID);
$lines = $request->lines;
$totalDebit = collect($lines)->sum('debit_amount');
$totalCredit = collect($lines)->sum('credit_amount');
if ($totalDebit !== $totalCredit || $totalDebit === 0) {
return response()->json([
'success' => false,
'message' => '차변합계와 대변합계가 일치해야 하며 0보다 커야 합니다.',
], 422);
}
$existing = JournalEntry::getJournalBySourceKey($tenantId, 'ecard_transaction', $request->source_key);
$maxRetries = 3;
$lastError = null;
for ($attempt = 0; $attempt < $maxRetries; $attempt++) {
try {
$entry = DB::transaction(function () use ($tenantId, $request, $lines, $totalDebit, $totalCredit, $existing) {
if ($existing) {
// 수정 모드: 기존 lines 삭제 후 재생성 (전표번호 유지)
$existing->update([
'entry_date' => $request->entry_date,
'description' => $request->description,
'total_debit' => $totalDebit,
'total_credit' => $totalCredit,
]);
$existing->lines()->delete();
$entry = $existing;
} else {
// 신규 생성
$entryNo = JournalEntry::generateEntryNo($tenantId, $request->entry_date);
$entry = JournalEntry::create([
'tenant_id' => $tenantId,
'entry_no' => $entryNo,
'entry_date' => $request->entry_date,
'description' => $request->description,
'total_debit' => $totalDebit,
'total_credit' => $totalCredit,
'status' => 'draft',
'source_type' => 'ecard_transaction',
'source_key' => $request->source_key,
'created_by_name' => auth()->user()?->name ?? '시스템',
]);
}
foreach ($lines as $i => $line) {
JournalEntryLine::create([
'tenant_id' => $tenantId,
'journal_entry_id' => $entry->id,
'line_no' => $i + 1,
'dc_type' => $line['dc_type'],
'account_code' => $line['account_code'],
'account_name' => $line['account_name'],
'debit_amount' => $line['debit_amount'],
'credit_amount' => $line['credit_amount'],
'description' => $line['description'] ?? null,
]);
}
// 동일 uniqueKey의 구버전 splits 자동 삭제
CardTransactionSplit::where('tenant_id', $tenantId)
->where('original_unique_key', $request->source_key)
->delete();
return $entry;
});
return response()->json([
'success' => true,
'message' => $existing ? '분개가 수정되었습니다.' : '분개가 저장되었습니다.',
'data' => ['id' => $entry->id, 'entry_no' => $entry->entry_no],
]);
} catch (\Illuminate\Database\QueryException $e) {
$lastError = $e;
if ($e->errorInfo[1] === 1062) {
continue;
}
break;
} catch (\Throwable $e) {
$lastError = $e;
break;
}
}
Log::error('카드거래 분개 저장 오류: '.$lastError->getMessage());
return response()->json([
'success' => false,
'message' => '분개 저장 실패: '.$lastError->getMessage(),
], 500);
}
/**
* 특정 카드 거래의 분개 조회
*/
public function getJournal(Request $request): JsonResponse
{
$tenantId = session('selected_tenant_id', self::HEADQUARTERS_TENANT_ID);
$sourceKey = $request->get('source_key');
if (! $sourceKey) {
return response()->json(['success' => false, 'message' => 'source_key가 필요합니다.'], 422);
}
$entry = JournalEntry::forTenant($tenantId)
->where('source_type', 'ecard_transaction')
->where('source_key', $sourceKey)
->with('lines')
->first();
if (! $entry) {
return response()->json(['success' => true, 'data' => null]);
}
return response()->json([
'success' => true,
'data' => [
'id' => $entry->id,
'entry_no' => $entry->entry_no,
'entry_date' => $entry->entry_date->format('Y-m-d'),
'description' => $entry->description,
'total_debit' => $entry->total_debit,
'total_credit' => $entry->total_credit,
'status' => $entry->status,
'lines' => $entry->lines->map(fn ($line) => [
'id' => $line->id,
'line_no' => $line->line_no,
'dc_type' => $line->dc_type,
'account_code' => $line->account_code,
'account_name' => $line->account_name,
'debit_amount' => $line->debit_amount,
'credit_amount' => $line->credit_amount,
'description' => $line->description,
]),
],
]);
}
/**
* 카드 거래 분개 삭제 (soft delete)
*/
public function deleteJournal(int $id): JsonResponse
{
$tenantId = session('selected_tenant_id', self::HEADQUARTERS_TENANT_ID);
$entry = JournalEntry::forTenant($tenantId)
->where('source_type', 'ecard_transaction')
->findOrFail($id);
$entry->delete();
return response()->json([
'success' => true,
'message' => '분개가 삭제되었습니다.',
]);
}
/**
* 기간 내 카드 거래 분개 상태 일괄 조회
*/
public function getJournalStatuses(Request $request): JsonResponse
{
$tenantId = session('selected_tenant_id', self::HEADQUARTERS_TENANT_ID);
$startDate = $request->input('startDate');
$endDate = $request->input('endDate');
if (! $startDate || ! $endDate) {
return response()->json(['success' => false, 'message' => 'startDate, endDate가 필요합니다.'], 422);
}
// YYYYMMDD → YYYY-MM-DD 변환
$startFormatted = substr($startDate, 0, 4).'-'.substr($startDate, 4, 2).'-'.substr($startDate, 6, 2);
$endFormatted = substr($endDate, 0, 4).'-'.substr($endDate, 4, 2).'-'.substr($endDate, 6, 2);
$journals = JournalEntry::where('tenant_id', $tenantId)
->where('source_type', 'ecard_transaction')
->whereBetween('entry_date', [$startFormatted, $endFormatted])
->select('id', 'source_key', 'entry_no')
->get();
$map = [];
foreach ($journals as $j) {
$map[$j->source_key] = [
'id' => $j->id,
'entry_no' => $j->entry_no,
'hasJournal' => true,
];
}
return response()->json([
'success' => true,
'data' => $map,
]);
}
/**
* SOAP 호출
*/
@@ -1819,21 +2074,21 @@ private function callSoap(string $method, array $params = []): array
if (! $this->soapClient) {
return [
'success' => false,
'error' => '바로빌 SOAP 클라이언트가 초기화되지 않았습니다.'
'error' => '바로빌 SOAP 클라이언트가 초기화되지 않았습니다.',
];
}
if (empty($this->certKey) && ! $this->isTestMode) {
return [
'success' => false,
'error' => 'CERTKEY가 설정되지 않았습니다.'
'error' => 'CERTKEY가 설정되지 않았습니다.',
];
}
if (empty($this->corpNum)) {
return [
'success' => false,
'error' => '사업자번호가 설정되지 않았습니다.'
'error' => '사업자번호가 설정되지 않았습니다.',
];
}
@@ -1859,32 +2114,34 @@ private function callSoap(string $method, array $params = []): array
return [
'success' => false,
'error' => $this->getErrorMessage((int) $resultData),
'error_code' => (int)$resultData
'error_code' => (int) $resultData,
];
}
return [
'success' => true,
'data' => $resultData
'data' => $resultData,
];
}
return [
'success' => true,
'data' => $result
'data' => $result,
];
} catch (\SoapFault $e) {
Log::error('바로빌 SOAP 오류: '.$e->getMessage());
return [
'success' => false,
'error' => 'SOAP 오류: '.$e->getMessage(),
'error_code' => $e->getCode()
'error_code' => $e->getCode(),
];
} catch (\Throwable $e) {
Log::error('바로빌 API 호출 오류: '.$e->getMessage());
return [
'success' => false,
'error' => 'API 호출 오류: ' . $e->getMessage()
'error' => 'API 호출 오류: '.$e->getMessage(),
];
}
}

View File

@@ -30,6 +30,10 @@
hide: '{{ route("barobill.ecard.hide") }}',
restore: '{{ route("barobill.ecard.restore") }}',
hidden: '{{ route("barobill.ecard.hidden") }}',
journalStore: '{{ route("barobill.ecard.journal.store") }}',
journalShow: '{{ route("barobill.ecard.journal.show") }}',
journalDelete: '/barobill/ecard/journal/',
journalStatuses: '{{ route("barobill.ecard.journal.statuses") }}',
};
const CSRF_TOKEN = '{{ csrf_token() }}';
@@ -552,6 +556,309 @@ className="flex-1 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 t
);
};
// ============================================
// CardJournalModal - 복식부기 분개 모달
// ============================================
const CardJournalModal = ({ isOpen, onClose, onSave, onDelete, log, accountCodes = [] }) => {
const formatCurrency = (val) => new Intl.NumberFormat('ko-KR').format(val || 0);
const formatAmountInput = (val) => { const n = String(val).replace(/[^\d]/g, ''); return n ? Number(n).toLocaleString() : ''; };
const parseAmountInput = (val) => parseInt(String(val).replace(/[^\d]/g, ''), 10) || 0;
if (!log) return null;
const supplyAmount = Math.round(log.effectiveSupplyAmount ?? ((log.approvalAmount || 0) - (log.tax || 0)));
const taxAmount = Math.round(log.effectiveTax ?? (log.tax || 0));
const totalAmount = supplyAmount + taxAmount;
const isDeductible = (log.deductionType || 'non_deductible') === 'deductible';
const uniqueKey = log.uniqueKey || `${log.cardNum}|${log.useDt}|${log.approvalNum}|${Math.floor(log.approvalAmount)}`;
// 기본 분개 라인
const getDefaultLines = () => {
const expenseCode = log.accountCode || '826';
const expenseName = log.accountName || '잡비';
if (isDeductible) {
return [
{ dc_type: 'debit', account_code: expenseCode, account_name: expenseName, debit_amount: supplyAmount, credit_amount: 0, description: '' },
{ dc_type: 'debit', account_code: '135', account_name: '부가세대급금', debit_amount: taxAmount, credit_amount: 0, description: '' },
{ dc_type: 'credit', account_code: '205', account_name: '미지급비용', debit_amount: 0, credit_amount: totalAmount, description: '' },
];
} else {
return [
{ dc_type: 'debit', account_code: expenseCode, account_name: expenseName, debit_amount: totalAmount, credit_amount: 0, description: '' },
{ dc_type: 'credit', account_code: '205', account_name: '미지급비용', debit_amount: 0, credit_amount: totalAmount, description: '' },
];
}
};
const [lines, setLines] = useState(getDefaultLines());
const [saving, setSaving] = useState(false);
const [loadingJournal, setLoadingJournal] = useState(false);
const [isEditMode, setIsEditMode] = useState(false);
const [journalId, setJournalId] = useState(null);
// 기존 분개 로드
useEffect(() => {
if (!isOpen || !log) return;
if (log._journalData) {
// 이미 로드된 분개 데이터가 있으면 사용
setLines(log._journalData.lines.map(l => ({
dc_type: l.dc_type,
account_code: l.account_code,
account_name: l.account_name,
debit_amount: l.debit_amount,
credit_amount: l.credit_amount,
description: l.description || '',
})));
setIsEditMode(true);
setJournalId(log._journalData.id);
} else if (log._hasJournal) {
// 분개가 있는 것으로 알고 있으면 API 조회
setLoadingJournal(true);
fetch(`${API.journalShow}?source_key=${encodeURIComponent(uniqueKey)}`)
.then(res => res.json())
.then(data => {
if (data.success && data.data) {
setLines(data.data.lines.map(l => ({
dc_type: l.dc_type,
account_code: l.account_code,
account_name: l.account_name,
debit_amount: l.debit_amount,
credit_amount: l.credit_amount,
description: l.description || '',
})));
setIsEditMode(true);
setJournalId(data.data.id);
} else {
setLines(getDefaultLines());
setIsEditMode(false);
setJournalId(null);
}
})
.catch(err => console.error('분개 로드 오류:', err))
.finally(() => setLoadingJournal(false));
} else {
setLines(getDefaultLines());
setIsEditMode(false);
setJournalId(null);
}
}, [isOpen, log]);
const updateLine = (idx, field, value) => {
setLines(prev => prev.map((l, i) => i === idx ? { ...l, [field]: value } : l));
};
const addLine = () => {
setLines(prev => [...prev, { dc_type: 'debit', account_code: '', account_name: '', debit_amount: 0, credit_amount: 0, description: '' }]);
};
const removeLine = (idx) => {
if (lines.length <= 2) return;
setLines(prev => prev.filter((_, i) => i !== idx));
};
const totalDebit = lines.reduce((sum, l) => sum + (parseInt(l.debit_amount) || 0), 0);
const totalCredit = lines.reduce((sum, l) => sum + (parseInt(l.credit_amount) || 0), 0);
const isBalanced = totalDebit === totalCredit && totalDebit > 0;
const toggleDcType = (idx) => {
setLines(prev => prev.map((l, i) => {
if (i !== idx) return l;
const newType = l.dc_type === 'debit' ? 'credit' : 'debit';
return { ...l, dc_type: newType, debit_amount: l.credit_amount, credit_amount: l.debit_amount };
}));
};
const handleSubmit = async () => {
const emptyLine = lines.find(l => !l.account_code || !l.account_name);
if (emptyLine) {
notify('모든 분개 라인의 계정과목을 선택해주세요.', 'warning');
return;
}
if (!isBalanced) {
notify('차변과 대변의 합계가 일치하지 않습니다.', 'warning');
return;
}
setSaving(true);
// entry_date: useDt에서 YYYY-MM-DD 추출
const useDt = log.useDt || '';
const entryDate = useDt.length >= 8
? `${useDt.substring(0,4)}-${useDt.substring(4,6)}-${useDt.substring(6,8)}`
: new Date().toISOString().substring(0,10);
await onSave({
source_key: uniqueKey,
entry_date: entryDate,
description: `${log.merchantName || ''} 카드결제`,
lines,
});
setSaving(false);
};
const handleDelete = async () => {
if (!journalId) return;
if (!confirm('분개를 삭제하시겠습니까?')) return;
setSaving(true);
await onDelete(journalId);
setSaving(false);
};
if (!isOpen) return null;
return (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
<div className="bg-white rounded-2xl shadow-2xl w-full max-w-3xl mx-4 max-h-[90vh] overflow-hidden">
<div className="p-6 border-b border-stone-100 flex items-center justify-between">
<h3 className="text-lg font-bold text-stone-900">
{isEditMode ? '분개 수정' : '분개 생성'}
</h3>
<button onClick={onClose} className="p-2 hover:bg-stone-100 rounded-lg transition-colors">
<svg className="w-5 h-5 text-stone-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div className="p-6 overflow-y-auto max-h-[65vh] space-y-5">
{/* 카드 거래 정보 */}
<div className="bg-stone-50 rounded-xl p-4">
<h4 className="text-sm font-semibold text-stone-700 mb-3">카드 거래 정보</h4>
<div className="grid grid-cols-2 md:grid-cols-4 gap-3 text-sm">
<div><span className="text-stone-500">가맹점: </span><span className="font-medium">{log.merchantName || '-'}</span></div>
<div><span className="text-stone-500">사용일시: </span><span className="font-medium">{log.useDateTime || '-'}</span></div>
<div><span className="text-stone-500">공급가액: </span><span className="font-medium">{formatCurrency(supplyAmount)}</span></div>
<div><span className="text-stone-500">세액: </span><span className="font-medium">{formatCurrency(taxAmount)}</span></div>
</div>
</div>
{loadingJournal ? (
<div className="flex items-center justify-center py-8">
<div className="animate-spin rounded-full h-6 w-6 border-2 border-purple-600 border-t-transparent"></div>
<span className="ml-2 text-sm text-stone-500">분개 데이터 로딩중...</span>
</div>
) : (
<div>
<h4 className="text-sm font-semibold text-stone-700 mb-3">분개 내역</h4>
<table className="w-full text-sm border border-stone-200 rounded-lg overflow-hidden">
<thead>
<tr className="bg-stone-100">
<th className="px-3 py-2 text-center text-xs font-semibold text-stone-600 border-b border-stone-200" style={{width:'60px'}}>/</th>
<th className="px-3 py-2 text-center text-xs font-semibold text-stone-600 border-b border-stone-200">계정과목</th>
<th className="px-3 py-2 text-center text-xs font-semibold text-stone-600 border-b border-stone-200" style={{width:'140px'}}>차변금액</th>
<th className="px-3 py-2 text-center text-xs font-semibold text-stone-600 border-b border-stone-200" style={{width:'140px'}}>대변금액</th>
<th className="px-3 py-2 text-center text-xs font-semibold text-stone-600 border-b border-stone-200" style={{width:'40px'}}></th>
</tr>
</thead>
<tbody>
{lines.map((line, idx) => (
<tr key={idx} className="border-b border-stone-100">
<td className="px-3 py-2 text-center">
<button
type="button"
onClick={() => toggleDcType(idx)}
className={`px-2 py-0.5 rounded text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity ${line.dc_type === 'debit' ? 'bg-blue-100 text-blue-700' : 'bg-red-100 text-red-700'}`}
title="클릭하여 차변/대변 전환"
>
{line.dc_type === 'debit' ? '차변' : '대변'}
</button>
</td>
<td className="px-3 py-2">
<AccountCodeSelect
value={line.account_code}
onChange={(code, name) => {
setLines(prev => prev.map((l, i) => i === idx ? { ...l, account_code: code, account_name: name } : l));
}}
accountCodes={accountCodes}
/>
</td>
<td className="px-3 py-2">
<input
type="text"
value={formatAmountInput(line.debit_amount)}
onChange={(e) => updateLine(idx, 'debit_amount', parseAmountInput(e.target.value))}
className="w-full px-2 py-1 border border-stone-200 rounded text-sm text-right focus:ring-1 focus:ring-purple-500 outline-none"
/>
</td>
<td className="px-3 py-2">
<input
type="text"
value={formatAmountInput(line.credit_amount)}
onChange={(e) => updateLine(idx, 'credit_amount', parseAmountInput(e.target.value))}
className="w-full px-2 py-1 border border-stone-200 rounded text-sm text-right focus:ring-1 focus:ring-purple-500 outline-none"
/>
</td>
<td className="px-3 py-2 text-center">
<button
onClick={() => removeLine(idx)}
disabled={lines.length <= 2}
className="text-red-400 hover:text-red-600 disabled:opacity-30 disabled:cursor-not-allowed"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M20 12H4" />
</svg>
</button>
</td>
</tr>
))}
{/* 합계 */}
<tr className={`font-bold ${isBalanced ? 'bg-green-50' : 'bg-red-50'}`}>
<td colSpan="2" className="px-3 py-2 text-center text-sm">합계</td>
<td className="px-3 py-2 text-right text-sm">{formatCurrency(totalDebit)}</td>
<td className="px-3 py-2 text-right text-sm">{formatCurrency(totalCredit)}</td>
<td></td>
</tr>
</tbody>
</table>
{!isBalanced && (
<p className="text-red-500 text-xs mt-2">차변과 대변의 합계가 일치하지 않습니다. (차이: {formatCurrency(Math.abs(totalDebit - totalCredit))})</p>
)}
{/* 행 추가 버튼 */}
<button
onClick={addLine}
className="mt-3 w-full py-2 border-2 border-dashed border-stone-300 text-stone-500 rounded-lg hover:border-purple-400 hover:text-purple-600 transition-colors flex items-center justify-center gap-2 text-sm"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 4v16m8-8H4" />
</svg>
추가
</button>
</div>
)}
</div>
<div className="p-4 border-t border-stone-100 flex justify-between">
<div>
{isEditMode && journalId && (
<button
onClick={handleDelete}
disabled={saving}
className="px-4 py-2 bg-red-50 text-red-600 rounded-lg text-sm font-medium hover:bg-red-100 transition-colors disabled:opacity-50"
>
분개 삭제
</button>
)}
</div>
<div className="flex gap-3">
<button onClick={onClose} className="px-4 py-2 bg-stone-100 text-stone-700 rounded-lg text-sm font-medium hover:bg-stone-200 transition-colors">
취소
</button>
<button
onClick={handleSubmit}
disabled={saving || !isBalanced || loadingJournal}
className="px-6 py-2 bg-purple-600 text-white rounded-lg text-sm font-medium hover:bg-purple-700 transition-colors disabled:opacity-50 flex items-center gap-2"
>
{saving && <div className="animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"></div>}
{isEditMode ? '분개 수정' : '분개 저장'}
</button>
</div>
</div>
</div>
</div>
);
};
// 카드사 코드 목록
const CARD_COMPANIES = [
{ code: '01', name: '비씨' },
@@ -979,6 +1286,8 @@ className="flex-1 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 t
hiddenLogs,
onRestore,
loadingHidden,
journalMap,
onOpenJournalModal,
}) => {
const formatCurrency = (val) => new Intl.NumberFormat('ko-KR').format(val || 0) + '원';
@@ -1029,19 +1338,35 @@ className="flex-1 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 t
{/* 원본 거래 행 */}
<tr className={`hover:bg-stone-50 transition-colors ${log.isSaved ? 'bg-purple-50/30' : ''} ${hasSplits ? 'bg-amber-50/50' : ''}`}>
<td className="px-3 py-3 text-center">
{hasSplits ? (
{(() => {
const jInfo = journalMap[uniqueKey];
if (jInfo) {
// 복식부기 분개 완료
return (
<button
onClick={() => onDeleteSplits(uniqueKey)}
className="p-1.5 text-red-500 hover:bg-red-100 rounded-lg transition-colors"
title="분개 삭제"
onClick={() => onOpenJournalModal(log, uniqueKey, true)}
className="px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded text-[10px] font-bold hover:bg-emerald-200 transition-colors"
title={`전표: ${jInfo.entry_no}`}
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M20 12H4" />
</svg>
분개완료
</button>
) : (
);
} else if (hasSplits) {
// 구버전 splits만 존재
return (
<button
onClick={() => onOpenSplitModal(log, uniqueKey)}
onClick={() => onOpenJournalModal(log, uniqueKey, false)}
className="px-1.5 py-0.5 bg-amber-100 text-amber-700 rounded text-[10px] font-bold hover:bg-amber-200 transition-colors"
title="구버전 분개 → 복식부기 전환"
>
구버전
</button>
);
} else {
// 분개 없음
return (
<button
onClick={() => onOpenJournalModal(log, uniqueKey, false)}
className="p-1.5 text-purple-500 hover:bg-purple-100 rounded-lg transition-colors"
title="분개 추가"
>
@@ -1049,7 +1374,9 @@ className="p-1.5 text-purple-500 hover:bg-purple-100 rounded-lg transition-color
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 4v16m8-8H4" />
</svg>
</button>
)}
);
}
})()}
</td>
<td className="px-4 py-3 whitespace-nowrap">
<div className="font-medium text-stone-900">{log.useDateTime || '-'}</div>
@@ -1133,8 +1460,11 @@ className="w-full px-2 py-1 text-sm border border-stone-200 rounded focus:outlin
</div>
);
})()}
{hasSplits && (
<div className="text-xs text-amber-600 mt-1">분개됨 ({logSplits.length})</div>
{journalMap[uniqueKey] && (
<div className="text-xs text-emerald-600 mt-1">{journalMap[uniqueKey].entry_no}</div>
)}
{!journalMap[uniqueKey] && hasSplits && (
<div className="text-xs text-amber-600 mt-1">구버전({logSplits.length})</div>
)}
</td>
<td className={`px-4 py-3 text-right ${log.isAmountModified && log.modifiedSupplyAmount !== null ? 'bg-orange-50' : ''}`}>
@@ -1395,7 +1725,12 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6
const [accountCodes, setAccountCodes] = useState([]);
const [hasChanges, setHasChanges] = useState(false);
// 분개 관련 상태
// 복식부기 분개 관련 상태
const [journalMap, setJournalMap] = useState({});
const [journalModalOpen, setJournalModalOpen] = useState(false);
const [journalModalLog, setJournalModalLog] = useState(null);
// 구버전 분개 관련 상태
const [splits, setSplits] = useState({});
const [splitModalOpen, setSplitModalOpen] = useState(false);
const [splitModalLog, setSplitModalLog] = useState(null);
@@ -1501,6 +1836,7 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6
// 분개 데이터 로드
loadSplits();
loadJournalStatuses();
};
// 분개 데이터 로드
@@ -1522,6 +1858,88 @@ className="px-3 py-1 bg-green-500 text-white text-xs rounded-lg hover:bg-green-6
}
};
// 복식부기 분개 상태 로드
const loadJournalStatuses = async () => {
try {
const params = new URLSearchParams({
startDate: dateFrom.replace(/-/g, ''),
endDate: dateTo.replace(/-/g, '')
});
const response = await fetch(`${API.journalStatuses}?${params}`);
const data = await response.json();
if (data.success) {
setJournalMap(data.data || {});
}
} catch (err) {
console.error('분개 상태 로드 오류:', err);
}
};
// 복식부기 분개 모달 열기
const handleOpenJournalModal = (log, uniqueKey, hasJournal) => {
const logWithJournalInfo = {
...log,
uniqueKey,
_hasJournal: hasJournal,
_journalData: null,
};
setJournalModalLog(logWithJournalInfo);
setJournalModalOpen(true);
};
// 복식부기 분개 저장
const handleSaveJournal = async (payload) => {
try {
const response = await fetch(API.journalStore, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': CSRF_TOKEN,
'Accept': 'application/json'
},
body: JSON.stringify(payload)
});
const data = await response.json();
if (data.success) {
notify(data.message, 'success');
setJournalModalOpen(false);
setJournalModalLog(null);
loadJournalStatuses();
loadSplits(); // splits 자동 삭제 반영
} else {
notify(data.message || '분개 저장 실패', 'error');
}
} catch (err) {
notify('분개 저장 오류: ' + err.message, 'error');
}
};
// 복식부기 분개 삭제
const handleDeleteJournal = async (journalId) => {
try {
const response = await fetch(`${API.journalDelete}${journalId}`, {
method: 'DELETE',
headers: {
'X-CSRF-TOKEN': CSRF_TOKEN,
'Accept': 'application/json'
}
});
const data = await response.json();
if (data.success) {
notify(data.message, 'success');
setJournalModalOpen(false);
setJournalModalLog(null);
loadJournalStatuses();
} else {
notify(data.message || '분개 삭제 실패', 'error');
}
} catch (err) {
notify('분개 삭제 오류: ' + err.message, 'error');
}
};
// 요약 재계산: 분개가 있는 거래는 원본 대신 분개별 통계로 대체
// 수정된 공급가액/세액이 있으면 해당 값으로 합계 반영
const recalculateSummary = (currentLogs, allSplits) => {
@@ -2245,6 +2663,8 @@ className={`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium tra
hiddenLogs={hiddenLogs}
onRestore={handleRestore}
loadingHidden={loadingHidden}
journalMap={journalMap}
onOpenJournalModal={handleOpenJournalModal}
/>
)}
@@ -2259,6 +2679,16 @@ className={`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium tra
splits={splitModalExisting}
/>
{/* Card Journal Modal (복식부기) */}
<CardJournalModal
isOpen={journalModalOpen}
onClose={() => { setJournalModalOpen(false); setJournalModalLog(null); }}
onSave={handleSaveJournal}
onDelete={handleDeleteJournal}
log={journalModalLog}
accountCodes={accountCodes}
/>
{/* Manual Entry Modal */}
<ManualEntryModal
isOpen={manualModalOpen}

View File

@@ -580,6 +580,11 @@
Route::post('/hide', [\App\Http\Controllers\Barobill\EcardController::class, 'hideTransaction'])->name('hide');
Route::post('/restore', [\App\Http\Controllers\Barobill\EcardController::class, 'restoreTransaction'])->name('restore');
Route::get('/hidden', [\App\Http\Controllers\Barobill\EcardController::class, 'hiddenTransactions'])->name('hidden');
// 복식부기 분개 (journal_entries 통합)
Route::post('/journal', [\App\Http\Controllers\Barobill\EcardController::class, 'storeJournal'])->name('journal.store');
Route::get('/journal', [\App\Http\Controllers\Barobill\EcardController::class, 'getJournal'])->name('journal.show');
Route::delete('/journal/{id}', [\App\Http\Controllers\Barobill\EcardController::class, 'deleteJournal'])->name('journal.delete');
Route::get('/journal-statuses', [\App\Http\Controllers\Barobill\EcardController::class, 'getJournalStatuses'])->name('journal.statuses');
});
// 홈택스 매출/매입 (React 페이지)