améliorations diverses
This commit is contained in:
parent
4a3c92af46
commit
52acb2094f
@ -9,7 +9,7 @@ class MOdrFileProduct < ApplicationRecord
|
|||||||
|
|
||||||
validates :qte, :presence => true, :if => :is_tire_admin_form?
|
validates :qte, :presence => true, :if => :is_tire_admin_form?
|
||||||
validates :price, :presence => true, :if => :is_tire_admin_form?
|
validates :price, :presence => true, :if => :is_tire_admin_form?
|
||||||
validates :m_odr_product_id, :presence => true, :if => :is_tire_admin_form?
|
validates :m_odr_product_size_id, :presence => true, :if => :is_tire_admin_form?
|
||||||
|
|
||||||
def is_tire_admin_form?
|
def is_tire_admin_form?
|
||||||
if self.m_odr_file and self.m_odr_file.m_odr_file_type_id == 2
|
if self.m_odr_file and self.m_odr_file.m_odr_file_type_id == 2
|
||||||
|
@ -21,7 +21,7 @@ class MOdrFileRoulage < ApplicationRecord
|
|||||||
if nbr_primes_to_use = self.nbr_primes_not_useds and nbr_primes_to_use > 0
|
if nbr_primes_to_use = self.nbr_primes_not_useds and nbr_primes_to_use > 0
|
||||||
|
|
||||||
|
|
||||||
if achats = MOdrFile.where(:admin_ok => true, :p_customer_id => self.m_odr_file.p_customer_id,:m_odr_file_type_id => 2).where("buy_at <= ? and nbr_pneus_not_useds > 0", self.date) and (achats.sum(:nbr_pneus_not_useds) > 0)
|
if achats = MOdrFile.where(:admin_ok => true, :p_customer_id => self.m_odr_file.p_customer_id,:m_odr_file_type_id => 2).where("buy_at <= ? and nbr_pneus_not_useds > 0 and buy_at >= ? and buy_at <= ?", self.date, self.date.beginning_of_year, self.date.end_of_year) and (achats.sum(:nbr_pneus_not_useds) > 0)
|
||||||
|
|
||||||
state = "A traiter"
|
state = "A traiter"
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ class MOdrProduct < ApplicationRecord
|
|||||||
belongs_to :m_odr
|
belongs_to :m_odr
|
||||||
|
|
||||||
has_many :m_odr_product_sizes
|
has_many :m_odr_product_sizes
|
||||||
|
accepts_nested_attributes_for :m_odr_product_sizes, :allow_destroy => true
|
||||||
|
|
||||||
has_many :m_odr_product_remises, :dependent => :destroy
|
has_many :m_odr_product_remises, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :m_odr_product_remises, :allow_destroy => true
|
accepts_nested_attributes_for :m_odr_product_remises, :allow_destroy => true
|
||||||
|
@ -16,6 +16,7 @@ Historique des factures
|
|||||||
-per_page = params[:search][:per_page]
|
-per_page = params[:search][:per_page]
|
||||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||||
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
||||||
|
-@m_odr_files = @m_odr_files.where("created_at >= ? and created_at <= ?", @m_odr_file.created_at.beginning_of_year, @m_odr_file.created_at.end_of_year)
|
||||||
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
||||||
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
=debug @m_odr_file.nbr_pneus
|
|
||||||
|
|
||||||
Historique des factures
|
Historique des factures
|
||||||
|
|
||||||
@ -19,6 +18,7 @@ Historique des factures
|
|||||||
-per_page = params[:search][:per_page]
|
-per_page = params[:search][:per_page]
|
||||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||||
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
-@m_odr_files = @m_odr_file.p_customer.m_odr_files.where("id != ?", @m_odr_file.id).where(:m_odr_file_type_id => @m_odr_file.m_odr_file_type_id )
|
||||||
|
-@m_odr_files = @m_odr_files.where("created_at >= ? and created_at <= ?", @m_odr_file.created_at.beginning_of_year, @m_odr_file.created_at.end_of_year)
|
||||||
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
-@m_odr_files = sort_by_sorting(@m_odr_files, "created_at DESC")
|
||||||
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
-@m_odr_files = @m_odr_files.page(page).per(per_page)
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ Historique des factures
|
|||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
%td Utilisateur
|
%td Utilisateur
|
||||||
%td=@m_odr_file.p_customer.show_name if @m_odr_file.p_customer
|
%td=link_to @m_odr_file.p_customer.show_name, [:admin, @m_odr_file.p_customer] if @m_odr_file.p_customer
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td Date de la facture
|
%td Date de la facture
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
%td= form.input :qte, :label => "Qté :"
|
%td= form.input :qte, :label => "Qté :"
|
||||||
%td= form.input :amount, :label => "Montant :"
|
%td= form.input :amount, :label => "Montant :"
|
||||||
|
|
||||||
%td.actions=link_to_remove_fields ic(:"trash-o"), form
|
%td=link_to_remove_fields ic(:"trash-o"), form
|
@ -1,15 +1,7 @@
|
|||||||
=semantic_form_for [:admin, @m_odr_product_size], :remote => true do |f|
|
|
||||||
|
|
||||||
.content
|
|
||||||
=f.inputs do
|
|
||||||
= f.input :name, :label => "name :"
|
|
||||||
= f.input :position, :label => "position :"
|
|
||||||
= f.input :m_odr_product, :label => "m_odr_product :"
|
|
||||||
= f.input :sap, :label => "sap :"
|
|
||||||
|
|
||||||
|
|
||||||
|
%tr.m_odr_product_remise_form.field
|
||||||
|
%td{:style => "width:400px"}= form.input :name, :label => "Nom :"
|
||||||
|
%td= form.input :sap, :label => "SAP :"
|
||||||
|
|
||||||
|
%td=link_to_remove_fields ic(:"trash-o"), form
|
||||||
|
|
||||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
|
||||||
|
|
@ -13,6 +13,14 @@
|
|||||||
%p= link_to_add_fields ic(:plus)+" Ajouter une remise", f, :m_odr_product_remises
|
%p= link_to_add_fields ic(:plus)+" Ajouter une remise", f, :m_odr_product_remises
|
||||||
|
|
||||||
|
|
||||||
|
%table.m_odr_product_sizes_form
|
||||||
|
|
||||||
|
=f.semantic_fields_for :m_odr_product_sizes do |form|
|
||||||
|
=render :partial => "admin/m_odr_product_sizes/form", :locals => {:form => form}
|
||||||
|
|
||||||
|
%p= link_to_add_fields ic(:plus)+" Ajouter une taille", f, :m_odr_product_sizes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user