fix deposit is net value

This commit is contained in:
viehlieb 2023-09-28 22:42:52 +02:00
parent f29ab603b6
commit 90e06a475f
10 changed files with 75 additions and 34 deletions

View file

@ -13,12 +13,22 @@
/
= number_to_currency(order_article.total_price, :unit => "")
%td
= number_to_currency(order_article.price.gross_price, :unit => "")
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
= number_to_currency(order_article.price.gross_price_without_deposit, :unit => "")
:plain
/
= number_to_currency(order_article.total_gross_price_without_deposit, :unit => "")
-else
= number_to_currency(order_article.price.gross_price, :unit => "")
:plain
/
= number_to_currency(order_article.total_gross_price, :unit => "")
%td= number_to_percentage(order_article.price.tax) unless order_article.price.tax.zero?
%td
= number_to_currency(order_article.price.deposit, :unit => "") unless order_article.price.deposit.zero?
:plain
/
= number_to_currency(order_article.total_gross_price, :unit => "")
%td= number_to_percentage(order_article.price.tax) unless order_article.price.tax.zero?
%td= number_to_currency(order_article.price.deposit, :unit => "") unless order_article.price.deposit.zero?
= number_to_currency(order_article.total_deposit_price, :unit => "") unless order_article.price.deposit.zero?
%td
= link_to t('ui.edit'), edit_order_order_article_path(order_article.order, order_article), remote: true,
class: 'btn btn-mini' unless order_article.order.closed?

View file

@ -6,22 +6,29 @@
%tr
%td= t('.net_amount')
%td.numeric= number_to_currency(order.sum(:net))
%tr
%td= t('.gross_amount')
%td.numeric= number_to_currency(order.sum(:gross))
%tr
%td= t('.fc_amount')
%td.numeric= number_to_currency(order.sum(:fc))
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
%tr
%td= t('.gross_amount')
%td.numeric= number_to_currency(order.sum(:gross_without_deposit))
%tr
%td= t('.fc_amount')
%td.numeric= number_to_currency(order.sum(:fc_without_deposit))
%tr
%td= t('.deposit')
%td.numeric= number_to_currency(order.sum(:deposit))
%tr
%td= t('.gross_deposit')
%td.numeric= number_to_currency(order.sum(:gross_deposit))
%td= t('.net_deposit')
%td.numeric= number_to_currency(order.sum(:net_deposit))
%tr
%td= t('.fc_deposit')
%td.numeric= number_to_currency(order.sum(:fc_deposit))
- else
%tr
%td= t('.gross_amount')
%td.numeric= number_to_currency(order.sum(:gross))
%tr
%td= t('.fc_amount')
%td.numeric= number_to_currency(order.sum(:fc))
%tr
%td= t('.groups_amount')
%td.numeric= number_to_currency(order.sum(:groups))

View file

@ -6,6 +6,8 @@
%th= t '.prices'
- if order.stockit?
%th= t '.units_ordered'
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
%th= t '.deposit'
- else
%th= 'Members'
%th= t '.units_full'
@ -19,7 +21,10 @@
%td{:colspan => "9"}
- order_articles.each do |order_article|
- net_price = order_article.price.price
- gross_price = order_article.price.gross_price
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
- gross_price = order_article.price.gross_price_without_deposit
- else
- gross_price = order_article.price.gross_price
- unit_quantity = order_article.price.unit_quantity
- units = order_article.units
- total_net += units * unit_quantity * net_price
@ -28,6 +33,8 @@
%td.name=h order_article.article.name
%td= order_article.article.unit
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
%td= "#{number_to_currency(order_article.price.deposit)}"
- if order.stockit?
%td= units
- else

View file

@ -32,8 +32,8 @@
= raw t '.description2',
ordergroups: ordergroup_count(@order),
article_count: @order.order_articles.ordered.count,
net_sum: number_to_currency(@order.sum(:net)),
gross_sum: number_to_currency(@order.sum(:gross))
net_sum: number_to_currency(@order.sum(:net) + @order.sum(:net_deposit)),
gross_sum: number_to_currency(@order.sum(:fc))
- unless @order.comments.blank?
= link_to t('.comments_link'), '#comments'