PArtciel from OK with device infos, adding coumn to price line block ct_tot_amount ht and ttc

This commit is contained in:
Philippe 2021-10-29 18:40:30 +02:00
parent 05007c569b
commit ee52fca31e
16 changed files with 99 additions and 129 deletions

View File

@ -1,4 +1,4 @@
class LineStock < ApplicationRecord
class LineStock < ApplicationRecord
belongs_to :p_product_ref
belongs_to :stockable, :polymorphic => true
@ -12,26 +12,17 @@ class LineStock < ApplicationRecord
:stockable => {:name => "Origine", :reorder => false},
:p_product_ref => {:name => "Produit", :reorder => false},
:description => {:name => "Description", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
:dluo => {:name => "DLUO", :reorder => true},
:qte => {:name => "Quantité", :reorder => true},
#:dluo => {:name => "DLUO", :reorder => true},
:qte => {:name => "Quantité", :reorder => true },
:qte_available => {:name => "Quantité restante", :reorder => true},
:qte_used => {:name => "Quantité utilisée", :reorder => true},
:price_ht => {:name => "Valeur totale d'origine", :reorder => true, :as => :currency},
:price_ht_available => {:name => "Valeur disponnible", :reorder => true, :as => :currency},
:price_ht_used => {:name => "Valeur utilisée", :reorder => true, :as => :currency},
:price_u_ht => {:name => "Prix Unitaire", :reorder => true, :as => :currency},
:price_u_kg_ht => {:name => "Prix U [Kg]", :reorder => true, :as => :currency},
:qte_kg_per_unit => {:name => "Poids par unité", :reorder => true},
:qte_kg => {:name => "Poids total", :reorder => true},
#:price_u_kg_ht => {:name => "Prix U [Kg]", :reorder => true, :as => :currency},
#:qte_kg_per_unit => {:name => "Poids par unité", :reorder => true},
#:qte_kg => {:name => "Poids total", :reorder => true},
:actions => {:name => "Actions", :reorder => false},
}

View File

@ -540,22 +540,6 @@ class PriceLine < ApplicationRecord
self.ca_discount_ecole_ht
end
def ca_tot_amount_ht
if self.ct_tot_amount_ht
self.ct_tot_amount_ht

View File

@ -681,7 +681,11 @@ class PriceLineBlock < ApplicationRecord
end
def ca_tot_amount_ht
self.tot_amount_af_discount_ht + self.tot_gen_discount_ht
if self.ct_tot_amount_ht
return self.ct_tot_amount_ht
else
self.tot_amount_af_discount_ht + self.tot_gen_discount_ht
end
end
def ca_tot_amount_tva

View File

@ -16,4 +16,3 @@
=form.inputs do
= form.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id)
= form.input :value

View File

@ -2,7 +2,10 @@
.content
=f.inputs do
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => f.object.label_for(:p_product_ref)
-if params[:p_product_ref_id]
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :selected => f.object.p_product_ref , :label => f.object.label_for(:p_product_ref)
-else
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => f.object.label_for(:p_product_ref)
-if PGrade::ACTIVATED
= f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade"
%h4 Numero de série :
@ -11,9 +14,4 @@
=render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form}
%p= link_to_add_fields "Ajouter un numéro de série", f, :p_article_serial_nums, {:class => "btn btn-primary"}
.actions=f.submit "sauvegarder", :class => "btn btn-primary"

View File

@ -25,10 +25,10 @@
%td
=form.input :ean
%tr
%td
=form.input :ct_sorecop, :label => "Sorecop personalisée :"
%td
=form.input :sorecop_comment, :label => "Commentaire de Sorecop :"
-# %td
-# =form.input :ct_sorecop, :label => "Sorecop personalisée :"
-# %td
-# =form.input :sorecop_comment, :label => "Commentaire de Sorecop :"
%td
=form.input :ct_deee, :label => "DEEE personalisée :"

View File

@ -20,7 +20,7 @@
=# f.input :stocked, :label => "Suivi de stock ?"
.col-sm-2
=f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true
=#f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true

View File

