63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
|
|
#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
|
|
|
|
|
|
|