Compare commits
10 Commits
3f87692a69
...
0368b94967
Author | SHA1 | Date | |
---|---|---|---|
0368b94967 | |||
a99dbfde83 | |||
7f71e82f74 | |||
5f3d435cc8 | |||
31c0f673d4 | |||
d90713a8e7 | |||
f2496c36a8 | |||
d9a8bbefed | |||
f9d656b0cb | |||
|
5238a52533 |
@ -338,7 +338,7 @@ class Admin::ProductOrdersController < ApplicationController
|
|||||||
end
|
end
|
||||||
if @product_order.bl_number?
|
if @product_order.bl_number?
|
||||||
|
|
||||||
|
if true
|
||||||
|
|
||||||
@temp_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}_temp.pdf"
|
@temp_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}_temp.pdf"
|
||||||
@final_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}.pdf"
|
@final_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}.pdf"
|
||||||
@ -370,7 +370,7 @@ class Admin::ProductOrdersController < ApplicationController
|
|||||||
|
|
||||||
require 'posix/spawn'
|
require 'posix/spawn'
|
||||||
|
|
||||||
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'background', Rails.root.join('pdf_stamp', 'bl.pdf').to_s, 'output', @final_file
|
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'background', Rails.root.join('pdf_stamp', "bl#{(@product_order.reseaux_id if @product_order.reseaux_id == 19)}.pdf").to_s, 'output', @final_file
|
||||||
|
|
||||||
#pdftk /Users/nico/Desktop/Sanstitre4.pdf background /Users/nico/Dev/negos_app/pdf_stamp/bl.pdf output sortie.pdf
|
#pdftk /Users/nico/Desktop/Sanstitre4.pdf background /Users/nico/Dev/negos_app/pdf_stamp/bl.pdf output sortie.pdf
|
||||||
|
|
||||||
@ -383,7 +383,9 @@ class Admin::ProductOrdersController < ApplicationController
|
|||||||
send_data @data_to_send, :filename =>"#{@product_order.bl_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
|
send_data @data_to_send, :filename =>"#{@product_order.bl_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,12 @@ class Public::ProductOrdersController < ApplicationController
|
|||||||
|
|
||||||
def my_cart
|
def my_cart
|
||||||
get_reseaux
|
get_reseaux
|
||||||
|
|
||||||
|
if !@product_order.reseaux
|
||||||
|
@product_order.reseaux = @reseaux
|
||||||
|
@product_order.save
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def vourcher
|
def vourcher
|
||||||
|
@ -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,daniel@videlier.fr", :subject => @title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def confirmation_cheque(product_order, options = {})
|
def confirmation_cheque(product_order, options = {})
|
||||||
@options = options
|
@options = options
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
class ProductOrder < ActiveRecord::Base
|
class ProductOrder < ActiveRecord::Base
|
||||||
|
belongs_to :reseaux
|
||||||
|
|
||||||
has_many :payments, :as => :element
|
has_many :payments, :as => :element
|
||||||
|
|
||||||
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
|
||||||
@ -199,7 +202,7 @@ class ProductOrder < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
last_number = 0
|
last_number = 0
|
||||||
last_number = ProductOrder.where("paid_at is not null").where(:bill_year => self.bill_year ).order("bill_index DESC").first.bill_index if ProductOrder.where("paid_at is not null").where(:bill_year => self.bill_year ).first
|
last_number = ProductOrder.where("paid_at is not null").where(:bill_year => self.bill_year, :reseaux_id => self.reseaux_id ).order("bill_index DESC").first.bill_index if ProductOrder.where("paid_at is not null").where(:bill_year => self.bill_year, :reseaux_id => self.reseaux_id ).first
|
||||||
self.bill_index = last_number+1
|
self.bill_index = last_number+1
|
||||||
self.bill_number = "NG"+self.bill_year.to_s+('%04d' % self.bill_index)
|
self.bill_number = "NG"+self.bill_year.to_s+('%04d' % self.bill_index)
|
||||||
self.save(:validate => false)
|
self.save(:validate => false)
|
||||||
@ -251,11 +254,16 @@ class ProductOrder < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
last_number = 0
|
last_number = 0
|
||||||
last_number = ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year ).order("bl_index DESC").first.bl_index if ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year ).first
|
last_number = ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year, :reseaux_id => self.reseaux_id ).order("bl_index DESC").first.bl_index if ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year, :reseaux_id => self.reseaux_id ).first
|
||||||
self.bl_index = last_number+1
|
self.bl_index = last_number+1
|
||||||
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.uniq.each do |fournisseur|
|
||||||
|
ProductOrdersMails.fournisseur(self, fournisseur).deliver
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -98,16 +98,22 @@
|
|||||||
#main
|
#main
|
||||||
|
|
||||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||||
|
-if @product_order.reseaux_id == 19
|
||||||
|
Commande achats n°
|
||||||
|
-else
|
||||||
Bon de commande n°
|
Bon de commande n°
|
||||||
=@product_order.bl_number
|
=@product_order.bl_number
|
||||||
%br
|
%br
|
||||||
=l @product_order.created_at, :format => :date
|
=l @product_order.created_at, :format => :date
|
||||||
|
|
||||||
|
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%div{:style => "height:350px;"}
|
%div{:style => "height:350px;"}
|
||||||
|
-else
|
||||||
|
%div{:style => "height:140px;"}
|
||||||
|
|
||||||
|
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
||||||
%tr
|
%tr
|
||||||
%td{:style => "width:5.5cm;border:0"}
|
%td{:style => "width:5.5cm;border:0"}
|
||||||
@ -161,6 +167,7 @@
|
|||||||
|
|
||||||
%table.table{:style => "width:100%;margin:1cm 0;"}
|
%table.table{:style => "width:100%;margin:1cm 0;"}
|
||||||
%tr
|
%tr
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%th
|
%th
|
||||||
%th
|
%th
|
||||||
Description
|
Description
|
||||||
@ -173,31 +180,62 @@
|
|||||||
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
|
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%td{:style => "width:135px;padding:0;vertical-align:middle"}
|
%td{:style => "width:135px;padding:0;vertical-align:middle"}
|
||||||
=image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
|
=image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
|
||||||
%td
|
%td{:style => ""+("border-bottom: 0;padding-bottom:0;"if @product_order.reseaux_id == 19).to_s}
|
||||||
=simple_format product_order_product.archived_product.lang(:fr).bl_title
|
=simple_format product_order_product.archived_product.lang(:fr).bl_title
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=# product_order_product.archived_product_size.name if product_order_product.archived_product_size
|
=# product_order_product.archived_product_size.name if product_order_product.archived_product_size
|
||||||
|
|
||||||
|
|
||||||
=# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
|
=# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
|
||||||
|
|
||||||
%td{:style => "text-align:right;"}
|
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||||
= number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
|
= number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
|
||||||
%td{:style => "text-align:right;"}
|
|
||||||
|
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||||
=product_order_product.qty
|
=product_order_product.qty
|
||||||
%td{:style => "text-align:right;"}
|
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||||
= number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
|
= number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
|
||||||
|
|
||||||
|
-if @product_order.reseaux_id == 19
|
||||||
|
%tr
|
||||||
|
%td{:colspan => 3, :style => "border-top:0;padding-top:0"}
|
||||||
|
%table.sub_products{:style => "width:100%;margin-bottom:20px;margin-top:5px;"}
|
||||||
|
%tr
|
||||||
|
%th Référence
|
||||||
|
%th Nom
|
||||||
|
|
||||||
|
%th Prix U.
|
||||||
|
%th Nbr
|
||||||
|
%th Prix HT
|
||||||
|
|
||||||
|
-product_order_product.sub_products.each do |sub_product|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
=sub_product.reference
|
||||||
|
%td
|
||||||
|
=sub_product.name
|
||||||
|
|
||||||
|
%td
|
||||||
|
=number_to_currency sub_product.price_ht_with_qte
|
||||||
|
|
||||||
|
%td
|
||||||
|
=sub_product.qte_tot
|
||||||
|
%td
|
||||||
|
=number_to_currency sub_product.price_tot_with_qte
|
||||||
|
%td
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td{:colspan => 3, :rowspan => 3, :style => "border:0;text-align:left;"}
|
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%p
|
%p
|
||||||
%br
|
%br
|
||||||
Mode de paiment :
|
Mode de paiment :
|
||||||
@ -214,7 +252,7 @@
|
|||||||
Franco de port pour le Pays Voironnais
|
Franco de port pour le Pays Voironnais
|
||||||
%td Total HT :
|
%td Total HT :
|
||||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
|
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
|
||||||
|
-if @product_order.reseaux_id != 19
|
||||||
%tr
|
%tr
|
||||||
|
|
||||||
%td TVA :
|
%td TVA :
|
||||||
|
@ -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
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddReseauxIdToProductOrders < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :product_orders, :reseaux_id, :integer
|
||||||
|
end
|
||||||
|
end
|
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: 20180301225428) 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: 20180301225428) 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|
|
||||||
@ -899,6 +901,7 @@ ActiveRecord::Schema.define(version: 20180301225428) do
|
|||||||
t.integer "bl_index", limit: 4
|
t.integer "bl_index", limit: 4
|
||||||
t.integer "bl_year", limit: 4
|
t.integer "bl_year", limit: 4
|
||||||
t.boolean "shiped", limit: 1
|
t.boolean "shiped", limit: 1
|
||||||
|
t.integer "reseaux_id", limit: 4
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "product_product_sizes", force: :cascade do |t|
|
create_table "product_product_sizes", force: :cascade do |t|
|
||||||
|
BIN
pdf_stamp/bl19.pdf
Normal file
BIN
pdf_stamp/bl19.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user