suite
This commit is contained in:
parent
46d54dfafd
commit
f1049b24a0
@ -131,9 +131,9 @@ class PProduct < ActiveRecord::Base
|
||||
|
||||
else
|
||||
|
||||
if !(p_product_stock = self.product_stocks.where(:p_color => nil, :p_size_id => nil).first)
|
||||
if !(p_product_stock = self.p_product_stocks.where(:p_color => nil, :p_size_id => nil).first)
|
||||
|
||||
p_product_stock = self.product_stocks.create(:stock_th_ok => 0, :stock_ok => 0)
|
||||
p_product_stock = self.p_product_stocks.create(:stock_th_ok => 0, :stock_ok => 0)
|
||||
|
||||
ids_new_saveds << p_product_stock.id
|
||||
end
|
||||
|
@ -63,43 +63,64 @@
|
||||
|
||||
-p_product = form.object.p_product if form.object.p_product
|
||||
%table.table.order_table
|
||||
%tr
|
||||
%th
|
||||
-if p_product and p_product.p_sizes.count > 0
|
||||
%tr
|
||||
%th
|
||||
|
||||
|
||||
|
||||
|
||||
-if form.object.p_product
|
||||
-if form.object.p_product
|
||||
|
||||
-p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |p_size|
|
||||
%th.size_th
|
||||
=p_size.name
|
||||
%th.price_td Qte
|
||||
%th.price_td PU
|
||||
%th.price_td
|
||||
Prix tot.
|
||||
-if form.object.p_product
|
||||
-p_product.p_colors.all.each do |p_color|
|
||||
%tr.color_line
|
||||
%td=p_color.name
|
||||
|
||||
-p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |p_size|
|
||||
%td
|
||||
-ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
|
||||
|
||||
-if ps
|
||||
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
|
||||
-if p_sheet_line_line
|
||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||
|
||||
%td.qte_tot.price_td
|
||||
%td.price.price_td{:data => {:price => form.object.price}}
|
||||
=number_to_currency form.object.price
|
||||
|
||||
%td.price_color_tot.price_td
|
||||
%th.size_th
|
||||
=p_size.name
|
||||
%th.price_td Qte
|
||||
%th.price_td PU
|
||||
%th.price_td
|
||||
Prix tot.
|
||||
-if form.object.p_product
|
||||
-p_product.p_colors.all.each do |p_color|
|
||||
%tr.color_line
|
||||
%td=p_color.name
|
||||
|
||||
-p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |p_size|
|
||||
%td
|
||||
-ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
|
||||
|
||||
-if ps
|
||||
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
|
||||
-if p_sheet_line_line
|
||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||
|
||||
%td.qte_tot.price_td
|
||||
%td.price.price_td{:data => {:price => form.object.price}}
|
||||
=number_to_currency form.object.price
|
||||
|
||||
%td.price_color_tot.price_td
|
||||
-elsif form.object.p_product
|
||||
%tr.color_line
|
||||
%td
|
||||
|
||||
-p_product.p_product_stocks.each do |ps|
|
||||
%td
|
||||
|
||||
|
||||
-if ps
|
||||
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
|
||||
-if p_sheet_line_line
|
||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||
|
||||
%td.qte_tot.price_td
|
||||
%td.price.price_td{:data => {:price => form.object.price}}
|
||||
=number_to_currency form.object.price
|
||||
|
||||
%td.price_color_tot.price_td
|
||||
|
||||
-if form.object.p_product
|
||||
%table{:style => "width:100%"}
|
||||
|
||||
|
@ -54,28 +54,62 @@
|
||||
|
||||
|
||||
%td{:colspan => 4}
|
||||
-sheet_line.p_product.p_colors.all.each do |pc|
|
||||
-if sheet_line.p_product.p_colors.count > 0
|
||||
-sheet_line.p_product.p_colors.all.each do |pc|
|
||||
-qte_tot = 0.0
|
||||
%tr
|
||||
%td
|
||||
%td{:colspan => 1, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
=pc.name
|
||||
|
||||
-sheet_line.p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |psize|
|
||||
|
||||
%td.p_size_td
|
||||
-psl = p_sheet_line_lines.joins(:p_product_stock).where(:p_product_stocks => {:p_size_id => psize.id, :p_color_id => pc.id} ).first
|
||||
-if psl
|
||||
=psl.qte
|
||||
-qte_tot += psl.qte
|
||||
|
||||
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
|
||||
-elsif sheet_line.p_product.p_sizes.count > 0
|
||||
-qte_tot = 0.0
|
||||
%tr
|
||||
%td
|
||||
%td{:colspan => 1, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
=pc.name
|
||||
|
||||
|
||||
|
||||
-sheet_line.p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |psize|
|
||||
|
||||
|
||||
%td.p_size_td
|
||||
-psl = p_sheet_line_lines.joins(:p_product_stock).where(:p_product_stocks => {:p_size_id => psize.id, :p_color_id => pc.id} ).first
|
||||
-psl = p_sheet_line_lines.joins(:p_product_stock).where(:p_product_stocks => {:p_size_id => psize.id} ).first
|
||||
-if psl
|
||||
=psl.qte
|
||||
-qte_tot += psl.qte
|
||||
|
||||
|
||||
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
@ -83,11 +117,39 @@
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
|
||||
-else
|
||||
%tr
|
||||
-qte_tot = 0.0
|
||||
%td
|
||||
%td{:colspan => 1, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
|
||||
|
||||
-p_sheet_line_lines.joins(:p_product_stock).each do |psl|
|
||||
-qte_tot += psl.qte
|
||||
|
||||
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -42,44 +42,46 @@
|
||||
Réf client :
|
||||
=sheet_line.cust_ref
|
||||
|
||||
|
||||
-p_sheet_line_lines.group(:p_size_id).joins(:p_size).order("p_sizes.position ASC, p_sizes.id ASC").uniq.each do |psize|
|
||||
%th.p_size_td=psize.p_size.name
|
||||
-if p_sheet_line_lines.group(:p_size_id).joins(:p_size).order("p_sizes.position ASC, p_sizes.id ASC").uniq.length > 0
|
||||
-p_sheet_line_lines.group(:p_size_id).joins(:p_size).order("p_sizes.position ASC, p_sizes.id ASC").uniq.each do |psize|
|
||||
%th.p_size_td=psize.p_size.name
|
||||
|
||||
|
||||
%td{:colspan => 4}
|
||||
-p_sheet_line_lines.group(:p_color_id).uniq.each do |pc|
|
||||
-qte_tot = 0.0
|
||||
%tr
|
||||
%td{:colspan => 3, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
-if pc.p_color
|
||||
%tr
|
||||
%td{:colspan => 3, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
=pc.p_color.name
|
||||
|
||||
-p_sheet_line_lines.group(:p_size_id).joins(:p_size).order("p_sizes.position ASC, p_sizes.id ASC").uniq.each do |psize|
|
||||
%tr
|
||||
%td
|
||||
=pc.p_color.name
|
||||
|
||||
|
||||
%td.p_size_td
|
||||
-psl = p_sheet_line_lines.where(:p_size_id => psize.p_size_id, :p_color_id => pc.p_color_id ).first
|
||||
-if psl
|
||||
=psl.qte
|
||||
-qte_tot += psl.qte
|
||||
-p_sheet_line_lines.group(:p_size_id).joins(:p_size).order("p_sizes.position ASC, p_sizes.id ASC").uniq.each do |psize|
|
||||
|
||||
%td.p_size_td
|
||||
-psl = p_sheet_line_lines.where(:p_size_id => psize.p_size_id, :p_color_id => pc.p_color_id ).first
|
||||
-if psl
|
||||
=psl.qte
|
||||
-qte_tot += psl.qte
|
||||
|
||||
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
-if @p_document and @p_document.label != "Bon de livraison"
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
-if @p_document and @p_document.label != "Bon de livraison"
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
|
||||
%tr.tr_sheet_line_head
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user