<?php

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

class CreateSalesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('sales', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('client_id')->unsigned();
			$table->enum('client_type', array('customer', 'client'))->default('customer');
			$table->enum('method_of_payment', array('card', 'cash', 'cheque'))->default('card');
			$table->float('total_price')->default(0);
			$table->boolean('include_vat')->default(FALSE);
			$table->smallInteger('vat')->unsigned()->default(20);
			$table->float('discout')->default(0);
			$table->boolean('refunded')->default(FALSE);
			$table->timestamp('sale_date')->default('0000-00-00 00:00:00');
			$table->integer('created_by')->nullable()->unsigned();
			$table->integer('modified_by')->nullable()->unsigned();
			$table->timestamps();
		});
	}

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

}
