This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
2021-11-18 17:47:00 +01:00

68 lines
1.8 KiB
Plaintext

-@price_documents = PriceDocument.where("date >= ? and date <= ?", @s_inventaire.date-2.year, @s_inventaire.date+1.day )
-@price_lines = PriceLine.where(:cc_block_type => "Facture achat",:price_line_block_id => PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id =>@price_documents.ids )).group(:p_product_ref_id)
-@p_product_ref_ids = @price_lines.map{|pl| pl.p_product_ref_id}
-@p_product_ref_ids = @p_product_ref_ids.compact
=#debug @p_product_ref_ids.length
-PProductRef.where(:id => @p_product_ref_ids).joins(:p_product).group("p_products.p_product_cat_id").each do |ppc|
-if !ppc.p_product.p_product_cat or !ppc.p_product.p_product_cat.exclude_inventaire
%h3{:style =>"text-align:center;text-transform:uppercase;"}
=#ppc.p_product.p_product_cat_id
-if ppc.p_product.p_product_cat
=ppc.p_product.p_product_cat.name
-else
Non catégorisé
%table.table.table-striped
%thead
%tr
%th Réf.
%th Libellé
%th{:style => "width:40px;"} Qté const.
%tbody
-PProductRef.joins(:p_product).order(:cc_name).where(:p_products => {:exclude_inventaire => false,:p_product_cat_id => ppc.p_product.p_product_cat_id}, :id => @p_product_ref_ids).each do |p_product_ref|
%tr
%td{:style => "width:100px;"}=p_product_ref.ref
%td=p_product_ref.name
%td{:style => "width:40px;"}
%div{:style => "page-break-after: always;"}
:scss
*{
font-family:Lato;
}
table{
border-collapse:collapse;
width:100%;
font-size:12px;
tr{
page-break-inside: avoid;
}
th,td{
padding:5px 5px;
border:1px solid gray;
}
h3{
font-size:18px;
text-align:center;
}
tr:nth-child(odd){
th,td{
background:#f9f9fe;
}
}
}