merge automatic group order invoice generation
This commit is contained in:
parent
817e409a2b
commit
3b5b057eed
28 changed files with 751 additions and 18 deletions
|
|
@ -7,4 +7,5 @@
|
|||
= config_input c, :country, as: :string, input_html: {class: 'input-xlarge'}
|
||||
= config_input c, :email, required: true, input_html: {class: 'input-xlarge'}
|
||||
= config_input c, :phone, input_html: {class: 'input-medium'}
|
||||
= config_input c, :tax_number, input_html: {class: 'input-medium'}
|
||||
= config_input form, :homepage, required: true, as: :url, input_html: {class: 'input-xlarge'}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@
|
|||
= config_input form, :charge_members_manually, as: :boolean
|
||||
= config_input form, :use_iban, as: :boolean
|
||||
= config_input form, :use_self_service, as: :boolean
|
||||
%h4= t '.group_order_invoices'
|
||||
= form.fields_for :group_order_invoices do |field|
|
||||
= config_input field, :use_automatic_invoices, as: :boolean
|
||||
= config_input field, :vat_exempt, as: :boolean
|
||||
= config_input field, :payment_method, as: :string, input_html: {class: 'input-medium'}
|
||||
|
||||
%h4= t '.schedule_title'
|
||||
= form.simple_fields_for :order_schedule do |fields|
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
%th= t('.end')
|
||||
%th= t('.state')
|
||||
%th= heading_helper Order, :updated_by
|
||||
%th= heading_helper GroupOrderInvoice, :name
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @orders.each do |order|
|
||||
|
|
@ -17,6 +19,14 @@
|
|||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
|
||||
%td= show_user(order.updated_by)
|
||||
%td{id: "generate-invoice#{order.id}"}
|
||||
- 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')
|
||||
%td
|
||||
- unless order.closed?
|
||||
- if current_user.role_orders?
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
- title t('.title')
|
||||
|
||||
- puts params
|
||||
- content_for :actionbar do
|
||||
- if FoodsoftConfig[:charge_members_manually]
|
||||
= link_to t('.close_all_direct_with_invoice'), close_all_direct_with_invoice_finance_order_index_path, method: :post, class: 'btn'
|
||||
|
|
|
|||
25
app/views/group_order_invoices/_links.html.haml
Normal file
25
app/views/group_order_invoices/_links.html.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.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
|
||||
|
||||
1
app/views/group_order_invoices/create.js.erb
Normal file
1
app/views/group_order_invoices/create.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= params[:id] %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
1
app/views/group_order_invoices/create_multiple.js.erb
Normal file
1
app/views/group_order_invoices/create_multiple.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
1
app/views/group_order_invoices/destroy.js.erb
Normal file
1
app/views/group_order_invoices/destroy.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
= f.hidden_field :order_id
|
||||
= f.hidden_field :updated_by_user_id
|
||||
= f.hidden_field :ordergroup_id
|
||||
%table.table.table-hover
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper Article, :name
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
%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"}
|
||||
%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
|
||||
|
|
|
|||
1
app/views/mailer/group_order_invoice.text.haml
Normal file
1
app/views/mailer/group_order_invoice.text.haml
Normal file
|
|
@ -0,0 +1 @@
|
|||
= raw t '.text', group: @group.name, supplier: @supplier , foodcoop: FoodsoftConfig[:name]
|
||||
Loading…
Add table
Add a link
Reference in a new issue