From f662a389f763d5bea992b230b27e3ff0a2f7d52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 11 Mar 2026 10:15:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[account-codes]=20=EA=B3=84=EC=A0=95?= =?UTF-8?q?=EA=B3=BC=EB=AA=A9=20=EC=A4=91=EB=B3=B5=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=A0=95=EB=A6=AC=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 비표준 코드(5자리 KIS 중복, 1-2자리 카테고리 헤더) 비활성화 - 홈택스 분개 코드 수정: 135→117, 251→201, 255→208 --- ...01502_fix_account_codes_duplicate_data.php | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 database/migrations/2026_03_11_101502_fix_account_codes_duplicate_data.php diff --git a/database/migrations/2026_03_11_101502_fix_account_codes_duplicate_data.php b/database/migrations/2026_03_11_101502_fix_account_codes_duplicate_data.php new file mode 100644 index 0000000..197e599 --- /dev/null +++ b/database/migrations/2026_03_11_101502_fix_account_codes_duplicate_data.php @@ -0,0 +1,65 @@ +where('is_active', true) + ->whereRaw('LENGTH(code) != 3') + ->update(['is_active' => false]); + + // 2. 홈택스 분개에서 잘못된 코드 수정 + $fixed135 = DB::table('hometax_invoice_journals') + ->where('account_code', '135') + ->update(['account_code' => '117', 'account_name' => '부가세대급금']); + + $fixed251 = DB::table('hometax_invoice_journals') + ->where('account_code', '251') + ->where('account_name', '외상매입금') + ->update(['account_code' => '201']); + + $fixed255 = DB::table('hometax_invoice_journals') + ->where('account_code', '255') + ->where('account_name', '부가세예수금') + ->update(['account_code' => '208']); + + Log::info('[Migration] 계정과목 정리 완료', [ + 'deactivated_codes' => $deactivated, + 'fixed_135_to_117' => $fixed135, + 'fixed_251_to_201' => $fixed251, + 'fixed_255_to_208' => $fixed255, + ]); + } + + public function down(): void + { + // 비활성화된 비표준 코드 복원 + DB::table('account_codes') + ->where('is_active', false) + ->whereRaw('LENGTH(code) != 3') + ->update(['is_active' => true]); + + // 분개 코드 원복 + DB::table('hometax_invoice_journals') + ->where('account_code', '117') + ->where('account_name', '부가세대급금') + ->update(['account_code' => '135']); + } +};