class CreatePriceLineBlocks < ActiveRecord::Migration[6.0]
  def change
    create_table :price_line_blocks do |t|
      
      
      t.references :p_customer
      t.integer :p_commercial_id
      
      t.integer :ac_p_customer_cat_id
      t.integer :cc_p_customer_cat_id
      
      t.integer :particular_bill_id
      t.integer :particular_send_id
      
      t.integer :ref_particular_bill_id
      t.integer :ref_particular_send_id
      
      
      
      t.boolean :archived
      
      t.string :movement_type, :default => "cred"
      t.boolean :accounting, :default => false
      
      t.integer :price_lineable_id
      t.string :price_lineable_type
      
      t.date :ct_creation_date
      t.date :cc_creation_date
      t.date :ac_creation_date
      
      t.date :wish_date
      t.date :estimate_date
      
      
      
      t.boolean :cc_remise_enrobage_ok
      t.boolean :cc_remise_ecole_ok
      
      t.boolean :ac_remise_enrobage_ok
      t.boolean :ac_remise_ecole_ok
      
      
      t.string :customer_ref
      
      t.integer :ct_nbr_ship
      t.integer :ac_nbr_ship
      t.integer :cc_nbr_ship
      
      
      
      t.integer :ac_accounting_zone_id
      t.integer :cc_accounting_zone_id
      t.string :ac_accounting_zone_name
      t.string :cc_accounting_zone_name
      
      
      
      t.decimal :ac_tot_lines_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_lines_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_lines_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_lines_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_lines_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_lines_ttc,   :precision => 14,   :scale => 2
      t.decimal :ct_tot_discount_percent, :precision => 5,   :scale => 2
      t.decimal :ct_tot_discount_value,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :ac_fdp_tva_rate,   :precision => 14,   :scale => 2
      t.decimal :cc_fdp_tva_rate,   :precision => 14,   :scale => 2
      t.decimal :ct_tot_fdp_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_fdp_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_fdp_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_fdp_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_fdp_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_fdp_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_fdp_ttc,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_af_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_af_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_af_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_af_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_af_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_af_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :ct_gen_discount_percent, :precision => 5,   :scale => 2
      t.decimal :ct_gen_discount_value,   :precision => 14,   :scale => 2
      t.decimal :ac_gen_discount_percent, :precision => 5,   :scale => 2
      t.decimal :cc_gen_discount_percent,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_gen_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_gen_discount_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_gen_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_gen_discount_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_gen_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_gen_discount_ttc,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_ht,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_ht,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_tva,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_tva,   :precision => 14,   :scale => 2
      t.decimal :ac_tot_amount_ttc,   :precision => 14,   :scale => 2
      t.decimal :cc_tot_amount_ttc,   :precision => 14,   :scale => 2
      
      t.decimal :ac_weight_tot,  :precision => 14,   :scale => 2
      t.decimal :cc_weight_tot,  :precision => 14,   :scale => 2
      
      
      t.integer :p_payment_type_id
      
      
      t.boolean :ct_payment_comptant
      t.boolean :ac_payment_comptant
      t.boolean :cc_payment_comptant
      
      t.integer :ct_payment_delais
      t.integer :ac_payment_delais
      t.integer :cc_payment_delais
      t.boolean :ct_payment_month_end
      t.boolean :ac_payment_month_end
      t.boolean :cc_payment_month_end
      t.date :ac_payment_end_at
      t.date :cc_payment_end_at
      
      
      t.boolean :ct_acompte
      t.boolean :ac_acompte
      t.boolean :cc_acompte
      
      t.decimal :ct_acompte_percent, :precision => 14,   :scale => 2
      t.decimal :ac_acompte_percent, :precision => 14,   :scale => 2
      t.decimal :cc_acompte_percent, :precision => 14,   :scale => 2
      
      
      t.integer :ac_payment_days
      t.integer :cc_payment_days

      t.timestamps
    end
  end
end
