diff --git a/.sass-cache/2008dff8cddf4c9967017d710d180856df6a3c9d/(__TEMPLATE__)c b/.sass-cache/2008dff8cddf4c9967017d710d180856df6a3c9d/(__TEMPLATE__)c
new file mode 100644
index 0000000..e13aa03
Binary files /dev/null and b/.sass-cache/2008dff8cddf4c9967017d710d180856df6a3c9d/(__TEMPLATE__)c differ
diff --git a/app/assets/javascripts/admin.coffee b/app/assets/javascripts/admin.coffee
index 7a571ec..ea98f59 100644
--- a/app/assets/javascripts/admin.coffee
+++ b/app/assets/javascripts/admin.coffee
@@ -56,6 +56,7 @@
#= require freeze-table
+#= require admin/random_hexa
@@ -856,6 +857,4 @@ $(document).on 'click', '.datepicker', (e) ->
$(this).next('.' + autocomplete_object + '_id').val ui.item.id
return
return
-
-
-
+
\ No newline at end of file
diff --git a/app/assets/javascripts/admin/random_hexa.js b/app/assets/javascripts/admin/random_hexa.js
new file mode 100644
index 0000000..910cebf
--- /dev/null
+++ b/app/assets/javascripts/admin/random_hexa.js
@@ -0,0 +1,2 @@
+const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
+
\ No newline at end of file
diff --git a/app/assets/javascripts/manager.js b/app/assets/javascripts/manager.js
index 10623e4..49a11fb 100644
--- a/app/assets/javascripts/manager.js
+++ b/app/assets/javascripts/manager.js
@@ -42,7 +42,7 @@ function manager_show(url){
function manager_hide(){
$("#manager_box_place").removeClass("manager_box_place_active");
-
+ $('#manager_box').html("");
$("body").css("overflow", "auto");
slider_enabled = null;
@@ -239,3 +239,23 @@ function select_video_from_manager(input_id){
}
+function select_product_from_manager(input_id){
+
+
+
+ manager_prompt(p_product_refs_url,function(m_return){
+
+ $('#p_product_ref_id_'+input_id).val(m_return.id);
+ $('#p_product_ref_name_'+input_id).val(m_return.name);
+ $('#p_product_ref_qte_'+input_id).focus()
+ });
+
+}
+
+function send_manager_product(product_id, product_name){
+
+ manager_send_response({id : product_id, name : product_name});
+}
+
+
+
diff --git a/app/assets/javascripts/nested_fields.coffee b/app/assets/javascripts/nested_fields.coffee
index c589739..c0a6ca7 100644
--- a/app/assets/javascripts/nested_fields.coffee
+++ b/app/assets/javascripts/nested_fields.coffee
@@ -10,9 +10,11 @@
if $(link).closest("p").next("." + association + "_form").length > 0
form_element = $(link).closest("p").next("." + association + "_form")
- else
+ else if $(link).closest("p").prev("." + association + "_form").length > 0
form_element = $(link).closest("p").prev("." + association + "_form")
-
+ else
+ form_element = $(link).closest(".qi_field_wrapper").find("." + association + "_form")
+
form_element.append content_final
$(".new_field").removeClass "new_field"
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
index a53341c..cb1ee54 100644
--- a/app/assets/stylesheets/admin.scss
+++ b/app/assets/stylesheets/admin.scss
@@ -1782,4 +1782,88 @@ td{
}
-// Fin
\ No newline at end of file
+
+// Html5 Tooltip
+.info {
+ color: #009bbf;
+ position: relative;
+ display: inline-block;
+ text-overflow: ellipsis;
+
+ .info-text-top {
+ visibility: hidden;
+ background-color: #555;
+ color: #fff;
+ text-align: center;
+ padding: 5px;
+ border-radius: 6px;
+ max-width: 500px;
+ min-width: fit-content;
+ white-space: normal;
+
+ /* Position the tooltip text */
+ position: absolute;
+ z-index: 1;
+ bottom: 125%;
+ left: 50%;
+ margin-left: -60px;
+
+ /* Fade in tooltip */
+ opacity: 0;
+ transition: opacity 0.3s;
+ }
+ .info-text-top::after {
+ content: "";
+ position: absolute;
+ top: 100%;
+ left: 50%;
+ margin-left: -5px;
+ border-width: 5px;
+ border-style: solid;
+ border-color: #555 transparent transparent transparent;
+ }
+ .info-text-bottom {
+ visibility: hidden;
+ background-color: #555;
+ color: #fff;
+ text-align: center;
+ padding: 5px;
+ border-radius: 6px;
+ max-width: 500px;
+ min-width: fit-content;
+ white-space: normal;
+
+ /* Position the tooltip text */
+ position: absolute;
+ z-index: 1;
+ top: 125%;
+ left: 200%;
+ margin-left: -60px;
+
+ /* Fade in tooltip */
+ opacity: 0;
+ transition: opacity 0.3s;
+ }
+ .info-text-bottom::after {
+ content: "";
+ position: absolute;
+ bottom: 100%;
+ left: 50%;
+ margin-left: -5px;
+ border-width: 5px;
+ border-style: solid;
+ border-color: transparent transparent #555 transparent;
+ }
+}
+.info:hover {
+ .info-text-top {
+ visibility: visible;
+ opacity: 1;
+ }
+ .info-text-bottom {
+ visibility: visible;
+ opacity: 1;
+ }
+}
+
+// Fin
diff --git a/app/assets/stylesheets/manager.scss b/app/assets/stylesheets/manager.scss
index eb296d2..f03e584 100644
--- a/app/assets/stylesheets/manager.scss
+++ b/app/assets/stylesheets/manager.scss
@@ -2,7 +2,8 @@
#manager_box_place{
position:fixed;
height:0;
- width:100%;
+ left:100px;
+ right:30px;
z-index:1500;
top:0px;
margin:0px;
diff --git a/app/controllers/admin/buy_lists_controller.rb b/app/controllers/admin/buy_lists_controller.rb
index d68d6b3..515b796 100644
--- a/app/controllers/admin/buy_lists_controller.rb
+++ b/app/controllers/admin/buy_lists_controller.rb
@@ -14,11 +14,83 @@ class Admin::BuyListsController < ApplicationController
@price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
+ if params[:search][:s_brand].present? && params[:search][:s_brand] != ""
+ @price_lines = @price_lines.joins(p_product_ref: :p_product).where("s_brand_id = ?", params[:search][:s_brand])
+ end
+
+ if params[:search][:state].present? && params[:search][:state] != ""
+ @p_customer_sheets = @p_customer_sheets.where(:state => params[:search][:state])
+ @price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids)
+ @price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
+ end
+
+ if params[:search][:p_customer_code].present?
+ @p_customer_sheets = @p_customer_sheets.joins(:p_customer).where("code LIKE ?", params[:search][:p_customer_code])
+ @price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PCustomerSheet", :price_lineable_id => @p_customer_sheets.ids)
+ @price_lines = PriceLine.where(:price_line_block_id => @price_line_blocks.ids)
+ end
+
+ date_regex = /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/](19|20)\d\d$/i
+
+
+ params[:cc_creation_date_start] = Date.today.beginning_of_month.strftime('%d/%m/%Y') if !params[:cc_creation_date_start]
+
+ if params[:cc_creation_date_start] and params[:cc_creation_date_start] =~ date_regex
+ #fsfds = sdfsfd
+ @cc_creation_date_start = Date.parse(params[:cc_creation_date_start]).beginning_of_day
+ params[:cc_creation_date_start]= @cc_creation_date_start.strftime('%d/%m/%Y')
+ else
+ @cc_creation_date_start = nil
+ end
+
+ if true
+ params[:cc_creation_date_stop] = Date.today.end_of_month.strftime('%d/%m/%Y') if !params[:cc_creation_date_stop]
+
+
+ if params[:cc_creation_date_stop].to_s != "" # and params[:stop] =~ date_regex
+ @cc_creation_date_stop = Date.parse(params[:cc_creation_date_stop]).end_of_day
+
+ params[:cc_creation_date_stop]= @cc_creation_date_stop.strftime('%d/%m/%Y')
+
+
+ else
+ @cc_creation_date_stop = nil
+ end
+
+ end
+ @price_lines = @price_lines.where("price_lines.cc_creation_date >= ?", @cc_creation_date_start) if @cc_creation_date_start
+ @price_lines = @price_lines.where("price_lines.cc_creation_date <= ?", @cc_creation_date_stop.end_of_day) if @cc_creation_date_stop
+
+ params[:wish_date_start] = Date.today.beginning_of_month.strftime('%d/%m/%Y') if !params[:wish_date_start]
+
+ if params[:wish_date_start] and params[:wish_date_start] =~ date_regex
+ #fsfds = sdfsfd
+ @wish_date_start = Date.parse(params[:wish_date_start]).beginning_of_day
+ params[:wish_date_start]= @wish_date_start.strftime('%d/%m/%Y')
+ else
+ @wish_date_start = nil
+ end
+
+ if true
+ params[:wish_date_stop] = Date.today.end_of_month.strftime('%d/%m/%Y') if !params[:wish_date_stop]
+
+
+ if params[:wish_date_stop].to_s != "" # and params[:stop] =~ date_regex
+ @wish_date_stop = Date.parse(params[:wish_date_stop]).end_of_day
+
+ params[:wish_date_stop]= @wish_date_stop.strftime('%d/%m/%Y')
+
+
+ else
+ @wish_date_stop = nil
+ end
+
+ end
+ @price_lines = @price_lines.joins(:price_line_block).where("price_line_blocks.wish_date >= ?", @wish_date_start) if @wish_date_start
+ @price_lines = @price_lines.joins(:price_line_block).where("price_line_blocks.wish_date <= ?", @wish_date_stop.end_of_day) if @wish_date_stop
respond_to do |format|
format.html{
-
-
}
end
diff --git a/app/controllers/admin/p_customer_sheets_controller.rb b/app/controllers/admin/p_customer_sheets_controller.rb
index f99ea9f..fbc5058 100644
--- a/app/controllers/admin/p_customer_sheets_controller.rb
+++ b/app/controllers/admin/p_customer_sheets_controller.rb
@@ -174,12 +174,14 @@ class Admin::PCustomerSheetsController < ApplicationController
@p_customer_sheet.admin = current_admin
- @p_customer = @p_customer_sheet.p_customer
+
if @p_customer_sheet.save
- @p_customer_sheets = PCustomerSheet.order(:id).all
+
redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
else
+ @p_customer = @p_customer_sheet.price_line_block.p_customer
+
render action: "new"
end
@@ -189,13 +191,14 @@ class Admin::PCustomerSheetsController < ApplicationController
def update
@p_customer_sheet = PCustomerSheet.find(params[:id])
- @p_customer = @p_customer_sheet.p_customer
+
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
- @p_customer_sheets = PCustomerSheet.order(:id).all
-
+ @p_customer = @p_customer_sheet.price_line_block.p_customer
+
+
redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
else
render action: "edit"
@@ -277,6 +280,89 @@ class Admin::PCustomerSheetsController < ApplicationController
end
-
+ def export_xls
+ @p_customer_sheets = PCustomerSheet.all
+ if params[:p_customer_sheet_ids].present?
+ @p_customer_sheets = PCustomerSheet.where(id: params[:p_customer_sheet_ids])
+ end
+
+ respond_to do |format|
+ format.csv {
+ @headers = ["BUID", "DATE", "NUMERO", "CLIENT", "REFERENCE", "EAN", "DESIGNATION", "QTE", "PRIX 1", "PRIX 2", "DEEE", "SORECOP", "FOURNISSEUR", "CODE ARTICLE MAG", "NomMarque", "Code Douanier", "Type SORECOP"]
+ @columns = []
+ # PCustomerSheet.qi_table_order.each do |key, value|
+ # if value.instance_of? Hash
+ # name = value[:name]
+ # else
+ # name = value
+ # end
+
+ # if name != "Actions"
+ # @headers << name.to_s
+ # @columns << key
+ # end
+
+ # end
+
+ xlsx_package = Axlsx::Package.new
+ wb = xlsx_package.workbook
+ wb.add_worksheet(name: "BASIC extract to Chronopost") do |sheet|
+ sheet.add_row @headers
+
+ @p_customer_sheets.each do |p_customer_sheet|
+ p_customer_sheet.price_line_block.price_lines.each do |price_line|
+ line = []
+ line << price_line.id
+ line << p_customer_sheet.created_at.strftime("%d/%d/%Y")
+ line << p_customer_sheet.id
+ line << p_customer_sheet.p_customer.code + " - " + p_customer_sheet.p_customer.particulars.first.organisation
+ line << price_line.p_product_ref.cc_name
+ # line << price_line.p_product_ref.cc_ean
+ line << price_line.p_product_ref.ean
+ line << price_line.p_product_ref.cc_name
+
+ line << price_line.qte
+ line << price_line.cc_price_u_ht
+ line << price_line.ct_u_price_ht
+ line << price_line.p_product_ref.deee
+ line << price_line.p_product_ref.sorecop
+ # line << price_line.p_product_ref.referal_fournisseur
+ line << "Fournisseur"
+ line << ""
+
+ line << price_line.p_product_ref.p_product.s_brand.name
+ line << "Code douanier"
+ line << price_line.p_product_ref.sorecop_comment
+ sheet.add_row line, types: line.map{|t| cell_type_from_value(t)}
+ # puts line
+ end
+
+
+ # @columns.each do |column|
+
+ # if (p_customer_sheet.respond_to?("csv_"+column.to_s))
+ # line << p_customer_sheet.send("csv_"+column.to_s)
+ # elsif (p_customer_sheet.respond_to?(column))
+ # if p_customer_sheet.send(column.to_s).class.to_s == "BigDecimal"
+ # line << p_customer_sheet.send(column.to_s).to_s.gsub('.', ',')
+ # else
+ # line << p_customer_sheet.send(column.to_s)
+ # end
+ # else
+ # line << column.to_s
+ # end
+ # end
+ # sheet.add_row line, types: line.map{|t| cell_type_from_value(t)}
+ end
+ end
+
+ @final_file = "#{Rails.root}/private_medias/export-inscrits-#{Time.now.to_s.to_slug}.xlsx"
+
+ xlsx_package.serialize(@final_file)
+ send_file @final_file
+ }
+ end
+ end
+
end
diff --git a/app/controllers/admin/p_product_refs_controller.rb b/app/controllers/admin/p_product_refs_controller.rb
index c72e779..736d823 100644
--- a/app/controllers/admin/p_product_refs_controller.rb
+++ b/app/controllers/admin/p_product_refs_controller.rb
@@ -42,11 +42,19 @@ class Admin::PProductRefsController < ApplicationController
if params[:search][:s_brand_id].to_s != ""
- @p_product_refs = @p_product_refs.where(:s_brand_id => params[:search][:s_brand_id])
+ @p_product_refs = @p_product_refs.where(:p_products => {:s_brand_id => params[:search][:s_brand_id]})
end
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
respond_to do |format|
+ format.js{
+
+ params[:search][:per_page] = params[:search][:per_page] || 100
+ per_page = params[:search][:per_page]
+ page = (params[:page] and params[:page] != "") ? params[:page] : 1
+ @p_product_refs = @p_product_refs.page(page).per(per_page)
+
+ }
format.html{
params[:search][:per_page] = params[:search][:per_page] || 100
@@ -57,6 +65,11 @@ class Admin::PProductRefsController < ApplicationController
}
end
+
+ if params[:manager].to_s == "true"
+ @manager = true
+ render :layout => false
+ end
end
@@ -93,9 +106,11 @@ class Admin::PProductRefsController < ApplicationController
if @p_product_ref.update_attributes(params.require(:p_product_ref).permit!)
+
else
- render action: "edit"
+
+ render action: "edit"
end
@@ -138,27 +153,29 @@ class Admin::PProductRefsController < ApplicationController
def get_infos
+
@p_product_ref = PProductRef.find(params[:id])
if params[:type] == "price"
price = @p_product_ref.get_price(:p_customer_id => params[:p_customer_id], :qte => params[:qte])
- puts params[:p_fournisseur_id]
-
+
+
if params[:p_customer_id].to_s != ""
p_customer = PCustomer.find(params[:p_customer_id])
accounting_zone_id = p_customer.accounting_zone_id
+
if p_customer.tva_rate
tva_account_id = p_customer.tva_rate.id
tva_account_value = p_customer.tva_rate.rate
-
+
else
tva_account_id = @p_product_ref.p_product.tva_rate(accounting_zone_id).id if @p_product_ref.p_product.tva_rate(accounting_zone_id)
tva_account_value = @p_product_ref.p_product.tva_rate(accounting_zone_id).rate if @p_product_ref.p_product.tva_rate(accounting_zone_id)
-
-
+
+
end
-
+
elsif params[:p_fournisseur_id].to_s != ""
p_fournisseur = PFournisseur.find(params[:p_fournisseur_id])
accounting_zone_id = p_fournisseur.accounting_zone_id
diff --git a/app/controllers/admin/price_documents_controller.rb b/app/controllers/admin/price_documents_controller.rb
index 2b92020..b224d70 100644
--- a/app/controllers/admin/price_documents_controller.rb
+++ b/app/controllers/admin/price_documents_controller.rb
@@ -2,7 +2,7 @@
class Admin::PriceDocumentsController < ApplicationController
layout "admin"
- before_action :auth_admin, :except => :print
+ before_action :auth_admin, :except => [:print, :consult, :consult_create, :consult_edit, :consult_update]
before_action :admin_space, :except => :print
@@ -224,7 +224,7 @@ class Admin::PriceDocumentsController < ApplicationController
def show
@price_document = PriceDocument.find(params[:id])
-
+ @facture_achat_childrens = PriceDocument.where(doc_ref_id: @price_document.id, price_document_type: PriceDocumentType.find_by_label("Facture achat"))
end
def new
@@ -235,11 +235,19 @@ class Admin::PriceDocumentsController < ApplicationController
@price_document.price_line_block = PriceLineBlock.new(:p_customer_id => params[:p_customer_id], :p_fournisseur_id => params[:p_fournisseur_id])
if @price_document.price_document_type.label == "Demande prix"
- @ref_price_lines = PriceLine.where(:id => params[:price_line_ids])
-
- @ref_price_lines.group(:p_product_ref_id).each do |plr|
- @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
+ p_product_ref_id = params[:p_product_ref_ids] - [""]
+ p_product_ref_qte = params[:qte].permit!.to_hash
+
+ p_product_ref_id.each do |i|
+ if p_product_ref_qte[i.to_s].to_i > 0
+ @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => i, :qte => p_product_ref_qte[i.to_s])
+ end
end
+
+ # @ref_price_lines = PriceLine.where(:id => params[:price_line_ids])
+ # @ref_price_lines.group(:p_product_ref_id).each do |plr|
+ # @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
+ # end
end
@@ -261,6 +269,7 @@ class Admin::PriceDocumentsController < ApplicationController
def consult
+ @consult = true
@demande = PriceDocument.where(:f_token => params[:id]).first
@@ -272,12 +281,34 @@ class Admin::PriceDocumentsController < ApplicationController
@ref_price_lines = @demande.price_line_block.price_lines
@ref_price_lines.group(:p_product_ref_id).each do |plr|
- @price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
+ @price_document.price_line_block.price_lines << PriceLine.new(:price_line_ref_id => plr.id, :p_product_ref_id => plr.p_product_ref_id, :qte => @ref_price_lines.where(:p_product_ref_id => plr.p_product_ref_id).sum(:qte))
end
end
+
+ def consult_create
+ @consult = true
+
+ @price_document = PriceDocument.new(params.require(:price_document).permit!)
+ @price_document.date = Date.today
+ if @price_document.save
+ redirect_to consult_edit_admin_price_document_path(:id => @price_document.token)
+ else
+ render action: "consult"
+
+ end
+
+ end
+
+
+ def consult_edit
+ @consult = true
+
+ @price_document = PriceDocument.where(:token => params[:id]).first
+ end
+
def edit
@price_document = PriceDocument.find(params[:id])
@@ -291,7 +322,11 @@ class Admin::PriceDocumentsController < ApplicationController
@price_document.date = Date.today
@avoir = true if @price_document.label == "Avoir"
if @price_document.save
- redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
+ if @price_document.cc_label == "Demande prix"
+ render action: :show
+ else
+ redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
+ end
else
render action: "new"
@@ -305,18 +340,26 @@ class Admin::PriceDocumentsController < ApplicationController
@avoir = true if @price_document.label == "Avoir"
if @price_document.update_attributes(params.require(:price_document).permit!)
-
if params[:public_edit].to_s == "true"
@price_document.reset_for_update
#@price_document.unarchive_now
#@price_document.archive_now
- if @price_document.ref_element
+ if ["Facture achat", "Commande achat"].include?(@price_document.cc_label)
+ redirect_to [:admin, @price_document]
+ elsif @price_document.doc_ref_id
+ redirect_to [:admin, PriceDocument.find(@price_document.doc_ref_id)]
+ elsif @price_document.ref_element
redirect_to [:admin, @price_document.ref_element]
else
redirect_to [:admin, @price_document]
end
+
+ elsif @price_document.doc_ref_id
+ redirect_to [:admin, PriceDocument.find(@price_document.doc_ref_id)]
+ elsif @price_document.ref_element
+ redirect_to [:admin, @price_document.ref_element]
else
redirect_to [:admin, @price_document]
end
@@ -566,5 +609,203 @@ class Admin::PriceDocumentsController < ApplicationController
end
-
+ def match_p_fournisseur
+ @price_document = PriceDocument.find(params[:id])
+ end
+
+ def match_p_fournisseur_save
+ @price_document = PriceDocument.find(params[:id])
+
+ if @price_document.update_attributes(params.require(:price_document).permit!)
+ # redirect_back(fallback_location: price_documents_ptath)
+ else
+ render action: "edit"
+ end
+ end
+
+ def analyse_reponses
+ @price_document = PriceDocument.find(params[:id])
+ @price_document_responses = PriceDocument.where(:doc_ref_id => @price_document.id, :price_document_type_id => PriceDocumentType.find_by_label("Réponse fournisseur").id )
+ end
+
+ def analyse_reponses_save
+ @price_document = PriceDocument.find(params[:id])
+ if @price_document.update_attributes(params.require(:price_document).permit!)
+ redirect_to :analyse_reponses_admin_price_document
+ else
+ render :edit
+ end
+ end
+
+
+ def generate_final_consult
+ price_lines_to_add = {}
+
+ @price_document_demand = PriceDocument.find(params[:id])
+
+ @price_document_demand.price_line_block.price_lines.each do |pl_demand|
+
+ pl_demand.price_line_resps.all.each do |price_line_resp|
+ price_lines_to_add[price_line_resp.p_fournisseur.id] = price_lines_to_add[price_line_resp.p_fournisseur.id] || {:p_fournisseur => price_line_resp.p_fournisseur, :price_lines => [] }
+ price_lines_to_add[price_line_resp.p_fournisseur.id][:price_lines] << price_line_resp
+ end
+
+ end
+
+ price_lines_to_add.each do |k,v|
+ new_final_consult = PriceDocument.new(:doc_ref_id => @price_document_demand.id,:date => Date.today, :price_document_type => PriceDocumentType.find_by_label("Consultation fournisseur"))
+ new_final_consult.price_line_block = PriceLineBlock.new(:p_fournisseur => v[:p_fournisseur])
+
+ v[:price_lines].each do |price_line_resp|
+ new_final_consult.price_line_block.price_lines << PriceLine.new(:p_product_ref => price_line_resp.p_product_ref, :qte => price_line_resp.qte_available, :ct_u_price_ht => price_line_resp.price_u_ht )
+ end
+
+ new_final_consult.save
+
+ end
+
+ @final_consult = PriceDocument.where(price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).last
+ redirect_to admin_price_document_path(@price_document_demand, anchor: "consult")
+ end
+
+ def buy_order_create
+
+ @final_consult = PriceDocument.find(params[:id])
+ price_line_block = PriceLineBlock.new(p_fournisseur: @final_consult.price_line_block.p_fournisseur)
+ price_lines = PriceLine.where(price_line_block: @final_consult.price_line_block)
+
+ @price_document = PriceDocument.new(date: Date.today, price_line_block: price_line_block, doc_ref_id: @final_consult.id, demande_de_prix_id: @final_consult.id ,:price_document_type => PriceDocumentType.find_by_label("Commande achat"))
+ price_lines.each do |pl|
+ @price_document.price_line_block.price_lines << PriceLine.new(p_product_ref: pl.p_product_ref, qte: pl.qte, ct_u_price_ht: pl.price_u_ht)
+ end
+ if @price_document.save!
+ redirect_to admin_price_document_path(@price_document)
+ end
+ end
+
+
+ def bon_de_reception
+ @past_price_document = PriceDocument.find(params[:id])
+
+ @p_customer_sheet = @past_price_document.ref_element
+
+ if @p_customer_sheet
+ price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
+ else
+ price_document = PriceDocument.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :date => Date.today)
+ end
+
+ price_document.doc_ref_id = @past_price_document.id
+ price_document.p_fournisseur = @past_price_document.p_fournisseur
+ price_document.price_line_block = @past_price_document.price_line_block.dup
+
+ if @past_price_document.cc_label == "Commande achat"
+ price_document.bon_de_commande_achat_id = @past_price_document.id
+ price_document.reliquat = true if PriceDocument.where(:bon_de_commande_achat_id => @past_price_document.id, :price_document_type => PriceDocumentType.find_by_label("Bon de réception achat")).count > 0
+ end
+
+
+ if @past_price_document.cc_label == "Facture achat"
+ price_document.facture_achat_id = @past_price_document.id
+ end
+
+
+ price_document.price_line_block.ac_bon_de_commande_id = nil
+ price_document.price_line_block.ac_bon_de_livraison_id = nil
+ price_document.price_line_block.ac_facture_id = nil
+ price_document.price_line_block.ac_block_type = nil
+ price_document.price_line_block.ac_reliquat = nil
+
+
+
+
+ @past_price_document.price_line_block.price_lines.each do |pl|
+ new_pl = pl.dup
+ new_pl.price_line_ref_id = pl.id
+ new_pl.ac_block_type = nil
+
+ if price_document.reliquat #and @p_customer_sheet
+ bls = PriceDocument.where(:bon_de_commande_achat_id => @past_price_document.id, :price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"))
+
+ qte_ok = PriceLine.where(:price_line_ref_id => new_pl.price_line_ref_id).where(:price_line_block_id => PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id => bls.ids)).sum(:qte)
+
+ new_pl.qte = new_pl.qte - qte_ok
+
+ end
+ price_document.price_line_block.price_lines << new_pl
+ end
+
+ if price_document.save
+ #price_document.reset_for_update
+ #price_document.archive_now
+ if @p_customer_sheet
+ @p_customer_sheet.state = "Bon de réception achat"
+ @p_customer_sheet.save
+ end
+
+ if price_document.doc_ref_id
+ redirect_to [:admin, @past_price_document]
+ else
+ redirect_to [:admin, price_document]
+ end
+ else
+ render :inline => price_document.errors.messages.to_s
+ end
+ end
+
+ def facture_achat
+ @past_price_document = PriceDocument.find(params[:id])
+
+ @p_customer_sheet = @past_price_document.ref_element
+
+ if @p_customer_sheet
+ price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Facture achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
+
+ else
+ price_document = PriceDocument.new(:price_document_type => PriceDocumentType.find_by_label("Facture achat"), :date => Date.today)
+ end
+
+ price_document.doc_ref_id = @past_price_document.id
+ price_document.p_fournisseur = @past_price_document.p_fournisseur
+
+ price_document.price_line_block = @past_price_document.price_line_block.dup
+
+ price_document.price_line_block.ac_bon_de_commande_id = nil
+ price_document.price_line_block.ac_bon_de_livraison_id = nil
+ price_document.price_line_block.ac_facture_id = nil
+ price_document.price_line_block.ac_block_type = nil
+ price_document.price_line_block.ac_reliquat = nil
+
+ @past_price_document.price_line_block.price_lines.each do |pl|
+ new_pl = pl.dup
+ new_pl.price_line_ref_id = pl.id
+ new_pl.ac_block_type = nil
+
+
+ price_document.price_line_block.price_lines << new_pl
+ end
+
+ if price_document.save
+ #price_document.reset_for_update
+ #price_document.archive_now
+ if @p_customer_sheet
+ @p_customer_sheet.state = "Facture"
+ @p_customer_sheet.save
+ end
+
+ if price_document.doc_ref_id
+ redirect_to [:admin, @past_price_document]
+ else
+ redirect_to [:admin, price_document]
+ end
+ else
+ render :inline => price_document.errors.messages.to_s
+ end
+
+
+
+
+
+ end
+
end
diff --git a/app/controllers/admin/price_line_resp_selects_controller.rb b/app/controllers/admin/price_line_resp_selects_controller.rb
new file mode 100644
index 0000000..24020fd
--- /dev/null
+++ b/app/controllers/admin/price_line_resp_selects_controller.rb
@@ -0,0 +1,76 @@
+# -*- encoding : utf-8 -*-
+
+class Admin::PriceLineRespSelectsController < ApplicationController
+ layout "admin"
+ before_action :auth_admin
+
+ before_action :admin_space
+
+ def admin_space
+ @admin_space = "default"
+ end
+
+ def index
+ @price_line_resp_selects = PriceLineRespSelect.all
+
+ @price_line_resp_selects = sort_by_sorting(@price_line_resp_selects, "id DESC")
+ respond_to do |format|
+ format.html{
+
+ params[:search][:per_page] = params[:search][:per_page] || 100
+ per_page = params[:search][:per_page]
+ page = (params[:page] and params[:page] != "") ? params[:page] : 1
+ @price_line_resp_selects = @price_line_resp_selects.page(page).per(per_page)
+
+ }
+ end
+ end
+
+ def show
+ @price_line_resp_select = PriceLineRespSelect.find(params[:id])
+
+ end
+
+ def new
+ @price_line_resp_select = PriceLineRespSelect.new
+
+ end
+
+ def edit
+ @price_line_resp_select = PriceLineRespSelect.find(params[:id])
+
+ end
+
+ def create
+ @price_line_resp_select = PriceLineRespSelect.new(params.require(:price_line_resp_select).permit!)
+
+ if @price_line_resp_select.save
+
+ else
+ render action: "new"
+
+ end
+
+ end
+
+
+ def update
+ @price_line_resp_select = PriceLineRespSelect.find(params[:id])
+
+
+ if @price_line_resp_select.update_attributes(params.require(:price_line_resp_select).permit!)
+
+ else
+ render action: "edit"
+
+ end
+
+ end
+
+
+ def destroy
+ @price_line_resp_select = PriceLineRespSelect.find(params[:id])
+ @price_line_resp_select.destroy
+
+ end
+end
diff --git a/app/controllers/admin/price_lines_controller.rb b/app/controllers/admin/price_lines_controller.rb
index 18930ce..0874893 100644
--- a/app/controllers/admin/price_lines_controller.rb
+++ b/app/controllers/admin/price_lines_controller.rb
@@ -2,7 +2,7 @@
class Admin::PriceLinesController < ApplicationController
layout "admin"
- before_action :auth_admin
+ before_action :auth_admin, :except => [:edit, :update]
before_action :admin_space
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9ab496c..ce02913 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,13 +2,14 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
- before_action :set_current_p_customer_sheet
+ #before_action :set_current_p_customer_sheet
before_action :init_admin_menu
before_action :qi_menu
+ before_action :set_navbar_dropdown
def qi_menu(sym=nil)
@@ -21,10 +22,24 @@ class ApplicationController < ActionController::Base
@qi_menu_active = sym.to_sym
else
@qi_menus.each do |k, v|
+
+
+
if v[:elements] and v[:elements][sym.to_sym]
@qi_menu_active = k
@qi_menu_sub_menu_active = sym.to_sym
break
+
+ elsif v[:elements]
+
+ v[:elements].each do |a,b|
+ if b[:sub_elements] and b[:sub_elements][sym.to_sym]
+ @qi_menu_active = k
+ @qi_menu_sub_menu_active = sym.to_sym
+ end
+ end
+
+
end
@@ -64,11 +79,14 @@ class ApplicationController < ActionController::Base
if current_admin.has_permission?("products")
set_sub_menu :stocks, :p_products, "Produits", admin_p_products_path
+
set_sub_menu :stocks, :p_product_refs, "Références", admin_p_product_refs_path
set_sub_menu :stocks, :p_articles, "Articles", admin_p_articles_path
# set_sub_menu :stocks, :promos_p_products, "Offres spots", promos_admin_p_products_path
end
+
+
if current_admin.has_permission?("product-cats")
set_sub_menu :stocks, :p_product_cats, "Catégories produits", admin_p_product_cats_path
@@ -76,35 +94,38 @@ class ApplicationController < ActionController::Base
end
+
+ set_sub_menu :stocks, :p_preferences_products_menu, "Préférences", admin_p_products_path
if current_admin.has_permission?("brands")
- set_sub_menu :stocks, :s_brands, "Marques", admin_s_brands_path
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :s_brands, "Marques", admin_s_brands_path
end
if current_admin.has_permission?("fournisseurs")
- set_sub_menu :stocks, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path
end
if current_admin.has_permission?("stocks")
- set_sub_menu :stocks, :stock_alias, "Stocks", admin_line_stocks_path
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :stock_alias, "Stocks", admin_line_stocks_path
end
if current_admin.has_permission?("boutique")
- set_sub_menu :stocks, :p_product_colors, "Couleurs"
- set_sub_menu :stocks, :p_article_serial_nums, "Numeros série"
- set_sub_menu :stocks, :p_serial_num_types, "Types de Numero série"
- set_sub_menu :stocks, :p_product_ref_specs, "Specs"
- set_sub_menu :stocks, :p_spec_values, "Valeur de specs"
- set_sub_menu :stocks, :p_grades, "Grades"
- set_sub_menu :stocks, :p_product_powers, "Types de chargeurs"
- set_sub_menu :stocks, :p_product_zones, "Zones produits"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_colors, "Couleurs"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_article_serial_nums, "Numeros série"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_serial_num_types, "Types de Numero série"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_ref_specs, "Specs"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_types, "Types de specs"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_values, "Valeurs de specs"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_grades, "Grades" if PGrade::ACTIVATED
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_powers, "Types de chargeurs"
+ set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_zones, "Zones produits"
end
@@ -144,7 +165,7 @@ class ApplicationController < ActionController::Base
end
- set_sub_menu :documents, :"p_document_type_reponse_fournisseur", "Réponses fournisseurs", admin_price_documents_path(:price_document_type_id => 2)
+ # set_sub_menu :documents, :"p_document_type_reponse_fournisseur", "Réponses fournisseurs", admin_price_documents_path(:price_document_type_id => PriceDocumentType.find_by(label: "Réponse fournisseur").id)
@@ -195,6 +216,16 @@ class ApplicationController < ActionController::Base
@qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym] = {:name => name, :link => link}
end
+
+
+ def set_sub_sub_menu(big_menu, sub_menu, sub_sub_menu, name, link=nil)
+
+ link = eval("admin_#{sub_sub_menu}_path") if !link
+ @qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements] = @qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements] || {}
+
+ @qi_menus[big_menu.to_sym][:elements][sub_menu.to_sym][:sub_elements][sub_sub_menu.to_sym] = {:name => name, :link => link}
+
+ end
before_action :set_product_display
@@ -440,13 +471,17 @@ class ApplicationController < ActionController::Base
def current_admin
- if cookies[:admin_remember_token]
- if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
- @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
- else
- cookies[:admin_remember_token] =nil
- end
+ if @current_admin
+ return @current_admin
+ else
+ if cookies[:admin_remember_token]
+ if @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
+ @current_admin = Admin.find_by_remember_token(cookies[:admin_remember_token])
+ else
+ cookies[:admin_remember_token] =nil
+ end
+ end
end
@@ -499,7 +534,10 @@ class ApplicationController < ActionController::Base
end
-
+ def set_navbar_dropdown
+ @dropdown_elements = [:p_product_cats, :s_brands, :p_product_colors, :p_article_serial_nums, :p_serial_num_types, :p_product_ref_specs, :p_spec_values, :p_grades, :p_product_powers, :p_product_zones]
+ @dropdown_title = "Parametrage"
+ end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9e30dd0..31e8de0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -13,7 +13,20 @@ module ApplicationHelper
end
return raw(r)
end
-
+
+ def qi_js_field_price_line_form(form, model, method, options = {})
+ r = ""
+ if options[:hidden]
+ r += hidden_field_tag(method, eval("form.object.#{method}"), :class => "input_#{model}_#{method} form-control",:disabled => true)
+ else
+ if options[:label]
+ r += label_tag(:input, options[:label], class: options[:label_class])
+ end
+ r += text_field_tag(method, (options[:value] ? options[:value] : eval("form.object.#{method}")), :class => "input_#{model}_#{method} form-control",:disabled => true)
+ end
+ return raw(r)
+ end
+
def edit_watcher(element_type, element_id, key='' )
raw ('
')
diff --git a/app/helpers/document_line_helper.rb b/app/helpers/document_line_helper.rb
index 6dbbc93..0e54205 100644
--- a/app/helpers/document_line_helper.rb
+++ b/app/helpers/document_line_helper.rb
@@ -28,13 +28,17 @@ module DocumentLineHelper
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render("admin/"+association.to_s + "/essentials_form", :form => builder)
end
+ elsif options[:slug]
+ fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
+ render("admin/"+association.to_s + "/form_#{options[:slug]}", :form => builder)
+ end
else
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
render("admin/"+association.to_s + "/form", :form => builder)
end
end
- link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class])
+ link_to name,"#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");return false;", :class => (options[:class]), tabindex: options[:tabindex], style: options[:style]
end
end
diff --git a/app/helpers/translation_helper.rb b/app/helpers/translation_helper.rb
index 9021c6e..a608c96 100755
--- a/app/helpers/translation_helper.rb
+++ b/app/helpers/translation_helper.rb
@@ -32,7 +32,7 @@ module TranslationHelper
content = capture(&block) if block_given?
r = ""
- if current_admin.id == 1
+ if current_admin and current_admin.id == 1
r += ""
r += ic(:"stethoscope") if show_icon
diff --git a/app/models/line_stock.rb b/app/models/line_stock.rb
index 06e170d..ab34132 100644
--- a/app/models/line_stock.rb
+++ b/app/models/line_stock.rb
@@ -99,7 +99,7 @@ class LineStock < ApplicationRecord
end
def ca_price_u_kg_ht
- if self.qte_kg_per_unit != 0.0
+ if self.qte_kg_per_unit.to_f != 0.0
(self.price_u_ht.to_f / self.qte_kg_per_unit).round(2)
else
0.0
@@ -116,7 +116,7 @@ class LineStock < ApplicationRecord
end
def ca_qte_kg
- self.qte * self.qte_kg_per_unit
+ self.qte.to_f * self.qte_kg_per_unit.to_f
end
diff --git a/app/models/p_article.rb b/app/models/p_article.rb
index f301d09..187741f 100644
--- a/app/models/p_article.rb
+++ b/app/models/p_article.rb
@@ -12,16 +12,26 @@ class PArticle < ApplicationRecord
# has_many :p_product_ref_specs, through: :p_product_ref
# accepts_nested_attributes_for :p_product_ref_specs
- acts_as_sorting :fields => {
- :id => {:name => "id", :reorder => true},
- :p_product_ref_code => {:name => "Code ref", :reorder => true},
- :p_product_ref => {:name => "Désignation", :reorder => true},
- :p_grade => {:name => "Grade", :reorder => true},
- :color => {:name => "Couleur"},
- :p_article_serial_nums => {:name => "N° identifiants"},
- :actions => {:name => "Actions", :reorder => false},
- }
-
+ if PGrade::ACTIVATED
+ acts_as_sorting :fields => {
+ :id => {:name => "id", :reorder => true},
+ :p_product_ref_code => {:name => "Code ref", :reorder => true},
+ :p_product_ref => {:name => "Désignation", :reorder => true},
+ :p_grade => {:name => "Grade", :reorder => true},
+ :color => {:name => "Couleur"},
+ :p_article_serial_nums => {:name => "N° identifiants"},
+ :actions => {:name => "Actions", :reorder => false},
+ }
+ else
+ acts_as_sorting :fields => {
+ :id => {:name => "id", :reorder => true},
+ :p_product_ref_code => {:name => "Code ref", :reorder => true},
+ :p_product_ref => {:name => "Désignation", :reorder => true},
+ :color => {:name => "Couleur"},
+ :p_article_serial_nums => {:name => "N° identifiants"},
+ :actions => {:name => "Actions", :reorder => false},
+ }
+ end
def member_label
"#{p_product_ref.cc_name}"
end
diff --git a/app/models/p_customer.rb b/app/models/p_customer.rb
index 3fd7005..e1ee85d 100644
--- a/app/models/p_customer.rb
+++ b/app/models/p_customer.rb
@@ -192,6 +192,15 @@ class PCustomer < ApplicationRecord
end
+ def tva_rate
+ if tva = TvaRate.where(:accounting_zone_id => self.accounting_zone_id).first
+ return tva
+ else
+ return nil
+ end
+ end
+
+
def update_caches
diff --git a/app/models/p_customer_sheet.rb b/app/models/p_customer_sheet.rb
index c38ed4c..9ab4cf7 100644
--- a/app/models/p_customer_sheet.rb
+++ b/app/models/p_customer_sheet.rb
@@ -40,6 +40,7 @@ class PCustomerSheet < ApplicationRecord
:tot_amount_ht => {:name => "Total HT", :reorder => true, :sort_name => "cc_tot_amount_ht", :sort_name => "p_customer_sheets.cc_tot_amount_ht"},
:tot_amount_ttc => {:name => "Total TTC", :reorder => true, :sort_name => "cc_tot_amount_ttc", :sort_name => "p_customer_sheets.cc_tot_amount_ttc"},
:state => {:name => "Statut", :reorder => false, :as => :state},
+ :check_box => {:name => "Export excel #{''}", :reorder => false},
:actions => {:name => "Actions", :reorder => false},
}
diff --git a/app/models/p_grade.rb b/app/models/p_grade.rb
index 949f5e1..648e10e 100644
--- a/app/models/p_grade.rb
+++ b/app/models/p_grade.rb
@@ -7,4 +7,5 @@ class PGrade < ApplicationRecord
:actions => {:name => "Actions", :reorder => false},
}
+ ACTIVATED = false
end
diff --git a/app/models/p_product_ref.rb b/app/models/p_product_ref.rb
index 07926e6..9a7fccf 100644
--- a/app/models/p_product_ref.rb
+++ b/app/models/p_product_ref.rb
@@ -18,7 +18,7 @@ class PProductRef < ApplicationRecord
accepts_nested_attributes_for :p_product_ref_specs, allow_destroy: true
#validates :ct_price_ht, :presence => true
-
+ validate :ean, :is_integer
has_many :p_customer_product_prices, :dependent => :destroy
accepts_nested_attributes_for :p_customer_product_prices, allow_destroy: true
@@ -43,11 +43,14 @@ class PProductRef < ApplicationRecord
:description => {:name => "Description"},
:ct_sub_name => {:name => "Nom référence"},
:ct_price_ht => {:name => "Prix de vente", :as => :currency},
-
-
+ :ean => {:name => "EAN"},
+ :ca_deee => {:name => "DEEE", :as => :currency},
+ :ca_sorecop => {:name => "Sorecop", :as => :currency},
+ :sorecop_comment => {:name => "Type de Sorecop"},
:actions => {:name => "Actions", :reorder => false}
}
+ acts_as_caching :fields => [:sorecop, :deee]
def not_imported?
if !self.p_product or !self.p_product.imported
@@ -150,4 +153,26 @@ class PProductRef < ApplicationRecord
"#{self.ref} | #{self.p_product.name} - #{self.ct_sub_name} - #{self.p_product_color.name if self.p_product_color} | #{self.cat_name}"
end
+ def ca_sorecop
+ if self.cc_sorecop
+ return self.cc_sorecop
+ else
+ "TODO Calcul sorecop"
+ end
+ end
+
+ def ca_deee
+ if self.cc_deee
+ return self.cc_deee
+ else
+ "TODO Calcul DEEE"
+ end
+ end
+
+ def is_integer
+ if ean.present? && ean.match(/\A[+-]?\d+\z/).nil?
+ errors.add(:ean, "ne doit être composé que de chiffres")
+ end
+ end
+
end
diff --git a/app/models/p_spec_type.rb b/app/models/p_spec_type.rb
index a656aa6..42875d3 100644
--- a/app/models/p_spec_type.rb
+++ b/app/models/p_spec_type.rb
@@ -1,5 +1,10 @@
class PSpecType < ApplicationRecord
has_many :p_product_ref_specs
-
TYPES = ["Ram", "Stockage"]
+
+ acts_as_sorting :fields => {
+ :id => {:name => "ID"},
+ :name => {:name => "Type", :reorder => true},
+ :actions => {:name => "Actions", :reorder => true}
+ }
end
diff --git a/app/models/price_document.rb b/app/models/price_document.rb
index ec4b0f8..24fcc09 100644
--- a/app/models/price_document.rb
+++ b/app/models/price_document.rb
@@ -25,8 +25,10 @@ class PriceDocument < ApplicationRecord
has_many :avoir_p_payment_documents, :dependent => :destroy, :foreign_key => :avoir_id, :class_name => "PPaymentDocument"
accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true
- PURCHASES = ["Demande prix", "Commande achat", "Facture d'achat"]
+ PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"]
SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
+ # AVANCEMENT = ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]
+ AVANCEMENT = ["0%", "25%", "50%", "75%", "100"]
validates :public_fournisseur_name, :presence => true, :if => :public_fournisseur_name_needed?
@@ -269,7 +271,8 @@ class PriceDocument < ApplicationRecord
:end_date => {:name => "Fin de consultation", :reorder => true},
:dp_comment => {:name => "Commentaire", :reorder => true},
:acheteur_text => {:name => "Envoyé à", :reorder => true},
-
+ :customer_ref => {:name => "Ref cotation", :reorder => false},
+
:p_commercial => {:name => "Commercial", :reorder => false},
:p_customer => {:name => "Client", :reorder => false},
@@ -291,7 +294,7 @@ class PriceDocument < ApplicationRecord
:cc_cost_ht => {:name => "Coût HT", :reorder => true, :as => :currency},
:cc_marge_ht => {:name => "Marge HT", :reorder => true, :as => :currency},
:cost_ok => {:name => "Marge calculée", :reorder => true, :as => :boolean},
-
+ :f_token => {:name => "Liens consultation"},
diff --git a/app/models/price_line.rb b/app/models/price_line.rb
index 7a82893..32e2d5b 100644
--- a/app/models/price_line.rb
+++ b/app/models/price_line.rb
@@ -2,6 +2,15 @@ class PriceLine < ApplicationRecord
belongs_to :price_line_block
belongs_to :p_product
belongs_to :p_product_ref
+ belongs_to :p_product_power
+ has_many :price_line_resp_selects, :foreign_key => :price_line_demand
+ has_many :price_line_resps, through: :price_line_resp_selects, :source => :price_line_resp
+
+
+ has_one :p_fournisseur, :through => :price_line_block
+
+ #has_many :price_line_demands, through: :price_line_resp_selects
+
default_scope { order('position ASC') }
validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed?
@@ -17,7 +26,10 @@ class PriceLine < ApplicationRecord
:ref => {:name => "Ref", :reorder => true},
:title => {:name => "Désignation", :reorder => true},
:qte => {:name => "Qté", :reorder => true},
+
:qte_available => {:name => "Qté dispo.", :reorder => true},
+
+ :ct_u_price_ht => {:name => "Prix de vente", :reorder => true},
:ref_fournisseur => {:name => "Réf. fournisseur", :reorder => true},
:p_product_power_id => {:name => "Chargeur", :reorder => true},
:p_product_zone_id => {:name => "Zone", :reorder => true},
@@ -26,7 +38,8 @@ class PriceLine < ApplicationRecord
:ram_unit => {:name => "Ram unité", :reorder => true},
:eu => {:name => "EU ?", :reorder => true},
:fullkit => {:name => "Fullkit ?", :reorder => true},
- :lang_start => {:name => "Démarrage écran langue ?", :reorder => true}
+ :lang_start => {:name => "Démarrage écran langue ?", :reorder => true},
+ :actions => {:name => "Actions"}
}
@@ -39,7 +52,9 @@ class PriceLine < ApplicationRecord
BON_DE_LIVRAISON_TO_RESET = %w(block_type weight_tot tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc)
- FACTURE_DACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
+ FACTURE_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
+
+ BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate local_tot_amount_ht block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
COMMANDE_ACHAT_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
@@ -209,7 +224,7 @@ class PriceLine < ApplicationRecord
def ca_product_no_remise
- if self.p_product_ref and self.p_customer and p_customer_product_price = self.p_product_ref.p_customer_product_prices.where(:p_customer_id => self.p_customer.id).first
+ if false #self.p_product_ref and self.p_customer and p_customer_product_price = self.p_product_ref.p_customer_product_prices.where(:p_customer_id => self.p_customer.id).first
p_customer_product_price.no_remise
@@ -533,38 +548,36 @@ class PriceLine < ApplicationRecord
-
-
def ca_tot_amount_ht
- if ct_tot_amount_ht
+ if self.ct_tot_amount_ht
self.ct_tot_amount_ht
else
- (self.ca_price_u_kg_net_ht * self.weight_qte.to_f).round(2)
+ (self.ca_price_u_ht * self.qte.to_f).round(3)
end
end
def ca_tot_amount_tva
- (self.tot_amount_ht * (self.tva_account_value/100)).round(2)
+ (self.tot_amount_ht * (self.tva_account_value/100)).round(3)
end
def ca_tot_amount_ttc
- (self.tot_amount_ht + self.tot_amount_tva).round(2)
+ (self.tot_amount_ht + self.tot_amount_tva).round(3)
end
-
-
-
+
+
+
def ca_tot_discount_ht
- (self.ca_price_u_ht * self.qte.to_f).round(2) - self.ca_tot_amount_ht
+ (self.ca_price_u_ht * self.qte.to_f).round(3) - self.ca_tot_amount_ht
end
-
-
-
+
+
+
def ca_tot_discount_tva
- (self.tot_discount_ht * (self.tva_account_value/100)).round(2)
+ (self.tot_discount_ht * (self.tva_account_value/100)).round(3)
end
def ca_tot_discount_ttc
- (self.tot_discount_ht+self.tot_discount_tva).round(2)
+ (self.tot_discount_ht+self.tot_discount_tva).round(3)
end
@@ -597,7 +610,12 @@ class PriceLine < ApplicationRecord
AVOIR_TO_RESET = %w(block_type product_no_remise price_calc weight_u weight_tot tva_account_id tva_account_value ref title description price_u_ht price_u_tva price_u_ttc tot_line_ht tot_line_tva tot_line_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc discount_market_percent discount_qte_percent discount_delay_percent discount_enrobage_percent discount_ecole_percent discount_comptant_percent product_remise_enrobage_ok uv p_product_specific_customer_id)
-
+ def self.asap_triage(limit)
+ total = self.sum(:qte).to_i
+ asap = self.where('cc_wish_date < ?', Date.today + limit).sum(:qte).to_i
+ non_asap = total - asap
+ return [asap, non_asap]
+ end
diff --git a/app/models/price_line_block.rb b/app/models/price_line_block.rb
index c116b7c..942a0ea 100644
--- a/app/models/price_line_block.rb
+++ b/app/models/price_line_block.rb
@@ -23,11 +23,12 @@ class PriceLineBlock < ApplicationRecord
belongs_to :p_payment_type
- PURCHASE_BLOCKS = ["Facture d'achat", "Commande achat"]
+ PURCHASE_BLOCKS = ["Réponse fournisseur", "Consultation fournisseur", "Facture d'achat", "Commande achat", "Demande prix", "Bon de commande achat", "Bon de réception achat", "Facture achat", "Avoir achat"]
+
SALE_BLOCKS = ["Demande de commande", "Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
-
+
belongs_to :p_fournisseur
-
+ accepts_nested_attributes_for :p_fournisseur
def to_no_archive
if self.imported
@@ -261,7 +262,9 @@ class PriceLineBlock < ApplicationRecord
end
def wish_date_needed?
- if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Réponse fournisseur"
+ if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
+ false
+ elsif self.block_type == "Devis"
false
else
true
@@ -270,7 +273,9 @@ class PriceLineBlock < ApplicationRecord
def particular_bill_needed?
if !self.imported
- if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur"
+ if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
+ false
+ elsif self.block_type == "Devis"
false
else
true
@@ -280,7 +285,9 @@ class PriceLineBlock < ApplicationRecord
def particular_send_needed?
if !self.imported
- if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur"
+ if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
+ false
+ elsif self.block_type == "Devis"
false
else
true
@@ -289,7 +296,9 @@ class PriceLineBlock < ApplicationRecord
end
def p_fournisseur_needed?
- if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
+ if ["Demande prix", "Consultation fournisseur", "Réponse fournisseur"].include?(self.block_type)
+ false
+ elsif PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
true
else
false
@@ -297,9 +306,11 @@ class PriceLineBlock < ApplicationRecord
end
def p_customer_needed?
- if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type) or self.block_type == "Demande prix" or self.block_type == "Réponse fournisseur"
+ if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
false
- elsif !self.imported
+ elsif self.block_type == "Devis"
+ false
+ else
true
end
end
@@ -315,7 +326,9 @@ class PriceLineBlock < ApplicationRecord
BON_DE_LIVRAISON_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
- FACTURE_DACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
+ FACTURE_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
+
+ BON_DE_RECEPTION_ACHAT_TO_RESET = %w(devise_rate weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
COMMANDE_ACHAT_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
@@ -337,12 +350,12 @@ class PriceLineBlock < ApplicationRecord
eval("self.ac_#{qid} = nil")
end
- self.archive_now(:skip_personalised_archive => true)
+ self.archive_now()
self.price_lines.each do |pl|
- pl.archive_now(:skip_personalised_archive => true)
+ pl.archive_now()
end
diff --git a/app/models/price_line_resp_select.rb b/app/models/price_line_resp_select.rb
new file mode 100644
index 0000000..f656ff3
--- /dev/null
+++ b/app/models/price_line_resp_select.rb
@@ -0,0 +1,4 @@
+class PriceLineRespSelect < ApplicationRecord
+ belongs_to :price_line_demand, class_name: "PriceLine"
+ belongs_to :price_line_resp, class_name: "PriceLine"
+end
diff --git a/app/views/admin/buy_lists/index.html.haml b/app/views/admin/buy_lists/index.html.haml
index fdde1af..de9fbbb 100644
--- a/app/views/admin/buy_lists/index.html.haml
+++ b/app/views/admin/buy_lists/index.html.haml
@@ -1,3 +1,4 @@
+-checkbox = false
.qi_header
.right
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add"
@@ -10,16 +11,76 @@
=form_tag "", :method => "get", :onsubmit => "" do
-params[:search] =params[:search] || {}
-
%table
- %tr
-
+ %tr.form-inline
+ %td
+ Date saisie commande :
+ Début
+ %td.input-group
+ =text_field_tag :cc_creation_date_start, params[:cc_creation_date_start],:class => "form-control datepicker", :placeholder => "Début"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
+ =ic(:times)
+ %td.pl-4
+ Fin
+ %td.input-group
+ =text_field_tag :cc_creation_date_stop, params[:cc_creation_date_stop],:class => "form-control datepicker", :placeholder => "Fin"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
+ =ic(:times)
%td
Statut :
- =select_tag "search[state]", options_for_select([["",""]]+PCustomerSheet.group(:state).all.map{|a| [a.state, a.state]}, params[:search][:state])
-
-
-
+ =select_tag "search[state]", options_for_select([["",""]]+PCustomerSheet.group(:state).all.map{|a| [a.state, a.state]}, params[:search][:state]), class: "custom-select"
+
+ %td
+ Marque :
+ =select_tag "search[s_brand]", options_for_select([["",""],["Aucune","null"]]+SBrand.pluck(:name, :id), params[:search][:s_brand]), class: "custom-select"
+ %td
+ Code client :
+ =text_field_tag "search[p_customer_code]", params[:search][:p_customer_code],:class => "form-control"
+
+ %tr.form-inline
+ %td{width: "110px"}
+
+ %td.right.mx-4
+ -if @cc_creation_date_start and @cc_creation_date_stop
+
+ =link_to "< Mois précédent",request.query_parameters.merge({cc_creation_date_start: ((@cc_creation_date_start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), cc_creation_date_stop: ((@cc_creation_date_stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+ %td{width: "20px"}
+ %td.mr-auto
+ -if @cc_creation_date_start and @cc_creation_date_stop
+ =link_to "Mois suivant >",request.query_parameters.merge({cc_creation_date_start: ((@cc_creation_date_start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), cc_creation_date_stop: ((@cc_creation_date_stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+
+ %tr.form-inline
+ %td
+ Date ETA :
+ Début
+ %td.input-group
+ =text_field_tag :wish_date_start, params[:wish_date_start],:class => "form-control datepicker", :placeholder => "Début"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
+ =ic(:times)
+ %td.pl-4
+ Fin
+ %td.input-group
+ =text_field_tag :wish_date_stop, params[:wish_date_stop],:class => "form-control datepicker", :placeholder => "Fin"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
+ =ic(:times)
+ %tr.form-inline
+ %td{width: "110px"}
+
+ %td.right.mx-4
+ -if @wish_date_start and @wish_date_stop
+
+ =link_to "< Mois précédent",request.query_parameters.merge({wish_date_start: ((@wish_date_start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), wish_date_stop: ((@wish_date_stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+ %td{width: "20px"}
+ %td.mr-auto
+ -if @wish_date_start and @wish_date_stop
+ =link_to "Mois suivant >",request.query_parameters.merge({wish_date_start: ((@wish_date_start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), wish_date_stop: ((@wish_date_stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+
+
+ =link_to ic(:search)+" Rechercher", "#", :class => "btn btn-default btn-qi-search", :onclick => "$(this).closest('form').submit();$(this).html('...');return false;"
@@ -27,7 +88,7 @@
=#render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customer_sheets}
--nbr_td = 15
+-nbr_td = 10
.qi_pannel.padding.new_table_container
.table-slider
@@ -39,32 +100,42 @@
=form_tag new_admin_price_document_path(), :method => "get" do
=hidden_field_tag :"document_type", "Demande prix"
- =hidden_field_tag :"price_line_ids[]", ""
+ =hidden_field_tag :"p_product_ref_ids[]", ""
+
.freezeTable
%table.table.table-striped.table-hover.table-bordered.data_table
%thead.header
%tr
- %th
+ -if checkbox
+ %th
+ %th.mask.plus-all
+ =link_to ic("plus-square-o"), '#'
%th
Produit
%th
Référence
- %th Qté
-
- %th.mask
+ / %th Qté
+ %th.mask.col-detail
N° Commande
- %th.mask
+ %th.mask.col-detail
Client
- %th.mask
+ %th.mask.col-detail
Statut
- %th.mask Date saisie
- %th.mask Date validation
+ %th.mask.col-detail Commentaire
+ %th.mask.col-detail Date saisie
+ %th.mask.col-detail Date validation
%th.mask Date livraison (ETA)
%th.mask
- Qté commandée
- %th.mask Commentaire
+ Qté nécessaire
+ %th.mask
+ Qté en stock
+ %th.mask
+ Qté souhaité
+ %span.info
+ =ic("info-circle")
+ %span.info-text-bottom BPA - Qté en stock
%th.mask BPA
%th.mask AV BPA
%th.mask PAS BPA
@@ -79,17 +150,27 @@
-if p_product_id != plr.p_product_id
-p_product_id = plr.p_product_id
%tr.prdct_tr
- -nbr_td.times.each do
+ -nbr_td.times.each do
%td
-
-
-
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
-ppr_lines = @price_lines.where(:p_product_ref_id => plr.p_product_ref.id)
%tr.ref_tr
- %td
+ - bpa_qte = ppr_lines.where(:cc_state => "BPA").sum(:qte).to_i
+ - qte_available = LineStock.where(p_product_ref_id: plr.p_product_ref.id).sum(:qte_available).to_i
+
+ -if checkbox
+ %td
+
+ %td.plus
+ =link_to ic("plus-square-o"), "#"
%td
=link_to plr.p_product_ref.p_product.name, [:admin, plr.p_product_ref]
%td
@@ -97,79 +178,105 @@
=plr.p_product_ref.ct_sub_name
=plr.p_product_ref.p_product_color.name if plr.p_product_ref.p_product_color
- %td
- =ppr_lines.sum(:qte)
-
+ %td.col-detail
+
+
+ %td.mask.col-detail
+ / %td.mask
+ %td.mask.col-detail
+ %td.mask.col-detail
+ %td.mask.col-detail
+ %td.mask.col-detail
+ %td.mask
+ %td.mask
+ ∑
+ =ppr_lines.sum(:qte).to_i
+ %br
+ %span.asap
+ =ic(:fire)
+ =ppr_lines.asap_triage(20).first
+ %br
+ %span.non-asap
+ =ic(:hourglass)
+ =ppr_lines.asap_triage(20).last
+ %td.mask
+ = qte_available
+ %td.mask
+ - default_qte = [bpa_qte - qte_available, 0].max
+ =check_box_tag :"p_product_ref_ids[]", plr.p_product_ref.id, (true if default_qte > 0 )
+
+ =number_field_tag "qte[#{plr.p_product_ref.id}]", '', class: "small-input", value: default_qte, min: 0
+
+ %td.mask
+ = bpa_qte
+ %td.mask
+ =ppr_lines.where(:cc_state => "AV BPA").sum(:qte).to_i
+ %td.mask
+ =ppr_lines.where(:cc_state => "PAS BPA").sum(:qte).to_i
- %td.mask
- %td.mask
- %td.mask
- %td.mask
- %td.mask
- %td.mask
- %td.mask
- %td.mask
-
-
- %td.mask
- =ppr_lines.where(:cc_state => "BPA").sum(:qte)
- %td.mask
- =ppr_lines.where(:cc_state => "AV BPA").sum(:qte)
- %td.mask
- =ppr_lines.where(:cc_state => "PAS BPA").sum(:qte)
-
- -ppr_lines.each do |price_line|
- %tr
- %td
- =check_box_tag :"price_line_ids[]", price_line.id
- %td
- %td
- %td
- %td
- =link_to [:admin, price_line.price_line_block.price_lineable] do
- =price_line.price_line_block.price_lineable.id
- =price_line.price_line_block.price_lineable.past_id
-
-
-
- %td
- =link_to price_line.p_customer.show_name, [:admin, price_line.p_customer]
-
- %td
- =state_helper price_line.price_line_block.price_lineable.state
-
- %td
- = l price_line.cc_creation_date, :format => :short_date
-
- %td
- = l price_line.cc_validation_date, :format => :short_date if price_line.cc_validation_date
-
-
- %td
- = l price_line.cc_wish_date, :format => "semaine %V (%Y)"
-
- %td
- =price_line.qte
-
- %td
- =price_line.comment
-
- %td
- =price_line.qte if price_line.cc_state == "BPA"
-
- %td
- =price_line.qte if price_line.cc_state == "AV BPA"
-
- %td
- =price_line.qte if price_line.cc_state == "PAS BPA"
-
+ %tbody.detail
+ -ppr_lines.each do |price_line|
+ %tr
+ - if checkbox
+ %td
+ =check_box_tag :"price_line_ids[]", price_line.id
+ / %td
+ %td
+ %td
+ %td
+ %td.col-detail
+ =link_to [:admin, price_line.price_line_block.price_lineable] do
+ =price_line.price_line_block.price_lineable.id
+ =price_line.price_line_block.price_lineable.past_id
+
+
+
+ %td.col-detail
+ =link_to price_line.p_customer.show_name, [:admin, price_line.p_customer]
+
+ %td
+ =state_helper price_line.price_line_block.price_lineable.state
+
+ %td
+ =price_line.comment
+ %td
+ = l price_line.cc_creation_date, :format => :short_date
+
+ %td
+ = l price_line.cc_validation_date, :format => :short_date if price_line.cc_validation_date
+
+ %td
+ = l price_line.cc_wish_date, :format => "semaine %V (%Y)"
+
+ %td
+ =price_line.qte.to_i
+ %td
+
+ %td
+
+
+ %td
+ =price_line.qte.to_i if price_line.cc_state == "BPA"
+
+ %td
+ =price_line.qte.to_i if price_line.cc_state == "AV BPA"
+
+ %td
+ =price_line.qte.to_i if price_line.cc_state == "PAS BPA"
+
-p_product_id = plr.p_product_id
-
- %tr
- -nbr_td.times.each do
- %td
-
- =submit_tag "Créer une demande de prix", :class => "btn btn-primary"
+
+ %tr
+ -nbr_td.times.each do
+ %td
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+ %td.col-detail
+
+ =submit_tag "Créer une demande de prix", :class => "btn btn-primary"
@@ -187,10 +294,77 @@
border-bottom:3px solid red;
}
}
+
+ .asap {
+ color: red;
+ }
+
+ .non-asap {
+ color: darkblue;
+ }
+
+ .small-input {
+ max-width: 100px;
+ }
+
+:javascript
+ // TOOGLE ORDERS DETAILS - set to hidden
+ $('.detail').hide()
+ $('.col-detail').hide()
+ let state = 0
+ // TOGGLE ORDER LINE DETAILS
+ $('.plus').click(function(event){
+ if( event.currentTarget.className == "plus") {
+ $(event.currentTarget).removeClass('plus').addClass('minus')
+ state += 1
+ $('.col-detail').show()
+ $(event.currentTarget).parent().parent().next('tbody.detail').toggle();
+ }else{
+ $(event.currentTarget).removeClass('minus').addClass('plus')
+ state -= 1
+ $(event.currentTarget).parent().parent().next('tbody.detail').toggle();
+ }
+ $(event.currentTarget).find('i').toggleClass('fa fa-plus-square-o').toggleClass('fa fa-minus-square-o')
+ if(state == 0){
+ $('.col-detail').hide()
+ }else{
+ $('.col-detail').show()
+ }
+ });
+ // TOOGLE ALL ORDERS DETAILS
+ $('.plus-all').click(function(event){
+ if( event.currentTarget.className == "mask plus-all") {
+ state += $('.plus').length
+ $(event.currentTarget).removeClass('plus-all').addClass('minus-all')
+ $('tbody.detail').show();
+ $('.plus').find('i').toggleClass('fa fa-plus-square-o').toggleClass('fa fa-minus-square-o')
+ $('.plus').removeClass('plus').addClass('minus')
+ $(event.currentTarget).find('i').removeClass('fa fa-plus-square-o').addClass('fa fa-minus-square-o')
+ }else{
+ state -= $('.minus').length
+ $(event.currentTarget).removeClass('minus-all').addClass('plus-all')
+ $('.minus').find('i').removeClass('fa fa-minus-square-o').addClass('fa fa-plus-square-o')
+ $('.minus').removeClass('minus').addClass('plus')
+
+ $('tbody.detail').hide();
+ $(event.currentTarget).find('i').removeClass('fa fa-minus-square-o').addClass('fa fa-plus-square-o')
+ }
+ if(state == 0){
+ $('.col-detail').hide()
+ }else{
+ $('.col-detail').show()
+ }
+ });
+ // CHECK QTE IF QTE CHANGE
+ $('.small-input').change(function(){
+ let checkbox = $(this).closest('td').find("input[type=checkbox]")
+ if (this.value > 0) {
+ checkbox.prop("checked", true)
+ } else {
+ checkbox.prop("checked", false)
+ }
+ })
+
-
-
-
-
\ No newline at end of file
diff --git a/app/views/admin/p_articles/_form.html.haml b/app/views/admin/p_articles/_form.html.haml
index 3bec92b..ae711c0 100644
--- a/app/views/admin/p_articles/_form.html.haml
+++ b/app/views/admin/p_articles/_form.html.haml
@@ -3,7 +3,8 @@
.content
=f.inputs do
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct, :label => f.object.label_for(:p_product_ref)
- = f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade"
+ -if PGrade::ACTIVATED
+ = f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade"
%h4 Numero de série :
.p_article_serial_nums_form
= f.semantic_fields_for :p_article_serial_nums do |form|
diff --git a/app/views/admin/p_articles/_p_article.html.haml b/app/views/admin/p_articles/_p_article.html.haml
index 8d4a1ed..32497fc 100644
--- a/app/views/admin/p_articles/_p_article.html.haml
+++ b/app/views/admin/p_articles/_p_article.html.haml
@@ -7,7 +7,8 @@
-tr[:p_grade] = capture do
%td
- = p_article.p_grade.grade
+ -if p_article.p_grade
+ = p_article.p_grade.grade
-tr[:color] = capture do
%td
diff --git a/app/views/admin/p_customer_sheets/_form.html.haml b/app/views/admin/p_customer_sheets/_form.html.haml
index 16361e8..2c1194a 100755
--- a/app/views/admin/p_customer_sheets/_form.html.haml
+++ b/app/views/admin/p_customer_sheets/_form.html.haml
@@ -1,17 +1,28 @@
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
-
- .content
+ =form.semantic_fields_for :price_line_block do |f|
+ =render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
-
- .price_line_block_form
- =form.semantic_fields_for :price_line_block do |f|
- =render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
+ .content
+ .qi_row
+ .qi_pannel.qi_plain.padding.row
+ .col-2
+ -if @p_customer_sheet and @p_customer_sheet.state != "commande"
+ =#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
+
+ =form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
+
+ =form.input :past_id, :label => "N° système actuel"
+ =yield :discount
+ .col-2
+ =yield :shipping_date
+ .col-8
+ =yield :particular
-
-
- .right.actions
- =link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
- =form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
+ =yield :price_lines
+ .large_actions
+ .actions
+ =link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
+ =form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
.clear
diff --git a/app/views/admin/p_customer_sheets/_p_customer_sheet.html.haml b/app/views/admin/p_customer_sheets/_p_customer_sheet.html.haml
index 5a8f2b5..7d589a3 100644
--- a/app/views/admin/p_customer_sheets/_p_customer_sheet.html.haml
+++ b/app/views/admin/p_customer_sheets/_p_customer_sheet.html.haml
@@ -43,9 +43,11 @@
-tr[:tot_amount_ttc] = capture do
%td.numeraire
=number_to_currency p_customer_sheet.cc_tot_amount_ttc
-
-
-
+
+ -tr[:check_box] = capture do
+ %td
+ =check_box_tag "p_customer_sheet_ids[]", p_customer_sheet.id, false, data: { client: p_customer_sheet.p_customer.id }, id: "p_customer_sheet_id_checkbox_#{p_customer_sheet.id}"
+
-tr[:actions] = capture do
%td.actions
-if p_customer_sheet.state == "brouillon" and p_customer_sheet.demande_type.to_s == "Brouillon"
diff --git a/app/views/admin/p_customer_sheets/index.html.haml b/app/views/admin/p_customer_sheets/index.html.haml
index 8657d2a..f61d281 100644
--- a/app/views/admin/p_customer_sheets/index.html.haml
+++ b/app/views/admin/p_customer_sheets/index.html.haml
@@ -1,7 +1,6 @@
.qi_header
.right
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary btn-ap-add"
-
%h1
Ventes
%span
@@ -179,5 +178,77 @@
="-"
=link_to ic(:times)+" Supprimer ce filtre", params.permit!.merge({ :active_kpi => nil, :p_customer_sheet_ids => nil})
+%div
+ =form_tag export_xls_admin_p_customer_sheets_path(format: :csv), id: 'export-form', :method => "get" do
+ .table
+ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}
+
+ %button.btn.btn-primary.ml-4{onclick: "checkMultipleClient()"}
+ =ic("file-excel-o")
+ Export xls
+.modal.fade#multi-client-export{"tab-index" => "-1", "role" => "dialog", "aria-labelledby" => "Raprochement Fournisseur", "aria-hidden" => "true"}
+ .modal-dialog{role: "dialog"}
+ .modal-content
+ .modal-header
+ %h5.modal-title
+ Export Excel
+ %button.close{"data-dismiss" => "modal", "aria-label" => "Close"}
+ %span{"aria-hidden" => "true"}
+ ×
+ .modal-body
+ Attention !
+ %br
+ %br
+ Selection de plusieurs clients détéctée
+ %br
+ Vous avez selectionné des commandes liées à différents clients.
+ %br
+ Etes-vous sûr ?
+
+ .modal-footer
+ %button.btn.btn-light{"data-dismiss" => "modal"}
+ Annuler l'export
+ %button.btn.btn-primary{"data-dismiss" => "modal", onclick: "submitExport()"}
+ =ic("file-excel-o")
+ Confirmer
+
+:javascript
+ $("#check-all").parent().on("click", function(event) {
+ console.log(event.currentTarget)
+ event.currentTarget.classList.toggle("checked")
+ if(event.currentTarget.classList.contains("checked")){
+ $('.table input[type=checkbox]').prop("checked", true)
+ }else{
+ $('.table input[type=checkbox]').prop("checked", false)
+ }
+ })
+
+ "#dataTable tbody tr"
+ function submitExport() {
+ $('#export-form').submit()
+ }
+
+ function checkDiff(arr) {
+ return arr.every(e => e == arr[0]);
+ }
+
+ const checkMultipleClient = () => {
+ let arr = []
+ $('.table input[type=checkbox]').each(function( i ) {
+ if ( this.checked === true)
+ arr.push($(this).data('client'))
+ })
+ if (checkDiff(arr) === false) {
+ $('#multi-client-export').modal('show')
+ } else {
+ submitExport()
+ }
+ }
+
+
+:scss
+ th > i {
+ cursor: pointer;
+ }
+
-=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}
diff --git a/app/views/admin/p_product_refs/_form.html.haml b/app/views/admin/p_product_refs/_form.html.haml
index b7ff800..4b0b755 100644
--- a/app/views/admin/p_product_refs/_form.html.haml
+++ b/app/views/admin/p_product_refs/_form.html.haml
@@ -1,3 +1,4 @@
+=#debug form.object.errors.messages
=# form.input :ref, :label => "Ref :"
.qi_row.field
.qi_pannel.qi_plain.padding
@@ -19,6 +20,15 @@
%td
=form.input :p_product_color_id, :label => "Couleur :", :collection => PProductColor.all, :as => :select, :include_blank => true
+ %td
+ =form.input :ct_sorecop, :label => "Sorecop personalisée :"
+ %td
+ =form.input :sorecop_comment, :label => "Type de Sorecop :"
+ %td
+ =form.input :ct_deee, :label => "DEEE personalisée :"
+ %td
+ =form.input :ean
+
diff --git a/app/views/admin/p_product_refs/_p_product_ref.html.haml b/app/views/admin/p_product_refs/_p_product_ref.html.haml
index 33e3f52..ca09295 100644
--- a/app/views/admin/p_product_refs/_p_product_ref.html.haml
+++ b/app/views/admin/p_product_refs/_p_product_ref.html.haml
@@ -31,8 +31,14 @@
%td.actions
=# link_to i(:"trash-o"), [:admin, p_product_ref], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce produit ? ' } , :remote => true if !PriceLine.where(:p_product_ref_id => p_product_ref).first
=#debug PriceLine.where(:p_product_ref_id => p_product_ref.id).first
- = link_to i(:pencil), edit_admin_p_product_path(p_product_ref.p_product), :remote => false
- = link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false
+
+ -if @manager
+ = link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false, :target => "_blank"
+ = link_to i(:"check"), "#",:onclick => "send_manager_product('"+p_product_ref.id.to_s+"', '"+escape_javascript(p_product_ref.member_label.to_s)+"');return false;"
+
+ -else
+ = link_to i(:pencil), edit_admin_p_product_path(p_product_ref.p_product), :remote => false
+ = link_to i(:eye), admin_p_product_ref_path(p_product_ref), :remote => false
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_product_ref}
diff --git a/app/views/admin/p_product_refs/index.html.haml b/app/views/admin/p_product_refs/index.html.haml
index 9e77e44..3a3aeaf 100644
--- a/app/views/admin/p_product_refs/index.html.haml
+++ b/app/views/admin/p_product_refs/index.html.haml
@@ -1,17 +1,19 @@
-.qi_header
- .right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false
- %h1
- Achats
- %span
- Produits
+-if !@manager
+ .qi_header
+ .right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false
+ %h1
+ Achats
+ %span
+ Références
+
.qi_search_row
- =form_tag "", :method => "get", :onsubmit => "" do
+ =form_tag admin_p_product_refs_path, :method => "get", :onsubmit => "", :remote => true do
=hidden_field_tag :column, params[:column]
=hidden_field_tag :direction, params[:direction]
-
+ =hidden_field_tag :manager, params[:manager]
%table
%tr
%td
@@ -42,7 +44,7 @@
-=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs}
+#p_product_refs_index_wrapper=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}
@@ -52,4 +54,7 @@
});
-
\ No newline at end of file
+
+:coffeescript
+ $(".qi_search_row form").on "submit", ->
+ $("#p_product_refs_index_wrapper").html('recherche en cours ...')
\ No newline at end of file
diff --git a/app/views/admin/p_product_refs/index.js.erb b/app/views/admin/p_product_refs/index.js.erb
new file mode 100644
index 0000000..ab3b84a
--- /dev/null
+++ b/app/views/admin/p_product_refs/index.js.erb
@@ -0,0 +1,9 @@
+
+var p_product_refs_url = "<%= escape_javascript(request.url) %>";
+
+
+$('#p_product_refs_index_wrapper').html("<%= escape_javascript(render(:partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}))%>");
+
+
+
+$(".btn-qi-search").html(' Rechercher');
\ No newline at end of file
diff --git a/app/views/admin/p_spec_types/_form.html.haml b/app/views/admin/p_spec_types/_form.html.haml
index ab615d2..2b94b28 100644
--- a/app/views/admin/p_spec_types/_form.html.haml
+++ b/app/views/admin/p_spec_types/_form.html.haml
@@ -1,2 +1,13 @@
-=f.inputs do
- = f.input :name, :label => "Type", as: :select, collection: PSpecType::TYPES
+- if params[:controller] == "admin/p_spec_types"
+ =semantic_form_for [:admin, @p_spec_type], :remote => true do |f|
+
+ .content
+ =f.inputs do
+ %td
+ = f.input :name, :label => "Type"
+
+ .actions=f.submit "sauvegarder", :class => "btn btn-primary"
+
+- else
+ =f.inputs do
+ = f.input :name, :label => "Type", as: :select, collection: PSpecType.pluck(:name).uniq
diff --git a/app/views/admin/price_documents/_form.html.haml b/app/views/admin/price_documents/_form.html.haml
index fa414d2..60a7314 100644
--- a/app/views/admin/price_documents/_form.html.haml
+++ b/app/views/admin/price_documents/_form.html.haml
@@ -20,18 +20,27 @@
=hidden_field_tag :public_edit, params[:public_edit]
-
- = @price_document.price_line_block.block_type
+ %h3
+ = @price_document.price_line_block.block_type
-if @price_document.label == "Demande prix"
- =f.input :avancement, :label => "Avancement (%) :"
- =f.input :list_designaton, :label => "Désignation de la liste :"
- =f.input :end_date, :label => "Fin de consultation :", :as => :date
- =f.input :dp_comment, :label => "Commentaire demande de prix :"
- =f.input :acheteur_text, :label => "Envoyé à :"
-
+ .row
+ .col-4
+ .row
+ .col
+ =f.input :end_date, :label => "Fin de consultation :", :as => :date
+ .col
+ =f.input :avancement, :label => "Avancement (%) :", as: :select, collection: PriceDocument::AVANCEMENT, selected: PriceDocument::AVANCEMENT.first
+ =f.input :list_designaton, as: :string, :label => "Désignation de la liste :"
+ .col
+ =f.input :acheteur_text, :label => "Envoyé à :", input_html: {rows: 5}
+ .col
+ =f.input :dp_comment, :label => "Commentaire demande de prix :", input_html: {rows: 5}
+
+
+
-if @price_document.price_document_type_id == 6 or @price_document.price_document_type_id == 7
= f.input :date, :label => "Date du document :", :as => :date
.price_line_block_form
@@ -50,4 +59,4 @@
-
\ No newline at end of file
+
diff --git a/app/views/admin/price_documents/_form_p_fournisseur.html.haml b/app/views/admin/price_documents/_form_p_fournisseur.html.haml
new file mode 100644
index 0000000..a860e68
--- /dev/null
+++ b/app/views/admin/price_documents/_form_p_fournisseur.html.haml
@@ -0,0 +1,16 @@
+=semantic_form_for [:admin, @price_document], url: match_p_fournisseur_save_admin_price_document_path, :html => {:class => "qi_price_form"}, :remote => true do |f|
+ =diag do
+ =f.object.errors.messages
+
+ .content
+ %h1.mb-2 Rapprochemnet du fournisseur
+ .form-row
+ .col-md-6
+ = f.input :public_fournisseur_name, label: "Nom indiqué par le fournisseur :", :input_html => { :disabled => true, class: "mx-3" }
+ .form-row
+ .col-md-6
+ =f.semantic_fields_for :price_line_block do |form|
+ =form.input :p_fournisseur, as: :select, collection: PFournisseur.pluck(:name, :id), label: "Correspondance base fournisseurs :", :input_html => { class: "mx-3"}
+
+ .large_actions
+ .actions=f.submit "sauvegarder", :class => "btn btn-primary"
diff --git a/app/views/admin/price_documents/_price_document.html.haml b/app/views/admin/price_documents/_price_document.html.haml
index 77a3096..a18ec45 100644
--- a/app/views/admin/price_documents/_price_document.html.haml
+++ b/app/views/admin/price_documents/_price_document.html.haml
@@ -1,4 +1,9 @@
%tr#price_document_row{:id => price_document.id}
+ - if price_document.doc_ref_id.present?
+ - parent_doc = PriceDocument.find(price_document.doc_ref_id)
+ -else
+ - parent_doc = nil
+
-tr = {}
-tr[:p_payment_type] = capture do
@@ -17,7 +22,13 @@
-tr[:p_fournisseur] = capture do
%td
- = price_document.p_fournisseur.name if price_document.p_fournisseur
+ - if price_document.price_document_type.label == "Réponse fournisseur"
+ -if price_document.p_fournisseur.present?
+ = price_document.p_fournisseur.name
+ - else
+ =link_to ic('pencil') + " rapprocher le fournisseur", match_p_fournisseur_admin_price_document_path(price_document), remote: true
+ -else
+ = price_document.p_fournisseur.name if price_document.p_fournisseur
-tr[:com_counter] = capture do
%td
@@ -50,9 +61,52 @@
-if price_document.label == "Avoir"
=number_to_currency price_document.cc_to_paid_ttc
+ -tr[:f_token] = capture do
+ %td
+ = consult_admin_price_document_url(:id => price_document.f_token, :lang => nil)
+
+ -tr[:avancement] = capture do
+ %td
+ - if price_document.avancement
+ = price_document.avancement.to_s + " %"
+ - elsif parent_doc and parent_doc.avancement
+ = parent_doc.avancement.to_s + " %"
+
+ -tr[:list_designaton] = capture do
+ %td
+ -if price_document.list_designaton
+ = price_document.list_designaton
+ -elsif parent_doc
+ =parent_doc.list_designaton
+
+ -tr[:end_date] = capture do
+ %td
+ -if price_document.end_date
+ =price_document.end_date
+ -elsif parent_doc and parent_doc.end_date
+ =parent_doc.end_date
-
+
+ -tr[:dp_comment] = capture do
+ %td
+ -if price_document.dp_comment
+ = price_document.dp_comment
+ -elsif parent_doc
+ =parent_doc.dp_comment
+
+ -tr[:acheteur_text] = capture do
+ %td
+ -if price_document.acheteur_text
+ = price_document.acheteur_text
+ -elsif parent_doc
+ =parent_doc.acheteur_text
+
+ -tr[:customer_ref] = capture do
+ %td
+ -if price_document.price_line_block.present?
+ = price_document.price_line_block.customer_ref
+
-tr[:stock_ok] = capture do
%td
-if !price_document.imported
@@ -90,6 +144,8 @@
-tr[:actions] = capture do
%td.actions
+ -if price_document.price_document_type.label == "Demande prix"
+ =link_to i("bar-chart"), analyse_reponses_admin_price_document_path(price_document)
-if !price_document.imported
-if current_admin.has_permission?("payments")
-if !price_document.d_number?
@@ -130,7 +186,6 @@
=# link_to i(:eye), admin_price_document_path(price_document), :remote => true
-
= link_to i(:eye), admin_price_document_path(price_document.id), :remote => false
-if PriceLineBlock::PURCHASE_BLOCKS.include?(price_document.block_type)
=# link_to i(:eye), admin_price_document_path(price_document.id), :remote => false
@@ -145,6 +200,9 @@
= link_to i(:pencil), edit_admin_price_document_path(price_document)
= link_to i(:eye), admin_price_document_path(price_document.id), :remote => false, :target => "_blank"
+ -if price_document.cc_label == "Bon de réception achat"
+ %br
+ =link_to "Générer la facture", facture_achat_admin_price_document_path(price_document)
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_document}
-
\ No newline at end of file
+
diff --git a/app/views/admin/price_documents/_relicats.html.haml b/app/views/admin/price_documents/_relicats.html.haml
new file mode 100644
index 0000000..035846f
--- /dev/null
+++ b/app/views/admin/price_documents/_relicats.html.haml
@@ -0,0 +1,62 @@
+
+#bills
+
+ .qi_tab_header
+ %h3 Bons de réception associés
+ .right
+
+
+ -params[:search][:per_page] = params[:search][:per_page] || 50
+ -per_page = params[:search][:per_page]
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+ -@price_documents = PriceDocument.where(:bon_de_commande_achat_id => bca.id, :price_document_type_id => [5]).order("date DESC, created_at DESC")
+
+ -@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
+ -@all_price_documents = @price_documents
+ -@price_documents = @price_documents.page(page).per(per_page)
+
+ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents, :key => "projet-factures"}
+
+
+%h3 Etat des réceptions par articles
+
+- bca_price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id => bca.id)
+
+- bra_price_line_blocks = PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id => @all_price_documents.ids)
+
+%table.table.table-striped.table-hover.table-bordered.data_table
+ %thead
+ %tr
+ %th
+ Code produit
+ %th
+ Produit
+ %th Quantité commandée
+
+ %th Quantité réceptionnée
+
+ %th Différence
+ %tbody
+ - PriceLine.where(:price_line_block_id => (bca_price_line_blocks.ids + bra_price_line_blocks.ids)).map {|pl| pl.p_product_ref_id}.uniq.each do |p_product_ref_id|
+ -if p_product_ref = PProductRef.where(:id => p_product_ref_id).first
+ %tr
+ %td
+ =link_to [:admin, p_product_ref] do
+ =p_product_ref.ref
+ %td
+ =link_to [:admin, p_product_ref] do
+ =p_product_ref.cc_name
+
+ %td
+ =a = PriceLine.where(:p_product_ref_id => p_product_ref_id, :price_line_block_id => bca_price_line_blocks).sum(:qte)
+
+
+ %td
+ =b = PriceLine.where(:p_product_ref_id => p_product_ref_id, :price_line_block_id => bra_price_line_blocks).sum(:qte)
+
+ %td
+ = a -b
+
+
+
diff --git a/app/views/admin/price_documents/analyse_reponses.html.haml b/app/views/admin/price_documents/analyse_reponses.html.haml
new file mode 100644
index 0000000..8627aca
--- /dev/null
+++ b/app/views/admin/price_documents/analyse_reponses.html.haml
@@ -0,0 +1,321 @@
+.qi_header
+ %h1
+ Achats
+ %span
+ Analyse des réponces à la demande de prix n°
+ = link_to @price_document.d_number, admin_price_document_path(@price_document)
+ \-
+ = @price_document.list_designaton
+
+-unmatched_fournisseur = 0
+=semantic_form_for [:admin, @price_document],url: analyse_reponses_save_admin_price_document_path, method: :post, :html => {:class => "qi_price_form"}, :remote => false do |form|
+ =form.semantic_fields_for :price_line_block do |f|
+ - price_line_block = f.object
+ .qi_pannel.padding.new_table_container
+ .table-slider
+ .inner
+
+ .table-area{:style => "overflow:auto;"}
+ .table-area-inner
+ .freezeTable
+ %table.table.table-striped.table-hover.table-bordered.data_table
+ %thead.header
+ %tr
+ -nb_resp = @price_document_responses.count
+ %th{colspan: 12}
+ Consultation
+ %th{colspan: nb_resp}
+ Fournisseurs
+ .btn.btn-light.mx-4#reset-radio
+ reset
+ .legend.d-flex
+ légende :
+ .inlie-block.d-flex.flex-wrap.justify-content-end
+ .mx-2.red
+ = ic("diamond") + " Spot detecté !"
+ .mx-2.green
+ = ic("money") + " Meilleur prix"
+ .mx-2.red
+ = ic(:times) + " Alerte marge basse"
+ .mx-2.green
+ = ic(:check) + " Marge ok"
+ .mx-2.orange
+ = ic(:warning) + " Alerte Qté"
+ .mx-2.info
+ = ic('info-circle') + " Commentaire fournisseur"
+ %tr
+ %th
+ Qté à
+ %br
+ satisfaire
+ %th
+ Qté consultée
+ %th
+ Produit
+ %th
+ Référence
+ %th
+ Couleur
+ %th
+ Type
+ %br
+ chargeur
+ %th
+ Target hors
+ %br
+ Sorecop
+ %th
+ Px d'achat
+ %br
+ référence
+ %th
+ Marge
+ %br
+ théorique
+ %br
+ référence
+ %br
+ par zone
+ %th
+ Fours.
+ %br
+ de référence
+ %th
+ Date
+ %br
+ px référence
+ %th.limit
+ Spec
+
+ -@price_document_responses.each do |resp|
+ %th
+ -if resp.p_fournisseur
+ =resp.p_fournisseur.name
+ -else
+ -unmatched_fournisseur += 1
+ nom renseigné par le fournisseur :
+ %br
+ ="(#{resp.public_fournisseur_name})"
+ %br
+ =link_to ic('pencil') + " rapprocher le fournisseur", match_p_fournisseur_admin_price_document_path(resp), remote: true
+
+
+ %tbody
+ -# price_lines = f.object.price_lines
+ -price_lines_child_index = {}
+ -consult_price_lines = @price_document.price_line_block.price_lines
+ =f.semantic_fields_for :price_lines do |form|
+ - price_line = form.object
+ -#price_lines = @price_document.price_line_block.price_lines
+ -#price_lines.each do |price_line|
+ %tr
+ %td
+ =# ATTENTION ! On a plus accès direct aux commandes qui on engendré cette demande de prix. donc plus accès aux délais différent entre les différentes commades pour une ref donée
+ / ∑
+ / =price_line.qte.to_i
+ / %br
+ - if price_line.cc_wish_date.present? && price_line.cc_wish_date < Date.today + 20.days
+ %span.red
+ =ic(:fire)
+ =price_line.qte.to_i
+ - else
+ %span.darkblue
+ =ic(:hourglass)
+ =price_line.qte.to_i
+ %td.ref_tr
+ Qté en comm
+ %td
+ = price_line.p_product_ref.p_product.name
+ %td
+ =link_to [:admin, price_line.p_product_ref] do
+ = price_line.p_product_ref.ct_sub_name
+ = price_line.p_product_ref.p_product_color.name
+
+ %td
+ = price_line.p_product_ref.p_product_color.color if price_line.p_product_ref and price_line.p_product_ref.p_product_color
+ %td
+ = price_line.p_product_power.name if price_line.p_product_power
+ %td
+ / Target hors Sorecop
+ %td
+ / Px d'achat de référence
+ %td
+ / Marge théorique de référence par zone
+ %td
+ / Fournisseurs de référence
+ %td
+ / Date du px de référence
+ %td.limit
+ / spec
+
+ =#form.input :price_line_resp_ids, collection: PriceLine.where(:price_line_ref_id => form.object.id).all, as: :check_boxes , :member_label => :id
+
+ -#NICO : j'ai commenté l'input qu'on a fait ensemble, par contre, pour toute la suite, j'ai en fait fait un copié collé du rendu de cet inpu ou j'ai remis les champs dynamics en correspondance.
+
+
+ -#NICO : j'ai créé un hash plus haut, vide, qui va me permettre de faire correspondre à chaque ID de price_line leur index dans le nested form (qui est différent, une itération, de l'ID de l'élement... Là c'est la magie de rails.)
+ - price_lines_child_index[form.object.id.to_s] = form.options[:child_index]
+ -best_price = PriceLine.where(price_line_ref_id: price_line.id).where("ct_u_price_ht > 0").order(:ct_u_price_ht).ids
+ -#Nico : je commence, pour chaque price line, par faire une checkbox vide. J'aurais pu faire un checkbox tag mais par facilité j'ai copé l'HTML dans HTML2HAML et je suis partid du résultat. Les checkboxes sont ensuite dans ta boucle
+ %input{:autocomplete => "off", :id => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }]_price_line_resp_ids_none", :name => "price_document[price_line_block_attributes][price_lines_attributes][#{form.options[:child_index] }][price_line_resp_ids][]", :type => "hidden", :value => ""}/
+
+ =#{}"price doc id : #{@price_document_responses.ids}"
+
+ - @price_document_responses.each do |resp|
+ -line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first
+ -cell = []
+
+ - if line.qte_available.to_i > 0
+ - if line.id == best_price[0]
+ -cell << "#{ic(:money)} Meilleur prix"
+ - if line.qte_available >= price_line.qte.to_i
+ - cell << "Qté dispo : #{line.qte_available.to_i}"
+ - else
+ - cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})"
+ - cell << "PA: #{line.ct_u_price_ht} €"
+ - # mp = calcul de la marge prévisionelle TODO
+ - line.id.odd? ? mp = 0.17 : mp = 0.11
+ - if false
+ -if mp > 0.15
+ - cell << "#{ic(:check)} MP: #{mp * 100} %"
+ -else
+ - cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %"
+ -else
+ - cell << "pas dispo"
+ -if line.comment.present?
+ - display_comment = ""
+ - if line.comment.length > 10
+ - display_comment = "#{line.comment[0..10]} (..)"
+ - else
+ - display_comment = line.comment
+ - cell << "#{ic('info-circle')} #{display_comment}#{line.comment}"
+
+ %td.p-0{class: ("best-price" if line.id == best_price[0])}
+ =# "reponse price_line ID : #{line.id}"
+ =# "price line origine : #{line.price_line_ref_id}" #NICO : simple contrôle, je récupère facilement par là l'ID de la price Line concernée.
+
+ -#NICO : si on a un price_line_ref_id, j'ajoute la case à cocher. Je récupère l'index de nested form dans mon hash, et je passe en value le line.id
+ -if line.price_line_ref_id.to_s != ""
+ %input.seletable_price{:id => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}" , :autocomplete => "off", :checked => ("checked" if PriceLine.find(line.price_line_ref_id).price_line_resp_ids.include?(line.id) ), :name => "price_document[price_line_block_attributes][price_lines_attributes][#{price_lines_child_index[line.price_line_ref_id.to_s]}][price_line_resp_ids][]", :type => "checkbox", :value => line.id}>/
+ %label.p-2.m-auto{:for => "price_document_price_line_block_attributes_price_lines_attributes_#{price_lines_child_index[line.price_line_ref_id.to_s]}_price_line_resp_ids_#{line.id}"}
+ =sanitize(cell.join('
'))
+
+
+ =# radio_button_tag "ref_price_selected_#{price_line.p_product_ref.id}", line.id, false, class: "seletable_price"
+ =# label_tag "ref_price_selected_#{price_line.p_product_ref.id}_#{line.id}", sanitize(cell.join('
')), class: "p-2 m-auto"
+
+ - if unmatched_fournisseur == 0
+ =submit_tag 'valider la selection', class: "btn btn-primary ml-4"
+ - else
+ %button.btn.btn-primary.ml-4{"type" => "button", "data-toggle" => "modal", "data-target" => "#unmatched-fournisseur"}
+ Valider la selection
+ .modal.fade#unmatched-fournisseur{"tab-index" => "-1", "role" => "dialog", "aria-labelledby" => "Raprochement Fournisseur", "aria-hidden" => "true"}
+ .modal-dialog{role: "dialog"}
+ .modal-content
+ .modal-header
+ %h5.modal-title
+ Rapprochement du fournisseur
+ %button.close{"data-dismiss" => "modal", "aria-label" => "Close"}
+ %span{"aria-hidden" => "true"}
+ ×
+ .modal-body
+ Il reste des fournisseurs à prapprocher avant de pouvoir valider.
+ .modal-footer
+ %button.btn.btn-light{"data-dismiss" => "modal"}
+ Close
+- if PriceDocument.where(doc_ref_id: @price_document, price_document_type: PriceDocumentType.find_by_label("Consultation fournisseur")).empty?
+ =link_to "Generer les consultations", generate_final_consult_admin_price_document_path, class: "btn btn-primary ml-4 mt-4"
+
+=link_to "Acceder aux consultations", admin_price_document_path(@price_document, anchor: "consult"), class: "btn btn-primary ml-4 mt-4"
+
+
+
+
+
+
+
+
+
+:scss
+ .seletable_price {
+ position: absolute;
+ transform: scale(0);
+ }
+
+ .seletable_price + label {
+ display: block;
+ min-height: 105px;
+ cursor: pointer;
+ box-sizing: border-box;
+ width: 100%;
+ text-align: left;
+
+ &:hover{
+ background:linear-gradient(to top, #efefef 5%, #fdfdfd 100%);
+ background-color:#5cb811;
+ }
+ &:active{
+ position:relative;
+ top:1px;
+ }
+ }
+
+ .seletable_priceOLD:checked + label {
+ background-color: green !important;
+ border-radius: 1em;
+ border: darkgreen solid 0.2em;
+ mix-blend-mode: difference;
+ }
+ .seletable_price:checked + label{
+ box-shadow:inset 0px 1px 0px 0px #caefab;
+ background:linear-gradient(to bottom, #77d42a 5%, #5cb811 100%);
+ background-color:#77d42a;
+ border-radius:6px;
+ border:1px solid #268a16;
+ display:inline-block;
+ cursor:pointer;
+ color:#306108;
+ font-family:Arial;
+ font-size:15px;
+ font-weight:bold;
+ padding:6px 24px;
+ text-decoration:none;
+ text-shadow:0px 1px 0px #aade7c;
+
+ &:hover{
+ background:linear-gradient(to bottom, #5cb811 5%, #77d42a 100%);
+ background-color:#5cb811;
+ }
+ }
+
+ .best-price{
+ background-color: #b4f99e !important;
+ }
+
+ .limit {
+ border-right:3px solid green !important;
+ }
+
+ .red {
+ color: red;
+ }
+ .green {
+ color: green;
+ }
+ .orange {
+ color: orange;
+ }
+
+
+ .darkblue {
+ color: darkblue;
+ }
+
+ .small-input {
+ max-width: 100px;
+ }
+
+:javascript
+ $( "#reset-radio" ).click(function(event){
+ $('input:checkbox').prop('checked',false);
+ })
diff --git a/app/views/admin/price_documents/consult.html.haml b/app/views/admin/price_documents/consult.html.haml
index bc946db..840b8fd 100644
--- a/app/views/admin/price_documents/consult.html.haml
+++ b/app/views/admin/price_documents/consult.html.haml
@@ -1,15 +1,24 @@
-.qi_header
+-if current_admin
+ .qi_header
- %h1
- Consultation fournisseur
- %span
- =@demande.list_designaton
+ %h1
+ Consultation fournisseur
+ %span
+ =@demande.list_designaton
.qi_row
- =semantic_form_for [:admin, @price_document], :html => {:class => "qi_price_form"}, :remote => false do |f|
+ %p{:style => "text-align:center;font-size:1.2em;"}
+ Vous allez pouvoir répondre à une demande de cotation envoyée par Arcom.
+ %p{:style => "text-align:center;font-size:1.2em;"}
+ Pour cela, merci de nous indiquer pour quelle société vous répondez à notre demande de chiffrage.
+
+
+
+
+ =semantic_form_for [:admin, @price_document], :url => consult_create_admin_price_documents_path(), :html => {:class => "qi_price_form"}, :remote => false do |f|
-@p_customer = @price_document.p_customer
=diag do
=f.object.errors.messages
@@ -21,28 +30,32 @@
=f.hidden_field :doc_ref_id
=f.hidden_field :price_document_type_id
-
- = f.input :public_fournisseur_name, :label => "Nom entreprise"
-
- =hidden_field_tag :public_edit, params[:public_edit]
-
- = @price_document.price_line_block.block_type
-
-
- .price_line_block_form
- =f.semantic_fields_for :price_line_block do |f|
- =render :partial => "admin/price_line_blocks/form_#{f.object.block_type_slug}", :locals => {:f => f}
-
-
-
-
+ %center
+ .small-container
+ = f.input :public_fournisseur_name, :label => "Nom de votre société :"
- .large_actions
- .actions=f.submit "sauvegarder", :class => "btn btn-primary"
+
+ %p{:style => "text-align:center;font-size:1.2em;"}
+ Vous pouvez également indiquer votre référence interne :
+
+
+ =hidden_field_tag :public_edit, params[:public_edit]
+
+
+ .price_line_block_form
+ =f.semantic_fields_for :price_line_block do |f|
+ %center=render :partial => "admin/price_line_blocks/form_#{f.object.block_type_slug}", :locals => {:f => f}
+
+
+ %center
+ =f.submit "sauvegarder", :class => "btn btn-primary"
-
+:scss
+ .small-container{
+ max-width: 500px;
+ }
-
\ No newline at end of file
+
diff --git a/app/views/admin/price_documents/consult_edit.html.haml b/app/views/admin/price_documents/consult_edit.html.haml
new file mode 100644
index 0000000..a031c76
--- /dev/null
+++ b/app/views/admin/price_documents/consult_edit.html.haml
@@ -0,0 +1,38 @@
+
+.qi_row
+ .qi_pannel.padding
+
+ %table.table.table-striped
+ %tr
+ %td
+ Numéro réponse
+
+ %td
+ =@price_document.d_number
+ %tr
+ %td
+ Nom fournisseur saisi
+ %td
+ =@price_document.public_fournisseur_name
+
+
+
+-params[:search][:per_page] = params[:search][:per_page] || 5000
+-per_page = params[:search][:per_page]
+-page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+-@price_lines = @price_document.price_line_block.price_lines
+
+
+
+
+-@price_lines = sort_by_sorting(@price_lines, "created_at DESC")
+-@price_lines = @price_lines.page(page).per(per_page)
+%br
+
+
+
+.clear
+=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_lines, :key => "reponses-prix-show"}
+
+
diff --git a/app/views/admin/price_documents/index.html.haml b/app/views/admin/price_documents/index.html.haml
index 18a695a..014b9eb 100644
--- a/app/views/admin/price_documents/index.html.haml
+++ b/app/views/admin/price_documents/index.html.haml
@@ -13,7 +13,7 @@
-else
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary bgbd-ventes"
%h1
- Documents comptables
+ Documents
%span
Liste
@@ -33,50 +33,50 @@
%table.qi_search_row_top
- %tr
+ %tr.form-inline
%td
Début
- %td
- .input-group
- =text_field_tag :start, params[:start],:class => "form-control datepicker", :placeholder => "Début"
- %span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
+ %td.input-group
+ =text_field_tag :start, params[:start],:class => "form-control datepicker", :placeholder => "Début"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
-
- %br
- -if @start and @stop
-
- =link_to "< Mois précédent",request.query_parameters.merge({start: ((@start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-default"
-
-
- %td
+ %td.pl-4
Fin
- %td
- .input-group
- =text_field_tag :stop, params[:stop],:class => "form-control datepicker", :placeholder => "Fin"
- %span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
+ %td.input-group
+ =text_field_tag :stop, params[:stop],:class => "form-control datepicker", :placeholder => "Fin"
+ .input-group-append
+ %span.input-group-text{:onclick => "$(this).prev('input').val('');"}
=ic(:times)
- %br
+
+ %tr.form-inline
+ %td.right.ml-auto
-if @start and @stop
- =link_to "Mois suivant >",request.query_parameters.merge({start: ((@start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-default"
-
-
+
+ =link_to "< Mois précédent",request.query_parameters.merge({start: ((@start - 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop - 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+ %td.mr-auto
+ -if @start and @stop
+ =link_to "Mois suivant >",request.query_parameters.merge({start: ((@start + 1.month).beginning_of_month.strftime('%d/%m/%Y')), stop: ((@stop + 1.month).end_of_month.strftime('%d/%m/%Y'))}), :class => "btn btn-tertiary"
+
+
-params[:price_document_type_ids] = params[:price_document_type_ids] || []
+ %tr.form-inline
%td
Type de document :
%td
-
- -if [6,7].include?(params[:price_document_type_id].to_i)or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7")))
+
+ -if [3,4,5,6,7,9,10].include?(params[:price_document_type_id].to_i)or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7")))
-PriceDocumentType.where(:label => PriceDocument::PURCHASES, :enabled => true).order("id DESC").each do |pdt|
- %p
- = check_box_tag :"price_document_type_ids[]", pdt.id, (true if params[:price_document_type_ids].include?(pdt.id.to_s)), {:id => "price_document_type_ids_#{pdt.id}"}
- = label_tag "price_document_type_ids_"+pdt.id.to_s, pdt.label
+ %p.d-inline-flex.ml-3
+ = check_box_tag :"price_document_type_ids[]", pdt.id, (true if params[:price_document_type_ids].include?(pdt.id.to_s)), {:id => "price_document_type_ids_#{pdt.id}", class: "my-auto"}
+ = label_tag "price_document_type_ids_"+pdt.id.to_s, pdt.label, class: "ml-3 my-auto"
-else
-PriceDocumentType.where(:label => PriceDocument::SALES, :enabled => true).order("id DESC").each do |pdt|
- %p
+ %p.d-inline-flex
= check_box_tag :"price_document_type_ids[]", pdt.id, (true if params[:price_document_type_ids].include?(pdt.id.to_s)), {:id => "price_document_type_ids_#{pdt.id}"}
- = label_tag "price_document_type_ids_"+pdt.id.to_s, pdt.label
-
+ = label_tag "price_document_type_ids_"+pdt.id.to_s, pdt.label, class: "ml-3"
+ %br
%table
%tr
%td
@@ -95,18 +95,19 @@
Commercial :
=select_tag "search[p_commercial_id]", options_for_select([["",""],["Aucun","null"]]+PCommercial.order(:name).all.map{|a| [a.member_label, a.id]}, params[:search][:p_commercial_id])
- %td
- Type de paiement :
- =select_tag "search[p_payment_type_id]", options_for_select([["",""]]+PPaymentType.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_payment_type_id])
+ -if [6].include?(params[:price_document_type_id].to_i)
+ %td
+ Type de paiement :
+ =select_tag "search[p_payment_type_id]", options_for_select([["",""]]+PPaymentType.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_payment_type_id])
- %td
- Soldé ?
- =select_tag "search[cc_solded]", options_for_select([[""], "Oui", "Non"], params[:search][:cc_solded])
-
- %td
- Importé ?
- =select_tag "search[imported]", options_for_select([[""], "Oui", "Non"], params[:search][:imported])
+ %td
+ Soldé ?
+ =select_tag "search[cc_solded]", options_for_select([[""], "Oui", "Non"], params[:search][:cc_solded])
+
+ %td
+ Importé ?
+ =select_tag "search[imported]", options_for_select([[""], "Oui", "Non"], params[:search][:imported])
%table
%tr
@@ -155,4 +156,4 @@
}
-
\ No newline at end of file
+
diff --git a/app/views/admin/price_documents/match_p_fournisseur.html.haml b/app/views/admin/price_documents/match_p_fournisseur.html.haml
new file mode 100644
index 0000000..ee81044
--- /dev/null
+++ b/app/views/admin/price_documents/match_p_fournisseur.html.haml
@@ -0,0 +1 @@
+.qi_row=render :partial => "form_p_fournisseur"
diff --git a/app/views/admin/price_documents/match_p_fournisseur.js.erb b/app/views/admin/price_documents/match_p_fournisseur.js.erb
new file mode 100644
index 0000000..aca251b
--- /dev/null
+++ b/app/views/admin/price_documents/match_p_fournisseur.js.erb
@@ -0,0 +1 @@
+show_pane_hover("<%= escape_javascript(render(:partial => "form_p_fournisseur"))%>",700,900);
diff --git a/app/views/admin/price_documents/match_p_fournisseur_save.js.erb b/app/views/admin/price_documents/match_p_fournisseur_save.js.erb
new file mode 100644
index 0000000..0d5cc58
--- /dev/null
+++ b/app/views/admin/price_documents/match_p_fournisseur_save.js.erb
@@ -0,0 +1,2 @@
+location.reload();
+close_pane_hover();
diff --git a/app/views/admin/price_documents/new.html.haml b/app/views/admin/price_documents/new.html.haml
index 995cf0e..c9c0084 100644
--- a/app/views/admin/price_documents/new.html.haml
+++ b/app/views/admin/price_documents/new.html.haml
@@ -1,10 +1,10 @@
.qi_header
%h1
- Documents comptables
+ Documents
%span
Ajouter un document
-.qi_row=render :partial => "form"
\ No newline at end of file
+.qi_row=render :partial => "form"
diff --git a/app/views/admin/price_documents/show.html.haml b/app/views/admin/price_documents/show.html.haml
index 6dc2903..1f7bc6a 100644
--- a/app/views/admin/price_documents/show.html.haml
+++ b/app/views/admin/price_documents/show.html.haml
@@ -1,104 +1,110 @@
.qi_header
- .right
-
+ .right
+ -if @price_document.price_document_type_id == 1
+ =link_to ic("bar-chart")+" analyse des réponses", analyse_reponses_admin_price_document_path(@price_document), class: "btn btn-primary"
+
-if @price_document.price_document_type_id == 6 and !@price_document.stock_ok
= link_to i(:pencil), edit_admin_price_document_path(:id => @price_document.id, :public_edit => true) if !@price_document.stock_ok
-
-
+
+
= diag do
= link_to i(:pencil), edit_admin_price_document_path(@price_document)
= link_to i(:eye), admin_price_document_path(@price_document.id), :remote => false, :target => "_blank"
-
+
= link_to i(:download), print_admin_price_document_path(@price_document.token), :remote => false, :target => "_blank" if !PriceLineBlock::PURCHASE_BLOCKS.include?(@price_document.block_type)
-
+
%h1
Documents
-
+
%span
=@price_document.price_document_type.label
-
+
%span
="##{@price_document.id}"
%span
=@price_document.d_number
-
-
--if @price_document.label == "Réponse fournisseur"
- .qi_row
- .qi_pannel.padding
-
- %table.table.table-striped
- %tr
- %td
- Nom fournisseur saisi
- %td
- =@price_document.public_fournisseur_name
- %tr
- %td
- Fournisseur
- %td
- =link_to @price_document.p_fournisseur.name, [:admin, @price_document.p_fournisseur] if @price_document.p_fournisseur
-
--if @price_document.label == "Demande prix"
- .qi_row
- .qi_pannel.padding
-
- %table.table.table-striped
- %tr
- %td
- Avancement (%)
- %td
- =@price_document.avancement
- %tr
- %td
- Désignation
- %td
- =@price_document.list_designaton
-
- %tr
- %td Date de fin de consultation :
- %td
- =l @price_document.end_date if @price_document.end_date
-
- %tr
- %td Commentaire
- %td
- =simple_format @price_document.dp_comment
-
- %tr
- %td
- Envoyé à
- %td
- =simple_format @price_document.acheteur_text
-
- %tr
- %td
- Lien pour consultation
- %td
- =link_to consult_admin_price_document_path(:id => @price_document.f_token, :lang => nil), consult_admin_price_document_path(:id => @price_document.f_token, :lang => nil)
-
+.qi_row
+
+ %table.table.table-striped
+ -if @price_document.label == "Réponse fournisseur"
+
+ %tr
+ %td
+ Nom fournisseur saisi
+ %td
+ =@price_document.public_fournisseur_name
+
+ -if @price_document.p_fournisseur
+ %tr
+ %td
+ Fournisseur
+ %td
+ =link_to @price_document.p_fournisseur.name, [:admin, @price_document.p_fournisseur] if @price_document.p_fournisseur
+
+ -if @price_document.d_number?
+ %tr
+ %td Numéro
+ %td=@price_document.d_number
+ %tr
+ %td Date
+ %td=l @price_document.date, :format => :date
+
+ -if @price_document.label == "Demande prix"
+ %tr
+ %td
+ Avancement (%)
+ %td
+ =@price_document.avancement.to_s + " %"
+ %tr
+ %td
+ Désignation
+ %td
+ =@price_document.list_designaton
+
+ %tr
+ %td Date de fin de consultation :
+ %td
+ =l @price_document.end_date if @price_document.end_date
+
+ %tr
+ %td Commentaire
+ %td
+ =simple_format @price_document.dp_comment
+
+ %tr
+ %td
+ Envoyé à
+ %td
+ =simple_format @price_document.acheteur_text
+
+ %tr
+ %td
+ Lien pour consultation
+ %td
+ =link_to consult_admin_price_document_url(:id => @price_document.f_token, :lang => nil), consult_admin_price_document_url(:id => @price_document.f_token, :lang => nil)
+
.qi_row
.qi_pannel.qi_plain.padding
-if false
=debug @price_document
-
-
-
- -if false
-
+
+
+
+ -if true
+
-price_line_block = @price_document.price_line_block
-
-
- =render price_line_block
-
+
+
+ =#render price_line_block
+
-else
-params[:search][:per_page] = params[:search][:per_page] || 5000
-per_page = params[:search][:per_page]
- -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
-@price_lines = @price_document.price_line_block.price_lines
@@ -111,85 +117,96 @@
- .clear
+ .clear
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_lines, :key => "reponses-prix-show"}
-
-
-
+
+
+
-if @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
-
-
+
-if current_admin and current_admin.id == 1
- %table.table
- %tr
- %th Archivé ?
- %td
- = diag do
- -if @price_document.archived
- Oui
- =link_to "Désarchiver", unarchive_now_admin_price_document_path(@price_document.id)
- -else
- =link_to "Archiver", archive_now_admin_price_document_path(@price_document.id)
- %tr
- %th Id bloc
- %td=price_line_block.id
-
-
- %tr
- %th Cout block
- %td=price_line_block.cc_cost_ht
-
-
- -params[:search][:per_page] = params[:search][:per_page] || 5000
- -per_page = params[:search][:per_page]
- -page = (params[:page] and params[:page] != "") ? params[:page] : 1
-
- -@stat_lines = @price_document.stat_lines.order("date DESC, created_at DESC")
- -@stat_lines = sort_by_sorting(@stat_lines, "created_at DESC")
- -@stat_lines = @stat_lines.page(page).per(per_page)
- %br
-
-
- =link_to "Générer les stats", generate_stat_lines_admin_price_document_path(@price_document), :class => "btn btn-primary"
-
- %table.table
- %tr
- %th
- HT
- %td
- =number_to_currency @stat_lines.sum(:tot_amount_ht)
-
- %tr
- %th
- TTC
- %td
- =number_to_currency @stat_lines.sum(:tot_amount_ttc)
-
-
- %tr
- %th
- Coût HT
- %td
- =number_to_currency @stat_lines.sum(:cost_ht)
-
+ -enable_stat = false
+ -if enable_stat
+ %table.table
+ %tr
+ %th Archivé ?
+ %td
+ = diag do
+ -if @price_document.archived
+ Oui
+ =link_to "Désarchiver", unarchive_now_admin_price_document_path(@price_document.id)
+ -else
+ =link_to "Archiver", archive_now_admin_price_document_path(@price_document.id)
+ %tr
+ %th Id bloc
+ %td=price_line_block.id
- .clear
- =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @stat_lines}
-
-
-
-
-
-
-
-
+ %tr
+ %th Cout block
+ %td=price_line_block.cc_cost_ht
+
+
+ -params[:search][:per_page] = params[:search][:per_page] || 5000
+ -per_page = params[:search][:per_page]
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+ -@stat_lines = @price_document.stat_lines.order("date DESC, created_at DESC")
+ -@stat_lines = sort_by_sorting(@stat_lines, "created_at DESC")
+ -@stat_lines = @stat_lines.page(page).per(per_page)
+ %br
+
+
+ =link_to "Générer les stats", generate_stat_lines_admin_price_document_path(@price_document), :class => "btn btn-primary"
+
+ %table.table
+ %tr
+ %th
+ HT
+ %td
+ =number_to_currency @stat_lines.sum(:tot_amount_ht)
+
+ %tr
+ %th
+ TTC
+ %td
+ =number_to_currency @stat_lines.sum(:tot_amount_ttc)
+
+
+ %tr
+ %th
+ Coût HT
+ %td
+ =number_to_currency @stat_lines.sum(:cost_ht)
+
+
+
+ .clear
+ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @stat_lines}
+
+
+
+
+
+
+
+ %h3 Lignes de produits
+ .mb-3
+ - if @price_document.cc_label == "Consultation fournisseur"
+ = link_to ic(:clipboard) + " Copier le texte", "#", class: "btn btn-primary", "data-document" => @price_document.id, onclick: 'copyPriceLines(event)'
+ - existing_order = PriceDocument.where(doc_ref_id: @price_document.id, cc_label: "Commande achat")
+
+ - if existing_order.present?
+ = link_to ic(:eye) + " Afficher la commande", admin_price_document_path(existing_order.first), class: "btn btn-tertiary"
+ - else
+ = link_to "Generer la commande", buy_order_create_admin_price_document_path(@price_document), class: "btn btn-primary"
+
%table.table
%thead
%tr
%th
%th Référence
- %th Produit
+ %th Marque
%th Désignation
%th Qté
%th P.U. HT
@@ -203,132 +220,151 @@
="##{price_line.id}"
%td
=price_line.ref
-
-
+
+
+
%td
- =link_to price_line.p_product_ref.p_product.name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product
-
-
- %td
- =price_line.title
-
- %td.numeraire
+ =price_line.p_product_ref.p_product.s_brand.name
+
+ %td{class: "p_product_ref_cc_name_#{@price_document.id}"}
+ =link_to price_line.p_product_ref.cc_name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product
+
+ %td.numeraire{class: "price_line_qte_#{@price_document.id}"}
=price_line.qte
-
- %td.numeraire
+
+ %td.numeraire{class: "price_line_price_u_ht_#{@price_document.id}"}
=number_to_currency price_line.price_u_ht
-
-
+
+
%td.numeraire
=price_line.tva_account_value.to_s+"%"
-
-
-
-
+
+
+
+
%td.numeraire
=number_to_currency price_line.tot_amount_ht
-
- %td
- = price_line.line_stocks.sum(:price_ht)
-
- -if current_admin.has_permission?("show-costs")
+
+ / %td=# price_line.line_stocks.sum(:price_ht)
+
+.qi_row
+ -if current_admin.has_permission?("show-costs")
+ %p
+ -if @price_document.price_document_type_id == 6
+ =link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok
+ -elsif @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
+ %p
+ Coût :
+ =number_to_currency @price_document.cost_ht
+ %p
+ Marge :
+ =number_to_currency @price_document.marge_ht
+
+ -if !@price_document.cost_ok
+ =#link_to "Mettre à jour les stocks, calculer la marge", update_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary"
+ -if @price_document.d_number
+ -if @price_document.cc_label == "Commande achat"
+ %p=link_to "Générer un bon de réception", bon_de_reception_admin_price_document_path(@price_document), :class => "btn btn-primary"
+ %p=link_to "Générer la facture", facture_achat_admin_price_document_path(@price_document), :class => "btn btn-primary"
+
+ -if @facture_achat_childrens.present?
+ %h3 Facture Achat
+ -params[:search][:per_page] = params[:search][:per_page] || 5000
+ -per_page = params[:search][:per_page]
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+ -@facture_achat_childrens = @facture_achat_childrens.order("date DESC, created_at DESC")
+
+
+ -#@line_stocks = sort_by_sorting(@line_stocks, "created_at DESC")
+ -@facture_achat_childrens = @facture_achat_childrens.page(page).per(per_page)
%br
- %br
- %p
- -if @price_document.price_document_type_id == 6
- =link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok
- -elsif @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
- %p
- Coût :
- =number_to_currency @price_document.cost_ht
- %p
- Marge :
- =number_to_currency @price_document.marge_ht
-
- -if !@price_document.cost_ok
- =link_to "Mettre à jour les stocks, calculer la marge", update_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary"
-
- -if false
-
- -if @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5 and !@price_document.cost_ok
- %table.table.table-striped.table-hover.table-bordered
- %thead
- %tr
- %th Produit
- %th Quantité dans cette pièce comptable
- %th Quantité restante
- %th
- -@price_document.price_line_block.price_lines.all.each do |pl|
- -if pl.p_product_ref
-
- -if pl.p_product_ref.assembled
- -pl.p_product_ref.p_product_assembleds.all.each do |ppa|
- %tr
- %td
- =ppa.p_product_ref.cc_name
- %td
- =@a = (pl.qte.to_f * ppa.qte.to_f).to_f
-
- %td
- =link_to admin_line_stocks_path(:p_product_ref_id => ppa.p_product_ref.id) do
- =@b = LineStock.where(:p_product_ref_id => ppa.p_product_ref_id).sum(:qte_available).to_f
-
- %td
- -if @a > @b
- .red=ic :warning
-
- -else
+ .clear
+
+ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @facture_achat_childrens}
+
+ -if @price_document.cc_label == "Commande achat"
+ =render :partial => "admin/price_documents/relicats", :locals => {:bca => @price_document}
+ -if false
+
+ -if @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5 and !@price_document.cost_ok
+ %table.table.table-striped.table-hover.table-bordered
+ %thead
+ %tr
+ %th Produit
+ %th Quantité dans cette pièce comptable
+ %th Quantité restante
+ %th
+ -@price_document.price_line_block.price_lines.all.each do |pl|
+ -if pl.p_product_ref
+
+ -if pl.p_product_ref.assembled
+ -pl.p_product_ref.p_product_assembleds.all.each do |ppa|
%tr
%td
- =pl.p_product_ref.cc_name
+ =ppa.p_product_ref.cc_name
%td
- =@a = pl.qte.to_f
-
+ =@a = (pl.qte.to_f * ppa.qte.to_f).to_f
+
%td
- =link_to admin_line_stocks_path(:p_product_ref_id => pl.p_product_ref.id) do
- =@b = LineStock.where(:p_product_ref_id => pl.p_product_ref_id).sum(:qte_available).to_f
-
+ =link_to admin_line_stocks_path(:p_product_ref_id => ppa.p_product_ref.id) do
+ =@b = LineStock.where(:p_product_ref_id => ppa.p_product_ref_id).sum(:qte_available).to_f
+
%td
- -if pl.p_product_ref.stocked and @a > @b
+ -if @a > @b
.red=ic :warning
-
-
-
-
- -if @price_document.price_document_type_id == 6 or @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
+
+ -else
+ %tr
+ %td
+ =pl.p_product_ref.cc_name
+ %td
+ =@a = pl.qte.to_f
+
+ %td
+ =link_to admin_line_stocks_path(:p_product_ref_id => pl.p_product_ref.id) do
+ =@b = LineStock.where(:p_product_ref_id => pl.p_product_ref_id).sum(:qte_available).to_f
+
+ %td
+ -if pl.p_product_ref.stocked and @a > @b
+ .red=ic :warning
+
+
+
+ -if @price_document.price_document_type_id == 6 or @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
+ -if @price_document.price_line_block.stock_ok
%h3 Stocks générés
#bills
-params[:search][:per_page] = params[:search][:per_page] || 5000
-per_page = params[:search][:per_page]
- -page = (params[:page] and params[:page] != "") ? params[:page] : 1
-
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
-@line_stocks = @price_document.line_stocks.order("date DESC, created_at DESC")
-if params[:price_document_ids]
-@line_stocks = @line_stocks.where(:id => params[:price_document_ids])
-
+
-@line_stocks = sort_by_sorting(@line_stocks, "created_at DESC")
-@line_stocks = @line_stocks.page(page).per(per_page)
%br
-
- .clear
+
+ .clear
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @line_stocks}
-
+
-if @price_document.label == "Demande prix"
-
- %h3 Réponses fournisseur
+ %h3.ml-2 Réponses fournisseur
#bills
-params[:search][:per_page] = params[:search][:per_page] || 5000
-per_page = params[:search][:per_page]
- -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+ -@price_documents = PriceDocument.where(:doc_ref_id => @price_document.id, :price_document_type_id => PriceDocumentType.find_by_label("Réponse fournisseur").id)
+
- -@price_documents = PriceDocument.where(:doc_ref_id => @price_document.id )
-
-
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
@@ -337,6 +373,106 @@
- .clear
+ .clear
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents, :key => "reponses-prix-show"}
-
+
+ -@price_documents = PriceDocument.where(:doc_ref_id => @price_document.id, :price_document_type_id => PriceDocumentType.find_by_label("Consultation fournisseur").id)
+
+ %h3.ml-2 Consultations fournisseur :
+ #consult
+
+ -if @price_documents.empty?
+ .qi_pannel.qi_plain.padding
+ Pas de consultation générée.
+ %br
+ Vous devez d'abord Selectionner les prix sur le page d'analyse :
+ =link_to ic("bar-chart")+" analyse des réponses", analyse_reponses_admin_price_document_path(@price_document), class: "btn btn-primary"
+ puis Generer les consultations
+
+ -@price_documents.each do |price_document_consult|
+
+ - if price_document_consult.p_fournisseur
+ %h4.ml-2= price_document_consult.p_fournisseur.name
+ - else
+ %h4.ml-2=link_to ic('pencil') + " rapprocher le fournisseur", match_p_fournisseur_admin_price_document_path(price_document_consult), remote: true
+
+
+ = semantic_form_for [:admin, price_document_consult], :html => {:class => "qi_price_form"}, :remote => false do |form|
+ = form.button "Valider modifications", type: :submit, class: "btn btn-primary m-2"
+ = link_to ic(:clipboard) + " Copier le texte", "#", class: "btn btn-primary", "data-document" => price_document_consult.id, onclick: 'copyPriceLines(event)'
+ - existing_order = PriceDocument.where(doc_ref_id: price_document_consult.id, cc_label: "Commande achat")
+ - if existing_order.present?
+ = link_to ic(:eye) + " Afficher la commande", admin_price_document_path(existing_order.first), class: "btn btn-tertiary"
+ - else
+ = link_to "Generer la commande", buy_order_create_admin_price_document_path(price_document_consult), class: "btn btn-primary"
+
+
+ .price-lines{"data-document" => price_document_consult.id}
+ =form.semantic_fields_for :price_line_block do |f|
+ .mx-2
+ =f.semantic_fields_for :price_lines do |form|
+ =render partial: "admin/price_lines/form_consult", locals: {form: form}
+
+ -params[:search][:per_page] = params[:search][:per_page] || 5000
+ -per_page = params[:search][:per_page]
+ -page = (params[:page] and params[:page] != "") ? params[:page] : 1
+
+ -@price_documents = PriceDocument.where(:doc_ref_id => @price_document.id, :price_document_type_id => PriceDocumentType.find_by_label("Consultation fournisseur").id)
+
+
+
+
+ -@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
+ -@price_documents = @price_documents.page(page).per(per_page)
+ %br
+
+
+ %h4.ml-2 Liste des consultations fournisseurs
+ .clear
+ =render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents, :key => "reponses-prix-show"}
+
+
+
+
+:javascript
+ const copyPriceLines = (event) => {
+ event.preventDefault()
+ let priceDocumentId = event.target.dataset.document
+ let names = $(`.p_product_ref_cc_name_${priceDocumentId}`)
+ let qtes_input = $(`.input_price_line_qte_${priceDocumentId}`)
+ let qtes = $(`.price_line_qte_${priceDocumentId}`)
+ let prices = $(`.price_line_price_u_ht_${priceDocumentId}`)
+ let table = []
+ names.each(function( i ) {
+ let row = []
+ if(qtes_input.length > 0) {
+ row.push(qtes_input[i].valueAsNumber)
+ }else{
+ row.push(qtes[i].innerText.slice(0, -2))
+ }
+ row.push(" X ")
+ row.push(names[i].innerText)
+ row.push(" @ ")
+ row.push(prices[i].innerText)
+ table.push(row.join(' '))
+ })
+ copyStringToClipboard(table.join('\r\n'))
+ }
+
+ function copyStringToClipboard (str) {
+ // Create new element
+ var el = document.createElement('textarea');
+ // Set value (string to be copied)
+ el.value = str;
+ // Set non-editable to avoid focus and move outside of view
+ el.setAttribute('readonly', '');
+ el.style = {position: 'absolute', left: '-9999px'};
+ document.body.appendChild(el);
+ // Select text inside element
+ el.select();
+ // Copy text to clipboard
+ document.execCommand('copy');
+ // Remove temporary element
+ document.body.removeChild(el);
+ }
+
diff --git a/app/views/admin/price_line_blocks/_form.html.haml b/app/views/admin/price_line_blocks/_form.html.haml
index e945168..f01c327 100644
--- a/app/views/admin/price_line_blocks/_form.html.haml
+++ b/app/views/admin/price_line_blocks/_form.html.haml
@@ -1,104 +1,109 @@
-.qi_row
- =f.inputs do
+=f.inputs do
+ :javascript
+ var p_product_refs_url = "#{admin_p_product_refs_path(:manager => true)}"
+
+ -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
+
+ = f.hidden_field :p_customer_id, :class => "p_customer_id"
+ =content_for :particular do
+ .row
+ .p_customer_sheet_customer.col-12.mb-4
- -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
- .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
-
- = 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}
- .padding{:style => "padding:0 10px;"}
+ .col-6
.addresses.row
.columns.span_6
- %h3 Adresse de facturation
-
+ %h4 Adresse de facturation
+
-if f.object.p_customer
=f.inputs do
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
-else
=f.inputs do
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
-
+ .col-6
+ .addresses.row
.columns.span_6
- %h3 Adresse de livraison
-
+ %h4 Adresse de livraison
+
-if f.object.p_customer
=f.inputs do
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
-else
=f.inputs do
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
-
+
.clear
-
-
- %table{:style => "width:100%;"}
- %tr
- %td{:style => "width:33%;"}
- = f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
-
- %td{:style => "width:33%;"}
- = f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
-
- %td{:style => "width:33%;"}
- = f.input :validation_date, :label => "Date de validation :", :as => :date
-
-
- = f.input :customer_ref, :label => "Référence commande client :"
- -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;"}
-
- -if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
- %div
- %strong Notes pour les demandes de commandes pour ce client :
- =simple_format @p_customer_sheet.p_customer.p_customer_sheet_note
- %br
-
-
-
-
- .price_lines_form
- =f.semantic_fields_for :price_lines do |f|
- =render :partial => "admin/price_lines/form", :locals => {:form => f}
-
- %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
-
-
- -if current_admin.has_permission?("payments")
- .qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
-
- -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 :"
-
-
- -if current_admin.has_permission?("payments")
+ =content_for :shipping_date do
+ = f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
+ = f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
+ = f.input :validation_date, :label => "Date de validation :", :as => :date
+
+
+
+ = f.input :customer_ref, :label => "Référence commande client :"
+ -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;"}
+
+ -if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
+ %div
+ %strong Notes pour les demandes de commandes pour ce client :
+ =simple_format @p_customer_sheet.p_customer.p_customer_sheet_note
+ %br
+
+
+
+ =content_for :price_lines do
+ %div{:style=>"padding:0 30px;"}
+ .row.qi_field_wrapper
+ %table{:style => "width:100%;border-collapse:separate;"}
+ %thead
+ %tr
+ %th
+ %th Produit
+ %th{:style => "width:200px;"} Prix
+ %th
+ %th{:style => "width:100px;"} Qté
+ %th TVA
+ %th
+ %tbody.price_lines_form
+ =f.semantic_fields_for :price_lines do |f|
+ =render :partial => "admin/price_lines/form", :locals => {:form => f}
+
+ %p{:style=>"padding-top:10px;"}= link_to_add_fields ic("plus-circle") + " ligne", f, :price_lines, {:class => "btn btn-primary p-2", tabindex: 10, style: "position: sticky; top: 100px"}
+
+
+ -if current_admin.has_permission?("payments")
+ =content_for :discount do
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
- - if f.object.id
- .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
- %h4 Paiements
-
- = f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
-
+ -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 :"
+
+
+ -if current_admin.has_permission?("payments")
+ -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
+ - if f.object.id
+ .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
+ %h4 Paiements
+
+ = f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
+
+
+ = f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
+
+ -if false
+ = f.input :ct_acompte, :label => "Acompte nécessaire ?"
+ = f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
+
+ = f.input :ct_payment_delais, :label => "Délais jour de paiement :"
+
+ -if false
+ = f.input :ct_payment_month_end, :label => "Fin de mois ?"
+
- = f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
- -if false
- = f.input :ct_acompte, :label => "Acompte nécessaire ?"
- = f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
- = f.input :ct_payment_delais, :label => "Délais jour de paiement :"
-
- -if false
- = f.input :ct_payment_month_end, :label => "Fin de mois ?"
-
-
-
-
\ No newline at end of file
diff --git a/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml b/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml
new file mode 100644
index 0000000..783139d
--- /dev/null
+++ b/app/views/admin/price_line_blocks/_form_bon_de_reception_achat.html.haml
@@ -0,0 +1,11 @@
+
+=f.inputs do
+
+ .price_lines_form
+ =f.semantic_fields_for :price_lines do |f|
+ =render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
+
+ %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {slug: f.object.block_type_slug , :class => "btn btn-primary", tabindex: 2}
+
+
+
diff --git a/app/views/admin/price_line_blocks/_form_commande_achat.html.haml b/app/views/admin/price_line_blocks/_form_commande_achat.html.haml
index 77f22ec..dca9aea 100644
--- a/app/views/admin/price_line_blocks/_form_commande_achat.html.haml
+++ b/app/views/admin/price_line_blocks/_form_commande_achat.html.haml
@@ -4,18 +4,54 @@
-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_fournisseur, :label => "Fournisseur :", :collection => PFournisseur.order(:name).all, :as => :select
-
+ = f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
- = f.input :customer_ref, :label => "Numéro de facture fournisseur :"
+ = 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}
+
+ .addresses.row
+ .columns.span_6
+ %h3 Adresse de facturation
+
+ -if f.object.p_customer
+ =f.inputs do
+ = f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
+ -else
+ =f.inputs do
+ = f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
+
+ .columns.span_6
+ %h3 Adresse de livraison
+
+ -if f.object.p_customer
+ =f.inputs do
+ = f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
+ -else
+ =f.inputs do
+ = f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
+
+ .clear
+
+
+ %table{:style => "width:100%;"}
+ %tr
+ %td{:style => "width:50%;"}
+ = f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
+
+ %td{:style => "width:50%;"}
+ = f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
+
+
+
+ = f.input :customer_ref, :label => "Référence commande client :"
-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;"}
+ = f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
-if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
%div
@@ -25,17 +61,46 @@
- = f.input :p_devise_id, :label => "Devise :", :collection => PDevise.order(:id).all, :as => :select, :include_blank => false
- = f.input :local_amount_ttc, :label => "Montant TTC en € réglé pour cette facture :"
-
-
.price_lines_form
=f.semantic_fields_for :price_lines do |f|
- =render :partial => "admin/price_lines/form_facture_dachat", :locals => {:form => f}
+ =render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
- %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary", :partial => "admin/price_lines/form_facture_dachat"}
+ %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
+ -if current_admin.has_permission?("payments")
+ .qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
+
+ -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 :"
+
+ -if !@avoir
+ -if current_admin.has_permission?("customer-sheets-bl")
+ = f.input :ct_nbr_ship, :label => "Nombre de colis :"
+
+ -if current_admin.has_permission?("payments")
+ -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
+ - if f.object.id
+ .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
+ %h4 Paiements
+
+ = f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
+
+
+ = f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
+
+ -if false
+ = f.input :ct_acompte, :label => "Acompte nécessaire ?"
+ = f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
+
+ = f.input :ct_payment_delais, :label => "Délais jour de paiement :"
+
+ -if false
+ = f.input :ct_payment_month_end, :label => "Fin de mois ?"
+
+
+
-
\ No newline at end of file
diff --git a/app/views/admin/price_line_blocks/_form_demande_prix.html.haml b/app/views/admin/price_line_blocks/_form_demande_prix.html.haml
index 28deefc..14a5e63 100644
--- a/app/views/admin/price_line_blocks/_form_demande_prix.html.haml
+++ b/app/views/admin/price_line_blocks/_form_demande_prix.html.haml
@@ -21,7 +21,7 @@
=f.semantic_fields_for :price_lines do |f|
=render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
- %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
+ %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {slug: f.object.block_type_slug , :class => "btn btn-primary", tabindex: 2}
-
\ No newline at end of file
+
diff --git a/app/views/admin/price_line_blocks/_form_facture_achat.html.haml b/app/views/admin/price_line_blocks/_form_facture_achat.html.haml
new file mode 100644
index 0000000..dca9aea
--- /dev/null
+++ b/app/views/admin/price_line_blocks/_form_facture_achat.html.haml
@@ -0,0 +1,106 @@
+
+=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.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}
+
+ .addresses.row
+ .columns.span_6
+ %h3 Adresse de facturation
+
+ -if f.object.p_customer
+ =f.inputs do
+ = f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
+ -else
+ =f.inputs do
+ = f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
+
+ .columns.span_6
+ %h3 Adresse de livraison
+
+ -if f.object.p_customer
+ =f.inputs do
+ = f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
+ -else
+ =f.inputs do
+ = f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
+
+ .clear
+
+
+ %table{:style => "width:100%;"}
+ %tr
+ %td{:style => "width:50%;"}
+ = f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
+
+ %td{:style => "width:50%;"}
+ = f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
+
+
+
+ = f.input :customer_ref, :label => "Référence commande client :"
+ -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;"}
+
+ -if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
+ %div
+ %strong Notes pour les demandes de commandes pour ce client :
+ =simple_format @p_customer_sheet.p_customer.p_customer_sheet_note
+ %br
+
+
+
+
+ .price_lines_form
+ =f.semantic_fields_for :price_lines do |f|
+ =render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
+
+ %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
+
+
+ -if current_admin.has_permission?("payments")
+ .qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
+
+ -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 :"
+
+ -if !@avoir
+ -if current_admin.has_permission?("customer-sheets-bl")
+ = f.input :ct_nbr_ship, :label => "Nombre de colis :"
+
+ -if current_admin.has_permission?("payments")
+ -if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
+ - if f.object.id
+ .qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
+ %h4 Paiements
+
+ = f.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
+
+
+ = f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
+
+ -if false
+ = f.input :ct_acompte, :label => "Acompte nécessaire ?"
+ = f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
+
+ = f.input :ct_payment_delais, :label => "Délais jour de paiement :"
+
+ -if false
+ = f.input :ct_payment_month_end, :label => "Fin de mois ?"
+
+
+
+
diff --git a/app/views/admin/price_line_blocks/_form_reponse_fournisseur.html.haml b/app/views/admin/price_line_blocks/_form_reponse_fournisseur.html.haml
index 06bc0c4..15332b8 100644
--- a/app/views/admin/price_line_blocks/_form_reponse_fournisseur.html.haml
+++ b/app/views/admin/price_line_blocks/_form_reponse_fournisseur.html.haml
@@ -3,17 +3,19 @@
-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_fournisseur_id, :label => "Fournisseur", :collection => PFournisseur.all, :as => :select, :member_label => :name if @price_document.label == "Réponse fournisseur" and current_admin
- = f.input :customer_ref, :label => "Référence cotation fournisseur :"
-
-
- .price_lines_form
- =f.semantic_fields_for :price_lines do |f|
- =render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
- %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
+
+ = f.input :p_fournisseur_id, :label => "Fournisseur", :collection => PFournisseur.all, :as => :select, :member_label => :name if @price_document.label == "Réponse fournisseur" and current_admin
+ = f.input :customer_ref, :label => "Votre référence de cotation :"
+
+
+ %div{:style => ("display:none" if !current_admin)}
+
+ .price_lines_form
+ =f.semantic_fields_for :price_lines do |f|
+ =render :partial => "admin/price_lines/form_#{f.object.block_type_slug}", :locals => {:form => f}
+
+ %p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"} if current_admin
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/_form.html.haml b/app/views/admin/price_line_resp_selects/_form.html.haml
new file mode 100644
index 0000000..73156af
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/_form.html.haml
@@ -0,0 +1,13 @@
+=semantic_form_for [:admin, @price_line_resp_select], :remote => true do |f|
+
+ .content
+ =f.inputs do
+ = f.input :price_line_demand_id, :label => f.object.label_for(:price_line_demand_id)
+ = f.input :price_line_resp_id, :label => f.object.label_for(:price_line_resp_id)
+
+
+
+
+
+ .actions=f.submit "sauvegarder", :class => "btn btn-primary"
+
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/_price_line_resp_select.html.haml b/app/views/admin/price_line_resp_selects/_price_line_resp_select.html.haml
new file mode 100644
index 0000000..d174a07
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/_price_line_resp_select.html.haml
@@ -0,0 +1,16 @@
+%tr#price_line_resp_select_row{:id => price_line_resp_select.id}
+ -tr = {}
+
+ -tr[:actions] = capture do
+ %td.actions
+ = link_to i(:"trash-o"), [:admin, price_line_resp_select], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
+ = link_to i(:pencil), edit_admin_price_line_resp_select_path(price_line_resp_select), :remote => true
+ = link_to i(:eye), admin_price_line_resp_select_path(price_line_resp_select), :remote => true
+
+
+
+ =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_line_resp_select}
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/create.js.erb b/app/views/admin/price_line_resp_selects/create.js.erb
new file mode 100644
index 0000000..aadcb42
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/create.js.erb
@@ -0,0 +1,2 @@
+$('#price_line_resp_selects_rows').prepend("<%= escape_javascript(render(@price_line_resp_select))%>");
+close_pane_hover();
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/destroy.js.erb b/app/views/admin/price_line_resp_selects/destroy.js.erb
new file mode 100644
index 0000000..9a7da6c
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/destroy.js.erb
@@ -0,0 +1 @@
+$('#price_line_resp_select_row_<%= @price_line_resp_select.id %>').remove();
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/edit.js.erb b/app/views/admin/price_line_resp_selects/edit.js.erb
new file mode 100644
index 0000000..6c8f015
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/edit.js.erb
@@ -0,0 +1 @@
+show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/index.html.haml b/app/views/admin/price_line_resp_selects/index.html.haml
new file mode 100644
index 0000000..b5afa77
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/index.html.haml
@@ -0,0 +1,16 @@
+.qi_header
+ .right= link_to ic(:plus)+' Ajouter', new_admin_price_line_resp_select_path(), :class => "btn btn-primary btn-ap-add", :remote => true
+ %h1
+ =PriceLineRespSelect.human rescue ""
+
+
+
+.qi_search_row
+ =form_tag "", :method => "get", :onsubmit => "" do
+ =render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @price_line_resp_selects}
+
+
+=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_line_resp_selects}
+
+
+
diff --git a/app/views/admin/price_line_resp_selects/new.js.erb b/app/views/admin/price_line_resp_selects/new.js.erb
new file mode 100644
index 0000000..6c8f015
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/new.js.erb
@@ -0,0 +1 @@
+show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/show.html.haml b/app/views/admin/price_line_resp_selects/show.html.haml
new file mode 100644
index 0000000..377ef51
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/show.html.haml
@@ -0,0 +1,10 @@
+.qi_header
+ %h1
+
+ %span
+
+
+
+.qi_row
+ .qi_pannel.qi_plain.padding
+ =debug @price_line_resp_select
\ No newline at end of file
diff --git a/app/views/admin/price_line_resp_selects/update.js.erb b/app/views/admin/price_line_resp_selects/update.js.erb
new file mode 100644
index 0000000..d834a55
--- /dev/null
+++ b/app/views/admin/price_line_resp_selects/update.js.erb
@@ -0,0 +1,2 @@
+$('#price_line_resp_select_row_<%= @price_line_resp_select.id %>').replaceWith("<%= escape_javascript(render(@price_line_resp_select))%>");
+close_pane_hover();
\ No newline at end of file
diff --git a/app/views/admin/price_lines/_form.html.haml b/app/views/admin/price_lines/_form.html.haml
index 9920ecb..123ca49 100644
--- a/app/views/admin/price_lines/_form.html.haml
+++ b/app/views/admin/price_lines/_form.html.haml
@@ -1,133 +1,121 @@
+%tr.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
-.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
- %table{:style => "width:100%;"}
- %tr
- %td{:style => "width:30px;"}
- .take
- =ic :arrows
- %td
-
- = form.input :ct_title, :label => "Designation personnalisée : " if @avoir
- %div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
- %label Produit :
- %input.p_product_ref_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
-
-
- = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
-
- :javascript
- $( function() {
-
- $('.p_product_ref_autocomplete_input').autocomplete({
- source: function( request, response ) {
- $.ajax( {
- url: "/admin/p_product_refs/autocomplete.json",
- dataType: "json",
- data: {
- search: request.term,
- p_customer_id: $(".p_customer_id").val()
- },
- success: function(data){
-
- arr = jQuery.map( data, function( item ) {
- return {
- label: item.member_label,
- value: item.member_label,
- id: item.id
- }
- });
-
- response(arr)
-
- }
-
- } );
- },
- minLength: 2,
- select: function( event, ui ) {
-
- $(this).next(".p_product_ref_id").val(ui.item.id)
-
- form = $(this).closest(".price_line_form")
-
-
-
- $.ajax( {
- url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
- dataType: "json",
- data: {
- type: "price",
- qte: form.find(".input_price_line_qte").val(),
- p_customer_id: $(".p_customer_id").val()
- },
- success: function (data) {
- form.find(".input_price_line_price_u_ht").val(data.price);
- form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
- form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
- form.find(".input_price_line_weight_u").val(data.weight);
-
-
-
- }
-
-
- } );
-
-
-
-
- //return false
- }
- });
-
-
-
- } );
-
-
- %table.top_td{:style => "width:100%;margin-top:5px;"}
- %tr
- %td{:style => "width:30px"}
- %span.destroy=link_to_remove_fields ic(:"trash-o"), form
- %td
- -form.object.forced_price = true if form.object.ct_u_price_ht
-
- -if form.object.forced_price and form.object.p_product_ref
- =qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
- -else
- =qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
-
- %div{:style => ("display:none;" if !current_admin.has_permission?("customer-sheets-personalised-price"))}
- = form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "input_price_line_forced_price"}
- .forced_price_wrapper{: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.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
-
-
- %td
- =#qi_js_field(form, :price_line, :tva_account_id, :label => "Compte TVA :")
-
- -if @avoir
-
- -if !form.object.ct_tva_account_id
- -form.object.ct_tva_account_id = form.object.tva_account_id
- = form.input :ct_tva_account_id, :collection => TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, :as => :select, :member_label => :member_label, :include_blank => false, :label => "TVA personnalisée", :input_html => { :class => "input_price_line_tva_account_id"}
-
- -else
- %label Taux de TVA :
- %br
- =select_tag :tva_account_id, 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), :class => "input_price_line_tva_account_id", :disabled => true
-
-
-
- =qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
+ %td{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
+ .take.mr-1
+ =ic :arrows
+ %td{:style => "white-space: nowrap;"}
- = form.input :comment, :label => "Commentaire"
+
+
+ .input-group
+ %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 :position, :class => "price_line_position_input"
+
+ .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.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
+
+
+
+
+ -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")
+ %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}
+
+ %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
+ $('.p_product_ref_autocomplete_input').focus()
+ $( function() {
+ $('.p_product_ref_autocomplete_input').autocomplete({
+ source: function( request, response ) {
+ $.ajax( {
+ url: "/admin/p_product_refs/autocomplete.json",
+ dataType: "json",
+ data: {
+ search: request.term,
+ p_customer_id: $(".p_customer_id").val()
+ },
+ success: function(data){
+ arr = jQuery.map( data, function( item ) {
+ return {
+ label: item.member_label,
+ value: item.member_label,
+ id: item.id
+ }
+ });
+ response(arr)
+ }
+ });
+ },
+ minLength: 2,
+ select: function( event, ui ) {
+ $(this).next(".p_product_ref_id").val(ui.item.id)
+ form = $(this).closest(".price_line_form")
+ $.ajax( {
+ url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
+ dataType: "json",
+ data: {
+ type: "price",
+ qte: form.find(".input_price_line_qte").val(),
+ p_customer_id: $(".p_customer_id").val()
+ },
+ success: function (data) {
+ form.find(".input_price_line_price_u_ht").val(data.price);
+ form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
+ form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
+ form.find(".input_price_line_weight_u").val(data.weight);
+ }
+ });
+ //return false
+ }
+ });
+ });
+
+
+:scss
+ .price_line_form{
+ .form-group{
+ margin-bottom:0;}
+
+ }
diff --git a/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml b/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml
new file mode 100644
index 0000000..a8d7aa0
--- /dev/null
+++ b/app/views/admin/price_lines/_form_bon_de_reception_achat.html.haml
@@ -0,0 +1,27 @@
+.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-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"
+
+
+
+ =qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
+
+ = form.hidden_field :position, :class => "price_line_position_input"
+
diff --git a/app/views/admin/price_lines/_form_consult.html.haml b/app/views/admin/price_lines/_form_consult.html.haml
new file mode 100644
index 0000000..64841df
--- /dev/null
+++ b/app/views/admin/price_lines/_form_consult.html.haml
@@ -0,0 +1,30 @@
+- price_line = form.object
+.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
+ .row
+ .col-6.d-flex
+ .take.mr-4
+ =ic :arrows
+ .mr-1
+ ref :
+ %div{class: "p_product_ref_cc_name_#{price_line.price_line_block.price_lineable_id}"}
+ =price_line.p_product_ref.cc_name
+
+
+ .col-3.d-flex
+ Base de prix U HT :
+ %div{class: "mx-1 price_line_price_u_ht_#{price_line.price_line_block.price_lineable_id}"}
+ = price_line.price_u_ht
+ €
+ .col-3
+ .form-inline
+ = form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte_#{price_line.price_line_block.price_lineable_id} form-control mx-2", tabindex: 1}
+ %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"
+
diff --git a/app/views/admin/price_lines/_form_demande_prix.html.haml b/app/views/admin/price_lines/_form_demande_prix.html.haml
index 0661845..ed5a37a 100644
--- a/app/views/admin/price_lines/_form_demande_prix.html.haml
+++ b/app/views/admin/price_lines/_form_demande_prix.html.haml
@@ -1,98 +1,24 @@
-
-.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
- %table{:style => "width:100%;"}
- %tr
- %td{:style => "width:30px;"}
- .take
+.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
- %td
-
- = form.input :ct_title, :label => "Designation personnalisée : " if @avoir
- %div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
- %label Produit :
- %input.p_product_ref_autocomplete_input.form-control{:disabled => true, :type => "text", :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref)}
-
-
- = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
-
- :javascript
- $( function() {
-
- $('.p_product_ref_autocomplete_input').autocomplete({
- source: function( request, response ) {
- $.ajax( {
- url: "/admin/p_product_refs/autocomplete.json",
- dataType: "json",
- data: {
- search: request.term,
- },
- success: function(data){
-
- arr = jQuery.map( data, function( item ) {
- return {
- label: item.member_label,
- value: item.member_label,
- id: item.id
- }
- });
-
- response(arr)
-
- }
-
- } );
- },
- minLength: 2,
- select: function( event, ui ) {
-
- $(this).next(".p_product_ref_id").val(ui.item.id)
-
- form = $(this).closest(".price_line_form")
-
-
-
- $.ajax( {
- url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
- dataType: "json",
- data: {
- type: "price",
- qte: form.find(".input_price_line_qte").val(),
- p_customer_id: $(".p_customer_id").val()
- },
- success: function (data) {
- form.find(".input_price_line_price_u_ht").val(data.price);
- form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
- form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
- form.find(".input_price_line_weight_u").val(data.weight);
-
-
-
- }
-
-
- } );
-
-
-
-
- //return false
- }
- });
-
-
-
- } );
-
-
- %table.top_td{:style => "width:100%;margin-top:5px;"}
- %tr
- %td{:style => "width:30px"}
- %span.destroy=link_to_remove_fields ic(:"trash-o"), form
-
- %td
- = form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
-
-
+ %label
+ ref :
+ %input.p_product_ref_autocomplete_input.form-control.col{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
+
+ .col-3.ml-4
+ .form-inline
+ = form.input :qte, :label => "qte :", :input_html => { class: "mx-2", tabindex: 1}
+ .col-1
+ %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"
- = form.hidden_field :position, :class => "price_line_position_input"
-
diff --git a/app/views/admin/price_lines/_form_demande_prix_OLD.html.haml b/app/views/admin/price_lines/_form_demande_prix_OLD.html.haml
new file mode 100644
index 0000000..0661845
--- /dev/null
+++ b/app/views/admin/price_lines/_form_demande_prix_OLD.html.haml
@@ -0,0 +1,98 @@
+
+.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
+ %table{:style => "width:100%;"}
+ %tr
+ %td{:style => "width:30px;"}
+ .take
+ =ic :arrows
+ %td
+
+ = form.input :ct_title, :label => "Designation personnalisée : " if @avoir
+ %div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
+ %label Produit :
+ %input.p_product_ref_autocomplete_input.form-control{:disabled => true, :type => "text", :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref)}
+
+
+ = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
+
+ :javascript
+ $( function() {
+
+ $('.p_product_ref_autocomplete_input').autocomplete({
+ source: function( request, response ) {
+ $.ajax( {
+ url: "/admin/p_product_refs/autocomplete.json",
+ dataType: "json",
+ data: {
+ search: request.term,
+ },
+ success: function(data){
+
+ arr = jQuery.map( data, function( item ) {
+ return {
+ label: item.member_label,
+ value: item.member_label,
+ id: item.id
+ }
+ });
+
+ response(arr)
+
+ }
+
+ } );
+ },
+ minLength: 2,
+ select: function( event, ui ) {
+
+ $(this).next(".p_product_ref_id").val(ui.item.id)
+
+ form = $(this).closest(".price_line_form")
+
+
+
+ $.ajax( {
+ url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
+ dataType: "json",
+ data: {
+ type: "price",
+ qte: form.find(".input_price_line_qte").val(),
+ p_customer_id: $(".p_customer_id").val()
+ },
+ success: function (data) {
+ form.find(".input_price_line_price_u_ht").val(data.price);
+ form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
+ form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
+ form.find(".input_price_line_weight_u").val(data.weight);
+
+
+
+ }
+
+
+ } );
+
+
+
+
+ //return false
+ }
+ });
+
+
+
+ } );
+
+
+ %table.top_td{:style => "width:100%;margin-top:5px;"}
+ %tr
+ %td{:style => "width:30px"}
+ %span.destroy=link_to_remove_fields ic(:"trash-o"), form
+
+ %td
+ = form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
+
+
+
+ = form.hidden_field :position, :class => "price_line_position_input"
+
diff --git a/app/views/admin/price_lines/_form_old.html.haml b/app/views/admin/price_lines/_form_old.html.haml
new file mode 100644
index 0000000..60e70c1
--- /dev/null
+++ b/app/views/admin/price_lines/_form_old.html.haml
@@ -0,0 +1,133 @@
+
+.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
+ %table{:style => "width:100%;"}
+ %tr
+ %td{:style => "width:30px;"}
+ .take
+ =ic :arrows
+ %td
+
+ = form.input :ct_title, :label => "Designation personnalisée : " if @avoir
+ %div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
+ %label Produit :
+ %td
+ %input.p_product_ref_autocomplete_input.form-control{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
+
+
+ = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
+
+ :javascript
+ $('.p_product_ref_autocomplete_input').focus()
+ $( function() {
+
+ $('.p_product_ref_autocomplete_input').autocomplete({
+ source: function( request, response ) {
+ $.ajax( {
+ url: "/admin/p_product_refs/autocomplete.json",
+ dataType: "json",
+ data: {
+ search: request.term,
+ p_customer_id: $(".p_customer_id").val()
+ },
+ success: function(data){
+
+ arr = jQuery.map( data, function( item ) {
+ return {
+ label: item.member_label,
+ value: item.member_label,
+ id: item.id
+ }
+ });
+
+ response(arr)
+
+ }
+
+ } );
+ },
+ minLength: 2,
+ select: function( event, ui ) {
+
+ $(this).next(".p_product_ref_id").val(ui.item.id)
+
+ form = $(this).closest(".price_line_form")
+
+
+
+ $.ajax( {
+ url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
+ dataType: "json",
+ data: {
+ type: "price",
+ qte: form.find(".input_price_line_qte").val(),
+ p_customer_id: $(".p_customer_id").val()
+ },
+ success: function (data) {
+ form.find(".input_price_line_price_u_ht").val(data.price);
+ form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
+ form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
+ form.find(".input_price_line_weight_u").val(data.weight);
+
+
+
+ }
+
+
+ } );
+
+
+
+
+ //return false
+ }
+ });
+
+
+
+ } );
+
+
+ %td{:style => "width:30px"}
+ %span.destroy=link_to_remove_fields ic(:"trash-o"), form
+ %td
+ -form.object.forced_price = true if form.object.ct_u_price_ht
+
+ -if form.object.forced_price and form.object.p_product_ref
+ =qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :", :value => form.object.th_price_u_ht)
+ -else
+ =qi_js_field(form, :price_line, :price_u_ht, :label => "Prix U HT :")
+
+ %div{: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 => "input_price_line_forced_price"}
+ .forced_price_wrapper{: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.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte", tabindex: 1}
+
+
+
+ %td
+ =#qi_js_field(form, :price_line, :tva_account_id, :label => "Compte TVA :")
+
+ -if @avoir
+
+ -if !form.object.ct_tva_account_id
+ -form.object.ct_tva_account_id = form.object.tva_account_id
+ = form.input :ct_tva_account_id, :collection => TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, :as => :select, :member_label => :member_label, :include_blank => false, :label => "TVA personnalisée", :input_html => { :class => "input_price_line_tva_account_id"}
+
+ -else
+ %label Taux de TVA :
+ %br
+ =select_tag :tva_account_id, 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), :class => "input_price_line_tva_account_id custom-select" #, :disabled => true
+
+
+
+ =qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
+
+ / = form.input :comment, :label => "Commentaire"
+
+
+
+
+ = form.hidden_field :position, :class => "price_line_position_input"
+
diff --git a/app/views/admin/price_lines/_form_reponse_fournisseur.html.haml b/app/views/admin/price_lines/_form_reponse_fournisseur.html.haml
index 169acc5..9c97d68 100644
--- a/app/views/admin/price_lines/_form_reponse_fournisseur.html.haml
+++ b/app/views/admin/price_lines/_form_reponse_fournisseur.html.haml
@@ -1,7 +1,7 @@
.qi_pannel.qi_plain.padding.price_line_form.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
-
+ =form.text_field :price_line_ref_id
%table.top_td{:style => "width:100%;"}
%tr
@@ -33,7 +33,7 @@
= form.input :ram, :label => "Ram"
%td
- = form.input :ram, :label => "Ram unité"
+ = form.input :ram_unit, :label => "Ram unité"
%td
diff --git a/app/views/admin/price_lines/_price_line.html.haml b/app/views/admin/price_lines/_price_line.html.haml
index 73c945d..4b7dee4 100644
--- a/app/views/admin/price_lines/_price_line.html.haml
+++ b/app/views/admin/price_lines/_price_line.html.haml
@@ -1,5 +1,7 @@
-%tr#price_document_row{:id => price_line.id}
+%tr#price_line_row{:id => price_line.id}
-tr = {}
-
+ -tr[:actions] = capture do
+ %td
+ =link_to ic(:pencil), edit_admin_price_line_path(price_line), :remote => true
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_line}
\ No newline at end of file
diff --git a/app/views/admin/price_lines/_reponse_pane_hover_form.html.haml b/app/views/admin/price_lines/_reponse_pane_hover_form.html.haml
new file mode 100644
index 0000000..4444417
--- /dev/null
+++ b/app/views/admin/price_lines/_reponse_pane_hover_form.html.haml
@@ -0,0 +1,61 @@
+
+
+=semantic_form_for [:admin, @price_line], :remote => true do |form|
+
+ .content
+ Produit :
+ =form.object.p_product_ref.cc_name if form.object.p_product_ref
+ %br
+ Quantité à satisfaire :
+ =form.object.qte
+
+ %br
+ %br
+
+ %table.top_td{:style => "width:100%;"}
+ %tr
+
+ %td
+ = form.input :p_product_power_id, :label => "Type de chargeur", :collection => PProductPower.all, :include_blank => false, :as => :select
+
+ %td
+ = form.input :qte_available, :label => "Qté disponible :", :input_html => {:class => "input_price_line_qte"}
+
+
+ %td
+ = form.input :ct_u_price_ht, :label => "Prix vente"
+
+ %td
+ = form.input :ready_stock, :label => "Ready stock", :as => :select
+
+ %td
+ = form.input :ram, :label => "Ram"
+
+ %td
+ = form.input :ram_unit, :label => "Ram unité"
+
+
+ %td
+ = form.input :eu, :label => "EU ?", :as => :select
+
+
+ %td
+ = form.input :p_product_zone_id, :label => "Zone", :collection => PProductZone.all, :include_blank => true, :as => :select
+
+
+
+ %td
+ = form.input :fullkit, :label => "Fullkit", :as => :select
+
+ %td
+ = form.input :lang_start, :label => "Démarage sur l'écran de langue (starting on screen language)", :as => :select
+
+
+
+
+
+
+ = form.input :comment, :label => "Commentaire", :input_html => {:style => "height:70px;"}
+
+ .actions= form.submit "Sauvegarder", :class => "btn btn-primary"
+
diff --git a/app/views/admin/price_lines/edit.js.erb b/app/views/admin/price_lines/edit.js.erb
index 6c8f015..30200cb 100644
--- a/app/views/admin/price_lines/edit.js.erb
+++ b/app/views/admin/price_lines/edit.js.erb
@@ -1 +1 @@
-show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
\ No newline at end of file
+show_pane_hover("<%= escape_javascript(render(:partial => "reponse_pane_hover_form"))%>",1200,900);
\ No newline at end of file
diff --git a/app/views/admin/stock_movement_lines/_form_cred.html.haml b/app/views/admin/stock_movement_lines/_form_cred.html.haml
index 75c4daf..3e2afcf 100644
--- a/app/views/admin/stock_movement_lines/_form_cred.html.haml
+++ b/app/views/admin/stock_movement_lines/_form_cred.html.haml
@@ -91,6 +91,7 @@
%td
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte"}
- %td
- = form.input :dluo, :label => "DLUO :", :input_html => {:class => ""}, :as => :date
+ -if false
+ %td
+ = form.input :dluo, :label => "DLUO :", :input_html => {:class => ""}, :as => :date
diff --git a/app/views/layouts/_navbar.haml b/app/views/layouts/_navbar.haml
new file mode 100644
index 0000000..03f02be
--- /dev/null
+++ b/app/views/layouts/_navbar.haml
@@ -0,0 +1,77 @@
+#qi_header_wrapper.fh-fixedHeader
+ %nav#admin_nav.navbar.navbar-expand-lg.navbar-dark.bg-light
+ %button.navbar-toggler{"type" => "button", "data-toggle" => "collapse", "data-target" => "#navbarSupportedContent", "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation"}
+ %span.navbar-toggler-icon
+ #navbarSupportedContent.collapse.navbar-collapse
+ %ul.navbar-nav.mr-auto
+ -if @qi_menu_active
+ -qi_menu_active = @qi_menus[@qi_menu_active]
+
+ -if qi_menu_active[:elements]
+ -qi_menu_active[:elements].each do |k,v|
+ -if !v[:sub_elements]
+ %li.nav-item{class: ("active" if @qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)}
+ =link_to v[:name], v[:link], :class => "nav-link"
+
+ -else
+ %li.nav-item.dropdown
+ =link_to v[:name], v[:link], class: "nav-link dropdown-toggle "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k) or (v[:sub_elements] and v[:sub_elements][@qi_menu_sub_menu_active])).to_s , id: "navbarDropdown", "role" => "button", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"
+ %ul.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
+ -v[:sub_elements].each do |k,v|
+ %li=link_to v[:name], v[:link], :class => "dropdown-item"+(" active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
+
+
+
+
+ / =qi_menu_active[:elements].each do |k,v|
+ / %li.dropdown-item=link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
+ / %li.nav-item= link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
+
+
+
+ %ul.nav.navbar-nav.navbar-right.ml-auto
+ %li.nav-item.qi_help_remove{:style => ("display:none" if !session[:qi_helps] )}
+
+ =link_to ic(:"question-circle"), admin_qi_helps_path(), :onclick => '$(".qi_help").hide();$(".qi_help_add").show();$(".qi_help_remove").hide();', :remote => true, :class => "nav-link"
+
+
+ %li.nav-item.qi_help_add{:style => ("display:none" if session[:qi_helps] )}
+ =link_to ic(:"question-circle-o"), admin_qi_helps_path(:enabled => true), :onclick => '$(".qi_help").show();$(".qi_help_add").hide();$(".qi_help_remove").show();', :remote => true, :class => "nav-link"
+
+
+
+ -if session[:qi_helps]
+ :scss
+ .qi_help{
+ display:inherit;
+
+ }
+ -else
+ :scss
+ .qi_help{
+ display:none;
+
+ }
+
+
+ %li.nav-item.dropdown
+ -if current_admin
+ %a#navbarDropdown.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :href => "#", :role => "button"}
+ =current_admin.firstname
+ =current_admin.name
+
+
+ .dropdown-menu{"aria-labelledby" => "navbarDropdown"}
+ = link_to "Gestion des admins", admin_admins_path, :class => "dropdown-item" if current_admin.super_admin
+ .dropdown-divider
+ =link_to "Se déconnecter", admin_admin_auth_path(1), method: :delete, :class => "dropdown-item"
+
+
+
+
+ %li.nav-item
+ =link_to ic(:refresh), "#", :onclick => "location.reload();", :class => "nav-link"
+
+
+
+ = yield :header
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
index 23443a3..dc31319 100644
--- a/app/views/layouts/admin.html.haml
+++ b/app/views/layouts/admin.html.haml
@@ -27,53 +27,54 @@
%body.admin{:id => "body_#{@qi_menu_active}"}
#right_bar
- =link_to image_tag("/logo-presta.png"), "/", :id => "logo"
+ =link_to image_tag("/logo-arcom.png"), "/", :id => "logo"
+
+
+ -if current_admin
-
-
- -@qi_menus.each do |k,v|
+ -@qi_menus.each do |k,v|
- :scss
- #body_#{k.to_s}{
- #admin_nav{
- //background:$big_color_#{k.to_s} !important;
- background-color: #{v[:color].to_s} !important;
- }
+ :scss
+ #body_#{k.to_s}{
+ #admin_nav{
+ //background:$big_color_#{k.to_s} !important;
+ background-color: #{v[:color].to_s} !important;
+ }
- }
- #big_cat_#{k.to_s}.active, #big_cat_#{k.to_s}:hover{
- //color:$big_color_#{k.to_s} !important;
- //background-color: #{v[:color].to_s} !important;
- color:white !important;
- border-right:4px solid #{v[:color].to_s};
- }
+ }
+ #big_cat_#{k.to_s}.active, #big_cat_#{k.to_s}:hover{
+ //color:$big_color_#{k.to_s} !important;
+ //background-color: #{v[:color].to_s} !important;
+ color:white !important;
+ border-right:4px solid #{v[:color].to_s};
+ }
- #big_cat_#{k.to_s}{
- //color:$big_color_#{k.to_s} !important;
- color: rgba(white, 0.5) !important;
- border-right:4px solid transparent;
- }
+ #big_cat_#{k.to_s}{
+ //color:$big_color_#{k.to_s} !important;
+ color: rgba(white, 0.5) !important;
+ border-right:4px solid transparent;
+ }
- .bgbd-#{k.to_s}{
- background-color: #{v[:color].to_s} !important;
- border-color: #{v[:color].to_s} !important;
- }
+ .bgbd-#{k.to_s}{
+ background-color: #{v[:color].to_s} !important;
+ border-color: #{v[:color].to_s} !important;
+ }
- .element
- =link_to v[:link] do
- .cat#big_cat{:id => k.to_s}
- =ic v[:icon].to_s.to_sym
- =v[:name]
+ .element
+ =link_to v[:link] do
+ .cat#big_cat{:id => k.to_s}
+ =ic v[:icon].to_s.to_sym
+ =v[:name]
.bottom
.element
- -if current_admin.has_permission?("admins")
+ -if current_admin and current_admin.has_permission?("admins")
=link_to admin_admins_path do
.cat#big_cat_preferences
=ic :"cog"
@@ -85,103 +86,9 @@
- #qi_header_wrapper.fh-fixedHeader
- %nav#admin_nav.navbar.navbar-expand-lg.navbar-dark.bg-light
- %button.navbar-toggler{"aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarSupportedContent", "data-toggle" => "collapse", :type => "button"}
- %span.navbar-toggler-icon
- #navbarSupportedContent.collapse.navbar-collapse
- %ul.navbar-nav.mr-auto
- -if @qi_menu_active
- -qi_menu_active = @qi_menus[@qi_menu_active]
-
- -if qi_menu_active[:elements]
- -qi_menu_active[:elements].each do |k,v|
- %li.nav-item= link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
-
- %script
- =raw '$("#big_cat_'+@qi_menu_active.to_s+'").addClass("active");'
-
-
-
- %form.form-inline.my-2.my-lg-0
- %ul.nav.navbar-nav.navbar-right
- %li.nav-item.qi_help_remove{:style => ("display:none" if !session[:qi_helps] )}
-
- =link_to ic(:"question-circle"), admin_qi_helps_path(), :onclick => '$(".qi_help").hide();$(".qi_help_add").show();$(".qi_help_remove").hide();', :remote => true, :class => "nav-link"
-
-
- %li.nav-item.qi_help_add{:style => ("display:none" if session[:qi_helps] )}
- =link_to ic(:"question-circle-o"), admin_qi_helps_path(:enabled => true), :onclick => '$(".qi_help").show();$(".qi_help_add").hide();$(".qi_help_remove").show();', :remote => true, :class => "nav-link"
-
+ =render partial: "layouts/navbar"
-
- -if session[:qi_helps]
- :scss
- .qi_help{
- display:inherit;
-
- }
- -else
- :scss
- .qi_help{
- display:none;
-
- }
-
-
-
-
- %li.nav-item.qi_stat_remove{:style => ("display:none" if !session[:qi_stats] )}
-
- =link_to raw(""+ic(:"pie-chart")+""), admin_qi_stats_path(), :onclick => '$(".qi_stat, .qi_kpi").show();$(".qi_stat_add").show();$(".qi_stat_remove").hide();', :remote => true, :class => "nav-link"
-
-
- %li.nav-item.qi_stat_add{:style => ("display:none" if session[:qi_stats] )}
- =link_to ic(:"pie-chart"), admin_qi_stats_path(:enabled => true), :onclick => '$(".qi_stat, .qi_kpi").hide();$(".qi_stat_add").hide();$(".qi_stat_remove").show();', :remote => true, :class => "nav-link"
-
-
-
- -if session[:qi_stats]
- :scss
- .qi_stat, .qi_kpi{
- display:none;
-
- }
-
- -else
- :scss
- .qi_stat, .qi_kpi{
- display:inherit;
-
- }
-
-
-
- %li.nav-item.dropdown
- %a#navbarDropdown.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :href => "#", :role => "button"}
- =current_admin.firstname
- =current_admin.name
-
-
- .dropdown-menu{"aria-labelledby" => "navbarDropdown"}
- = link_to "Gestion des admins", admin_admins_path, :class => "dropdown-item" if current_admin.super_admin
- .dropdown-divider
- =link_to "Se déconnecter", admin_admin_auth_path(1), method: :delete, :class => "dropdown-item"
-
- -if super_current_admin
- %li.nav-item
- =link_to ic(:"user-secret"), admin_admins_path, :class => "nav-link"
-
-
- %li.nav-item
- =link_to ic(:refresh), "#", :onclick => "location.reload();", :class => "nav-link"
-
-
-
-
-
- = yield :header
diff --git a/app/views/qi/_qi_ordered_table.html.haml b/app/views/qi/_qi_ordered_table.html.haml
index 79c9a48..b968bab 100644
--- a/app/views/qi/_qi_ordered_table.html.haml
+++ b/app/views/qi/_qi_ordered_table.html.haml
@@ -1,5 +1,7 @@
- "QI ActsAsCaching V0.6"
+- remote = remote || false
+
-if true
-masqued_columns = masqued_columns || nil
@@ -183,7 +185,7 @@
.qi_pagination
- = paginate qi_ordered_table_collection #, :remote => true
+ = paginate qi_ordered_table_collection, :remote => remote
:scss
diff --git a/config/routes.rb b/config/routes.rb
index cdc0dc1..a5835ca 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,16 @@
Rails.application.routes.draw do
+ namespace :admin do
+ resources :price_line_resp_selects do
+ member do
+
+ end
+ collection do
+
+ end
+ end
+ end
+
namespace :admin do
resources :p_grades do
member do
@@ -612,10 +623,22 @@ Rails.application.routes.draw do
get :consult
post :consult_save
+ post :consult_create
+ get :consult_edit
+ put :consult_update
+ get :match_p_fournisseur
+ patch :match_p_fournisseur_save
+ get :analyse_reponses
+ post :analyse_reponses_save
+ get :generate_final_consult
+ get :buy_order_create
+ get :bon_de_reception
+ get :facture_achat
end
collection do
get :search_to_affect
-
+ post :consult_create
+
end
end
end
@@ -1030,6 +1053,7 @@ Rails.application.routes.draw do
collection do
get :affects
get :update_stocks
+ get :export_xls
end
end
diff --git a/db/migrate/20210907083709_add_selected_price_offer_to_price_lines.rb b/db/migrate/20210907083709_add_selected_price_offer_to_price_lines.rb
new file mode 100644
index 0000000..0654371
--- /dev/null
+++ b/db/migrate/20210907083709_add_selected_price_offer_to_price_lines.rb
@@ -0,0 +1,5 @@
+class AddSelectedPriceOfferToPriceLines < ActiveRecord::Migration[6.0]
+ def change
+ add_column :price_lines, :selected_price_line_id, :integer
+ end
+end
diff --git a/db/migrate/20210907161735_create_price_line_resp_selects.rb b/db/migrate/20210907161735_create_price_line_resp_selects.rb
new file mode 100644
index 0000000..bc401da
--- /dev/null
+++ b/db/migrate/20210907161735_create_price_line_resp_selects.rb
@@ -0,0 +1,10 @@
+class CreatePriceLineRespSelects < ActiveRecord::Migration[6.0]
+ def change
+ create_table :price_line_resp_selects do |t|
+ t.integer :price_line_demand_id
+ t.integer :price_line_resp_id
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20210914071847_add_doc_hist_to_price_documents.rb b/db/migrate/20210914071847_add_doc_hist_to_price_documents.rb
new file mode 100644
index 0000000..eebac6b
--- /dev/null
+++ b/db/migrate/20210914071847_add_doc_hist_to_price_documents.rb
@@ -0,0 +1,9 @@
+class AddDocHistToPriceDocuments < ActiveRecord::Migration[6.0]
+ def change
+ add_column :price_documents, :bon_de_commande_achat_id, :integer
+ add_column :price_documents, :bon_de_reception_achat_id, :integer
+ add_column :price_documents, :demande_de_prix_id, :integer
+ add_column :price_documents, :avoir_achat_id, :integer
+ add_column :price_documents, :facture_achat_id, :integer
+ end
+end
diff --git a/db/migrate/20210917115613_add_sorecop_to_p_product_refs.rb b/db/migrate/20210917115613_add_sorecop_to_p_product_refs.rb
new file mode 100644
index 0000000..80e2940
--- /dev/null
+++ b/db/migrate/20210917115613_add_sorecop_to_p_product_refs.rb
@@ -0,0 +1,7 @@
+class AddSorecopToPProductRefs < ActiveRecord::Migration[6.0]
+ def change
+ add_column :p_product_refs, :ca_sorecop, :decimal, :precision => 10, :scale => 2
+ add_column :p_product_refs, :cc_sorecop, :decimal, :precision => 10, :scale => 2
+ add_column :p_product_refs, :ct_sorecop, :decimal, :precision => 10, :scale => 2
+ end
+end
diff --git a/db/migrate/20210917121011_add_deee_to_p_product_refs.rb b/db/migrate/20210917121011_add_deee_to_p_product_refs.rb
new file mode 100644
index 0000000..9542490
--- /dev/null
+++ b/db/migrate/20210917121011_add_deee_to_p_product_refs.rb
@@ -0,0 +1,7 @@
+class AddDeeeToPProductRefs < ActiveRecord::Migration[6.0]
+ def change
+ add_column :p_product_refs, :ca_deee, :decimal, :precision => 10, :scale => 2
+ add_column :p_product_refs, :cc_deee, :decimal, :precision => 10, :scale => 2
+ add_column :p_product_refs, :ct_deee, :decimal, :precision => 10, :scale => 2
+ end
+end
diff --git a/db/migrate/20210917122153_add_ean_to_p_product_refs.rb b/db/migrate/20210917122153_add_ean_to_p_product_refs.rb
new file mode 100644
index 0000000..128e438
--- /dev/null
+++ b/db/migrate/20210917122153_add_ean_to_p_product_refs.rb
@@ -0,0 +1,5 @@
+class AddEanToPProductRefs < ActiveRecord::Migration[6.0]
+ def change
+ add_column :p_product_refs, :ean, :string
+ end
+end
diff --git a/db/migrate/20210917124338_add_sorecop_comment_to_p_product_refs.rb b/db/migrate/20210917124338_add_sorecop_comment_to_p_product_refs.rb
new file mode 100644
index 0000000..3c239fb
--- /dev/null
+++ b/db/migrate/20210917124338_add_sorecop_comment_to_p_product_refs.rb
@@ -0,0 +1,5 @@
+class AddSorecopCommentToPProductRefs < ActiveRecord::Migration[6.0]
+ def change
+ add_column :p_product_refs, :sorecop_comment, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e1898e3..5baae52 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2021_08_30_091804) do
+ActiveRecord::Schema.define(version: 2021_09_17_124338) do
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "name"
@@ -1793,6 +1793,14 @@ ActiveRecord::Schema.define(version: 2021_08_30_091804) do
t.boolean "stocked", default: true
t.text "description"
t.integer "p_product_color_id"
+ t.decimal "ca_sorecop", precision: 10, scale: 2
+ t.decimal "cc_sorecop", precision: 10, scale: 2
+ t.decimal "ct_sorecop", precision: 10, scale: 2
+ t.decimal "ca_deee", precision: 10, scale: 2
+ t.decimal "cc_deee", precision: 10, scale: 2
+ t.decimal "ct_deee", precision: 10, scale: 2
+ t.string "ean"
+ t.string "sorecop_comment"
end
create_table "p_product_specs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
@@ -2251,6 +2259,11 @@ ActiveRecord::Schema.define(version: 2021_08_30_091804) do
t.string "f_token"
t.text "acheteur_text"
t.string "public_fournisseur_name"
+ t.integer "bon_de_commande_achat_id"
+ t.integer "bon_de_reception_achat_id"
+ t.integer "demande_de_prix_id"
+ t.integer "avoir_achat_id"
+ t.integer "facture_achat_id"
t.index ["p_customer_id"], name: "index_price_documents_on_p_customer_id"
end
@@ -2403,6 +2416,13 @@ ActiveRecord::Schema.define(version: 2021_08_30_091804) do
t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id"
end
+ create_table "price_line_resp_selects", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
+ t.integer "price_line_demand_id"
+ t.integer "price_line_resp_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ end
+
create_table "price_lines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.boolean "archived"
t.integer "price_line_block_id"
@@ -2544,6 +2564,7 @@ ActiveRecord::Schema.define(version: 2021_08_30_091804) do
t.boolean "eu"
t.boolean "fullkit"
t.boolean "lang_start"
+ t.integer "selected_price_line_id"
end
create_table "quote_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|