62 lines
1.8 KiB
Plaintext
62 lines
1.8 KiB
Plaintext
.qi_header
|
|
.right
|
|
= link_to i(:pencil), edit_admin_p_customer_path(@p_customer), :remote => true
|
|
%h1
|
|
Clients
|
|
%span
|
|
Détail d'un client
|
|
|
|
|
|
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
|
|
|
|
=render :partial => "admin/p_customers/apercu.html.haml", :locals => {:particular => @p_customer.particular, :mask_fin => true}
|
|
|
|
|
|
= @p_customer.archive_import
|
|
|
|
|
|
|
|
|
|
|
|
-if false
|
|
|
|
-past_fact = @p_customer.p_documents.where("d_number regexp '^[0-9]+'").order("created_at DESC")
|
|
-if past_fact.first
|
|
=date = past_fact.first.created_at + 1.second
|
|
=amount = past_fact.sum(:cache_total_ttc)
|
|
-if !@p_customer.p_payments.where(:p_payment_type_id => 66).first
|
|
AAAAA
|
|
-p_payment = @p_customer.p_payments.new(:p_payment_type_id => 66, :imported => true, :paid => true, :paid_at => date, :amount => amount)
|
|
|
|
-p_payment.save
|
|
|
|
%table.table
|
|
=render past_fact
|
|
|
|
-PPayment.where(:imported => true).update_all(:paid => true)
|
|
-date = nil
|
|
|
|
-@p_customer.p_payments.order("paid_at DESC").each do |pp|
|
|
-enc = @p_customer.encours_at(pp.paid_at)
|
|
%p
|
|
|
|
=l pp.paid_at, :format => :date
|
|
=":"
|
|
=number_to_currency enc
|
|
=":"
|
|
=@p_customer.sheets_total_ttc(pp.paid_at)
|
|
=":"
|
|
=@p_customer.paiements_total(pp.paid_at)
|
|
|
|
-if enc == 0.0
|
|
-date = pp.paid_at.end_of_day
|
|
-break
|
|
|
|
-@p_customer.p_customer_sheets.where(:state => "facturée", :imported => true).where("created_at < ?", date).update_all(:i_archive => true)
|
|
-@p_customer.p_documents.where(:label => "Facture", :imported => true).where("created_at < ?", date).update_all(:i_archive => true)
|
|
|
|
-@p_customer.p_payments.where(:imported => true).where("paid_at < ?", date).update_all(:i_archive => true) if date |