Merge remote-tracking branch 'origin/philippe-sortiedestock'
This commit is contained in:
commit
40f1a8db0b
@ -214,7 +214,7 @@ class Admin::BuyListsController < ApplicationController
|
||||
|
||||
def reject
|
||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||
@p_customer_sheet.state = "refusée"
|
||||
@p_customer_sheet.state = "Refusée"
|
||||
|
||||
@p_customer_sheet.save
|
||||
@p_customer_sheet.archive_now if !@p_customer_sheet.archived
|
||||
|
@ -175,20 +175,14 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
def create
|
||||
@p_customer_sheet = PCustomerSheet.new(params.require(:p_customer_sheet).permit!)
|
||||
@p_customer_sheet.admin = current_admin
|
||||
@p_customer_sheet.price_line_block.particular_send = @p_customer_sheet.price_line_block.particular_bill if params[:p_customer_sheet][:price_line_block_attributes][:same_adress] == "oui"
|
||||
|
||||
if @p_customer_sheet.save
|
||||
|
||||
redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
|
||||
else
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts params
|
||||
puts @p_customer_sheet.errors.messages
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
@p_customer = @p_customer_sheet.price_line_block.p_customer
|
||||
|
||||
render action: "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -233,7 +227,7 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
redirect_back(fallback_location: admin_p_customer_sheets_path)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def generate_bc
|
||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||
@p_customer_sheet.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1)
|
||||
@ -264,7 +258,7 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
def reject
|
||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||
@p_customer_sheet.state = "refusée"
|
||||
@p_customer_sheet.state = "Refusée"
|
||||
|
||||
@p_customer_sheet.save
|
||||
@p_customer_sheet.archive_now if !@p_customer_sheet.archived
|
||||
@ -369,6 +363,5 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -44,21 +44,26 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
|
||||
def admin_space
|
||||
if (params[:document_type] and (params[:document_type] == "Facture d'achat" or params[:document_type] == "Commande achat")) or [6,7].include?(params[:price_document_type_id].to_i) or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7"))) or (params[:id] and d = PriceDocument.where(:id => params[:id]).first and [6,7].include?(d.price_document_type_id))
|
||||
@admin_space = "documents"
|
||||
|
||||
qi_menu(:documents)
|
||||
|
||||
else
|
||||
# if (params[:document_type] and (params[:document_type] == "Facture d'achat" or params[:document_type] == "Commande achat")) or [6,7].include?(params[:price_document_type_id].to_i) or (params[:price_document_type_ids] and (params[:price_document_type_ids].include?("6") or params[:price_document_type_ids].include?("7"))) or (params[:id] and d = PriceDocument.where(:id => params[:id]).first and [6,7].include?(d.price_document_type_id))
|
||||
if PriceDocument::PURCHASES.include?(params[:document_type]) or (params[:price_document_type_id].present? and PriceDocument::PURCHASES.include?(PriceDocumentType.find(params[:price_document_type_id].to_i).label)) or (params[:id] and d = PriceDocument.where(:id => params[:id]).first and PriceDocument::PURCHASES.include?(d.price_document_type.label)) or (params[:price_document_type_ids].present? and params[:price_document_type_ids] == PriceDocumentType.where(label: PriceDocument::PURCHASES).ids.map{|id| id.to_s})
|
||||
|
||||
@admin_space = "achats"
|
||||
|
||||
qi_menu(:achats)
|
||||
|
||||
elsif PriceDocument::SALES.include?(params[:document_type]) or (params[:price_document_type_id].present? and PriceDocument::SALES.include?(PriceDocumentType.find(params[:price_document_type_id].to_i).label)) or (params[:id] and d = PriceDocument.where(:id => params[:id]).first and PriceDocument::SALES.include?(d.price_document_type.label)) or (params[:price_document_type_ids].present? and params[:price_document_type_ids] == PriceDocumentType.where(label: PriceDocument::SALES).ids.map{|id| id.to_s})
|
||||
@admin_space = "ventes"
|
||||
|
||||
qi_menu(:ventes)
|
||||
|
||||
else
|
||||
@admin_space = "documents"
|
||||
|
||||
qi_menu(:documents)
|
||||
end
|
||||
|
||||
@admin_space = "documents"
|
||||
# @admin_space = "documents"
|
||||
|
||||
qi_menu(:documents)
|
||||
# qi_menu(:documents)
|
||||
|
||||
end
|
||||
|
||||
@ -551,28 +556,24 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
if @p_customer_sheet
|
||||
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Bon de livraison"), :bon_de_commande_id => @past_price_document.id, :date => Date.today)
|
||||
price_document.p_customer = @past_price_document.p_customer
|
||||
|
||||
price_document.reliquat = true if @p_customer_sheet and @p_customer_sheet.price_documents.where(:cc_label => "Bon de livraison", :cancelled => false).count > 0
|
||||
|
||||
price_document.price_line_block = @past_price_document.price_line_block.dup
|
||||
|
||||
price_document.tva_type = @past_price_document.tva_type
|
||||
|
||||
price_document.price_line_block.ac_bon_de_commande_id = nil
|
||||
price_document.price_line_block.ac_bon_de_livraison_id = nil
|
||||
price_document.price_line_block.ac_facture_id = nil
|
||||
price_document.price_line_block.ac_block_type = nil
|
||||
price_document.price_line_block.ac_reliquat = nil
|
||||
|
||||
|
||||
|
||||
|
||||
price_document.price_line_block.bk_tot_fdp_ht = price_document.price_line_block.cc_tot_fdp_ht
|
||||
|
||||
|
||||
|
||||
|
||||
@past_price_document.price_line_block.price_lines.each do |pl|
|
||||
new_pl = pl.dup
|
||||
new_pl.price_line_ref_id = pl.id
|
||||
new_pl.ac_block_type = nil
|
||||
|
||||
new_pl.p_articles = pl.p_articles
|
||||
new_pl.save
|
||||
if price_document.reliquat
|
||||
bls = @p_customer_sheet.price_documents.where(:cc_label => "Bon de livraison", :cancelled => false)
|
||||
|
||||
@ -583,11 +584,11 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
end
|
||||
price_document.price_line_block.price_lines << new_pl
|
||||
end
|
||||
|
||||
|
||||
if price_document.save
|
||||
price_document.reset_for_update
|
||||
price_document.archive_now
|
||||
@p_customer_sheet.state = "en livraison"
|
||||
@p_customer_sheet.state = "Livraison"
|
||||
@p_customer_sheet.save
|
||||
|
||||
redirect_to admin_p_customer_sheet_path(price_document.ref_element)
|
||||
@ -701,7 +702,9 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
@p_customer_sheet = @past_price_document.ref_element
|
||||
|
||||
if @p_customer_sheet
|
||||
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
|
||||
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"),
|
||||
:demande_de_prix_id => @past_price_document.id,
|
||||
:date => Date.today)
|
||||
else
|
||||
price_document = PriceDocument.new(:price_document_type => PriceDocumentType.find_by_label("Bon de réception achat"), :date => Date.today)
|
||||
end
|
||||
@ -709,6 +712,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
price_document.doc_ref_id = @past_price_document.id
|
||||
price_document.p_fournisseur = @past_price_document.p_fournisseur
|
||||
price_document.price_line_block = @past_price_document.price_line_block.dup
|
||||
price_document.tva_type = @past_price_document.tva_type
|
||||
|
||||
if @past_price_document.cc_label == "Commande achat"
|
||||
price_document.bon_de_commande_achat_id = @past_price_document.id
|
||||
@ -743,9 +747,13 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
new_pl.qte = new_pl.qte - qte_ok
|
||||
|
||||
end
|
||||
new_pl.p_articles = pl.p_articles
|
||||
price_document.price_line_block.price_lines << new_pl
|
||||
end
|
||||
|
||||
@past_price_document.price_line_block.br_ok = true
|
||||
@past_price_document.save
|
||||
end
|
||||
|
||||
if price_document.save
|
||||
#price_document.reset_for_update
|
||||
#price_document.archive_now
|
||||
@ -766,10 +774,10 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
def facture_achat
|
||||
@past_price_document = PriceDocument.find(params[:id])
|
||||
|
||||
@p_customer_sheet = @past_price_document.ref_element
|
||||
|
||||
if @p_customer_sheet
|
||||
|
||||
price_document = @p_customer_sheet.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Facture achat"), :demande_de_prix_id => @past_price_document.id, :date => Date.today)
|
||||
|
||||
else
|
||||
@ -778,21 +786,19 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
price_document.doc_ref_id = @past_price_document.id
|
||||
price_document.p_fournisseur = @past_price_document.p_fournisseur
|
||||
|
||||
price_document.price_line_block = @past_price_document.price_line_block.dup
|
||||
|
||||
price_document.price_line_block.ac_bon_de_commande_id = nil
|
||||
price_document.price_line_block.ac_bon_de_livraison_id = nil
|
||||
price_document.price_line_block.ac_facture_id = nil
|
||||
price_document.price_line_block.ac_block_type = nil
|
||||
price_document.price_line_block.ac_reliquat = nil
|
||||
price_document.tva_type = @past_price_document.tva_type
|
||||
|
||||
@past_price_document.price_line_block.price_lines.each do |pl|
|
||||
new_pl = pl.dup
|
||||
new_pl.price_line_ref_id = pl.id
|
||||
new_pl.ac_block_type = nil
|
||||
|
||||
|
||||
new_pl.p_articles = pl.p_articles
|
||||
price_document.price_line_block.price_lines << new_pl
|
||||
end
|
||||
|
||||
@ -813,10 +819,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
render :inline => price_document.errors.messages.to_s
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -66,115 +66,109 @@ class ApplicationController < ActionController::Base
|
||||
def set_admin_menu
|
||||
|
||||
|
||||
|
||||
# CLient
|
||||
set_big_menu :clients, "Clients", admin_p_customers_path, "address-book-o", "#016699"
|
||||
|
||||
set_sub_menu :clients, :p_customers, "Clients", admin_p_customers_path if current_admin.has_permission?("customers")
|
||||
|
||||
set_sub_menu :clients, :p_customer_cats, "Catégories clients", admin_p_customer_cats_path if current_admin.has_permission?("p_customer_cats")
|
||||
|
||||
|
||||
set_sub_menu :clients, :p_commercials, "Commerciaux", admin_p_commercials_path if current_admin.has_permission?("commercials")
|
||||
set_sub_menu :clients, :p_commercial_cats, "Catégories de commerciaux", admin_p_commercial_cats_path if current_admin.has_permission?("commercial-cats")
|
||||
|
||||
|
||||
set_big_menu :stocks, "Produits", admin_p_products_path, "cubes", "#718197"
|
||||
|
||||
# Produit
|
||||
set_big_menu :products, "Produits", admin_p_products_path, "cubes", "#718197"
|
||||
|
||||
if current_admin.has_permission?("products")
|
||||
set_sub_menu :stocks, :p_products, "Produits", admin_p_products_path
|
||||
|
||||
set_sub_menu :stocks, :p_product_refs, "Références", admin_p_product_refs_path
|
||||
set_sub_menu :stocks, :p_articles, "Articles", admin_p_articles_path
|
||||
# set_sub_menu :stocks, :promos_p_products, "Offres spots", promos_admin_p_products_path
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
if current_admin.has_permission?("product-cats")
|
||||
set_sub_menu :stocks, :p_product_cats, "Catégories produits", admin_p_product_cats_path
|
||||
# set_sub_menu :stocks, :p_product_sub_cats, "Sous catégories produits", admin_p_product_sub_cats_path
|
||||
set_sub_menu :products, :p_products, "Produits", admin_p_products_path
|
||||
set_sub_menu :products, :p_product_refs, "Références", admin_p_product_refs_path
|
||||
set_sub_menu :products, :p_articles, "Articles", admin_p_articles_path
|
||||
if current_admin.has_permission?("product-cats")
|
||||
set_sub_menu :products, :p_product_cats, "Catégories produits", admin_p_product_cats_path
|
||||
# set_sub_menu :products, :p_product_sub_cats, "Sous catégories produits", admin_p_product_sub_cats_path
|
||||
end
|
||||
|
||||
set_sub_menu :products, :p_preferences_products_menu, "Préférences", admin_p_products_path
|
||||
# set_sub_menu :products, :promos_p_products, "Offres spots", promos_admin_p_products_path
|
||||
end
|
||||
|
||||
|
||||
set_sub_menu :stocks, :p_preferences_products_menu, "Préférences", admin_p_products_path
|
||||
|
||||
|
||||
if current_admin.has_permission?("brands")
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :s_brands, "Marques", admin_s_brands_path
|
||||
|
||||
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :s_brands, "Marques", admin_s_brands_path
|
||||
end
|
||||
|
||||
if current_admin.has_permission?("fournisseurs")
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path
|
||||
|
||||
|
||||
end
|
||||
|
||||
if current_admin.has_permission?("stocks")
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :stock_alias, "Stocks", admin_line_stocks_path
|
||||
|
||||
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_fournisseurs, "Fournisseurs", admin_p_fournisseurs_path
|
||||
end
|
||||
|
||||
if current_admin.has_permission?("boutique")
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_colors, "Couleurs"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_article_serial_nums, "Numeros série"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_serial_num_types, "Types de Numero série"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_ref_specs, "Specs"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_types, "Types de specs"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_spec_values, "Valeurs de specs"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_grades, "Grades" if PGrade::ACTIVATED
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_powers, "Types de chargeurs"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_zones, "Zones produits"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :import_csvs, "Import Excel"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :import_csv_match_refs, "Rapprochement références", match_refs_admin_import_csvs_path
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_cats, "Catégories SORECOP"
|
||||
set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_taxes, "taxe SORECOP"
|
||||
# set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_product_colors, "Couleurs"
|
||||
#set_sub_sub_menu :stocks, :p_preferences_products_menu, :p_article_serial_nums, "Numeros série"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_serial_num_types, "Types de Numero série"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_product_ref_specs, "Specs"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_spec_types, "Types de specs"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_spec_values, "Valeurs de specs"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_grades, "Grades" if PGrade::ACTIVATED
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_product_powers, "Types de chargeurs"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :p_product_zones, "Zones produits"
|
||||
set_sub_sub_menu :products, :p_preferences_products_menu, :import_csvs, "Import Excel"
|
||||
# set_sub_sub_menu :stocks, :p_preferences_products_menu, :import_csv_match_refs, "Rapprochement références", match_refs_admin_import_csvs_path
|
||||
# set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_cats, "Catégories SORECOP"
|
||||
# set_sub_sub_menu :stocks, :p_preferences_products_menu, :sorecop_taxes, "taxe SORECOP"
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Vente
|
||||
set_big_menu :ventes, "Commandes", admin_p_customer_sheets_path, "shopping-cart", "#518889"
|
||||
|
||||
set_sub_menu :ventes, :p_customer_sheets, "Demande de commande", admin_p_customer_sheets_path
|
||||
|
||||
if false
|
||||
PriceDocumentType.where(:label => PriceDocument::SALES).order("id DESC").all.each do |p_document_type|
|
||||
|
||||
set_sub_menu :ventes, :"p_document_type_#{p_document_type.label.to_s.to_slug}", p_document_type.label, admin_price_documents_path(:price_document_type_id => p_document_type.id)
|
||||
|
||||
end
|
||||
|
||||
set_sub_menu :ventes, :price_documents_all, "Tous documents", admin_price_documents_path
|
||||
PriceDocumentType.where(:label => PriceDocument::SALES).order("id DESC").all.each do |p_document_type|
|
||||
set_sub_menu :ventes, :"p_document_type_#{p_document_type.label.to_s.to_slug}", p_document_type.label, admin_price_documents_path(:price_document_type_id => p_document_type.id)
|
||||
end
|
||||
set_sub_menu :ventes, :price_documents_all, "Tous documents", admin_price_documents_path(:price_document_type_ids => PriceDocumentType.where(:label => PriceDocument::SALES).ids)
|
||||
|
||||
|
||||
# Achat
|
||||
set_big_menu :achats, "Achats", admin_price_documents_path(:price_document_type_ids => PriceDocumentType.where(:label => PriceDocument::PURCHASES).ids), "file-text-o", "#d97941"
|
||||
PriceDocumentType.where(:label => PriceDocument::PURCHASES).order("id DESC").all.each do |p_document_type|
|
||||
set_sub_menu :achats, :"p_document_type_#{p_document_type.label.to_s.to_slug}", p_document_type.label, admin_price_documents_path(:price_document_type_id => p_document_type.id)
|
||||
end
|
||||
set_sub_menu :achats, :price_documents_all, "Tous documents", admin_price_documents_path(:price_document_type_ids => PriceDocumentType.where(:label => PriceDocument::PURCHASES).ids)
|
||||
|
||||
if current_admin.has_permission?("stocks")
|
||||
set_sub_menu :achats, :line_stocks, "Lignes de stock", admin_line_stocks_path
|
||||
set_sub_menu :achats, :stock_movements, "Mouvements de stock manuel", admin_stock_movements_path
|
||||
end
|
||||
|
||||
# Stock
|
||||
# set_big_menu :stocks, "Stocks", admin_line_stocks_path, "cubes", "#d97941"
|
||||
# TODO Corriger le path
|
||||
|
||||
|
||||
# set_sub_sub_menu :stocks, :p_preferences_products_menu, :stock_alias, "Stocks", admin_line_stocks_path
|
||||
|
||||
|
||||
|
||||
# Documents
|
||||
# set_big_menu :documents, "Documents", admin_price_documents_path, "file-text-o", "#d97941"
|
||||
# PriceDocumentType.all.order("id DESC").each do |p_document_type|
|
||||
# set_sub_menu :documents, :"p_document_type_#{p_document_type.label.to_s.to_slug}", p_document_type.label, admin_price_documents_path(:price_document_type_id => p_document_type.id)
|
||||
# end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if current_admin.has_permission?("bills")
|
||||
set_big_menu :documents, "Achats", admin_price_documents_path(:price_document_type_id =>6, :purchase => true), "file-text-o", "#d97941"
|
||||
|
||||
#set_sub_menu :documents, :buy_lists, "TdB achats"
|
||||
|
||||
set_sub_menu :documents, :line_stocks, "Lignes de stock", admin_line_stocks_path
|
||||
set_sub_menu :documents, :stock_movements, "Mouvements de stock manuel", admin_stock_movements_path
|
||||
|
||||
|
||||
PriceDocumentType.where(:label => PriceDocument::PURCHASES).order("id DESC").all.each do |p_document_type|
|
||||
set_sub_menu :documents, :"p_document_type_#{p_document_type.label.to_s.to_slug}", p_document_type.label, admin_price_documents_path(:price_document_type_id => p_document_type.id)
|
||||
|
||||
end
|
||||
|
||||
# set_sub_menu :documents, :"p_document_type_reponse_fournisseur", "Réponses fournisseurs", admin_price_documents_path(:price_document_type_id => PriceDocumentType.find_by(label: "Réponse fournisseur").id)
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -46,31 +46,47 @@ module TranslationHelper
|
||||
|
||||
def state_helper(value)
|
||||
value = value.to_s
|
||||
if ["brouillon","Reçue", "Panier web", "AV BPA"].include?(value)
|
||||
r = '<span class="badge badge-pill badge-warning">'+value+'</span>'
|
||||
elsif ["Virement envoyé", "Validé"].include?(value)
|
||||
r = '<span class="badge badge-success">'+value+'</span>'
|
||||
elsif value == "commande" or value == "Commande" or value == "Réglée" or value == "PAS BPA"
|
||||
r = '<span class="badge badge-success">'+value+'</span>'
|
||||
elsif value == "En cours d'expédition" or value == "Expédiée" or value == "BPA"
|
||||
r = '<span class="badge badge-success" style="background:#036516;">'+value+'</span>'
|
||||
elsif ["Virement demandé"].include?(value)
|
||||
r = '<span class="badge badge-info">'+value+'</span>'
|
||||
elsif value =="Livrée"
|
||||
r = '<span class="badge badge-primary">'+value+'</span>'
|
||||
elsif value == "annulée"
|
||||
r = '<span class="badge badge-dark">'+value+'</span>'
|
||||
elsif ["Erreur sur virement", "Refusé", "Refusée","refusée"].include?(value)
|
||||
r = '<span class="badge badge-danger">'+value+'</span>'
|
||||
elsif ["En cours de traitement"].include?(value)
|
||||
r = '<span class="badge badge-danger" style="background:#865F7C;">'+value+'</span>'
|
||||
# if ["Brouillon", "Validée", "Préparation", "Livraison", "Réceptionné", "Payé"].include?(value)
|
||||
# r = '<span class="badge badge-warning" style="background:rgb(163,163,163);">'+value+'</span>'
|
||||
# elsif ["Virement envoyé", "Validé"].include?(value)
|
||||
# r = '<span class="badge badge-success">'+value+'</span>'
|
||||
# elsif value == "commande" or value == "Commande" or value == "Réglée" or value == "PAS BPA"
|
||||
# r = '<span class="badge badge-success">'+value+'</span>'
|
||||
# elsif value == "En cours d'expédition" or value == "Expédiée" or value == "BPA"
|
||||
# r = '<span class="badge badge-success" style="background:#036516;">'+value+'</span>'
|
||||
# elsif ["Virement demandé"].include?(value)
|
||||
# r = '<span class="badge badge-info">'+value+'</span>'
|
||||
# elsif value =="Livrée"
|
||||
# r = '<span class="badge badge-primary">'+value+'</span>'
|
||||
# elsif value == "annulée"
|
||||
# r = '<span class="badge badge-dark">'+value+'</span>'
|
||||
# elsif ["Erreur sur virement", "Refusé", "Refusée","refusée"].include?(value)
|
||||
# r = '<span class="badge badge-danger">'+value+'</span>'
|
||||
# elsif ["En cours de traitement"].include?(value)
|
||||
# r = '<span class="badge badge-danger" style="background:#865F7C;">'+value+'</span>'
|
||||
|
||||
elsif ["Disponible en boutique", "Disponible en point retrait"].include?(value)
|
||||
r = '<span class="badge badge-danger" style="background:#76bdf2;">'+value+'</span>'
|
||||
else
|
||||
r = '<span class="badge badge-danger" style="background:rgba(0,0,0,0.8);">'+value+'</span>'
|
||||
# elsif ["Disponible en boutique", "Disponible en point retrait"].include?(value)
|
||||
# r = '<span class="badge badge-danger" style="background:#76bdf2;">'+value+'</span>'
|
||||
# else
|
||||
# r = '<span class="badge badge-danger" style="background:rgba(0,0,0,0.8);">'+value+'</span>'
|
||||
# end
|
||||
|
||||
if value == "Brouillon"
|
||||
r = '<span class="badge badge-warning" style="background:rgb(163,163,163);">'+value+'</span>'
|
||||
elsif value == "Validée"
|
||||
r = '<span class="badge badge-success" style="background:rgb(250,185,43);">'+value+'</span>'
|
||||
elsif value == "Préparation"
|
||||
r = '<span class="badge badge-success" style="background:rgb(233,122,28);">'+value+'</span>'
|
||||
elsif value == "Livraison"
|
||||
r = '<span class="badge badge-success" style="background:rgb(66,122,255);">'+value+'</span>'
|
||||
elsif value == "Réceptionné"
|
||||
r = '<span class="badge badge-success" style="background:rgb(42,171,43);">'+value+'</span>'
|
||||
elsif value == "Payé"
|
||||
r = '<span class="badge badge-success" style="background:rgb(110,45,116);">'+value+'</span>'
|
||||
elsif value == "Refusée"
|
||||
r = '<span class="badge badge-success" style="background:rgb(110,45,116);">'+value+'</span>'
|
||||
end
|
||||
|
||||
|
||||
return raw(r)
|
||||
end
|
||||
|
||||
|
@ -51,6 +51,9 @@
|
||||
|
||||
|
||||
before_validation do
|
||||
puts "SELF QTEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
puts self.qte
|
||||
puts "SELF QTEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
if self.qte >= 0
|
||||
self.qte_used = self.line_stock_usages.sum(:qte)
|
||||
self.qte_available = self.qte - self.qte_used
|
||||
|
@ -244,12 +244,12 @@ class PCustomer < ApplicationRecord
|
||||
end
|
||||
|
||||
def nbr_orders
|
||||
self.p_customer_sheets.where(:state => "facturée")
|
||||
self.p_customer_sheets.where(:state => "Payée")
|
||||
|
||||
end
|
||||
|
||||
def nbr_orders_refusees
|
||||
self.p_customer_sheets.where(:state => "refusée")
|
||||
self.p_customer_sheets.where(:state => "Refusée")
|
||||
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ class PCustomerSheet < ApplicationRecord
|
||||
has_many :price_documents, :as => :ref_element
|
||||
|
||||
|
||||
acts_as_caching :fields => %w(weight_tot com_counter accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva payment_days payment_delais payment_month_end payment_end_at )
|
||||
acts_as_caching :fields => %w(weight_tot com_counter accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva payment_days payment_delais payment_month_end payment_end_at particular_infos)
|
||||
|
||||
acts_as_sorting :fields => {
|
||||
|
||||
@ -35,9 +35,10 @@ class PCustomerSheet < ApplicationRecord
|
||||
:d_number => {:name => "N° BC", :reorder => false},
|
||||
:created_at => {:name => "Date", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
|
||||
:admin_id => {:name => "Déposée par", :reorder => true},
|
||||
:wish_date => {:name => "Semaine de livraison", :reorder => true, :sort_name => "price_line_blocks.wish_date"},
|
||||
:wish_date_2 => {:name => "Date de livraison souhaitée ", :reorder => true, :sort_name => "price_line_blocks.wish_date"},
|
||||
#:wish_date => {:name => "Semaine de livraison", :reorder => true, :sort_name => "price_line_blocks.wish_date"},
|
||||
#:wish_date_2 => {:name => "Date de livraison souhaitée ", :reorder => true, :sort_name => "price_line_blocks.wish_date"},
|
||||
:p_customer => {:name => "Client", :reorder => false, :member_label => :show_name, :as => :ref_link},
|
||||
:particular_infos => {:name => "Client final", :reorder => false},
|
||||
:tot_amount_ht => {:name => "Total HT", :reorder => true, :sort_name => "cc_tot_amount_ht", :sort_name => "p_customer_sheets.cc_tot_amount_ht"},
|
||||
:tot_amount_ttc => {:name => "Total TTC", :reorder => true, :sort_name => "cc_tot_amount_ttc", :sort_name => "p_customer_sheets.cc_tot_amount_ttc"},
|
||||
:state => {:name => "Statut", :reorder => false, :as => :state},
|
||||
@ -46,8 +47,8 @@ class PCustomerSheet < ApplicationRecord
|
||||
}
|
||||
|
||||
# STATES = ["brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"]
|
||||
STATES = ["AV BPA", "PAS BPA","BPA", "Traitée"]
|
||||
|
||||
# STATES = ["AV BPA", "PAS BPA","BPA", "Traitée"]
|
||||
STATES = ["Brouillon", "Validée", "Préparation", "Livraison", "Réceptionné", "Payé", "Refusée"]
|
||||
|
||||
def personalised_archive
|
||||
self.price_line_block.archive_now
|
||||
@ -58,11 +59,6 @@ class PCustomerSheet < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
#["created_at", "price_line_blocks.wish_date", "cc_tot_amount_ht","cc_tot_amount_ttc"]
|
||||
|
||||
|
||||
before_validation do
|
||||
|
||||
|
||||
@ -106,6 +102,9 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def ca_particular_infos
|
||||
self.price_line_block.particular_bill.organisation + self.price_line_block.particular_bill.firstname + self.price_line_block.particular_bill.name
|
||||
end
|
||||
|
||||
|
||||
def ca_com_counter
|
||||
@ -237,17 +236,17 @@ class PCustomerSheet < ApplicationRecord
|
||||
def state_html
|
||||
if self.state == "Panier web"
|
||||
'<span class="badge badge-warning" style="background:#ffc107;">Panier web</span>'
|
||||
elsif self.state == "brouillon"
|
||||
elsif self.state == "Brouillon"
|
||||
'<span class="badge badge-warning" style="background:#ffc107;">'+self.demande_type.to_s+'</span>'
|
||||
elsif self.state == "offre"
|
||||
'<span class="badge badge-warning">Offre</span>'
|
||||
elsif self.state == "commande"
|
||||
elsif self.state == "Validée"
|
||||
'<span class="badge badge-success" style="background:#fd7e14;">Commande</span>'
|
||||
elsif self.state == "en livraison"
|
||||
elsif self.state == "Livraison"
|
||||
'<span class="badge badge-success" style="background:#28a745;">En livraison</span>'
|
||||
elsif self.state == "livrée"
|
||||
'<span class="badge badge-info">livrée</span>'
|
||||
elsif self.state =="facturée"
|
||||
elsif self.state =="Payée"
|
||||
'<span class="badge badge-primary">Facturée</span>'
|
||||
elsif self.state == "annulée"
|
||||
'<span class="badge badge-dark">Annulée</span>'
|
||||
@ -260,7 +259,7 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
|
||||
after_create do
|
||||
self.state = "brouillon" if self.state != "Panier web"
|
||||
self.state = "Brouillon" if self.state != "Panier web"
|
||||
self.save
|
||||
end
|
||||
|
||||
@ -268,69 +267,33 @@ class PCustomerSheet < ApplicationRecord
|
||||
def generate_doc(label, state)
|
||||
self.archive_now if !self.archived
|
||||
self.block_price if !self.price_blocked
|
||||
self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1)
|
||||
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1).empty?
|
||||
price_document_standard_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today, :tva_type_id => 1)
|
||||
price_document_standard_tva.p_customer = self.p_customer
|
||||
price_document_standard_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_standard_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 1).empty?
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 1).each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document_standard_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
price_document = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today)
|
||||
price_document.p_customer = self.p_customer
|
||||
price_document.price_line_block = self.price_line_block.dup
|
||||
price_document.tva_type = TvaType.first #le type de TVA est correctement enregistrée dans le fonction generate_f pour les factures
|
||||
price_document.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document.price_line_block.price_lines << new_pl
|
||||
end
|
||||
|
||||
if price_document_standard_tva.save
|
||||
price_document_standard_tva.archive_now
|
||||
if price_document.save
|
||||
price_document.archive_now
|
||||
puts 'STATEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
|
||||
puts state
|
||||
puts 'STATEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
|
||||
self.state = state
|
||||
self.save
|
||||
else
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts price_document.errors.full_messages
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
end
|
||||
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 2).empty?
|
||||
price_document_sur_marge_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today, :tva_type_id => 2)
|
||||
price_document_sur_marge_tva.p_customer = self.p_customer
|
||||
price_document_sur_marge_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_sur_marge_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 2).empty?
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 2).each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document_sur_marge_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if price_document_sur_marge_tva.save
|
||||
price_document_sur_marge_tva.archive_now
|
||||
self.state = state
|
||||
self.save
|
||||
end
|
||||
|
||||
# price_document = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today)
|
||||
# price_document.p_customer = self.p_customer
|
||||
# price_document.price_line_block = self.price_line_block.dup
|
||||
# price_document.price_line_block.ac_block_type = nil
|
||||
|
||||
# self.price_line_block.price_lines.each do |pl|
|
||||
# new_pl = pl.dup
|
||||
# new_pl.ac_block_type = nil
|
||||
# pl.p_articles.each { |p_article| new_pl.p_articles << p_article }
|
||||
# price_document.price_line_block.price_lines << new_pl
|
||||
# end
|
||||
|
||||
# if price_document.save
|
||||
# price_document.archive_now
|
||||
# self.state = state
|
||||
# self.save
|
||||
# end
|
||||
end
|
||||
|
||||
def generate_d
|
||||
@ -349,19 +312,69 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
def generate_bc
|
||||
|
||||
generate_doc("Bon de commande client", "commande")
|
||||
generate_doc("Bon de commande client", "Validée")
|
||||
|
||||
end
|
||||
|
||||
def generate_bl()
|
||||
|
||||
generate_doc("Bon de livraison", "en livraison")
|
||||
generate_doc("Bon de livraison", "Livraison")
|
||||
|
||||
end
|
||||
|
||||
def generate_f()
|
||||
#generate_doc("Facture", "Payé") On n'appelle plus la fonction generate doc car on veut générer 1 facture par type de TVA présent dans la commande
|
||||
|
||||
generate_doc("Facture", "facturée")
|
||||
self.archive_now if !self.archived
|
||||
self.block_price if !self.price_blocked
|
||||
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1).empty?
|
||||
price_document_standard_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Facture"), :date => Date.today, :tva_type_id => 1)
|
||||
price_document_standard_tva.p_customer = self.p_customer
|
||||
price_document_standard_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_standard_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 1).empty?
|
||||
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 1).each do |p_article|
|
||||
new_pl.p_articles << pl.p_articles
|
||||
end
|
||||
new_pl.save
|
||||
price_document_standard_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
|
||||
if price_document_standard_tva.save
|
||||
price_document_standard_tva.archive_now
|
||||
self.state = "Payé"
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 2).empty?
|
||||
price_document_sur_marge_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label("Facture"), :date => Date.today, :tva_type_id => 2)
|
||||
price_document_sur_marge_tva.p_customer = self.p_customer
|
||||
price_document_sur_marge_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_sur_marge_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 2).empty?
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 2).each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document_sur_marge_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
|
||||
if price_document_sur_marge_tva.save
|
||||
price_document_sur_marge_tva.archive_now
|
||||
self.state = "Payé"
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -423,5 +436,10 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def stock_generable
|
||||
return self.price_line_block.price_lines.joins(:p_articles).count < self.price_line_block.price_lines.sum(:qte) ? false : true
|
||||
#exclure les produit non stockable et sans SN
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ class PProduct < ApplicationRecord
|
||||
|
||||
belongs_to :p_product_cat
|
||||
belongs_to :s_brand
|
||||
|
||||
validates :s_brand, :presence => true
|
||||
validates :name, :presence => true, exclusion: { in: ["--> Selectioner un produit <--"], message: "Selectioner un produit avant de valider" }
|
||||
validates :code, :presence => true, :uniqueness => true, exclusion: { in: ["--> Indiquer un code produit <--"], message: "Indiquer un code produit avant de valider" }
|
||||
|
||||
|
@ -51,8 +51,8 @@ class PProductRef < ApplicationRecord
|
||||
:ct_price_ht => {:name => "Prix de vente", :as => :currency},
|
||||
:ean => {:name => "EAN"},
|
||||
:deee => {:name => "DEEE", :as => :currency},
|
||||
:sorecop => {:name => "Sorecop", :as => :currency},
|
||||
:sorecop_comment => {:name => "Commentaire Sorecop"},
|
||||
# :sorecop => {:name => "Sorecop", :as => :currency},
|
||||
# :sorecop_comment => {:name => "Commentaire Sorecop"},
|
||||
:actions => {:name => "Actions", :reorder => false}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,25 @@ class Particular < ApplicationRecord
|
||||
attr_accessor :validate_email, :skip_email
|
||||
|
||||
belongs_to :particular_ref, :class_name => "Particular"
|
||||
|
||||
|
||||
|
||||
def self.qi_table_order
|
||||
{
|
||||
:created_at => {:name => "Date de création", :reorder => true, :as => :date},
|
||||
:organisation => {:name => "Raison sociale", :reorder => true},
|
||||
:name => {:name => "Nom", :reorder => true},
|
||||
:firstname => {:name => "Prénom", :reorder => true},
|
||||
:address_1 => {:name => "Adresse", :reorder => true},
|
||||
:address_2 => {:name => "Adresse", :reorder => true},
|
||||
:city => {:name => "Ville", :reorder => true},
|
||||
:country => {:name => "Pays", :reorder => true},
|
||||
:actions => {:name => "Actions", :reorder => false}
|
||||
}
|
||||
#, :sort_name => "code"
|
||||
end
|
||||
|
||||
|
||||
def validate_pro
|
||||
true if self.force_validation and self.pro
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ class PriceDocument < ApplicationRecord
|
||||
belongs_to :p_devise
|
||||
belongs_to :p_payment_type
|
||||
belongs_to :tva_type
|
||||
|
||||
validates :tva_type, :presence => true
|
||||
|
||||
has_one :p_compta_element, :dependent => :destroy, :as => :element
|
||||
|
||||
@ -21,13 +21,12 @@ class PriceDocument < ApplicationRecord
|
||||
has_many :p_payments, :through => :p_payment_documents
|
||||
has_many :line_stocks, :as => :stockable
|
||||
|
||||
|
||||
has_many :avoir_p_payment_documents, :dependent => :destroy, :foreign_key => :avoir_id, :class_name => "PPaymentDocument"
|
||||
accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true
|
||||
|
||||
#PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"]
|
||||
PURCHASES = ["Facture achat"]
|
||||
SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
|
||||
PURCHASES = ["Facture achat", "Bon de réception achat"]
|
||||
SALES = ["Devis", "Avoir", "Facture", "Bon de livraison", "Bon de commande client"]
|
||||
# AVANCEMENT = ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]
|
||||
AVANCEMENT = ["0%", "25%", "50%", "75%", "100"]
|
||||
|
||||
@ -267,6 +266,7 @@ class PriceDocument < ApplicationRecord
|
||||
|
||||
:id => {:name => "ID", :reorder => false},
|
||||
:actions => {:name => "Actions", :reorder => false},
|
||||
:label => {:name => "Type", :reorder => false},
|
||||
:p_customer_code => {:name => "Code client", :reorder => false},
|
||||
#:avancement => {:name => "Avancement (%)", :reorder => true},
|
||||
#:list_designaton => {:name => "Designation liste", :reorder => true},
|
||||
@ -280,9 +280,8 @@ class PriceDocument < ApplicationRecord
|
||||
:public_fournisseur_name => {:name => "Nom fournisseur saisi", :reorder => false},
|
||||
:p_fournisseur => {:name => "Fournisseur", :reorder => false},
|
||||
:com_counter => {:name => "N° Offre", :reorder => false},
|
||||
:label => {:name => "Type", :reorder => false},
|
||||
:stock_ok => {:name => "Stock mis à jour ?", :reorder => true},
|
||||
:tva_type_name => {:name => "ID Type de TVA", :reorder => true},
|
||||
#:tva_type_name => {:name => "Type de TVA", :reorder => true},
|
||||
#:package_number => {:name => "Nombre de colis", :reorder => true},
|
||||
:d_number => {:name => "Numéro", :reorder => true},
|
||||
:date => {:name => "Date", :reorder => true},
|
||||
@ -332,7 +331,6 @@ class PriceDocument < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
|
||||
def personalised_archive
|
||||
self.price_line_block.archive_now
|
||||
end
|
||||
@ -444,9 +442,10 @@ class PriceDocument < ApplicationRecord
|
||||
last_dt = PriceDocument.where("d_number is not null").where(:d_year => self.d_year,:price_document_type_id => self.price_document_type_id).order("d_index DESC").first
|
||||
|
||||
last_number = last_dt.d_index if last_dt
|
||||
tva_prefix = self.tva_type.name == "Standard" ? "S" : "M"
|
||||
|
||||
self.d_index = last_number+1
|
||||
self.d_number = self.d_prefix+self.d_year.to_s+('%05d' % self.d_index)
|
||||
self.d_number = self.d_prefix+tva_prefix+self.d_year.to_s+('%05d' % self.d_index)
|
||||
self.save
|
||||
|
||||
|
||||
@ -596,19 +595,7 @@ class PriceDocument < ApplicationRecord
|
||||
url = (Rails.env.development? ? "http://localhost:3000" : "http://mdmb.basiclabs.fr").to_s+url
|
||||
pdf = ("pdf2")
|
||||
node_file = @temp_file
|
||||
|
||||
|
||||
puts "NODE IFLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts node_file
|
||||
puts "NODE IFLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
|
||||
|
||||
|
||||
|
||||
system("node #{pdf}.js #{Shellwords.escape(url)} #{Shellwords.escape(@temp_file)}")
|
||||
require 'posix/spawn'
|
||||
|
||||
@ -790,8 +777,9 @@ class PriceDocument < ApplicationRecord
|
||||
end
|
||||
|
||||
def stock_generable
|
||||
return self.price_line_block.price_lines.joins(:p_articles).count < self.price_line_block.price_lines.sum(:qte) ? false : true
|
||||
return self.price_line_block.price_lines.joins(:p_articles).count == self.price_line_block.price_lines.sum(:qte) ? true : false
|
||||
#exclure les produit non stockable et sans SN
|
||||
#return self.price_line_block.price_lines.joins(:p_product_ref).joins(:p_product).where("p_products.stockable = ?", true).where("p_products.with_serial_number = ?", true).joins(:p_articles).count < self.price_line_block.price_lines.joins(:p_product_ref).joins(:p_product).where("p_products.stockable = ?", true).where("p_products.with_serial_number = ?", true).sum(:qte) ? false : true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
class PriceLineBlock < ApplicationRecord
|
||||
belongs_to :price_lineable, :polymorphic => true
|
||||
validates :wish_date, :presence => true, :if => :wish_date_needed?
|
||||
#validates :wish_date, :presence => true, :if => :wish_date_needed?
|
||||
has_many :price_lines
|
||||
accepts_nested_attributes_for :price_lines, allow_destroy: true
|
||||
belongs_to :p_devise
|
||||
@ -11,17 +11,16 @@ class PriceLineBlock < ApplicationRecord
|
||||
#validates :particular_send_id, :presence => true, :if => :particular_send_needed?
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"#, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :particular_bill
|
||||
|
||||
|
||||
belongs_to :particular_send, :class_name => "Particular"#, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :particular_send
|
||||
|
||||
has_many :line_blocks
|
||||
belongs_to :p_customer
|
||||
|
||||
belongs_to :p_payment_type
|
||||
attr_accessor :same_adress
|
||||
|
||||
PURCHASE_BLOCKS = ["Réponse fournisseur", "Consultation fournisseur", "Facture d'achat", "Commande achat", "Demande prix", "Bon de commande achat", "Bon de réception achat", "Facture achat", "Avoir achat", "Catalogue fournisseur"]
|
||||
|
||||
@ -124,86 +123,126 @@ class PriceLineBlock < ApplicationRecord
|
||||
|
||||
|
||||
def update_stocks_for(p_product_ref, qte, pl)
|
||||
puts "TEST"
|
||||
puts "Référence : #{p_product_ref.id} #{p_product_ref.p_product.name}"
|
||||
if qte.to_f != 0.0
|
||||
decr_line_stock = LineStock.create(:date => self.price_lineable.date, :p_product_ref => p_product_ref, :qte => qte*-1, :description => "Attribution à la ligne d'une facture", :price_ht => 0.0, :price_line => pl, :price_line_block => self, :stockable => self.price_lineable)
|
||||
|
||||
|
||||
price = 0.0
|
||||
line_stock_usages = []
|
||||
|
||||
qte_to_affect = qte
|
||||
|
||||
LineStock.where(:p_product_ref_id => p_product_ref.id).where("date <= ?", self.price_lineable.date).where("qte_available > 0.0").each do |ls|
|
||||
if qte_to_affect <= ls.qte_available
|
||||
qte_here = qte_to_affect
|
||||
else
|
||||
qte_here = ls.qte_available
|
||||
if !pl.p_articles.empty?
|
||||
pl.p_articles.each do |p_article|
|
||||
decr_line_stock = LineStock.new(:date => self.price_lineable.date,
|
||||
:p_product_ref => p_product_ref,
|
||||
:qte => -1,
|
||||
:description => "Attribution à la ligne d'une facture",
|
||||
:price_ht => 0.0,
|
||||
:price_line => pl,
|
||||
:price_line_block => self,
|
||||
:stockable => self.price_lineable)
|
||||
|
||||
price = 0.0
|
||||
line_stock_usages = []
|
||||
#qte_to_affect = qte
|
||||
|
||||
lsu_p_art = LineStockUsage.where(p_article_id: p_article.id)
|
||||
|
||||
# ls = LineStock.joins(:p_articles).joins(:line_stock_usages).where("p_articles.id = ?", p_article.id).where.not("line_stock_usages.p_article").order(:date).last
|
||||
# ls = LineStock.joins(:p_articles).joins(:line_stock_usages).where("p_articles.id = ?", 69).where.not("line_stock_usages.p_article_id = ?", 69).order(:date).last
|
||||
# used_line_stock_p_article = line_stocks_p_article.joins(:line_stock_usages).where("line_stock_usages.p_article_id = ?", p_article.id).order(date: :desc).last
|
||||
# line_stocks_p_article = LineStock.joins(:p_articles).where("p_articles.id = ?", p_article.id)
|
||||
|
||||
line_stocks_p_article = p_article.line_stocks.where("qte_available > ?", 0) #LineStock.joins(:p_articles).where("p_articles.id = ?", p_article.id)
|
||||
ls = nil
|
||||
line_stocks_p_article.each do |p_article_line_stock|
|
||||
if p_article_line_stock.line_stock_usages.where(p_article_id: p_article).empty?
|
||||
ls = p_article_line_stock
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
#ls = LineStock.joins(:p_articles).where("p_articles.id = ?", p_article.id).joins(:line_stock_usages)
|
||||
#ls.qte_available = ls.qte_available - 1
|
||||
#qte_to_affect = qte_to_affect - qte_here
|
||||
|
||||
lsu = LineStockUsage.create(:qte => 1, :line_stock => ls, :dest_line_stock_id => decr_line_stock.id, p_article_id: p_article.id)
|
||||
#line_stock_usages << lsu
|
||||
|
||||
price += lsu.price_ht
|
||||
ls.save
|
||||
decr_line_stock.price_ht = price * -1
|
||||
decr_line_stock.save
|
||||
|
||||
ls_p_art = LineStockPArticle.new(
|
||||
p_article: p_article,
|
||||
line_stock: decr_line_stock
|
||||
)
|
||||
ls_p_art.save
|
||||
|
||||
|
||||
end
|
||||
|
||||
qte_to_affect = qte_to_affect - qte_here
|
||||
|
||||
lsu = LineStockUsage.create(:qte => qte_here, :line_stock => ls, :dest_line_stock_id => decr_line_stock.id)
|
||||
line_stock_usages << lsu
|
||||
|
||||
price += lsu.price_ht
|
||||
ls.save
|
||||
|
||||
break if qte_to_affect == 0.0
|
||||
|
||||
#price_u_ht
|
||||
|
||||
else
|
||||
|
||||
#===================================================================================================================
|
||||
|
||||
puts "TEST"
|
||||
puts "Référence : #{p_product_ref.id} #{p_product_ref.p_product.name}"
|
||||
if qte.to_f != 0.0
|
||||
decr_line_stock = LineStock.create(:date => self.price_lineable.date,
|
||||
:p_product_ref => p_product_ref,
|
||||
:qte => qte*-1,
|
||||
:description => "Attribution à la ligne d'une facture",
|
||||
:price_ht => 0.0,
|
||||
:price_line => pl,
|
||||
:price_line_block => self,
|
||||
:stockable => self.price_lineable)
|
||||
|
||||
price = 0.0
|
||||
line_stock_usages = []
|
||||
qte_to_affect = qte
|
||||
|
||||
#LineStock.where(:p_product_ref_id => p_product_ref.id).where("date <= ?", self.price_lineable.date).where("qte_available > 0.0").each do |ls|
|
||||
LineStock.where(:p_product_ref_id => p_product_ref.id).where("date <= ?", self.price_lineable.date).where("qte_available > 0.0").each do |ls|
|
||||
if qte_to_affect <= ls.qte_available
|
||||
qte_here = qte_to_affect
|
||||
else
|
||||
qte_here = ls.qte_available
|
||||
end
|
||||
|
||||
qte_to_affect = qte_to_affect - qte_here
|
||||
lsu = LineStockUsage.create(:qte => qte_here, :line_stock => ls, :dest_line_stock_id => decr_line_stock.id)
|
||||
line_stock_usages << lsu
|
||||
price += lsu.price_ht
|
||||
ls.save
|
||||
|
||||
break if qte_to_affect == 0.0
|
||||
#price_u_ht
|
||||
end
|
||||
|
||||
|
||||
decr_line_stock.p_articles = pl.p_articles
|
||||
decr_line_stock.price_ht = price * -1
|
||||
|
||||
decr_line_stock.save
|
||||
end
|
||||
decr_line_stock.price_ht = price * -1
|
||||
decr_line_stock.save
|
||||
#===================================================================================================================
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def update_stocks
|
||||
if self.block_type == "Facture" and !self.cost_ok
|
||||
if self.block_type == "Facture" or self.block_type == "Bon de commande client" or self.block_type == "Bon de réception achat" && !self.cost_ok
|
||||
if self.test_if_stock_ok?
|
||||
|
||||
self.price_lines.each do |pl|
|
||||
if pl.p_product_ref && pl.p_product_ref.stocked
|
||||
if pl.p_product_ref.assembled
|
||||
|
||||
pl.p_product_ref.p_product_assembleds.all.each do |ppa|
|
||||
|
||||
|
||||
self.update_stocks_for(ppa.p_product_ref, (pl.qte.to_f * ppa.qte.to_f), pl)
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
self.update_stocks_for(pl.p_product_ref, pl.qte, pl)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
self.cost_ok = true
|
||||
|
||||
|
||||
self.save
|
||||
self.save # deuxième sauvegarde pour prendre en compte les couts de price_line
|
||||
|
||||
|
||||
self.price_lineable.save if self.price_lineable
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -223,7 +262,26 @@ class PriceLineBlock < ApplicationRecord
|
||||
ls.p_articles = pl.p_articles
|
||||
ls.save
|
||||
end
|
||||
|
||||
|
||||
|
||||
pl.p_articles.joins(:p_grade).where(p_grades: {grade: "RMA"}).each do |p_article|
|
||||
decr_line_stock = LineStock.new(
|
||||
:date => self.price_lineable.date,
|
||||
:p_product_ref => pl.p_product_ref,
|
||||
:qte => -1,
|
||||
:description => "Sortie de stock automatique des RMA",
|
||||
:price_ht => 0.0,
|
||||
:price_line => pl,
|
||||
:price_line_block => self,
|
||||
:stockable => self.price_lineable)
|
||||
decr_line_stock.p_articles << p_article
|
||||
decr_line_stock.save
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
@ -276,9 +334,10 @@ class PriceLineBlock < ApplicationRecord
|
||||
def wish_date_needed?
|
||||
if PriceLineBlock::PURCHASE_BLOCKS.include?(self.block_type)
|
||||
false
|
||||
elsif self.block_type == "Devis"
|
||||
elsif self.block_type == "Devis" or self.block_type == "Demande de commande"
|
||||
false
|
||||
else
|
||||
raise
|
||||
true
|
||||
end
|
||||
end
|
||||
@ -453,9 +512,6 @@ class PriceLineBlock < ApplicationRecord
|
||||
end
|
||||
|
||||
if self.particular_bill_needed? and (!self.p_customer or !self.particular_bill or !self.particular_bill.owner or self.particular_bill.owner != self.p_customer)
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
puts self.particular_bill
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
errors.add(:particular_bill_id, 'doit être une adresse du client')
|
||||
end
|
||||
|
||||
|
@ -4,11 +4,12 @@
|
||||
=f.inputs do
|
||||
= f.input :enabled, :label => "Actif ?"
|
||||
= f.input :name, :label => "Nom de la zone :"
|
||||
=# f.input :description, :label => "description :"
|
||||
=# f.input :description, :label => "description :"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
-# .actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -11,9 +11,10 @@
|
||||
|
||||
= f.input :slug, :label => "Slug :"
|
||||
|
||||
= f.input :position, :label => "Position :"
|
||||
= f.input :position, :label => "Position :"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -6,6 +6,6 @@
|
||||
= f.input :name, :label => "Nom :"
|
||||
|
||||
=f.input :admin_permissions, :label => "Permissions :", :collection => AdminPermission.all, :as => :check_boxes, :member_label => :member_label
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -21,6 +21,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
@ -13,6 +13,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -17,8 +17,6 @@
|
||||
= f.input :nbr_send, :label => "nbr_send :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -7,9 +7,10 @@
|
||||
= f.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id)
|
||||
|
||||
= f.input :value
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
- else
|
||||
.ml-5
|
||||
|
@ -13,7 +13,8 @@
|
||||
=render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un numéro de série", f, :p_article_serial_nums, {:class => "btn btn-primary"}
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
- elsif params[:controller] == "admin/price_lines"
|
||||
= form.inputs do
|
||||
|
||||
|
@ -9,6 +9,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -30,14 +30,7 @@
|
||||
= f.input :birth, :label => "Date de naissance :", :as => :date
|
||||
|
||||
= f.input :objectif_ht, :label => "Objectif CA (HT)"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -7,11 +7,6 @@
|
||||
|
||||
=# f.input :payment_days, :label => "Délais de paiement par défaut :"
|
||||
=# f.input :encourt_max, :label => "Encours max par défaut :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
=#debug form.object.errors.messages if current_admin.id == 1
|
||||
=form.semantic_fields_for :price_line_block do |f|
|
||||
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
|
||||
|
||||
|
||||
-# .content
|
||||
-# .qi_row
|
||||
-# .qi_pannel.qi_plain.padding.row
|
||||
|
@ -29,11 +29,11 @@
|
||||
-tr[:created_at] = capture do
|
||||
%td=l p_customer_sheet.created_at, :format => :date
|
||||
|
||||
-tr[:wish_date] = capture do
|
||||
%td=l p_customer_sheet.price_line_block.wish_date, :format => "semaine %V (%Y)"
|
||||
-# -tr[:wish_date] = capture do
|
||||
-# %td=l p_customer_sheet.price_line_block.wish_date, :format => "semaine %V (%Y)"
|
||||
|
||||
-tr[:wish_date_2] = capture do
|
||||
%td=l p_customer_sheet.price_line_block.wish_date, :format => :date
|
||||
-# -tr[:wish_date_2] = capture do
|
||||
-# %td=l p_customer_sheet.price_line_block.wish_date, :format => :date
|
||||
|
||||
|
||||
-tr[:tot_amount_ht] = capture do
|
||||
|
@ -63,19 +63,14 @@
|
||||
%span.input-group-addon.btn{:onclick => "$(this).prev('input').val('');"}
|
||||
=ic(:times)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @p_customer_sheets}
|
||||
|
||||
.qi_kpi
|
||||
-params[:active_kpi] = [] if params[:active_kpi].to_s == ""
|
||||
|
||||
|
||||
|
||||
-[["brouillon", "Brouillon", "#ffc107"], ["commande", "Commande", "#fd7e14"], ["en livraison", "En livraison", "#28a745"], ["facturée", "Facturée", "#3B7DDD"]].each do |state| #,["refusée", "Refusée", "#dc3545"]
|
||||
-[["Brouillon", "Brouillon", "#a3a3a3"], ["Validée", "Validée", "#fab92b"], ["Préparation", "Préparation", "#e97a1c"], ["Livraison", "Livraison", "#28a745"], ["Payée", "Payée", "#3B7DDD"]].each do |state| #,["refusée", "Refusée", "#dc3545"]
|
||||
-p_customer_sheets = @p_customer_sheets.where(:state => state[0])
|
||||
|
||||
-if p_customer_sheets.count > 0
|
||||
|
@ -1,13 +1,13 @@
|
||||
.qi_header
|
||||
|
||||
.right
|
||||
=raw @p_customer_sheet.state_html
|
||||
|
||||
=#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 == "commande")
|
||||
-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
|
||||
|
||||
@ -27,60 +27,60 @@
|
||||
-price_line_block = @p_customer_sheet.price_line_block
|
||||
%h3
|
||||
Contenu de la demande de commande :
|
||||
|
||||
|
||||
|
||||
|
||||
=render price_line_block
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%hr
|
||||
-if @p_customer_sheet.demande_type?
|
||||
%p
|
||||
Demande lors de la saisie :
|
||||
%strong=@p_customer_sheet.demande_type
|
||||
.right{:style => "text-align:right;"}
|
||||
-@bon_de_commande = @p_customer_sheet.price_documents.where(:cc_label => "Bon de commande client").first
|
||||
%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;"
|
||||
%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"
|
||||
%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
|
||||
%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
|
||||
%p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
||||
|
||||
-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 == "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 "
|
||||
|
||||
-if( @p_customer_sheet.state == "commande" 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=link_to "Mettre à jour les stocks, calculer la marge", 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 @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"
|
||||
|
||||
|
||||
|
||||
-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"
|
||||
|
||||
-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
|
||||
@ -89,10 +89,10 @@
|
||||
-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 DESC, created_at DESC")
|
||||
-@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 DESC")
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at ASC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
|
||||
- if @price_documents.exists?
|
||||
|
@ -160,9 +160,7 @@
|
||||
|
||||
|
||||
#customer_adresses
|
||||
=render(:partial => "admin/particulars/customer_preview", :locals => {:p_customer => @p_customer})
|
||||
|
||||
|
||||
=render(:partial => "admin/particulars/customer_preview", :locals => {:p_customer => @p_customer}) if !@p_customer.p_customer_cat.name == "Plateforme"
|
||||
|
||||
|
||||
|
||||
@ -181,6 +179,8 @@
|
||||
%li.nav-item=link_to "Factures & Avoirs", "?tab=bills#tabs", :class => "nav-link"+(" active" if params[:tab] == "bills").to_s
|
||||
-if current_admin.has_permission?("payments")
|
||||
%li.nav-item=link_to "Paiements", "?tab=payments#tabs", :class => "nav-link"+(" active" if params[:tab] == "payments").to_s
|
||||
-if current_admin.has_permission?("payments") and @p_customer.p_customer_cat.name == "Plateforme"
|
||||
%li.nav-item=link_to "Adresses", "?tab=adresses#tabs", :class => "nav-link"+(" active" if params[:tab] == "adresses").to_s
|
||||
|
||||
|
||||
|
||||
@ -281,6 +281,24 @@
|
||||
-@p_payments = @p_payments.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_payments}
|
||||
|
||||
|
||||
-if params[:tab] == "adresses" and @p_customer.p_customer_cat.name == "Plateforme"
|
||||
#adresses
|
||||
.qi_tab_header
|
||||
.right{:style => "text-align:right;"}
|
||||
/= link_to 'Ajouter une adresse', new_admin_p_payment_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary bgbd-payments", :remote => true
|
||||
|
||||
.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
|
||||
-@adresses =@p_customer.particulars
|
||||
-@adresses = sort_by_sorting(@adresses, "created_at DESC")
|
||||
-@adresses = @adresses.page(page).per(per_page)
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @adresses}
|
||||
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -11,6 +11,6 @@
|
||||
|
||||
= f.input :i_archive, :label => "Indiquer le lettrage comme effectué ? (forcer, même si aucun paiements rattachés)"
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -3,10 +3,7 @@
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :grade, :label => f.object.label_for(:grade)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -13,5 +13,5 @@
|
||||
=# f.input :purchase_account, :label => "Compte achat :"
|
||||
=# f.input :sale_account, :label => "Compte vente :"
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -7,6 +7,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -1,5 +1,11 @@
|
||||
=semantic_form_for [:admin, @p_product], :remote => false do |f|
|
||||
|
||||
%div.error.has-error
|
||||
-f.object.errors.keys.each do |key|
|
||||
%p=key.to_s
|
||||
%p=f.object.errors[key.to_sym][0]
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
=f.inputs do
|
||||
@ -17,7 +23,7 @@
|
||||
#with_serial
|
||||
= f.input :with_serial_number, :label => "Avec n° de série ?"
|
||||
.col-sm-2
|
||||
=f.input :s_brand_id, :label => "Marque :", :collection => SBrand.all, :as => :select, :include_blank => true
|
||||
=f.input :s_brand_id, :label => "Marque :", :collection => SBrand.all, required: true, :as => :select, :include_blank => true
|
||||
=# f.input :stocked, :label => "Suivi de stock ?"
|
||||
.col-sm-2
|
||||
=#f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true
|
||||
|
@ -7,6 +7,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
@ -6,6 +6,6 @@
|
||||
=f.inputs do
|
||||
|
||||
= render :partial => "form", :locals => {:form => f}
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -12,12 +12,7 @@
|
||||
=render :partial => "admin/partition_lines/form", :locals => {:form => f}
|
||||
|
||||
%p= link_to_add_fields "Ajouter une ligne", f, :partition_lines, {:class => "btn btn-primary", :partial =>( "admin/partition_lines/form")}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -15,9 +15,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
|
||||
|
||||
|
@ -8,8 +8,11 @@
|
||||
-else
|
||||
=link_to ic(:plus)+" Demande de commande", admin_p_customers_path(:offre => true), :class => "btn btn-primary bgbd-ventes"
|
||||
|
||||
|
||||
-if params[:price_document_type_id]
|
||||
=breadcrumb second_title: PriceDocumentType.find(params[:price_document_type_id]).label
|
||||
-else
|
||||
=breadcrumb second_title: "Tous les documents"
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
= link_to i(:download), print_admin_price_document_path(@price_document.token), :remote => false, :target => "_blank" if !PriceLineBlock::PURCHASE_BLOCKS.include?(@price_document.block_type)
|
||||
|
||||
=breadcrumb second_title: @price_document.label, second_link: admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id), record: @price_document.d_number
|
||||
|
||||
=breadcrumb first_title: "Commandes", second_title: @price_document.label, second_link: admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id), record: @price_document.d_number
|
||||
|
||||
|
||||
.qi_row
|
||||
@ -246,18 +246,23 @@
|
||||
-if current_admin.has_permission?("show-costs")
|
||||
%p
|
||||
-if @price_document.price_document_type_id == 6
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
-# =link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
-# =link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
=link_to "Générer un bon de réception", bon_de_reception_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
=link_to "Générer un bon de réception", bon_de_reception_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
|
||||
-elsif @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
|
||||
%p
|
||||
Coût :
|
||||
=number_to_currency @price_document.cost_ht
|
||||
%p
|
||||
Marge :
|
||||
=number_to_currency @price_document.marge_ht
|
||||
-# %p
|
||||
-# Coût :
|
||||
-# =number_to_currency @price_document.cost_ht
|
||||
-# %p
|
||||
-# Marge :
|
||||
-# =number_to_currency @price_document.marge_ht
|
||||
|
||||
-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"
|
||||
=link_to "Mettre à jour les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
=link_to "Mettre à jour les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
|
||||
-if @price_document.d_number
|
||||
-if @price_document.cc_label == "Commande achat"
|
||||
%p=link_to "Générer un bon de réception", bon_de_reception_admin_price_document_path(@price_document), :class => "btn btn-primary"
|
||||
@ -334,20 +339,29 @@
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 5000
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
|
||||
-@line_stocks = @price_document.line_stocks.order("date DESC, created_at DESC")
|
||||
-if params[:price_document_ids]
|
||||
-@line_stocks = @line_stocks.where(:id => params[:price_document_ids])
|
||||
|
||||
|
||||
-@line_stocks = sort_by_sorting(@line_stocks, "created_at DESC")
|
||||
-@line_stocks = @line_stocks.page(page).per(per_page)
|
||||
%br
|
||||
|
||||
|
||||
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @line_stocks}
|
||||
-if @price_document.price_line_block.br_ok
|
||||
%h3 Bons de reception générés
|
||||
#bills
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 5000
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
|
||||
-@price_documents = PriceDocument.where(facture_achat_id: @price_document.id).order("date DESC, created_at DESC")
|
||||
-# -if params[:price_document_ids]
|
||||
-# -@line_stocks = @line_stocks.where(:id => params[:price_document_ids])
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
%br
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
||||
|
||||
-if @price_document.label == "Demande prix"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
.col-6
|
||||
= f.input :customer_ref, :label => "Référence commande client :"
|
||||
.col-6
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
/= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
@ -20,18 +20,24 @@
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
Adresse de livraison :
|
||||
=f.semantic_fields_for :particular_send do |form_particular_send|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_send}
|
||||
=form_particular_send.hidden_field :owner_id
|
||||
=form_particular_send.hidden_field :owner_type
|
||||
.col-6
|
||||
Adresse de facturation :
|
||||
=f.semantic_fields_for :particular_bill do |form_particular_bill|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_bill}
|
||||
=form_particular_bill.hidden_field :owner_id
|
||||
=form_particular_bill.hidden_field :owner_type
|
||||
.col-12
|
||||
.row
|
||||
.col-3
|
||||
= f.input :same_adress, label: "Adresse de livraison identique ?", collection: [["oui", "oui"], ["non", "non"]], include_blank: false, as: :select
|
||||
.row
|
||||
.col-6
|
||||
Adresse de facturation :
|
||||
=f.semantic_fields_for :particular_bill do |form_particular_bill|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_bill}
|
||||
=form_particular_bill.hidden_field :owner_id
|
||||
=form_particular_bill.hidden_field :owner_type
|
||||
.col-6#send_adress
|
||||
Adresse de livraison :
|
||||
=f.semantic_fields_for :particular_send do |form_particular_send|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_send}
|
||||
=form_particular_send.hidden_field :owner_id
|
||||
=form_particular_send.hidden_field :owner_type
|
||||
|
||||
|
||||
-if current_admin.has_permission?("customer-sheets-bl")
|
||||
=# f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||
@ -97,4 +103,18 @@
|
||||
$('.p_product_ref_select').select2();
|
||||
$('.add_lines').click(function() {
|
||||
$('.p_product_ref_select').last().select2();
|
||||
});
|
||||
});
|
||||
|
||||
$('#p_customer_sheet_price_line_block_attributes_same_adress_input').on('change', function(e) {
|
||||
if ($('#p_customer_sheet_price_line_block_attributes_same_adress_input :selected').text() == "oui") {
|
||||
$( "#send_adress" ).show().fadeOut( 500 );
|
||||
} else {
|
||||
$( "#send_adress" ).show().fadeIn( 500 );
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#p_customer_sheet_price_line_block_attributes_same_adress_input :selected').text() == "oui") {
|
||||
$( "#send_adress" ).hide();
|
||||
} else {
|
||||
$( "#send_adress" ).show();
|
||||
}
|
@ -62,7 +62,7 @@
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th IDddd
|
||||
%th ID
|
||||
%th Référence
|
||||
%th Désignation
|
||||
%th Qté
|
||||
|
@ -1,33 +1,78 @@
|
||||
.row.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||
.take.mr-1{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||
.take
|
||||
=ic :arrows
|
||||
.col-3
|
||||
= form.input :p_product_ref, as: :select, collection: PProductRef.all.map{ |p_product_ref| [p_product_ref.member_label, p_product_ref.id] }, label: "Référence :", input_html: {class:"p_product_ref_select"}
|
||||
.input-group
|
||||
-# %label Référence
|
||||
-# %input.p_product_ref_autocomplete_input.form-control{:type => "text", :style => "", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref), :class => "p_product_ref_name"}
|
||||
-# = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
.col-3
|
||||
= form.input :ct_title, :label => "Designation personnalisée : " if @avoir
|
||||
%div{:class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||
%label Produit :
|
||||
|
||||
%input.p_product_ref_autocomplete_input.form-control{:type => "text", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
|
||||
:javascript
|
||||
$('.p_product_ref_autocomplete_input').focus()
|
||||
$( function() {
|
||||
|
||||
$('.p_product_ref_autocomplete_input').autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "/admin/p_product_refs/autocomplete.json",
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term,
|
||||
p_customer_id: $(".p_customer_id").val()
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
arr = jQuery.map( data, function( item ) {
|
||||
return {
|
||||
label: item.member_label,
|
||||
value: item.member_label,
|
||||
id: item.id
|
||||
}
|
||||
});
|
||||
|
||||
response(arr)
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
},
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
|
||||
-# .input-group-append
|
||||
-# =link_to "#", class: "btn btn-dark",:onclick => "key=genRanHex(12);select_product_from_manager(key);$(this).closest('tr').find('.p_product_ref_id').attr('id', 'p_product_ref_id_'+key);$(this).closest('tr').find('.p_product_ref_name').attr('id', 'p_product_ref_name_'+key);$(this).closest('tr').find('.p_product_ref_qte').attr('id', 'p_product_ref_qte_'+key);return false;" do
|
||||
-# =ic(:search)
|
||||
$(this).next(".p_product_ref_id").val(ui.item.id)
|
||||
|
||||
form = $(this).closest(".price_line_form")
|
||||
|
||||
|
||||
|
||||
$.ajax( {
|
||||
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
||||
dataType: "json",
|
||||
data: {
|
||||
type: "price",
|
||||
qte: form.find(".input_price_line_qte").val(),
|
||||
p_customer_id: $(".p_customer_id").val()
|
||||
},
|
||||
success: function (data) {
|
||||
form.find(".input_price_line_price_u_ht").val(data.price);
|
||||
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
||||
form.find(".input_price_line_tva_account_value").val(data.tva_account_value);
|
||||
form.find(".input_price_line_weight_u").val(data.weight);
|
||||
|
||||
|
||||
|
||||
}
|
||||
} );
|
||||
//return false
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
|
||||
|
||||
-form.object.forced_price = true if form.object.ct_u_price_ht
|
||||
|
||||
-# -if form.object.forced_price and form.object.p_product_ref
|
||||
-# .col-3
|
||||
-# .mx-2
|
||||
-# .form-inline
|
||||
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label => false, label_class: "mr-1", :value => form.object.th_price_u_ht)
|
||||
-# -else
|
||||
-# .col-3
|
||||
-# .mx-2
|
||||
-# .form-inline
|
||||
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label =>false, label_class: "mr-1")
|
||||
-# .col-3
|
||||
-# .form-inline.mr-2{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
||||
-# = form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "form-inline input_price_line_forced_price"}
|
||||
-# .forced_price_wrapper.mx-2{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
||||
.col-3
|
||||
= form.input :qte, :label => "Quantité :", :input_html => {:class => "input_price_line_qte form-control p_product_ref_qte", tabindex: 1}
|
||||
.col-3
|
||||
@ -39,3 +84,4 @@
|
||||
%span.destroy{style: "font-size: 2rem;"}=link_to_remove_fields ic(:"trash-o"), form
|
||||
= qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||
= form.hidden_field :position, :class => "price_line_position_input"
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||
%table{:style => "width:100%;"}
|
||||
%tr
|
||||
|
@ -1,59 +1,10 @@
|
||||
=semantic_form_for [:admin, @price_line], :remote => true do |form|
|
||||
|
||||
.content
|
||||
Produit :
|
||||
=form.object.p_product_ref.cc_name if form.object.p_product_ref
|
||||
%br
|
||||
Quantité à satisfaire :
|
||||
=form.object.qte
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%table.top_td{:style => "width:100%;"}
|
||||
%tr
|
||||
|
||||
%td
|
||||
= form.input :p_product_power_id, :label => "Type de chargeur", :collection => PProductPower.all, :include_blank => false, :as => :select
|
||||
|
||||
%td
|
||||
= form.input :qte_available, :label => "Qté disponible :", :input_html => {:class => "input_price_line_qte"}
|
||||
|
||||
|
||||
%td
|
||||
= form.input :ct_u_price_ht, :label => "Prix vente"
|
||||
|
||||
%td
|
||||
= form.input :ready_stock, :label => "Ready stock", :as => :select
|
||||
|
||||
%td
|
||||
= form.input :ram, :label => "Ram"
|
||||
|
||||
%td
|
||||
= form.input :ram_unit, :label => "Ram unité"
|
||||
|
||||
|
||||
%td
|
||||
= form.input :eu, :label => "EU ?", :as => :select
|
||||
|
||||
|
||||
%td
|
||||
= form.input :p_product_zone_id, :label => "Zone", :collection => PProductZone.all, :include_blank => true, :as => :select
|
||||
|
||||
|
||||
|
||||
%td
|
||||
= form.input :fullkit, :label => "Fullkit", :as => :select
|
||||
|
||||
%td
|
||||
= form.input :lang_start, :label => "Démarage sur l'écran de langue (starting on screen language)", :as => :select
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
= form.input :p_product_ref, label: "Produit :" if form.object.p_product_ref
|
||||
= form.input :qte, label: "Quantité à satisfaire :"
|
||||
= form.input :ct_u_price_ht, :label => "Prix vente"
|
||||
= form.input :comment, :label => "Commentaire", :input_html => {:style => "height:70px;"}
|
||||
|
||||
.actions= form.submit "Sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => form}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "reponse_pane_hover_form"))%>",1200,900);
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "reponse_pane_hover_form"))%>",700,900);
|
@ -3,10 +3,12 @@
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :code, :label => "Code :"
|
||||
= f.input :name, :label => "Nom :"
|
||||
= f.input :name, :label => "Nom :"
|
||||
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
= f.input :movement_type, :label => "movement_type :", :as => :hidden
|
||||
-# = f.input :movement_type, :label => "movement_type :", :as => :hidden
|
||||
= f.hidden_field :movement_type
|
||||
= f.input :description, :label => "Description :", :as => :string
|
||||
|
||||
= f.input :date, :label => "Date :", :as => :date
|
||||
@ -14,12 +15,7 @@
|
||||
=render :partial => "admin/stock_movement_lines/form", :locals => {:form => f}
|
||||
|
||||
%p= link_to_add_fields "Ajouter une ligne", f, :stock_movement_lines, {:class => "btn btn-primary", :partial =>(@stock_movement.movement_type == "cred" ? "admin/stock_movement_lines/form_cred" : "admin/stock_movement_lines/form")}
|
||||
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
/.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -672,6 +672,7 @@ Rails.application.routes.draw do
|
||||
get :buy_order_create
|
||||
get :bon_de_reception
|
||||
get :facture_achat
|
||||
|
||||
end
|
||||
collection do
|
||||
get :search_to_affect
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddBrOkToPriceLineBlock < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :price_line_blocks, :br_ok, :boolean
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class AddParticularInfosToPCustommerSheet < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :p_customer_sheets, :cc_particular_infos, :string
|
||||
add_column :p_customer_sheets, :ac_particular_infos, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddPArticleToLineStockUsage < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :line_stock_usages, :p_article_id, :integer
|
||||
end
|
||||
end
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_11_12_130721) do
|
||||
ActiveRecord::Schema.define(version: 2021_11_17_161758) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -568,6 +568,7 @@ ActiveRecord::Schema.define(version: 2021_11_12_130721) do
|
||||
t.integer "dest_line_stock_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.integer "p_article_id"
|
||||
t.index ["line_stock_id"], name: "index_line_stock_usages_on_line_stock_id"
|
||||
end
|
||||
|
||||
@ -1271,6 +1272,8 @@ ActiveRecord::Schema.define(version: 2021_11_12_130721) do
|
||||
t.datetime "customer_validation_at"
|
||||
t.boolean "web_order", default: false
|
||||
t.string "past_id"
|
||||
t.string "cc_particular_infos"
|
||||
t.string "ac_particular_infos"
|
||||
t.index ["p_customer_id"], name: "index_p_customer_sheets_on_p_customer_id"
|
||||
end
|
||||
|
||||
@ -2474,6 +2477,7 @@ ActiveRecord::Schema.define(version: 2021_11_12_130721) do
|
||||
t.date "stock_entrance_date"
|
||||
t.decimal "ct_tot_amount_ht", precision: 14, scale: 2
|
||||
t.bigint "price_document_id"
|
||||
t.boolean "br_ok"
|
||||
t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id"
|
||||
t.index ["price_document_id"], name: "index_price_line_blocks_on_price_document_id"
|
||||
end
|
||||
|
Reference in New Issue
Block a user