i18n finance + controller

This commit is contained in:
Manuel Wiedenmann 2013-02-10 15:05:20 +07:00
parent 2d58054d1c
commit 8be93c33f8
13 changed files with 186 additions and 91 deletions

View File

@ -7,7 +7,7 @@ class Finance::BalancingController < Finance::BaseController
def new
@order = Order.find(params[:order_id])
flash.now.alert = "Achtung, Bestellung wurde schon abgerechnet" if @order.closed?
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
@comments = @order.comments
if params['sort']
@ -55,19 +55,19 @@ class Finance::BalancingController < Finance::BaseController
def close
@order = Order.find(params[:id])
@order.close!(@current_user)
redirect_to finance_root_url, notice: "Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert."
redirect_to finance_root_url, notice: t('finance.balancing.close.notice')
rescue => error
redirect_to new_finance_order_url(order_id: @order.id), alert: "Ein Fehler ist beim Abrechnen aufgetreten: #{error.message}"
redirect_to new_finance_order_url(order_id: @order.id), alert: t('finance.balancing.close.alert', message: error.message)
end
# Close the order directly, without automaticly updating ordergroups account balances
def close_direct
@order = Order.find(params[:id])
@order.close_direct!(@current_user)
redirect_to finance_balancing_url, notice: "Bestellung wurde geschlossen."
redirect_to finance_balancing_url, notice: t('finance.balancing.close_direct.notice')
rescue => error
redirect_to finance_balancing_url, alert: "Bestellung kann nicht geschlossen werden: #{error.message}"
redirect_to finance_balancing_url, alert: t('finance.balancing.close_direct.alert', message: error.message)
end
end

View File

@ -5,5 +5,5 @@
.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'
= button_tag t('.close'), class: 'btn', data: {dismiss: 'modal'}
= f.submit , class: 'btn btn-primary'

View File

@ -1,16 +1,16 @@
%table.ordered-articles.table.table-striped
%thead
%tr
%th= sort_link_helper "Artikel", "name"
%th= sort_link_helper "Nr.", "order_number"
%th Menge
%th GebGr * Einheit
%th Netto
%th Brutto
%th MwSt
%th Pfand
%th= sort_link_helper t('.article'), "name"
%th= sort_link_helper t('.number'), "order_number"
%th= t('.amount')
%th= t('.amount_per_unit')
%th= t('.net')
%th= t('.gross')
%th= t('.tax')
%th= t('.refund')
%th{:colspan => "2"}
= link_to "Artikel hinzufügen", new_finance_order_order_article_path(@order), remote: true,
= link_to t('.add_article'), new_finance_order_order_article_path(@order), remote: true,
class: 'btn btn-small'
%tbody#result_table
- for order_article in @articles

View File

@ -3,11 +3,11 @@
%thead
%tr
%td
%td{:style => "width:8em"} Gruppe
%td Einheiten
%td Gesamtpreis
%td{:style => "width:8em"}= t('.group')
%td= t('.units')
%td= t('.total')
%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 t('.add_group'), new_finance_group_order_article_path(order_article_id: order_article.id),
remote: true, class: 'btn btn-mini'
%tbody
- for group_order_article in order_article.group_order_articles.ordered.all(:include => [:group_order])
@ -33,7 +33,7 @@
%tfoot
%tr
%td
%td{:style => "width:8em"} Summe (FC-Preis)
%td{:style => "width:8em"}= t('total_fc')
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
= order_article.group_orders_sum[:quantity]
%td.numeric{:id => "group_orders_sum_price_#{order_article.id}"}

View File

@ -1,26 +1,26 @@
- if invoice
%table
%tr
%td Rechnungsnummer:
%td= t('.invoice_number')
%td= invoice.number
%tr
%td Rechnungsdatum:
%td= t('.invoice_date')
%td= invoice.date
%tr
%td Rechnungsbetrag:
%td= t('.invoice_amount')
%td.curreny= number_to_currency invoice.amount
%tr
%td - Pfand berechnet:
%td= t('.minus_refund_calculated')
%td.curreny= number_to_currency invoice.deposit
%tr
%td + Pfand gutgeschrieben:
%td= t('.plus_refund_credited')
%td.curreny= number_to_currency invoice.deposit_credit
%tr
%td pfandbereinigter Betrag:
%td= t('.refund_adjusted_amount')
%td.curreny= number_to_currency invoice.net_amount
%br/
= link_to "Rechnung bearbeiten", edit_finance_invoice_path(invoice)
= link_to t('.edit'), edit_finance_invoice_path(invoice)
- else
Eine Rechnung für diese Bestellung anlegen:
= link_to "Neue Rechnung erstellen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier)
= link_to t('.new'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier)

View File

@ -19,8 +19,8 @@
%td= order_article.price.tax
%td= order_article.price.deposit
%td
= link_to "Bearbeiten", edit_finance_order_order_article_path(order_article.order, order_article), remote: true,
= link_to t('.edit'), edit_finance_order_order_article_path(order_article.order, order_article), remote: true,
class: 'btn btn-mini'
%td
= link_to "Löschen", finance_order_order_article_path(order_article.order, order_article), method: :delete,
remote: true, confirm: 'Bist du sicher?', class: 'btn btn-danger btn-mini'
= link_to t('.delete'), finance_order_order_article_path(order_article.order, order_article), method: :delete,
remote: true, confirm: t('.confirm'), class: 'btn btn-danger btn-mini'

