.qi_header .right =raw @p_customer_sheet.state_html =#debug @p_customer_sheet.archive_now -if !@p_customer_sheet.archived or @p_customer_sheet.state == "commande" = link_to i(:pencil), edit_admin_p_customer_sheet_path(@p_customer_sheet), :remote => false %h1 Ventes %span =link_to "Offres",admin_p_customer_sheets_path .qi_row .qi_pannel.qi_plain.padding %h3 Client -if @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.particular =render :partial => "admin/p_customers/apercu", :locals => {:particular => @p_customer_sheet.p_customer.particular} %table.table{:style => ""} %tr %td{:style => "border:0"} %h3 Adresse de facturation =render(:partial => "admin/particulars/particular_detail", :locals => {:particular => @p_customer_sheet.particular_bill}) if @p_customer_sheet.particular_bill %td{:style => "border:0"} %h3 Adresse de livraison =render(:partial => "admin/particulars/particular_detail", :locals => {:particular => @p_customer_sheet.particular_send}) if @p_customer_sheet.particular_send -price_line_block = @p_customer_sheet.price_line_block %p Date de commande : =l price_line_block.creation_date %p Date de livraison souhaitée : =#l price_line_block.wish_date %p Nombre de colis : =price_line_block.nbr_ship -if price_line_block.customer_ref? %p Référence commande personnalisée : =price_line_block.customer_ref %table.table %thead %tr %th Référence %th Désignation %th Qté %th P.U. HT %th TVA %th Montant HT %tbody -price_line_block.price_lines.each do |price_line| %tr %td =price_line.ref %td Forfait ="#{price_line.qte}J location" =price_line.title -if price_line.ship_price_ht > 0.0 ="+ livraison incluse" %br Livraison : =l price_line.ship_at, :format => :short_date if price_line.ship_at %br Récupération : =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) %br %br Caution : chèque de =number_to_currency price_line.caution non encaissé %td.numeraire =price_line.qte %td.numeraire =price_line.price_u_ht %td.numeraire =price_line.tva_account_value.to_s+"%" %td.numeraire =number_to_currency price_line.tot_amount_ht %table.table{:style => "width:auto;float:right;"} %tr %th Total HT %td.numeraire =number_to_currency price_line_block.tot_lines_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 %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] %table.table{:style => "width:auto;"} %tr %th Échéance %th Mode de paiement %th Montant net %tr %td =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 %hr .right -if @p_customer_sheet.state == "brouillon" or @p_customer_sheet.state == "offre"# or @p_customer_sheet.state == "commande" -if @p_customer_sheet.state == "brouillon" %p=link_to "Générer le devis", generate_d_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary" %p=#link_to "Générer la facture proforma", generate_fp_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary" %p=#link_to "Générer le bon de commande", generate_bc_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-success btn-ap-add" %p=link_to "Marquer l'offre comme refusée", reject_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-error " %p=link_to "Générer le contrat", generate_c_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-success btn-ap-add" %p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-add" -if @p_customer_sheet.state == "commande" %p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-add" -if @p_customer_sheet.state == "en livraison" # or @p_customer_sheet.state == "remboursée" -if false or @p_customer_sheet.state == "remboursée" %p= link_to ic(:pencil)+" Modifier l'adresse, le client, ou le montant avant de re-facturer", edit_admin_p_customer_sheet_path(@p_customer_sheet), :remote => false, :class => "btn btn-warning" %p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-add" .clear %hr %h3 Documents %table.table.table-hover.table-striped %tr %th Code client %th Commercial %th Client %th Type %th Numéro %th Date %th Montant HT %th TVA %th Montant TTC %th Soldé ? %th Restant dû %th.actions %tbody#p_customer_sheets_rows =render @p_customer_sheet.price_documents.order("date DESC, created_at DESC") -if false %h3 Résumé -if @p_customer_sheet.cust_ref? Référence client : %strong=@p_customer_sheet.cust_ref -if false %table %tr %td =number_to_currency @p_customer_sheet.a_ok_total %td =number_to_currency @p_customer_sheet.a_total_cost_ok =render :partial => "admin/p_sheet_lines/p_sheet_lines", :locals => {:sheet_lines => @p_customer_sheet.p_sheet_lines, :ok => (@p_customer_sheet.state_ok?) } %table.en-tete-table{:style => "width:auto;position:relative;top:-40px;"} %tr %th Conditions de réglement %tr %td{:style => "width:150px;"} -if @p_customer_sheet.p_payment_type =@p_customer_sheet.p_payment_type.name %br -if @p_customer_sheet.comptant Comptant -else =@p_customer_sheet.payment_delais.to_i j nets .right %p Demande lors de la saisie : %strong =@p_customer_sheet.demande_type -if @p_customer_sheet.state == "brouillon" or @p_customer_sheet.state == "offre" or @p_customer_sheet.state == "commande" %p=link_to "Générer le devis", generate_d_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary" %p=link_to "Générer la facture proforma", generate_fp_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary" %p=link_to "Générer le bon de commande", generate_bc_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-ap-add" %p=link_to "Marquer l'offre comme refusée", reject_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-danger" -if @p_customer_sheet.state == "commande" and @p_customer_sheet.p_sheet_lines.joins(:p_product).where("bl = 0 and (p_products.p_product_cat_id != 6 OR (p_products.p_product_cat_id = 6 and externe = 1))").count > 0 %p=link_to "Générer le bon de livraison", generate_bl_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-add" -if @p_customer_sheet.state == "livrée" or @p_customer_sheet.state == "remboursée" -if @p_customer_sheet.state == "remboursée" %p= link_to ic(:pencil)+" Modifier l'adresse, le client, ou le montant avant de re-facturer", edit_admin_p_customer_sheet_path(@p_customer_sheet), :remote => false, :class => "btn btn-warning" %p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary btn-ap-add" .clear %h3 Documents =#["brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"] =#debug @p_customer_sheet.p_documents.first.save %table.table.table-hover.table-striped %tr %th Date %th Client %th Type %th Numéro %th Total HT %th Total TTC %th.actions %tbody#p_customer_sheets_rows =render @p_customer_sheet.p_documents.order("created_at DESC")