@ -45,7 +45,9 @@ PRICE_DOCUMENTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
-if @price_document.price_document_type_id == 6 or @price_document.price_document_type_id == 7
.row
.col-6
= f.input :date, :label => "Date du document :", :as => :date
= f.input :date, :label => "Date de la facture achat :", :as => :date
.col-6
= f.input :supplier_document_date, :label => "Date du document fournisseur :", :as => :date
.col-6
= f.input :tva_type_id, :label => "Type de TVA :", as: :select, collection: TvaType.pluck(:name, :id)
.price_line_block_form

View File

@ -243,7 +243,7 @@
= link_to i(:"trash-o"), admin_price_line_path(price_line), method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
= link_to i(:pencil), edit_admin_price_line_path(price_line), :remote => true
= link_to i(:eye), admin_price_line_path(price_line), :remote => true
= link_to i(:"mobile-alt"), new_admin_p_article_path, :remote => true
= link_to i(:"mobile-alt"), new_admin_p_article_path(p_product_ref_id: price_line.p_product_ref.id), :remote => true
/ %td=# price_line.line_stocks.sum(:price_ht)

View File

@ -1,17 +1,12 @@
PRICE LINE BLOCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
=f.inputs do
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
= f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
=# f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
= f.hidden_field :p_customer_id, :class => "p_customer_id"
.p_customer_sheet_customer
-if f.object.p_customer and f.object.p_customer.particular
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
@ -47,13 +42,11 @@ PRICE LINE BLOCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
=# f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
.row
.col-6
= f.input :validation_date, :label => "Date d'entrée en stock :", :as => :date
= f.input :stock_entrance_date, :label => "Date d'entrée en stock :", :as => :date
.row
.col-6
= f.input :customer_ref, :label => "Référence commande fournisseur :"
.col-6
= f.input :package_number, :label => "Nombre de colis :"
-if current_admin.has_permission?("customer-sheets-bl")
= f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
@ -80,11 +73,16 @@ PRICE LINE BLOCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
-if !@avoir
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
= f.input :ct_tot_fdp_ht, :label => "Montant des frais de port HT (€) :"
-if !@avoir
-if current_admin.has_permission?("customer-sheets-bl")
= f.input :ct_nbr_ship, :label => "Nombre de colis :"
= f.input :cc_tot_amount_ttc, label: "Montant TTC à payer", :input_html => {disabled: true}
= f.input :cc_tot_amount_ht, label: "Montant HT à payer", input_html: {disabled: true}
= f.input :ct_tot_amount_ht, label: "Montant HT personnalisé"
-if current_admin.has_permission?("payments")
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")

View File

