class CreatePCustomerSheets < ActiveRecord::Migration[6.0]
  def change
    create_table :p_customer_sheets do |t|
      t.references   :p_customer,   index: true
      t.references   :p_customer_site,   index: true
      t.string       :state
      t.string       :comments
      t.references   :particular_bill,   index: true
      t.references   :particular_send,   index: true
      t.date         :wish_start
      t.date         :wish_stop
      t.decimal      :a_total_cost_ok,   :precision => 14,   :scale => 2
      t.decimal      :a_ok_total,   :precision => 14,   :scale => 2
      t.boolean      :stock_done,   :default => false
      t.integer      :p_commercial_id
      t.boolean      :imported,   :default => false
      t.string       :npiece
      t.decimal      :a_ok_total_ttc,   :precision => 14,   :scale => 2
      t.boolean      :billed,   :default => false
      t.decimal      :a_total,   :precision => 14,   :scale => 2
      t.decimal      :a_total_ttc,   :precision => 14,   :scale => 2
      t.boolean      :comptant,   :default => true
      t.boolean      :acompte,   :default => false
      t.decimal      :acompte_percent,   :precision => 14,   :scale => 2
      t.integer      :payment_delais
      t.boolean      :payment_fin_de_mois,   :default => false
      t.datetime     :paid_start_at
      t.boolean      :paid,   :default => false
      t.datetime     :paid_at
      t.references   :p_payment_type,   index: true
      t.boolean      :i_archive,   :default => false
      t.string       :cust_ref

      t.timestamps
    end
  end
end