View File

@ -5,22 +5,22 @@
%table.table.table-striped
%thead
%tr
%th Name
%th Ende
%th Status
%th zuletzt bearbeitet von
%th= t('.name')
%th= t('.end')
%th= t('.state')
%th= t('.last_edited_by')
%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.closed? ? t('.cleared', amount: 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'
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
= link_to t('.close'), close_direct_finance_order_path(order),
:confirm => t('.confirm'), :method => :put, class: 'btn btn-mini'
- else
%i derzeit gibt es keine beendeten Bestellungen
%i= t('.no_closed_orders')

View File

@ -1,27 +1,27 @@
%b=h order.name
%br/
= "von #{format_date(order.starts)} bis #{format_date(order.ends)}"
= t('.duration', {starts: format_date(order.starts), ends: format_date(order.ends)})
%p
%table
%tr
%td Nettobetrag:
%td= t('.net_amount')
%td.numeric= number_to_currency(order.sum(:net))
%tr
%td Bruttobetrag:
%td= t('.gross_amount')
%td.numeric= number_to_currency(order.sum(:gross))
%tr
%td FC-Betrag:
%td= t('.fc_amount')
%td.numeric= number_to_currency(order.sum(:fc))
%tr
%td Gruppenbeträge:
%td= t('.groups_amount')
%td.numeric= number_to_currency(order.sum(:groups))
%tr
%td
FC Gewinn
%small ohne Aufschlag:
= t('.fc_profit')
%small= t('.without_extra_charge')
%td.numeric= number_to_currency(order.profit(:without_markup => true))
%tr
%td
FC Gewinn
%small mit Aufschlag:
= t('.fc_profit')
%small= t('.with_extra_charge')
%td#order_profit.numeric= number_to_currency(order.profit)

View File

@ -1,13 +1,10 @@
-title "Bestellung abschließen"
%p
Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.
%br/
Die Konten werden wie folgt belastet:
-title t('.title')
%p!= t('.first_paragraph')
%table.table.table-striped{:style => "width:35em"}
- for group_order in @order.group_orders
%tr{:class => cycle('even', 'odd')}
%td= group_order.ordergroup.name
%td.numeric= number_to_currency(group_order.price)
.form-actions
= link_to "Abschließen", close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
= link_to 'oder zurück zur Abrechnung', new_finance_order_path(order_id: @order.id)
= link_to t('.clear'), close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
= link_to t('.or_cancle'), new_finance_order_path(order_id: @order.id)

View File

@ -1,3 +1,3 @@
- title "beendete Bestellungen"
- title t('.title')
#ordersTable= render 'orders'

View File

@ -1,45 +1,45 @@
- title "#{@order.name} abrechnen"
- title t('.title', name: @order.name)
- content_for :sidebar do
.well.well-small
%h3 Zusammenfassung
%h3= t('.summary')
#summary= render 'summary', order: @order
.well.well-small
%h3 Rechnung
%h3= t('.invoice')
#invoice= render 'invoice', invoice: @order.invoice
.well.well-small
%h3 Notizen/Protokoll
%h3= t('.notes_and_journal')
#note
- unless @order.note.empty?
= simple_format @order.note
- else
%p Hier kannst Du deine Abrechnung kommentieren
= link_to "Notiz bearbeiten", edit_note_finance_order_path(@order), remote: true
%p= t('.comment_on_transaction')
= link_to t('.edit_note'), edit_note_finance_order_path(@order), remote: true
.well.well-small
%h3 Kommentare
%h3= t('.comments')
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments}
- content_for :actionbar do
.btn-group
- unless @order.invoice or @order.stockit?
= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
= link_to t('.create_invoice'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
class: 'btn'
- unless @order.closed?
= link_to "Bestellung abschließen", confirm_finance_order_path(@order), class: 'btn btn-primary'
= link_to t('.confirm_order'), 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
= t('.view_options')
%span.caret
%ul.dropdown-menu
%li= link_to 'Bestellung bearbeiten', new_finance_order_path(order_id: @order.id, view: 'edit_results'),
%li= link_to t('.edit_order'), 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'),
%li= link_to t('.groups_overview'), 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'),
%li= link_to t('.articles_overview'), new_finance_order_path(order_id: @order.id, view: 'articles_overview'),
remote: true
%section#results

View File

@ -1,16 +1,16 @@
- title "Finanzbereich"
- title t('.title')
.row-fluid
.span6
%h2
Unbezahlte Rechnungen
%small= link_to "alle anzeigen", finance_invoices_path
= t('.unpaid_invoices')
%small= link_to t('.show_all'), finance_invoices_path
%table.table.table-striped
%thead
%tr
%th Datum
%th.numeric Betrag
%th Lieferantin
%th= t('.date')
%th.numeric= t('.amount')
%th= t('.supplier')
%th
%tbody
- for invoice in @unpaid_invoices
@ -18,18 +18,18 @@
%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'
%td= link_to t('.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
%h2
letzte Überweisungen
%small= link_to "alle anzeigen", finance_ordergroups_path
= t('.last_transactions')
%small= link_to(t('.show_all'), finance_ordergroups_path)
%table.table.table-striped
%thead
%tr
%th Datum
%th Gruppe
%th Notiz
%th.numeric Betrag
%th= t('.date')
%th= t('.group')
%th= t('.note')
%th.numeric= t('.amount')
%tbody
- @financial_transactions.each do |ft|
%tr
@ -39,15 +39,15 @@
%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
= t('.open_transactions')
%small= link_to t('.show_all'), finance_order_index_path
- unless @orders.empty?
%table.table.table-striped
%thead
%tr
%th Lieferantin
%th Ende
%th.numeric Betrag(FC)
%th= t('.supplier')
%th= t('.end')
%th.numeric= t('.amount_fc')
%th
%tbody
- @orders.each do |order|
@ -55,6 +55,6 @@
%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'
%td= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini'
- else
Super, alles schon abgerechnet...
= t('.everything_cleared')

View File

@ -0,0 +1,98 @@
de:
finance:
index:
title: 'Finanzbereich'
unpaid_invoices: 'Unbezahlte Rechnungen'
show_all: 'alle anzeigen'
date: 'Datum'
amount: 'Betrag'
supplier: 'Lieferantin'
edit: 'Bearbeiten'
last_transactions: 'letzte Überweisungen'
group: 'Gruppe'
note: 'Notiz'
open_transactions: 'noch nicht abgerechnet'
end: 'Ende'
amount_fc: 'Betrag(FC)'
clear: 'Abrechnen'
everything_cleared: 'Super, alles schon abgerechnet...'
balancing:
close:
notice: 'Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert.'
alert: 'Ein Fehler ist beim Abrechnen aufgetreten: %{message}'
close_direct:
notice: 'Bestellung wurde geschlossen.'
alert: 'Bestellung kann nicht geschlossen werden: %{message}'
index:
title: 'beendete Bestellungen'
new:
alert: 'Achtung, Bestellung wurde schon abgerechnet'
title: '%{name} abrechnen'
summary: 'Zusammenfassung'
invoice: 'Rechnung'
notes_and_journal: 'Notizen/Protokoll'
comment_on_transaction: 'Hier kannst Du deine Abrechnung kommentieren'
edit_note: 'Notiz bearbeiten'
comments: 'Kommentare'
create_invoice: 'Rechnung anlegen'
confirm_order: 'Bestellung abschließen'
view_options: 'Ansichtsoptionen'
edit_order: 'Bestellung bearbeiten'
groups_overview: 'Gruppenübersicht'
articles_overview: 'Artikelübersicht'
confirm:
title: 'Bestellung abschließen'
first_paragraph: 'Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.<br />Die Konten werden wie folgt belastet:'
clear: 'Abschließen'
or_cancle: 'oder zurück zur Abrechnung'
summary:
duration: 'von %{starts} bis %{ends}'
net_amount: 'Nettobetrag:'
gross_amount: 'Bruttobetrag:'
fc_amount: 'FC-Betrag:'
groups_amount: 'Gruppenbeträge:'
fc_profit: 'FC Gewinn'
without_extra_charge: 'ohne Aufschlag:'
with_extra_charge: 'mit Aufschlag:'
orders:
name: 'Name'
end: 'Ende'
state: 'Status'
last_edited_by: 'zuletzt bearbeitet von'
cleared: 'abgerechnet (%{amount})'
clear: 'abrechnen'
close: 'direkt schließen'
confirm: 'Wirklich die Bestellung schließen setzen?'
no_closed_orders: 'derzeit gibt es keine beendeten Bestellungen'
order_article:
edit: 'Bearbeiten'
delete: 'Löschen'
confirm: 'Bist du sicher?'
invoice:
invoice_number: 'Rechnungsnummer:'
invoice_date: 'Rechnungsdatum:'
invoice_amount: 'Rechnungsbetrag:'
minus_refund_calculated: '- Pfand berechnet:'
plus_refund_credited: '+ Pfand gutgeschrieben:'
refund_adjusted_amount: 'pfandbereinigter Betrag:'
edit: 'Rechnung bearbeiten'
new: 'Neue Rechnung erstellen'
group_order_articles:
group: 'Gruppe'
units: 'Einheiten'
total: 'Gesamtpreis'
add_group: 'Gruppe hinzufügen'
total_fc: 'Summe (FC-Preis)'
edit_note:
close: 'Schließen'
save: 'Speichern'
edit_results_by_articles:
article: 'Artikel'
number: 'Nr.'
amount: 'Menge'
amount_per_unit: 'GebGr * Einheit'
net: 'Netto'
gross: 'Brutto'
tax: 'MwSt'
refund: 'Pfand'
add_article: 'Artikel hinzufügen'