@ -3,69 +3,47 @@
%td{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
.take.mr-1
="PRICE_LINEEEEEEEE"
=ic :arrows
= "PRICE_LINEEEEEEEE"
%td{:style => "white-space: nowrap;"}
.input-group
%label Référence
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :style => "", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref), :class => "p_product_ref_name"}
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
.input-group-append
=link_to "#", class: "btn btn-dark",:onclick => "key=genRanHex(12);select_product_from_manager(key);$(this).closest('tr').find('.p_product_ref_id').attr('id', 'p_product_ref_id_'+key);$(this).closest('tr').find('.p_product_ref_name').attr('id', 'p_product_ref_name_'+key);$(this).closest('tr').find('.p_product_ref_qte').attr('id', 'p_product_ref_qte_'+key);return false;" do
=ic(:search)
-form.object.forced_price = true if form.object.ct_u_price_ht
-if form.object.forced_price and form.object.p_product_ref
%td
.mx-2
.form-inline
=qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label => false, label_class: "mr-1", :value => form.object.th_price_u_ht)
-else
%td
.mx-2
.form-inline
=qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label =>false, label_class: "mr-1")
-# -if form.object.forced_price and form.object.p_product_ref
-# %td
-# .mx-2
-# .form-inline
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label => false, label_class: "mr-1", :value => form.object.th_price_u_ht)
-# -else
-# %td
-# .mx-2
-# .form-inline
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label =>false, label_class: "mr-1")
-# %td
-# .form-inline.mr-2{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
-# = form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "form-inline input_price_line_forced_price"}
-# .forced_price_wrapper.mx-2{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
%td
.form-inline.mr-2{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "form-inline input_price_line_forced_price"}
.forced_price_wrapper.mx-2{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
%td{:style => "width:100px;"}
= form.input :qte, :label => false, :input_html => {:class => "input_price_line_qte form-control p_product_ref_qte", tabindex: 1}
= form.input :qte, :label => "Quantité", :input_html => {:class => "input_price_line_qte form-control p_product_ref_qte", tabindex: 1}
%td
= form.input :ct_u_price_ht, :label => "Prix Unitaire HT :", :input_html => { class: "mx-2"}
-# %td
-# =form.input :ct_tva_account_id, :collection => options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :as => :select ,:label => false, :include_blank => false , :input_html => {:class => "input_price_line_tva_account_id form-control custom-select"}
%td
=form.input :ct_tva_account_id, :collection => options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :as => :select ,:label => false, :include_blank => false , :input_html => {:class => "input_price_line_tva_account_id form-control custom-select"}
%td
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
= form.hidden_field :position, :class => "price_line_position_input"
:javascript
:javascript
$('.p_product_ref_autocomplete_input').focus()
$( function() {
$('.p_product_ref_autocomplete_input').autocomplete({

View File

@ -1,27 +1,35 @@
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
- price_line = form.object
.row
.col-6.row
.col-2.d-flex
.take.mx-3
=ic :arrows
%label
ref :
%input.p_product_ref_autocomplete_input.form-control.col{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
.col-11
.row
.col-5.row
.col-2.d-flex
.take.mx-3
=ic :arrows
%label
Référence :
%input.p_product_ref_autocomplete_input.form-control.col{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
.col-3.ml-2
.form-inline
= form.input :qte, :label => "qte :", :input_html => { class: "mx-2", autofocus: true, tabindex: 1}
.col-2
.form-inline
= form.input :ct_u_price_ht, :label => "PU :", :input_html => { class: "mx-2"}
.col-1.ml-2
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
.col-3.ml-2
.form-inline
= form.input :qte, :label => "Quantité :", :input_html => { class: "mx-2", autofocus: true, tabindex: 1}
.col-2
.form-inline
= form.input :ct_u_price_ht, :label => "Prix unitaire HT :", :input_html => { class: "mx-2"}
.row
.col-5.row
.col-2.d-flex
.take.mx-3
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
= form.hidden_field :position, :class => "price_line_position_input"
.form-inline
=# form.input :ac_tot_amount_ht, :label => "Prix total HT :", :input_html => { class: "mx-2", disabled: true}
%label Montant HT :
=price_line.tot_amount_ht
.col-1
.col-1.ml-2
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
= qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
= form.hidden_field :position, :class => "price_line_position_input"

View File

@ -6,12 +6,8 @@ class CreateTvaTypes < ActiveRecord::Migration[6.0]
t.timestamps
end
TvaType.create(name: "basique")
TvaType.create(name: "Standard")
TvaType.create(name: "Sur Marge")
add_reference :price_documents, :tva_type, index: true
add_column :price_documents, :ac_tva_type_name, :string
add_column :price_documents, :cc_tva_type_name, :string
add_column :price_line_blocks, :package_number, :integer
end
end

View File

@ -0,0 +1,10 @@
class AddColumnsToPriceDocsAdnPriceLineBlocks < ActiveRecord::Migration[6.0]
def change
add_reference :price_documents, :tva_type, index: true
add_column :price_documents, :ac_tva_type_name, :string
add_column :price_documents, :cc_tva_type_name, :string
add_column :price_documents, :supplier_document_date, :date
add_column :price_line_blocks, :stock_entrance_date, :date
add_column :price_line_blocks, :ct_tot_amount_ht, :decimal, :precision => 14, :scale => 2
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_10_28_091122) do
ActiveRecord::Schema.define(version: 2021_10_29_111104) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -2307,6 +2307,7 @@ ActiveRecord::Schema.define(version: 2021_10_28_091122) do
t.bigint "tva_type_id"
t.string "ac_tva_type_name"
t.string "cc_tva_type_name"
t.date "supplier_document_date"
t.index ["p_customer_id"], name: "index_price_documents_on_p_customer_id"
t.index ["tva_type_id"], name: "index_price_documents_on_tva_type_id"
end
@ -2457,7 +2458,8 @@ ActiveRecord::Schema.define(version: 2021_10_28_091122) do
t.boolean "imported", default: false
t.date "validation_date"
t.string "cc_state"
t.integer "package_number"
t.date "stock_entrance_date"
t.decimal "ct_tot_amount_ht", precision: 14, scale: 2
t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id"
end