class CreateStatLines < ActiveRecord::Migration[6.0]
  def change
    create_table :stat_lines do |t|
      t.references :p_product, foreign_key: true
      t.string :product_name
      t.string :product_code
      t.references :p_product_ref, foreign_key: true
      t.string :p_product_ref_name
      t.decimal :tva_rate, precision: 10, scale: 2
      t.integer :tva_account_id
      t.string :title
      t.decimal :price_u_ht, precision: 15, scale: 3
      t.decimal :price_u_tva, precision: 15, scale: 3
      t.decimal :price_u_ttc, precision: 15, scale: 3
      t.decimal :qte, precision: 15, scale: 3
      t.decimal :tot_line_ht, precision: 15, scale: 3
      t.decimal :tot_line_tva, precision: 15, scale: 3
      t.decimal :tot_line_ttc, precision: 15, scale: 3
      t.decimal :tot_discount_ht, precision: 15, scale: 3
      t.decimal :tot_discount_tva, precision: 15, scale: 3
      t.decimal :tot_discount_ttc, precision: 15, scale: 3
      t.decimal :tot_amount_ht, precision: 15, scale: 3
      t.decimal :tot_amount_tva, precision: 15, scale: 3
      t.decimal :tot_amount_ttc, precision: 15, scale: 3
      t.decimal :weight_u, precision: 15, scale: 3
      t.decimal :weight_tot, precision: 15, scale: 3
      t.decimal :cost_ht, precision: 15, scale: 3
      t.decimal :cost_u_ht, precision: 15, scale: 3
      t.decimal :marge_ht, precision: 15, scale: 3
      t.decimal :marge_u_ht, precision: 15, scale: 3
      t.decimal :cost_u_w_ht, precision: 15, scale: 3
      t.decimal :marge_u_w_ht, precision: 15, scale: 3
      t.references :p_commercial, foreign_key: true
      t.string :p_commercial_name
      t.string :p_commercial_code
      t.references :p_product_cat
      t.string :p_product_cat_name
      t.references :p_customer, foreign_key: true
      t.string :p_customer_name
      t.string :p_customer_code
      t.date :date
      t.integer :price_document_id
      t.string :price_document_number
      t.integer :price_line_block_id
      t.integer :price_line_id

      t.timestamps
    end
    
    
    
  end
end
