suite
This commit is contained in:
parent
31c0f673d4
commit
5f3d435cc8
@ -3,7 +3,15 @@ class ProductOrdersMails < ActionMailer::Base
|
|||||||
layout 'mail'
|
layout 'mail'
|
||||||
|
|
||||||
default from: "Negos <contact@negos.pro>"
|
default from: "Negos <contact@negos.pro>"
|
||||||
|
def fournisseur(product_order, fournisseur)
|
||||||
|
@product_order = product_order
|
||||||
|
@fournisseur = fournisseur
|
||||||
|
@email = @fournisseur.email
|
||||||
|
@title = "Commande achat via Négos"
|
||||||
|
if @fournisseur.send_email
|
||||||
|
mail(:to => @email, :bcc => "info@nicolasbally.com", :subject => @title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def confirmation_cheque(product_order, options = {})
|
def confirmation_cheque(product_order, options = {})
|
||||||
@options = options
|
@options = options
|
||||||
|
@ -5,6 +5,8 @@ class ProductOrder < ActiveRecord::Base
|
|||||||
|
|
||||||
has_many :product_order_products
|
has_many :product_order_products
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
has_many :sub_products, :through => :product_order_products
|
has_many :sub_products, :through => :product_order_products
|
||||||
|
|
||||||
has_many :fournisseurs, :through => :sub_products
|
has_many :fournisseurs, :through => :sub_products
|
||||||
@ -257,6 +259,11 @@ class ProductOrder < ActiveRecord::Base
|
|||||||
self.bl_number = self.bl_ap+self.bl_year.to_s+('%05d' % self.bl_index)
|
self.bl_number = self.bl_ap+self.bl_year.to_s+('%05d' % self.bl_index)
|
||||||
self.save(:validate => false)
|
self.save(:validate => false)
|
||||||
|
|
||||||
|
|
||||||
|
self.fournisseurs.each do |fournisseur|
|
||||||
|
ProductOrdersMails.fournisseur(self, fournisseur).deliver
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -116,6 +116,7 @@
|
|||||||
%br
|
%br
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
%h3 Détail des sous produits
|
%h3 Détail des sous produits
|
||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
%p Bonjour,
|
%p Bonjour,
|
||||||
|
|
||||||
%p Nous vous remercions pour votre pré-commande.
|
%p Nous vous remercions pour votre commande.
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%p Nous vous confirmerons prochainement la date de livraison.
|
%p Nous vous confirmerons prochainement la date de livraison.
|
||||||
|
|
||||||
%p Par ailleurs, celle-ci vous sera expédiée dès que nous aurons reçu votre règlement.
|
%p Par ailleurs, celle-ci vous sera expédiée dès que nous aurons reçu votre règlement.
|
||||||
|
58
app/views/product_orders_mails/fournisseur.html.haml
Normal file
58
app/views/product_orders_mails/fournisseur.html.haml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
:scss
|
||||||
|
.table{
|
||||||
|
width:100%;
|
||||||
|
border-collapse:collapse;
|
||||||
|
td, th{
|
||||||
|
border:1px solid rgba(0,0,0,0.4);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%p
|
||||||
|
Pour information, et suite à l’accord avec l’association Vouis’star veuillez trouver ci-joint le récapitulatif de la commande établie ce jour :
|
||||||
|
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
%tr
|
||||||
|
%th Fournisseur
|
||||||
|
%th Prix HT
|
||||||
|
|
||||||
|
-fournisseur = @fournisseur
|
||||||
|
%tr
|
||||||
|
%td=fournisseur.name
|
||||||
|
%td
|
||||||
|
-i = 0.0
|
||||||
|
-@product_order.sub_products.where(:fournisseur_id => fournisseur.id).each do |sub_product|
|
||||||
|
-i += sub_product.price_tot_with_qte
|
||||||
|
=number_to_currency i
|
||||||
|
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
%tr
|
||||||
|
%th Fournisseur
|
||||||
|
%th Référence
|
||||||
|
%th Nom
|
||||||
|
%th Nbr
|
||||||
|
|
||||||
|
|
||||||
|
-@product_order.sub_products.group(:reference).where(:fournisseur_id => @fournisseur.id).each do |sub_product_group|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= sub_product_group.fournisseur.name if sub_product_group.fournisseur
|
||||||
|
%td= sub_product_group.reference
|
||||||
|
%td= sub_product_group.name
|
||||||
|
|
||||||
|
-sub_products = @product_order.sub_products.where(:reference => sub_product_group.reference)
|
||||||
|
|
||||||
|
|
||||||
|
%td
|
||||||
|
-i = 0.0
|
||||||
|
-sub_products.each do |sub_product|
|
||||||
|
-i += sub_product.qte_tot
|
||||||
|
=i
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -106,10 +106,12 @@
|
|||||||
clearInterval(countup);
|
clearInterval(countup);
|
||||||
}
|
}
|
||||||
}, 0);}
|
}, 0);}
|
||||||
%div{:style => "padding:10px 15px;display:inline-block;text-transform:uppercase;font-weight:bold;font-size:30px;line-height:35px;position:relative;top:-10px;padding-left:3px;"}
|
%div{:style => "padding:10px 15px;display:inline-block;text-transform:uppercase;font-weight:bold;font-size:25px;line-height:30px;position:relative;top:-10px;padding-left:3px;"}
|
||||||
déjà
|
déjà
|
||||||
%br
|
%br
|
||||||
commandés
|
commandés
|
||||||
|
%br
|
||||||
|
depuis 2018
|
||||||
|
|
||||||
|
|
||||||
:coffeescript
|
:coffeescript
|
||||||
|
6
db/migrate/20180326193718_add_email_to_fournisseurs.rb
Normal file
6
db/migrate/20180326193718_add_email_to_fournisseurs.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class AddEmailToFournisseurs < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :fournisseurs, :email, :string
|
||||||
|
add_column :fournisseurs, :send_email, :boolean
|
||||||
|
end
|
||||||
|
end
|
@ -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: 20180325210006) do
|
ActiveRecord::Schema.define(version: 20180326193718) do
|
||||||
|
|
||||||
create_table "abonnements", force: :cascade do |t|
|
create_table "abonnements", force: :cascade do |t|
|
||||||
t.integer "abonnement_type_id", limit: 4
|
t.integer "abonnement_type_id", limit: 4
|
||||||
@ -378,6 +378,8 @@ ActiveRecord::Schema.define(version: 20180325210006) do
|
|||||||
t.string "bic", limit: 255
|
t.string "bic", limit: 255
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.string "email", limit: 255
|
||||||
|
t.boolean "send_email", limit: 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "gallery_contents", force: :cascade do |t|
|
create_table "gallery_contents", force: :cascade do |t|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user