This commit is contained in:
Nicolas Bally 2020-04-13 11:43:32 +02:00
parent fbf9d71321
commit c275389288
8 changed files with 46 additions and 13 deletions

View File

@ -86,7 +86,7 @@ class Admin::PPaymentsController < ApplicationController
def index
@p_payments = PPayment.includes(:p_payment_type)
@p_payments = @p_payments.where(:paid => true)
params[:p_payment_type_ids] = params[:p_payment_type_ids] || []
@p_payments = @p_payments.where(:p_payment_type_id => params[:p_payment_type_ids]) if params[:p_payment_type_ids].size > 0

View File

@ -12,6 +12,34 @@ class PriceLine < ApplicationRecord
acts_as_caching :fields => [:ship_price_ht, :caution, :credits, :permis_b, :stage_remorque, :permis_remorque, :carburant, :carburant_type, :carburant_price, :carburant_mention, :carburant_reservoir, :age_min, :cg, :accessoire, :sale_account, :p_product_cat_id, :weight_u, :weight_tot, :accounting_zone_id, :accounting_zone_name, :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 ca_carburant
if self.ct_carburant?
self.ct_carburant
elsif self.p_product_ref and self.p_product_ref.p_product
self.p_product_ref.p_product.carburant
end
end
def ca_carburant_type
if self.ct_carburant_type?
self.ct_carburant_type
elsif self.p_product_ref and self.p_product_ref.p_product
self.p_product_ref.p_product.carburant_type
end
end
def ca_carburant_price
if self.ct_carburant_price?
self.ct_carburant_price
elsif self.p_product_ref and self.p_product_ref.p_product
self.p_product_ref.p_product.carburant_price
end
end
def ca_caution
if self.ct_caution?

View File

@ -91,8 +91,8 @@
= f.input :price_we_ht, :label => "Prix WE HT :"
= f.input :price_min_ht, :label => "Prix sacrifié :"
= f.input :serial_no, :label => "Numéro de série :"
= f.input :buy_at, :label => "Date d'achat :"
= f.input :producted_at, :label => "Date de production :"
= f.input :buy_at, :label => "Date d'achat :", :as => :date
= f.input :producted_at, :label => "Date de production :", :as => :date
= f.input :permis_b, :label => "Permis B nécessaire ?"
= f.input :stage_remorque, :label => "Stage remorque nécessaire :"
= f.input :permis_remorque, :label => "Permis remorque nécessaire :"

View File

@ -48,7 +48,7 @@
= link_to i(:"check-circle-o"), generate_number_admin_price_document_path(price_document), data: { confirm: 'Voulez-vous vraiment valider cette facture et générer son numéro ? ' }
-else
= link_to i(:"credit-card"), paid_by_ogone_admin_price_document_path(price_document.token), :remote => false, :target => "_blank" if price_document.to_paid_ttc > 0.0
= link_to i(:"credit-card"), paid_by_ogone_admin_price_document_path(price_document.token), :remote => false, :target => "_blank" if price_document.to_paid_ttc > 0.0 and price_document.price_document_type_id == 1
=# link_to i(:eye), admin_price_document_path(price_document), :remote => true

View File

@ -5,7 +5,7 @@
body{
font-size:12px;
font-family:arial, sans-serif;
-webkit-font-smoothin:antialiased;
.table{
border-collapse:collapse;
font-family:arial, sans-serif;
@ -211,8 +211,13 @@
=l price_line.return_at, :format => :short_date if price_line.return_at
%br
Carburant : livrée réservoir plein, rendu plein, remise à niveau GNR 1,20€ HT / litres (1,44€ TTC)
-if price_line.carburant
%br
Carburant : livrée réservoir plein, rendu plein, remise à niveau :
=price_line.carburant_type
=number_to_currency price_line.carburant_price
HT / litres
="(#{number_to_currency(price_line.carburant_price*(price_line.tva_account_value/100+1))} TTC)"
%br
%br

View File

@ -9,11 +9,7 @@
=ic :arrows
%td
= form.input :ct_title, :label => "Désignation personnalisée :"
= form.input :ct_description, :label => "Description personnalisée :", :input_html => {:style => "height:70px;"}
%td{:style => "width:300px"}
%label Produit :
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
@ -91,6 +87,10 @@
} );
= form.input :ct_title, :label => "Désignation personnalisée :"
= form.input :ct_description, :label => "Description personnalisée :", :input_html => {:style => "height:70px;"}

View File

@ -53,7 +53,7 @@
=ic :"cubes"
Produits
.element
=link_to admin_price_documents_path do
=link_to admin_price_documents_path("price_document_type_ids[]" => 1) do
.cat#big_cat_documents
=ic :"file-text-o"
Documents

2
pdf.js
View File

@ -5,7 +5,7 @@ const puppeteer = require('puppeteer');
const createPdf = async() => {
let browser;
try {
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox', '--font-render-hinting=medium']});
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox', '--font-render-hinting=none', '--disable-gpu']});
const page = await browser.newPage();
//await page.setViewport({width: 794, height: 1122, deviceScaleFactor: 1});
await page.goto(process.argv[2], {timeout: 3000, waitUntil: 'networkidle2'});