wip move automatic invoices to plugin
This commit is contained in:
parent
78bf494182
commit
4523d0b26e
35 changed files with 628 additions and 2045 deletions
|
|
@ -0,0 +1,53 @@
|
|||
%table.table.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper Article, :name
|
||||
%th= heading_helper Article, :unit
|
||||
%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'
|
||||
- total_net, total_gross, counter = 0, 0, 0
|
||||
%tbody.list
|
||||
- order.articles_grouped_by_category.each do |category_name, order_articles|
|
||||
%tr.list-heading.article-category
|
||||
%td
|
||||
= category_name
|
||||
%i.icon-tag
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- net_price = order_article.price.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
|
||||
- total_gross += units * unit_quantity * gross_price
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + order_article_class(order_article)}
|
||||
%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
|
||||
- if unit_quantity > 1 or order_article.tolerance > 0
|
||||
%td= "#{order_article.quantity} + #{order_article.tolerance}"
|
||||
- else
|
||||
%td= "#{order_article.quantity}"
|
||||
%td{title: units_history_line(order_article, plain: true)}
|
||||
= units
|
||||
= pkg_helper order_article.price
|
||||
%p
|
||||
= t '.prices_sum'
|
||||
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
|
||||
%p
|
||||
= t '.article_count'
|
||||
= order.order_articles.ordered.count
|
||||
97
plugins/automatic_invoices/app/views/orders/show.html.haml
Normal file
97
plugins/automatic_invoices/app/views/orders/show.html.haml
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
- title t('.title', name: @order.name)
|
||||
|
||||
- if current_user.role_finance? || current_user.role_invoices?
|
||||
- content_for :actionbar do
|
||||
- if @order.invoice.present?
|
||||
= link_to t('.show_invoice'), finance_invoice_path(@order.invoice), class: 'btn'
|
||||
- elsif !@order.open?
|
||||
= link_to t('.create_invoice'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
|
||||
class: 'btn'
|
||||
|
||||
.well
|
||||
= close_button :alert
|
||||
%p
|
||||
- description1 = raw t '.description1_order',
|
||||
state: t("orders.state.#{@order.state}").capitalize,
|
||||
supplier: supplier_link(@order),
|
||||
who: show_user_link(@order.created_by)
|
||||
- description1 += ' '
|
||||
- if @order.ends
|
||||
- description1 += raw t '.description1_period.starts_ends',
|
||||
starts: format_time(@order.starts),
|
||||
ends: format_time(@order.ends)
|
||||
- else
|
||||
- description1 += raw t '.description1_period.starts',
|
||||
starts: format_time(@order.starts)
|
||||
- if @order.pickup
|
||||
- description1 += ' '
|
||||
- description1 += raw t '.description1_period.pickup',
|
||||
pickup: format_date(@order.pickup)
|
||||
= description1 + '.'
|
||||
%br
|
||||
= raw t '.description2',
|
||||
ordergroups: ordergroup_count(@order),
|
||||
article_count: @order.order_articles.ordered.count,
|
||||
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'
|
||||
|
||||
- if @note.present?
|
||||
%p
|
||||
= heading_helper(Order, :note) + ': '
|
||||
= @order.note
|
||||
|
||||
-# Proposing to remove this warning, since there is a valid period when the order is not settled yet.
|
||||
-# Perhaps when the pickup day has been, or when the order isn't settled a week after it has been
|
||||
-# closed, this message could be shown.
|
||||
-#- if @order.finished? and !@order.closed?
|
||||
.alert.alert-warning
|
||||
= t '.warn_not_closed'
|
||||
|
||||
.well.well-small
|
||||
.btn-toolbar
|
||||
.form-search.pull-right
|
||||
.input-append
|
||||
= text_field_tag :query, params[:query], class: 'search-query delayed-search resettable'
|
||||
%button.add-on.btn.reset-search{:type => :button, :title => t('.search_reset')}
|
||||
%i.icon.icon-remove
|
||||
|
||||
.btn-toolbar
|
||||
.btn-group.view_buttons
|
||||
= update_articles_link @order, t('.articles'), :default, class: 'btn'
|
||||
= update_articles_link @order, t('.sort_group'), :groups, class: 'btn'
|
||||
= update_articles_link @order, t('.sort_article'), :articles, class: 'btn'
|
||||
|
||||
- unless @order.open?
|
||||
= render 'shared/order_download_button', order: @order, klass: ''
|
||||
- if @order.open?
|
||||
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
|
||||
data: {confirm: t('.confirm_end', order: @order.name)}
|
||||
- if @order.supplier
|
||||
- if @order.stock_group_order
|
||||
= link_to t('.stock_order'), edit_group_order_path(@order.stock_group_order, order_id: @order.id), class: 'btn'
|
||||
- else
|
||||
= link_to t('.stock_order'), new_group_order_path(order_id: @order.id, stock_order: true), class: 'btn'
|
||||
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
|
||||
- elsif not @order.closed? and not @order.stockit?
|
||||
= link_to t('.send_to_supplier'), send_result_to_supplier_order_path(@order), method: :post,
|
||||
class: "btn#{' btn-primary' unless @order.last_sent_mail}",
|
||||
data: {confirm: @order.last_sent_mail && t('.confirm_send_to_supplier', when: format_time(@order.last_sent_mail)) }
|
||||
= receive_button @order
|
||||
- unless @order.closed?
|
||||
= link_to t('ui.delete'), @order, data: {confirm: t('.confirm_delete')}, method: :delete,
|
||||
class: 'btn btn-danger'
|
||||
|
||||
%section#articles_table
|
||||
= render @partial, order: @order
|
||||
|
||||
%h2= t '.comments.title'
|
||||
#comments
|
||||
= render partial: 'shared/comments', locals: { comments: @order.comments }
|
||||
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
||||
= link_to_top
|
||||
|
||||
= render 'show_js'
|
||||
= render 'shared/articles_by/common', order: @order
|
||||
Loading…
Add table
Add a link
Reference in a new issue