diff --git a/database/migrations/2026_02_09_100000_create_hometax_invoice_journals_table.php b/database/migrations/2026_02_09_100000_create_hometax_invoice_journals_table.php new file mode 100644 index 0000000..7309be6 --- /dev/null +++ b/database/migrations/2026_02_09_100000_create_hometax_invoice_journals_table.php @@ -0,0 +1,43 @@ +id(); + $table->unsignedBigInteger('tenant_id')->comment('테넌트 ID'); + $table->unsignedBigInteger('hometax_invoice_id')->comment('홈택스 세금계산서 ID'); + $table->string('nts_confirm_num', 50)->comment('국세청승인번호'); + + $table->enum('dc_type', ['debit', 'credit'])->comment('차변/대변'); + $table->string('account_code', 20)->comment('계정과목 코드'); + $table->string('account_name', 100)->comment('계정과목명'); + $table->bigInteger('debit_amount')->default(0)->comment('차변금액'); + $table->bigInteger('credit_amount')->default(0)->comment('대변금액'); + $table->string('description', 500)->nullable()->comment('적요'); + $table->integer('sort_order')->default(0)->comment('정렬순서'); + + $table->string('invoice_type', 20)->comment('매출/매입 (sales/purchase)'); + $table->date('write_date')->nullable()->comment('작성일자'); + $table->bigInteger('supply_amount')->default(0)->comment('공급가액'); + $table->bigInteger('tax_amount')->default(0)->comment('세액'); + $table->bigInteger('total_amount')->default(0)->comment('합계금액'); + $table->string('trading_partner_name', 200)->nullable()->comment('거래처명'); + + $table->timestamps(); + + $table->index(['tenant_id', 'hometax_invoice_id'], 'idx_hij_tenant_invoice'); + $table->index(['tenant_id', 'write_date'], 'idx_hij_tenant_write_date'); + }); + } + + public function down(): void + { + Schema::dropIfExists('hometax_invoice_journals'); + } +};