Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

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

class AlterPaymentOrdersTableAddColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('payment_orders', function (Blueprint $table) {
$table->unsignedInteger('form_id')->nullable()->index();
$table->unsignedInteger('supplier_id')->index();
$table->decimal('total_invoice', 65, 30);
$table->decimal('total_down_payment', 65, 30);
$table->decimal('total_return', 65, 30);
$table->decimal('total_other', 65, 30);
$table->timestamps();

$table->foreign('form_id')
->references('id')
->on('forms');
$table->foreign('supplier_id')
->references('id')
->on('suppliers');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('payment_orders', function (Blueprint $table) {
$table->dropForeign(['supplier_id']);
$table->dropForeign(['form_id']);
$table->dropColumn(['updated_at', 'created_at', 'total_other', 'total_return', 'total_down_payment', 'total_invoice', 'supplier_id', 'form_id']);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

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

class CreatePaymentOrderInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_invoices', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->unsignedInteger('purchase_invoice_id')->index();
$table->decimal('amount', 65, 30);
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('purchase_invoice_id')
->references('id')
->on('purchase_invoices');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_invoices');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

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

class CreatePaymentOrderDownPaymentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_down_payments', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->unsignedInteger('purchase_down_payment_id')->index();
$table->decimal('amount', 65, 30);
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('purchase_down_payment_id')
->references('id')
->on('purchase_down_payments');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_down_payments');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

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

class CreatePaymentOrderReturnsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_returns', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->unsignedInteger('purchase_return_id')->index();
$table->decimal('amount', 65, 30);
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('purchase_return_id')
->references('id')
->on('purchase_returns');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_returns');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

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

class CreatePaymentOrderOthersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_others', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->unsignedInteger('chart_of_account_id')->index();
$table->unsignedInteger('allocation_id')->nullable()->index();
$table->decimal('amount', 65, 30);
$table->text('notes')->nullable();
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('chart_of_account_id')
->references('id')
->on('chart_of_accounts');
$table->foreign('allocation_id')
->references('id')
->on('allocations');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_others');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

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

class CreatePaymentOrderHistoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_histories', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->unsignedInteger('user_id')->index();
$table->string('activity')->nullable();
$table->json('archive')->nullable();
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('user_id')
->references('id')
->on('users');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_histories');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

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

class CreatePurchaseInvoiceDoneTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('purchase_invoice_done', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('purchase_invoice_id')->index();
$table->string('ref_no')->nullable();
$table->decimal('value', 65, 30);
$table->timestamps();

$table->foreign('purchase_invoice_id')
->references('id')
->on('purchase_invoices');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('purchase_invoice_done');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

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

class CreatePaymentOrderArchiveTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payment_order_archive', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('payment_order_id')->index();
$table->string('payment_type');
$table->datetime('due_date')->nullable();
$table->unsignedInteger('payment_account_id')->nullable();
$table->decimal('amount', 65, 30);
$table->unsignedInteger('paymentable_id')->nullable();
$table->string('paymentable_type')->nullable();
$table->string('paymentable_name')->nullable();
$table->unsignedInteger('payment_id')->nullable();
$table->unsignedInteger('form_id')->nullable()->index();
$table->unsignedInteger('supplier_id')->index();
$table->decimal('total_invoice', 65, 30);
$table->decimal('total_down_payment', 65, 30);
$table->decimal('total_return', 65, 30);
$table->decimal('total_other', 65, 30);
$table->timestamps();

$table->foreign('payment_order_id')
->references('id')
->on('payment_orders');
$table->foreign('payment_account_id')
->references('id')
->on('chart_of_accounts');
$table->foreign('payment_id')
->references('id')
->on('payments');
$table->foreign('form_id')
->references('id')
->on('forms');
$table->foreign('supplier_id')
->references('id')
->on('suppliers');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_order_archive');
}
}
1 change: 1 addition & 0 deletions database/seeds/first/PermissionSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private function setPurchasePermission()
'purchase invoice',
'purchase down payment',
'purchase return',
'purchase payment order',
];

foreach ($allPermission as $permission) {
Expand Down