This commit is contained in:
Nicolas Bally 2019-11-14 00:39:42 +01:00
parent 3f0a3d5fba
commit eb9ad0b434
23 changed files with 216 additions and 64 deletions

View File

@ -141,6 +141,8 @@ class Admin::PCustomerSheetsController < ApplicationController
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
@p_customer_sheet.customer_validation_at = Time.now
@p_customer_sheet.save
redirect_to :back redirect_to :back

View File

@ -78,11 +78,15 @@ class Public::POrdersController < ApplicationController
@p_customer_sheet.particular_send.force_validation=true @p_customer_sheet.particular_send.force_validation=true
@p_customer_sheet.ecom_status = "commande" @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 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_bc
@p_customer_sheet.generate_fa if @p_customer_sheet.acompte_percent? @p_customer_sheet.generate_fa if @p_customer_sheet.acompte_percent?
AdminMailer.notify_order().deliver
cookies[:current_p_customer_sheet_id] = nil cookies[:current_p_customer_sheet_id] = nil
redirect_to thank_public_p_order_path(:id => @p_customer_sheet.id) redirect_to thank_public_p_order_path(:id => @p_customer_sheet.id)

View File

@ -7,4 +7,8 @@ class AdminMailer < ActionMailer::Base
def notify_comments def notify_comments
mail :to => "n.bally@quartz.xyz", :subject => "Nouveaux commentaires à modérer sur le blog", :from => "n.bally@quartz.xyz" mail :to => "n.bally@quartz.xyz", :subject => "Nouveaux commentaires à modérer sur le blog", :from => "n.bally@quartz.xyz"
end end
def notify_order
mail :to => "ducoin@jrh.fr", :subject => "Nouvelle commande enregistrée par le site", :from => "n.bally@quartz.xyz"
end
end end

View File

@ -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.fdp_force_price = self.element.fdp_force_price if self.p_document_type.label != "Avoir"
self.acompte_percent = self.element.acompte_percent 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 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

View File

@ -162,9 +162,10 @@
-if @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.particular -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} =render :partial => "admin/p_customers/apercu", :locals => {:particular => @p_customer_sheet.p_customer.particular}
%br
.addresses.row .addresses.row
.columns.span_6 .columns.span_6
%h3 Adresse de facturation
-if @p_customer_sheet.p_customer -if @p_customer_sheet.p_customer
=form.inputs do =form.inputs do
@ -174,7 +175,6 @@
= form.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation" = form.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
.columns.span_6 .columns.span_6
%h3 Adresse de livraison
-if @p_customer_sheet.p_customer -if @p_customer_sheet.p_customer
=form.inputs do =form.inputs do
@ -207,6 +207,21 @@
= form.input :fdp_force_price, :label => "Frais de port (calculés automatiquement si vides) :" = 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 -if false
%p %p

View File

@ -2,10 +2,12 @@
%tr#p_customer_sheet{:id => p_customer_sheet.id} %tr#p_customer_sheet{:id => p_customer_sheet.id}
%td="##{p_customer_sheet.id}" %td="##{p_customer_sheet.id}"
%td=l p_customer_sheet.created_at, :format => :date %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 -if !@p_customer
%td= p_customer_sheet.p_customer.show_name if p_customer_sheet.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_not_shiped.count
%td= p_customer_sheet.sheet_lines_shiped.count =#%td= p_customer_sheet.sheet_lines_shiped.count
%td %td

View File

@ -12,11 +12,14 @@
%tr %tr
%th ID %th ID
%th Date %th Date
%th Date validation
%th Client %th Client
%th Non livrés =#%th Non livrés
%th Livrés =#%th Livrés
%th Total HT %th Total HT
%th Total TTC
%th Statut %th Statut
%th %th

View File

@ -8,7 +8,7 @@
%th Réf %th Réf
%th Débit %th Débit
%th Crédit %th Crédit
%th Soldé ? %th Soldé
%th.action %th.action
%tbody.lines %tbody.lines

View File

@ -14,6 +14,27 @@
-if false -if false
%td{:style => "text-align:right;"}=number_to_currency p_customer.p_customer_sheets.sum(:a_ok_total) %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 %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(:"trash-o"), [:admin, p_customer], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet auteur ? ' } , :remote => true

View File

@ -112,7 +112,7 @@
%th Réf %th Réf
%th Débit %th Débit
%th Crédit %th Crédit
%th{:style => "width:20px"} Soldé ? %th{:style => "width:20px"} Soldé
-if !@p_customer -if !@p_customer
%th Solde %th Solde
-if !params[:html] -if !params[:html]

View File

