diff --git a/database/migrations/2022_05_28_234651_create_purchase_orders_table.php b/database/migrations/2022_05_28_234651_create_purchase_orders_table.php new file mode 100644 index 000000000000..1229e46fe622 --- /dev/null +++ b/database/migrations/2022_05_28_234651_create_purchase_orders_table.php @@ -0,0 +1,122 @@ +id(); + $table->unsignedInteger('client_id')->index(); + $table->unsignedInteger('user_id'); + $table->unsignedInteger('assigned_user_id')->nullable(); + $table->unsignedInteger('company_id')->index(); + $table->unsignedInteger('status_id'); + $table->unsignedInteger('project_id')->nullable(); + $table->unsignedInteger('vendor_id')->nullable(); + $table->unsignedInteger('recurring_id')->nullable(); + $table->unsignedInteger('design_id')->nullable(); + $table->unsignedInteger('invoice_id')->nullable(); + + $table->string('number')->nullable(); + $table->float('discount')->default(0); + $table->boolean('is_amount_discount')->default(0); + + $table->string('po_number')->nullable(); + $table->date('date')->nullable(); + $table->datetime('last_sent_date')->nullable(); + + $table->date('due_date')->nullable(); + + $table->boolean('is_deleted')->default(false); + $table->mediumText('line_items')->nullable(); + $table->mediumText('backup')->nullable(); + $table->text('footer')->nullable(); + $table->text('public_notes')->nullable(); + $table->text('private_notes')->nullable(); + $table->text('terms')->nullable(); + + $table->string('tax_name1')->nullable(); + + + $table->decimal('tax_rate1', 20, 6)->default(0); + + $table->string('tax_name2')->nullable(); + $table->decimal('tax_rate2', 20, 6)->default(0); + + $table->string('tax_name3')->nullable(); + $table->decimal('tax_rate3', 20, 6)->default(0); + + + $table->decimal('total_taxes', 20, 6)->default(0); + $table->boolean('uses_inclusive_taxes')->default(0); + + $table->date('reminder1_sent')->nullable(); + $table->date('reminder2_sent')->nullable(); + $table->date('reminder3_sent')->nullable(); + $table->date('reminder_last_sent')->nullable(); + + $table->text('custom_value1')->nullable(); + $table->text('custom_value2')->nullable(); + $table->text('custom_value3')->nullable(); + $table->text('custom_value4')->nullable(); + + + $table->datetime('next_send_date')->nullable(); + + + + $table->decimal('custom_surcharge1', 20,6)->nullable(); + $table->decimal('custom_surcharge2', 20,6)->nullable(); + $table->decimal('custom_surcharge3', 20,6)->nullable(); + $table->decimal('custom_surcharge4', 20,6)->nullable(); + + + $table->boolean('custom_surcharge_tax1')->default(false); + $table->boolean('custom_surcharge_tax2')->default(false); + $table->boolean('custom_surcharge_tax3')->default(false); + $table->boolean('custom_surcharge_tax4')->default(false); + + + $table->decimal('exchange_rate', 20, 6)->default(1); + $table->decimal('balance', 20, 6); + $table->decimal('partial', 20, 6)->nullable(); + $table->decimal('amount', 20, 6); + $table->decimal('paid_to_date', 20, 6)->default(0); + + $table->datetime('partial_due_date')->nullable(); + + $table->datetime('last_viewed')->nullable(); + + $table->softDeletes(); + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('purchase_orders'); + } +}