demade de prix
This commit is contained in:
parent
fa354b1366
commit
e9e0f009a6
@ -235,11 +235,17 @@ 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[:qte].keys
|
||||
p_product_ref_qte = params[:qte].values
|
||||
|
||||
p_product_ref_id.each_with_index do |key, i|
|
||||
@price_document.price_line_block.price_lines << PriceLine.new(:p_product_ref_id => key, :qte => p_product_ref_qte[i])
|
||||
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
|
||||
|
||||
|
@ -27,6 +27,8 @@ class PriceDocument < ApplicationRecord
|
||||
|
||||
PURCHASES = ["Demande prix", "Commande achat", "Facture d'achat"]
|
||||
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?
|
||||
|
||||
@ -291,7 +293,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"},
|
||||
|
||||
|
||||
|
||||
|
@ -597,7 +597,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
|
||||
|
||||
|
||||
|
||||
|
@ -24,14 +24,23 @@
|
||||
= @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 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -50,8 +50,15 @@
|
||||
-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 + " %"
|
||||
|
||||
|
||||
-tr[:stock_ok] = capture do
|
||||
%td
|
||||
@ -147,4 +154,4 @@
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_document}
|
||||
|
||||
|
||||
|
@ -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 [1,2,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")))
|
||||
-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 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
.qi_header
|
||||
|
||||
%h1
|
||||
Documents comptables
|
||||
Documents
|
||||
%span
|
||||
Ajouter un document
|
||||
|
||||
|
||||
|
||||
.qi_row=render :partial => "form"
|
||||
.qi_row=render :partial => "form"
|
||||
|
Reference in New Issue
Block a user