This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/views/admin/price_documents/_price_document.html.haml

209 lines
8.7 KiB
Plaintext

%tr#price_document_row{:id => price_document.id}
- if price_document.doc_ref_id.present?
- parent_doc = PriceDocument.find(price_document.doc_ref_id)
-else
- parent_doc = nil
-tr = {}
-tr[:p_payment_type] = capture do
%td= price_document.price_line_block.p_payment_type.name if price_document.price_line_block and price_document.price_line_block.p_payment_type
-tr[:p_customer_code] = capture do
%td
= price_document.p_customer.code if price_document.p_customer
-tr[:p_commercial] = capture do
%td
= price_document.p_customer.p_commercial.long_name if price_document.p_customer and price_document.p_customer.p_commercial
-tr[:p_customer] = capture do
%td
= price_document.p_customer.show_name if price_document.p_customer
-tr[:p_fournisseur] = capture do
%td
- if price_document.price_document_type.label == "Réponse fournisseur"
-if price_document.p_fournisseur.present?
= price_document.p_fournisseur.name
- else
=link_to ic('pencil') + " rapprocher le fournisseur", match_p_fournisseur_admin_price_document_path(price_document), remote: true
-else
= price_document.p_fournisseur.name if price_document.p_fournisseur
-tr[:com_counter] = capture do
%td
=link_to price_document.ref_element.com_counter, [:admin, price_document.ref_element] if price_document.ref_element and price_document.ref_element_type == "PCustomerSheet"
-tr[:label] = capture do
%td
=price_document.label
-tr[:d_number] = capture do
%td
=price_document.d_number
-tr[:cc_cost_ht] = capture do
%td
=number_to_currency price_document.cost_ht if current_admin.has_permission?("show-costs")
-tr[:cc_marge_ht] = capture do
%td
=number_to_currency price_document.marge_ht if current_admin.has_permission?("show-costs")
-tr[:cc_to_paid_ttc] = capture do
%td
-if price_document.label == "Facture"
=number_to_currency price_document.cc_to_paid_ttc
-tr[:reste_to_affect] = capture do
%td
-if price_document.label == "Avoir"
=number_to_currency price_document.cc_to_paid_ttc
-tr[:f_token] = capture do
%td
= consult_admin_price_document_url(:id => price_document.f_token, :lang => nil)
-tr[:avancement] = capture do
%td
- if price_document.avancement
= price_document.avancement.to_s + " %"
- elsif parent_doc and parent_doc.avancement
= parent_doc.avancement.to_s + " %"
-tr[:list_designaton] = capture do
%td
-if price_document.list_designaton
= price_document.list_designaton
-elsif parent_doc
=parent_doc.list_designaton
-tr[:end_date] = capture do
%td
-if price_document.end_date
=price_document.end_date
-elsif parent_doc and parent_doc.end_date
=parent_doc.end_date
-tr[:dp_comment] = capture do
%td
-if price_document.dp_comment
= price_document.dp_comment
-elsif parent_doc
=parent_doc.dp_comment
-tr[:acheteur_text] = capture do
%td
-if price_document.acheteur_text
= price_document.acheteur_text
-elsif parent_doc
=parent_doc.acheteur_text
-tr[:customer_ref] = capture do
%td
-if price_document.price_line_block.present?
= price_document.price_line_block.customer_ref
-tr[:stock_ok] = capture do
%td
-if !price_document.imported
-if price_document.block_type == "Facture d'achat"
-if price_document.stock_ok
Oui
-else
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(price_document), :class => "btn btn-primary"
-elsif price_document.price_document_type_id == 4 or price_document.price_document_type_id == 5
-if !price_document.cost_ok
=link_to "Mettre à jour les stocks, calculer la marge", update_stocks_admin_price_document_path(price_document), :class => "btn btn-primary"
-else
Oui
-tr[:date] = capture do
%td
=l price_document.date, :format => :date
-tr[:tot_amount_ht] = capture do
%td.numeraire=number_to_currency price_document.tot_amount_ht, :unit => price_document.devise_symbol
-tr[:tot_amount_tva] = capture do
%td.numeraire=number_to_currency price_document.tot_amount_tva, :unit => price_document.devise_symbol
-tr[:tot_amount_ttc] = capture do
%td.numeraire=number_to_currency price_document.tot_amount_ttc, :unit => price_document.devise_symbol
-tr[:solded] = capture do
%td
="oui" if price_document.solded if price_document.price_document_type and price_document.price_document_type.accounting
-tr[:to_paid_ttc] = capture do
%td
=number_to_currency price_document.to_paid_ttc, :unit => price_document.devise_symbol if price_document.price_document_type and price_document.price_document_type.accounting
-tr[:actions] = capture do
%td.actions
-if price_document.price_document_type.label == "Demande prix"
=link_to i("bar-chart"), analyse_reponses_admin_price_document_path(price_document)
-if !price_document.imported
-if current_admin.has_permission?("payments")
-if !price_document.d_number?
= link_to i(:"trash-o"), [:admin, price_document], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
= link_to i(:pencil), edit_admin_price_document_path(price_document)
-if price_document.label != "Facture"
-if price_document.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 i(:pencil), edit_admin_price_document_path(:id => price_document.id, :public_edit => true)
=#link_to "Générer le bon de livraison", bl_admin_price_document_path(price_document), :class => "btn btn-primary btn-ap-add"
-elsif price_document.label == "Avoir"
= link_to "Lettrage", edit_lettrage_admin_price_document_path(:id => price_document.id)
= link_to i(:pencil), edit_admin_price_document_path(:id => price_document.id, :public_edit => true)
=#link_to "Générer le bon de livraison", bl_admin_price_document_path(price_document), :class => "btn btn-primary btn-ap-add"
-if price_document.label == "Facture"
=link_to "Créer un avoir", create_avoir_admin_price_document_path(price_document)
-if price_document.label == "Bon de livraison" and @p_customer_sheet
-if @p_customer_sheet.price_documents.where(:cc_label => "Facture", :bon_de_livraison_id => price_document.id).count == 0
-if price_document.cancelled
%span.red
Document annulé
-else
=link_to "Annuler", cancel_now_admin_price_document_path(price_document), :class => "btn btn-danger", :data => {:confirm => "Voulez-vous vraiment annuler ce BL (impossible de revenir en arrière)"}
= link_to i(:pencil), edit_admin_price_document_path(:id => price_document.id, :public_edit => true)
=link_to "Générer la facture", bill_admin_price_document_path(price_document), :class => "btn btn-primary btn-ap-add", :onclick => "$(this).replaceWith('Sauvegarde en cours...');"
=# link_to i(:eye), admin_price_document_path(price_document), :remote => true
= link_to i(:eye), admin_price_document_path(price_document.id), :remote => false
-if PriceLineBlock::PURCHASE_BLOCKS.include?(price_document.block_type)
=# link_to i(:eye), admin_price_document_path(price_document.id), :remote => false
-if !price_document.stock_ok
= link_to i(:pencil), edit_admin_price_document_path(:id => price_document.id, :public_edit => true)
-else
= link_to i(:download), print_admin_price_document_path(price_document.token), :remote => false, :target => "_blank"
= diag do
= link_to i(:pencil), edit_admin_price_document_path(price_document)
= link_to i(:eye), admin_price_document_path(price_document.id), :remote => false, :target => "_blank"
-if price_document.cc_label == "Bon de réception achat"
%br
=link_to "Générer la factureeee", facture_achat_admin_price_document_path(price_document)
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_document}