<?php

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

class CreatePoTaxInvoiceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('po_tax_invoice', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('purchase_order_id')->nullable()->unsigned();
            $table->foreign('purchase_order_id')->references('id')->on('purchase_order');
            $table->string('file')->nullable();
            $table->bigInteger('reviewed_by_user_id')->nullable()->unsigned();
            $table->foreign('reviewed_by_user_id')->references('id')->on('users');
            $table->date('payment_date')->nullable();
            $table->string('reference_no')->nullable();
            $table->double('amount')->nullable();
            $table->string('inward_number')->nullable();
            $table->date('document_date')->nullable();
            $table->bigInteger('payment_terms_id')->nullable()->unsigned();
            $table->foreign('payment_terms_id')->references('id')->on('payment_terms');
            $table->date('inward_date')->nullable();
            $table->bigInteger('delivery_address_id')->nullable()->unsigned();
            $table->foreign('delivery_address_id')->references('id')->on('client_address');
            $table->double('total')->nullable();
            $table->string('comment')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('po_tax_invoice');
    }
}
