<?php

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

class CreateReceivingNotesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('receiving_notes', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('purchase_order_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('p_id')->nullable();
            $table->string('grn_number')->nullable();
            $table->double('total_quantity')->nullable();
            $table->double('rejected_quantity')->nullable();
            $table->double('accepted_quantity')->nullable();
              $table->unsignedInteger('au_id')->nullable();
            $table->enum('grn_type', ['Service','Product'])->default('Product');
            $table->enum('grn_status', ['0','1'])->default('0');
            $table->enum('status', ['Pending','Approved'])->default('Pending');
            $table->enum('is_recycle', ['0','1','2'])->default('0');
            $table->timestamp('receive_date')->nullable();
            $table->timestamps();
        });
    }

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