37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('invoices', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('invoice_number')->unique();
|
|
$table->foreignId('patient_id')->constrained('patients');
|
|
$table->foreignId('treatment_id')->nullable()->constrained('treatments');
|
|
$table->date('invoice_date');
|
|
$table->date('due_date');
|
|
$table->decimal('subtotal', 15, 2)->default(0);
|
|
$table->decimal('tax_amount', 15, 2)->default(0);
|
|
$table->decimal('discount_amount', 15, 2)->default(0);
|
|
$table->decimal('total_amount', 15, 2)->default(0);
|
|
$table->decimal('paid_amount', 15, 2)->default(0);
|
|
$table->enum('status', ['draft', 'sent', 'paid', 'partial', 'overdue', 'cancelled'])->default('draft');
|
|
$table->foreignId('currency_id')->constrained('currencies');
|
|
$table->text('notes')->nullable();
|
|
$table->foreignId('created_by')->constrained('users');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('invoices');
|
|
}
|
|
};
|