This commit is contained in:
Abhishek Mali
2025-11-25 13:14:53 +05:30
parent a14fe614e5
commit bebe0711f4
18 changed files with 1105 additions and 623 deletions

View File

@@ -0,0 +1,53 @@
<?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::table('invoices', function (Blueprint $table) {
// GST type — gst or igst
$table->enum('tax_type', ['gst', 'igst'])
->default('gst')
->after('final_amount');
// Old gst_percent becomes optional
$table->decimal('gst_percent', 5, 2)
->nullable()
->change();
// Split GST %
$table->decimal('cgst_percent', 5, 2)
->nullable()
->after('gst_percent');
$table->decimal('sgst_percent', 5, 2)
->nullable()
->after('cgst_percent');
// IGST %
$table->decimal('igst_percent', 5, 2)
->nullable()
->after('sgst_percent');
// Tax amount recalculation is the same
// gst_amount and final_amount_with_gst already exist
});
}
public function down(): void
{
Schema::table('invoices', function (Blueprint $table) {
$table->dropColumn([
'tax_type',
'cgst_percent',
'sgst_percent',
'igst_percent',
]);
});
}
};

View File

@@ -0,0 +1,30 @@
<?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('invoice_installments', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('invoice_id');
$table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
$table->date('installment_date');
$table->string('payment_method')->nullable(); // cash, bank, UPI, cheque, etc
$table->string('reference_no')->nullable();
$table->decimal('amount', 10, 2);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('invoice_installments');
}
};