wip move automatic invoices to plugin
This commit is contained in:
parent
78bf494182
commit
4523d0b26e
35 changed files with 628 additions and 2045 deletions
|
@ -1,4 +1,4 @@
|
|||
FROM ruby:2.7
|
||||
FROM ruby:2.7.8
|
||||
|
||||
# Install dependencies
|
||||
RUN deps='libmagic-dev chromium nodejs' && \
|
||||
|
@ -19,6 +19,7 @@ ENV PORT=3000 \
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
RUN gem update --system
|
||||
RUN gem install bundler
|
||||
RUN bundle config build.nokogiri "--use-system-libraries"
|
||||
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -71,6 +71,7 @@ gem 'foodsoft_links', path: 'plugins/links'
|
|||
gem 'foodsoft_messages', path: 'plugins/messages'
|
||||
gem 'foodsoft_polls', path: 'plugins/polls'
|
||||
gem 'foodsoft_wiki', path: 'plugins/wiki'
|
||||
gem 'foodsoft_automatic_invoices', path: 'plugins/automatic_invoices'
|
||||
|
||||
# plugins not enabled by default
|
||||
# gem 'foodsoft_current_orders', path: 'plugins/current_orders'
|
||||
|
|
|
@ -16,6 +16,13 @@ GIT
|
|||
acts_as_versioned (0.6.0)
|
||||
activerecord (>= 3.0.9)
|
||||
|
||||
PATH
|
||||
remote: plugins/automatic_invoices
|
||||
specs:
|
||||
foodsoft_automatic_invoices (0.0.1)
|
||||
deface (~> 1.9)
|
||||
rails
|
||||
|
||||
PATH
|
||||
remote: plugins/discourse
|
||||
specs:
|
||||
|
@ -630,6 +637,7 @@ DEPENDENCIES
|
|||
exception_notification
|
||||
factory_bot_rails
|
||||
faker
|
||||
foodsoft_automatic_invoices!
|
||||
foodsoft_discourse!
|
||||
foodsoft_documents!
|
||||
foodsoft_links!
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
%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?
|
||||
%td
|
||||
%td.end
|
||||
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
|
||||
remote: true, data: {confirm: t('.confirm')}, class: 'btn btn-danger btn-mini' unless order_article.order.closed?
|
||||
|
|
2
app/views/finance/balancing/_results.html.haml
Normal file
2
app/views/finance/balancing/_results.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%section#results
|
||||
= render 'edit_results_by_articles'
|
|
@ -6,11 +6,11 @@
|
|||
%tr
|
||||
%td= t('.net_amount')
|
||||
%td.numeric= number_to_currency(order.sum(:net))
|
||||
%tr
|
||||
%tr.gross-amount
|
||||
%td= t('.gross_amount')
|
||||
%td.numeric= number_to_currency(order.sum(:gross))
|
||||
%tr
|
||||
%td= t('.fc_amount')
|
||||
%td= t('.fc_amount_total')
|
||||
%td.numeric= number_to_currency(order.sum(:fc))
|
||||
%tr
|
||||
%td= t('.groups_amount')
|
||||
|
|
|
@ -76,6 +76,6 @@
|
|||
%li= link_to t('.articles_overview'), new_finance_order_path(order_id: @order.id, view: 'articles_overview'),
|
||||
remote: true
|
||||
|
||||
%section#results
|
||||
= render 'edit_results_by_articles'
|
||||
= render "results"
|
||||
|
||||
%p= link_to_top
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
= render 'form'
|
||||
#group-order-form
|
||||
= render 'form'
|
|
@ -1 +1,2 @@
|
|||
= render 'form'
|
||||
#group-order-form
|
||||
= render 'form'
|
||||
|
|
|
@ -11,7 +11,6 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-dev
|
||||
platform: linux/x86_64
|
||||
command: ./proc-start worker
|
||||
volumes:
|
||||
- bundle:/usr/local/bundle
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
module Concerns::SendGroupOrderInvoicePdf
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
protected
|
||||
|
||||
def create_invoice_pdf(group_order_invoice)
|
||||
invoice_data = group_order_invoice.load_data_for_invoice
|
||||
invoice_data[:title] = t('documents.group_order_invoice_pdf.title', supplier: invoice_data[:supplier])
|
||||
invoice_data[:no_footer] = true
|
||||
GroupOrderInvoicePdf.new invoice_data
|
||||
end
|
||||
|
||||
def send_group_order_invoice_pdf(group_order_invoice)
|
||||
pdf = create_invoice_pdf(group_order_invoice)
|
||||
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,3 @@
|
|||
/ insert_after 'erb:contains(":contact_person")'
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
= f.input :customer_number
|
|
@ -1,3 +1,4 @@
|
|||
/ insert_after 'erb:contains(":updated_by")'
|
||||
%th= heading_helper GroupOrderInvoice, :name
|
||||
%th
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
%th= heading_helper GroupOrderInvoice, :name
|
||||
%th
|
|
@ -1,9 +1,10 @@
|
|||
/ insert_after 'erb:contains("show_user(order.updated_by)")'
|
||||
%td
|
||||
- if order.closed?
|
||||
-if FoodsoftConfig[:contact][:tax_number] && order.ordergroups.present?
|
||||
= render :partial => 'group_order_invoices/links', locals:{order: order}
|
||||
-else
|
||||
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
||||
- else
|
||||
= t('orders.index.not_closed')
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
%td
|
||||
- if order.closed?
|
||||
-if FoodsoftConfig[:contact][:tax_number] && order.ordergroups.present?
|
||||
= render :partial => 'group_order_invoices/links', locals:{order: order}
|
||||
-else
|
||||
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
||||
- else
|
||||
= t('orders.index.not_closed')
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/ replace_contents "section#results"
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
= render :partial => 'finance/balancing/edit_results_by_articles_override'
|
|
@ -0,0 +1,3 @@
|
|||
/ replace_contents "#group-order-form"
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
= render "form_override"
|
|
@ -0,0 +1,3 @@
|
|||
/ replace_contents "#group-order-form"
|
||||
- if FoodsoftAutomaticInvoices.enabled?
|
||||
= render "form_override"
|
|
@ -7,5 +7,9 @@ if FoodsoftAutomaticInvoices.enabled?
|
|||
def total_deposit_price
|
||||
units * price.unit_quantity * price.deposit
|
||||
end
|
||||
|
||||
def total_price_without_deposit
|
||||
units * price.unit_quantity * price.fc_price_without_deposit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
- content_for :javascript do
|
||||
:javascript
|
||||
$(function() {
|
||||
// create List for search-feature (using list.js, http://listjs.com)
|
||||
var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}];
|
||||
var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}];
|
||||
new List(document.body, {
|
||||
valueNames: ['name'],
|
||||
engine: 'unlist',
|
||||
plugins: [listjsResetPlugin, listjsDelayPlugin],
|
||||
// make large pages work too (as we don't have paging - articles may disappear!)
|
||||
page: 10000,
|
||||
indexAsync: true
|
||||
});
|
||||
$('input').keydown(function(event){
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
%table.ordered-articles.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
.input-append
|
||||
= text_field_tag :article, params[:article], placeholder: (heading_helper Article, :name), class: 'delayed-search resettable search-query'
|
||||
%th= heading_helper Article, :order_number
|
||||
%th= t('.amount')
|
||||
%th= heading_helper Article, :unit
|
||||
%th= t('.net')
|
||||
%th= t('.gross')
|
||||
%th= t('.fc')
|
||||
%th= heading_helper Article, :deposit
|
||||
%th= heading_helper Article, :tax
|
||||
%th{:colspan => "2"}
|
||||
- unless @order.closed?
|
||||
.btn-group
|
||||
= link_to t('.add_article'), new_order_order_article_path(@order), remote: true,
|
||||
class: 'btn btn-small'
|
||||
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn btn-small dropdown-toggle' do
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to t('.add_article'), new_order_order_article_path(@order), remote: true
|
||||
%li= link_to t('.edit_transport'), edit_transport_finance_order_path(@order), remote: true
|
||||
%tbody.list#result_table
|
||||
- for order_article in @articles.select { |oa| oa.units > 0 }
|
||||
= render :partial => "order_article_result_override", :locals => {:order_article => order_article}
|
||||
|
||||
%tr
|
||||
%td{ colspan: 10 } The following were not ordered
|
||||
|
||||
- for order_article in @articles.select { |oa| oa.units == 0 }
|
||||
= render :partial => "order_article_result_override", :locals => {:order_article => order_article}
|
||||
|
||||
- if @order.transport
|
||||
%tr
|
||||
%td{ colspan: 5 }= heading_helper Order, :transport
|
||||
%td{ colspan: 3, data: {value: @order.transport} }= number_to_currency(@order.transport)
|
||||
%td= link_to t('ui.edit'), edit_transport_finance_order_path(@order), remote: true,
|
||||
class: 'btn btn-mini' unless order_article.order.closed?
|
|
@ -0,0 +1,42 @@
|
|||
%td.closed.name
|
||||
= link_to order_article.article.name, '#', 'data-toggle-this' => "#group_order_articles_#{order_article.id}"
|
||||
%td= order_article.article.order_number
|
||||
%td{title: units_history_line(order_article, :plain => true)}
|
||||
= order_article.units
|
||||
= pkg_helper order_article.article_price
|
||||
- if s=order_article.ordered_quantities_different_from_group_orders?
|
||||
%span{:style => "color:red;font-weight: bold"}= s
|
||||
%td #{order_article.article.unit}
|
||||
%td
|
||||
= number_to_currency(order_article.price.price, :unit => "")
|
||||
:plain
|
||||
/
|
||||
= number_to_currency(order_article.total_price, :unit => "")
|
||||
%td
|
||||
- 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_currency(order_article.price.fc_price_without_deposit, :unit => "")
|
||||
:plain
|
||||
/
|
||||
= number_to_currency(order_article.total_price_without_deposit, :unit => "")
|
||||
%td
|
||||
= number_to_currency(order_article.price.deposit, :unit => "") unless order_article.price.deposit.zero?
|
||||
:plain
|
||||
/
|
||||
= number_to_currency(order_article.total_deposit_price, :unit => "") unless order_article.price.deposit.zero?
|
||||
%td= number_to_percentage(order_article.price.tax) unless order_article.price.tax.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?
|
||||
%td
|
||||
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
|
||||
remote: true, data: {confirm: t('.confirm')}, class: 'btn btn-danger btn-mini' unless order_article.order.closed?
|
|
@ -0,0 +1,5 @@
|
|||
%tr[order_article]
|
||||
= render :partial => 'finance/balancing/order_article_override', :locals => {:order_article => order_article}
|
||||
|
||||
%tr{:id => "group_order_articles_#{order_article.id}", :class => "results", :style => "display:none"}
|
||||
= render :partial => 'finance/balancing/group_order_articles', :locals => {:order_article => order_article}
|
|
@ -0,0 +1,29 @@
|
|||
.row
|
||||
.column.small-12
|
||||
- show_generate_with_date = true
|
||||
- order.group_orders.each do |go|
|
||||
- if go.group_order_invoice.present?
|
||||
- show_generate_with_date = false
|
||||
- if show_generate_with_date
|
||||
= form_for :group_order_invoice, url: url_for('group_order_invoice#create_multiple'), remote: true do |f|
|
||||
= f.label :invoice_date, I18n.t('activerecord.attributes.group_order_invoice.links.invoice_date')
|
||||
= f.date_field :invoice_date, {value: Date.today, max: Date.today, required: true}
|
||||
= f.hidden_field :order_id, value: order.id
|
||||
= f.submit I18n.t('activerecord.attributes.group_order_invoice.links.generate_with_date'), class: 'btn btn small'
|
||||
|
||||
- order.group_orders.includes([:group_order_invoice, :ordergroup]).each do |go|
|
||||
.row
|
||||
.column.small-3
|
||||
= label_tag go.ordergroup.name
|
||||
- if go.group_order_invoice
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download'), group_order_invoice_path(go.group_order_invoice, :format => 'pdf'), class: 'btn btn-small'
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.delete'), go.group_order_invoice, method: :delete, class: 'btn btn-danger btn-small', remote: true
|
||||
- else
|
||||
= button_to I18n.t('activerecord.attributes.group_order_invoice.links.generate'), group_order_invoices_path(:method => :post, group_order: go) ,class: 'btn btn-small', params: {id: order.id}, remote: true
|
||||
- if order.group_orders.map(&:group_order_invoice).compact.present?
|
||||
%br/
|
||||
.row
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download_all_zip'), download_all_group_order_invoices_path(order), class: 'btn btn-small'
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= params[:id] %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
|
@ -0,0 +1,180 @@
|
|||
- content_for :javascript do
|
||||
- group_balance = FoodsoftConfig[:charge_members_manually] ? @ordering_data[:account_balance] : @ordering_data[:available_funds]
|
||||
:javascript
|
||||
$(function() {
|
||||
#{data_to_js(@ordering_data)}
|
||||
setGroupBalance(#{group_balance});
|
||||
setMinimumBalance(#{FoodsoftConfig[:minimum_balance] or 0});
|
||||
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
||||
setStockit(#{@order.stockit?});
|
||||
// create List for search-feature (using list.js, http://listjs.com)
|
||||
var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}];
|
||||
var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}];
|
||||
new List(document.body, {
|
||||
valueNames: ['name'],
|
||||
engine: 'unlist',
|
||||
plugins: [listjsResetPlugin, listjsDelayPlugin],
|
||||
// make large pages work too (as we don't have paging - articles may disappear!)
|
||||
page: 10000,
|
||||
indexAsync: true
|
||||
});
|
||||
});
|
||||
|
||||
- title t('.title'), false
|
||||
|
||||
.row-fluid
|
||||
.well.pull-left
|
||||
= close_button :alert
|
||||
%h2= @order.name
|
||||
%dl.dl-horizontal
|
||||
- unless @order.note.blank?
|
||||
%dt= heading_helper Order, :note
|
||||
%dd= @order.note
|
||||
%dt= heading_helper Order, :created_by
|
||||
%dd= show_user_link(@order.created_by)
|
||||
%dt= heading_helper Order, :ends
|
||||
%dd= format_time(@order.ends)
|
||||
%dt= heading_helper Order, :pickup
|
||||
%dd= format_date(@order.pickup)
|
||||
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
||||
%dt= heading_helper Supplier, :min_order_quantity, short: true
|
||||
%dd= @order.supplier.min_order_quantity
|
||||
%dt= t '.sum_amount'
|
||||
%dd= number_to_currency @order.sum
|
||||
- unless @group_order.new_record?
|
||||
%dt= heading_helper GroupOrder, :updated_by
|
||||
%dd
|
||||
= show_user(@group_order.updated_by)
|
||||
(#{format_time(@group_order.updated_on)})
|
||||
%dt= heading_helper Ordergroup, :account_balance
|
||||
%dd= number_to_currency(@ordering_data[:account_balance])
|
||||
- unless FoodsoftConfig[:charge_members_manually]
|
||||
%dt= heading_helper Ordergroup, :available_funds
|
||||
%dd= number_to_currency(@ordering_data[:available_funds])
|
||||
|
||||
.well.pull-right
|
||||
= close_button :alert
|
||||
= render 'switch_order', current_order: @order
|
||||
|
||||
.row-fluid
|
||||
.well.clear
|
||||
.form-search
|
||||
.input-append
|
||||
= text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable'
|
||||
%button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')}
|
||||
%i.icon.icon-remove
|
||||
|
||||
= form_for @group_order do |f|
|
||||
= f.hidden_field :lock_version
|
||||
= f.hidden_field :order_id
|
||||
= f.hidden_field :updated_by_user_id
|
||||
= f.hidden_field :ordergroup_id
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper Article, :name
|
||||
- if @order.stockit?
|
||||
%th{style: 'width:120px'}= heading_helper StockArticle, :supplier
|
||||
%th{style: "width:13px;"}
|
||||
%th{style: "width:4.5em;"}= t '.price'
|
||||
%th{style: "width:4.5em;"}= heading_helper Article, :unit
|
||||
- unless @order.stockit?
|
||||
%th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true
|
||||
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
||||
%th#col_tolerance= heading_helper GroupOrderArticle, :tolerance
|
||||
- else
|
||||
%th(style="width:20px")= heading_helper StockArticle, :available
|
||||
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
||||
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
|
||||
%tbody.list
|
||||
- @order.articles_grouped_by_category.each do |category, order_articles|
|
||||
%tr.list-heading.article-category
|
||||
%td
|
||||
= category
|
||||
%i.icon-tag
|
||||
%td{colspan: "9"}
|
||||
- order_articles.each do |order_article|
|
||||
%tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article #{get_missing_units_css_class(@ordering_data[:order_articles][order_article.id][:missing_units])}", valign: "top", tabindex: "0"}
|
||||
%td.name= order_article.article.name
|
||||
- if @order.stockit?
|
||||
%td= truncate order_article.article.supplier.name, length: 15
|
||||
%td= h order_article.article.origin
|
||||
%td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price])
|
||||
%td= order_article.article.unit
|
||||
%td
|
||||
- if @order.stockit?
|
||||
= @ordering_data[:order_articles][order_article.id][:quantity_available]
|
||||
- else
|
||||
%span{id: "missing_units_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:missing_units]
|
||||
|
||||
%td.quantity
|
||||
%input{id: "q_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:quantity], 'data-min' => (@ordering_data[:order_articles][order_article.id][:quantity] if @order.boxfill?), 'data-max' => (@ordering_data[:order_articles][order_article.id][:quantity]+@ordering_data[:order_articles][order_article.id][:missing_units] if @order.boxfill?)}/
|
||||
%span.used{id: "q_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_quantity]
|
||||
+
|
||||
%span.unused{id: "q_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] - @ordering_data[:order_articles][order_article.id][:used_quantity]
|
||||
.btn-group
|
||||
%a.btn.btn-ordering{'data-increase_quantity' => order_article.id}
|
||||
%i.icon-plus
|
||||
%a.btn.btn-ordering{'data-decrease_quantity' => order_article.id}
|
||||
%i.icon-minus
|
||||
|
||||
%td.tolerance{style: ('display:none' if @order.stockit?)}
|
||||
%input{id: "t_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance], 'data-min' => (@ordering_data[:order_articles][order_article.id][:tolerance] if @order.boxfill?)}/
|
||||
- if (@ordering_data[:order_articles][order_article.id][:unit] > 1)
|
||||
%span.used{id: "t_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_tolerance]
|
||||
+
|
||||
%span.unused{id: "t_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] - @ordering_data[:order_articles][order_article.id][:used_tolerance]
|
||||
.btn-group
|
||||
%a.btn.btn-ordering{'data-increase_tolerance' => order_article.id}
|
||||
%i.icon-plus
|
||||
%a.btn.btn-ordering{'data-decrease_tolerance' => order_article.id}
|
||||
%i.icon-minus
|
||||
|
||||
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
|
||||
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])
|
||||
.article-info
|
||||
.article-name= order_article.article.name
|
||||
.pull-right
|
||||
= t('.units_full') + ':'
|
||||
%span{id: "units_#{order_article.id}"}= order_article.units_to_order
|
||||
%br/
|
||||
= t('.units_total') + ':'
|
||||
%span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity]
|
||||
%br/
|
||||
= t('.total_tolerance') + ':'
|
||||
%span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance]
|
||||
%br/
|
||||
.pull-left
|
||||
#{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer}
|
||||
%br/
|
||||
#{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
|
||||
%br/
|
||||
#{heading_helper Article, :note}: #{order_article.article.note}
|
||||
%br/
|
||||
#order-footer
|
||||
#info-box
|
||||
#total-sum
|
||||
%table
|
||||
%tr
|
||||
%td= t('.total_sum_amount') + ':'
|
||||
%td.currency
|
||||
%span#total_price= number_to_currency(@group_order.price)
|
||||
%tr
|
||||
- if FoodsoftConfig[:charge_members_manually]
|
||||
- old_balance = @ordering_data[:account_balance]
|
||||
%td= heading_helper(Ordergroup, :account_balance) + ':'
|
||||
%td.currency= number_to_currency(@ordering_data[:account_balance])
|
||||
- else
|
||||
- old_balance = @ordering_data[:available_funds]
|
||||
%td= heading_helper(Ordergroup, :available_funds) + ':'
|
||||
%td.currency= number_to_currency(@ordering_data[:available_funds])
|
||||
%tr
|
||||
%td= t('.new_funds') + ':'
|
||||
%td.currency
|
||||
%strong
|
||||
%span#new_balance= number_to_currency(old_balance - @group_order.price)
|
||||
#order-button
|
||||
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
||||
#{link_to t('ui.or_cancel'), group_orders_path}
|
||||
%input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/
|
||||
%input{name: "version", type: "hidden", value: @version}/
|
|
@ -0,0 +1 @@
|
|||
= raw t '.text', group: @group.name, supplier: @supplier , foodcoop: FoodsoftConfig[:name]
|
|
@ -0,0 +1,72 @@
|
|||
- title t('.title')
|
||||
- form_for @ordergroup do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
= f.label :type
|
||||
%br/
|
||||
= f.text_field :type
|
||||
%p
|
||||
= f.label :name
|
||||
%br/
|
||||
= f.text_field :name
|
||||
%p
|
||||
= f.label :description
|
||||
%br/
|
||||
= f.text_field :description
|
||||
%p
|
||||
= f.label :account_balance
|
||||
%br/
|
||||
= f.text_field :account_balance
|
||||
%p
|
||||
= f.label :account_updated
|
||||
%br/
|
||||
= f.datetime_select :account_updated
|
||||
%p
|
||||
= f.label :created_on
|
||||
%br/
|
||||
= f.datetime_select :created_on
|
||||
%p
|
||||
= f.label :role_admin
|
||||
%br/
|
||||
= f.check_box :role_admin
|
||||
%p
|
||||
= f.label :role_suppliers
|
||||
%br/
|
||||
= f.check_box :role_suppliers
|
||||
%p
|
||||
= f.label :role_article_meta
|
||||
%br/
|
||||
= f.check_box :role_article_meta
|
||||
%p
|
||||
= f.label :role_finance
|
||||
%br/
|
||||
= f.check_box :role_finance
|
||||
%p
|
||||
= f.label :role_invoices
|
||||
%br/
|
||||
= f.check_box :role_invoices
|
||||
%p
|
||||
= f.label :role_orders
|
||||
%br/
|
||||
= f.check_box :role_orders
|
||||
%p
|
||||
= f.label :deleted_at
|
||||
%br/
|
||||
= f.datetime_select :deleted_at
|
||||
%p
|
||||
= f.label :contact_person
|
||||
%br/
|
||||
= f.text_field :contact_person
|
||||
%p
|
||||
= f.label :customer_number
|
||||
%br/
|
||||
= f.text_field :customer_number
|
||||
%p
|
||||
= f.label :contact_phone
|
||||
%br/
|
||||
= f.text_field :contact_phone
|
||||
%p
|
||||
= f.label :contact_address
|
||||
%br/
|
||||
= f.text_field :contact_address
|
||||
%p= f.submit t('ui.edit')
|
|
@ -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
|
24
plugins/automatic_invoices/app/views/shared/_group.html.haml
Normal file
24
plugins/automatic_invoices/app/views/shared/_group.html.haml
Normal file
|
@ -0,0 +1,24 @@
|
|||
%dl
|
||||
%dt= heading_helper(Ordergroup, :description) + ':'
|
||||
%dd=h group.description
|
||||
- if group.is_a?(Ordergroup) and (@current_user.role_admin? or @current_user.role_finance?)
|
||||
%dt= heading_helper(Ordergroup, :contact) + ':'
|
||||
%dd=h group.contact
|
||||
%dt= heading_helper(Ordergroup, :contact_address) + ':'
|
||||
%dd= link_to_gmaps group.contact_address
|
||||
%dt= heading_helper(Ordergroup, :customer_number) + ':'
|
||||
%dd=h group.customer_number
|
||||
- if group.break_start? or group.break_end?
|
||||
%dt= heading_helper(Ordergroup, :break) + ':'
|
||||
%dd= raw t '.break', start: format_date(group.break_start), end: format_date(group.break_end)
|
||||
- if group.is_a?(Workgroup)
|
||||
%dt= t('.access') + ':'
|
||||
%dd= format_roles(group)
|
||||
%dt= heading_helper(Ordergroup, :user_tokens) + ':'
|
||||
%dd
|
||||
- members = group.users
|
||||
= "(#{members.size})"
|
||||
= members.collect{|u| show_user(u)}.join(", ")
|
||||
- if group.is_a?(Ordergroup) and FoodsoftConfig[:use_apple_points]
|
||||
%dt= t '.apple_limit'
|
||||
%dd= group.ignore_apple_restriction ? t('.deactivated') : t('.activated')
|
|
@ -871,12 +871,13 @@ de:
|
|||
title: Bestellung abrechnen
|
||||
edit_note:
|
||||
title: Notiz bearbeiten
|
||||
edit_results_by_articles:
|
||||
edit_results_by_articles_override:
|
||||
add_article: Artikel hinzufügen
|
||||
amount: Menge
|
||||
edit_transport: Transportkosten bearbeiten
|
||||
gross: Brutto
|
||||
net: Netto
|
||||
fc: FC
|
||||
edit_transport:
|
||||
title: Transportkosten verteilen
|
||||
group_order_articles:
|
||||
|
@ -928,13 +929,13 @@ de:
|
|||
summary:
|
||||
changed: Daten wurden verändert!
|
||||
duration: von %{starts} bis %{ends}
|
||||
fc_amount: 'FC-Betrag:'
|
||||
fc_amount_total: 'FC-Gesamtbetrag:'
|
||||
deposit: 'Pfand brutto:'
|
||||
gross_deposit: 'Pfand brutto:'
|
||||
net_deposit: 'Pfand netto:'
|
||||
fc_deposit: 'Pfand FC-Betrag:'
|
||||
fc_profit: FC Gewinn
|
||||
fc_amount: FC-Betrag (brutto)
|
||||
fc_gross_amount: FC-Betrag (brutto)
|
||||
gross_amount: 'Bruttobetrag:'
|
||||
groups_amount: 'Gruppenbeträge:'
|
||||
net_amount: 'Nettobetrag:'
|
||||
|
@ -1124,7 +1125,7 @@ de:
|
|||
closed: Diese Bestellung ist bereits abgeschlossen.
|
||||
no_member: Du bist kein Mitglieder einer Bestellgruppe.
|
||||
notfound: Fehlerhafte URL, das ist nicht Deine Bestellung.
|
||||
form:
|
||||
form_override:
|
||||
action_save: Bestellung speichern
|
||||
new_funds: Neuer Kontostand
|
||||
price: Preis
|
||||
|
|
|
@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|||
s.summary = "Foodsoft plugin to enhance foodsoft's accounting capabilities and to create and automatically deliver invoice pdfs for accounted orders."
|
||||
s.description = ''
|
||||
|
||||
s.files = Dir['{app,config,db,spec,lib}/**/*'] + ['Rakefile', 'README.md','/app/controllers/concerns/send_group_order_invoice_pdf.rb']
|
||||
s.files = Dir['{app,config,db,spec,lib}/**/**/**/*'] + ['Rakefile', 'README.md']
|
||||
|
||||
s.add_dependency 'rails'
|
||||
s.add_dependency 'deface', '~> 1.0'
|
||||
s.add_dependency 'deface', '~> 1.9'
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ require 'deface'
|
|||
require 'foodsoft_automatic_invoices/engine'
|
||||
require 'foodsoft_automatic_invoices/send_group_order_invoice_pdf'
|
||||
|
||||
|
||||
module FoodsoftAutomaticInvoices
|
||||
def self.enabled?
|
||||
FoodsoftConfig[:use_automatic_invoices]
|
||||
|
|
Loading…
Reference in a new issue