From f642bb86db2e7f47a6d1ca9bb4d1414e472578c9 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Wed, 3 Jul 2019 15:37:00 +0200 Subject: [PATCH] suite --- app/models/p_document.rb | 6 +++++- app/models/p_payment.rb | 2 +- app/views/admin/p_customer_sheets/show.html.haml | 11 +++++++++++ app/views/admin/p_documents/_p_document.html.haml | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/models/p_document.rb b/app/models/p_document.rb index 5cf2017..30a3511 100644 --- a/app/models/p_document.rb +++ b/app/models/p_document.rb @@ -347,7 +347,11 @@ class PDocument < ActiveRecord::Base def echeance - d = self.created_at + if self.created_at? + d = self.created_at + else + d = Time.now + end if self.comptant d else diff --git a/app/models/p_payment.rb b/app/models/p_payment.rb index 26456a0..de63e41 100644 --- a/app/models/p_payment.rb +++ b/app/models/p_payment.rb @@ -69,7 +69,7 @@ class PPayment < ActiveRecord::Base self.p_payment_documents.each do |ppd| r += ppd.amount.to_f end - return r + return r.round(2) end def paid_date_needed? diff --git a/app/views/admin/p_customer_sheets/show.html.haml b/app/views/admin/p_customer_sheets/show.html.haml index 599342d..1f24112 100644 --- a/app/views/admin/p_customer_sheets/show.html.haml +++ b/app/views/admin/p_customer_sheets/show.html.haml @@ -119,11 +119,22 @@ %table.table %tr + %th Date + %th Offre + %th Client %th Type %th Numéro %th Total HT %th Total TTC + %th + Payée + %th Solde + %th Echéance + + %th Jours de retard + %th + %tbody#p_customer_sheets_rows diff --git a/app/views/admin/p_documents/_p_document.html.haml b/app/views/admin/p_documents/_p_document.html.haml index 1f5af39..bd6294d 100644 --- a/app/views/admin/p_documents/_p_document.html.haml +++ b/app/views/admin/p_documents/_p_document.html.haml @@ -84,7 +84,7 @@ - -if !@p_customer_sheet + -if !@p_customer_sheet or true %td =link_to "##{p_document.element.id}", admin_p_customer_sheet_path(p_document.element)