gst
This commit is contained in:
@@ -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',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user