<?php

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

class CreateInvoicesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('invoices', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('client_id')->unsigned();
			$table->enum('client_type', array('customer', 'client'))->default('customer');
			$table->float('total_amount')->default(0);
			$table->float('pending_amount')->default(0);
			$table->boolean('include_vat')->default(FALSE);
			$table->smallInteger('vat')->unsigned()->default(20);
			$table->float('discount')->default(0);
			$table->integer('status')->nullable()->unsigned();
			$table->date('invoice_date')->default('0000-00-00');
			$table->integer('created_by')->nullable()->unsigned();
			$table->integer('updated_by')->nullable()->unsigned();
			$table->timestamps();
		});
	}

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

}
