Untitled

 avatar
unknown
plain_text
6 months ago
2.1 kB
3
Indexable
Schema::create('issued_invoices', function (Blueprint $table) {
            $table->id();
            $table->foreignId('cost_center_id')
                ->constrained('cost_centers')
                ->onDelete('cascade');
            $table->enum('state', [InhouseInvoicesState::NEW->value, InhouseInvoicesState::SEND->value])->default(InhouseInvoicesState::NEW->value);
            $table->date('date');

            $table->enum('type', [InvoiceType::INVOICE->value, InvoiceType::INHOUSE->value])->default(InvoiceType::INVOICE->value);

            $table->unsignedBigInteger('contract_id'); // Foreign key to contracts table
            $table->unsignedBigInteger('document_id')->nullable(); // Foreign key to documents table
            $table->string('invoice_number', 30)->nullable(); // číslo_dokladu
            $table->string('customer', 255)->nullable(); // odběratel
            $table->dateTime('date')->nullable(); // datum
            $table->dateTime('due_date')->nullable(); // datum_splatnosti
            $table->double('amount_exclude_vat')->nullable(); // celkem_bez_dph
            $table->double('amount_include_vat')->nullable(); // celkem_sdph
            $table->double('amount_paid')->nullable(); // uhrazeno
            $table->dateTime('tax_date')->nullable(); // datum_zdanitelneho_plneni
            $table->dateTime('accounting_date')->nullable(); // datum_ucetniho_pripadu
            $table->unsignedBigInteger('period_id'); // Foreign key to contract period table
            $table->unsignedInteger('next_version_id')->nullable(); // následná verze
            $table->timestamps();

            $table->foreign('contract_id')->references('id')->on('contracts')->onDelete('cascade');
            $table->foreign('document_id')->references('id')->on('zakazka_doklad')->onDelete('set null');
            $table->foreign('period_id')->references('id')->on('contract_periods')->onDelete('cascade');
            $table->foreign('next_version_id')->references('id')->on('contract_issued_invoice')->onDelete('set null');

        });
Editor is loading...
Leave a Comment