TODO: - AJAX for add_p_article and add_stock_movement_p_article in stock_movement views - Fix select p_article with in stock_movement partial view - Fix query to display available p_article in stock_movement partial
114 lines
7.7 KiB
Plaintext
114 lines
7.7 KiB
Plaintext
.qi_header
|
|
|
|
.right
|
|
=#raw @p_customer_sheet.state_html
|
|
=state_helper(@p_customer_sheet.price_line_block.state)
|
|
=#debug @p_customer_sheet.archive_now
|
|
|
|
|
|
|
|
-if !@p_customer_sheet.archived and (current_admin.has_permission?("gestion-des-commandes") or @p_customer_sheet.demande_type.to_s == "Brouillon" or @p_customer_sheet.state == "Validée")
|
|
|
|
= link_to i(:pencil), edit_admin_p_customer_sheet_path(@p_customer_sheet), :remote => false
|
|
|
|
|
|
= breadcrumb
|
|
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
-if @bon_de_commande = @p_customer_sheet.price_documents.where(:cc_label => "Bon de commande").first
|
|
-price_line_block = @bon_de_commande.price_line_block
|
|
%h3
|
|
Contenu du bon de commande
|
|
=@bon_de_commande.d_number
|
|
=":"
|
|
-else
|
|
-price_line_block = @p_customer_sheet.price_line_block
|
|
%h3
|
|
Contenu de la demande de commande :
|
|
|
|
=render price_line_block
|
|
|
|
%hr
|
|
-# status : Brouillon Validée En Préparation En livraison Réceptionné Payée
|
|
|
|
-@bon_de_commande = @p_customer_sheet.price_documents.where(:cc_label => "Bon de commande client").first
|
|
-state = @p_customer_sheet.state
|
|
-if !state = "Refusée" and !state = "Validée" and !state = "En Préparation" and !state = "En Livraison" and !state = "Payée"
|
|
%p=link_to "Marquer l'offre comme refusée", reject_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn", style: "background:rgb(110,45,116); color: white;"
|
|
-if !state = "Refusée" and state = "Brouillon" and !state = "Validée" and !state = "En Préparation" and !state = "En Livraison" and !state = "Payée"
|
|
%p=link_to "Générer le bon de commande et marquer la commande comme Validée", generate_bc_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-success btn-ap-add disabled" if !@p_customer_sheet.stock_generable
|
|
%p=link_to "Générer le bon de commande et marquer la commande comme Validée", generate_bc_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-success btn-ap-add" if @p_customer_sheet.stock_generable
|
|
|
|
- if @bon_de_commande
|
|
-# %p=link_to "Générer le devis", generate_d_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
|
-if !state = "Refusée" and state = "Validée" and !state = "En Livraison" and !state = "Payée"
|
|
%p=link_to "Passer la commande en Préparation", admin_p_customer_sheet_path(:id => @p_customer_sheet.id, :p_customer_sheet => {:state => "Préparation"}), :method => :put, :class => "btn", style: "background:rgb(233,122,28); color: white" if !@bon_de_commande.stock_ok and @bon_de_commande.stock_generable
|
|
-if !state = "Refusée" and !state = "Validée" and state = "En Préparation" and !state = "En Livraison" and !state = "Payée"
|
|
%p=link_to "Générer le bon de livraison et marquer la commande comme Livraison", bl_admin_price_document_path(@bon_de_commande), :class => "btn btn-primary btn-ap-add"
|
|
%p=link_to "Passer la commande en Livraison", admin_p_customer_sheet_path(:id => @p_customer_sheet.id, :p_customer_sheet => {:state => "Livraison"}), :method => :put, :class => "btn", style: "background:rgb(66,122,255); color: white" if !@bon_de_commande.stock_ok and @bon_de_commande.stock_generable
|
|
-if !state = "Refusée" and !state = "Validée" and !state = "En Préparation" and state = "En Livraison" and !state = "Payée"
|
|
%p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
|
|
|
|
|
%p=link_to "Mettre à jour les stocks", update_stocks_admin_price_document_path(@bon_de_commande), :class => "btn btn-primary" if !@bon_de_commande.stock_ok and @bon_de_commande.stock_generable
|
|
|
|
-if false
|
|
-if @p_customer_sheet.demande_type?
|
|
%p
|
|
Demande lors de la saisie :
|
|
%strong=@p_customer_sheet.demande_type
|
|
.right{:style => "text-align:right;"}
|
|
-if current_admin.has_permission?("gestion-des-commandes")
|
|
-if @p_customer_sheet.state == "Brouillon"
|
|
%p
|
|
-if @p_customer_sheet.price_blocked
|
|
=link_to ic(:unlock)+" Débloquer les prix", block_price_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-default"
|
|
-else
|
|
=link_to ic(:lock)+" Bloquer les prix", block_price_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-default"
|
|
-if @p_customer_sheet.state == "Brouillon" or @p_customer_sheet.state == "offre"# or @p_customer_sheet.state == "Validée"
|
|
-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 disabled" if !@p_customer_sheet.stock_generable
|
|
%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" if @p_customer_sheet.stock_generable
|
|
%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 "
|
|
-if( @p_customer_sheet.state == "Validée" or (@p_customer_sheet.state == "en livraison" and @p_customer_sheet.price_documents.where(:cc_label => "Bon de livraison", :cancelled => false).count == 0)) and @bon_de_commande
|
|
-if price_line_block.nbr_ship
|
|
%p
|
|
-if @bon_de_commande.label == "Bon de commande" and @p_customer_sheet and @p_customer_sheet.price_documents.where(:cc_label => "Bon de livraison", :cancelled => false).count == 0
|
|
= link_to ic(:pencil)+" Modifier le bon de commande", edit_admin_price_document_path(:id => @bon_de_commande.id, :public_edit => true), :class => "btn btn-default"
|
|
=link_to "Générer le bon de livraison", bl_admin_price_document_path(@bon_de_commande), :class => "btn btn-primary btn-ap-add"
|
|
-else
|
|
%p=link_to "Indiquer le nombre de colis à livrer", edit_ship_admin_price_document_path(@bon_de_commande), :class => "btn btn-default"
|
|
-elsif @bon_de_commande
|
|
-if (@bon_de_commande.price_line_block.price_lines.sum(:qte) > PriceLine.where(:price_line_block_id => PriceLineBlock.where(:price_lineable_type => "PriceDocument", :price_lineable_id => @p_customer_sheet.price_documents.where(:cancelled => false, :cc_label => "Bon de livraison").ids)).sum(:qte))
|
|
=link_to "Générer un bon de livraison pour le reliquat", bl_admin_price_document_path(@bon_de_commande), :class => "btn btn-primary btn-ap-add"
|
|
|
|
|
|
|
|
.clear
|
|
|
|
|
|
-params[:search][:per_page] = params[:search][:per_page] || 50
|
|
-per_page = params[:search][:per_page]
|
|
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
|
-@price_documents = @p_customer_sheet.price_documents.order("date ASC, created_at ASC")
|
|
-if params[:price_document_ids]
|
|
-@price_documents = @price_documents.where(:id => params[:price_document_ids])
|
|
-@price_documents = sort_by_sorting(@price_documents, "created_at ASC")
|
|
-@price_documents = @price_documents.page(page).per(per_page)
|
|
|
|
- if @price_documents.exists?
|
|
%h3 Documents liés à l'offre
|
|
#bills
|
|
%br
|
|
.clear
|
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
|
|
|
|
|
|
|
:javascript
|
|
$('.p_articles_lines').hide();
|
|
|