suite
This commit is contained in:
parent
4a3a65e4bf
commit
5230857960
@ -24,7 +24,7 @@ class Admin::PDocumentsController < ApplicationController
|
|||||||
@p_document = PDocument.find_by_token(params[:id])
|
@p_document = PDocument.find_by_token(params[:id])
|
||||||
@element = @p_document.element
|
@element = @p_document.element
|
||||||
params[:inline] = true
|
params[:inline] = true
|
||||||
if false
|
if true
|
||||||
|
|
||||||
@temp_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}_temp.pdf"
|
@temp_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}_temp.pdf"
|
||||||
@final_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}.pdf"
|
@final_file = "#{Rails.root}/pdf/p_documents/#{@p_document.d_number}.pdf"
|
||||||
|
@ -266,6 +266,7 @@ class PCustomerSheet < ActiveRecord::Base
|
|||||||
if self.p_documents.create(:p_document_type => PDocumentType.find_by_label("Bon de commande"))
|
if self.p_documents.create(:p_document_type => PDocumentType.find_by_label("Bon de commande"))
|
||||||
self.state = "commande"
|
self.state = "commande"
|
||||||
self.save
|
self.save
|
||||||
|
self.unstock_th
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -287,6 +288,8 @@ class PCustomerSheet < ActiveRecord::Base
|
|||||||
|
|
||||||
self.fige
|
self.fige
|
||||||
|
|
||||||
|
self.unstock
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -315,6 +318,32 @@ class PCustomerSheet < ActiveRecord::Base
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def unstock_th
|
||||||
|
self.p_sheet_lines.each do |sheet_line|
|
||||||
|
p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
|
||||||
|
p_sheet_line_lines.each do |p_sheet_line_line|
|
||||||
|
if p_sheet_line_line.p_product_stock
|
||||||
|
p_sheet_line_line.p_product_stock.stock_th_ok = p_sheet_line_line.p_product_stock.stock_th_ok - p_sheet_line_line.qte
|
||||||
|
p_sheet_line_line.p_product_stock.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def unstock
|
||||||
|
self.p_sheet_lines.each do |sheet_line|
|
||||||
|
p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
|
||||||
|
p_sheet_line_lines.each do |p_sheet_line_line|
|
||||||
|
if p_sheet_line_line.p_product_stock
|
||||||
|
p_sheet_line_line.p_product_stock.stock_ok = p_sheet_line_line.p_product_stock.stock_ok - p_sheet_line_line.qte
|
||||||
|
p_sheet_line_line.p_product_stock.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
STATES = ["panier", "brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"]
|
STATES = ["panier", "brouillon", "offre", "commande", "livrée","facturée", "annulée", "refusée"]
|
||||||
|
|
||||||
|
@ -13,12 +13,13 @@
|
|||||||
|
|
||||||
%th
|
%th
|
||||||
Qte
|
Qte
|
||||||
%th
|
-if @p_document and @p_document.label != "Bon de livraison"
|
||||||
Prix U.
|
%th
|
||||||
%th
|
Prix U.
|
||||||
Prix Tot.
|
%th
|
||||||
%th
|
Prix Tot.
|
||||||
Prix TTC
|
%th
|
||||||
|
Prix TTC
|
||||||
|
|
||||||
|
|
||||||
-sheet_lines.each do |sheet_line|
|
-sheet_lines.each do |sheet_line|
|
||||||
@ -65,13 +66,14 @@
|
|||||||
|
|
||||||
%td{}
|
%td{}
|
||||||
=qte_tot.to_i
|
=qte_tot.to_i
|
||||||
%td
|
-if @p_document and @p_document.label != "Bon de livraison"
|
||||||
=number_to_currency sheet_line.price.to_f
|
%td
|
||||||
%td
|
=number_to_currency sheet_line.price.to_f
|
||||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
%td
|
||||||
|
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||||
|
|
||||||
%tr.tr_sheet_line_head
|
%tr.tr_sheet_line_head
|
||||||
|
|
||||||
@ -86,45 +88,47 @@
|
|||||||
%td
|
%td
|
||||||
=sheet_line.qte
|
=sheet_line.qte
|
||||||
|
|
||||||
%td
|
-if @p_document and @p_document.label != "Bon de livraison"
|
||||||
=number_to_currency sheet_line.price if sheet_line.price
|
%td
|
||||||
|
=number_to_currency sheet_line.price if sheet_line.price
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
||||||
|
|
||||||
%td
|
%td
|
||||||
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
||||||
|
|
||||||
|
|
||||||
-total_with_labels = PSheetLine.total_with_labels(sheet_lines)
|
-total_with_labels = PSheetLine.total_with_labels(sheet_lines)
|
||||||
|
|
||||||
-total_with_labels.each do |index, total|
|
-if @p_document and @p_document.label != "Bon de livraison"
|
||||||
|
-total_with_labels.each do |index, total|
|
||||||
|
|
||||||
|
|
||||||
%tr.sheet_line_head
|
%tr.sheet_line_head
|
||||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
%strong
|
%strong
|
||||||
=total[:label]
|
=total[:label]
|
||||||
%td
|
%td
|
||||||
=number_to_currency total[:value]
|
=number_to_currency total[:value]
|
||||||
|
|
||||||
-if @p_document and @p_document.label == "Facture Acompte"
|
-if @p_document and @p_document.label == "Facture Acompte"
|
||||||
%tr
|
%tr
|
||||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
Pourcentage d'acompte :
|
Pourcentage d'acompte :
|
||||||
%td
|
%td
|
||||||
=@p_document.acompte_percent.to_s+"%"
|
=@p_document.acompte_percent.to_s+"%"
|
||||||
%tr
|
%tr
|
||||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
Acompte HT :
|
Acompte HT :
|
||||||
%td
|
%td
|
||||||
=number_to_currency @p_document.total_with_labels_table[:total][:value] * (@p_document.acompte_percent.to_f/100)
|
=number_to_currency @p_document.total_with_labels_table[:total][:value] * (@p_document.acompte_percent.to_f/100)
|
||||||
|
|
||||||
%tr.sheet_line_head
|
%tr.sheet_line_head
|
||||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
%td{:style => "text-align:right;padding-right:10px;", :colspan =>6}
|
||||||
%strong Acompte TTC :
|
%strong Acompte TTC :
|
||||||
%td
|
%td
|
||||||
%strong=number_to_currency @p_document.total_with_labels_table[:total_ttc][:value] * (@p_document.acompte_percent.to_f/100)
|
%strong=number_to_currency @p_document.total_with_labels_table[:total_ttc][:value] * (@p_document.acompte_percent.to_f/100)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
%body
|
%body
|
||||||
#header
|
#header
|
||||||
.right
|
.right{:style => "text-align:right;"}
|
||||||
-if current_p_customer
|
-if current_p_customer
|
||||||
=link_to ic(:user)+" Mon compte", public_my_account_path
|
=link_to ic(:user)+" Mon compte", public_my_account_path
|
||||||
="-"
|
="-"
|
||||||
@ -42,7 +42,7 @@
|
|||||||
="-"
|
="-"
|
||||||
=link_to ic(:"power-off")+" Déconnexion", logout_public_p_customer_auths_path()
|
=link_to ic(:"power-off")+" Déconnexion", logout_public_p_customer_auths_path()
|
||||||
%br
|
%br
|
||||||
=link_to "Mes commandes", public_p_customer_sheets_path()
|
=link_to "Mes commandes / factures", public_p_customer_sheets_path()
|
||||||
="-"
|
="-"
|
||||||
|
|
||||||
=link_to ic(:"shopping-cart")+" commande en cours ("+current_p_customer_sheet.qte.to_i.to_s+" articles)", cart_public_p_orders_path()
|
=link_to ic(:"shopping-cart")+" commande en cours ("+current_p_customer_sheet.qte.to_i.to_s+" articles)", cart_public_p_orders_path()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user