suite
This commit is contained in:
parent
3f0a3d5fba
commit
eb9ad0b434
@ -141,6 +141,8 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
def generate_bc
|
||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||
@p_customer_sheet.generate_bc
|
||||
@p_customer_sheet.customer_validation_at = Time.now
|
||||
@p_customer_sheet.save
|
||||
|
||||
redirect_to :back
|
||||
|
||||
|
@ -78,11 +78,15 @@ class Public::POrdersController < ApplicationController
|
||||
@p_customer_sheet.particular_send.force_validation=true
|
||||
@p_customer_sheet.ecom_status = "commande"
|
||||
|
||||
@p_customer_sheet.customer_validation_at = Time.now
|
||||
|
||||
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!) and @p_customer_sheet.particular_bill.save and @p_customer_sheet.particular_send.save
|
||||
|
||||
@p_customer_sheet.generate_bc
|
||||
@p_customer_sheet.generate_fa if @p_customer_sheet.acompte_percent?
|
||||
|
||||
AdminMailer.notify_order().deliver
|
||||
|
||||
cookies[:current_p_customer_sheet_id] = nil
|
||||
|
||||
redirect_to thank_public_p_order_path(:id => @p_customer_sheet.id)
|
||||
|
@ -7,4 +7,8 @@ class AdminMailer < ActionMailer::Base
|
||||
def notify_comments
|
||||
mail :to => "n.bally@quartz.xyz", :subject => "Nouveaux commentaires à modérer sur le blog", :from => "n.bally@quartz.xyz"
|
||||
end
|
||||
|
||||
def notify_order
|
||||
mail :to => "ducoin@jrh.fr", :subject => "Nouvelle commande enregistrée par le site", :from => "n.bally@quartz.xyz"
|
||||
end
|
||||
end
|
@ -117,6 +117,13 @@ class PDocument < ActiveRecord::Base
|
||||
self.fdp_force_price = self.element.fdp_force_price if self.p_document_type.label != "Avoir"
|
||||
self.acompte_percent = self.element.acompte_percent
|
||||
|
||||
self.obs_devis = self.element.obs_devis
|
||||
self.obs_bdc = self.element.obs_bdc
|
||||
self.obs_bdl = self.element.obs_bdl
|
||||
|
||||
|
||||
|
||||
|
||||
if self.element_type == "PCustomerSheet" and self.element.particular_bill
|
||||
self.particular_bill = self.element.particular_bill.dup
|
||||
self.particular_bill.owner = nil
|
||||
|
@ -162,10 +162,11 @@
|
||||
-if @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => @p_customer_sheet.p_customer.particular}
|
||||
|
||||
%br
|
||||
.addresses.row
|
||||
|
||||
.columns.span_6
|
||||
%h3 Adresse de facturation
|
||||
|
||||
|
||||
-if @p_customer_sheet.p_customer
|
||||
=form.inputs do
|
||||
= form.input :particular_bill_id, :collection => @p_customer_sheet.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||
@ -174,8 +175,7 @@
|
||||
= form.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
|
||||
.columns.span_6
|
||||
%h3 Adresse de livraison
|
||||
|
||||
|
||||
-if @p_customer_sheet.p_customer
|
||||
=form.inputs do
|
||||
= form.input :particular_send_id, :collection => @p_customer_sheet.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||
@ -207,6 +207,21 @@
|
||||
|
||||
= form.input :fdp_force_price, :label => "Frais de port (calculés automatiquement si vides) :"
|
||||
|
||||
%table{:style => "width:100%;"}
|
||||
|
||||
%tr
|
||||
%td{:style => "width:33%;"}
|
||||
= form.input :obs_devis, :label => "Observation devis :"
|
||||
%td{:style => "width:33%;"}
|
||||
= form.input :obs_bdc, :label => "Observation bon de commande :"
|
||||
%td{:style => "width:33%;"}
|
||||
= form.input :obs_bdl, :label => "Observation bon de livraison :"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-if false
|
||||
%p
|
||||
|
@ -2,10 +2,12 @@
|
||||
%tr#p_customer_sheet{:id => p_customer_sheet.id}
|
||||
%td="##{p_customer_sheet.id}"
|
||||
%td=l p_customer_sheet.created_at, :format => :date
|
||||
%td=l p_customer_sheet.customer_validation_at, :format => "%d/%m/%Y %H:%M" if p_customer_sheet.customer_validation_at
|
||||
|
||||
-if !@p_customer
|
||||
%td= p_customer_sheet.p_customer.show_name if p_customer_sheet.p_customer
|
||||
%td= p_customer_sheet.sheet_lines_not_shiped.count
|
||||
%td= p_customer_sheet.sheet_lines_shiped.count
|
||||
=#%td= p_customer_sheet.sheet_lines_not_shiped.count
|
||||
=#%td= p_customer_sheet.sheet_lines_shiped.count
|
||||
|
||||
|
||||
%td
|
||||
|
@ -12,11 +12,14 @@
|
||||
%tr
|
||||
%th ID
|
||||
%th Date
|
||||
%th Date validation
|
||||
|
||||
%th Client
|
||||
|
||||
%th Non livrés
|
||||
%th Livrés
|
||||
=#%th Non livrés
|
||||
=#%th Livrés
|
||||
%th Total HT
|
||||
%th Total TTC
|
||||
%th Statut
|
||||
|
||||
%th
|
||||
|
@ -8,7 +8,7 @@
|
||||
%th Réf
|
||||
%th Débit
|
||||
%th Crédit
|
||||
%th Soldé ?
|
||||
%th Soldé
|
||||
%th.action
|
||||
|
||||
%tbody.lines
|
||||
|
@ -14,7 +14,28 @@
|
||||
|
||||
-if false
|
||||
%td{:style => "text-align:right;"}=number_to_currency p_customer.p_customer_sheets.sum(:a_ok_total)
|
||||
|
||||
%td
|
||||
-emails = []
|
||||
|
||||
|
||||
-p_contacts = p_customer.p_contacts
|
||||
|
||||
-p_customer.particulars.each do |p|
|
||||
-p_contacts = p_contacts + p.p_contacts
|
||||
|
||||
|
||||
-p_contacts.uniq.each do |p_c|
|
||||
|
||||
-emails << p_c.email
|
||||
|
||||
-emails << p_customer.email
|
||||
|
||||
-emails = emails.uniq
|
||||
|
||||
=emails.size
|
||||
|
||||
|
||||
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, p_customer], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet auteur ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_p_customer_path(p_customer), :remote => true
|
||||
|
@ -112,7 +112,7 @@
|
||||
%th Réf
|
||||
%th Débit
|
||||
%th Crédit
|
||||
%th{:style => "width:20px"} Soldé ?
|
||||
%th{:style => "width:20px"} Soldé
|
||||
-if !@p_customer
|
||||
%th Solde
|
||||
-if !params[:html]
|
||||
|
@ -20,6 +20,7 @@
|
||||
%th CP
|
||||
%th Ville
|
||||
%th Encours
|
||||
%th Nbr emails
|
||||
%th
|
||||
|
||||
|
||||
@ -48,7 +49,7 @@
|
||||
%th CP
|
||||
%th Ville
|
||||
%th Encours
|
||||
|
||||
%th Nbr emails
|
||||
%th
|
||||
|
||||
|
||||
|
@ -112,6 +112,34 @@
|
||||
=render :partial => "admin/p_sheet_lines/print_p_sheet_lines", :locals => {:sheet_lines => @p_document.p_sheet_lines }
|
||||
|
||||
|
||||
-if @p_document.obs_devis? and @p_document.label == "Devis"
|
||||
.obs
|
||||
%div Observations :
|
||||
=simple_format @p_document.obs_devis
|
||||
|
||||
-elsif @p_document.obs_bdc? and @p_document.label == "Bon de commande"
|
||||
.obs
|
||||
%div Observations :
|
||||
=simple_format @p_document.obs_bdc
|
||||
|
||||
-elsif @p_document.obs_bdl? and @p_document.label == "Bon de livraison"
|
||||
.obs
|
||||
%div Observations :
|
||||
=simple_format @p_document.obs_bdl
|
||||
|
||||
:scss
|
||||
.obs{
|
||||
//padding-top:20px;
|
||||
|
||||
div{
|
||||
position:relative;
|
||||
top:10px;
|
||||
text-decoration:underline;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
%table.en-tete-table{:style => "width:auto;position:relative;"}
|
||||
%tr
|
||||
%th Conditions de réglement
|
||||
|
@ -34,10 +34,10 @@
|
||||
|
||||
-@csv.each do |row|
|
||||
-ps = nil
|
||||
-if row["Stock const"].to_s != ""
|
||||
-if row["Ref variante"].to_s != "" and PProductStock.where(:code => row["Ref variante"]).count == 1
|
||||
-if row["Stock Disponible"].to_s != ""
|
||||
-if row["Article"].to_s != "" and PProductStock.where(:code => row["Article"]).count == 1
|
||||
-m = "Par réf."
|
||||
-ps = PProductStock.where(:code => row["Ref variante"]).first
|
||||
-ps = PProductStock.where(:code => row["Article"]).first
|
||||
|
||||
-elsif row["ID variante"].to_s != "" and PProductStock.where(:id => row["ID variante"]).count == 1
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
%tr
|
||||
%td
|
||||
=check_box_tag :"ids[]", ps.id, true if ps
|
||||
=hidden_field_tag "ps_#{ps.id}", row["Stock const"] if ps
|
||||
=hidden_field_tag "ps_#{ps.id}", row["Stock Disponible"] if ps
|
||||
|
||||
%td=row["Ref variante"]
|
||||
%td=row["Article"]
|
||||
%td=row["ID variante"]
|
||||
%td=m
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
|
||||
|
||||
|
||||
%td=row["Stock const"]
|
||||
%td=row["Stock Disponible"]
|
||||
-if ps
|
||||
%td=ps.delta_stock
|
||||
-else
|
||||
|
@ -2,11 +2,7 @@
|
||||
Bonjour,
|
||||
|
||||
%p
|
||||
Il y a des nouveaux commentaires à modérer sur le blog.
|
||||
|
||||
%p
|
||||
Voici le lien direct pour le faire :
|
||||
=link_to "https://3p.quartz.xyz/admin/comments?lang=fr", "https://3p.quartz.xyz/admin/comments?lang=fr"
|
||||
Une nouvelle commande a été passée par le site, à retrouver sur l'espace d'administration.
|
||||
|
||||
%p
|
||||
Bonne journée !
|
8
app/views/admin_mailer/notify_order.html.haml
Normal file
8
app/views/admin_mailer/notify_order.html.haml
Normal file
@ -0,0 +1,8 @@
|
||||
%p
|
||||
Bonjour,
|
||||
|
||||
%p
|
||||
Une nouvelle commande a été passée par le site, à retrouver sur l'espace d'administration.
|
||||
|
||||
%p
|
||||
Bonne journée !
|
@ -1,15 +1,18 @@
|
||||
-total_with_labels = @p_customer_sheet.total_with_labels_table
|
||||
|
||||
|
||||
=render :partial => "public/p_orders/warning", :locals => {:style => "max-width:500px;float:left;"}
|
||||
|
||||
%table{:style => "width:100%;"}
|
||||
%table{:style => "float:right;"}
|
||||
-total_with_labels.each do |index, total|
|
||||
|
||||
|
||||
%tr
|
||||
|
||||
%td{:style => "text-align:right;"}
|
||||
%strong
|
||||
=total[:label]
|
||||
%td.price_td
|
||||
=number_to_currency total[:value]
|
||||
|
||||
|
||||
.clear
|
23
app/views/public/p_orders/_warning.html.haml
Normal file
23
app/views/public/p_orders/_warning.html.haml
Normal file
@ -0,0 +1,23 @@
|
||||
-style = style || ""
|
||||
|
||||
-tot = 0
|
||||
-@p_customer_sheet.p_sheet_lines.each do |psl|
|
||||
-psl.p_sheet_line_lines.each do |psll|
|
||||
-psll.qte
|
||||
-stock = 0
|
||||
-stock = psll.p_product_stock.stock_th_ok if psll.p_product_stock.stock_th_ok > 0
|
||||
-surplus = (stock - psll.qte.to_i)
|
||||
|
||||
-if surplus < 0
|
||||
-tot += (surplus*-1)
|
||||
|
||||
-if tot > 0
|
||||
|
||||
.alert.alert-warning{:style => style}
|
||||
=ic :warning
|
||||
|
||||
Attention :
|
||||
=tot
|
||||
unité(s)
|
||||
ne sont pas en stock. Notre équipe commerciale vous contactera pour vous indiquer une date de livraison.
|
||||
|
@ -57,11 +57,17 @@
|
||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||
=builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
|
||||
.stock_line{:style => "text-align:left;font-size:0.8em;color:rgba(0,0,0,0.5)"}
|
||||
|
||||
%span{:style => "font-size:0.75em;"}
|
||||
|
||||
Stock :
|
||||
=ps.stock_th_ok
|
||||
-if ps.stock_th_ok < 0
|
||||
-show_stock = 0
|
||||
-else
|
||||
-show_stock = ps.stock_th_ok
|
||||
|
||||
%span{:style => ("color:red;" if show_stock <= 0).to_s}
|
||||
%span{:style => "font-size:0.75em;"}
|
||||
|
||||
Stock :
|
||||
=show_stock
|
||||
|
||||
|
||||
%td.price.price_td{:data => {:price => form.object.price}}
|
||||
=number_to_currency form.object.price
|
||||
@ -95,7 +101,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#cart_totals=render :partial => "cart_totals"
|
||||
|
||||
|
@ -209,7 +209,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
=render :partial => "public/p_orders/warning"
|
||||
=semantic_form_for [:public, @p_customer_sheet],:url => recap_save_public_p_orders_path(), :html => { :method => :post, :onchange =>""}, :remote => false do |form|
|
||||
=form.input :cgv, :label => raw("J'ai lu et j'accepte les <a href='/fr/mentions-legales.html' target='_blank'>conditions générales de vente</a>")
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
|
||||
|
||||
-if @p_product.get_prices(current_p_customer).count > 0 and @p_product.get_prices(current_p_customer).first.price > 0.0
|
||||
-if @p_product.get_prices(current_p_customer) and @p_product.get_prices(current_p_customer).count > 0 and @p_product.get_prices(current_p_customer).first.price.to_f > 0.0
|
||||
.sub_header
|
||||
-if current_p_customer.account_validated
|
||||
.right
|
||||
@ -130,11 +130,16 @@
|
||||
=builder.hidden_field :p_product_stock_id,:label => false, :as => :string
|
||||
=builder.input :qte,:label => false, :input_html => {:class => "qte"}
|
||||
.stock_line{:style => "text-align:left;font-size:0.8em;color:rgba(0,0,0,0.5)"}
|
||||
|
||||
%span{:style => "font-size:0.75em;"}
|
||||
|
||||
Stock :
|
||||
=ps.stock_th_ok
|
||||
-if ps.stock_th_ok < 0
|
||||
-show_stock = 0
|
||||
-else
|
||||
-show_stock = ps.stock_th_ok
|
||||
|
||||
%span{:style => ("color:red;" if show_stock <= 0).to_s}
|
||||
%span{:style => "font-size:0.75em;"}
|
||||
|
||||
Stock :
|
||||
=show_stock
|
||||
|
||||
%td.price.price_td{:data => {:price => form.object.price}}
|
||||
=number_to_currency form.object.price
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddCustomerValidationToPCustomerSheets < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :p_customer_sheets, :customer_validation_at, :datetime
|
||||
end
|
||||
end
|
12
db/migrate/20191113231005_add_infos_to_p_customer_sheets.rb
Normal file
12
db/migrate/20191113231005_add_infos_to_p_customer_sheets.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class AddInfosToPCustomerSheets < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :p_customer_sheets, :obs_devis, :text
|
||||
add_column :p_customer_sheets, :obs_bdc, :text
|
||||
add_column :p_customer_sheets, :obs_bdl, :text
|
||||
|
||||
add_column :p_documents, :obs_devis, :text
|
||||
add_column :p_documents, :obs_bdc, :text
|
||||
add_column :p_documents, :obs_bdl, :text
|
||||
|
||||
end
|
||||
end
|
59
db/schema.rb
59
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20190804183718) do
|
||||
ActiveRecord::Schema.define(version: 20191113231005) do
|
||||
|
||||
create_table "admin_admin_roles", force: :cascade do |t|
|
||||
t.integer "admin_id", limit: 4
|
||||
@ -821,35 +821,39 @@ ActiveRecord::Schema.define(version: 20190804183718) do
|
||||
end
|
||||
|
||||
create_table "p_customer_sheets", force: :cascade do |t|
|
||||
t.integer "p_customer_id", limit: 4
|
||||
t.string "state", limit: 255
|
||||
t.string "comments", limit: 255
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "particular_bill_id", limit: 4
|
||||
t.integer "particular_send_id", limit: 4
|
||||
t.integer "p_customer_id", limit: 4
|
||||
t.string "state", limit: 255
|
||||
t.string "comments", limit: 255
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "particular_bill_id", limit: 4
|
||||
t.integer "particular_send_id", limit: 4
|
||||
t.date "wish_start"
|
||||
t.date "wish_stop"
|
||||
t.decimal "a_total_cost_ok", precision: 14, scale: 4
|
||||
t.decimal "a_ok_total", precision: 14, scale: 4
|
||||
t.boolean "stock_done", default: false
|
||||
t.integer "p_commercial_id", limit: 4
|
||||
t.boolean "imported", default: false
|
||||
t.string "npiece", limit: 255
|
||||
t.string "ecom_status", limit: 255
|
||||
t.integer "p_payment_type_id", limit: 4
|
||||
t.boolean "cgv", default: false
|
||||
t.boolean "comptant", default: true
|
||||
t.boolean "acompte", default: false
|
||||
t.decimal "acompte_percent", precision: 10
|
||||
t.integer "payment_delais", limit: 4
|
||||
t.boolean "payment_fin_de_mois", default: false
|
||||
t.decimal "a_total_cost_ok", precision: 14, scale: 4
|
||||
t.decimal "a_ok_total", precision: 14, scale: 4
|
||||
t.boolean "stock_done", default: false
|
||||
t.integer "p_commercial_id", limit: 4
|
||||
t.boolean "imported", default: false
|
||||
t.string "npiece", limit: 255
|
||||
t.string "ecom_status", limit: 255
|
||||
t.integer "p_payment_type_id", limit: 4
|
||||
t.boolean "cgv", default: false
|
||||
t.boolean "comptant", default: true
|
||||
t.boolean "acompte", default: false
|
||||
t.decimal "acompte_percent", precision: 10
|
||||
t.integer "payment_delais", limit: 4
|
||||
t.boolean "payment_fin_de_mois", default: false
|
||||
t.datetime "paid_start_at"
|
||||
t.boolean "paid", default: false
|
||||
t.boolean "paid", default: false
|
||||
t.datetime "paid_at"
|
||||
t.integer "p_price_cat_id", limit: 4
|
||||
t.decimal "fdp_force_price", precision: 10, scale: 2
|
||||
t.string "cust_ref", limit: 255
|
||||
t.integer "p_price_cat_id", limit: 4
|
||||
t.decimal "fdp_force_price", precision: 10, scale: 2
|
||||
t.string "cust_ref", limit: 255
|
||||
t.datetime "customer_validation_at"
|
||||
t.text "obs_devis", limit: 65535
|
||||
t.text "obs_bdc", limit: 65535
|
||||
t.text "obs_bdl", limit: 65535
|
||||
end
|
||||
|
||||
add_index "p_customer_sheets", ["p_payment_type_id"], name: "index_p_customer_sheets_on_p_payment_type_id", using: :btree
|
||||
@ -985,6 +989,9 @@ ActiveRecord::Schema.define(version: 20190804183718) do
|
||||
t.decimal "cache_fdp", precision: 13, scale: 2
|
||||
t.decimal "cache_total_tva", precision: 13, scale: 2
|
||||
t.decimal "cache_to_paid", precision: 13, scale: 2
|
||||
t.text "obs_devis", limit: 65535
|
||||
t.text "obs_bdc", limit: 65535
|
||||
t.text "obs_bdl", limit: 65535
|
||||
end
|
||||
|
||||
create_table "p_eps", force: :cascade do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user