Fixed finance module to work with bootstrap design.
This commit is contained in:
parent
16de9124fe
commit
0236fb5a60
55 changed files with 440 additions and 486 deletions
|
@ -50,10 +50,10 @@ footer {
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
|
||||||
th.sortdown a:after {
|
a.sortdown:after {
|
||||||
content: ' \25BC';
|
content: ' \25BC';
|
||||||
}
|
}
|
||||||
th.sortup a:after {
|
a.sortup:after {
|
||||||
content: ' \25B2';
|
content: ' \25B2';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ArticlesController < ApplicationController
|
||||||
sort = "article_categories.name, articles.name"
|
sort = "article_categories.name, articles.name"
|
||||||
end
|
end
|
||||||
|
|
||||||
@articles = @supplier.articles.includes(:article_category).order(sort)
|
@articles = Article.where(supplier_id: @supplier).includes(:article_category).order(sort)
|
||||||
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@articles = @articles.page(params[:page]).per(@per_page)
|
@articles = @articles.page(params[:page]).per(@per_page)
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class Finance::BalancingController < ApplicationController
|
class Finance::BalancingController < Finance::BaseController
|
||||||
before_filter :authenticate_finance
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@financial_transactions = FinancialTransaction.order('created_on DESC').limit(8)
|
@orders = Order.finished.page(params[:page]).per(@per_page).order('ends DESC')
|
||||||
@orders = Order.finished_not_closed
|
|
||||||
@unpaid_invoices = Invoice.unpaid
|
|
||||||
end
|
|
||||||
|
|
||||||
def list
|
|
||||||
@orders = Order.finished.paginate :page => params[:page], :per_page => 10, :order => 'ends DESC'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -62,10 +55,10 @@ class Finance::BalancingController < ApplicationController
|
||||||
def close
|
def close
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
@order.close!(@current_user)
|
@order.close!(@current_user)
|
||||||
redirect_to finance_balancing_url, notice: "Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert."
|
redirect_to finance_root_url, notice: "Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert."
|
||||||
|
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to finance_balancing_url, alert: "Ein Fehler ist beim Abrechnen aufgetreten: #{error.message}"
|
redirect_to new_finance_order_url(order_id: @order.id), alert: "Ein Fehler ist beim Abrechnen aufgetreten: #{error.message}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Close the order directly, without automaticly updating ordergroups account balances
|
# Close the order directly, without automaticly updating ordergroups account balances
|
||||||
|
|
11
app/controllers/finance/base_controller.rb
Normal file
11
app/controllers/finance/base_controller.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class Finance::BaseController < ApplicationController
|
||||||
|
before_filter :authenticate_finance
|
||||||
|
|
||||||
|
def index
|
||||||
|
@financial_transactions = FinancialTransaction.order('created_on DESC').limit(8)
|
||||||
|
@orders = Order.finished_not_closed
|
||||||
|
@unpaid_invoices = Invoice.unpaid
|
||||||
|
|
||||||
|
render template: 'finance/index'
|
||||||
|
end
|
||||||
|
end
|
|
@ -19,15 +19,10 @@ class Finance::FinancialTransactionsController < ApplicationController
|
||||||
sort = "created_on DESC"
|
sort = "created_on DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
@financial_transactions = @ordergroup.financial_transactions.order(sort)
|
@financial_transactions = @ordergroup.financial_transactions.unscoped.order(sort)
|
||||||
@financial_transactions = @financial_transactions.where('note LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@financial_transactions = @financial_transactions.where('note LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@financial_transactions = @financial_transactions.paginate :page => params[:page], :per_page => 10
|
@financial_transactions = @financial_transactions.page(params[:page]).per(@per_page)
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js { render :layout => false }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -55,9 +50,9 @@ class Finance::FinancialTransactionsController < ApplicationController
|
||||||
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user)
|
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redirect_to finance_ordergroups_url, :notice => "Alle Transaktionen wurden gespeichert."
|
redirect_to finance_ordergroups_url, notice: "Alle Transaktionen wurden gespeichert."
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to :action => 'new_collection', :alert => "Ein Fehler ist aufgetreten: " + error.to_s
|
redirect_to finance_new_transaction_collection_url, alert: "Ein Fehler ist aufgetreten: " + error.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -1,39 +1,23 @@
|
||||||
class Finance::InvoicesController < ApplicationController
|
class Finance::InvoicesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@invoices = Invoice.includes(:supplier, :delivery, :order).order('date DESC').paginate(page: params[:page])
|
@invoices = Invoice.includes(:supplier, :delivery, :order).order('date DESC').page(params[:page]).per(@per_page)
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @invoices }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@invoice = Invoice.find(params[:id])
|
@invoice = Invoice.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # show.html.erb
|
|
||||||
format.xml { render :xml => @invoice }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@invoice = Invoice.new :supplier_id => params[:supplier_id],
|
@invoice = Invoice.new :supplier_id => params[:supplier_id],
|
||||||
:delivery_id => params[:delivery_id], :order_id => params[:order_id]
|
:delivery_id => params[:delivery_id],
|
||||||
|
:order_id => params[:order_id]
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @invoice }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@invoice = Invoice.find(params[:id])
|
@invoice = Invoice.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /invoices
|
|
||||||
# POST /invoices.xml
|
|
||||||
def create
|
def create
|
||||||
@invoice = Invoice.new(params[:invoice])
|
@invoice = Invoice.new(params[:invoice])
|
||||||
|
|
||||||
|
@ -41,7 +25,7 @@ class Finance::InvoicesController < ApplicationController
|
||||||
flash[:notice] = "Rechnung wurde erstellt."
|
flash[:notice] = "Rechnung wurde erstellt."
|
||||||
if @invoice.order
|
if @invoice.order
|
||||||
# Redirect to balancing page
|
# Redirect to balancing page
|
||||||
redirect_to :controller => 'balancing', :action => 'new', :id => @invoice.order
|
redirect_to new_finance_order_url(order_id: @invoice.order.id)
|
||||||
else
|
else
|
||||||
redirect_to [:finance, @invoice]
|
redirect_to [:finance, @invoice]
|
||||||
end
|
end
|
||||||
|
@ -50,32 +34,20 @@ class Finance::InvoicesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# PUT /invoices/1
|
|
||||||
# PUT /invoices/1.xml
|
|
||||||
def update
|
def update
|
||||||
@invoice = Invoice.find(params[:id])
|
@invoice = Invoice.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @invoice.update_attributes(params[:invoice])
|
if @invoice.update_attributes(params[:invoice])
|
||||||
flash[:notice] = 'Invoice was successfully updated.'
|
redirect_to [:finance, @invoice], notice: "Rechnung wurde aktualisiert."
|
||||||
format.html { redirect_to([:finance, @invoice]) }
|
|
||||||
format.xml { head :ok }
|
|
||||||
else
|
else
|
||||||
format.html { render :action => "edit" }
|
render :edit
|
||||||
format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /invoices/1
|
|
||||||
# DELETE /invoices/1.xml
|
|
||||||
def destroy
|
def destroy
|
||||||
@invoice = Invoice.find(params[:id])
|
@invoice = Invoice.find(params[:id])
|
||||||
@invoice.destroy
|
@invoice.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
redirect_to finance_invoices_url
|
||||||
format.html { redirect_to(finance_invoices_path) }
|
|
||||||
format.xml { head :ok }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class Finance::OrdergroupsController < ApplicationController
|
class Finance::OrdergroupsController < Finance::BaseController
|
||||||
before_filter :authenticate_finance
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if params["sort"]
|
if params["sort"]
|
||||||
|
@ -16,11 +15,6 @@ class Finance::OrdergroupsController < ApplicationController
|
||||||
@ordergroups = Ordergroup.order(sort)
|
@ordergroups = Ordergroup.order(sort)
|
||||||
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@ordergroups = @ordergroups.paginate :page => params[:page], :per_page => @per_page
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js { render :layout => false }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,24 +46,32 @@ module ApplicationHelper
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_td_class_helper(param)
|
|
||||||
result = 'sortup' if params[:sort] == param.to_s
|
|
||||||
result = 'sortdown' if params[:sort] == param.to_s + "_reverse"
|
|
||||||
result
|
|
||||||
end
|
|
||||||
|
|
||||||
def sort_link_helper(text, key, options = {})
|
def sort_link_helper(text, key, options = {})
|
||||||
per_page = options[:per_page] || @per_page
|
# Hmtl options
|
||||||
remote = options[:remote].nil? ? true : options[:remote]
|
remote = options[:remote].nil? ? true : options[:remote]
|
||||||
key += "_reverse" if params[:sort] == key
|
class_name = case params[:sort]
|
||||||
url = url_for(:sort => key, :page => nil, :per_page => per_page)
|
when key then
|
||||||
|
'sortup'
|
||||||
|
when key + '_reverse' then
|
||||||
|
'sortdown'
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
html_options = {
|
html_options = {
|
||||||
:title => "Nach #{text} sortieren",
|
:title => "Nach #{text} sortieren",
|
||||||
:remote => remote
|
:remote => remote,
|
||||||
|
:class => class_name
|
||||||
}
|
}
|
||||||
|
|
||||||
link_to(text, url, html_options)
|
|
||||||
|
# Url options
|
||||||
|
key += "_reverse" if params[:sort] == key
|
||||||
|
per_page = options[:per_page] || @per_page
|
||||||
|
url_options = params.merge(per_page: per_page, sort: key)
|
||||||
|
url_options.merge!({page: params[:page]}) if params[:page]
|
||||||
|
url_options.merge!({query: params[:query]}) if params[:query]
|
||||||
|
|
||||||
|
link_to(text, url_for(url_options), html_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generates a link to the top of the website
|
# Generates a link to the top of the website
|
||||||
|
|
|
@ -2,9 +2,9 @@ module Finance::OrderArticlesHelper
|
||||||
|
|
||||||
def new_order_articles_collection
|
def new_order_articles_collection
|
||||||
if @order.stockit?
|
if @order.stockit?
|
||||||
StockArticle.order(:name)
|
StockArticle.order('articles.name')
|
||||||
else
|
else
|
||||||
@order.supplier.articles.order(:name)
|
@order.supplier.articles.order('articles.name')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
belongs_to :order_article
|
belongs_to :order_article
|
||||||
has_many :group_order_article_quantities, :dependent => :destroy
|
has_many :group_order_article_quantities, :dependent => :destroy
|
||||||
|
|
||||||
validates_presence_of :group_order_id, :order_article_id
|
validates_presence_of :group_order, :order_article
|
||||||
validates_inclusion_of :quantity, :in => 0..99
|
validates_inclusion_of :quantity, :in => 0..99
|
||||||
validates_inclusion_of :result, :in => 0..99, :allow_nil => true
|
validates_inclusion_of :result, :in => 0..99, :allow_nil => true
|
||||||
validates_inclusion_of :tolerance, :in => 0..99
|
validates_inclusion_of :tolerance, :in => 0..99
|
||||||
|
|
|
@ -2,19 +2,15 @@
|
||||||
= items_per_page
|
= items_per_page
|
||||||
= pagination_links_remote @articles
|
= pagination_links_remote @articles
|
||||||
|
|
||||||
%table#articles_table.table.table-striped
|
%table#articles_table.table.table-hover
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th
|
%th
|
||||||
%th{class: sort_td_class_helper(:name)}
|
%th= sort_link_helper "Name", "name"
|
||||||
= sort_link_helper "Name", "name"
|
|
||||||
%th
|
%th
|
||||||
%th{class: sort_td_class_helper(:category)}
|
%th= sort_link_helper "Kategorie", "category"
|
||||||
= sort_link_helper "Kategorie", "category"
|
%th= sort_link_helper "Einheit", "unit"
|
||||||
%th{class: sort_td_class_helper(:unit)}
|
%th= sort_link_helper "Notiz", "note"
|
||||||
= sort_link_helper "Einheit", "unit"
|
|
||||||
%th{class: sort_td_class_helper(:note)}
|
|
||||||
= sort_link_helper "Notiz", "note"
|
|
||||||
%th{:style => "width: 4em;"} Gebgr.
|
%th{:style => "width: 4em;"} Gebgr.
|
||||||
%th{:style => "width: 5em;"} Preis
|
%th{:style => "width: 5em;"} Preis
|
||||||
%th{:style => "width: 3.5em;"} MwSt
|
%th{:style => "width: 3.5em;"} MwSt
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
$('#modalContainer').html('#{escape_javascript(render("form"))}');
|
$('#modalContainer').html('#{j(render("form"))}');
|
||||||
$('#modalContainer').modal();
|
$('#modalContainer').modal();
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
%h2 Notiz bearbeiten
|
|
||||||
= simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f|
|
= simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f|
|
||||||
= f.input :note, inner_html: {size: "60x20"}
|
.modal-header
|
||||||
= f.submit
|
= button_tag "x", class: 'close', data: {dismiss: 'modal'}
|
||||||
|
%h3 Notiz bearbeiten
|
||||||
|
.modal-body
|
||||||
|
= f.input :note, input_html: {class: 'input-xlarge'}
|
||||||
|
.modal-footer
|
||||||
|
= button_tag "Schließen", class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= f.submit "Speichern", class: 'btn btn-primary'
|
|
@ -1,15 +1,10 @@
|
||||||
%p{:style => "float:left"}
|
%h3 Bestellung bearbeiten
|
||||||
%b Lieferung bearbeiten
|
|
||||||
%p{:style => "float:right"}
|
|
||||||
= link_to "Artikel hinzufügen", new_finance_order_order_article_path(@order), remote: true
|
|
||||||
|
|
||||||
%table{:class => "ordered_articles", :style => "clear:both"}
|
%table.ordered-articles.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{colspan: "1", class: sort_td_class_helper("name")}
|
%th= sort_link_helper "Artikel", "name"
|
||||||
= sort_link_helper "Artikel", "name"
|
%th= sort_link_helper "Nr.", "order_number"
|
||||||
%th{class: sort_td_class_helper("order_number")}
|
|
||||||
= sort_link_helper "Nr.", "order_number"
|
|
||||||
%th Menge
|
%th Menge
|
||||||
%th GebGr * Einheit
|
%th GebGr * Einheit
|
||||||
%th Netto
|
%th Netto
|
||||||
|
@ -17,6 +12,8 @@
|
||||||
%th MwSt
|
%th MwSt
|
||||||
%th Pfand
|
%th Pfand
|
||||||
%th{:colspan => "2"}
|
%th{:colspan => "2"}
|
||||||
|
= link_to "Artikel hinzufügen", new_finance_order_order_article_path(@order), remote: true,
|
||||||
|
class: 'btn btn-small'
|
||||||
%tbody#result_table
|
%tbody#result_table
|
||||||
- for order_article in @articles
|
- for order_article in @articles
|
||||||
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%td{:colspan => "7"}
|
%td{:colspan => "7"}
|
||||||
%table
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
|
@ -7,35 +7,35 @@
|
||||||
%td Einheiten
|
%td Einheiten
|
||||||
%td Gesamtpreis
|
%td Gesamtpreis
|
||||||
%td{:colspan => "3",:style => "width:14em"}
|
%td{:colspan => "3",:style => "width:14em"}
|
||||||
= link_to '[Gruppe hinzufügen]', new_finance_group_order_article_path(order_article_id: order_article.id),
|
= link_to 'Gruppe hinzufügen', new_finance_group_order_article_path(order_article_id: order_article.id),
|
||||||
remote: true
|
remote: true, class: 'btn btn-mini'
|
||||||
%tbody
|
%tbody
|
||||||
- for group_order_article in order_article.group_order_articles.ordered.all(:include => [:group_order])
|
- for group_order_article in order_article.group_order_articles.ordered.all(:include => [:group_order])
|
||||||
%tr{:class => cycle('even', 'odd', :name => 'results')}[group_order_article]
|
%tr[group_order_article]
|
||||||
%td
|
%td
|
||||||
%td{:style=>"width:50%"}
|
%td{:style=>"width:50%"}
|
||||||
= group_order_article.group_order.ordergroup.name
|
= group_order_article.group_order.ordergroup.name
|
||||||
%td{:id => "group_order_article_#{group_order_article.id}_quantity", :style => "white-space:nowrap"}
|
%td{:id => "group_order_article_#{group_order_article.id}_quantity", :style => "white-space:nowrap"}
|
||||||
= group_order_article.result
|
= group_order_article.result
|
||||||
= button_to "+", update_result_finance_group_order_article_path(group_order_article, modifier: '+'),
|
= link_to "+", update_result_finance_group_order_article_path(group_order_article, modifier: '+'),
|
||||||
method: :put, remote: true, style: 'float:left'
|
method: :put, remote: true, class: 'btn btn-mini'
|
||||||
= button_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
|
= link_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
|
||||||
method: :put, remote: true
|
method: :put, remote: true, class: 'btn btn-mini'
|
||||||
%td.currency
|
%td.numeric
|
||||||
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "")
|
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "")
|
||||||
%td.actions{:style=>"width:1em"}
|
%td.actions{:style=>"width:1em"}
|
||||||
= link_to icon(:edit), edit_finance_group_order_article_path(group_order_article), remote: true
|
= link_to "Bearbeiten", edit_finance_group_order_article_path(group_order_article), remote: true,
|
||||||
|
class: 'btn btn-mini'
|
||||||
%td.actions{:style=>"width:1em"}
|
%td.actions{:style=>"width:1em"}
|
||||||
= link_to icon(:delete), finance_group_order_article_path(group_order_article), method: :delete,
|
= link_to "Löschen", finance_group_order_article_path(group_order_article), method: :delete,
|
||||||
remote: true
|
remote: true, class: 'btn btn-mini btn-danger'
|
||||||
%td
|
%td
|
||||||
%tfoot
|
%tfoot
|
||||||
%tr{:class => cycle('even', 'odd', :name => 'results')}
|
%tr
|
||||||
%td
|
%td
|
||||||
%td{:style => "width:8em"} Summe (FC-Preis)
|
%td{:style => "width:8em"} Summe (FC-Preis)
|
||||||
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
|
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
|
||||||
= order_article.group_orders_sum[:quantity]
|
= order_article.group_orders_sum[:quantity]
|
||||||
%td{:id => "group_orders_sum_price_#{order_article.id}", :class => "currency"}
|
%td.numeric{:id => "group_orders_sum_price_#{order_article.id}"}
|
||||||
= number_to_currency(order_article.group_orders_sum[:price], :unit => "")
|
= number_to_currency(order_article.group_orders_sum[:price], :unit => "")
|
||||||
%td{:colspan => "3"}
|
%td{:colspan => "3"}
|
||||||
- reset_cycle('results')
|
|
|
@ -19,7 +19,8 @@
|
||||||
%td= order_article.price.tax
|
%td= order_article.price.tax
|
||||||
%td= order_article.price.deposit
|
%td= order_article.price.deposit
|
||||||
%td
|
%td
|
||||||
= link_to icon(:edit), edit_finance_order_order_article_path(order_article.order, order_article), remote: true
|
= link_to "Bearbeiten", edit_finance_order_order_article_path(order_article.order, order_article), remote: true,
|
||||||
|
class: 'btn btn-mini'
|
||||||
%td
|
%td
|
||||||
= link_to icon(:delete), finance_order_order_article_path(order_article.order, order_article), method: :delete,
|
= link_to "Löschen", finance_order_order_article_path(order_article.order, order_article), method: :delete,
|
||||||
remote: true, confirm: 'Bist du sicher?'
|
remote: true, confirm: 'Bist du sicher?', class: 'btn btn-danger btn-mini'
|
|
@ -1,4 +1,4 @@
|
||||||
%tr{:class => cycle('even', 'odd', :name => 'articles')}[order_article]
|
%tr[order_article]
|
||||||
= render :partial => 'finance/balancing/order_article', :locals => {:order_article => order_article}
|
= render :partial => 'finance/balancing/order_article', :locals => {:order_article => order_article}
|
||||||
|
|
||||||
%tr{:id => "group_order_articles_#{order_article.id}", :class => "results", :style => "display:none"}
|
%tr{:id => "group_order_articles_#{order_article.id}", :class => "results", :style => "display:none"}
|
||||||
|
|
26
app/views/finance/balancing/_orders.html.haml
Normal file
26
app/views/finance/balancing/_orders.html.haml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
- unless @orders.empty?
|
||||||
|
- if Order.finished.count > 20
|
||||||
|
= items_per_page
|
||||||
|
= pagination_links_remote @orders
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Name
|
||||||
|
%th Ende
|
||||||
|
%th Status
|
||||||
|
%th zuletzt bearbeitet von
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- @orders.each do |order|
|
||||||
|
%tr{:class => cycle("even","odd", :name => "order")}
|
||||||
|
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
|
||||||
|
%td=h format_time(order.ends) unless order.ends.nil?
|
||||||
|
%td= order.closed? ? "abgerechnet (#{number_to_currency order.foodcoop_result})" : "beendet"
|
||||||
|
%td= order.updated_by.nil? ? '??' : order.updated_by.nick
|
||||||
|
%td
|
||||||
|
- unless order.closed?
|
||||||
|
= link_to "abrechnen", new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
|
||||||
|
= link_to 'direkt schließen', close_direct_finance_order_path(order),
|
||||||
|
:confirm => 'Wirklich die Bestellung schließen setzen?', :method => :put, class: 'btn btn-mini'
|
||||||
|
- else
|
||||||
|
%i derzeit gibt es keine beendeten Bestellungen
|
|
@ -5,19 +5,23 @@
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
%td Nettobetrag:
|
%td Nettobetrag:
|
||||||
%td= number_to_currency(order.sum(:net))
|
%td.numeric= number_to_currency(order.sum(:net))
|
||||||
%tr
|
%tr
|
||||||
%td Bruttobetrag:
|
%td Bruttobetrag:
|
||||||
%td= number_to_currency(order.sum(:gross))
|
%td.numeric= number_to_currency(order.sum(:gross))
|
||||||
%tr
|
%tr
|
||||||
%td FC-Betrag:
|
%td FC-Betrag:
|
||||||
%td= number_to_currency(order.sum(:fc))
|
%td.numeric= number_to_currency(order.sum(:fc))
|
||||||
%tr
|
%tr
|
||||||
%td Summe der Gruppenbeträge:
|
%td Gruppenbeträge:
|
||||||
%td= number_to_currency(order.sum(:groups))
|
%td.numeric= number_to_currency(order.sum(:groups))
|
||||||
%tr
|
%tr
|
||||||
%td FC Gewinn ohne Aufschlag:
|
%td
|
||||||
%td= number_to_currency(order.profit(:without_markup => true))
|
FC Gewinn
|
||||||
|
%small ohne Aufschlag:
|
||||||
|
%td.numeric= number_to_currency(order.profit(:without_markup => true))
|
||||||
%tr
|
%tr
|
||||||
%td FC Gewinn mit Aufschlag:
|
%td
|
||||||
%td#order_profit= number_to_currency(order.profit)
|
FC Gewinn
|
||||||
|
%small mit Aufschlag:
|
||||||
|
%td#order_profit.numeric= number_to_currency(order.profit)
|
|
@ -1,16 +1,13 @@
|
||||||
-title "Bestellung abschließen"
|
-title "Bestellung abschließen"
|
||||||
%div{:style => "width: 40em"}
|
%p
|
||||||
%p
|
|
||||||
Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.
|
Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.
|
||||||
%br/
|
%br/
|
||||||
Die Konten werden wie folgt belastet:
|
Die Konten werden wie folgt belastet:
|
||||||
%table.list{:style => "width:35em"}
|
%table.table.table-striped{:style => "width:35em"}
|
||||||
- for group_order in @order.group_orders
|
- for group_order in @order.group_orders
|
||||||
%tr{:class => cycle('even', 'odd')}
|
%tr{:class => cycle('even', 'odd')}
|
||||||
%td= group_order.ordergroup.name
|
%td= group_order.ordergroup.name
|
||||||
%td= number_to_currency(group_order.price)
|
%td.numeric= number_to_currency(group_order.price)
|
||||||
%p
|
.form-actions
|
||||||
%div{:style => "float:left"}
|
= link_to "Abschließen", close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
|
||||||
= button_to "Abschließen", close_finance_order_path(@order), method: :put
|
= link_to 'oder zurück zur Abrechnung', new_finance_order_path(order_id: @order.id)
|
||||||
%div{:style => "float:right"}
|
|
||||||
= link_to 'Zurück zur Abrechnung', new_finance_order_path(order_id: @order.id)
|
|
|
@ -1 +1,2 @@
|
||||||
$.fancybox('#{escape_javascript(render("edit_note"))}');
|
$('#modalContainer').html('#{j(render("edit_note"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -1,63 +1,3 @@
|
||||||
%h1 Finanzbereich
|
- title "beendete Bestellungen"
|
||||||
.left_column{:style => 'width: 50%'}
|
|
||||||
.box_title
|
|
||||||
%h2 Unbezahlte Rechnungen
|
|
||||||
.column_content
|
|
||||||
%p= link_to "Zeige alle Rechnungen", finance_invoices_path
|
|
||||||
%table.list
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Datum
|
|
||||||
%th Betrag
|
|
||||||
%th Lieferantin
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- for invoice in @unpaid_invoices
|
|
||||||
%tr{:class => cycle("even","odd", :name => "invoices")}
|
|
||||||
%td= format_date(invoice.date)
|
|
||||||
%td= number_to_currency(invoice.amount)
|
|
||||||
%td=h invoice.supplier.name
|
|
||||||
%td= link_to "Bearbeiten", edit_finance_invoice_path(invoice)
|
|
||||||
|
|
||||||
.box_title
|
#ordersTable= render 'orders'
|
||||||
%h2 letzte Überweisungen
|
|
||||||
.column_content
|
|
||||||
%p
|
|
||||||
= link_to "Bestellgruppen", :controller => 'financial_transactions'
|
|
||||||
%table.list
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Datum
|
|
||||||
%th Gruppe
|
|
||||||
%th Notiz
|
|
||||||
%th Betrag
|
|
||||||
%tbody
|
|
||||||
- @financial_transactions.each do |ft|
|
|
||||||
%tr{:class => cycle("even","odd", :name => "financial_transaction")}
|
|
||||||
%td= format_date(ft.created_on)
|
|
||||||
%td= ft.ordergroup.name
|
|
||||||
%td{:style => "width:50%"}=h ft.note
|
|
||||||
%td{:style => "color:#{ft.amount < 0 ? 'red' : 'black'}", :class => "currency"}= number_to_currency(ft.amount)
|
|
||||||
|
|
||||||
.right_column{:style => 'width: 46%'}
|
|
||||||
.box_title
|
|
||||||
%h2 noch nicht abgerechnet
|
|
||||||
.column_content
|
|
||||||
%p= link_to "Bestellungsübersicht", finance_balancing_path
|
|
||||||
- unless @orders.empty?
|
|
||||||
%table.list
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Lieferantin
|
|
||||||
%th Ende
|
|
||||||
%th Betrag(FC)
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- @orders.each do |order|
|
|
||||||
%tr{:class => cycle("even","odd", :name => "order")}
|
|
||||||
%td= order.name
|
|
||||||
%td= format_date(order.ends)
|
|
||||||
%td{:class => "currency"}= number_to_currency(order.sum(:fc))
|
|
||||||
%td= link_to "abrechnen", new_finance_order_path(order_id: order.id)
|
|
||||||
- else
|
|
||||||
Super, alles schon abgerechnet...
|
|
1
app/views/finance/balancing/index.js.haml
Normal file
1
app/views/finance/balancing/index.js.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
$('#ordersTable').html('#{j(render('orders'))}');
|
|
@ -1,29 +0,0 @@
|
||||||
- title "beendete Bestellungen"
|
|
||||||
.left_column{:style => "width:70em"}
|
|
||||||
.box_title
|
|
||||||
.column_content
|
|
||||||
- unless @orders.empty?
|
|
||||||
= will_paginate @orders
|
|
||||||
%table.list
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Name
|
|
||||||
%th Ende
|
|
||||||
%th Status
|
|
||||||
%th zuletzt bearbeitet von
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- @orders.each do |order|
|
|
||||||
%tr{:class => cycle("even","odd", :name => "order")}
|
|
||||||
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
|
|
||||||
%td=h format_time(order.ends) unless order.ends.nil?
|
|
||||||
%td= order.closed? ? "abgerechnet (#{number_to_currency order.foodcoop_result})" : "beendet"
|
|
||||||
%td= order.updated_by.nil? ? '??' : order.updated_by.nick
|
|
||||||
%td
|
|
||||||
- unless order.closed?
|
|
||||||
= link_to "abrechnen", new_finance_order_path(order_id: order.id)
|
|
||||||
|
|
|
||||||
= link_to 'direkt schließen', close_direct_finance_order_path(order),
|
|
||||||
:confirm => 'Wirklich die Bestellung schließen setzen?', :method => :put
|
|
||||||
- else
|
|
||||||
%i derzeit gibt es keine beendeten Bestellungen
|
|
|
@ -1,53 +1,49 @@
|
||||||
- title "#{@order.name} abrechnen"
|
- title "#{@order.name} abrechnen"
|
||||||
|
|
||||||
.left_column{:style => 'width: 24em'}
|
- content_for :sidebar do
|
||||||
.box_title
|
.well.well-small
|
||||||
%h2 Zusammenfassung
|
%h3 Zusammenfassung
|
||||||
.column_content#summary
|
#summary= render 'summary', order: @order
|
||||||
= render :partial => "summary", :locals => {:order => @order}
|
|
||||||
|
|
||||||
- unless @order.stockit?
|
.well.well-small
|
||||||
.middle_column{:style => 'width: 24em'}
|
%h3 Rechnung
|
||||||
.box_title
|
#invoice= render 'invoice', invoice: @order.invoice
|
||||||
%h2 Rechnung
|
|
||||||
.column_content#invoice
|
|
||||||
= render :partial => "invoice", :locals => {:invoice => @order.invoice}
|
|
||||||
|
|
||||||
.right_column{:style => 'width: 20em'}
|
.well.well-small
|
||||||
.box_title
|
%h3 Notizen/Protokoll
|
||||||
%h2 Aktionen
|
|
||||||
.column_content
|
|
||||||
%ul
|
|
||||||
- unless @order.invoice or @order.stockit?
|
|
||||||
%li= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier)
|
|
||||||
- unless @order.closed?
|
|
||||||
%li= link_to "Bestellung abschließen", :action => "confirm", :id => @order
|
|
||||||
|
|
||||||
.right_column{:style => 'clear:both;width: 28%'}
|
|
||||||
.box_title
|
|
||||||
%h2 Notizen/Protokoll
|
|
||||||
.column_content
|
|
||||||
#note
|
#note
|
||||||
- unless @order.note.empty?
|
- unless @order.note.empty?
|
||||||
= simple_format @order.note
|
= simple_format @order.note
|
||||||
- else
|
- else
|
||||||
%p Hier kannst Du deine Abrechnung kommentieren
|
%p Hier kannst Du deine Abrechnung kommentieren
|
||||||
= link_to "Notiz bearbeiten", edit_note_finance_order_path(@order), remote: true
|
= link_to "Notiz bearbeiten", edit_note_finance_order_path(@order), remote: true
|
||||||
.box_title
|
|
||||||
%h2 Kommentare
|
|
||||||
.column_content
|
|
||||||
#comments
|
|
||||||
= render :partial => 'shared/comments', locals: {comments: @order.comments}
|
|
||||||
|
|
||||||
.left_column{:style => 'width: 69%'}
|
.well.well-small
|
||||||
.box_title
|
%h3 Kommentare
|
||||||
#editOrderNav
|
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments}
|
||||||
%ul
|
|
||||||
%li= link_to 'Bestellung bearbeiten', new_finance_order_path(order_id: @order.id, view: 'edit_results'), remote: true
|
.well.well-small
|
||||||
%li= link_to 'Gruppenübersicht', new_finance_order_path(order_id: @order.id, view: 'groups_overview'), remote: true
|
.btn-toolbar
|
||||||
%li= link_to 'Artikelübersicht', new_finance_order_path(order_id: @order.id, view: 'articles_overview'), remote: true
|
.btn-group
|
||||||
.column_content
|
- unless @order.invoice or @order.stockit?
|
||||||
#results
|
= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
|
||||||
= render partial: 'edit_results_by_articles'
|
class: 'btn'
|
||||||
%p= link_to_top
|
- unless @order.closed?
|
||||||
|
= link_to "Bestellung abschließen", confirm_finance_order_path(@order), class: 'btn btn-primary'
|
||||||
|
|
||||||
|
#editOrderNav.btn-group.pull-right
|
||||||
|
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||||
|
Ansichtsoptionen
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu
|
||||||
|
%li= link_to 'Bestellung bearbeiten', new_finance_order_path(order_id: @order.id, view: 'edit_results'),
|
||||||
|
remote: true
|
||||||
|
%li= link_to 'Gruppenübersicht', new_finance_order_path(order_id: @order.id, view: 'groups_overview'),
|
||||||
|
remote: true
|
||||||
|
%li= link_to 'Artikelübersicht', new_finance_order_path(order_id: @order.id, view: 'articles_overview'),
|
||||||
|
remote: true
|
||||||
|
|
||||||
|
%section#results
|
||||||
|
= render 'edit_results_by_articles'
|
||||||
|
%p= link_to_top
|
||||||
#edit_box{:style => 'display:none'}
|
#edit_box{:style => 'display:none'}
|
|
@ -1 +1 @@
|
||||||
$('#results').html('#{escape_javascript(render(partial: balancing_view_partial, locals: {order: @order}))}');
|
$('#results').html('#{j(render(balancing_view_partial, order: @order))}');
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
$.fancybox.close();
|
$('#modalContainer').modal('hide');
|
||||||
$('#note').html('#{escape_javascript(simple_format(@order.note))}');
|
$('#note').html('#{j(simple_format(@order.note))}');
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
%td
|
%td
|
||||||
= select_tag 'financial_transactions[][ordergroup_id]',
|
= select_tag 'financial_transactions[][ordergroup_id]',
|
||||||
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
|
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
|
||||||
%td= text_field_tag 'financial_transactions[][amount]'
|
%td= text_field_tag 'financial_transactions[][amount]', nil, class: 'input-small'
|
||||||
%td= link_to icon(:delete), "#", :title => "Gruppe enfernen", 'data-remove-transaction' => true
|
%td= link_to "Entfernen", "#", :title => "Gruppe enfernen", 'data-remove-transaction' => true,
|
||||||
|
class: 'btn btn-small'
|
|
@ -1,25 +1,16 @@
|
||||||
- if @total == 0
|
- if @ordergroup.financial_transactions.count > 20
|
||||||
%p Keine gefunden
|
= items_per_page
|
||||||
- else
|
= pagination_links_remote @financial_transactions
|
||||||
%p
|
%table.table.table-striped
|
||||||
Anzahl gefundener Transaktionen:
|
|
||||||
%b= @total
|
|
||||||
%p
|
|
||||||
= pagination_links_remote @financial_transactions, :update => 'transactions', |
|
|
||||||
:params => {:sort => params[:sort], :query => params['query']} |
|
|
||||||
%table
|
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
<td #{sort_td_class_helper("date")}>
|
%td= sort_link_helper "Datum", "date"
|
||||||
\#{sort_link_helper "Datum", "date"}
|
|
||||||
%td Wer
|
%td Wer
|
||||||
<td #{sort_td_class_helper("note")}>
|
%td= sort_link_helper "Notiz", "note"
|
||||||
\#{sort_link_helper "Notiz", "note"}
|
%td= sort_link_helper "Betrag", "amount"
|
||||||
<td #{sort_td_class_helper("amount")}>
|
|
||||||
\#{sort_link_helper "Betrag", "amount"}
|
|
||||||
%tbody
|
%tbody
|
||||||
- @financial_transactions.each do |t|
|
- @financial_transactions.each do |t|
|
||||||
%tr{:class => cycle("even","odd")}
|
%tr
|
||||||
%td= format_time(t.created_on)
|
%td= format_time(t.created_on)
|
||||||
%td= h t.user.nil? ? '??' : t.user.nick
|
%td= h t.user.nil? ? '??' : t.user.nick
|
||||||
%td= h t.note
|
%td= h t.note
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
- title "Kontoauszug für #{@ordergroup.name}"
|
- title "Kontoauszug für #{@ordergroup.name}"
|
||||||
%p
|
|
||||||
%b
|
- content_for :sidebar do
|
||||||
Kontostand: #{number_to_currency(@ordergroup.account_balance)}
|
%p= link_to 'Neue Transaktion anlegen', new_finance_ordergroup_transaction_path(@ordergroup), class: 'btn btn-primary'
|
||||||
%span{:style => "color:grey"}
|
.well.well-small
|
||||||
(zuletzt aktualisiert vor #{distance_of_time_in_words(Time.now, @ordergroup.account_updated)})
|
%strong Kontostand: #{number_to_currency(@ordergroup.account_balance)}
|
||||||
.left_column{:style => "width:100%"}
|
%br/
|
||||||
.box_title
|
%small (zuletzt aktualisiert vor #{distance_of_time_in_words(Time.now, @ordergroup.account_updated)})
|
||||||
%h2 Überweisungen
|
.well.well-small
|
||||||
.column_content
|
= form_tag finance_ordergroup_transactions_path(@ordergroup), :method => :get, :remote => true,
|
||||||
= form_tag finance_ordergroup_transactions_path(@ordergroup), :method => :get, :style=>"display:inline;", :id => 'ordergroup_search',
|
'data-submit-onchange' => true, class: 'form-search' do
|
||||||
:remote => true, 'data-submit-onchange' => true do
|
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||||
%label{:for => 'article_name'} Suche in Notiz:
|
placeholder: 'Suchen ...'
|
||||||
= text_field_tag :query, params[:query], :size => 10
|
|
||||||
#transactions
|
|
||||||
= render :partial => "transactions"
|
#transactions= render 'transactions'
|
||||||
%p= link_to 'Neue Transaktion', new_finance_ordergroup_transaction_path(@ordergroup)
|
|
||||||
= link_to 'Gruppenübersicht', finance_ordergroups_path
|
|
|
@ -1,6 +1,6 @@
|
||||||
- title "Mehrer Konten aktualisieren"
|
- title "Mehrere Konten aktualisieren"
|
||||||
|
|
||||||
- content_for :head do
|
- content_for :javascript do
|
||||||
:javascript
|
:javascript
|
||||||
var ordergroup = "#{escape_javascript(render('ordergroup'))}"
|
var ordergroup = "#{escape_javascript(render('ordergroup'))}"
|
||||||
|
|
||||||
|
@ -16,19 +16,23 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
- form_tag finance_create_transaction_collection_path do
|
- content_for :sidebar do
|
||||||
|
.well.well-small
|
||||||
|
Hier kannst Du mehrere Konten gleichzeitig aktualsieren.
|
||||||
|
Z.B. alle Überweisungen der Bestellgruppen aus einem Kontoauszug.
|
||||||
|
|
||||||
|
= form_tag finance_create_transaction_collection_path do
|
||||||
%p
|
%p
|
||||||
%b Notiz
|
%b Notiz
|
||||||
= text_field_tag :note
|
= text_field_tag :note, params[:note], class: 'input-xlarge', required: 'required'
|
||||||
%p
|
%p
|
||||||
%table#ordergroups{:style => "width:20em"}
|
%table#ordergroups{:style => "width:20em"}
|
||||||
%tr
|
%tr
|
||||||
%th Bestellgruppe
|
%th Bestellgruppe
|
||||||
%th Betrag
|
%th Betrag
|
||||||
= render :partial => 'ordergroup', :collection => [1, 2, 3]
|
= render :partial => 'ordergroup', :collection => [1, 2, 3]
|
||||||
|
|
||||||
%p
|
%p
|
||||||
= link_to "Neue Bestellgruppe hinzufügen", '#', 'data-add-transaction' => true
|
= link_to "Weitere Bestellgruppe hinzufügen", '#', 'data-add-transaction' => true, class: 'btn'
|
||||||
%p
|
.form-actions
|
||||||
= submit_tag "Transaktionen speichern"
|
= submit_tag "Transaktionen speichern", class: 'btn btn-primary'
|
||||||
= link_to "oder abbrechen", finance_ordergroups_path
|
= link_to "oder abbrechen", finance_ordergroups_path
|
|
@ -1,9 +1,11 @@
|
||||||
%h2 Mengenänderung
|
= simple_form_for [:finance, @group_order_article], remote: true do |form|
|
||||||
%p
|
|
||||||
%b Artikel: #{@order_article.article.name}
|
|
||||||
|
|
||||||
- simple_form_for [:finance, @group_order_article], remote: true do |form|
|
|
||||||
= form.hidden_field :order_article_id
|
= form.hidden_field :order_article_id
|
||||||
|
.modal-header
|
||||||
|
= button_tag "x", class: 'close', data: {dismiss: 'modal'}
|
||||||
|
%h3 Mengenänderung für #{@order_article.article.name}
|
||||||
|
.modal-body
|
||||||
= form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] }
|
= form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] }
|
||||||
= form.input :result, hint: "Einheit: #{@order_article.article.unit}"
|
= form.input :result, hint: "Einheit: #{@order_article.article.unit}"
|
||||||
= form.submit 'Speichern'
|
.modal-footer
|
||||||
|
= button_tag "Schließen", class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= form.submit "Speichern", class: 'btn btn-primary'
|
|
@ -1 +1,2 @@
|
||||||
$.fancybox('#{escape_javascript(render('form'))}');
|
$('#modalContainer').html('#{j(render("form"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -1 +1,2 @@
|
||||||
$.fancybox('#{escape_javascript(render("form"))}');
|
$('#modalContainer').html('#{j(render("form"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -1,5 +1,3 @@
|
||||||
$.fancybox.close();
|
$('#modalContainer').modal('hide');
|
||||||
$('#order_article_#{@order_article.id}').
|
$('#order_article_#{@order_article.id}').html('#{j(render('finance/balancing/order_article', order_article: @order_article))}');
|
||||||
html('#{escape_javascript(render(partial: 'finance/balancing/order_article', locals: {order_article: @order_article}))}');
|
$('#group_order_articles_#{@order_article.id}').html('#{j(render('finance/balancing/group_order_articles', order_article: @order_article))}');
|
||||||
$('#group_order_articles_#{@order_article.id}').
|
|
||||||
html('#{escape_javascript(render(partial: 'finance/balancing/group_order_articles', locals: {order_article: @order_article}))}');
|
|
||||||
|
|
60
app/views/finance/index.html.haml
Normal file
60
app/views/finance/index.html.haml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
- title "Finanzbereich"
|
||||||
|
|
||||||
|
.row-fluid
|
||||||
|
.span6
|
||||||
|
%h2
|
||||||
|
Unbezahlte Rechnungen
|
||||||
|
%small= link_to "alle anzeigen", finance_invoices_path
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Datum
|
||||||
|
%th.numeric Betrag
|
||||||
|
%th Lieferantin
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- for invoice in @unpaid_invoices
|
||||||
|
%tr
|
||||||
|
%td= format_date(invoice.date)
|
||||||
|
%td.numeric= number_to_currency(invoice.amount)
|
||||||
|
%td= invoice.supplier.name
|
||||||
|
%td= link_to "Bearbeiten", edit_finance_invoice_path(invoice), class: 'btn btn-mini'
|
||||||
|
|
||||||
|
%h2
|
||||||
|
letzte Überweisungen
|
||||||
|
%small= link_to "alle anzeigen", finance_ordergroups_path
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Datum
|
||||||
|
%th Gruppe
|
||||||
|
%th Notiz
|
||||||
|
%th.numeric Betrag
|
||||||
|
%tbody
|
||||||
|
- @financial_transactions.each do |ft|
|
||||||
|
%tr
|
||||||
|
%td= format_date(ft.created_on)
|
||||||
|
%td= ft.ordergroup.name
|
||||||
|
%td= ft.note
|
||||||
|
%td.numeric{:style => "color:#{ft.amount < 0 ? 'red' : 'black'}"}= number_to_currency(ft.amount)
|
||||||
|
.span6
|
||||||
|
%h2
|
||||||
|
noch nicht abgerechnet
|
||||||
|
%small= link_to "alle anzeigen", finance_order_index_path
|
||||||
|
- unless @orders.empty?
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Lieferantin
|
||||||
|
%th Ende
|
||||||
|
%th.numeric Betrag(FC)
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- @orders.each do |order|
|
||||||
|
%tr
|
||||||
|
%td= order.name
|
||||||
|
%td= format_date(order.ends)
|
||||||
|
%td.numeric= number_to_currency(order.sum(:fc))
|
||||||
|
%td= link_to "Abrechnen", new_finance_order_path(order_id: order.id), class: 'btn btn-mini'
|
||||||
|
- else
|
||||||
|
Super, alles schon abgerechnet...
|
|
@ -9,10 +9,12 @@
|
||||||
|
|
||||||
= f.association :supplier, hint: false
|
= f.association :supplier, hint: false
|
||||||
= f.input :number
|
= f.input :number
|
||||||
= f.input :date
|
= f.input :date, as: :date_picker
|
||||||
= f.input :paid_on
|
= f.input :paid_on, as: :date_picker
|
||||||
= f.input :amount, as: :string
|
= f.input :amount, as: :string
|
||||||
= f.input :deposit, as: :string
|
= f.input :deposit, as: :string
|
||||||
= f.input :deposit_credit, as: :string
|
= f.input :deposit_credit, as: :string
|
||||||
= f.input :note
|
= f.input :note
|
||||||
= f.submit
|
.form-actions
|
||||||
|
= f.submit class: 'btn'
|
||||||
|
= link_to "oder abbrechen", :back
|
||||||
|
|
31
app/views/finance/invoices/_invoices.html.haml
Normal file
31
app/views/finance/invoices/_invoices.html.haml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
- if Invoice.count > 20
|
||||||
|
= items_per_page
|
||||||
|
= pagination_links_remote @invoices
|
||||||
|
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Nummer
|
||||||
|
%th Lieferantin
|
||||||
|
%th Datum
|
||||||
|
%th Bezahlt am
|
||||||
|
%th Betrag
|
||||||
|
%th Lieferung
|
||||||
|
%th Bestellung
|
||||||
|
%th Note
|
||||||
|
%th
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- for invoice in @invoices
|
||||||
|
%tr
|
||||||
|
%td= link_to h(invoice.number), finance_invoice_path(invoice)
|
||||||
|
%td= invoice.supplier.name
|
||||||
|
%td= format_date invoice.date
|
||||||
|
%td= format_date invoice.paid_on
|
||||||
|
%td= number_to_currency invoice.amount
|
||||||
|
%td= link_to "Lieferung", [invoice.supplier,invoice.delivery] if invoice.delivery
|
||||||
|
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
|
||||||
|
%td= truncate(invoice.note)
|
||||||
|
%td= link_to "Bearbeiten", edit_finance_invoice_path(invoice), class: 'btn btn-mini'
|
||||||
|
%td= link_to "Löschen", finance_invoice_path(invoice), :confirm => 'Are you sure?', :method => :delete,
|
||||||
|
class: 'btn btn-danger btn-mini'
|
|
@ -1,5 +1,2 @@
|
||||||
- title "Rechnung bearbeiten"
|
- title "Rechnung bearbeiten"
|
||||||
= render :partial => 'form'
|
= render :partial => 'form'
|
||||||
= link_to "Anzeigen", [:finance, @invoice]
|
|
||||||
|
|
|
||||||
\#{link_to 'Zurück', finance_invoices_path}
|
|
||||||
|
|
|
@ -1,30 +1,5 @@
|
||||||
- title "Rechnungen"
|
- title "Rechnungen"
|
||||||
%p= will_paginate @invoices
|
|
||||||
%table.list{:style => "width:70em"}
|
= link_to 'Neue Rechnung anlegen', new_finance_invoice_path, class: 'btn btn-primary'
|
||||||
%thead
|
|
||||||
%tr
|
#invoicesTable= render 'invoices'
|
||||||
%th Nummer
|
|
||||||
%th Lieferantin
|
|
||||||
%th Datum
|
|
||||||
%th Bezahlt am
|
|
||||||
%th Betrag
|
|
||||||
%th Lieferung
|
|
||||||
%th Bestellung
|
|
||||||
%th Note
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- for invoice in @invoices
|
|
||||||
%tr
|
|
||||||
%td= link_to h(invoice.number), finance_invoice_path(invoice)
|
|
||||||
%td= invoice.supplier.name
|
|
||||||
%td= format_date invoice.date
|
|
||||||
%td= format_date invoice.paid_on
|
|
||||||
%td= number_to_currency invoice.amount
|
|
||||||
%td= link_to "Lieferung", [invoice.supplier,invoice.delivery] if invoice.delivery
|
|
||||||
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
|
|
||||||
%td= truncate(invoice.note)
|
|
||||||
%td= link_to icon(:edit), edit_finance_invoice_path(invoice)
|
|
||||||
%td= link_to icon(:delete), finance_invoice_path(invoice), :confirm => 'Are you sure?', :method => :delete
|
|
||||||
%br/
|
|
||||||
= link_to 'Neue Rechnung anlegen', new_finance_invoice_path
|
|
||||||
|
|
1
app/views/finance/invoices/index.js.haml
Normal file
1
app/views/finance/invoices/index.js.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
$('#invoicesTable').html('#{j(render('invoices'))}');
|
|
@ -1,25 +1,19 @@
|
||||||
%h2 Artikel aktualisieren
|
= simple_form_for [:finance, @order, @order_article], remote: true do |form|
|
||||||
|
.modal-header
|
||||||
|
= button_tag "x", class: 'close', data: {dismiss: 'modal'}
|
||||||
|
%h3 Artikel aktualisieren
|
||||||
|
.modal-body
|
||||||
|
= form.input :units_to_order
|
||||||
|
|
||||||
= form_for [:finance, @order, @order_article], remote: true do |form|
|
= simple_fields_for @order_article.article do |f|
|
||||||
%table
|
= f.input :name
|
||||||
%tr
|
= f.input :order_number
|
||||||
%th Name
|
= f.input :unit
|
||||||
%th Nr.
|
= f.input :unit_quantity
|
||||||
%th
|
= f.input :price
|
||||||
%abbr{:title=>"Anzahl gelieferter Gebinde"} Menge
|
= f.input :tax
|
||||||
%th Einheit
|
= f.input :deposit
|
||||||
%th GebGr
|
|
||||||
%th Netto
|
.modal-footer
|
||||||
%th MwSt.
|
= button_tag "Schließen", class: 'btn', data: {dismiss: 'modal'}
|
||||||
%th Pfand
|
= form.submit class: 'btn btn-primary'
|
||||||
%tr
|
|
||||||
%td= text_field_tag 'article[name]', @order_article.article.name, :size => 20
|
|
||||||
%td= text_field_tag 'article[order_number]', @order_article.article.order_number, :size => 3
|
|
||||||
%td= text_field_tag 'order_article[units_to_order]', @order_article.units_to_order, :size => 5
|
|
||||||
%td= text_field_tag 'article[unit]', @order_article.article.unit, :size => 5
|
|
||||||
%td= text_field_tag 'price[unit_quantity]', @order_article.price.unit_quantity, :size => 3
|
|
||||||
%td= text_field_tag 'price[price]', @order_article.price.price, :size => 3
|
|
||||||
%td= text_field_tag 'price[tax]', @order_article.price.tax, :size => 3
|
|
||||||
%td= text_field_tag 'price[deposit]', @order_article.price.deposit, :size => 3
|
|
||||||
%br/
|
|
||||||
= submit_tag "Speichern"
|
|
|
@ -1,6 +1,9 @@
|
||||||
%h2
|
|
||||||
Neuer gelieferter Artikel die Bestellung
|
|
||||||
|
|
||||||
= simple_form_for [:finance, @order, @order_article], remote: true do |form|
|
= simple_form_for [:finance, @order, @order_article], remote: true do |form|
|
||||||
|
.modal-header
|
||||||
|
= button_tag "x", class: 'close', data: {dismiss: 'modal'}
|
||||||
|
%h3 Neuer gelieferter Artikel die Bestellung
|
||||||
|
.modal-body
|
||||||
= form.input :article_id, as: :select, collection: new_order_articles_collection
|
= form.input :article_id, as: :select, collection: new_order_articles_collection
|
||||||
= form.submit
|
.modal-footer
|
||||||
|
= button_tag "Schließen", class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= form.submit class: 'btn btn-primary'
|
|
@ -1,3 +1,2 @@
|
||||||
$.fancybox.close();
|
$('#modalContainer').modal('hide');
|
||||||
$('#result_table').
|
$('#result_table').prepend('#{j(render('finance/balancing/order_article_result', order_article: @order_article))}');
|
||||||
prepend('#{escape_javascript(render(partial: 'finance/balancing/order_article_result', locals: {order_article: @order_article}))}');
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
$.fancybox('#{escape_javascript(render("edit"))}');
|
$('#modalContainer').html('#{j(render("edit"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -1 +1,2 @@
|
||||||
$.fancybox('#{escape_javascript(render("new"))}');
|
$('#modalContainer').html('#{j(render("new"))}');
|
||||||
|
$('#modalContainer').modal();
|
|
@ -1,3 +1,2 @@
|
||||||
$.fancybox.close();
|
$('#modalContainer').modal('hide');
|
||||||
$('#order_article_#{@order_article.id}').
|
$('#order_article_#{@order_article.id}').html('#{j(render('finance/balancing/order_article', order_article: @order_article))}');
|
||||||
html('#{escape_javascript(render(partial: 'finance/balancing/order_article', locals: {order_article: @order_article}))}');
|
|
||||||
|
|
|
@ -1,30 +1,20 @@
|
||||||
%p
|
- if Ordergroup.count > 20
|
||||||
Gefunden:
|
|
||||||
= @ordergroups.size
|
|
||||||
%p
|
|
||||||
%table{:style => "width:100%"}
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= pagination_links_remote @ordergroups, :update => :ordergroups, :params => {:sort => params[:sort]}
|
|
||||||
%td{:style => "text-align:right"}
|
|
||||||
- if @ordergroups.size > 20
|
|
||||||
= items_per_page
|
= items_per_page
|
||||||
%table.list
|
= pagination_links_remote @ordergroups
|
||||||
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= sort_link_helper "Name", "name", :per_page => @per_page
|
%th= sort_link_helper "Name", "name", :per_page => @per_page
|
||||||
%th Kontakt
|
%th Kontakt
|
||||||
%th= sort_link_helper "Kontostand", "account_balance", :per_page => @per_page
|
%th.numeric= sort_link_helper "Kontostand", "account_balance", :per_page => @per_page
|
||||||
%th
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- for ordergroup in @ordergroups
|
- for ordergroup in @ordergroups
|
||||||
%tr{:class => cycle('even','odd', :name => 'ordergroups')}
|
%tr
|
||||||
%td= ordergroup.name
|
%td= ordergroup.name
|
||||||
%td= ordergroup.contact
|
%td= ordergroup.contact
|
||||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(ordergroup.account_balance)
|
%td.numeric= number_to_currency(ordergroup.account_balance)
|
||||||
%td{:class => "actions"}
|
%td
|
||||||
= link_to image_tag("euro_new.png", :size => "16x16", :alt => "Neue Transaktion", :border => "0"),
|
= link_to "Neue Transaktion", new_finance_ordergroup_transaction_path(ordergroup), class: 'btn btn-mini'
|
||||||
new_finance_ordergroup_transaction_path(ordergroup), :title => "Neue Transaktion"
|
= link_to "Kontoauszug", finance_ordergroup_transactions_path(ordergroup), class: 'btn btn-mini'
|
||||||
= link_to image_tag("b_browse.png", :size => "16x16", :border => "0", :alt => 'Kontoauszug'),
|
|
||||||
finance_ordergroup_transactions_path(ordergroup), :title => "Kontoauszug"
|
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
- title "Konten verwalten"
|
- title "Konten verwalten"
|
||||||
%p
|
|
||||||
%i
|
|
||||||
Um mehrer Transaktionen auf einmal anzulegen folge bitte diesem
|
|
||||||
= link_to "Link", finance_new_transaction_collection_path
|
|
||||||
|
|
||||||
.left_column{:style=>"width:50em"}
|
- content_for :sidebar do
|
||||||
.box_title
|
.well.well-small
|
||||||
%h2 Bestellgruppen
|
Hier kannst du mehrere Transaktionen gleichzeitig anlegen:
|
||||||
.column_content
|
= link_to "Neue Überweisungen eingeben", finance_new_transaction_collection_path, class: 'btn btn-primary'
|
||||||
#group_filter
|
|
||||||
= form_tag finance_ordergroups_path, :method => :get, :style=>"display:inline;", :id => 'ordergroup_search',
|
.well.well-small
|
||||||
:remote => true, 'data-submit-onchange' => true do
|
= form_tag finance_ordergroups_path, :method => :get, :remote => true,
|
||||||
%label{:for => 'article_name'} Suche nach Name:
|
'data-submit-onchange' => true, class: 'form-search' do
|
||||||
= text_field_tag :query, params[:query], :size => 10
|
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||||
#ordergroups
|
placeholder: 'Suchen ...'
|
||||||
|
|
||||||
|
#ordergroupsTable
|
||||||
= render :partial => "ordergroups"
|
= render :partial => "ordergroups"
|
||||||
%br/
|
|
||||||
- if @current_user.role_admin?
|
|
||||||
= link_to "Neue Bestellgruppe anlegen", new_admin_ordergroup_path
|
|
|
@ -1 +1 @@
|
||||||
$('#ordergroups').html('#{escape_javascript(render("ordergroups"))}');
|
$('#ordergroupsTable').html('#{escape_javascript(render("ordergroups"))}');
|
||||||
|
|
|
@ -33,4 +33,4 @@
|
||||||
%footer
|
%footer
|
||||||
%p
|
%p
|
||||||
Foodsoft, open source software to manage a non-profit food coop.
|
Foodsoft, open source software to manage a non-profit food coop.
|
||||||
#modalContainer.modal(tabindex="-1" role="dialog" style="display:none")
|
#modalContainer.modal.hide.fade(tabindex="-1" role="dialog")
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
%table.table.table-striped
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{class: sort_td_class_helper(:supplier)}
|
%th= sort_link_helper "Lieferantin", "supplier"
|
||||||
= sort_link_helper "Lieferantin", "supplier"
|
|
||||||
%th Start
|
%th Start
|
||||||
%th{class: sort_td_class_helper(:ends)}
|
%th= sort_link_helper "Ende", "ends"
|
||||||
= sort_link_helper "Ende", "ends"
|
|
||||||
%th Status
|
%th Status
|
||||||
%th{:colspan => "2"}
|
%th{:colspan => "2"}
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -371,6 +371,8 @@ de:
|
||||||
paid_on: Bezahlt am
|
paid_on: Bezahlt am
|
||||||
deposit: Pfand berechnet
|
deposit: Pfand berechnet
|
||||||
deposit_credit: Pfand gutgeschrieben
|
deposit_credit: Pfand gutgeschrieben
|
||||||
|
order_article:
|
||||||
|
units_to_order: Menge
|
||||||
|
|
||||||
|
|
||||||
hints:
|
hints:
|
||||||
|
@ -386,3 +388,5 @@ de:
|
||||||
supplier: ''
|
supplier: ''
|
||||||
message:
|
message:
|
||||||
private: Nachricht erscheint nicht im Foodsoft Posteingang
|
private: Nachricht erscheint nicht im Foodsoft Posteingang
|
||||||
|
order_article:
|
||||||
|
units_to_order: Anzahl gelieferter Gebinde
|
||||||
|
|
|
@ -32,8 +32,9 @@ SimpleNavigation::Configuration.run do |navigation|
|
||||||
end
|
end
|
||||||
|
|
||||||
primary.item :finance, 'Finanzen', '#', if: Proc.new { current_user.role_finance? } do |subnav|
|
primary.item :finance, 'Finanzen', '#', if: Proc.new { current_user.role_finance? } do |subnav|
|
||||||
|
subnav.item :finance_home, 'Übersicht', finance_root_path
|
||||||
subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil
|
subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil
|
||||||
subnav.item :balancing, 'Bestellungen abrechnen', finance_balancing_path, id: nil
|
subnav.item :balancing, 'Bestellungen abrechnen', finance_order_index_path, id: nil
|
||||||
subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil
|
subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,7 @@ Foodsoft::Application.routes.draw do
|
||||||
########### Finance
|
########### Finance
|
||||||
|
|
||||||
namespace :finance do
|
namespace :finance do
|
||||||
root :to => 'balancing#index'
|
root :to => 'base#index'
|
||||||
match 'balancing/list' => 'balancing#list', :as => 'balancing'
|
|
||||||
|
|
||||||
resources :order, controller: 'balancing', path: 'balancing' do
|
resources :order, controller: 'balancing', path: 'balancing' do
|
||||||
member do
|
member do
|
||||||
|
|
Loading…
Reference in a new issue