wip move automatic invoices to plugin
This commit is contained in:
parent
42a1773a87
commit
78bf494182
33 changed files with 7197 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
if FoodsoftAutomaticInvoices.enabled?
|
||||
|
||||
PriceCalculation.class_eval do
|
||||
# deposit is always gross
|
||||
def gross_price
|
||||
add_percent(price, tax) + deposit
|
||||
end
|
||||
|
||||
def gross_price_without_deposit
|
||||
add_percent(price, tax)
|
||||
end
|
||||
|
||||
def net_deposit_price
|
||||
remove_percent(deposit, tax)
|
||||
end
|
||||
|
||||
def fc_price_without_deposit
|
||||
add_percent(gross_price_without_deposit, FoodsoftConfig[:price_markup].to_i)
|
||||
end
|
||||
|
||||
def fc_deposit_price
|
||||
add_percent(deposit, FoodsoftConfig[:price_markup].to_i)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove_percent(value, percent)
|
||||
(value / ((percent * 0.01) + 1)).round(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue