2024-10-30 19:28:03 -04:00
|
|
|
<?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();
|
|
|
|
|
2024-11-13 23:34:53 -05:00
|
|
|
$table->string('internal_id')->nullable();
|
2024-11-12 16:54:48 -05:00
|
|
|
$table->foreignId('customer_id')->nullable()->constrained();
|
2024-11-05 11:35:23 -05:00
|
|
|
|
2024-11-13 23:34:53 -05:00
|
|
|
$table->string('status')->default('UNPAID');
|
|
|
|
|
2025-01-07 14:32:17 -05:00
|
|
|
$table->decimal('subtotal', 8, 2)->default(0.00);
|
|
|
|
$table->decimal('total', 8, 2)->default(0.00);
|
2024-11-05 11:35:23 -05:00
|
|
|
|
2025-01-14 17:17:04 -05:00
|
|
|
$table->decimal('pst_rate', 8, 2);
|
|
|
|
$table->decimal('gst_rate', 8, 2);
|
2025-01-21 21:28:41 -05:00
|
|
|
$table->decimal('hst_rate', 8, 2);
|
2025-01-14 17:17:04 -05:00
|
|
|
|
|
|
|
$table->decimal('pst_amount', 8, 2)->nullable();
|
|
|
|
$table->decimal('gst_amount', 8, 2)->nullable();
|
2025-01-21 21:28:41 -05:00
|
|
|
$table->decimal('hst_amount', 8, 2)->nullable();
|
2025-01-14 17:17:04 -05:00
|
|
|
|
|
|
|
$table->boolean('has_pst')->default(false);
|
|
|
|
$table->boolean('has_gst')->default(true);
|
2025-01-21 21:28:41 -05:00
|
|
|
$table->boolean('has_hst')->default(false);
|
2024-10-30 19:28:03 -04:00
|
|
|
|
2024-11-05 11:35:23 -05:00
|
|
|
$table->date('date')->default(today());
|
|
|
|
$table->date('due_date')->nullable();
|
|
|
|
|
2024-12-10 15:28:14 -08:00
|
|
|
$table->softDeletes();
|
2024-10-30 19:28:03 -04:00
|
|
|
$table->timestamps();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down(): void
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('invoices');
|
|
|
|
}
|
|
|
|
};
|