%head :scss body{ font-size:10px; font-family:arial, sans-serif; .table{ border-collapse:collapse; font-size:10px; font-family:arial, sans-serif; td,th{ border:1px solid gray; } } .table{ td{ padding:2px 5px; } } } .clear{ clear:both; } .table{ width:100%; } td.numeraire{ white-space: nowrap; text-align:right; } -price_line_block = @price_document.price_line_block %body %div{:style => "float:right;margin-top:4cm;font-size:13px;margin-bottom:0.5cm;padding-right:2cm;"} -if @price_document.label == "Bon de livraison" -@bl = true -particular_doc = price_line_block.particular_send -else -particular_doc = price_line_block.particular_bill -if particular_doc.organisation? %strong=particular_doc.organisation -if particular_doc.com_name? %br =particular_doc.com_name %br -if particular_doc.firstname? or particular_doc.name? =particular_doc.civilite =particular_doc.firstname =particular_doc.name %br =particular_doc.address_2 -if particular_doc.address_3? %br =particular_doc.address_3 %br =particular_doc.cp =particular_doc.city %br =particular_doc.country #top_left{:style => "width:230px;text-align:center;"} =image_tag "https://mdmb.basiclabs.fr/logo-mdmb.png", :style => "width:100px;display:block;margin:auto;" .address %strong MAISON DES METIERS DE BOUCHE %br 20 chemin des Posés %br 74330 POISY .clear %div{:style => "position:absolute;top:20px;;right:0;"} %span{:style => "font-size:14pt;font-weight:bold;text-transform:uppercase;"} =@price_document.label %span{:style => "font-weight:normal;"}=@price_document.d_number %br Date : =l @price_document.date, :format => :date -if @price_document.ref_element_type == "PCustomerSheet" and @price_document.ref_element -bc = @price_document.ref_element.price_documents.where(:cc_label => "Bon de commande").order("date DESC, created_at DESC").first -if bc ="-" Ref commande : =bc.d_number %table.table{:style => "width:auto;"} %tr %td N° Client %td Date de commande %td Représentant -if @price_document.label != "Avoir" %td Semaine de livraison souhaitée %td Nombre de colis -elsif pd = PriceDocument.where(:id => @price_document.facture_id).first %td Réf. facture %tr %td=@price_document.p_customer.code if @price_document.p_customer %td =l price_line_block.creation_date if price_line_block.creation_date %td =@price_document.p_commercial.long_name if @price_document.p_commercial -if @price_document.label != "Avoir" %td =l price_line_block.wish_date, :format => "%V" (du =l price_line_block.wish_date.beginning_of_week au =l price_line_block.wish_date.end_of_week ) %td =price_line_block.nbr_ship -elsif pd %td =pd.d_number -if price_line_block.customer_ref? %p Référence commande personnalisée : =price_line_block.customer_ref -if particular_doc -range_part = price_line_block.particular_send -range_part = range_part.particular_ref if range_part.particular_ref -oras = [] -OpenRange.where(:id => (OpenRange.all.ids - range_part.open_ranges.ids)).each do |ora| -oras << ora.name -if oras.size > 0 %p Jour(s) de fermeture : =oras.join(", ") %br %table.table %thead %tr %th Référence %th Désignation %th Qté [U] -if true or @price_document.label != "Avoir" %th Qté [Kg] -if !@bl -if @price_document.label != "Avoir" %th P.U. HT [Kg] %th TVA -if @price_document.label != "Avoir" -if !price_line_block.remise_ecole_ok %th Remise %br Marché %br annuel -if price_line_block.ca_remise_qte_ok %th Remise %br Qté livrée %br ="/cde" -if price_line_block.remise_pre_order_ok %th Remise %br commande %br anticipée -if price_line_block.discount_comptant %th Remise %br comptant -if price_line_block.remise_enrobage_ok %th Remise %br enrobage -else %th Remise %br école -if @price_document.label != "Avoir" %th P.U. Net -else %th P.U. %th Montant HT %tbody -price_line_block.price_lines.each do |price_line| %tr %td =price_line.ref -if price_line.p_product_ref and price_line.p_product_ref.assembled and @bl %br Contient les références primaires suivantes : -price_line.p_product_ref.p_product_assembleds.all.each do |ppa| %br %strong =ppa.qte X =ppa.p_product_ref.p_product.code %td =price_line.title %td.numeraire =price_line.qte -if true or @price_document.label != "Avoir" %td.numeraire =price_line.weight_qte.to_f.round(3) -if !@bl -if @price_document.label != "Avoir" %td.numeraire =number_to_currency price_line.ca_price_u_kg_ht %td.numeraire =price_line.tva_account_value.to_s+"%" -if @price_document.label != "Avoir" -if !price_line_block.remise_ecole_ok %td.numeraire =price_line.discount_market_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_market_ht -if price_line_block.ca_remise_qte_ok %td.numeraire =price_line.discount_qte_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_qte_ht -if price_line_block.remise_pre_order_ok %td.numeraire =price_line.discount_delay_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_delay_ht -if price_line_block.discount_comptant %td.numeraire =price_line.discount_comptant_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_comptant_ht -if price_line_block.remise_enrobage_ok %td.numeraire =price_line.discount_enrobage_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_enrobage_ht -else %td.numeraire =price_line.discount_ecole_percent.to_s+"%" %br =number_to_currency price_line.ca_discount_ecole_ht -if @price_document.label != "Avoir" %td.numeraire =number_to_currency price_line.ca_price_u_kg_net_ht -else %td.numeraire =number_to_currency price_line.ca_price_u_ht %td.numeraire =number_to_currency price_line.tot_amount_ht -if !@bl %table.table{:style => "width:auto;float:right;border-top:0;"} -if @price_document.label != "Avoir" %tr %th{:style => "border-top:0;"} Poids total :    %td.numeraire{:style => "border-top:0;"} ="#{price_line_block.weight_tot}Kg" %tr %th Total remises U. HT : %td.numeraire =number_to_currency price_line_block.cumul_discount_ht %tr %th Total HT %td.numeraire =number_to_currency price_line_block.tot_lines_ht -if @price_document.label != "Avoir" -if price_line_block.tot_discount_ht != 0.0 %tr %th Remise commerciale exceptionnelle (HT ="(#{price_line_block.ct_tot_discount_percent}%)" %td.numeraire =number_to_currency price_line_block.tot_discount_ht %tr %th Frais de port HT ="(TVA #{price_line_block.fdp_tva_rate}%)" %td.numeraire =number_to_currency price_line_block.tot_fdp_ht %tr %th Total HT Net %td.numeraire =number_to_currency price_line_block.tot_amount_ht %tr %th Total TVA %td.numeraire =number_to_currency price_line_block.tot_amount_tva %tr %th Total TTC %td.numeraire =number_to_currency price_line_block.tot_amount_ttc %tr %th   %th %tr %th Net à payer %td.numeraire =number_to_currency price_line_block.tot_amount_ttc -else %table.table{:style => "width:auto;float:right;border-top:0;"} %tr %th{:style => "border-top:0;"} Poids total :    %td.numeraire{:style => "border-top:0;"} ="#{price_line_block.weight_tot}Kg" -if !@bl %br %br %table.table{:style => "width:auto;"} %tr %th Taux %br TVA %th Montant HT Net %th Montant TVA -tva_rates = {} -price_line_block.price_lines.each do |pl| -tva_rates[pl.tva_account_value.to_s] = tva_rates[pl.tva_account_value.to_s] || {:montant => 0.0, :tva => 0.0} -tva_rates[pl.tva_account_value.to_s][:montant] += pl.tot_amount_ht.to_f - (pl.tot_amount_ht.to_f * ((price_line_block.ct_tot_discount_percent and price_line_block.ct_tot_discount_percent != 0.0) ? (price_line_block.ct_tot_discount_percent.to_f/100) : 0.0)) -tva_rates[pl.tva_account_value.to_s][:tva] += pl.tot_amount_tva.to_f - (pl.tot_amount_tva.to_f * ((price_line_block.ct_tot_discount_percent and price_line_block.ct_tot_discount_percent != 0.0) ? (price_line_block.ct_tot_discount_percent.to_f/100) : 0.0.to_f)) -tva_rates[price_line_block.fdp_tva_rate.to_s] = tva_rates[price_line_block.fdp_tva_rate.to_s] || {:montant => 0.0, :tva => 0.0} -tva_rates[price_line_block.fdp_tva_rate.to_s][:montant] += price_line_block.tot_fdp_ht -tva_rates[price_line_block.fdp_tva_rate.to_s][:tva] += price_line_block.tot_fdp_tva -tva_rates.each do |key, value| %tr %td ="#{key}%" %td =number_to_currency value[:montant] %td =number_to_currency value[:tva] -if @bl %div{:style => "width:60%;"} =simple_format price_line_block.bl_comment -if !@bl and @price_document.label != "Avoir" %br %br %table.table{:style => "width:auto;"} %tr %th Échéance %th Mode de paiement %th Montant net %tr %td -if @price_document.label == "Facture" =l @price_document.payment_end_at -else =price_line_block.payment_delais.to_i jours %td =price_line_block.p_payment_type.name if price_line_block.p_payment_type %td =number_to_currency price_line_block.tot_amount_ttc .clear -if @price_document.label == "Facture" %p.legals{:style => "text-align:center;font-size:10px;margin-top:10px;olwen_demo_app"} Pas d'escompte pour paiement anticipé, passée la date d'échéance, tout paiement différé entraine l'application d'une pénalité de 3 fois le taux d'intérêt légal. (loi 2008-776 du 04/08/2008) ainsi qu'une indemnité forfaitaire pour frais de recouvrement de 40 euros (Décret 2012-1115 du 02/10/2012). .clear