HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/erp.nhatnamsst.com/database/migrations/2025_02_01_000000_create_debts_table.php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('debts', function (Blueprint $table) {
            $table->id();
            $table->string('invoice_number')->unique()->nullable(); // Số hóa đơn (HD00000142)
            $table->date('invoice_date')->nullable(); // Ngày xuất hóa đơn
            $table->date('debt_aging_date')->nullable(); // Ngày công nợ
            $table->unsignedBigInteger('sale_id')->nullable(); // Nhân viên sale
            $table->unsignedBigInteger('sale_leader_id')->nullable(); // Sale Leader
            $table->unsignedBigInteger('customer_id')->nullable(); // Khách hàng
            $table->integer('customer_type')->nullable(); // Loại khách hàng (EU, TM, CN)
            $table->integer('payment_days')->default(30); // Số ngày thanh toán
            $table->decimal('total_po_price', 15, 2)->default(0); // Tổng giá PO
            $table->decimal('vat_percent', 5, 2)->default(10); // % thuế VAT
            $table->decimal('total_payment_amount', 15, 2)->default(0); // Tổng số tiền thanh toán
            $table->decimal('advance_payment', 15, 2)->default(0); // Tiền trả trước
            $table->string('due_date_warning')->nullable(); // Cảnh báo hạn thanh toán
            $table->text('related_pos')->nullable(); // PO liên quan (PO230345;PO230766)
            $table->decimal('remaining_amount', 15, 2)->default(0); // Số tiền còn lại
            $table->integer('status')->default(1); // Trạng thái (1: Chưa thanh toán, 2: Đang thanh toán, 3: Hoàn thành)
            $table->string('payment_method')->nullable(); // Phương thức thanh toán (Trả sau, Trả trước, etc.)
            $table->text('accounting_note')->nullable(); // Ghi chú kế toán
            $table->text('attached_file')->nullable(); // File đính kèm (JSON array)
            $table->timestamps();
            
            $table->foreign('sale_id')->references('id')->on('admins')->onDelete('set null');
            $table->foreign('sale_leader_id')->references('id')->on('admins')->onDelete('set null');
            $table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('debts');
    }
};