156 lines
4.1 KiB
Plaintext
156 lines
4.1 KiB
Plaintext
-if !params[:detail]
|
|
|
|
%tr#p_document{:id => p_document.id}
|
|
|
|
|
|
|
|
-if @case_multiple
|
|
%td
|
|
=check_box_tag "ids[]", p_document.token
|
|
|
|
|
|
|
|
%td
|
|
= ic :history if p_document.i_archive
|
|
=l p_document.created_at, :format => :date
|
|
|
|
|
|
|
|
-if !@p_customer_sheet
|
|
%td
|
|
=link_to "##{p_document.element.id}", admin_p_customer_sheet_path(p_document.element)
|
|
|
|
-if p_document.p_customer
|
|
%td
|
|
=link_to p_document.p_customer.show_name, [:admin, p_document.p_customer]
|
|
|
|
|
|
|
|
%td
|
|
=p_document.label
|
|
%td
|
|
-if !p_document.imported
|
|
=link_to p_document.d_number, admin_p_document_path(p_document.token), :target => "_blank"
|
|
-else
|
|
=p_document.d_number
|
|
(importé)
|
|
|
|
|
|
%td.numeraire
|
|
= number_to_currency p_document.cache_total_ht
|
|
HT
|
|
|
|
%td.numeraire
|
|
= number_to_currency p_document.cache_total_ttc
|
|
|
|
TTC
|
|
|
|
|
|
-if false
|
|
%td
|
|
="oui" if p_document.theo_paid
|
|
%td
|
|
="oui" if p_document.paid
|
|
|
|
%td.numeraire
|
|
-if p_document.cache_to_paid?
|
|
=number_to_currency p_document.cache_to_paid
|
|
TTC
|
|
|
|
%td
|
|
=l p_document.echeance_date, :format => :date
|
|
%td
|
|
=(Date.today - p_document.echeance_date).to_i
|
|
|
|
|
|
%td.actions
|
|
-if p_document.label == "Facture" and !@relances
|
|
-if p_document.relative_docs.where(:label => "Avoir").count == 0 or true
|
|
=link_to "Créer un avoir", create_avoir_admin_p_document_path(p_document), :data => {:confirm => "Voulez-vous vraiment créer un avoir ?"}
|
|
|
|
=link_to i(:eye), detail_admin_p_document_path(p_document), :remote => false
|
|
|
|
-if p_document.compta_locked
|
|
=ic :lock
|
|
-else
|
|
=link_to i(:pencil), edit_admin_p_document_path(p_document), :remote => true
|
|
|
|
|
|
|
|
-else
|
|
-p_document.p_sheet_lines.each do |sheet_line|
|
|
%tr
|
|
%td="#"+p_document.id.to_s
|
|
%td
|
|
=l p_document.created_at, :format => :date
|
|
|
|
%td
|
|
=link_to "##{p_document.element.id}", admin_p_customer_sheet_path(p_document.element) if p_document.element
|
|
|
|
%td
|
|
-if p_document.p_customer
|
|
=link_to p_document.p_customer.code, [:admin, p_document.p_customer]
|
|
%td
|
|
-if p_document.p_customer
|
|
=link_to p_document.p_customer.show_name, [:admin, p_document.p_customer]
|
|
|
|
|
|
|
|
%td
|
|
=p_document.label
|
|
%td
|
|
-if !p_document.imported
|
|
=link_to p_document.d_number, admin_p_document_path(p_document.token)
|
|
-else
|
|
=p_document.d_number
|
|
(importé)
|
|
|
|
|
|
-ok = (sheet_line.shiped or p_document.label == "Avoir") ? true : false
|
|
|
|
%td
|
|
=sheet_line.p_product.code
|
|
%td
|
|
=sheet_line.p_product.name
|
|
-if ok
|
|
%td
|
|
=sheet_line.ok_qte
|
|
|
|
%td
|
|
=number_to_currency sheet_line.ok_price, :precision => 5 if sheet_line.ok_price
|
|
|
|
%td
|
|
=number_to_currency sheet_line.ok_price_tot if sheet_line.ok_price_tot
|
|
-@totals[:ht] = @totals[:ht].to_f + sheet_line.ok_price_tot
|
|
%td
|
|
-tva = (sheet_line.ok_price_tot * sheet_line.tva).to_f.round(2)
|
|
=number_to_currency tva if tva
|
|
-@totals[:tva] = @totals[:tva].to_f + tva
|
|
%td
|
|
=number_to_currency sheet_line.ok_price_tot_ttc if sheet_line.ok_price_tot_ttc
|
|
-@totals[:ttc] = @totals[:ttc].to_f + sheet_line.ok_price_tot_ttc
|
|
-else
|
|
%td
|
|
=sheet_line.qte
|
|
|
|
|
|
%td
|
|
=number_to_currency sheet_line.price, :precision => 5 if sheet_line.price
|
|
|
|
%td
|
|
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
|
|
|
-@totals[:ht] = @totals[:ht].to_f + sheet_line.price_tot
|
|
|
|
%td
|
|
-tva = (sheet_line.price_tot * sheet_line.tva).to_f.round(2)
|
|
=number_to_currency tva if tva
|
|
-@totals[:tva] = @totals[:tva].to_f + tva
|
|
|
|
%td
|
|
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
|
|
|
-@totals[:ttc] = @totals[:ttc].to_f + sheet_line.price_tot_ttc
|
|
|
|
|
|
|