@ -20,6 +20,7 @@
%th CP %th CP
%th Ville %th Ville
%th Encours %th Encours
%th Nbr emails
%th %th
@ -48,7 +49,7 @@
%th CP %th CP
%th Ville %th Ville
%th Encours %th Encours
%th Nbr emails
%th %th

View File

@ -112,6 +112,34 @@
=render :partial => "admin/p_sheet_lines/print_p_sheet_lines", :locals => {:sheet_lines => @p_document.p_sheet_lines } =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;"} %table.en-tete-table{:style => "width:auto;position:relative;"}
%tr %tr
%th Conditions de réglement %th Conditions de réglement

View File

@ -34,10 +34,10 @@
-@csv.each do |row| -@csv.each do |row|
-ps = nil -ps = nil
-if row["Stock const"].to_s != "" -if row["Stock Disponible"].to_s != ""
-if row["Ref variante"].to_s != "" and PProductStock.where(:code => row["Ref variante"]).count == 1 -if row["Article"].to_s != "" and PProductStock.where(:code => row["Article"]).count == 1
-m = "Par réf." -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 -elsif row["ID variante"].to_s != "" and PProductStock.where(:id => row["ID variante"]).count == 1
@ -52,9 +52,9 @@
%tr %tr
%td %td
=check_box_tag :"ids[]", ps.id, true if ps =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=row["ID variante"]
%td=m %td=m
@ -72,7 +72,7 @@
%td=row["Stock const"] %td=row["Stock Disponible"]
-if ps -if ps
%td=ps.delta_stock %td=ps.delta_stock
-else -else

View File

@ -2,11 +2,7 @@
Bonjour, Bonjour,
%p %p
Il y a des nouveaux commentaires à modérer sur le blog. Une nouvelle commande a été passée par le site, à retrouver sur l'espace d'administration.
%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"
%p %p
Bonne journée ! Bonne journée !

View 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 !

View File

@ -1,15 +1,18 @@
-total_with_labels = @p_customer_sheet.total_with_labels_table -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| -total_with_labels.each do |index, total|
%tr %tr
%td{:style => "text-align:right;"} %td{:style => "text-align:right;"}
%strong %strong
=total[:label] =total[:label]
%td.price_td %td.price_td
=number_to_currency total[:value] =number_to_currency total[:value]
.clear

View 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
&nbsp;
Attention :
=tot
unité(s)
ne sont pas en stock. Notre équipe commerciale vous contactera pour vous indiquer une date de livraison.

View File

@ -57,11 +57,17 @@
=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, :input_html => {:class => "qte"} =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)"} .stock_line{:style => "text-align:left;font-size:0.8em;color:rgba(0,0,0,0.5)"}
-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;"} %span{:style => "font-size:0.75em;"}
&nbsp;&nbsp; &nbsp;&nbsp;
Stock : Stock :
=ps.stock_th_ok =show_stock
%td.price.price_td{:data => {:price => form.object.price}} %td.price.price_td{:data => {:price => form.object.price}}
=number_to_currency form.object.price =number_to_currency form.object.price

View File

@ -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| =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>") =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>")

View File

@ -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 .sub_header
-if current_p_customer.account_validated -if current_p_customer.account_validated
.right .right
@ -130,11 +130,16 @@
=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, :input_html => {:class => "qte"} =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)"} .stock_line{:style => "text-align:left;font-size:0.8em;color:rgba(0,0,0,0.5)"}
-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;"} %span{:style => "font-size:0.75em;"}
&nbsp;&nbsp; &nbsp;&nbsp;
Stock : Stock :
=ps.stock_th_ok =show_stock
%td.price.price_td{:data => {:price => form.object.price}} %td.price.price_td{:data => {:price => form.object.price}}
=number_to_currency form.object.price =number_to_currency form.object.price

View File

@ -0,0 +1,5 @@
class AddCustomerValidationToPCustomerSheets < ActiveRecord::Migration
def change
add_column :p_customer_sheets, :customer_validation_at, :datetime
end
end

View 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

View File

@ -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: 20190804183718) do ActiveRecord::Schema.define(version: 20191113231005) 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
@ -850,6 +850,10 @@ ActiveRecord::Schema.define(version: 20190804183718) do
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 t.decimal "fdp_force_price", precision: 10, scale: 2
t.string "cust_ref", limit: 255 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 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
@ -985,6 +989,9 @@ ActiveRecord::Schema.define(version: 20190804183718) do
t.decimal "cache_fdp", precision: 13, scale: 2 t.decimal "cache_fdp", precision: 13, scale: 2
t.decimal "cache_total_tva", precision: 13, scale: 2 t.decimal "cache_total_tva", precision: 13, scale: 2
t.decimal "cache_to_paid", 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 end
create_table "p_eps", force: :cascade do |t| create_table "p_eps", force: :cascade do |t|