factures
This commit is contained in:
parent
56d5d329df
commit
6868876b90
108
app/controllers/admin/product_order_document_types_controller.rb
Executable file
108
app/controllers/admin/product_order_document_types_controller.rb
Executable file
@ -0,0 +1,108 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::ProductOrderDocumentTypesController < ApplicationController
|
||||
before_filter :auth_admin
|
||||
|
||||
layout "admin"
|
||||
|
||||
|
||||
before_filter :find_product_order_document_types
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def new
|
||||
@product_order_document_type = ProductOrderDocumentType.new()
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@product_order_document_type = ProductOrderDocumentType.find(params[:id])
|
||||
end
|
||||
|
||||
def show
|
||||
@product_order_document_type = ProductOrderDocumentType.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@product_order_document_type = ProductOrderDocumentType.new(params.require(:product_order_document_type).permit!)
|
||||
|
||||
|
||||
if @product_order_document_type.save
|
||||
|
||||
find_product_order_document_types
|
||||
flash[:notice] = "La catégorie à été ajouté avec succès."
|
||||
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@product_order_document_type = ProductOrderDocumentType.find(params[:id])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @product_order_document_type.update_attributes(params.require(:product_order_document_type).permit!)
|
||||
|
||||
|
||||
|
||||
flash[:notice] = "Le menu à été modifié avec succès."
|
||||
|
||||
if @reorder
|
||||
format.js {
|
||||
|
||||
render :action => "update" }
|
||||
else
|
||||
format.js {
|
||||
@product_order_document_type = ProductOrderDocumentType.find(@product_order_document_type.id)
|
||||
render :action => "update_row" }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@product_order_document_type = ProductOrderDocumentType.find(params[:id])
|
||||
@product_order_document_type.destroy
|
||||
find_product_order_document_types
|
||||
|
||||
flash[:notice] = "La catégorie à bien été supprimée."
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def find_product_order_document_types
|
||||
|
||||
@product_order_document_types = ProductOrderDocumentType.all
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
71
app/controllers/admin/product_order_documents_controller.rb
Executable file
71
app/controllers/admin/product_order_documents_controller.rb
Executable file
@ -0,0 +1,71 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::ProductOrderDocumentsController < ApplicationController
|
||||
before_filter :auth_admin
|
||||
|
||||
layout "admin"
|
||||
|
||||
|
||||
|
||||
def show
|
||||
@product_order_document = ProductOrderDocument.find_by_token(params[:id])
|
||||
@product_order = @product_order_document.product_order
|
||||
params[:inline] = true
|
||||
if true
|
||||
|
||||
@temp_file = "#{Rails.root}/pdf/bl/DOC_#{@product_order_document.id}_temp.pdf"
|
||||
@final_file = "#{Rails.root}/pdf/bl/DOC_#{@product_order_document.id}.pdf"
|
||||
|
||||
|
||||
view = ActionView::Base.new(Rails.root.join('app/views'))
|
||||
view.class.include ApplicationHelper
|
||||
view.class.include Rails.application.routes.url_helpers
|
||||
|
||||
pdf = view.render(
|
||||
:pdf => "#{@product_order.id}",
|
||||
:template => "admin/product_order_documents/show.html.haml",
|
||||
|
||||
:locals => {:@product_order => @product_order, :@product_order_document => @product_order_document})
|
||||
|
||||
# then save to a file
|
||||
pdf = WickedPdf.new.pdf_from_string(pdf, :margin => { top: 0, # default 10 (mm)
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0 })
|
||||
|
||||
save_path = @temp_file
|
||||
File.open(save_path, 'wb') do |file|
|
||||
file << pdf
|
||||
end
|
||||
|
||||
if @product_order_document.product_order_document_type.data_file
|
||||
|
||||
|
||||
|
||||
require 'posix/spawn'
|
||||
|
||||
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'background', @product_order_document.product_order_document_type.data_file.file.path, 'output', @final_file
|
||||
|
||||
#pdftk /Users/nico/Desktop/Sanstitre4.pdf background /Users/nico/Dev/negos_app/pdf_stamp/bl.pdf output sortie.pdf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@data_to_send = File.open( @final_file).read
|
||||
else
|
||||
@data_to_send = File.open( @temp_file).read
|
||||
end
|
||||
|
||||
send_data @data_to_send, :filename =>"#{@product_order_document.d_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
|
||||
|
||||
|
||||
else
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
@ -5,6 +5,9 @@ class ProductOrder < ActiveRecord::Base
|
||||
|
||||
has_many :product_order_products
|
||||
|
||||
has_many :product_order_documents
|
||||
|
||||
|
||||
|
||||
|
||||
has_many :sub_products, :through => :product_order_products
|
||||
@ -39,6 +42,35 @@ class ProductOrder < ActiveRecord::Base
|
||||
attr_accessor :force_fdp_validation, :force_payment, :force_cgv_validation
|
||||
|
||||
|
||||
def generate_docs
|
||||
dts = []
|
||||
ProductOrderDocumentType.where(:reseaux_id => nil, :fournisseur_id => nil).each do |dt|
|
||||
dts << dt
|
||||
self.product_order_documents.create(:product_order_document_type => dt, :product_order_id => self.id)
|
||||
end
|
||||
|
||||
|
||||
ProductOrderDocumentType.where(:reseaux_id => self.reseaux_id, :fournisseur_id => nil).each do |dt|
|
||||
|
||||
if !dts.include?(dt)
|
||||
dts << dt
|
||||
self.product_order_documents.create(:product_order_document_type => dt, :product_order_id => self.id)
|
||||
end
|
||||
end
|
||||
|
||||
ProductOrderDocumentType.where(:reseaux_id => self.reseaux_id, :fournisseur_id => self.fournisseur_ids.uniq).each do |dt|
|
||||
|
||||
if !dts.include?(dt)
|
||||
dts << dt
|
||||
self.product_order_documents.create(:product_order_document_type => dt, :product_order_id => self.id)
|
||||
end
|
||||
end
|
||||
|
||||
dts
|
||||
|
||||
end
|
||||
|
||||
|
||||
def sage_tiers
|
||||
"tiers"
|
||||
end
|
||||
@ -194,6 +226,7 @@ class ProductOrder < ActiveRecord::Base
|
||||
|
||||
|
||||
if !self.bill_number and self.paid and self.product_order_payment_type_ok_id == 3 and self.payments.where(:paid => true).first
|
||||
self.generate_docs
|
||||
self.paid_at = self.payments.where(:paid => true).first.paid_at
|
||||
|
||||
self.bill_year = self.paid_at.year
|
||||
@ -226,6 +259,8 @@ class ProductOrder < ActiveRecord::Base
|
||||
|
||||
self.generate_bl_number
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -247,8 +282,8 @@ class ProductOrder < ActiveRecord::Base
|
||||
|
||||
|
||||
if !self.bl_number and ([1,2,3,4,10].include?(self.product_order_payment_type_ok_id))
|
||||
|
||||
self.bl_year = self.updated_at.year
|
||||
self.generate_docs
|
||||
self.bl_year = self.created_at.year
|
||||
|
||||
|
||||
|
||||
|
62
app/models/product_order_document.rb
Normal file
62
app/models/product_order_document.rb
Normal file
@ -0,0 +1,62 @@
|
||||
class ProductOrderDocument < ActiveRecord::Base
|
||||
belongs_to :product_order
|
||||
belongs_to :product_order_document_type
|
||||
|
||||
after_create do
|
||||
generate_number
|
||||
end
|
||||
|
||||
before_validation do
|
||||
self.verify
|
||||
if !self.id
|
||||
puts "TTTT"
|
||||
puts ProductOrderDocument.where(:product_order_id => self.product_order_id,:product_order_document_type_id => self.product_order_document_type_id).count
|
||||
|
||||
#sdffdsfds = sffds
|
||||
if ProductOrderDocument.where(:product_order_id => self.product_order_id,:product_order_document_type_id => self.product_order_document_type_id).count > 0
|
||||
|
||||
#sdfsd = sdfdsfsdf
|
||||
errors.add(:product_order_id, 'Le document existe déjà')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def generate_number
|
||||
|
||||
|
||||
if !self.d_number
|
||||
|
||||
self.d_year = self.product_order.created_at.year
|
||||
|
||||
|
||||
self.d_prefix = self.product_order_document_type.prefix.to_s
|
||||
self.label = self.product_order_document_type.label.to_s
|
||||
self.header = self.product_order_document_type.header.to_s
|
||||
self.footer = self.product_order_document_type.footer.to_s
|
||||
self.image_file_id = self.product_order_document_type.image_file_id
|
||||
self.data_file_id = self.product_order_document_type.data_file_id
|
||||
self.reseaux_id = self.product_order_document_type.reseaux_id
|
||||
self.fournisseur_id = self.product_order_document_type.fournisseur_id
|
||||
|
||||
last_number = 0
|
||||
last_dt = ProductOrderDocument.where("d_number is not null").where(:d_year => self.d_year,:product_order_document_type_id => self.product_order_document_type_id).order("d_index DESC").first
|
||||
#sdfdfs = sfsdsdf
|
||||
last_number = last_dt.d_index if last_dt
|
||||
|
||||
self.d_index = last_number+1
|
||||
self.d_number = self.d_prefix+self.d_year.to_s+('%05d' % self.d_index)
|
||||
self.save #(:validate => false)
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
def verify(size=16)
|
||||
if !self.token
|
||||
s = ""
|
||||
size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
|
||||
self.token = s
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
5
app/models/product_order_document_type.rb
Normal file
5
app/models/product_order_document_type.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class ProductOrderDocumentType < ActiveRecord::Base
|
||||
belongs_to :reseaux
|
||||
belongs_to :fournisseur
|
||||
belongs_to :data_file
|
||||
end
|
0
app/views/admin/_product_order_document.html.haml
Normal file
0
app/views/admin/_product_order_document.html.haml
Normal file
30
app/views/admin/product_order_document_types/_form.html.haml
Executable file
30
app/views/admin/product_order_document_types/_form.html.haml
Executable file
@ -0,0 +1,30 @@
|
||||
= semantic_form_for [:admin,@product_order_document_type], :remote => true do |form|
|
||||
|
||||
.content
|
||||
= form.input :label, :label => "Label :"
|
||||
= form.input :prefix, :label => "Prefix :"
|
||||
= form.input :reseaux_id, :label => "Réseau :", :collection => Reseaux.where(:parent_id => nil).all, :as => :select, :include_blank => true
|
||||
=form.input :fournisseur_id, :label => "Fournisseur :", :collection => Fournisseur.all, :as => :select, :include_blank => true
|
||||
|
||||
%p
|
||||
%table.form_table
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td{:style => "vertical-align:top;padding-right:10px;"}
|
||||
-r = rand(1000000000000000000000000000)
|
||||
%strong PDF de fond :
|
||||
%td
|
||||
#name{:id => r}
|
||||
-if form.object.data_file
|
||||
=form.object.data_file.abstract_file_name if form.object.data_file
|
||||
=link_to "Supprimer", "#", :onclick => "$('#input_"+r.to_s+"').val('');$('#name_"+r.to_s+"').html('');return false;"
|
||||
|
||||
=form.hidden_field :data_file_id, :id => "input_"+r.to_s
|
||||
|
||||
=link_to "Modifier ce fichier", "#", :onclick => "select_file_from_manager('"+r.to_s+"');return false;"
|
||||
|
||||
.actions
|
||||
= form.submit "Sauvegarder"
|
||||
|
@ -0,0 +1,15 @@
|
||||
|
||||
%tr#product_order_document_type.product_order_document_type{:id => product_order_document_type.id}
|
||||
%td=product_order_document_type.label
|
||||
%td=product_order_document_type.prefix
|
||||
%td=product_order_document_type.reseaux.name if product_order_document_type.reseaux
|
||||
%td=product_order_document_type.fournisseur.name if product_order_document_type.fournisseur
|
||||
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, product_order_document_type], :data =>{:remote => true, :confirm => 'Voulez-vous vraiment supprimer cette taille ? Elle sera supprimée de tous les produits qui la contenait'}, :method => :delete
|
||||
|
||||
= link_to i(:pencil), edit_admin_product_order_document_type_path(product_order_document_type), :data => {:remote => true}
|
||||
|
||||
|
||||
|
||||
|
4
app/views/admin/product_order_document_types/create.js.erb
Executable file
4
app/views/admin/product_order_document_types/create.js.erb
Executable file
@ -0,0 +1,4 @@
|
||||
close_pane_hover();
|
||||
|
||||
$('#product_order_document_types').html("<%= escape_javascript(render(@product_order_document_types)) %>");
|
||||
|
5
app/views/admin/product_order_document_types/destroy.js.erb
Executable file
5
app/views/admin/product_order_document_types/destroy.js.erb
Executable file
@ -0,0 +1,5 @@
|
||||
|
||||
$('#product_order_document_type_<%= @product_order_document_type.id %>').remove();
|
||||
|
||||
|
||||
<%= flash_js %>
|
1
app/views/admin/product_order_document_types/edit.js.erb
Executable file
1
app/views/admin/product_order_document_types/edit.js.erb
Executable file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600);
|
26
app/views/admin/product_order_document_types/index.html.haml
Executable file
26
app/views/admin/product_order_document_types/index.html.haml
Executable file
@ -0,0 +1,26 @@
|
||||
.qi_header
|
||||
.right= link_to 'Ajouter un document', new_admin_product_order_document_type_path, :class => "btn btn-primary", :remote => true
|
||||
%h1
|
||||
|
||||
Boutique
|
||||
%span
|
||||
Liste des documents
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
%table.table
|
||||
%tr
|
||||
%th
|
||||
Label
|
||||
%th
|
||||
Prefix
|
||||
%th
|
||||
Réseaux
|
||||
%th
|
||||
Fournisseur
|
||||
|
||||
%th
|
||||
|
||||
%tbody#product_order_document_types=render @product_order_document_types
|
1
app/views/admin/product_order_document_types/new.js.erb
Executable file
1
app/views/admin/product_order_document_types/new.js.erb
Executable file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600);
|
2
app/views/admin/product_order_document_types/update_row.js.erb
Executable file
2
app/views/admin/product_order_document_types/update_row.js.erb
Executable file
@ -0,0 +1,2 @@
|
||||
close_pane_hover();
|
||||
$('#product_order_document_type_<%= @product_order_document_type.id %>').replaceWith("<%= escape_javascript(render(@product_order_document_type))%>");
|
@ -0,0 +1,3 @@
|
||||
%tr
|
||||
%td
|
||||
=link_to product_order_document.d_number, admin_product_order_document_path(product_order_document.token)
|
185
app/views/admin/product_order_documents/_vs_bl.html.haml
Normal file
185
app/views/admin/product_order_documents/_vs_bl.html.haml
Normal file
@ -0,0 +1,185 @@
|
||||
#main
|
||||
|
||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||
=@product_order_document.label
|
||||
n°
|
||||
=@product_order_document.d_number
|
||||
%br
|
||||
=l @product_order.created_at, :format => :date #@product_order_document.created_at
|
||||
|
||||
|
||||
|
||||
- if @product_order.reseaux_id != 19
|
||||
%div{:style => "height:350px;"}
|
||||
-else
|
||||
%div{:style => "height:140px;"}
|
||||
|
||||
|
||||
-if @product_order.reseaux_id != 19
|
||||
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
||||
%tr
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de facturation
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_bill.firstname
|
||||
|
||||
=@product_order.particular_bill.name
|
||||
%br
|
||||
=@product_order.particular_bill.address_2
|
||||
|
||||
-if @product_order.particular_bill.address_3?
|
||||
%br
|
||||
=@product_order.particular_bill.address_3
|
||||
%br
|
||||
=@product_order.particular_bill.cp
|
||||
|
||||
=@product_order.particular_bill.city
|
||||
%br
|
||||
=@product_order.particular_bill.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de livraison
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_send.firstname
|
||||
|
||||
=@product_order.particular_send.name
|
||||
%br
|
||||
=@product_order.particular_send.address_2
|
||||
|
||||
-if @product_order.particular_send.address_3?
|
||||
%br
|
||||
=@product_order.particular_send.address_3
|
||||
%br
|
||||
=@product_order.particular_send.cp
|
||||
|
||||
=@product_order.particular_send.city
|
||||
%br
|
||||
=@product_order.particular_send.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
%table.table{:style => "width:100%;margin:1cm 0;"}
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%th
|
||||
%th
|
||||
Description
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix U. HT
|
||||
%th{:style => "text-align:right;width:80px"}
|
||||
Qté
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix HT
|
||||
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
|
||||
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%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
|
||||
%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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=# 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
|
||||
|
||||
%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
|
||||
|
||||
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||
=product_order_product.qty
|
||||
%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
|
||||
|
||||
-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
|
||||
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
|
||||
-if @product_order.reseaux_id != 19
|
||||
%p
|
||||
%br
|
||||
Mode de paiment :
|
||||
-if @product_order.product_order_payment_type_ok_id == 3
|
||||
CB
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 1
|
||||
Chèque
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 2
|
||||
Virement
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 4
|
||||
Mandat administratif
|
||||
%br
|
||||
%br
|
||||
Franco de port pour le Pays Voironnais
|
||||
%td Total HT :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
|
||||
-if @product_order.reseaux_id != 19
|
||||
%tr
|
||||
|
||||
%td TVA :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
|
||||
|
||||
%tr
|
||||
|
||||
%td Total TTC :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%br
|
||||
|
||||
<!---
|
||||
.fdp
|
||||
%table.table
|
||||
%tr
|
||||
%td
|
||||
=@product_order.product_fdp_archived.fdp_description
|
||||
%td
|
||||
=number_to_currency @product_order.product_fdp_archived.price
|
||||
="--->"
|
||||
|
185
app/views/admin/product_order_documents/_vsg_achats.html.haml
Normal file
185
app/views/admin/product_order_documents/_vsg_achats.html.haml
Normal file
@ -0,0 +1,185 @@
|
||||
#main
|
||||
|
||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||
=@product_order_document.label
|
||||
n°
|
||||
=@product_order_document.d_number
|
||||
%br
|
||||
=l @product_order.created_at, :format => :date #@product_order_document.created_at
|
||||
|
||||
|
||||
|
||||
- if @product_order.reseaux_id != 19
|
||||
%div{:style => "height:350px;"}
|
||||
-else
|
||||
%div{:style => "height:140px;"}
|
||||
|
||||
|
||||
-if @product_order.reseaux_id != 19
|
||||
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
||||
%tr
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de facturation
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_bill.firstname
|
||||
|
||||
=@product_order.particular_bill.name
|
||||
%br
|
||||
=@product_order.particular_bill.address_2
|
||||
|
||||
-if @product_order.particular_bill.address_3?
|
||||
%br
|
||||
=@product_order.particular_bill.address_3
|
||||
%br
|
||||
=@product_order.particular_bill.cp
|
||||
|
||||
=@product_order.particular_bill.city
|
||||
%br
|
||||
=@product_order.particular_bill.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de livraison
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_send.firstname
|
||||
|
||||
=@product_order.particular_send.name
|
||||
%br
|
||||
=@product_order.particular_send.address_2
|
||||
|
||||
-if @product_order.particular_send.address_3?
|
||||
%br
|
||||
=@product_order.particular_send.address_3
|
||||
%br
|
||||
=@product_order.particular_send.cp
|
||||
|
||||
=@product_order.particular_send.city
|
||||
%br
|
||||
=@product_order.particular_send.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
%table.table{:style => "width:100%;margin:1cm 0;"}
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%th
|
||||
%th
|
||||
Description
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix U. HT
|
||||
%th{:style => "text-align:right;width:80px"}
|
||||
Qté
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix HT
|
||||
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
|
||||
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%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
|
||||
%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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=# 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
|
||||
|
||||
%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
|
||||
|
||||
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||
=product_order_product.qty
|
||||
%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
|
||||
|
||||
-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
|
||||
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
|
||||
-if @product_order.reseaux_id != 19
|
||||
%p
|
||||
%br
|
||||
Mode de paiment :
|
||||
-if @product_order.product_order_payment_type_ok_id == 3
|
||||
CB
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 1
|
||||
Chèque
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 2
|
||||
Virement
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 4
|
||||
Mandat administratif
|
||||
%br
|
||||
%br
|
||||
Franco de port pour le Pays Voironnais
|
||||
%td Total HT :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
|
||||
-if @product_order.reseaux_id != 19
|
||||
%tr
|
||||
|
||||
%td TVA :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
|
||||
|
||||
%tr
|
||||
|
||||
%td Total TTC :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%br
|
||||
|
||||
<!---
|
||||
.fdp
|
||||
%table.table
|
||||
%tr
|
||||
%td
|
||||
=@product_order.product_fdp_archived.fdp_description
|
||||
%td
|
||||
=number_to_currency @product_order.product_fdp_archived.price
|
||||
="--->"
|
||||
|
@ -0,0 +1,109 @@
|
||||
#main
|
||||
|
||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||
=@product_order_document.label
|
||||
n°
|
||||
=@product_order_document.d_number
|
||||
%br
|
||||
=l @product_order.created_at, :format => :date #@product_order_document.created_at
|
||||
|
||||
|
||||
|
||||
|
||||
%div{:style => "height:350px;"}
|
||||
|
||||
|
||||
|
||||
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
||||
%tr
|
||||
%td{:style => "width:8cm;border:0"}
|
||||
%h3 Adresse de facturation
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_bill.firstname
|
||||
|
||||
=@product_order.particular_bill.name
|
||||
%br
|
||||
=@product_order.particular_bill.address_2
|
||||
|
||||
-if @product_order.particular_bill.address_3?
|
||||
%br
|
||||
=@product_order.particular_bill.address_3
|
||||
%br
|
||||
=@product_order.particular_bill.cp
|
||||
|
||||
=@product_order.particular_bill.city
|
||||
%br
|
||||
=@product_order.particular_bill.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
|
||||
|
||||
-@fournisseur = @product_order_document.product_order_document_type.fournisseur
|
||||
-fournisseur = @fournisseur
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%table.table{:style => "width:100%;margin:1cm 0;"}
|
||||
%tr
|
||||
%th Référence
|
||||
%th Nom
|
||||
%th Nbr
|
||||
-if true
|
||||
%th Prix U. HT
|
||||
%th Prix HT
|
||||
|
||||
|
||||
-@product_order.sub_products.group(:reference).where(:fournisseur_id => @fournisseur.id).each do |sub_product_group|
|
||||
%tr
|
||||
%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
|
||||
-if true
|
||||
%td
|
||||
|
||||
=number_to_currency sub_products[0].price_ht
|
||||
|
||||
%td{:style => "text-align:right;"}
|
||||
=number_to_currency sub_products[0].price_ht * i
|
||||
|
||||
%tr
|
||||
%td{:colspan => 4, :style => "text-align:right;"}
|
||||
Total HT :
|
||||
%td{:style => "text-align:right;"}
|
||||
-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
|
||||
-if @fournisseur.id == 5
|
||||
%tr
|
||||
%td{:colspan => 4, :style => "text-align:right;"}
|
||||
Taux de TVA :
|
||||
%td{:style => "text-align:right;"}
|
||||
20%
|
||||
%tr
|
||||
%td{:colspan => 4, :style => "text-align:right;"}
|
||||
TVA :
|
||||
%td{:style => "text-align:right;"}
|
||||
=number_to_currency i*0.20
|
||||
%tr
|
||||
%td{:colspan => 4, :style => "text-align:right;"}
|
||||
Total TTC
|
||||
%td{:style => "text-align:right;"}
|
||||
=number_to_currency i*1.2
|
||||
|
||||
|
||||
|
||||
|
298
app/views/admin/product_order_documents/show.html.haml
Normal file
298
app/views/admin/product_order_documents/show.html.haml
Normal file
@ -0,0 +1,298 @@
|
||||
!!!
|
||||
%html
|
||||
%head
|
||||
|
||||
%meta{:"http-equiv" => "Content-Type", :content=>"text/html; charset=UTF-8"}
|
||||
%meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"}
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i" rel="stylesheet">
|
||||
:scss
|
||||
body{
|
||||
font-size:11pt;
|
||||
padding :0px;
|
||||
margin:0px;
|
||||
background-color: transparent;
|
||||
|
||||
font-family:"Lato", Arial, Sans-serif;
|
||||
padding:1cm;
|
||||
}
|
||||
#main{
|
||||
//margin-left:4.2cm;
|
||||
|
||||
}
|
||||
td, th{
|
||||
//border:1px solid black;
|
||||
padding:5px;
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
th{
|
||||
font-weight:normal;
|
||||
border-bottom:1px solid gray;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
td{
|
||||
border-bottom:1px solid rgba(0,0,0,0.1);
|
||||
|
||||
p{
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
table{
|
||||
border-collapse:collapse;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
tr{
|
||||
page-break-inside:avoid;
|
||||
|
||||
}
|
||||
|
||||
#bottom{
|
||||
page-break-inside:avoid;
|
||||
|
||||
}
|
||||
.right{
|
||||
text-align:right;
|
||||
|
||||
}
|
||||
.line p{
|
||||
margin:0px;
|
||||
}
|
||||
.description{
|
||||
padding-top:2pt;
|
||||
display:block;
|
||||
|
||||
}
|
||||
|
||||
.bot_separate{
|
||||
height:50pt;
|
||||
|
||||
}
|
||||
|
||||
.upcase{
|
||||
|
||||
text-transform:uppercase;
|
||||
}
|
||||
|
||||
h3{
|
||||
|
||||
font-size:1em;
|
||||
margin-bottom:5px;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%body
|
||||
-if @product_order.reseaux_id == 19 #distributeurs vouisstar
|
||||
|
||||
-if @product_order_document.product_order_document_type.fournisseur
|
||||
=render :partial => "admin/product_order_documents/vsg_fournisseurs"
|
||||
-else
|
||||
=render :partial => "admin/product_order_documents/vsg_achats"
|
||||
|
||||
-elsif @product_order.reseaux_id == 2 #Vouisstar
|
||||
=render :partial => "admin/product_order_documents/vs_bl"
|
||||
-else
|
||||
=render :partial => "admin/product_order_documents/general"
|
||||
-if false
|
||||
#main
|
||||
|
||||
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
|
||||
|
||||
=@product_order_document.label
|
||||
n°
|
||||
=@product_order_document.d_number
|
||||
%br
|
||||
=l @product_order_document.created_at, :format => :date
|
||||
|
||||
|
||||
-if @product_order.reseaux_id != 19
|
||||
%div{:style => "height:350px;"}
|
||||
-else
|
||||
%div{:style => "height:140px;"}
|
||||
|
||||
|
||||
-if @product_order.reseaux_id != 19
|
||||
%table.table{:style => "position:absolute;right:1cm;top:220px"}
|
||||
%tr
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de facturation
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_bill.firstname
|
||||
|
||||
=@product_order.particular_bill.name
|
||||
%br
|
||||
=@product_order.particular_bill.address_2
|
||||
|
||||
-if @product_order.particular_bill.address_3?
|
||||
%br
|
||||
=@product_order.particular_bill.address_3
|
||||
%br
|
||||
=@product_order.particular_bill.cp
|
||||
|
||||
=@product_order.particular_bill.city
|
||||
%br
|
||||
=@product_order.particular_bill.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
|
||||
%td{:style => "width:5.5cm;border:0"}
|
||||
%h3 Adresse de livraison
|
||||
|
||||
%strong=@product_order.particular_bill.organisation
|
||||
%br
|
||||
=@product_order.particular_send.firstname
|
||||
|
||||
=@product_order.particular_send.name
|
||||
%br
|
||||
=@product_order.particular_send.address_2
|
||||
|
||||
-if @product_order.particular_send.address_3?
|
||||
%br
|
||||
=@product_order.particular_send.address_3
|
||||
%br
|
||||
=@product_order.particular_send.cp
|
||||
|
||||
=@product_order.particular_send.city
|
||||
%br
|
||||
=@product_order.particular_send.country
|
||||
%br
|
||||
%br
|
||||
=@product_order.particular_bill.tel
|
||||
|
||||
%table.table{:style => "width:100%;margin:1cm 0;"}
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%th
|
||||
%th
|
||||
Description
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix U. HT
|
||||
%th{:style => "text-align:right;width:80px"}
|
||||
Qté
|
||||
%th{:style => "text-align:right;width:100px"}
|
||||
Prix HT
|
||||
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
|
||||
|
||||
%tr
|
||||
-if @product_order.reseaux_id != 19
|
||||
%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
|
||||
%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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=# 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
|
||||
|
||||
%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
|
||||
|
||||
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
|
||||
=product_order_product.qty
|
||||
%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
|
||||
|
||||
-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
|
||||
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
|
||||
-if @product_order.reseaux_id != 19
|
||||
%p
|
||||
%br
|
||||
Mode de paiment :
|
||||
-if @product_order.product_order_payment_type_ok_id == 3
|
||||
CB
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 1
|
||||
Chèque
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 2
|
||||
Virement
|
||||
-elsif @product_order.product_order_payment_type_ok_id == 4
|
||||
Mandat administratif
|
||||
%br
|
||||
%br
|
||||
Franco de port pour le Pays Voironnais
|
||||
%td Total HT :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
|
||||
-if @product_order.reseaux_id != 19
|
||||
%tr
|
||||
|
||||
%td TVA :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
|
||||
|
||||
%tr
|
||||
|
||||
%td Total TTC :
|
||||
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%br
|
||||
|
||||
<!---
|
||||
.fdp
|
||||
%table.table
|
||||
%tr
|
||||
%td
|
||||
=@product_order.product_fdp_archived.fdp_description
|
||||
%td
|
||||
=number_to_currency @product_order.product_fdp_archived.price
|
||||
="--->"
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,9 +6,20 @@
|
||||
%span
|
||||
Détail de la commande
|
||||
="#"+@product_order.id.to_s
|
||||
%hr
|
||||
%h3=@product_order.reseaux.name if @product_order.reseaux
|
||||
|
||||
|
||||
|
||||
Documents générés
|
||||
%table
|
||||
-@product_order.product_order_documents.each do |document|
|
||||
=render document if document.id
|
||||
|
||||
%hr
|
||||
%br
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
%p
|
||||
@ -19,7 +30,7 @@
|
||||
="oui" if @product_order.paid
|
||||
=link_to "Facture", bill_admin_product_order_path(@product_order)
|
||||
|
||||
=link_to "BL", bl_admin_product_order_path(@product_order.token)
|
||||
=link_to "BL #{@product_order.bl_number}", bl_admin_product_order_path(@product_order.token)
|
||||
|
||||
|
||||
-if @product_order.paid
|
||||
@ -109,3 +120,23 @@
|
||||
%tbody#product_order_payments
|
||||
=render @product_order.product_order_payments.order("created_at DESC")
|
||||
|
||||
|
||||
%hr
|
||||
%hr
|
||||
|
||||
-#@product_order.generate_docs
|
||||
%table.table
|
||||
-@product_orders = ProductOrder.where(:completed_finish => true).order("created_at ASC").each do |po|
|
||||
|
||||
-if !po.reseaux
|
||||
-po.reseaux_id = 2
|
||||
-po.save
|
||||
-po.generate_docs
|
||||
%tr
|
||||
%td=po.reseaux.name if po.reseaux
|
||||
%td=link_to po.bl_number,[:admin,po]
|
||||
%td=po.product_order_documents[0].d_number if po.product_order_documents[0]
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
%br
|
@ -68,6 +68,8 @@
|
||||
%li= link_to "Produits", admin_products_path
|
||||
%li= link_to "Tailles", admin_product_sizes_path
|
||||
%li= link_to "Commandes", admin_product_orders_path
|
||||
%li= link_to "Fournisseurs", admin_fournisseurs_path
|
||||
%li= link_to "Type de documents", admin_product_order_document_types_path
|
||||
%li=# link_to "Codes de reduction", admin_vourcher_codes_path
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ Rails.application.routes.draw do
|
||||
get 'p/:mlm_token' => "public/customers#parrainage", :as => :mlm_token
|
||||
|
||||
namespace :public do
|
||||
|
||||
resources :payments do
|
||||
member do
|
||||
get :paid_by_ogone
|
||||
@ -184,7 +185,7 @@ Rails.application.routes.draw do
|
||||
|
||||
get "sitemap.:f" => "public/sitemap#sitemap"
|
||||
namespace :public do
|
||||
|
||||
resources :product_order_documents
|
||||
get :my_cart, to: "product_orders#my_cart"
|
||||
|
||||
|
||||
@ -322,7 +323,9 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
|
||||
resources :fournisseurs
|
||||
resources :product_order_documents
|
||||
resources :product_order_document_types
|
||||
resources :product_order_payments
|
||||
resources :product_orders do
|
||||
collection do
|
||||
|
@ -0,0 +1,17 @@
|
||||
class CreateProductOrderDocumentTypes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :product_order_document_types do |t|
|
||||
t.string :prefix
|
||||
t.string :label
|
||||
t.text :header
|
||||
t.text :footer
|
||||
t.integer :image_file_id
|
||||
t.integer :data_file_id
|
||||
t.integer :reseaux_id
|
||||
t.integer :fournisseur_id
|
||||
t.string :name
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
23
db/migrate/20180416162335_create_product_order_documents.rb
Normal file
23
db/migrate/20180416162335_create_product_order_documents.rb
Normal file
@ -0,0 +1,23 @@
|
||||
class CreateProductOrderDocuments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :product_order_documents do |t|
|
||||
t.string :d_number
|
||||
t.integer :d_index
|
||||
t.integer :d_year
|
||||
t.string :d_prefix
|
||||
t.string :label
|
||||
t.text :header
|
||||
t.text :footer
|
||||
t.integer :image_file_id
|
||||
t.integer :data_file_id
|
||||
t.references :product_order, index: true
|
||||
t.references :product_order_document_type
|
||||
t.integer :reseaux_id
|
||||
t.integer :fournisseur_id
|
||||
t.string :token
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
add_foreign_key :product_order_documents, :product_orders
|
||||
end
|
||||
end
|
37
db/schema.rb
37
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: 20180326193718) do
|
||||
ActiveRecord::Schema.define(version: 20180416162335) do
|
||||
|
||||
create_table "abonnements", force: :cascade do |t|
|
||||
t.integer "abonnement_type_id", limit: 4
|
||||
@ -824,6 +824,40 @@ ActiveRecord::Schema.define(version: 20180326193718) do
|
||||
|
||||
add_index "product_options", ["product_id"], name: "index_product_options_on_product_id", using: :btree
|
||||
|
||||
create_table "product_order_document_types", force: :cascade do |t|
|
||||
t.string "prefix", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.text "header", limit: 65535
|
||||
t.text "footer", limit: 65535
|
||||
t.integer "image_file_id", limit: 4
|
||||
t.integer "data_file_id", limit: 4
|
||||
t.integer "reseaux_id", limit: 4
|
||||
t.integer "fournisseur_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "product_order_documents", force: :cascade do |t|
|
||||
t.string "d_number", limit: 255
|
||||
t.integer "d_index", limit: 4
|
||||
t.integer "d_year", limit: 4
|
||||
t.string "d_prefix", limit: 255
|
||||
t.string "label", limit: 255
|
||||
t.text "header", limit: 65535
|
||||
t.text "footer", limit: 65535
|
||||
t.integer "image_file_id", limit: 4
|
||||
t.integer "data_file_id", limit: 4
|
||||
t.integer "product_order_id", limit: 4
|
||||
t.integer "product_order_document_type_id", limit: 4
|
||||
t.integer "reseaux_id", limit: 4
|
||||
t.integer "fournisseur_id", limit: 4
|
||||
t.string "token", limit: 255
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "product_order_documents", ["product_order_id"], name: "index_product_order_documents_on_product_order_id", using: :btree
|
||||
|
||||
create_table "product_order_payments", force: :cascade do |t|
|
||||
t.integer "product_order_payment_type_id", limit: 4
|
||||
t.integer "product_order_id", limit: 4
|
||||
@ -1091,6 +1125,7 @@ ActiveRecord::Schema.define(version: 20180326193718) do
|
||||
add_foreign_key "product_langs", "product_collections"
|
||||
add_foreign_key "product_option_langs", "product_options"
|
||||
add_foreign_key "product_options", "products"
|
||||
add_foreign_key "product_order_documents", "product_orders"
|
||||
add_foreign_key "product_product_sizes", "product_sizes"
|
||||
add_foreign_key "product_product_sizes", "products"
|
||||
add_foreign_key "product_stocks", "products"
|
||||
|
21
test/fixtures/product_order_document_types.yml
vendored
Normal file
21
test/fixtures/product_order_document_types.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
prefix: MyString
|
||||
label: MyString
|
||||
header: MyText
|
||||
footer: MyText
|
||||
image_file_id: 1
|
||||
data_file_id: 1
|
||||
reseaux_id: 1
|
||||
fournisseur_id: 1
|
||||
|
||||
two:
|
||||
prefix: MyString
|
||||
label: MyString
|
||||
header: MyText
|
||||
footer: MyText
|
||||
image_file_id: 1
|
||||
data_file_id: 1
|
||||
reseaux_id: 1
|
||||
fournisseur_id: 1
|
25
test/fixtures/product_order_documents.yml
vendored
Normal file
25
test/fixtures/product_order_documents.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
d_number: MyString
|
||||
d_index: 1
|
||||
d_year: 1
|
||||
d_prefix: MyString
|
||||
label: MyString
|
||||
header: MyText
|
||||
footer: MyText
|
||||
image_file_id: 1
|
||||
data_file_id: 1
|
||||
product_order_id:
|
||||
|
||||
two:
|
||||
d_number: MyString
|
||||
d_index: 1
|
||||
d_year: 1
|
||||
d_prefix: MyString
|
||||
label: MyString
|
||||
header: MyText
|
||||
footer: MyText
|
||||
image_file_id: 1
|
||||
data_file_id: 1
|
||||
product_order_id:
|
7
test/models/product_order_document_test.rb
Normal file
7
test/models/product_order_document_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProductOrderDocumentTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/product_order_document_type_test.rb
Normal file
7
test/models/product_order_document_type_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProductOrderDocumentTypeTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user