mise à jour process clients + facture
This commit is contained in:
parent
c4ae300c80
commit
9b86a9a314
@ -225,7 +225,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to admin_price_documents_path("price_document_type_ids[]" => @price_document.price_document_type_id)
|
redirect_back(fallback_location: admin_price_documents_path)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PCustomer < ApplicationRecord
|
|||||||
|
|
||||||
has_many :p_documents
|
has_many :p_documents
|
||||||
|
|
||||||
validates :code, :presence => true, :uniqueness => true
|
#validates :code, :presence => true, :uniqueness => true
|
||||||
|
|
||||||
has_many :p_compta_elements
|
has_many :p_compta_elements
|
||||||
|
|
||||||
@ -101,18 +101,7 @@ class PCustomer < ApplicationRecord
|
|||||||
|
|
||||||
before_validation do
|
before_validation do
|
||||||
|
|
||||||
if !self.code?
|
|
||||||
if self.particulars[0]
|
|
||||||
cars = self.particulars[0].organisation
|
|
||||||
cars += self.particulars[0].name
|
|
||||||
cars += self.particulars[0].firstname
|
|
||||||
|
|
||||||
cars = cars.to_slug.gsub(/\W/,'').upcase
|
|
||||||
cars = cars[0..2]
|
|
||||||
cars +=
|
|
||||||
self.code = self.particulars[0].cp+cars
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
generate_mlm_token
|
generate_mlm_token
|
||||||
|
|
||||||
@ -296,6 +285,14 @@ class PCustomer < ApplicationRecord
|
|||||||
self.save
|
self.save
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if !self.code?
|
||||||
|
last = PCustomer.order("code_index DESC").first
|
||||||
|
self.code_index = last.code_index + 1
|
||||||
|
self.code = "CLT"+('%05d' % self.code_index)
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -20,6 +20,19 @@ class PCustomerSheet < ApplicationRecord
|
|||||||
|
|
||||||
has_many :price_documents, :as => :ref_element
|
has_many :price_documents, :as => :ref_element
|
||||||
|
|
||||||
|
acts_as_sorting :fields => {
|
||||||
|
|
||||||
|
:p_commercial => {:name => "Commercial", :reorder => false},
|
||||||
|
:created_at => {:name => "Date", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
|
||||||
|
:admin_id => {:name => "Déposée par", :reorder => true},
|
||||||
|
:demande_type => {:name => "Type de demande", :reorder => true},
|
||||||
|
:p_customer => {:name => "Client", :reorder => false},
|
||||||
|
:tot_amount_ht => {:name => "Total HT", :reorder => true, :sort_name => "cc_tot_amount_ht", :sort_name => "p_customer_sheets.cc_tot_amount_ht"},
|
||||||
|
:tot_amount_ttc => {:name => "Total TTC", :reorder => true, :sort_name => "cc_tot_amount_ttc", :sort_name => "p_customer_sheets.cc_tot_amount_ttc"},
|
||||||
|
:state => {:name => "Statut", :reorder => false},
|
||||||
|
:actions => {:name => "Actions", :reorder => false},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QI_DYNAMICS = %w(accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva payment_days payment_delais payment_month_end payment_end_at )
|
QI_DYNAMICS = %w(accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva payment_days payment_delais payment_month_end payment_end_at )
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ class Particular < ApplicationRecord
|
|||||||
#validates :name, :presence => true, :if => :force_validation
|
#validates :name, :presence => true, :if => :force_validation
|
||||||
#validates :firstname, :presence => true, :if => :force_validation
|
#validates :firstname, :presence => true, :if => :force_validation
|
||||||
validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :if => :force_email_validation
|
validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :if => :force_email_validation
|
||||||
validates :address_2, :presence => true, :if => :force_validation
|
#validates :address_2, :presence => true, :if => :force_validation
|
||||||
validates :cp, :presence => true, :if => :force_validation
|
validates :cp, :presence => true, :if => :force_validation
|
||||||
validates :city, :presence => true, :if => :force_validation
|
#validates :city, :presence => true, :if => :force_validation
|
||||||
validates :country, :presence => true, :if => :force_validation
|
validates :country, :presence => true, :if => :force_validation
|
||||||
#validates :tel, :presence => true, :if => :force_validation
|
#validates :tel, :presence => true, :if => :force_validation
|
||||||
#validates :organisation, :presence => true, :if => :force_validation
|
#validates :organisation, :presence => true, :if => :force_validation
|
||||||
|
@ -43,11 +43,6 @@
|
|||||||
-if @p_customer.id or (@p_customer.code? and @p_customer.errors[:code])
|
-if @p_customer.id or (@p_customer.code? and @p_customer.errors[:code])
|
||||||
= form.input :code, :label => "Code client :"
|
= form.input :code, :label => "Code client :"
|
||||||
|
|
||||||
= form.input :siret, :label => "Siret :"
|
|
||||||
= form.input :ape, :label => "Ape :"
|
|
||||||
= form.input :tva_intra, :label => "TVA intra. :"
|
|
||||||
= form.input :website, :label => "Site Web :"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.qi_row
|
.qi_row
|
||||||
@ -77,21 +72,30 @@
|
|||||||
|
|
||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
%h4 Paiements
|
= form.input :siret, :label => "Siret :"
|
||||||
.row.qi_cancel_margins
|
= form.input :ape, :label => "Ape :"
|
||||||
.col-sm-4
|
= form.input :tva_intra, :label => "TVA intra. :"
|
||||||
= form.input :comptant, :label => "Paiement comptant nécessaire ?"
|
= form.input :website, :label => "Site Web :"
|
||||||
|
|
||||||
-if false
|
.qi_row
|
||||||
= form.input :acompte, :label => "Acompte nécessaire ?"
|
.qi_pannel.qi_plain.padding
|
||||||
= form.input :acompte_percent, :label => "Pourcentage d'acompte :"
|
|
||||||
.col-sm-4
|
|
||||||
= form.input :payment_delais, :label => "Délais jour de paiement :"
|
|
||||||
|
|
||||||
= form.input :payment_fin_de_mois, :label => "Fin de mois ?"
|
|
||||||
|
|
||||||
.col-sm-4
|
-if true
|
||||||
= form.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
%h4 Paiements
|
||||||
|
.row.qi_cancel_margins
|
||||||
|
.col-sm-4
|
||||||
|
= form.input :comptant, :label => "Paiement comptant nécessaire ?"
|
||||||
|
|
||||||
|
-if false
|
||||||
|
= form.input :acompte, :label => "Acompte nécessaire ?"
|
||||||
|
= form.input :acompte_percent, :label => "Pourcentage d'acompte :"
|
||||||
|
.col-sm-4
|
||||||
|
= form.input :payment_delais, :label => "Délais jour de paiement :"
|
||||||
|
|
||||||
|
= form.input :payment_fin_de_mois, :label => "Fin de mois ?"
|
||||||
|
|
||||||
|
.col-sm-4
|
||||||
|
= form.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:id => "payment_type_id_select"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@
|
|||||||
.qi_row#tabs
|
.qi_row#tabs
|
||||||
.qi_pannel
|
.qi_pannel
|
||||||
%ul.nav.nav-tabs
|
%ul.nav.nav-tabs
|
||||||
-params[:tab] = params[:tab] || "projets"
|
-params[:tab] = params[:tab] || "offres"
|
||||||
|
|
||||||
%li{:class => ("active" if params[:tab] == "projets")}=link_to "Projets", "?tab=projets#tabs"
|
%li{:class => ("active" if params[:tab] == "offres")}=link_to "Offres", "?tab=offres#tabs"
|
||||||
-if false
|
-if false
|
||||||
%li{:class => ("active" if params[:tab] == "etat")}=link_to "Etat de compte", "?tab=etat#tabs"
|
%li{:class => ("active" if params[:tab] == "etat")}=link_to "Etat de compte", "?tab=etat#tabs"
|
||||||
|
|
||||||
@ -74,13 +74,13 @@
|
|||||||
%li{:class => ("active" if params[:tab] == "payments")}=link_to "Paiements", "?tab=payments#tabs"
|
%li{:class => ("active" if params[:tab] == "payments")}=link_to "Paiements", "?tab=payments#tabs"
|
||||||
|
|
||||||
.qi_tab_content
|
.qi_tab_content
|
||||||
-if params[:tab] == "projets"
|
-if params[:tab] == "offres"
|
||||||
#offres
|
#offres
|
||||||
|
|
||||||
.qi_tab_header
|
.qi_tab_header
|
||||||
.right{:style => "text-align:right;"}
|
.right{:style => "text-align:right;"}
|
||||||
-if @p_customer.enabled
|
-if @p_customer.enabled
|
||||||
=#link_to ic(:plus)+" Demande de commande", new_admin_s_project_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary btn-ap-add"
|
=link_to ic(:plus)+" Nouvelle offre", new_admin_p_customer_sheet_path(:p_customer_id => @p_customer.id), :class => "btn btn-primary btn-ap-add"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -91,11 +91,11 @@
|
|||||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||||
-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
|
||||||
-@s_projects =@p_customer.s_projects
|
-@p_customer_sheets =@p_customer.p_customer_sheets
|
||||||
-@s_projects = sort_by_sorting(@s_projects, "created_at DESC")
|
-@p_customer_sheets = sort_by_sorting(@p_customer_sheets, "created_at DESC")
|
||||||
-@s_projects = @s_projects.page(page).per(per_page)
|
-@p_customer_sheets = @p_customer_sheets.page(page).per(per_page)
|
||||||
|
|
||||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @s_projects}
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_customer_sheets}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@
|
|||||||
p_customer_id: $(".p_customer_id").val()
|
p_customer_id: $(".p_customer_id").val()
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
alert(data.p_product_cat_id);
|
|
||||||
form.find(".input_price_line_price_u_ht").val(data.price);
|
form.find(".input_price_line_price_u_ht").val(data.price);
|
||||||
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
form.find(".input_price_line_tva_account_id").val(data.tva_account_id);
|
||||||
form.find(".input_price_line_p_product_cat_id").val(data.p_product_cat_id);
|
form.find(".input_price_line_p_product_cat_id").val(data.p_product_cat_id);
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddCodeIndexToPCustomers < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :p_customers, :code_index, :integer
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,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: 2020_05_25_113631) do
|
ActiveRecord::Schema.define(version: 2020_11_09_142527) do
|
||||||
|
|
||||||
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
@ -978,6 +978,7 @@ ActiveRecord::Schema.define(version: 2020_05_25_113631) do
|
|||||||
t.string "nav_vat_bus_posting_group"
|
t.string "nav_vat_bus_posting_group"
|
||||||
t.string "nav_primary_contact_no"
|
t.string "nav_primary_contact_no"
|
||||||
t.datetime "nav_last_date_modified"
|
t.datetime "nav_last_date_modified"
|
||||||
|
t.integer "code_index"
|
||||||
t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
|
t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
|
||||||
t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
|
t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
|
||||||
t.index ["particular_id"], name: "index_p_customers_on_particular_id"
|
t.index ["particular_id"], name: "index_p_customers_on_particular_id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user