suite
This commit is contained in:
parent
331548c6a9
commit
5ceaeded7d
@ -35,6 +35,8 @@
|
|||||||
#= require admin/trunk8.js
|
#= require admin/trunk8.js
|
||||||
|
|
||||||
|
|
||||||
|
#=require sheet_prices
|
||||||
|
|
||||||
portlet_to_move = false
|
portlet_to_move = false
|
||||||
content_type_to_move =false
|
content_type_to_move =false
|
||||||
window.disable_portlet_select = false
|
window.disable_portlet_select = false
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#= require redactor_plugins/fontsize
|
#= require redactor_plugins/fontsize
|
||||||
#= require redactor_plugins/fontfamily
|
#= require redactor_plugins/fontfamily
|
||||||
#= require redactor_plugins/fontcolor
|
#= require redactor_plugins/fontcolor
|
||||||
|
#= require vendor/accounting
|
||||||
|
|
||||||
#= require vendor/flipclock.js
|
#= require vendor/flipclock.js
|
||||||
#= require vendor/jquery.cookiebar.js
|
#= require vendor/jquery.cookiebar.js
|
||||||
@ -22,6 +23,8 @@
|
|||||||
|
|
||||||
#= require nested_fields
|
#= require nested_fields
|
||||||
|
|
||||||
|
#=require sheet_prices
|
||||||
|
|
||||||
top = 20
|
top = 20
|
||||||
|
|
||||||
@scroll_ajust = () ->
|
@scroll_ajust = () ->
|
||||||
|
16
app/assets/javascripts/sheet_prices.coffee
Normal file
16
app/assets/javascripts/sheet_prices.coffee
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
@udpate_sheet_lines = ->
|
||||||
|
$(".p_sheet_line_field").each ->
|
||||||
|
price = parseFloat($(this).find(".price").data("price"))
|
||||||
|
price_tot = 0
|
||||||
|
qte_tot = 0
|
||||||
|
$(this).find(".color_line").each ->
|
||||||
|
qte = 0
|
||||||
|
$(this).find("input.qte").each ->
|
||||||
|
qte += parseFloat($(this).val()) if parseFloat($(this).val())
|
||||||
|
price_color = qte * price
|
||||||
|
$(this).find(".price_color_tot").html(accounting.formatMoney(price_color))
|
||||||
|
qte_tot += qte
|
||||||
|
|
||||||
|
$(this).find(".qte_tot").html(qte_tot)
|
||||||
|
$(this).find(".price_tot").html(accounting.formatMoney(qte_tot*price))
|
||||||
|
|
@ -130,6 +130,14 @@ class Admin::PCustomerSheetsController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_fa
|
||||||
|
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||||
|
@p_customer_sheet.generate_fa
|
||||||
|
|
||||||
|
redirect_to :back
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def generate_bc
|
def generate_bc
|
||||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||||
@p_customer_sheet.generate_bc
|
@p_customer_sheet.generate_bc
|
||||||
|
@ -67,9 +67,10 @@ class Admin::PCustomersController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@p_customer = PCustomer.new(params.require(:p_customer).permit!)
|
@p_customer = PCustomer.new(params.require(:p_customer).permit!)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if @p_customer.save
|
if @p_customer.save
|
||||||
|
@p_customer.generate_mdp_now if @p_customer.generate_mdp and @p_customer.generate_mdp != "0"
|
||||||
else
|
else
|
||||||
render action: "new"
|
render action: "new"
|
||||||
|
|
||||||
@ -80,10 +81,10 @@ class Admin::PCustomersController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@p_customer = PCustomer.find(params[:id])
|
@p_customer = PCustomer.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
if @p_customer.update_attributes(params.require(:p_customer).permit!)
|
if @p_customer.update_attributes(params.require(:p_customer).permit!)
|
||||||
|
@p_customer.generate_mdp_now if @p_customer.generate_mdp and @p_customer.generate_mdp != "0"
|
||||||
else
|
else
|
||||||
render action: "edit"
|
render action: "edit"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class Admin::PDocumentsController < ApplicationController
|
|||||||
@p_document = PDocument.find_by_token(params[:id])
|
@p_document = PDocument.find_by_token(params[:id])
|
||||||
@element = @p_document.element
|
@element = @p_document.element
|
||||||
params[:inline] = true
|
params[:inline] = true
|
||||||
if true
|
if false
|
||||||
|
|
||||||
@temp_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}_temp.pdf"
|
@temp_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}_temp.pdf"
|
||||||
@final_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}.pdf"
|
@final_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}.pdf"
|
||||||
|
@ -23,7 +23,7 @@ class Public::PCustomerAuthsController < ApplicationController
|
|||||||
|
|
||||||
user = PCustomer.find_by_email(params[:email])
|
user = PCustomer.find_by_email(params[:email])
|
||||||
|
|
||||||
if user && user.authenticate(params[:password])
|
if user && user.password_digest && user.authenticate(params[:password].to_s)
|
||||||
#session[:forum_user_id] = user.id
|
#session[:forum_user_id] = user.id
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,12 @@ class Public::POrdersController < ApplicationController
|
|||||||
|
|
||||||
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
|
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to cart_public_p_orders_path()}
|
||||||
|
format.js { render :layout => false }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
redirect_to cart_public_p_orders_path()
|
|
||||||
else
|
else
|
||||||
render action: "cart"
|
render action: "cart"
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
module MailHelper
|
module MailHelper
|
||||||
|
|
||||||
def mail_content(slug, lang, arguments = {})
|
def mail_content(mail_content, lang_slug, arguments = {})
|
||||||
|
|
||||||
lang_site = LangSite.find_by_slug(lang)
|
lang_site = LangSite.find_by_slug(lang_slug)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mail_content = MailContent.joins(:mail_type).where(:lang_site_id => lang_site.id, :mail_types => { :slug => slug}).first
|
|
||||||
|
|
||||||
@new_site = true
|
|
||||||
if mail_content.content_type == "blocs" and mail_content.block
|
if mail_content.content_type == "blocs" and mail_content.block
|
||||||
r = "<div class='render_block'>"+render(:partial => "public/blocks/block", :locals => {:block => mail_content.block})+render(:partial => "public/shared/render_block.html.haml")+"</div>"
|
r = "<div class='render_block'>"+render(:partial => "public/blocks/block", :locals => {:block => mail_content.block})+render(:partial => "public/shared/render_block.html.haml")+"</div>"
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
class AdminMailer < ActionMailer::Base
|
class AdminMailer < ActionMailer::Base
|
||||||
def password_reset(admin)
|
def password_reset(admin)
|
||||||
@admin = admin
|
@admin = admin
|
||||||
mail :to => admin.email, :subject => "Reinitialisation du mot de passe.", :from => "info@nicolasbally.com"
|
mail :to => admin.email, :subject => "Reinitialisation du mot de passe.", :from => "n.bally@quartz.xyz"
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_comments
|
def notify_comments
|
||||||
mail :to => "info@3p.quartz.xyz,perrotmathilde@orange.fr", :subject => "Nouveaux commentaires à modérer sur le blog", :from => "info@3p.quartz.xyz"
|
mail :to => "n.bally@quartz.xyz", :subject => "Nouveaux commentaires à modérer sur le blog", :from => "n.bally@quartz.xyz"
|
||||||
end
|
end
|
||||||
end
|
end
|
23
app/mailers/general_mailer.rb
Executable file
23
app/mailers/general_mailer.rb
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
class GeneralMailer < ActionMailer::Base
|
||||||
|
default from: "contact@biocoton.net"
|
||||||
|
|
||||||
|
add_template_helper(MailHelper)
|
||||||
|
|
||||||
|
# Subject can be set in your I18n file at config/locales/en.yml
|
||||||
|
# with the following lookup:
|
||||||
|
#
|
||||||
|
# en.question.deliver.subject
|
||||||
|
#
|
||||||
|
def send_qi_mail(lang_slug, slug, to, options)
|
||||||
|
|
||||||
|
@mail_content = MailContent.find_key(LangSite.find_by_slug(lang_slug), slug)
|
||||||
|
|
||||||
|
@lang_slug = lang_slug
|
||||||
|
|
||||||
|
@options = options
|
||||||
|
|
||||||
|
mail to: to, :subject => "[Biocoton] "+@mail_content.subject.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -1,5 +1,5 @@
|
|||||||
class QuestionMailer < ActionMailer::Base
|
class QuestionMailer < ActionMailer::Base
|
||||||
default from: "info@3p.quartz.xyz"
|
default from: "info@quartz.xyz"
|
||||||
|
|
||||||
# Subject can be set in your I18n file at config/locales/en.yml
|
# Subject can be set in your I18n file at config/locales/en.yml
|
||||||
# with the following lookup:
|
# with the following lookup:
|
||||||
@ -9,7 +9,7 @@ class QuestionMailer < ActionMailer::Base
|
|||||||
def send_contact(contact)
|
def send_contact(contact)
|
||||||
@contact = contact
|
@contact = contact
|
||||||
|
|
||||||
mail to: "info@3p.quartz.xyz",:reply_to => @contact.email.to_s, :subject => "[Contact site] "+@contact.raison_text
|
mail to: "info@quartz.xyz",:reply_to => @contact.email.to_s, :subject => "[Contact site] "+@contact.raison_text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,4 +2,16 @@ class MailType < ActiveRecord::Base
|
|||||||
has_many :mail_contents
|
has_many :mail_contents
|
||||||
belongs_to :mail_type_reference, :class_name => "MailType"
|
belongs_to :mail_type_reference, :class_name => "MailType"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def self.generate_mail_content(slug)
|
||||||
|
mc = MailType.new(:slug => slug)
|
||||||
|
LangSite.all.each do |ls|
|
||||||
|
|
||||||
|
mc.mail_contents.new(:lang_site_id => ls.id, :content_type => "text")
|
||||||
|
end
|
||||||
|
mc.save
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
6
app/models/p_box_fdp.rb
Normal file
6
app/models/p_box_fdp.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class PBoxFdp < ActiveRecord::Base
|
||||||
|
belongs_to :p_product
|
||||||
|
belongs_to :element, :polymorphic => true
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -20,12 +20,34 @@ class PCustomer < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
belongs_to :p_price_cat
|
belongs_to :p_price_cat
|
||||||
|
|
||||||
|
|
||||||
attr_accessor :valid_public
|
attr_accessor :valid_public, :generate_mdp
|
||||||
|
before_validation do
|
||||||
|
self.generate_token if !self.token? and self.email?
|
||||||
|
end
|
||||||
|
def generate_mdp_now
|
||||||
|
ps = SecureRandom.hex(4)
|
||||||
|
self.password = ps
|
||||||
|
self.password_confirmation = ps
|
||||||
|
|
||||||
|
if !self.email?
|
||||||
|
errors.add(:email, "Doit être présent")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if self.save
|
||||||
|
GeneralMailer.send_qi_mail("fr", "generation_mdp", self.email, {"mdp" => ps}).deliver
|
||||||
|
else
|
||||||
|
fgfdggdf = dfgdgf
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def public_validation?
|
def public_validation?
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
class PCustomerSheet < ActiveRecord::Base
|
class PCustomerSheet < ActiveRecord::Base
|
||||||
has_many :p_documents, :as => :element
|
has_many :p_documents, :as => :element
|
||||||
|
|
||||||
|
has_many :p_box_fdps, :as => :element
|
||||||
|
accepts_nested_attributes_for :p_box_fdps, allow_destroy: true
|
||||||
|
|
||||||
|
|
||||||
belongs_to :p_customer
|
belongs_to :p_customer
|
||||||
accepts_nested_attributes_for :p_customer
|
accepts_nested_attributes_for :p_customer
|
||||||
|
|
||||||
@ -247,6 +252,15 @@ class PCustomerSheet < ActiveRecord::Base
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_fa
|
||||||
|
|
||||||
|
if self.p_documents.create(:p_document_type => PDocumentType.find_by_label("Facture acompte"))
|
||||||
|
self.state = "commande"
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def generate_bc
|
def generate_bc
|
||||||
|
|
||||||
if self.p_documents.create(:p_document_type => PDocumentType.find_by_label("Bon de commande"))
|
if self.p_documents.create(:p_document_type => PDocumentType.find_by_label("Bon de commande"))
|
||||||
@ -297,6 +311,11 @@ class PCustomerSheet < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def generate_fdp
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
STATES = ["panier", "brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"]
|
STATES = ["panier", "brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"]
|
||||||
|
|
||||||
ECOM_STATUS = ["commande", "commande validée", "en livraison", "livrée"]
|
ECOM_STATUS = ["commande", "commande validée", "en livraison", "livrée"]
|
||||||
|
@ -2,7 +2,7 @@ class PDegressif < ActiveRecord::Base
|
|||||||
belongs_to :p_product
|
belongs_to :p_product
|
||||||
|
|
||||||
|
|
||||||
has_many :p_price_cat_p_degressifs
|
has_many :p_price_cat_p_degressifs, :dependent => :destroy
|
||||||
|
|
||||||
has_many :p_price_cats, :through => :p_price_cat_p_degressifs
|
has_many :p_price_cats, :through => :p_price_cat_p_degressifs
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@ class PDocument < ActiveRecord::Base
|
|||||||
archive_sheet_line
|
archive_sheet_line
|
||||||
end
|
end
|
||||||
before_create do
|
before_create do
|
||||||
|
self.fdp_force_price = self.element.fdp_force_price
|
||||||
|
self.acompte_percent = self.element.acompte_percent
|
||||||
|
|
||||||
if self.element_type == "PCustomerSheet" and self.element.particular_bill
|
if self.element_type == "PCustomerSheet" and self.element.particular_bill
|
||||||
self.particular_bill = self.element.particular_bill.dup
|
self.particular_bill = self.element.particular_bill.dup
|
||||||
self.particular_bill.owner = nil
|
self.particular_bill.owner = nil
|
||||||
@ -35,6 +38,7 @@ class PDocument < ActiveRecord::Base
|
|||||||
self.th_paid_completed?
|
self.th_paid_completed?
|
||||||
|
|
||||||
if self.element_type == "PCustomerSheet"
|
if self.element_type == "PCustomerSheet"
|
||||||
|
|
||||||
self.p_customer = self.element.p_customer
|
self.p_customer = self.element.p_customer
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,7 +58,8 @@ class PDocument < ActiveRecord::Base
|
|||||||
def archive_sheet_line
|
def archive_sheet_line
|
||||||
if self.element_type == "PCustomerSheet"
|
if self.element_type == "PCustomerSheet"
|
||||||
|
|
||||||
|
|
||||||
|
self.save
|
||||||
self.element.p_sheet_lines.joins(:p_product).each do |p_sheet_line|
|
self.element.p_sheet_lines.joins(:p_product).each do |p_sheet_line|
|
||||||
|
|
||||||
n_sheet_line = p_sheet_line.dup
|
n_sheet_line = p_sheet_line.dup
|
||||||
@ -67,10 +72,58 @@ class PDocument < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
p_colors_archiveds = []
|
||||||
|
|
||||||
|
p_sizes_archiveds = []
|
||||||
|
|
||||||
p_sheet_line.p_sheet_line_lines.each do |psll|
|
p_sheet_line.p_sheet_line_lines.each do |psll|
|
||||||
new_psll = psll.dup
|
new_psll = psll.dup
|
||||||
|
|
||||||
new_psll.fige
|
|
||||||
|
|
||||||
|
#Attention avant fonction fige
|
||||||
|
#new_psll.fige ########
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if new_psll.p_product_stock.p_color
|
||||||
|
|
||||||
|
if p_color = p_colors_archiveds[new_psll.p_product_stock.p_color_id]
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
p_color = new_psll.p_product_stock.p_color.dup
|
||||||
|
p_color.archived = true
|
||||||
|
|
||||||
|
p_colors_archiveds[new_psll.p_product_stock.p_color_id] = p_color
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
new_psll.p_color = p_color
|
||||||
|
end
|
||||||
|
|
||||||
|
if new_psll.p_product_stock.p_size
|
||||||
|
|
||||||
|
if p_size = p_sizes_archiveds[new_psll.p_product_stock.p_size_id]
|
||||||
|
|
||||||
|
else
|
||||||
|
p_size = new_psll.p_product_stock.p_size.dup
|
||||||
|
p_size.archived = true
|
||||||
|
|
||||||
|
|
||||||
|
p_sizes_archiveds[new_psll.p_product_stock.p_size_id] = p_size
|
||||||
|
end
|
||||||
|
|
||||||
|
new_psll.p_size = p_size
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
new_psll.ok_code = new_psll.p_product_stock.code
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#end ################
|
||||||
|
|
||||||
|
|
||||||
n_sheet_line.p_sheet_line_lines << new_psll
|
n_sheet_line.p_sheet_line_lines << new_psll
|
||||||
|
@ -8,16 +8,16 @@ class PProduct < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :p_ep
|
belongs_to :p_ep
|
||||||
|
|
||||||
has_many :p_product_colors
|
has_many :p_product_colors, :dependent => :destroy
|
||||||
has_many :p_colors, :through => :p_product_colors
|
has_many :p_colors, :through => :p_product_colors
|
||||||
|
|
||||||
has_many :p_product_certifs
|
has_many :p_product_certifs, :dependent => :destroy
|
||||||
has_many :p_certifs, :through => :p_product_certifs
|
has_many :p_certifs, :through => :p_product_certifs
|
||||||
|
|
||||||
has_many :p_product_sizes
|
has_many :p_product_sizes, :dependent => :destroy
|
||||||
has_many :p_sizes, :through => :p_product_sizes
|
has_many :p_sizes, :through => :p_product_sizes
|
||||||
|
|
||||||
has_many :p_product_qtes
|
has_many :p_product_qtes, :dependent => :destroy
|
||||||
has_many :p_qtes, :through => :p_product_qtes
|
has_many :p_qtes, :through => :p_product_qtes
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +51,11 @@ class PProduct < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
def generate_degressif
|
def generate_degressif
|
||||||
vals = [100,200,300,400,500,1000,3000,5000,10000]
|
vals = [0]#[100,200,300,400,500,1000,3000,5000,10000]
|
||||||
|
|
||||||
vals.each do |val|
|
vals.each do |val|
|
||||||
|
|
||||||
self.p_degressifs.create(:nbr => val)
|
self.p_degressifs.create(:nbr => val, :p_price_cat_ids => PPriceCat.all.ids)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,4 +2,7 @@ class PProductStock < ActiveRecord::Base
|
|||||||
belongs_to :p_product
|
belongs_to :p_product
|
||||||
belongs_to :p_color
|
belongs_to :p_color
|
||||||
belongs_to :p_size
|
belongs_to :p_size
|
||||||
|
|
||||||
|
has_many :p_sheet_line_lines, :dependent => :delete_all
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
class PSheetLine < ActiveRecord::Base
|
class PSheetLine < ActiveRecord::Base
|
||||||
belongs_to :p_customer_sheet
|
belongs_to :p_customer_sheet
|
||||||
|
|
||||||
|
belongs_to :p_document
|
||||||
|
|
||||||
has_one :p_customer, :through => :p_customer_sheet
|
has_one :p_customer, :through => :p_customer_sheet
|
||||||
belongs_to :p_product
|
belongs_to :p_product
|
||||||
belongs_to :p_tank
|
belongs_to :p_tank
|
||||||
@ -138,7 +140,7 @@ class PSheetLine < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
product_degressif = self.p_product.p_degressifs.joins(:p_price_cats).where("nbr >= ?", self.qte).where(:p_price_cats => {:id => p_price_cat.id}).order("nbr ASC").first
|
product_degressif = self.p_product.p_degressifs.joins(:p_price_cats).where("nbr <= ?", self.qte).where(:p_price_cats => {:id => p_price_cat.id}).order("nbr DESC").first
|
||||||
if product_degressif
|
if product_degressif
|
||||||
price = product_degressif.price.to_f
|
price = product_degressif.price.to_f
|
||||||
|
|
||||||
@ -355,8 +357,8 @@ class PSheetLine < ActiveRecord::Base
|
|||||||
r[:fdp] = {:label =>"Frais de port HT",:value => fdp}
|
r[:fdp] = {:label =>"Frais de port HT",:value => fdp}
|
||||||
|
|
||||||
|
|
||||||
total = total +fdp
|
total = total +fdp.to_f
|
||||||
total_ttc = total_ttc + (fdp*1.2)
|
total_ttc = total_ttc + (fdp.to_f*1.2)
|
||||||
r[:total] = {:label =>"Total HT",:value => total}
|
r[:total] = {:label =>"Total HT",:value => total}
|
||||||
r[:tva] = {:label =>"TVA",:value => total_ttc - total}
|
r[:tva] = {:label =>"TVA",:value => total_ttc - total}
|
||||||
r[:total_ttc] = {:label =>"Total TTC",:value => total_ttc}
|
r[:total_ttc] = {:label =>"Total TTC",:value => total_ttc}
|
||||||
@ -370,14 +372,30 @@ class PSheetLine < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
def self.frais_de_port(p_sheet_lines)
|
def self.frais_de_port(p_sheet_lines)
|
||||||
if PSheetLine.total_articles(p_sheet_lines)[:total] > PSheetLine.franco_port
|
|
||||||
0.0
|
if p_sheet_lines[0] and ((p_sheet_lines[0].p_customer_sheet and p_sheet_lines[0].p_customer_sheet.fdp_force_price) or (p_sheet_lines[0].p_document and p_sheet_lines[0].p_document.fdp_force_price))
|
||||||
|
if p_sheet_lines[0].p_document
|
||||||
|
p_sheet_lines[0].p_document.fdp_force_price
|
||||||
|
elsif p_sheet_lines[0].p_customer_sheet
|
||||||
|
p_sheet_lines[0].p_customer_sheet.fdp_force_price
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
PSheetLine.ship_affects(p_sheet_lines) * PSheetLine.carton_price
|
if PSheetLine.total_articles(p_sheet_lines)[:total] > PSheetLine.franco_port
|
||||||
|
0.0
|
||||||
|
else
|
||||||
|
PSheetLine.ship_affects(p_sheet_lines) * PSheetLine.carton_price
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ship_affects(p_sheet_lines)
|
def self.ship_affects(p_sheet_lines)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
=semantic_form_for [:admin, @p_customer_sheet], :remote => false do |form|
|
=semantic_form_for [:admin, @p_customer_sheet], :remote => false, :html => {:id => "cart_form"} do |form|
|
||||||
|
|
||||||
.content
|
.content
|
||||||
%h3 Client
|
%h3 Client
|
||||||
@ -201,29 +201,32 @@
|
|||||||
=form.semantic_fields_for :p_sheet_lines do |form|
|
=form.semantic_fields_for :p_sheet_lines do |form|
|
||||||
=render :partial => "admin/p_sheet_lines/form", :locals => {:form => form}
|
=render :partial => "admin/p_sheet_lines/form", :locals => {:form => form}
|
||||||
|
|
||||||
%p= link_to_add_fields "Ajouter une ligne", form, :p_sheet_lines
|
%p= link_to_add_fields "Ajouter une ligne", form, :p_sheet_lines
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
%strong Totaux
|
|
||||||
|
|
||||||
%table{:style => "width:100%;"}
|
= form.input :fdp_force_price, :label => "Frais de port (calculés automatiquement si vides) :"
|
||||||
%td{:style => "text-align:right;"}
|
|
||||||
Total HT :
|
|
||||||
%td.price_td
|
|
||||||
.price_emp.p_sheet_lines_tot_ht
|
|
||||||
|
|
||||||
%table{:style => "width:100%;"}
|
|
||||||
%td{:style => "text-align:right;"}
|
-if false
|
||||||
TVA :
|
%p
|
||||||
%td.price_td
|
%strong Totaux
|
||||||
.price_emp.p_sheet_lines_tot_tva
|
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%td{:style => "text-align:right;"}
|
||||||
|
Total HT :
|
||||||
|
%td.price_td
|
||||||
|
.price_emp.p_sheet_lines_tot_ht
|
||||||
|
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%td{:style => "text-align:right;"}
|
||||||
|
TVA :
|
||||||
|
%td.price_td
|
||||||
|
.price_emp.p_sheet_lines_tot_tva
|
||||||
|
|
||||||
%table{:style => "width:100%;"}
|
%table{:style => "width:100%;"}
|
||||||
%td{:style => "text-align:right;"}
|
%td{:style => "text-align:right;"}
|
||||||
Total TTC :
|
Total TTC :
|
||||||
%td.price_td
|
%td.price_td
|
||||||
.price_emp.p_sheet_lines_tot_ttc
|
.price_emp.p_sheet_lines_tot_ttc
|
||||||
|
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
@ -292,4 +295,16 @@
|
|||||||
margin-bottom:0}
|
margin-bottom:0}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
:coffeescript
|
||||||
|
|
||||||
|
|
||||||
|
udpate_sheet_lines()
|
||||||
|
|
||||||
|
$("#cart_form").change ->
|
||||||
|
udpate_sheet_lines()
|
||||||
|
|
||||||
|
$("#cart_form").keyup ->
|
||||||
|
udpate_sheet_lines()
|
||||||
|
@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
%td
|
%td
|
||||||
-totals = PSheetLine.totals(p_customer_sheet.p_sheet_lines)
|
-totals = PSheetLine.totals(p_customer_sheet.p_sheet_lines)
|
||||||
-if p_customer_sheet.state_ok?
|
=number_to_currency totals[:total]
|
||||||
=number_to_currency totals[:ok_total]
|
|
||||||
-else
|
|
||||||
=number_to_currency totals[:total]
|
|
||||||
|
|
||||||
|
|
||||||
%td=raw p_customer_sheet.state_html
|
%td=raw p_customer_sheet.state_html
|
||||||
|
@ -121,6 +121,9 @@
|
|||||||
%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 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"
|
%p=link_to "Générer le bon de commande", generate_bc_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-success"
|
||||||
%p=link_to "Marquer l'offre comme refusée", reject_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-danger"
|
%p=link_to "Marquer l'offre comme refusée", reject_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-danger"
|
||||||
|
|
||||||
|
-if @p_customer_sheet.acompte_percent?
|
||||||
|
%p=link_to "Générer la facture d'acompte", generate_fa_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
||||||
|
|
||||||
-elsif @p_customer_sheet.state == "commande" and @p_customer_sheet.p_sheet_lines.joins(:p_product).where("bl = 0 and (p_products.p_product_cat_id != 6 OR (p_products.p_product_cat_id = 6 and externe = 1))").count > 0
|
-elsif @p_customer_sheet.state == "commande" and @p_customer_sheet.p_sheet_lines.joins(:p_product).where("bl = 0 and (p_products.p_product_cat_id != 6 OR (p_products.p_product_cat_id = 6 and externe = 1))").count > 0
|
||||||
%p=link_to "Générer le bon de livraison", generate_bl_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
%p=link_to "Générer le bon de livraison", generate_bl_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
||||||
@ -128,6 +131,9 @@
|
|||||||
=#-elsif @p_customer_sheet.state == "livrée"
|
=#-elsif @p_customer_sheet.state == "livrée"
|
||||||
%p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
%p=link_to "Générer la facture", generate_f_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
||||||
|
|
||||||
|
-if @p_customer_sheet.acompte_percent?
|
||||||
|
%p=link_to "Générer la facture d'acompte", generate_fa_admin_p_customer_sheet_path(@p_customer_sheet), :class => "btn btn-primary"
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
= form.input :code, :label => "Code client :"
|
= form.input :code, :label => "Code client :"
|
||||||
|
|
||||||
= form.input :email, :label => "Email client (login) :"
|
= form.input :email, :label => "Email client (login) :"
|
||||||
|
|
||||||
|
= form.input :generate_mdp, :label => "Forcer la génération d'un nouveau mot de passe ? (un mail sera envoyé au client)", :as => :boolean
|
||||||
|
|
||||||
= form.input :password, :label => "Mot de passe :"
|
= form.input :password, :label => "Mot de passe :"
|
||||||
|
|
||||||
|
|
||||||
@ -44,9 +47,7 @@
|
|||||||
|
|
||||||
%p= link_to_add_fields "Ajouter une contact au client", form, :p_contacts
|
%p= link_to_add_fields "Ajouter une contact au client", form, :p_contacts
|
||||||
|
|
||||||
%hr
|
|
||||||
= form.input :mlm_token, :label => "Code parrain :"
|
|
||||||
|
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
=form.input :p_price_cat_id, :label => "Catégories de prix :", :as => :select, :collection => PPriceCat.all, :include_blank => false
|
=form.input :p_price_cat_id, :label => "Catégories de prix :", :as => :select, :collection => PPriceCat.all, :include_blank => false
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
%tr.p_degressif_form.field
|
%tr.p_degressif_form.field
|
||||||
%td{:style => "width:30%"}
|
%td{:style => "width:30%"}
|
||||||
=form.input :nbr, :label => "Nombre max :"
|
=form.input :nbr, :label => "Nombre min :"
|
||||||
%td{:style => "width:40%"}
|
%td{:style => "width:40%"}
|
||||||
=form.input :price, :label => "Prix"
|
=form.input :price, :label => "Prix"
|
||||||
%td{:style => "width:20%"}
|
%td{:style => "width:20%"}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||||
=@p_document.label
|
=@p_document.label
|
||||||
|
|
||||||
n°
|
n°
|
||||||
=@p_document.d_number
|
=@p_document.d_number
|
||||||
%br
|
%br
|
||||||
|
@ -24,10 +24,7 @@
|
|||||||
%td
|
%td
|
||||||
- p_product.p_qtes.each do |p_qte|
|
- p_product.p_qtes.each do |p_qte|
|
||||||
=p_qte.qte
|
=p_qte.qte
|
||||||
|
|
||||||
=debug p_product.p_degressifs.count
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td.actions
|
%td.actions
|
||||||
|
@ -1,98 +1,215 @@
|
|||||||
.product_stock_form.field
|
-if true
|
||||||
%hr
|
#p_sheet_line.product_stock_form.field.p_sheet_line_field{:id => form.object.id}
|
||||||
%table{:style => "width:100%;"}
|
|
||||||
%tr
|
-if form.object.lock != true
|
||||||
%td
|
=link_to_remove_fields ic(:"trash-o"), form
|
||||||
%label Produit :
|
|
||||||
%input.p_product_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product.code} #{form.object.p_product.name}" if form.object.p_product), :readonly => ("true" if form.object.id)}
|
%label Produit :
|
||||||
|
%input.p_product_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product.code} #{form.object.p_product.name}" if form.object.p_product), :readonly => ("true" if form.object.id)}
|
||||||
|
|
||||||
|
|
||||||
|
= form.hidden_field :p_product_id, :class => "p_product_id"
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$( function() {
|
||||||
|
|
||||||
|
$('.p_product_autocomplete_input').autocomplete({
|
||||||
|
source: function( request, response ) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "/admin/p_products/autocomplete.json",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
search: request.term
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
|
||||||
|
arr = jQuery.map( data, function( item ) {
|
||||||
|
return {
|
||||||
|
label: item.code+" "+item.name,
|
||||||
|
value: item.code+" "+item.name,
|
||||||
|
id: item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
response(arr)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
minLength: 2,
|
||||||
|
select: function( event, ui ) {
|
||||||
|
|
||||||
|
$(this).next(".p_product_id").val(ui.item.id)
|
||||||
|
|
||||||
|
//return false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-p_product = form.object.p_product if form.object.p_product
|
||||||
|
%table.table.order_table
|
||||||
|
%tr
|
||||||
|
%th
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-if form.object.p_product
|
||||||
|
|
||||||
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
|
%th.size_th
|
||||||
|
=p_size.name
|
||||||
|
|
||||||
|
%th.price_td PU
|
||||||
|
%th.price_td
|
||||||
|
Prix tot.
|
||||||
|
-if form.object.p_product
|
||||||
|
-p_product.p_colors.all.each do |p_color|
|
||||||
|
%tr.color_line
|
||||||
|
%td=p_color.name
|
||||||
|
|
||||||
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
|
%td
|
||||||
|
-ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
|
||||||
|
|
||||||
|
-if ps
|
||||||
|
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
|
||||||
|
-if p_sheet_line_line
|
||||||
|
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||||
|
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||||
|
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||||
|
|
||||||
|
%td.price.price_td{:data => {:price => form.object.price}}
|
||||||
|
=number_to_currency form.object.price
|
||||||
|
|
||||||
|
%td.price_color_tot.price_td
|
||||||
|
|
||||||
|
-if form.object.p_product
|
||||||
|
%table{:style => "width:100%"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%tr
|
||||||
|
|
||||||
|
%td
|
||||||
|
 
|
||||||
|
%td.qte_tot.price_td{:style => "font-weight:bold;"}
|
||||||
|
%strong=form.object.qte
|
||||||
|
|
||||||
|
%td.price.price_td{:style => "font-weight:bold;", :data => {:price => form.object.price}}
|
||||||
|
%strong=number_to_currency form.object.price
|
||||||
|
|
||||||
|
|
||||||
|
%td.price_tot.price_td{:style => "font-weight:bold;"}
|
||||||
|
=number_to_currency form.object.price_tot
|
||||||
|
%br
|
||||||
|
|
||||||
|
-if false
|
||||||
|
.product_stock_form.field
|
||||||
|
%hr
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%label Produit :
|
||||||
|
%input.p_product_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product.code} #{form.object.p_product.name}" if form.object.p_product), :readonly => ("true" if form.object.id)}
|
||||||
|
|
||||||
|
|
||||||
= form.hidden_field :p_product_id, :class => "p_product_id"
|
= form.hidden_field :p_product_id, :class => "p_product_id"
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$( function() {
|
$( function() {
|
||||||
|
|
||||||
$('.p_product_autocomplete_input').autocomplete({
|
$('.p_product_autocomplete_input').autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "/admin/p_products/autocomplete.json",
|
url: "/admin/p_products/autocomplete.json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
data: {
|
||||||
search: request.term
|
search: request.term
|
||||||
},
|
},
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
|
||||||
arr = jQuery.map( data, function( item ) {
|
arr = jQuery.map( data, function( item ) {
|
||||||
return {
|
return {
|
||||||
label: item.code+" "+item.name,
|
label: item.code+" "+item.name,
|
||||||
value: item.code+" "+item.name,
|
value: item.code+" "+item.name,
|
||||||
id: item.id
|
id: item.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
response(arr)
|
response(arr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
|
|
||||||
$(this).next(".p_product_id").val(ui.item.id)
|
$(this).next(".p_product_id").val(ui.item.id)
|
||||||
|
|
||||||
//return false
|
//return false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
-if form.object.p_product
|
-if form.object.p_product
|
||||||
|
|
||||||
-p_product = form.object.p_product
|
-p_product = form.object.p_product
|
||||||
|
|
||||||
|
|
||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
%th Taille
|
%th Taille
|
||||||
%th Couleur
|
%th Couleur
|
||||||
%th Qte
|
%th Qte
|
||||||
-s = "a"
|
-s = "a"
|
||||||
-si = 1
|
-si = 1
|
||||||
|
|
||||||
|
|
||||||
-if true
|
-if true
|
||||||
-p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
|
-p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
|
||||||
|
|
||||||
-si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
|
-si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
-if ps.p_size_id != s
|
-if ps.p_size_id != s
|
||||||
-s = ps.p_size_id
|
-s = ps.p_size_id
|
||||||
|
|
||||||
%td{:rowspan => si}
|
%td{:rowspan => si}
|
||||||
=si
|
=si
|
||||||
=ps.p_size.name if ps.p_size
|
=ps.p_size.name if ps.p_size
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=ps.p_color.name if ps.p_color
|
=ps.p_color.name if ps.p_color
|
||||||
|
|
||||||
%td
|
%td
|
||||||
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock => ps.id).first
|
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock => ps.id).first
|
||||||
|
|
||||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||||
=builder.input :qte,:label => false, :as => :string
|
=builder.input :qte,:label => false, :as => :string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-if form.object.lock != true
|
|
||||||
=link_to_remove_fields ic(:"trash-o"), form
|
|
@ -8,9 +8,9 @@
|
|||||||
%th
|
%th
|
||||||
Description
|
Description
|
||||||
%th
|
%th
|
||||||
Taille
|
|
||||||
%th
|
%th
|
||||||
Couleur
|
|
||||||
%th
|
%th
|
||||||
Qte
|
Qte
|
||||||
%th
|
%th
|
||||||
@ -25,45 +25,77 @@
|
|||||||
-p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
|
-p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
|
||||||
-nbr_lines = p_sheet_line_lines.count
|
-nbr_lines = p_sheet_line_lines.count
|
||||||
-ok = true if sheet_line.shiped
|
-ok = true if sheet_line.shiped
|
||||||
%tr.sheet_line_head
|
|
||||||
|
|
||||||
%td
|
|
||||||
=sheet_line.product_name
|
|
||||||
|
|
||||||
%td
|
|
||||||
%td
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%tr
|
||||||
|
%td{:colspan => 3, :style => "text-align:right;"}
|
||||||
|
%table.size_table
|
||||||
|
%tr
|
||||||
|
%th{:style => "text-align:left !important;"}
|
||||||
|
=sheet_line.product_name
|
||||||
|
fdfd
|
||||||
|
|
||||||
|
-p_sheet_line_lines.group(:p_size_id).uniq.each do |psize|
|
||||||
|
%th.p_size_td=psize.p_size.name
|
||||||
|
|
||||||
|
|
||||||
|
%td{:colspan => 4}
|
||||||
|
-p_sheet_line_lines.group(:p_color_id).uniq.each do |pc|
|
||||||
|
-qte_tot = 0.0
|
||||||
|
%tr
|
||||||
|
%td{:colspan => 3, :style => "text-align:right;"}
|
||||||
|
%table.size_table
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
=pc.p_color.name
|
||||||
|
|
||||||
|
-p_sheet_line_lines.group(:p_size_id).uniq.each do |psize|
|
||||||
|
|
||||||
|
%td.p_size_td
|
||||||
|
-psl = p_sheet_line_lines.where(:p_size_id => psize.p_size_id, :p_color_id => pc.p_color_id ).first
|
||||||
|
-if psl
|
||||||
|
=psl.qte
|
||||||
|
-qte_tot += psl.qte
|
||||||
|
|
||||||
|
|
||||||
|
%td{}
|
||||||
|
=qte_tot.to_i
|
||||||
|
%td
|
||||||
|
=number_to_currency sheet_line.price.to_f
|
||||||
|
%td
|
||||||
|
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||||
|
|
||||||
|
%td
|
||||||
|
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||||
|
|
||||||
|
%tr.tr_sheet_line_head
|
||||||
|
|
||||||
|
%td
|
||||||
|
|
||||||
|
|
||||||
|
%td
|
||||||
|
%td
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=sheet_line.qte
|
=sheet_line.qte
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price if sheet_line.price
|
=number_to_currency sheet_line.price if sheet_line.price
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
||||||
|
|
||||||
|
|
||||||
-p_sheet_line_lines.each do |p_sheet_line_line|
|
|
||||||
%tr
|
|
||||||
|
|
||||||
%td
|
|
||||||
|
|
||||||
%td
|
|
||||||
=p_sheet_line_line.p_size.name if p_sheet_line_line.p_size
|
|
||||||
%td
|
|
||||||
=p_sheet_line_line.p_color.name if p_sheet_line_line.p_color
|
|
||||||
%td
|
|
||||||
=p_sheet_line_line.qte
|
|
||||||
|
|
||||||
%td
|
|
||||||
%td
|
|
||||||
%td
|
|
||||||
|
|
||||||
-total_with_labels = PSheetLine.total_with_labels(sheet_lines)
|
-total_with_labels = PSheetLine.total_with_labels(sheet_lines)
|
||||||
|
|
||||||
-total_with_labels.each do |index, total|
|
-total_with_labels.each do |index, total|
|
||||||
@ -75,8 +107,26 @@
|
|||||||
=total[:label]
|
=total[:label]
|
||||||
%td
|
%td
|
||||||
=number_to_currency total[:value]
|
=number_to_currency total[:value]
|
||||||
|
|
||||||
|
-if @p_document and @p_document.label == "Facture Acompte"
|
||||||
|
%tr
|
||||||
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
|
Pourcentage d'acompte :
|
||||||
|
%td
|
||||||
|
=@p_document.acompte_percent.to_s+"%"
|
||||||
|
%tr
|
||||||
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
|
Acompte HT :
|
||||||
|
%td
|
||||||
|
=number_to_currency @p_document.total_with_labels_table[:total][:value] * (@p_document.acompte_percent.to_f/100)
|
||||||
|
|
||||||
|
%tr.sheet_line_head
|
||||||
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
|
%strong Acompte TTC :
|
||||||
|
%td
|
||||||
|
%strong=number_to_currency @p_document.total_with_labels_table[:total_ttc][:value] * (@p_document.acompte_percent.to_f/100)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:scss
|
:scss
|
||||||
.sheet_line_head{
|
.sheet_line_head{
|
||||||
@ -85,6 +135,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.tr_sheet_line_head{
|
||||||
|
td, th{
|
||||||
|
border:0;
|
||||||
|
border-bottom: 1px solid rgba(0,0,0,0.5) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.marges{
|
.marges{
|
||||||
td{
|
td{
|
||||||
vertical-align:top;
|
vertical-align:top;
|
||||||
@ -93,4 +153,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.size_table{
|
||||||
|
width:97%;
|
||||||
|
|
||||||
|
text-align:center;
|
||||||
|
margin-right:3%;
|
||||||
|
td,th{
|
||||||
|
text-align:right;
|
||||||
|
border:0;
|
||||||
|
border-right:solid 1px rgba(0,0,0,0.1) !important;
|
||||||
|
padding:0 3px;
|
||||||
|
}
|
||||||
|
.p_size_td{
|
||||||
|
width:60px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
1
app/views/general_mailer/send_qi_mail.html.haml
Normal file
1
app/views/general_mailer/send_qi_mail.html.haml
Normal file
@ -0,0 +1 @@
|
|||||||
|
=mail_content(@mail_content, @lang_slug, @options)
|
15
app/views/public/p_orders/_cart_totals.html.haml
Normal file
15
app/views/public/p_orders/_cart_totals.html.haml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-total_with_labels = @p_customer_sheet.total_with_labels_table
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%table{:style => "width:100%;"}
|
||||||
|
-total_with_labels.each do |index, total|
|
||||||
|
|
||||||
|
|
||||||
|
%tr
|
||||||
|
%td{:style => "text-align:right;"}
|
||||||
|
%strong
|
||||||
|
=total[:label]
|
||||||
|
%td.price_td
|
||||||
|
=number_to_currency total[:value]
|
||||||
|
|
@ -9,53 +9,19 @@
|
|||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
|
|
||||||
=semantic_form_for [:public, @p_customer_sheet],:url => update_cart_public_p_orders_path(), :html => { :method => :post, :onchange =>""}, :remote => false do |form|
|
=semantic_form_for [:public, @p_customer_sheet],:url => update_cart_public_p_orders_path(), :html => { :method => :post, :onchange =>"", :id => "cart_form"}, :remote => true do |form|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.p_sheet_lines_form
|
.p_sheet_lines_form
|
||||||
=form.semantic_fields_for :p_sheet_lines do |form|
|
=form.semantic_fields_for :p_sheet_lines do |form|
|
||||||
#p_sheet_line.product_stock_form.field{:id => form.object.id}
|
#p_sheet_line.product_stock_form.field.p_sheet_line_field{:id => form.object.id}
|
||||||
%hr
|
|
||||||
%table{:style => "width:100%"}
|
|
||||||
%tr
|
|
||||||
%th Produit :
|
|
||||||
|
|
||||||
%th{:style => "width:15px;"}
|
|
||||||
Quantité
|
|
||||||
|
|
||||||
%th
|
|
||||||
Prix U
|
|
||||||
|
|
||||||
%th
|
|
||||||
Prix Tot
|
|
||||||
|
|
||||||
%th{:style => "width:15px;"}
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
|
|
||||||
=form.object.p_product.name
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%td.qte
|
|
||||||
=form.object.qte
|
|
||||||
%td.price
|
|
||||||
=number_to_currency form.object.price
|
|
||||||
|
|
||||||
%td.price_tot
|
|
||||||
=number_to_currency form.object.price_tot
|
|
||||||
|
|
||||||
%td
|
|
||||||
=link_to_remove_fields ic(:"trash-o"), form
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -67,39 +33,61 @@
|
|||||||
|
|
||||||
-p_product = form.object.p_product
|
-p_product = form.object.p_product
|
||||||
|
|
||||||
|
|
||||||
%table.table
|
%table.table.order_table
|
||||||
%tr
|
%tr
|
||||||
%th Taille
|
%th
|
||||||
%th Couleur
|
=form.object.p_product.name
|
||||||
%th Qte
|
=link_to_remove_fields ic(:"trash-o"), form
|
||||||
-s = "a"
|
|
||||||
-si = 1
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
|
%th.size_th
|
||||||
|
=p_size.name
|
||||||
-if true
|
|
||||||
-p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
|
%th.price_td PU
|
||||||
|
%th.price_td
|
||||||
-si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
|
Prix tot.
|
||||||
|
|
||||||
%tr
|
-p_product.p_colors.all.each do |p_color|
|
||||||
-if ps.p_size_id != s
|
%tr.color_line
|
||||||
-s = ps.p_size_id
|
%td=p_color.name
|
||||||
|
|
||||||
%td{:rowspan => si}
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
=si
|
|
||||||
=ps.p_size.name if ps.p_size
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=ps.p_color.name if ps.p_color
|
-ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
|
||||||
|
|
||||||
%td
|
-if ps
|
||||||
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock => ps.id).first
|
-p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
|
||||||
|
-if p_sheet_line_line
|
||||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||||
=builder.input :qte,:label => false, :as => :string, :input_html => {:maxlength => 10}
|
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||||
|
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||||
|
|
||||||
|
%td.price.price_td{:data => {:price => form.object.price}}
|
||||||
|
=number_to_currency form.object.price
|
||||||
|
|
||||||
|
%td.price_color_tot.price_td
|
||||||
|
|
||||||
|
|
||||||
|
%table{:style => "width:100%"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%tr
|
||||||
|
|
||||||
|
%td
|
||||||
|
 
|
||||||
|
%td.qte_tot.price_td{:style => "font-weight:bold;"}
|
||||||
|
%strong=form.object.qte
|
||||||
|
|
||||||
|
%td.price.price_td{:style => "font-weight:bold;", :data => {:price => form.object.price}}
|
||||||
|
%strong=number_to_currency form.object.price
|
||||||
|
|
||||||
|
|
||||||
|
%td.price_tot.price_td{:style => "font-weight:bold;"}
|
||||||
|
=number_to_currency form.object.price_tot
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -107,33 +95,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
%p
|
|
||||||
%strong Totaux
|
|
||||||
|
|
||||||
|
#cart_totals=render :partial => "cart_totals"
|
||||||
-total_with_labels = form.object.total_with_labels_table
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%table{:style => "width:100%;"}
|
|
||||||
-total_with_labels.each do |index, total|
|
|
||||||
|
|
||||||
|
|
||||||
%tr
|
|
||||||
%td{:style => "text-align:right;"}
|
|
||||||
%strong
|
|
||||||
=total[:label]
|
|
||||||
%td.price_td
|
|
||||||
=number_to_currency total[:value]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
=form.submit "sauvegarder", :class => "btn btn-primary"
|
=#form.submit "sauvegarder", :class => "btn btn-primary"
|
||||||
|
|
||||||
=link_to "Suivant", particulars_public_p_orders_path
|
=link_to "Suivant", particulars_public_p_orders_path, :class => "btn btn-primary"
|
||||||
|
|
||||||
|
|
||||||
:scss
|
:scss
|
||||||
@ -161,4 +133,22 @@
|
|||||||
margin-bottom:0}
|
margin-bottom:0}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:scss
|
||||||
|
.size_th{
|
||||||
|
width:80px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
:coffeescript
|
||||||
|
|
||||||
|
|
||||||
|
udpate_sheet_lines()
|
||||||
|
|
||||||
|
$("#cart_form").change ->
|
||||||
|
udpate_sheet_lines()
|
||||||
|
$(this).submit()
|
||||||
|
$("#cart_form").keyup ->
|
||||||
|
udpate_sheet_lines()
|
||||||
|
$(this).submit()
|
||||||
|
1
app/views/public/p_orders/update_cart.js.erb
Normal file
1
app/views/public/p_orders/update_cart.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#cart_totals').html("<%= escape_javascript(render(:partial => "cart_totals"))%>");
|
@ -56,39 +56,70 @@
|
|||||||
-p_product = form.object.p_product
|
-p_product = form.object.p_product
|
||||||
|
|
||||||
|
|
||||||
%table.table.order_table
|
-if false
|
||||||
%tr
|
%table.table.order_table
|
||||||
%th Taille
|
%tr
|
||||||
%th Couleur
|
%th Taille
|
||||||
%th Qte
|
%th Couleur
|
||||||
-s = "a"
|
%th Qte
|
||||||
-si = 1
|
-s = "a"
|
||||||
|
-si = 1
|
||||||
|
|
||||||
|
|
||||||
-if true
|
-if true
|
||||||
-p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
|
-p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps|
|
||||||
|
|
||||||
-si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
|
-si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count()
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
-if ps.p_size_id != s
|
-if ps.p_size_id != s
|
||||||
-s = ps.p_size_id
|
-s = ps.p_size_id
|
||||||
|
|
||||||
%td{:rowspan => si}
|
%td{:rowspan => si}
|
||||||
|
|
||||||
=ps.p_size.name if ps.p_size
|
=ps.p_size.name if ps.p_size
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=ps.p_color.name if ps.p_color
|
=ps.p_color.name if ps.p_color
|
||||||
|
|
||||||
%td
|
%td
|
||||||
-p_sheet_line_line = @p_sheet_line.p_sheet_line_lines.new(:p_product_stock_id => ps.id)
|
-p_sheet_line_line = @p_sheet_line.p_sheet_line_lines.new(:p_product_stock_id => ps.id)
|
||||||
|
|
||||||
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||||
=builder.input :qte,:label => false, :as => :string
|
=builder.input :qte,:label => false, :as => :string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%table.table.order_table
|
||||||
|
%tr
|
||||||
|
%th
|
||||||
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
|
%th.size_th
|
||||||
|
=p_size.name
|
||||||
|
|
||||||
|
-p_product.p_colors.all.each do |p_color|
|
||||||
|
%tr
|
||||||
|
%td=p_color.name
|
||||||
|
|
||||||
|
-p_product.p_sizes.all.each do |p_size|
|
||||||
|
%td
|
||||||
|
-ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
|
||||||
|
|
||||||
|
-if ps
|
||||||
|
-p_sheet_line_line = @p_sheet_line.p_sheet_line_lines.new(:p_product_stock_id => ps.id)
|
||||||
|
|
||||||
|
=form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
|
||||||
|
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||||
|
=builder.input :qte,:label => false, :as => :string
|
||||||
|
|
||||||
|
|
||||||
=form.submit "Commander", :class => "btn btn-primary"
|
=form.submit "Commander", :class => "btn btn-primary"
|
||||||
|
|
||||||
|
:scss
|
||||||
|
.size_th{
|
||||||
|
width:80px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ Rails.application.configure do
|
|||||||
#config.action_mailer.delivery_method = :file
|
#config.action_mailer.delivery_method = :file
|
||||||
|
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
|
config.action_mailer.smtp_settings = { :address => "127.0.0.1", :port => 1025 }
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { :host => HOSTNAME }
|
config.action_mailer.default_url_options = { :host => HOSTNAME }
|
||||||
Rails.application.routes.default_url_options = config.action_mailer.default_url_options = { :host => HOSTNAME, :protocol => 'http' }
|
Rails.application.routes.default_url_options = config.action_mailer.default_url_options = { :host => HOSTNAME, :protocol => 'http' }
|
||||||
|
|
||||||
ANGORA_HOSTNAME = "angora.local:3000"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ upstream coton_app_unicorn {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name 3p.quartz.xyz ;
|
server_name biocoton.quartz.xyz ;
|
||||||
root /srv/www/web/coton_app/current/public;
|
root /srv/www/web/coton_app/current/public;
|
||||||
try_files $uri/index.html $uri @unicorn;
|
try_files $uri/index.html $uri @unicorn;
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name www.3p.quartz.xyz;
|
server_name www.biocoton.quartz.xyz;
|
||||||
rewrite ^(.*) http://3p.quartz.xyz$1 permanent;
|
rewrite ^(.*) http://biocoton.quartz.xyz$1 permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@ Rails.application.routes.draw do
|
|||||||
member do
|
member do
|
||||||
get :generate_d
|
get :generate_d
|
||||||
get :generate_fp
|
get :generate_fp
|
||||||
|
get :generate_fa
|
||||||
get :generate_bc
|
get :generate_bc
|
||||||
get :generate_bl
|
get :generate_bl
|
||||||
get :generate_f
|
get :generate_f
|
||||||
|
18
db/migrate/20181217084852_create_p_box_fdps.rb
Normal file
18
db/migrate/20181217084852_create_p_box_fdps.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class CreatePBoxFdps < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :p_box_fdps do |t|
|
||||||
|
t.references :p_product, index: true, foreign_key: true
|
||||||
|
t.references :p_sheet_line
|
||||||
|
t.integer :p_product_archived_id
|
||||||
|
t.decimal :nbr_el, precision: 10, scale: 2
|
||||||
|
t.decimal :nbr_in_box, precision: 10, scale: 2
|
||||||
|
t.integer :qte
|
||||||
|
t.decimal :price, precision: 10, scale: 2
|
||||||
|
t.text :notes
|
||||||
|
t.integer :element_id
|
||||||
|
t.string :element_type
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddFdpForcePriceToPCustomerSheets < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :p_customer_sheets, :fdp_force_price, :decimal, precision: 10, scale: 2
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddFdpForcePriceToPDocuments < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :p_documents, :fdp_force_price, :decimal, precision: 10, scale: 2
|
||||||
|
end
|
||||||
|
end
|
6
db/migrate/20181217112205_add_acompte_to_p_documents.rb
Normal file
6
db/migrate/20181217112205_add_acompte_to_p_documents.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class AddAcompteToPDocuments < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :p_documents, :acompte_percent, :decimal, precision: 10, scale: 2
|
||||||
|
add_column :p_documents, :acompte_value, :decimal, precision: 10, scale: 2
|
||||||
|
end
|
||||||
|
end
|
24
db/schema.rb
24
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20181126002517) do
|
ActiveRecord::Schema.define(version: 20181217112205) do
|
||||||
|
|
||||||
create_table "admin_admin_roles", force: :cascade do |t|
|
create_table "admin_admin_roles", force: :cascade do |t|
|
||||||
t.integer "admin_id", limit: 4
|
t.integer "admin_id", limit: 4
|
||||||
@ -706,6 +706,23 @@ ActiveRecord::Schema.define(version: 20181126002517) do
|
|||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "p_box_fdps", force: :cascade do |t|
|
||||||
|
t.integer "p_product_id", limit: 4
|
||||||
|
t.integer "p_sheet_line_id", limit: 4
|
||||||
|
t.integer "p_product_archived_id", limit: 4
|
||||||
|
t.decimal "nbr_el", precision: 10, scale: 2
|
||||||
|
t.decimal "nbr_in_box", precision: 10, scale: 2
|
||||||
|
t.integer "qte", limit: 4
|
||||||
|
t.decimal "price", precision: 10, scale: 2
|
||||||
|
t.text "notes", limit: 65535
|
||||||
|
t.integer "element_id", limit: 4
|
||||||
|
t.string "element_type", limit: 255
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "p_box_fdps", ["p_product_id"], name: "index_p_box_fdps_on_p_product_id", using: :btree
|
||||||
|
|
||||||
create_table "p_certifs", force: :cascade do |t|
|
create_table "p_certifs", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name", limit: 255
|
||||||
t.text "description", limit: 65535
|
t.text "description", limit: 65535
|
||||||
@ -781,6 +798,7 @@ ActiveRecord::Schema.define(version: 20181126002517) do
|
|||||||
t.boolean "paid", default: false
|
t.boolean "paid", default: false
|
||||||
t.datetime "paid_at"
|
t.datetime "paid_at"
|
||||||
t.integer "p_price_cat_id", limit: 4
|
t.integer "p_price_cat_id", limit: 4
|
||||||
|
t.decimal "fdp_force_price", precision: 10, scale: 2
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "p_customer_sheets", ["p_payment_type_id"], name: "index_p_customer_sheets_on_p_payment_type_id", using: :btree
|
add_index "p_customer_sheets", ["p_payment_type_id"], name: "index_p_customer_sheets_on_p_payment_type_id", using: :btree
|
||||||
@ -894,6 +912,9 @@ ActiveRecord::Schema.define(version: 20181126002517) do
|
|||||||
t.datetime "theo_paid_at"
|
t.datetime "theo_paid_at"
|
||||||
t.boolean "paid", default: false
|
t.boolean "paid", default: false
|
||||||
t.datetime "paid_at"
|
t.datetime "paid_at"
|
||||||
|
t.decimal "fdp_force_price", precision: 10, scale: 2
|
||||||
|
t.decimal "acompte_percent", precision: 10, scale: 2
|
||||||
|
t.decimal "acompte_value", precision: 10, scale: 2
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "p_eps", force: :cascade do |t|
|
create_table "p_eps", force: :cascade do |t|
|
||||||
@ -1549,6 +1570,7 @@ ActiveRecord::Schema.define(version: 20181126002517) do
|
|||||||
add_foreign_key "mail_contents", "mail_types"
|
add_foreign_key "mail_contents", "mail_types"
|
||||||
add_foreign_key "menu_item_langs", "image_files"
|
add_foreign_key "menu_item_langs", "image_files"
|
||||||
add_foreign_key "menu_item_langs", "lang_sites"
|
add_foreign_key "menu_item_langs", "lang_sites"
|
||||||
|
add_foreign_key "p_box_fdps", "p_products"
|
||||||
add_foreign_key "p_customer_sheets", "p_payment_types"
|
add_foreign_key "p_customer_sheets", "p_payment_types"
|
||||||
add_foreign_key "p_customer_sheets", "p_price_cats"
|
add_foreign_key "p_customer_sheets", "p_price_cats"
|
||||||
add_foreign_key "p_customers", "p_price_cats"
|
add_foreign_key "p_customers", "p_price_cats"
|
||||||
|
23
test/fixtures/p_box_fdps.yml
vendored
Normal file
23
test/fixtures/p_box_fdps.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
p_product_id:
|
||||||
|
p_product_archived_id: 1
|
||||||
|
nbr_el: 9.99
|
||||||
|
nbr_in_box: 9.99
|
||||||
|
qte: 1
|
||||||
|
price: 9.99
|
||||||
|
notes: MyText
|
||||||
|
element_id: 1
|
||||||
|
element_type: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
p_product_id:
|
||||||
|
p_product_archived_id: 1
|
||||||
|
nbr_el: 9.99
|
||||||
|
nbr_in_box: 9.99
|
||||||
|
qte: 1
|
||||||
|
price: 9.99
|
||||||
|
notes: MyText
|
||||||
|
element_id: 1
|
||||||
|
element_type: MyString
|
7
test/models/p_box_fdp_test.rb
Normal file
7
test/models/p_box_fdp_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PBoxFdpTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user