Merge branch 'philippe-entréeenstock'
This commit is contained in:
commit
3bd57cb940
8
Gemfile
8
Gemfile
@ -54,9 +54,9 @@ group :development do
|
||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||
gem 'web-console', '>= 3.3.0'
|
||||
gem 'listen', '>= 3.0.5', '< 3.2'
|
||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||
gem 'spring'
|
||||
gem 'spring-watcher-listen', '~> 2.0.0'
|
||||
# # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||
# gem 'spring'
|
||||
# gem 'spring-watcher-listen', '~> 2.0.0'
|
||||
end
|
||||
|
||||
group :test do
|
||||
@ -118,3 +118,5 @@ gem 'axlsx_rails'
|
||||
|
||||
gem 'mimemagic', "0.3.10"
|
||||
gem "roo"
|
||||
gem "select2-rails"
|
||||
|
||||
|
@ -301,6 +301,7 @@ GEM
|
||||
activemodel (>= 5)
|
||||
elasticsearch (>= 6)
|
||||
hashie
|
||||
select2-rails (4.0.13)
|
||||
selenium-webdriver (3.142.3)
|
||||
childprocess (>= 0.5, < 2.0)
|
||||
rubyzip (~> 1.2, >= 1.2.2)
|
||||
@ -308,10 +309,6 @@ GEM
|
||||
sixarm_ruby_unaccent (1.2.0)
|
||||
sort_alphabetical (1.1.0)
|
||||
unicode_utils (>= 1.2.2)
|
||||
spring (2.1.0)
|
||||
spring-watcher-listen (2.0.1)
|
||||
listen (>= 2.7, < 4.0)
|
||||
spring (>= 1.2, < 3.0)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
@ -406,9 +403,8 @@ DEPENDENCIES
|
||||
roo
|
||||
sass-rails (~> 5)
|
||||
searchkick
|
||||
select2-rails
|
||||
selenium-webdriver
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
sprockets
|
||||
tiny_tds (= 1.3.0)
|
||||
truncate_html
|
||||
|
@ -15,7 +15,7 @@
|
||||
#= require vendor/jquery.fileupload
|
||||
#= require vendor/jquery.fileupload-ui
|
||||
#= require vendor/jquery.fileupload-process
|
||||
#= require vendor/select2.min
|
||||
#= require select2
|
||||
#= require vendor/accounting
|
||||
#= require vendor/jquery.mask
|
||||
#= require vendor/datatables.min
|
||||
|
@ -25,6 +25,13 @@ function show_pane_hover(content, width, height, zindex){
|
||||
|
||||
$(".datepicker").attr("autocomplete", "off");
|
||||
|
||||
$(document).keyup(function(e) {
|
||||
if (e.keyCode == 27) {
|
||||
close_pane_hover();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
*= require select2
|
||||
*/
|
||||
// Variables
|
||||
@import "1-variables/app";
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
.actions{
|
||||
position:absolute;
|
||||
position: static;
|
||||
bottom:0px;
|
||||
left:0px;
|
||||
right:0px;
|
||||
|
@ -133,4 +133,8 @@ class Admin::LineStocksController < ApplicationController
|
||||
def empty_stock
|
||||
@price_document = PriceDocument.where(:price_document_type_id => 4, :cost_ok => false)
|
||||
end
|
||||
|
||||
def show_p_article
|
||||
@line_stock = LineStock.find(params[:line_stock_id])
|
||||
end
|
||||
end
|
||||
|
@ -146,17 +146,20 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
|
||||
def new
|
||||
|
||||
|
||||
@p_customer_sheet = PCustomerSheet.new()
|
||||
|
||||
@p_customer = PCustomer.find(params[:p_customer_id]) if params[:p_customer_id]
|
||||
|
||||
|
||||
|
||||
@p_customer_sheet.p_customer = @p_customer
|
||||
|
||||
@p_customer_sheet.price_line_block = PriceLineBlock.new(:particular_bill_id => @p_customer.particular_bill_id, :particular_send_id => @p_customer.particular_send_id)
|
||||
@p_customer_sheet.price_line_block = PriceLineBlock.new
|
||||
@p_customer_sheet.price_line_block.price_lines.build
|
||||
@p_customer_sheet.price_line_block.p_customer = @p_customer
|
||||
|
||||
@p_customer_sheet.price_line_block.build_particular_send(owner: @p_customer)
|
||||
@p_customer_sheet.price_line_block.build_particular_bill(owner: @p_customer)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -171,15 +174,15 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
def create
|
||||
@p_customer_sheet = PCustomerSheet.new(params.require(:p_customer_sheet).permit!)
|
||||
|
||||
@p_customer_sheet.admin = current_admin
|
||||
|
||||
|
||||
|
||||
if @p_customer_sheet.save
|
||||
|
||||
redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
|
||||
else
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
puts params
|
||||
puts @p_customer_sheet.errors.messages
|
||||
puts "ERRORSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"
|
||||
@p_customer = @p_customer_sheet.price_line_block.p_customer
|
||||
|
||||
render action: "new"
|
||||
@ -233,6 +236,10 @@ class Admin::PCustomerSheetsController < ApplicationController
|
||||
|
||||
def generate_bc
|
||||
@p_customer_sheet = PCustomerSheet.find(params[:id])
|
||||
@p_customer_sheet.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1)
|
||||
@p_customer_sheet.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 2)
|
||||
|
||||
|
||||
@p_customer_sheet.generate_bc
|
||||
|
||||
redirect_back(fallback_location: admin_p_customer_sheets_path)
|
||||
|
@ -98,7 +98,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
|
||||
if true
|
||||
@price_documents = @price_documents.where(:price_document_type_id => params[:price_document_type_ids]) if params[:price_document_type_ids].size > 0
|
||||
@price_documents = @price_documents.where(:price_document_type_id => params[:price_document_type_ids]).order(:id) if params[:price_document_type_ids].size > 0
|
||||
|
||||
|
||||
if current_admin.p_commercial
|
||||
@ -234,7 +234,6 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
redirect_to admin_p_fournisseurs_path(:create_document => "Commande achat" )
|
||||
|
||||
else
|
||||
|
||||
@price_document = PriceDocument.new(:p_customer_id => params[:p_customer_id], :p_fournisseur_id => params[:p_fournisseur_id])
|
||||
@price_document.price_document_type = PriceDocumentType.where(:label => params[:document_type]).first
|
||||
@price_document.price_line_block = PriceLineBlock.new(:p_customer_id => params[:p_customer_id], :p_fournisseur_id => params[:p_fournisseur_id])
|
||||
@ -332,7 +331,7 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
if @price_document.save
|
||||
#if @price_document.cc_label == "Demande prix"
|
||||
if @price_document.cc_label == "Facture achat"
|
||||
render action: :show
|
||||
redirect_to admin_price_document_path(@price_document)
|
||||
else
|
||||
redirect_to admin_price_documents_path(:price_document_type_id => @price_document.price_document_type_id)
|
||||
end
|
||||
@ -428,38 +427,39 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
end
|
||||
|
||||
|
||||
def print
|
||||
|
||||
|
||||
|
||||
def OLD_print
|
||||
@price_document = PriceDocument.find_by_token(params[:id])
|
||||
@element = @price_document.ref_element
|
||||
|
||||
doc_number = @price_document.d_number
|
||||
url = print_admin_price_document_path(:id => @price_document.token, :html => true)
|
||||
|
||||
|
||||
|
||||
|
||||
params[:inline] = true
|
||||
|
||||
if !params[:html] # and !Rails.env.development?
|
||||
|
||||
@data_to_send = File.open(@price_document.generate_pdf).read
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
send_data @data_to_send, :filename =>"#{doc_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
|
||||
#render :inline => "y"
|
||||
|
||||
else
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def print
|
||||
@price_document = PriceDocument.find_by_token(params[:id])
|
||||
@element = @price_document.ref_element
|
||||
|
||||
doc_number = @price_document.d_number
|
||||
url = print_admin_price_document_path(:id => @price_document.token, :html => true)
|
||||
params[:inline] = true
|
||||
if !params[:html] # and !Rails.env.development?
|
||||
@data_to_send = File.open(@price_document.generate_pdf).read
|
||||
send_data @data_to_send, :filename =>"#{doc_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
|
||||
#render :inline => "y"
|
||||
else
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create_avoir
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
require "awesome_print"
|
||||
class Admin::PriceLinesController < ApplicationController
|
||||
layout "admin"
|
||||
before_action :auth_admin, :except => [:edit, :update]
|
||||
@ -46,12 +46,10 @@ class Admin::PriceLinesController < ApplicationController
|
||||
def update
|
||||
@price_line = PriceLine.find(params[:id])
|
||||
|
||||
|
||||
if @price_line.update_attributes(params.require(:price_line).permit!)
|
||||
|
||||
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@ -62,4 +60,14 @@ class Admin::PriceLinesController < ApplicationController
|
||||
@price_line.destroy
|
||||
|
||||
end
|
||||
|
||||
def add_p_article
|
||||
@price_line = PriceLine.find(params[:price_line_id])
|
||||
# @p_article = PArticle.new#@price_line.p_articles.build
|
||||
# @p_article_serial_nums = @p_article.p_article_serial_nums.build
|
||||
end
|
||||
|
||||
def add_price_line_p_article
|
||||
@price_line = PriceLine.find(params[:price_line_id])
|
||||
end
|
||||
end
|
||||
|
@ -79,6 +79,15 @@ module ApplicationHelper
|
||||
icon = column == sort_column ? icon : ""
|
||||
link_to raw("#{title} "+ic(icon).html_safe), request.query_parameters.merge({column: column, direction: direction})
|
||||
end
|
||||
|
||||
|
||||
def id_color(price_line)
|
||||
if price_line.p_articles.count == 0
|
||||
return "background-color: red"
|
||||
elsif price_line.p_articles.count < price_line.qte
|
||||
return "background-color: orange"
|
||||
else
|
||||
return "background-color: #70ff29"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -20,6 +20,18 @@ module DocumentLineHelper
|
||||
|
||||
|
||||
end
|
||||
|
||||
if association == :p_articles
|
||||
|
||||
|
||||
|
||||
new_object.p_product_ref_id = f.object.p_product_ref_id
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
if options[:partial]
|
||||
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
||||
render(options[:partial], :form => builder)
|
||||
|
@ -1,4 +1,4 @@
|
||||
class LineStock < ApplicationRecord
|
||||
class LineStock < ApplicationRecord
|
||||
belongs_to :p_product_ref
|
||||
|
||||
belongs_to :stockable, :polymorphic => true
|
||||
@ -6,32 +6,28 @@ class LineStock < ApplicationRecord
|
||||
belongs_to :price_line_block
|
||||
belongs_to :stock_movement_line
|
||||
belongs_to :partition_lines
|
||||
|
||||
has_many :line_stock_p_articles
|
||||
has_many :p_articles, through: :line_stock_p_articles
|
||||
|
||||
|
||||
acts_as_sorting :fields => {
|
||||
:id => {:name => "ID", :reorder => false},
|
||||
:date => {:name => "Date", :reorder => true, :as => :date},
|
||||
:stockable => {:name => "Origine", :reorder => false},
|
||||
:p_product_ref => {:name => "Produit", :reorder => false},
|
||||
:description => {:name => "Description", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
|
||||
:dluo => {:name => "DLUO", :reorder => true},
|
||||
|
||||
:qte => {:name => "Quantité", :reorder => true},
|
||||
#:dluo => {:name => "DLUO", :reorder => true},
|
||||
:qte => {:name => "Quantité", :reorder => true },
|
||||
:qte_available => {:name => "Quantité restante", :reorder => true},
|
||||
:qte_used => {:name => "Quantité utilisée", :reorder => true},
|
||||
:price_ht => {:name => "Valeur totale d'origine", :reorder => true, :as => :currency},
|
||||
|
||||
:price_ht_available => {:name => "Valeur disponnible", :reorder => true, :as => :currency},
|
||||
|
||||
:price_ht_used => {:name => "Valeur utilisée", :reorder => true, :as => :currency},
|
||||
|
||||
:price_u_ht => {:name => "Prix Unitaire", :reorder => true, :as => :currency},
|
||||
|
||||
:price_u_kg_ht => {:name => "Prix U [Kg]", :reorder => true, :as => :currency},
|
||||
|
||||
:qte_kg_per_unit => {:name => "Poids par unité", :reorder => true},
|
||||
|
||||
:qte_kg => {:name => "Poids total", :reorder => true},
|
||||
|
||||
|
||||
#:price_u_kg_ht => {:name => "Prix U [Kg]", :reorder => true, :as => :currency},
|
||||
#:qte_kg_per_unit => {:name => "Poids par unité", :reorder => true},
|
||||
#:qte_kg => {:name => "Poids total", :reorder => true},
|
||||
|
||||
:actions => {:name => "Actions", :reorder => false},
|
||||
}
|
||||
|
4
app/models/line_stock_p_article.rb
Normal file
4
app/models/line_stock_p_article.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class LineStockPArticle < ApplicationRecord
|
||||
belongs_to :line_stock
|
||||
belongs_to :p_article
|
||||
end
|
@ -1,13 +1,21 @@
|
||||
class PArticle < ApplicationRecord
|
||||
belongs_to :p_grade
|
||||
belongs_to :p_product_ref
|
||||
belongs_to :tva_type
|
||||
has_one :p_product, through: :p_product_ref
|
||||
has_one :p_product_color, through: :p_product_ref
|
||||
has_one :s_brand, through: :p_product_ref
|
||||
|
||||
has_many :p_article_serial_nums, dependent: :destroy
|
||||
# has_many :p_serial_num_values, through: :p_article_serial_nums
|
||||
has_many :price_line_p_articles
|
||||
has_many :price_lines, through: :price_line_p_articles
|
||||
accepts_nested_attributes_for :p_article_serial_nums
|
||||
|
||||
has_many :line_stock_p_articles
|
||||
has_many :line_stocks, through: :line_stock_p_articles
|
||||
|
||||
|
||||
|
||||
validates_presence_of :p_product_ref
|
||||
# has_many :p_product_ref_specs, through: :p_product_ref
|
||||
@ -49,4 +57,8 @@ class PArticle < ApplicationRecord
|
||||
def member_label
|
||||
"#{p_product_ref.cc_name}"
|
||||
end
|
||||
|
||||
def serialized_name
|
||||
"#{self.p_product_ref.cc_name} #{self.p_article_serial_nums.map{|x| x.value}.join(' / ')}"
|
||||
end
|
||||
end
|
||||
|
@ -73,8 +73,13 @@ class PCustomer < ApplicationRecord
|
||||
|
||||
def generate_code
|
||||
if !self.code
|
||||
last_used_code = self.class.all.order(code: :desc).limit(1)[0].code
|
||||
last_number = last_used_code.match(/\d+/).to_s.to_i + 1
|
||||
if self.class.all.order(code: :desc).limit(1)[0]
|
||||
last_used_code = self.class.all.order(code: :desc).limit(1)[0].code
|
||||
last_number = last_used_code.match(/\d+/).to_s.to_i + 1
|
||||
else
|
||||
last_used_code = 1
|
||||
last_number = 1
|
||||
end
|
||||
|
||||
code = "CLI%04d" % [last_number]
|
||||
|
||||
|
@ -12,12 +12,13 @@ class PCustomerSheet < ApplicationRecord
|
||||
belongs_to :p_customer
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"#, :dependent => :destroy
|
||||
accepts_nested_attributes_for :particular_bill
|
||||
|
||||
belongs_to :particular_send, :class_name => "Particular"#, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :particular_send
|
||||
|
||||
has_one :price_line_block, :as => :price_lineable
|
||||
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
|
||||
has_many :price_lines, :through => :price_line_block
|
||||
|
||||
@ -30,7 +31,7 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
|
||||
#:cc_com_counter => {:name => "ID", :reorder => true},
|
||||
:past_id => {:name => "N° ancien système", :reorder => true},
|
||||
:id => {:name => "ID", :reorder => true},
|
||||
:d_number => {:name => "N° BC", :reorder => false},
|
||||
:created_at => {:name => "Date", :reorder => true, :sort_name => "p_customer_sheets.created_at"},
|
||||
:admin_id => {:name => "Déposée par", :reorder => true},
|
||||
@ -263,30 +264,73 @@ class PCustomerSheet < ApplicationRecord
|
||||
self.save
|
||||
end
|
||||
|
||||
|
||||
def generate_doc(label, state)
|
||||
self.archive_now if !self.archived
|
||||
self.block_price if !self.price_blocked
|
||||
price_document = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today)
|
||||
price_document.p_customer = self.p_customer
|
||||
self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1)
|
||||
|
||||
price_document.price_line_block = self.price_line_block.dup
|
||||
|
||||
price_document.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
price_document.price_line_block.price_lines << new_pl
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 1).empty?
|
||||
price_document_standard_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today, :tva_type_id => 1)
|
||||
price_document_standard_tva.p_customer = self.p_customer
|
||||
price_document_standard_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_standard_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 1).empty?
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 1).each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document_standard_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if price_document.save
|
||||
|
||||
price_document.archive_now
|
||||
if price_document_standard_tva.save
|
||||
price_document_standard_tva.archive_now
|
||||
self.state = state
|
||||
self.save
|
||||
|
||||
end
|
||||
|
||||
if !self.price_line_block.price_lines.joins(:p_articles).where("p_articles.tva_type_id = ?", 2).empty?
|
||||
price_document_sur_marge_tva = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today, :tva_type_id => 2)
|
||||
price_document_sur_marge_tva.p_customer = self.p_customer
|
||||
price_document_sur_marge_tva.price_line_block = self.price_line_block.dup
|
||||
price_document_sur_marge_tva.price_line_block.ac_block_type = nil
|
||||
|
||||
self.price_line_block.price_lines.each do |pl|
|
||||
if !pl.p_articles.where(tva_type_id: 2).empty?
|
||||
new_pl = pl.dup
|
||||
new_pl.ac_block_type = nil
|
||||
pl.p_articles.where(tva_type_id: 2).each { |p_article| new_pl.p_articles << p_article }
|
||||
price_document_sur_marge_tva.price_line_block.price_lines << new_pl
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if price_document_sur_marge_tva.save
|
||||
price_document_sur_marge_tva.archive_now
|
||||
self.state = state
|
||||
self.save
|
||||
end
|
||||
|
||||
# price_document = self.price_documents.new(:price_document_type => PriceDocumentType.find_by_label(label), :date => Date.today)
|
||||
# price_document.p_customer = self.p_customer
|
||||
# price_document.price_line_block = self.price_line_block.dup
|
||||
# price_document.price_line_block.ac_block_type = nil
|
||||
|
||||
# self.price_line_block.price_lines.each do |pl|
|
||||
# new_pl = pl.dup
|
||||
# new_pl.ac_block_type = nil
|
||||
# pl.p_articles.each { |p_article| new_pl.p_articles << p_article }
|
||||
# price_document.price_line_block.price_lines << new_pl
|
||||
# end
|
||||
|
||||
# if price_document.save
|
||||
# price_document.archive_now
|
||||
# self.state = state
|
||||
# self.save
|
||||
# end
|
||||
end
|
||||
|
||||
def generate_d
|
||||
@ -305,7 +349,7 @@ class PCustomerSheet < ApplicationRecord
|
||||
|
||||
def generate_bc
|
||||
|
||||
generate_doc("Bon de commande", "commande")
|
||||
generate_doc("Bon de commande client", "commande")
|
||||
|
||||
end
|
||||
|
||||
|
@ -7,6 +7,7 @@ class Particular < ApplicationRecord
|
||||
has_many :open_ranges, :through => :open_range_elements
|
||||
|
||||
belongs_to :owner, :polymorphic => true
|
||||
#has_many :p_customer_sheets
|
||||
#validates :civilite, :presence => true, :if => :force_validation
|
||||
#validates :name, :presence => true, :if => :force_validation
|
||||
#validates :firstname, :presence => true, :if => :force_validation
|
||||
|
@ -5,6 +5,7 @@ class PriceDocument < ApplicationRecord
|
||||
belongs_to :p_commercial
|
||||
belongs_to :p_devise
|
||||
belongs_to :p_payment_type
|
||||
belongs_to :tva_type
|
||||
|
||||
|
||||
has_one :p_compta_element, :dependent => :destroy, :as => :element
|
||||
@ -12,7 +13,6 @@ class PriceDocument < ApplicationRecord
|
||||
belongs_to :p_fournisseur
|
||||
|
||||
has_one :price_line_block, :as => :price_lineable
|
||||
|
||||
accepts_nested_attributes_for :price_line_block
|
||||
|
||||
belongs_to :ref_element, :polymorphic => true
|
||||
@ -26,7 +26,7 @@ class PriceDocument < ApplicationRecord
|
||||
accepts_nested_attributes_for :avoir_p_payment_documents, allow_destroy: true
|
||||
|
||||
#PURCHASES = ["Demande prix", "Réponse fournisseur", "Commande achat", "Facture achat", "Consultation fournisseur"]
|
||||
PURCHASES = ["Commande achat"]
|
||||
PURCHASES = ["Facture achat"]
|
||||
SALES = ["Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
|
||||
# AVANCEMENT = ["0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]
|
||||
AVANCEMENT = ["0%", "25%", "50%", "75%", "100"]
|
||||
@ -265,23 +265,25 @@ class PriceDocument < ApplicationRecord
|
||||
def self.qi_table_order
|
||||
{
|
||||
|
||||
:p_customer_code => {:name => "Code client", :reorder => false},
|
||||
|
||||
|
||||
:avancement => {:name => "Avancement (%)", :reorder => true},
|
||||
:list_designaton => {:name => "Designation liste", :reorder => true},
|
||||
:end_date => {:name => "Fin de consultation", :reorder => true},
|
||||
:dp_comment => {:name => "Commentaire", :reorder => true},
|
||||
:acheteur_text => {:name => "Envoyé à", :reorder => true},
|
||||
:id => {:name => "ID", :reorder => false},
|
||||
:actions => {:name => "Actions", :reorder => false},
|
||||
:p_customer_code => {:name => "Code client", :reorder => false},
|
||||
#:avancement => {:name => "Avancement (%)", :reorder => true},
|
||||
#:list_designaton => {:name => "Designation liste", :reorder => true},
|
||||
#:end_date => {:name => "Fin de consultation", :reorder => true},
|
||||
#:dp_comment => {:name => "Commentaire", :reorder => true},
|
||||
#:acheteur_text => {:name => "Envoyé à", :reorder => true},
|
||||
:customer_ref => {:name => "Ref cotation", :reorder => false},
|
||||
|
||||
|
||||
:p_commercial => {:name => "Commercial", :reorder => false},
|
||||
#:p_commercial => {:name => "Commercial", :reorder => false},
|
||||
:p_customer => {:name => "Client", :reorder => false},
|
||||
:public_fournisseur_name => {:name => "Nom fournisseur saisi", :reorder => false},
|
||||
:p_fournisseur => {:name => "Fournisseur", :reorder => false},
|
||||
:com_counter => {:name => "N° Offre", :reorder => false},
|
||||
:label => {:name => "Type", :reorder => false},
|
||||
:stock_ok => {:name => "Stock mis à jour ?", :reorder => true},
|
||||
:tva_type_name => {:name => "ID Type de TVA", :reorder => true},
|
||||
#:package_number => {:name => "Nombre de colis", :reorder => true},
|
||||
:d_number => {:name => "Numéro", :reorder => true},
|
||||
:date => {:name => "Date", :reorder => true},
|
||||
:cc_payment_end_at => {:name => "Date d'échance", :reorder => true},
|
||||
@ -295,22 +297,20 @@ class PriceDocument < ApplicationRecord
|
||||
:cc_to_paid_ttc => {:name => "Restant dû", :reorder => true, :as => :currency},
|
||||
:cc_cost_ht => {:name => "Coût HT", :reorder => true, :as => :currency},
|
||||
:cc_marge_ht => {:name => "Marge HT", :reorder => true, :as => :currency},
|
||||
:cost_ok => {:name => "Marge calculée", :reorder => true, :as => :boolean},
|
||||
:f_token => {:name => "Liens consultation"},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:stock_ok => {:name => "Stock mis à jour ?", :reorder => true},
|
||||
:actions => {:name => "Actions", :reorder => false}
|
||||
|
||||
|
||||
:cost_ok => {:name => "Marge calculée", :reorder => true, :as => :boolean}
|
||||
#:f_token => {:name => "Liens consultation"},
|
||||
}
|
||||
#, :sort_name => "code"
|
||||
end
|
||||
|
||||
def ca_tva_type_name
|
||||
self.tva_type.name
|
||||
end
|
||||
|
||||
# def package_number
|
||||
# self.price_line_block.package_number
|
||||
# end
|
||||
|
||||
def self.valid_sort
|
||||
r = []
|
||||
self.qi_table_order.each do |key, value|
|
||||
@ -343,7 +343,7 @@ class PriceDocument < ApplicationRecord
|
||||
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
QI_DYNAMICS = %w(solded_nbr_days solded_at cost_ht marge_ht weight_tot accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva label header footer payment_days payment_delais payment_month_end payment_end_at to_paid_ht to_paid_ttc to_paid_tva solded)
|
||||
QI_DYNAMICS = %w(solded_nbr_days solded_at cost_ht marge_ht weight_tot accounting_zone_id accounting_zone_name tot_amount_ht tot_amount_ttc tot_amount_tva label header footer payment_days payment_delais payment_month_end payment_end_at to_paid_ht to_paid_ttc to_paid_tva solded)# tva_type_name)
|
||||
|
||||
|
||||
def reset_for_update
|
||||
@ -585,50 +585,76 @@ class PriceDocument < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def generate_pdf
|
||||
|
||||
|
||||
|
||||
|
||||
def OLD_generate_pdf
|
||||
doc_number = self.d_number
|
||||
url = print_admin_price_document_path(:id => self.token, :html => true)
|
||||
|
||||
url = print_admin_price_document_path(:id => self.token, :html => true) #don't forget to copy line "include Rails.application.routes.url_helpers"
|
||||
|
||||
@temp_file = "#{Rails.root}/pdf/price_documents/#{doc_number}_temp.pdf"
|
||||
@final_file = "#{Rails.root}/pdf/price_documents/#{doc_number}_temp2.pdf"
|
||||
@final_file2 = "#{Rails.root}/pdf/price_documents/#{doc_number}.pdf"
|
||||
|
||||
url = (Rails.env.development? ? "http://localhost:4000" : "http://mdmb.basiclabs.fr").to_s+url
|
||||
puts url
|
||||
pdf = ("pdf")
|
||||
|
||||
url = (Rails.env.development? ? "http://localhost:3000" : "http://mdmb.basiclabs.fr").to_s+url
|
||||
pdf = ("pdf2")
|
||||
node_file = @temp_file
|
||||
|
||||
|
||||
puts "NODE IFLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts url
|
||||
puts node_file
|
||||
puts "NODE IFLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
||||
|
||||
|
||||
|
||||
system("node #{pdf}.js #{Shellwords.escape(url)} #{Shellwords.escape(@temp_file)}")
|
||||
|
||||
|
||||
|
||||
require 'posix/spawn'
|
||||
|
||||
|
||||
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'stamp', "#{Rails.root}/pdf_stamp/en-tete.pdf", 'output', @final_file
|
||||
|
||||
|
||||
# ::POSIX::Spawn::Child.new 'pdftk', @final_file,"#{Rails.root}/pdf_stamp/cgv.pdf", 'cat', 'output', @final_file2 #AJOUT CGV
|
||||
|
||||
# File.rename(@temp_file, @final_file2)
|
||||
|
||||
|
||||
#File.delete(@temp_file) if File.exist?(@temp_file)
|
||||
#File.delete(@final_file) if File.exist?(@final_file)
|
||||
::POSIX::Spawn::Child.new 'pdftk', @final_file,"#{Rails.root}/pdf_stamp/cgv.pdf", 'cat', 'output', @final_file2 #AJOUT CGV
|
||||
|
||||
# File.rename(@temp_file, @final_file2) if File.exist?(@temp_file)
|
||||
# File.delete(@temp_file) if File.exist?(@temp_file)
|
||||
# File.delete(@final_file) if File.exist?(@final_file)
|
||||
|
||||
return @final_file
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def generate_pdf
|
||||
doc_number = self.d_number
|
||||
url = print_admin_price_document_path(:id => self.token, :html => true) #don't forget to copy line "include Rails.application.routes.url_helpers"
|
||||
|
||||
@temp_file = "#{Rails.root}/pdf/price_documents/#{doc_number}_temp.pdf"
|
||||
@final_file = "#{Rails.root}/pdf/price_documents/#{doc_number}_temp2.pdf"
|
||||
@final_file2 = "#{Rails.root}/pdf/price_documents/#{doc_number}.pdf"
|
||||
|
||||
url = (Rails.env.development? ? "http://localhost:3000" : "http://mdmb.basiclabs.fr").to_s+url
|
||||
pdf = ("pdf")
|
||||
node_file = @temp_file
|
||||
|
||||
system("node #{pdf}.js #{Shellwords.escape(url)} #{Shellwords.escape(@temp_file)}")
|
||||
|
||||
require 'posix/spawn'
|
||||
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'stamp', "#{Rails.root}/pdf_stamp/en-tete.pdf", 'output', @final_file
|
||||
|
||||
if self.label != "Bon de livraison"
|
||||
#::POSIX::Spawn::Child.new 'pdftk', @final_file,"#{Rails.root}/pdf_stamp/cgv.pdf", 'cat', 'output', @final_file2 #AJOUT CGV
|
||||
#return @final_file2
|
||||
File.rename(@final_file, @final_file2) if File.exist?(@final_file)
|
||||
File.delete(@temp_file) if File.exist?(@temp_file)
|
||||
return @final_file2
|
||||
else
|
||||
return @final_file
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def create_avoir
|
||||
past_price_document = self
|
||||
|
||||
@ -763,4 +789,9 @@ class PriceDocument < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def stock_generable
|
||||
return self.price_line_block.price_lines.joins(:p_articles).count < self.price_line_block.price_lines.sum(:qte) ? false : true
|
||||
#exclure les produit non stockable et sans SN
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -10,6 +10,10 @@ class PriceLine < ApplicationRecord
|
||||
has_one :p_fournisseur, :through => :price_line_block
|
||||
|
||||
#has_many :price_line_demands, through: :price_line_resp_selects
|
||||
has_many :price_line_p_articles
|
||||
has_many :p_articles, through: :price_line_p_articles
|
||||
accepts_nested_attributes_for :p_articles
|
||||
accepts_nested_attributes_for :price_line_p_articles
|
||||
|
||||
default_scope { order('position ASC') }
|
||||
|
||||
@ -28,9 +32,7 @@ class PriceLine < ApplicationRecord
|
||||
:ref => {:name => "Ref", :reorder => true},
|
||||
:title => {:name => "Désignation", :reorder => true},
|
||||
:qte => {:name => "Qté", :reorder => true},
|
||||
|
||||
:qte_available => {:name => "Qté dispo.", :reorder => true},
|
||||
|
||||
:ct_u_price_ht => {:name => "Prix de vente", :reorder => true},
|
||||
:ref_fournisseur => {:name => "Réf. fournisseur", :reorder => true},
|
||||
:p_product_power_id => {:name => "Chargeur", :reorder => true},
|
||||
@ -43,7 +45,6 @@ class PriceLine < ApplicationRecord
|
||||
:lang_start => {:name => "Démarrage écran langue ?", :reorder => true},
|
||||
:actions => {:name => "Actions"}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -540,22 +541,6 @@ class PriceLine < ApplicationRecord
|
||||
self.ca_discount_ecole_ht
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def ca_tot_amount_ht
|
||||
if self.ct_tot_amount_ht
|
||||
self.ct_tot_amount_ht
|
||||
|
@ -7,8 +7,8 @@ class PriceLineBlock < ApplicationRecord
|
||||
|
||||
validates :p_customer_id, :presence => true, :if => :p_customer_needed?
|
||||
#validates :p_fournisseur_id, :presence => true, :if => :p_fournisseur_needed?
|
||||
validates :particular_bill_id, :presence => true, :if => :particular_bill_needed?
|
||||
validates :particular_send_id, :presence => true, :if => :particular_send_needed?
|
||||
#validates :particular_bill_id, :presence => true, :if => :particular_bill_needed?
|
||||
#validates :particular_send_id, :presence => true, :if => :particular_send_needed?
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"#, :dependent => :destroy
|
||||
|
||||
@ -29,6 +29,8 @@ class PriceLineBlock < ApplicationRecord
|
||||
|
||||
belongs_to :p_fournisseur
|
||||
accepts_nested_attributes_for :p_fournisseur
|
||||
|
||||
belongs_to :price_document
|
||||
|
||||
def to_no_archive
|
||||
if self.imported
|
||||
@ -208,8 +210,18 @@ class PriceLineBlock < ApplicationRecord
|
||||
def generate_stock
|
||||
self.price_lines.each do |pl|
|
||||
if pl.p_product_ref
|
||||
LineStock.create(:dluo => pl.dluo, :date => self.price_lineable.date, :p_product_ref => pl.p_product_ref, :description => "Entrée en stock par facture d'achat", :qte => pl.qte, :price_ht => pl.local_tot_amount_ht, :price_line => pl, :price_line_block => self, :stockable => self.price_lineable)
|
||||
|
||||
ls = LineStock.new(
|
||||
:dluo => pl.dluo,
|
||||
:date => self.price_lineable.date,
|
||||
:p_product_ref => pl.p_product_ref,
|
||||
:description => "Entrée en stock par facture d'achat",
|
||||
:qte => pl.qte,
|
||||
:price_ht => pl.local_tot_amount_ht,
|
||||
:price_line => pl,
|
||||
:price_line_block => self,
|
||||
:stockable => self.price_lineable)
|
||||
ls.p_articles = pl.p_articles
|
||||
ls.save
|
||||
end
|
||||
|
||||
|
||||
@ -441,6 +453,9 @@ class PriceLineBlock < ApplicationRecord
|
||||
end
|
||||
|
||||
if self.particular_bill_needed? and (!self.p_customer or !self.particular_bill or !self.particular_bill.owner or self.particular_bill.owner != self.p_customer)
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
puts self.particular_bill
|
||||
puts "PARTICULEARRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"
|
||||
errors.add(:particular_bill_id, 'doit être une adresse du client')
|
||||
end
|
||||
|
||||
@ -543,7 +558,7 @@ class PriceLineBlock < ApplicationRecord
|
||||
def ca_tot_lines_tva
|
||||
r = 0.0
|
||||
self.price_lines.each do |pl|
|
||||
r+= pl.tot_amount_tva
|
||||
r+= pl.tot_amount_tva if pl
|
||||
end
|
||||
return r
|
||||
end
|
||||
@ -681,7 +696,11 @@ class PriceLineBlock < ApplicationRecord
|
||||
end
|
||||
|
||||
def ca_tot_amount_ht
|
||||
self.tot_amount_af_discount_ht + self.tot_gen_discount_ht
|
||||
if self.ct_tot_amount_ht
|
||||
return self.ct_tot_amount_ht
|
||||
else
|
||||
self.tot_amount_af_discount_ht + self.tot_gen_discount_ht
|
||||
end
|
||||
end
|
||||
|
||||
def ca_tot_amount_tva
|
||||
@ -810,10 +829,6 @@ class PriceLineBlock < ApplicationRecord
|
||||
|
||||
|
||||
AVOIR_TO_RESET = %w(weight_tot tot_lines_ht tot_lines_tva tot_lines_ttc tot_fdp_ht tot_fdp_tva tot_fdp_ttc tot_discount_ht tot_discount_tva tot_discount_ttc tot_amount_af_discount_ht tot_amount_af_discount_tva tot_amount_af_discount_ttc gen_discount_percent tot_gen_discount_ht tot_gen_discount_tva tot_gen_discount_ttc tot_amount_ht tot_amount_tva tot_amount_ttc nbr_ship)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
4
app/models/price_line_p_article.rb
Normal file
4
app/models/price_line_p_article.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class PriceLinePArticle < ApplicationRecord
|
||||
belongs_to :price_line
|
||||
belongs_to :p_article
|
||||
end
|
3
app/models/tva_type.rb
Normal file
3
app/models/tva_type.rb
Normal file
@ -0,0 +1,3 @@
|
||||
class TvaType < ApplicationRecord
|
||||
has_many :price_documents
|
||||
end
|
@ -25,6 +25,7 @@
|
||||
= link_to i(:"trash-o"), [:admin, line_stock], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_line_stock_path(line_stock), :remote => true
|
||||
= link_to i(:eye), admin_line_stock_path(line_stock), :remote => true
|
||||
= link_to i(:"mobile-alt"), show_p_article_admin_line_stocks_path(line_stock_id: line_stock.id), :remote => true
|
||||
|
||||
|
||||
|
||||
|
13
app/views/admin/line_stocks/_show_p_article_form.html.haml
Normal file
13
app/views/admin/line_stocks/_show_p_article_form.html.haml
Normal file
@ -0,0 +1,13 @@
|
||||
.mx-2.my-2
|
||||
%table.table-bordered
|
||||
%tbody
|
||||
-@line_stock.p_articles.each do |p_article|
|
||||
%tr
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
- p_article.p_article_serial_nums.each do |sn|
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
="#{sn.p_serial_num_type.name} - #{sn.value}"
|
||||
.actions
|
@ -140,3 +140,4 @@
|
||||
|
||||
|
||||
|
||||
|
1
app/views/admin/line_stocks/show_p_article.js.erb
Normal file
1
app/views/admin/line_stocks/show_p_article.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "show_p_article_form"))%>",700,900);
|
@ -12,8 +12,8 @@
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
||||
- else
|
||||
.p_article_serial_nums_form.field
|
||||
=form.inputs do
|
||||
= form.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id)
|
||||
= form.input :value
|
||||
|
||||
.ml-5
|
||||
.p_article_serial_nums_form.field
|
||||
=form.inputs do
|
||||
= form.input :p_serial_num_type_id, :label => "type", as: :select, collection: PSerialNumType.pluck(:name, :id)
|
||||
= form.input :value
|
||||
|
@ -1,8 +1,10 @@
|
||||
=semantic_form_for [:admin, @p_article], :remote => true do |f|
|
||||
|
||||
.content
|
||||
- if params[:controller] == "admin/p_articles"
|
||||
=semantic_form_for [:admin, @p_article], :remote => true do |f|
|
||||
=f.inputs do
|
||||
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => f.object.label_for(:p_product_ref)
|
||||
-if params[:p_product_ref_id]
|
||||
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :selected => f.object.p_product_ref , :label => f.object.label_for(:p_product_ref)
|
||||
-else
|
||||
= f.input :p_product_ref, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => f.object.label_for(:p_product_ref)
|
||||
-if PGrade::ACTIVATED
|
||||
= f.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade"
|
||||
%h4 Numero de série :
|
||||
@ -11,9 +13,23 @@
|
||||
=render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un numéro de série", f, :p_article_serial_nums, {:class => "btn btn-primary"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
- elsif params[:controller] == "admin/price_lines"
|
||||
= form.inputs do
|
||||
|
||||
=@price_line.price_line_block.price_lineable.tva_type_id
|
||||
-if params[:p_product_ref_id]
|
||||
= form.input :p_product_ref_id, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => form.object.label_for(:p_product_ref), input_html: {disabled: true}
|
||||
= form.hidden_field :p_product_ref_id, value: form.object.p_product_ref_id
|
||||
= form.hidden_field :tva_type_id, value: @price_line.price_line_block.price_lineable.tva_type_id
|
||||
|
||||
-else
|
||||
= form.input :p_product_ref_id, as: :select, collection: PProductRef.all.distinct.pluck(:cc_name, :id), :label => form.object.label_for(:p_product_ref), input_html: {disabled: true}
|
||||
= form.hidden_field :p_product_ref_id, value: form.object.p_product_ref_id
|
||||
-if PGrade::ACTIVATED
|
||||
= form.input :p_grade, as: :select, collection: PGrade.pluck(:grade, :id), :label => "Grade"
|
||||
%h4 Numero de série :
|
||||
.p_article_serial_nums_form
|
||||
= form.semantic_fields_for :p_article_serial_nums do |form|
|
||||
=render :partial => "admin/p_article_serial_nums/form", :locals => {:form => form}
|
||||
%p= link_to_add_fields "Ajouter un numéro de série", form, :p_article_serial_nums, {:class => "btn btn-primary"}
|
||||
|
@ -1,28 +1,21 @@
|
||||
=semantic_form_for [:admin, @p_customer_sheet], :html => {:class => "qi_price_form"}, :remote => false do |form|
|
||||
=#debug form.object.errors.messages if current_admin.id == 1
|
||||
=form.semantic_fields_for :price_line_block do |f|
|
||||
=render :partial => "admin/price_line_blocks/form", :locals => {:f => f}
|
||||
|
||||
.content
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-2
|
||||
-if @p_customer_sheet and @p_customer_sheet.state != "commande"
|
||||
=#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
|
||||
|
||||
=form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
|
||||
|
||||
=form.input :past_id, :label => "N° système actuel"
|
||||
=yield :discount
|
||||
.col-2
|
||||
=yield :shipping_date
|
||||
.col-8
|
||||
=yield :particular
|
||||
|
||||
|
||||
=yield :price_lines
|
||||
-# .content
|
||||
-# .qi_row
|
||||
-# .qi_pannel.qi_plain.padding.row
|
||||
-# .col-8
|
||||
-# =@p_customer_sheet.p_customer.particular.organisation
|
||||
-# -if @p_customer_sheet and @p_customer_sheet.state != "commande"
|
||||
-# =#form.input :demande_type, :collection => ["Brouillon", "Demande de bon de commande","Demande de devis"], :as => :select, :include_blank => false, :label => "Type de demande :"
|
||||
-# =#form.input :state, :collection => ["AV BPA", "PAS BPA","BPA", "Traitée"], :as => :select, :include_blank => false, :label => "Statut :"
|
||||
-# =#form.input :past_id, :label => "N° système actuel"
|
||||
|
||||
|
||||
.large_actions
|
||||
.actions
|
||||
=link_to "Annuler", admin_p_customer_sheets_path(), :class => "btn"
|
||||
=form.submit "sauvegarder", :class => "btn btn-primary btn-ap-add"
|
||||
.clear
|
||||
|
||||
|
@ -16,14 +16,11 @@
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
|
||||
|
||||
|
||||
.qi_pannel.qi_plain.padding
|
||||
-if @bon_de_commande = @p_customer_sheet.price_documents.where(:cc_label => "Bon de commande").first
|
||||
-price_line_block = @bon_de_commande.price_line_block
|
||||
%h3
|
||||
Contenu du bon de commande
|
||||
Contenu du bon de commande
|
||||
=@bon_de_commande.d_number
|
||||
=":"
|
||||
-else
|
||||
@ -88,25 +85,25 @@
|
||||
|
||||
.clear
|
||||
|
||||
%h3 Documents liés à l'offre
|
||||
#bills
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
|
||||
-@price_documents = @p_customer_sheet.price_documents.order("date DESC, created_at DESC")
|
||||
-if params[:price_document_ids]
|
||||
-@price_documents = @price_documents.where(:id => params[:price_document_ids])
|
||||
|
||||
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
%br
|
||||
|
||||
|
||||
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
||||
|
||||
-params[:search][:per_page] = params[:search][:per_page] || 50
|
||||
-per_page = params[:search][:per_page]
|
||||
-page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
-@price_documents = @p_customer_sheet.price_documents.order("date DESC, created_at DESC")
|
||||
-if params[:price_document_ids]
|
||||
-@price_documents = @price_documents.where(:id => params[:price_document_ids])
|
||||
-@price_documents = sort_by_sorting(@price_documents, "created_at DESC")
|
||||
-@price_documents = @price_documents.page(page).per(per_page)
|
||||
|
||||
- if @price_documents.exists?
|
||||
%h3 Documents liés à l'offre
|
||||
#bills
|
||||
%br
|
||||
.clear
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents}
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_articles_lines').hide();
|
||||
|
@ -19,6 +19,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
=link_to "Annuler", "#", class:"btn btn-default", onclick:"close_pane_hover();return false;"
|
||||
=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -25,10 +25,10 @@
|
||||
%td
|
||||
=form.input :ean
|
||||
%tr
|
||||
%td
|
||||
=form.input :ct_sorecop, :label => "Sorecop personalisée :"
|
||||
%td
|
||||
=form.input :sorecop_comment, :label => "Commentaire de Sorecop :"
|
||||
-# %td
|
||||
-# =form.input :ct_sorecop, :label => "Sorecop personalisée :"
|
||||
-# %td
|
||||
-# =form.input :sorecop_comment, :label => "Commentaire de Sorecop :"
|
||||
%td
|
||||
=form.input :ct_deee, :label => "DEEE personalisée :"
|
||||
|
||||
|
@ -4,26 +4,24 @@
|
||||
.qi_pannel.qi_plain.padding
|
||||
=f.inputs do
|
||||
.row.qi_cancel_margins
|
||||
|
||||
.col-sm-2
|
||||
= f.input :p_product_cat_id, :label => "Catégorie produit :", :collection => PProductCat.all, :as => :select, :include_blank => false
|
||||
|
||||
|
||||
.col-sm-2
|
||||
%br
|
||||
= f.input :enabled, :label => "Produit actif ?"
|
||||
|
||||
.col-sm-2
|
||||
|
||||
%br
|
||||
= f.input :stockable, :label => "Produit stockable ?"#, :input_html => {:onclick => "$('#with_serial').toggle('slow');"}
|
||||
.col-sm-2
|
||||
%br
|
||||
#with_serial
|
||||
= f.input :with_serial_number, :label => "Avec n° de série ?"
|
||||
.col-sm-2
|
||||
=f.input :s_brand_id, :label => "Marque :", :collection => SBrand.all, :as => :select, :include_blank => true
|
||||
|
||||
=# f.input :stocked, :label => "Suivi de stock ?"
|
||||
|
||||
.col-sm-2
|
||||
=f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true
|
||||
|
||||
|
||||
|
||||
=#f.input :sorecop_cat, label: "Catgorie Sorecop :", :collection => SorecopCat.all, :as => :select, :include_blank => true
|
||||
|
||||
-if false
|
||||
%table{:style => "width:100%"}
|
||||
%tr
|
||||
@ -108,9 +106,3 @@
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
=form.hidden_field :particular_type
|
||||
=form.hidden_field :skip_validation, :class => "skip_validation"
|
||||
=form.hidden_field :pro
|
||||
@ -31,15 +30,14 @@
|
||||
=#form.input :email, :label => false, :placeholder => qit("don-particular-email","Email")
|
||||
=#form.input :tel, :label => false, :placeholder => qit("don-particular-phone","Téléphone")
|
||||
|
||||
Contacts de l'adresse :
|
||||
-if !params[:controller] == "p_customer_sheets"
|
||||
Contacts de l'adresse :
|
||||
.p_contacts_form
|
||||
=form.semantic_fields_for :p_contacts do |form|
|
||||
=render :partial => "admin/p_contacts/form", :locals => {:form => form}
|
||||
|
||||
|
||||
.p_contacts_form
|
||||
=form.semantic_fields_for :p_contacts do |form|
|
||||
=render :partial => "admin/p_contacts/form", :locals => {:form => form}
|
||||
|
||||
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un contact à l'adresse", form, :p_contacts
|
||||
%p= link_to_add_fields ic(:plus)+" Ajouter un contact à l'adresse", form, :p_contacts
|
||||
|
||||
=#form.input :open_ranges, :label => "Horaires d'ouvertures :", :collection => OpenRange.all, :as => :check_boxes
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
=f.inputs do
|
||||
|
||||
=f.hidden_field :price_document_type_id
|
||||
= f.hidden_field :p_customer_id
|
||||
=f.hidden_field :p_customer_id
|
||||
=f.hidden_field :ref_element_type
|
||||
=f.hidden_field :ref_element_id
|
||||
=f.hidden_field :doc_ref_id
|
||||
@ -42,7 +42,15 @@
|
||||
|
||||
|
||||
-if @price_document.price_document_type_id == 6 or @price_document.price_document_type_id == 7
|
||||
= f.input :date, :label => "Date du document :", :as => :date
|
||||
.row
|
||||
.col-6
|
||||
= f.input :date, :label => "Date de la facture achat :", :as => :date, input_html: {value: Date.today}
|
||||
.col-6
|
||||
= f.input :supplier_document_date, :label => "Date du document fournisseur :", :as => :date
|
||||
.col-6
|
||||
= f.input :tva_type_id, :label => "Type de TVA :", as: :select, collection: TvaType.pluck(:name, :id)
|
||||
.col-6
|
||||
= f.input :p_fournisseur, :label => "Fournisseur :", as: :select, collection: PFournisseur.pluck(:name, :id)
|
||||
.price_line_block_form
|
||||
=f.semantic_fields_for :price_line_block do |f|
|
||||
=render :partial => "admin/price_line_blocks/form_#{f.object.block_type_slug}", :locals => {:f => f}
|
||||
|
@ -11,8 +11,6 @@
|
||||
-if params[:price_document_type_id]
|
||||
=breadcrumb second_title: PriceDocumentType.find(params[:price_document_type_id]).label
|
||||
|
||||
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
|
||||
@ -137,7 +135,7 @@
|
||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @price_documents}
|
||||
|
||||
-if true #if params[:price_document_type_id].to_i != 0
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents, :key => params[:price_document_type_id].to_s}
|
||||
= render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @price_documents, :key => params[:price_document_type_id].to_s}
|
||||
|
||||
|
||||
:scss
|
||||
|
File diff suppressed because one or more lines are too long
@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
.qi_row
|
||||
|
||||
=#debug @price_document.price_line_block.price_lines.count
|
||||
%table.table.table-striped
|
||||
-if @price_document.label == "Réponse fournisseur"
|
||||
|
||||
@ -196,62 +196,58 @@
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th ID
|
||||
%th Référence
|
||||
%th Marque
|
||||
%th Désignation
|
||||
%th Qté
|
||||
%th Qté saisie
|
||||
%th P.U. HT
|
||||
%th TVA
|
||||
%th Montant HT
|
||||
%th Actions
|
||||
|
||||
%tbody
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
%tbody
|
||||
%tr
|
||||
%td
|
||||
%td{style: id_color(price_line), id: "price_line_#{price_line.id}", onclick: "$('.p_articles_#{price_line.id}').toggle('800','swing');"}
|
||||
="##{price_line.id}"
|
||||
%td
|
||||
=price_line.ref
|
||||
|
||||
|
||||
|
||||
|
||||
%td
|
||||
=price_line.p_product_ref.p_product.s_brand.name
|
||||
|
||||
%td{class: "p_product_ref_cc_name_#{@price_document.id}"}
|
||||
=link_to price_line.p_product_ref.cc_name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product
|
||||
|
||||
%td.numeraire{class: "price_line_qte_#{@price_document.id}"}
|
||||
=price_line.qte
|
||||
|
||||
%td.numeraire{class: "price_line_qte_#{@price_document.id}"}
|
||||
=price_line.p_articles.count
|
||||
%td.numeraire{class: "price_line_price_u_ht_#{@price_document.id}"}
|
||||
=number_to_currency price_line.price_u_ht
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=price_line.tva_account_value.to_s+"%"
|
||||
|
||||
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.tot_amount_ht
|
||||
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), admin_price_line_path(price_line), method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_price_line_path(price_line), :remote => true
|
||||
= link_to i(:eye), admin_price_line_path(price_line), :remote => true
|
||||
= link_to i(:"mobile-alt"), new_admin_p_article_path, :remote => true
|
||||
|
||||
/ %td=# price_line.line_stocks.sum(:price_ht)
|
||||
= link_to i(:"mobile-alt"), add_p_article_admin_price_lines_path(p_product_ref_id: price_line.p_product_ref.id, price_line_id: price_line.id), :remote => true if price_line.p_product_ref.p_product.stockable and price_line.p_product_ref.p_product.with_serial_number
|
||||
-price_line.p_articles.each do |p_article|
|
||||
%tr{class: "p_articles_lines p_articles_#{price_line.id}"}
|
||||
%td
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
%td
|
||||
- p_article.p_article_serial_nums.each do |sn|
|
||||
="#{sn.p_serial_num_type.name} - #{sn.value} /"
|
||||
|
||||
.qi_row
|
||||
-if current_admin.has_permission?("show-costs")
|
||||
%p
|
||||
-if @price_document.price_document_type_id == 6
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary" if !@price_document.stock_ok and @price_document.stock_generable
|
||||
=link_to "Générer les stocks", generate_stocks_admin_price_document_path(@price_document), :class => "btn btn-primary disabled" if !@price_document.stock_ok and !@price_document.stock_generable
|
||||
-elsif @price_document.price_document_type_id == 4 or @price_document.price_document_type_id == 5
|
||||
%p
|
||||
Coût :
|
||||
@ -434,6 +430,8 @@
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_articles_lines').hide();
|
||||
|
||||
const copyPriceLines = (event) => {
|
||||
event.preventDefault()
|
||||
let priceDocumentId = event.target.dataset.document
|
||||
|
@ -4,47 +4,35 @@
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
=content_for :particular do
|
||||
.row
|
||||
.p_customer_sheet_customer.col-12.mb-4
|
||||
|
||||
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
.addresses.row
|
||||
.columns.span_6
|
||||
%h4 Adresse de facturation
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
= f.input :customer_ref, :label => "Référence commande client :"
|
||||
.col-6
|
||||
.addresses.row
|
||||
.columns.span_6
|
||||
%h4 Adresse de livraison
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
|
||||
.clear
|
||||
|
||||
=content_for :shipping_date do
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
= f.input :validation_date, :label => "Date de validation :", :as => :date
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
|
||||
|
||||
|
||||
= f.input :customer_ref, :label => "Référence commande client :"
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
Adresse de livraison :
|
||||
=f.semantic_fields_for :particular_send do |form_particular_send|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_send}
|
||||
=form_particular_send.hidden_field :owner_id
|
||||
=form_particular_send.hidden_field :owner_type
|
||||
.col-6
|
||||
Adresse de facturation :
|
||||
=f.semantic_fields_for :particular_bill do |form_particular_bill|
|
||||
=render :partial => "admin/particulars/form", :locals => {:form => form_particular_bill}
|
||||
=form_particular_bill.hidden_field :owner_id
|
||||
=form_particular_bill.hidden_field :owner_type
|
||||
|
||||
-if current_admin.has_permission?("customer-sheets-bl")
|
||||
=# f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||
|
||||
@ -55,55 +43,58 @@
|
||||
%br
|
||||
|
||||
|
||||
-# %div{:style=>"padding:0 30px;"}
|
||||
-# .row.qi_field_wrapper
|
||||
-# %table{:style => "width:100%;border-collapse:separate;"}
|
||||
-# %thead
|
||||
-# %tr
|
||||
-# %th
|
||||
-# %th Produit
|
||||
-# %th{:style => "width:200px;"} Prix
|
||||
-# %th
|
||||
-# %th{:style => "width:100px;"} Qté
|
||||
-# %th TVA
|
||||
-# %th
|
||||
-# %tbody.price_lines_form
|
||||
.qi_row.price_lines_form
|
||||
=f.semantic_fields_for :price_lines do |f|
|
||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||
|
||||
=content_for :price_lines do
|
||||
%div{:style=>"padding:0 30px;"}
|
||||
.row.qi_field_wrapper
|
||||
%table{:style => "width:100%;border-collapse:separate;"}
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th Produit
|
||||
%th{:style => "width:200px;"} Prix
|
||||
%th
|
||||
%th{:style => "width:100px;"} Qté
|
||||
%th TVA
|
||||
%th
|
||||
%tbody.price_lines_form
|
||||
=f.semantic_fields_for :price_lines do |f|
|
||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||
|
||||
%p{:style=>"padding-top:10px;"}= link_to_add_fields ic("plus-circle") + " ligne", f, :price_lines, {:class => "btn btn-primary p-2", tabindex: 10, style: "position: sticky; top: 100px"}
|
||||
|
||||
%p{:style=>"padding-left:10px;"}= link_to_add_fields ic("plus-circle") + " Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary p-2 add_lines", tabindex: 10}
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
=content_for :discount do
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
-if !@avoir
|
||||
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
-if !@avoir
|
||||
.col-3
|
||||
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :"#, :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
.col-3
|
||||
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
- if f.object.id
|
||||
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||
%h4 Paiements
|
||||
|
||||
= f.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"}
|
||||
|
||||
|
||||
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||
|
||||
-if false
|
||||
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||
|
||||
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||
|
||||
-if false
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding.row
|
||||
.col-6
|
||||
%h4 Paiements
|
||||
= f.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"}
|
||||
= f.input :ct_payment_comptant, :label => "Paiement comptant nécessaire ?"
|
||||
-if false
|
||||
.col-6
|
||||
= f.input :ct_acompte, :label => "Acompte nécessaire ?"
|
||||
= f.input :ct_acompte_percent, :label => "Pourcentage d'acompte :"
|
||||
.col-6
|
||||
%h4{style: "color: transparent;"} Paiements
|
||||
= f.input :ct_payment_delais, :label => "Délais jour de paiement :"
|
||||
-if false
|
||||
.col-6
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
|
||||
:javascript
|
||||
$('.p_product_ref_select').select2();
|
||||
$('.add_lines').click(function() {
|
||||
$('.p_product_ref_select').last().select2();
|
||||
});
|
@ -1,57 +1,54 @@
|
||||
|
||||
=f.inputs do
|
||||
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
.qi_pannel.qi_plain.padding{:style => "margin:20px 0;"}
|
||||
= f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
|
||||
|
||||
|
||||
=# f.input :p_commercial_id, :label => "Commercial :", :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name if f.object.id
|
||||
= f.hidden_field :p_customer_id, :class => "p_customer_id"
|
||||
|
||||
.p_customer_sheet_customer
|
||||
|
||||
|
||||
-if f.object.p_customer and f.object.p_customer.particular
|
||||
=render :partial => "admin/p_customers/apercu", :locals => {:particular => f.object.p_customer.particular}
|
||||
|
||||
.addresses.row
|
||||
.columns.span_6
|
||||
%h3 Adresse de facturation
|
||||
-# .addresses.row
|
||||
-# .columns.span_6
|
||||
-# %h3 Adresse de facturation
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
-# -if f.object.p_customer
|
||||
-# =f.inputs do
|
||||
-# = f.input :particular_bill_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
|
||||
-# -else
|
||||
-# =f.inputs do
|
||||
-# = f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
|
||||
.columns.span_6
|
||||
%h3 Adresse de livraison
|
||||
-# .columns.span_6
|
||||
-# %h3 Adresse de livraison
|
||||
|
||||
-if f.object.p_customer
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||
-else
|
||||
=f.inputs do
|
||||
= f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
|
||||
-# -if f.object.p_customer
|
||||
-# =f.inputs do
|
||||
-# = f.input :particular_send_id, :collection => f.object.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
|
||||
-# -else
|
||||
-# =f.inputs do
|
||||
-# = f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de livraison"
|
||||
|
||||
.clear
|
||||
|
||||
|
||||
%table{:style => "width:100%;"}
|
||||
%tr
|
||||
%td{:style => "width:50%;"}
|
||||
= f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
|
||||
%td{:style => "width:50%;"}
|
||||
= f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
%td
|
||||
=# f.input :wish_date, :label => "Date de livraison souhaitée :", :as => :date
|
||||
%td
|
||||
=# f.input :ct_creation_date, :label => "Date de commande (si différente de la date de création) :", :as => :date
|
||||
.row
|
||||
.col-6
|
||||
= f.input :stock_entrance_date, :label => "Date d'entrée en stock :", :as => :date, input_html: {value: Date.today}
|
||||
|
||||
.row
|
||||
.col-6
|
||||
= f.input :customer_ref, :label => "Référence commande fournisseur :"
|
||||
|
||||
|
||||
|
||||
= f.input :customer_ref, :label => "Référence commande client :"
|
||||
-if current_admin.has_permission?("customer-sheets-bl")
|
||||
= f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||
=# f.input :bl_comment, :label => "Commentaire à mettre sur le BL :", :input_html => {:style => "min-height:50px;height:50px;"}
|
||||
|
||||
-if @p_customer_sheet and @p_customer_sheet.p_customer and @p_customer_sheet.p_customer.p_customer_sheet_note?
|
||||
%div
|
||||
@ -64,22 +61,29 @@
|
||||
|
||||
.price_lines_form
|
||||
=f.semantic_fields_for :price_lines do |f|
|
||||
=render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
|
||||
|
||||
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary"}
|
||||
-# =render :partial => "admin/price_lines/form_bon_de_reception_achat", :locals => {:form => f}
|
||||
=render :partial => "admin/price_lines/form", :locals => {:form => f}
|
||||
|
||||
%p= link_to_add_fields "Ajouter une ligne", f, :price_lines, {:class => "btn btn-primary add_lines"}
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
.qi_pannel.qi_plain.padding.price_line_block_footer{:style => "margin:20px 0;"}
|
||||
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
= f.input :cc_tot_amount_ht, label: "Somme HT des produits", input_html: {disabled: true}
|
||||
-if !@avoir
|
||||
= f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
= f.input :ct_tot_fdp_ht, :label => "Frais de port personnalisés :"
|
||||
=# f.input :ct_tot_discount_percent, :label => "Réduction pied de page (%) :", :input_html => {:class => "input_price_line_block_ct_tot_discount_percent"}
|
||||
=# f.input :ct_tot_fdp_ht, :label => "Montant des frais de port HT (€) :"
|
||||
|
||||
-if !@avoir
|
||||
-if current_admin.has_permission?("customer-sheets-bl")
|
||||
= f.input :ct_nbr_ship, :label => "Nombre de colis :"
|
||||
=# f.input :ct_nbr_ship, :label => "Nombre de colis :"
|
||||
= f.input :ct_tot_amount_ht, label: "Montant HT à payer"
|
||||
= f.input :cc_tot_amount_ttc, label: "Montant TTC à payer", :input_html => {disabled: false}
|
||||
|
||||
|
||||
|
||||
|
||||
-if current_admin.has_permission?("payments")
|
||||
-if !@p_customer_sheet or (@p_customer_sheet and @p_customer_sheet.state != "commande")
|
||||
@ -101,6 +105,8 @@
|
||||
-if false
|
||||
= f.input :ct_payment_month_end, :label => "Fin de mois ?"
|
||||
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_product_ref_select').select2();
|
||||
$('.add_lines').click(function() {
|
||||
$('.p_product_ref_select').last().select2();
|
||||
});
|
||||
|
@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
-if price_line_block.p_customer
|
||||
%h3 Client
|
||||
-if price_line_block.p_customer and price_line_block.p_customer.particular
|
||||
@ -66,57 +62,57 @@
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th IDddd
|
||||
%th Référence
|
||||
|
||||
%th Désignation
|
||||
|
||||
|
||||
|
||||
%th Qté
|
||||
%th Qté saisie
|
||||
%th Actions
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%th P.U. HT
|
||||
%th TVA
|
||||
%th
|
||||
Montant HT
|
||||
|
||||
-if price_line_block.purchase?
|
||||
%th Montant équivalent
|
||||
%tbody
|
||||
-price_line_block.price_lines.each do |price_line|
|
||||
%tr
|
||||
%td{style: id_color(price_line), id: "price_line_#{price_line.id}", onclick: "$('.p_articles_#{price_line.id}').toggle('800','swing');"}
|
||||
="##{price_line.id}"
|
||||
%td
|
||||
=price_line.ref
|
||||
|
||||
%td
|
||||
-if price_line.p_product_ref
|
||||
=price_line.p_product_ref.member_label
|
||||
-else
|
||||
=price_line.title
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=price_line.qte
|
||||
|
||||
%td.numeraire
|
||||
= price_line.p_articles.count
|
||||
= link_to i(:"mobile-alt"), add_price_line_p_article_admin_price_lines_path(p_product_ref_id: price_line.p_product_ref.id, price_line_id: price_line.id), :remote => true
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.price_u_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=price_line.tva_account_value.to_s+"%"
|
||||
|
||||
|
||||
|
||||
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.tot_amount_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
-if price_line_block.purchase?
|
||||
%td.numeraire
|
||||
=number_to_currency price_line.local_tot_amount_ht, :unit => price_line_block.devise_symbol
|
||||
|
||||
|
||||
-price_line.p_articles.each do |p_article|
|
||||
%tr{class: "p_articles_lines p_articles_#{price_line.id}"}
|
||||
%td
|
||||
%td="##{p_article.id}"
|
||||
%td=p_article.p_product_ref.name
|
||||
%td
|
||||
- p_article.p_article_serial_nums.each do |sn|
|
||||
="#{sn.p_serial_num_type.name} - #{sn.value} /"
|
||||
|
||||
-if @price_document and @price_document.label != "Demande prix" and @price_document.label != "Réponse fournisseur"
|
||||
%table.table{:style => "width:auto;float:right;"}
|
||||
%tr
|
||||
|
1
app/views/admin/price_line_p_articles/_form.html.haml
Normal file
1
app/views/admin/price_line_p_articles/_form.html.haml
Normal file
@ -0,0 +1 @@
|
||||
= form.input :p_article_id, as: :select, collection: PArticle.joins(:p_product_ref).where(p_product_ref: @price_line.p_product_ref).map{|p_article| [p_article.serialized_name, p_article.id]}, label: "Article(s) associé(s)", input_html: {class:"p_article_select"}
|
@ -0,0 +1,9 @@
|
||||
.mx-2.my-2
|
||||
=semantic_form_for [:admin, @price_line], :remote => true do |f|
|
||||
.content
|
||||
=f.inputs do
|
||||
.p_articles_form
|
||||
= f.semantic_fields_for :p_articles do |form|
|
||||
=render :partial => "admin/p_articles/form", :locals => {:form => form, @price_line => f.object}
|
||||
%p= link_to_add_fields "Ajouter un article", f, :p_articles, {:class => "btn btn-primary"} if f.object.p_articles.count < f.object.qte
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
@ -0,0 +1,17 @@
|
||||
.mx-2.my-2
|
||||
=semantic_form_for [:admin, @price_line], :remote => true do |f|
|
||||
.content
|
||||
=f.inputs do
|
||||
.price_line_p_articles_form
|
||||
= f.semantic_fields_for :price_line_p_articles do |form|
|
||||
= render "admin/price_line_p_articles/form", form: form, price_line: @price_line
|
||||
%p= link_to_add_fields "Ajouter un article", f, :price_line_p_articles, {:class => "btn btn-primary add_price_line_p_article"} if @price_line.p_articles.count < @price_line.qte
|
||||
=render :partial => "qi/actions", :locals => {:f => f}
|
||||
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_article_select').select2();
|
||||
$('.add_price_line_p_article').click(function() {
|
||||
$('.p_article_select').last().select2();
|
||||
});
|
@ -1,121 +1,41 @@
|
||||
%tr.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||
|
||||
|
||||
%td{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||
.take.mr-1
|
||||
=ic :arrows
|
||||
%td{:style => "white-space: nowrap;"}
|
||||
|
||||
|
||||
|
||||
.row.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||
.take.mr-1{:style => "padding-left:10px;", :class => ("error has-error" if form.object.errors[:p_product_ref_id].size > 0 )}
|
||||
=ic :arrows
|
||||
.col-3
|
||||
= form.input :p_product_ref, as: :select, collection: PProductRef.all.map{ |p_product_ref| [p_product_ref.member_label, p_product_ref.id] }, label: "Référence :", input_html: {class:"p_product_ref_select"}
|
||||
.input-group
|
||||
%input.p_product_ref_autocomplete_input.form-control{:type => "text", :style => "", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref), :class => "p_product_ref_name"}
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
|
||||
|
||||
-# %label Référence
|
||||
-# %input.p_product_ref_autocomplete_input.form-control{:type => "text", :style => "", tabindex: 1, autofocus: true, :value => ("#{form.object.p_product_ref.member_label}" if form.object.p_product_ref), :class => "p_product_ref_name"}
|
||||
-# = form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
|
||||
|
||||
.input-group-append
|
||||
=link_to "#", class: "btn btn-dark",:onclick => "key=genRanHex(12);select_product_from_manager(key);$(this).closest('tr').find('.p_product_ref_id').attr('id', 'p_product_ref_id_'+key);$(this).closest('tr').find('.p_product_ref_name').attr('id', 'p_product_ref_name_'+key);$(this).closest('tr').find('.p_product_ref_qte').attr('id', 'p_product_ref_qte_'+key);return false;" do
|
||||
=ic(:search)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-# .input-group-append
|
||||
-# =link_to "#", class: "btn btn-dark",:onclick => "key=genRanHex(12);select_product_from_manager(key);$(this).closest('tr').find('.p_product_ref_id').attr('id', 'p_product_ref_id_'+key);$(this).closest('tr').find('.p_product_ref_name').attr('id', 'p_product_ref_name_'+key);$(this).closest('tr').find('.p_product_ref_qte').attr('id', 'p_product_ref_qte_'+key);return false;" do
|
||||
-# =ic(:search)
|
||||
|
||||
-form.object.forced_price = true if form.object.ct_u_price_ht
|
||||
|
||||
-if form.object.forced_price and form.object.p_product_ref
|
||||
%td
|
||||
.mx-2
|
||||
.form-inline
|
||||
=qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label => false, label_class: "mr-1", :value => form.object.th_price_u_ht)
|
||||
-else
|
||||
%td
|
||||
.mx-2
|
||||
.form-inline
|
||||
=qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label =>false, label_class: "mr-1")
|
||||
%td
|
||||
.form-inline.mr-2{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
||||
= form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "form-inline input_price_line_forced_price"}
|
||||
.forced_price_wrapper.mx-2{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
||||
%td{:style => "width:100px;"}
|
||||
|
||||
= form.input :qte, :label => false, :input_html => {:class => "input_price_line_qte form-control p_product_ref_qte", tabindex: 1}
|
||||
|
||||
%td
|
||||
|
||||
|
||||
=form.input :ct_tva_account_id, :collection => options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :as => :select ,:label => false, :include_blank => false , :input_html => {:class => "input_price_line_tva_account_id form-control custom-select"}
|
||||
|
||||
%td
|
||||
|
||||
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||
|
||||
|
||||
|
||||
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||
-# -if form.object.forced_price and form.object.p_product_ref
|
||||
-# .col-3
|
||||
-# .mx-2
|
||||
-# .form-inline
|
||||
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label => false, label_class: "mr-1", :value => form.object.th_price_u_ht)
|
||||
-# -else
|
||||
-# .col-3
|
||||
-# .mx-2
|
||||
-# .form-inline
|
||||
-# =qi_js_field_price_line_form(form, :price_line, :price_u_ht, :label =>false, label_class: "mr-1")
|
||||
-# .col-3
|
||||
-# .form-inline.mr-2{:style => ("display:none;" if !current_admin or !current_admin.has_permission?("customer-sheets-personalised-price"))}
|
||||
-# = form.input :forced_price, :label => "Prix personnalisé ?", :as => :boolean, :input_html => {:class => "form-inline input_price_line_forced_price"}
|
||||
-# .forced_price_wrapper.mx-2{:style => ("display:none;" if !form.object.forced_price)}= form.input :ct_u_price_ht, :label => false, :input_html => {:class => "input_price_line_ct_u_price_ht"}
|
||||
.col-3
|
||||
= form.input :qte, :label => "Quantité :", :input_html => {:class => "input_price_line_qte form-control p_product_ref_qte", tabindex: 1}
|
||||
.col-3
|
||||
= form.input :ct_u_price_ht, :label => "Prix Unitaire HT :", :input_html => { class: "mx-2"}
|
||||
|
||||
-# .col-3
|
||||
-# =form.input :ct_tva_account_id, :collection => options_from_collection_for_select(TvaRate.where(:accounting_zone_id => (@p_customer ? @p_customer.accounting_zone_id : nil)).all, "id", "member_label", form.object.tva_account_id), :as => :select ,:label => false, :include_blank => false , :input_html => {:class => "input_price_line_tva_account_id form-control custom-select"}
|
||||
.col-1.text-center.my-auto
|
||||
%span.destroy{style: "font-size: 2rem;"}=link_to_remove_fields ic(:"trash-o"), form
|
||||
= qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||
= form.hidden_field :position, :class => "price_line_position_input"
|
||||
|
||||
|
||||
:javascript
|
||||
$('.p_product_ref_autocomplete_input').focus()
|
||||
$( function() {
|
||||
$('.p_product_ref_autocomplete_input').autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "/admin/p_product_refs/autocomplete.json",
|
||||
dataType: "json",
|
||||
data: {
|
||||
search: request.term,
|
||||
p_customer_id: $(".p_customer_id").val()
|
||||
},
|
||||
success: function(data){
|
||||
arr = jQuery.map( data, function( item ) {
|
||||
return {
|
||||
label: item.member_label,
|
||||
value: item.member_label,
|
||||
id: item.id
|
||||
}
|
||||
});
|
||||
response(arr)
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
$(this).next(".p_product_ref_id").val(ui.item.id)
|
||||
form = $(this).closest(".price_line_form")
|
||||
$.ajax( {
|
||||
url: "/admin/p_product_refs/"+ui.item.id+"/get_infos.json",
|
||||
dataType: "json",
|
||||
data: {
|
||||
type: "price",
|
||||
qte: form.find(".input_price_line_qte").val(),
|
||||
p_customer_id: $(".p_customer_id").val()
|
||||
},
|
||||
success: function (data) {
|
||||
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_value").val(data.tva_account_value);
|
||||
form.find(".input_price_line_weight_u").val(data.weight);
|
||||
}
|
||||
});
|
||||
//return false
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
:scss
|
||||
.price_line_form{
|
||||
.form-group{
|
||||
margin-bottom:0;}
|
||||
|
||||
}
|
||||
|
@ -1,27 +1,35 @@
|
||||
.qi_pannel.qi_plain.padding.price_line_form.col-12.field{:style =>"border-left:4px solid gray;margin-bottom:10px;padding-left:5px;"}
|
||||
- price_line = form.object
|
||||
.row
|
||||
.col-6.row
|
||||
.col-2.d-flex
|
||||
.take.mx-3
|
||||
=ic :arrows
|
||||
%label
|
||||
ref :
|
||||
%input.p_product_ref_autocomplete_input.form-control.col{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
||||
.col-11
|
||||
.row
|
||||
.col-5.row
|
||||
.col-2.d-flex
|
||||
.take.mx-3
|
||||
=ic :arrows
|
||||
%label
|
||||
Référence :
|
||||
%input.p_product_ref_autocomplete_input.form-control.col{:type => "text", :value => ("#{form.object.p_product_ref.ref} #{form.object.p_product_ref.cc_name}" if form.object.p_product_ref)}
|
||||
|
||||
.col-3.ml-2
|
||||
.form-inline
|
||||
= form.input :qte, :label => "qte :", :input_html => { class: "mx-2", autofocus: true, tabindex: 1}
|
||||
.col-2
|
||||
.form-inline
|
||||
= form.input :ct_u_price_ht, :label => "PU :", :input_html => { class: "mx-2"}
|
||||
.col-1.ml-2
|
||||
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
.col-3.ml-2
|
||||
.form-inline
|
||||
= form.input :qte, :label => "Quantité :", :input_html => { class: "mx-2", autofocus: true, tabindex: 1}
|
||||
.col-2
|
||||
.form-inline
|
||||
= form.input :ct_u_price_ht, :label => "Prix unitaire HT :", :input_html => { class: "mx-2"}
|
||||
.row
|
||||
.col-5.row
|
||||
.col-2.d-flex
|
||||
.take.mx-3
|
||||
|
||||
|
||||
|
||||
=qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||
|
||||
= form.hidden_field :position, :class => "price_line_position_input"
|
||||
.form-inline
|
||||
=# form.input :ac_tot_amount_ht, :label => "Prix total HT :", :input_html => { class: "mx-2", disabled: true}
|
||||
%label Montant HT :
|
||||
=price_line.tot_amount_ht
|
||||
.col-1
|
||||
.col-1.ml-2
|
||||
%span.destroy=link_to_remove_fields ic(:"trash-o"), form
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
= qi_js_field(form, :price_line, :tva_account_value, :hidden => true)
|
||||
= form.hidden_field :position, :class => "price_line_position_input"
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
=semantic_form_for [:admin, @price_line], :remote => true do |form|
|
||||
|
||||
.content
|
||||
|
@ -1 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "add_p_articles_form"))%>",700,900);
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "add_p_article_form"))%>",700,900);
|
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "add_price_line_p_article_form"))%>",700,900);
|
4
app/views/qi/_actions.html.haml
Normal file
4
app/views/qi/_actions.html.haml
Normal file
@ -0,0 +1,4 @@
|
||||
%hr
|
||||
=link_to "Annuler", "#", class:"btn btn-default", onclick:"close_pane_hover();return false;"
|
||||
=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
@ -447,6 +447,7 @@ Rails.application.routes.draw do
|
||||
collection do
|
||||
get "stock_resume"
|
||||
get "empty_stock"
|
||||
get :show_p_article
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -697,6 +698,8 @@ Rails.application.routes.draw do
|
||||
|
||||
end
|
||||
collection do
|
||||
get :add_p_article
|
||||
get :add_price_line_p_article
|
||||
|
||||
end
|
||||
end
|
||||
|
13
db/migrate/20211028091122_create_tva_types.rb
Normal file
13
db/migrate/20211028091122_create_tva_types.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class CreateTvaTypes < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :tva_types do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
TvaType.create(name: "Standard")
|
||||
TvaType.create(name: "Sur Marge")
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class AddColumnsToPriceDocsAdnPriceLineBlocks < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_reference :price_documents, :tva_type, index: true
|
||||
add_column :price_documents, :ac_tva_type_name, :string
|
||||
add_column :price_documents, :cc_tva_type_name, :string
|
||||
add_column :price_documents, :supplier_document_date, :date
|
||||
add_column :price_line_blocks, :stock_entrance_date, :date
|
||||
add_column :price_line_blocks, :ct_tot_amount_ht, :decimal, :precision => 14, :scale => 2
|
||||
change_table :price_line_blocks do |t|
|
||||
t.belongs_to :price_document
|
||||
end
|
||||
end
|
||||
end
|
6
db/migrate/20211102094225_add_stockable_to_p_product.rb
Normal file
6
db/migrate/20211102094225_add_stockable_to_p_product.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddStockableToPProduct < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :p_products, :stockable, :boolean
|
||||
add_column :p_products, :with_serial_number, :boolean
|
||||
end
|
||||
end
|
12
db/migrate/20211102105934_create_price_line_p_articles.rb
Normal file
12
db/migrate/20211102105934_create_price_line_p_articles.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreatePriceLinePArticles < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :price_line_p_articles do |t|
|
||||
t.belongs_to :p_article
|
||||
t.belongs_to :price_line
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
#add_reference :price_lines, :price_line_p_article, index: true
|
||||
#add_reference :p_articles, :price_line_p_article, index: true
|
||||
end
|
||||
end
|
10
db/migrate/20211103085623_create_line_stock_p_articles.rb
Normal file
10
db/migrate/20211103085623_create_line_stock_p_articles.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class CreateLineStockPArticles < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :line_stock_p_articles do |t|
|
||||
t.belongs_to :p_article
|
||||
t.belongs_to :line_stock
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20211112130721_add_tva_type_to_p_article.rb
Normal file
5
db/migrate/20211112130721_add_tva_type_to_p_article.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddTvaTypeToPArticle < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_reference :p_articles, :tva_type, index: true
|
||||
end
|
||||
end
|
39
db/schema.rb
39
db/schema.rb
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
ActiveRecord::Schema.define(version: 2021_11_12_130721) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -549,6 +549,15 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "line_stock_p_articles", force: :cascade do |t|
|
||||
t.bigint "p_article_id"
|
||||
t.bigint "line_stock_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["line_stock_id"], name: "index_line_stock_p_articles_on_line_stock_id"
|
||||
t.index ["p_article_id"], name: "index_line_stock_p_articles_on_p_article_id"
|
||||
end
|
||||
|
||||
create_table "line_stock_usages", force: :cascade do |t|
|
||||
t.bigint "line_stock_id"
|
||||
t.decimal "qte", precision: 14, scale: 2
|
||||
@ -990,8 +999,10 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.bigint "p_grade_id"
|
||||
t.bigint "tva_type_id"
|
||||
t.index ["p_grade_id"], name: "index_p_articles_on_p_grade_id"
|
||||
t.index ["p_product_ref_id"], name: "index_p_articles_on_p_product_ref_id"
|
||||
t.index ["tva_type_id"], name: "index_p_articles_on_tva_type_id"
|
||||
end
|
||||
|
||||
create_table "p_bank_accounts", force: :cascade do |t|
|
||||
@ -1930,6 +1941,8 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.boolean "conserve_proportion", default: false
|
||||
t.boolean "frontpage", default: true
|
||||
t.integer "sorecop_cat_id"
|
||||
t.boolean "stockable"
|
||||
t.boolean "with_serial_number"
|
||||
t.index ["p_product_cat_id"], name: "index_p_products_on_p_product_cat_id"
|
||||
t.index ["s_brand_id"], name: "index_p_products_on_s_brand_id"
|
||||
end
|
||||
@ -2304,7 +2317,12 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.integer "demande_de_prix_id"
|
||||
t.integer "avoir_achat_id"
|
||||
t.integer "facture_achat_id"
|
||||
t.bigint "tva_type_id"
|
||||
t.string "ac_tva_type_name"
|
||||
t.string "cc_tva_type_name"
|
||||
t.date "supplier_document_date"
|
||||
t.index ["p_customer_id"], name: "index_price_documents_on_p_customer_id"
|
||||
t.index ["tva_type_id"], name: "index_price_documents_on_tva_type_id"
|
||||
end
|
||||
|
||||
create_table "price_line_blocks", force: :cascade do |t|
|
||||
@ -2453,7 +2471,20 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.boolean "imported", default: false
|
||||
t.date "validation_date"
|
||||
t.string "cc_state"
|
||||
t.date "stock_entrance_date"
|
||||
t.decimal "ct_tot_amount_ht", precision: 14, scale: 2
|
||||
t.bigint "price_document_id"
|
||||
t.index ["p_customer_id"], name: "index_price_line_blocks_on_p_customer_id"
|
||||
t.index ["price_document_id"], name: "index_price_line_blocks_on_price_document_id"
|
||||
end
|
||||
|
||||
create_table "price_line_p_articles", force: :cascade do |t|
|
||||
t.bigint "p_article_id"
|
||||
t.bigint "price_line_id"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["p_article_id"], name: "index_price_line_p_articles_on_p_article_id"
|
||||
t.index ["price_line_id"], name: "index_price_line_p_articles_on_price_line_id"
|
||||
end
|
||||
|
||||
create_table "price_line_resp_selects", force: :cascade do |t|
|
||||
@ -3007,6 +3038,12 @@ ActiveRecord::Schema.define(version: 2021_10_18_142636) do
|
||||
t.index ["accounting_zone_id"], name: "index_tva_rates_on_accounting_zone_id"
|
||||
end
|
||||
|
||||
create_table "tva_types", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
|
||||
create_table "tvable_tva_rates", force: :cascade do |t|
|
||||
t.integer "tvable_id"
|
||||
t.string "tvable_type"
|
||||
|
6
pdf.js
6
pdf.js
@ -8,16 +8,12 @@ const createPdf = async() => {
|
||||
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
|
||||
const page = await browser.newPage();
|
||||
//await page.setViewport({width: 794, height: 1122, deviceScaleFactor: 1});
|
||||
await page._emulationManager._client.send(
|
||||
'Emulation.setDefaultBackgroundColorOverride',
|
||||
{ color: { r: 0, g: 0, b: 0, a: 0 } }
|
||||
);
|
||||
await page.goto(process.argv[2], {timeout: 3000, waitUntil: 'networkidle2'});
|
||||
await page.waitFor(250);
|
||||
await page.pdf({
|
||||
path: process.argv[3],
|
||||
format: 'A4',
|
||||
margin: { top: "0cm", right: "0cm", bottom: "0cm", left: "0cm" },
|
||||
margin: { top: "0.5cm", right: "1cm", bottom: "4.2cm", left: "1cm" },
|
||||
printBackground: false
|
||||
});
|
||||
} catch (err) {
|
||||
|
32
pdf3.js
Normal file
32
pdf3.js
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
const createPdf = async() => {
|
||||
let browser;
|
||||
try {
|
||||
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
|
||||
const page = await browser.newPage();
|
||||
//await page.setViewport({width: 794, height: 1122, deviceScaleFactor: 1});
|
||||
await page._emulationManager._client.send(
|
||||
'Emulation.setDefaultBackgroundColorOverride',
|
||||
{ color: { r: 0, g: 0, b: 0, a: 0 } }
|
||||
);
|
||||
await page.goto(process.argv[2], {timeout: 3000, waitUntil: 'networkidle2'});
|
||||
await page.waitFor(250);
|
||||
await page.pdf({
|
||||
path: process.argv[3],
|
||||
format: 'A4',
|
||||
margin: { top: "0cm", right: "0cm", bottom: "0cm", left: "0cm" },
|
||||
printBackground: false
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
} finally {
|
||||
if (browser) {
|
||||
browser.close();
|
||||
}
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
createPdf();
|
BIN
pdf_stamp/cgv.pdf
Normal file
BIN
pdf_stamp/cgv.pdf
Normal file
Binary file not shown.
Binary file not shown.
11
test/fixtures/line_stock_p_articles.yml
vendored
Normal file
11
test/fixtures/line_stock_p_articles.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
11
test/fixtures/price_line_p_articles.yml
vendored
Normal file
11
test/fixtures/price_line_p_articles.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
11
test/fixtures/tva_types.yml
vendored
Normal file
11
test/fixtures/tva_types.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
7
test/models/line_stock_p_article_test.rb
Normal file
7
test/models/line_stock_p_article_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class LineStockPArticleTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/price_line_p_article_test.rb
Normal file
7
test/models/price_line_p_article_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PriceLinePArticleTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/tva_type_test.rb
Normal file
7
test/models/tva_type_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TvaTypeTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Reference in New Issue
Block a user