<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tbl_payment_voucher', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('idsupplier');
            $table->unsignedBigInteger('idway_to_pay');
            $table->unsignedBigInteger('idsource_bank');
            $table->unsignedBigInteger('idreceiving_bank')->nullable();
            $table->string('series');
            $table->date('entry_date');
            $table->date('document_date');
            $table->unsignedBigInteger('amount');
            $table->unsignedBigInteger('idcompany');
            $table->char('status', 1)->default(1);

            $table->foreign('idsupplier')->references('id')->on('tbl_supplier');
            $table->foreign('idway_to_pay')->references('id')->on('tbl_way_to_pay');
            $table->foreign('idsource_bank')->references('id')->on('tbl_bank');
            $table->foreign('idreceiving_bank')->references('id')->on('tbl_bank');
            $table->foreign('idcompany')->references('id')->on('tbl_company');
            $table->timestamps();
        });
    }

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