<?php

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

class CreateReceiptVoucherTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('receipt_voucher', function (Blueprint $table) {
            $table->id();
            $table->string('reference_no')->nullable();
            $table->date('payment_date')->nullable();
            $table->string('attachment_file')->nullable();
            $table->bigInteger('delivery_address_id')->nullable()->unsigned();
            $table->foreign('delivery_address_id')->references('id')->on('client_address');
            $table->string('comment')->nullable();
            $table->string('advance_description')->nullable();
            $table->double('advance_percentage')->nullable();
            $table->double('advance_amount')->nullable();
            $table->string('file')->nullable();
            $table->bigInteger('tnc_id')->nullable()->unsigned();
            $table->foreign('tnc_id')->references('id')->on('terms_and_conditaions');
            $table->bigInteger('quotation_id')->nullable()->unsigned();
            $table->foreign('quotation_id')->references('id')->on('quotation');
            $table->timestamps();
        });
    }

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