Fixed finance module to work with bootstrap design.

This commit is contained in:
benni 2012-11-10 16:44:05 +01:00
parent 16de9124fe
commit 0236fb5a60
55 changed files with 440 additions and 486 deletions

View file

@ -1,4 +1,9 @@
%h2 Notiz bearbeiten
= simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f|
= f.input :note, inner_html: {size: "60x20"}
= f.submit
.modal-header
= 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'

View file

@ -1,15 +1,10 @@
%p{:style => "float:left"}
%b Lieferung bearbeiten
%p{:style => "float:right"}
= link_to "Artikel hinzufügen", new_finance_order_order_article_path(@order), remote: true
%h3 Bestellung bearbeiten
%table{:class => "ordered_articles", :style => "clear:both"}
%table.ordered-articles.table.table-striped
%thead
%tr
%th{colspan: "1", class: sort_td_class_helper("name")}
= sort_link_helper "Artikel", "name"
%th{class: sort_td_class_helper("order_number")}
= sort_link_helper "Nr.", "order_number"
%th= sort_link_helper "Artikel", "name"
%th= sort_link_helper "Nr.", "order_number"
%th Menge
%th GebGr * Einheit
%th Netto
@ -17,6 +12,8 @@
%th MwSt
%th Pfand
%th{:colspan => "2"}
= link_to "Artikel hinzufügen", new_finance_order_order_article_path(@order), remote: true,
class: 'btn btn-small'
%tbody#result_table
- for order_article in @articles
= render :partial => "order_article_result", :locals => {:order_article => order_article}

View file

@ -1,5 +1,5 @@
%td{:colspan => "7"}
%table
%table.table.table-striped
%thead
%tr
%td
@ -7,35 +7,35 @@
%td Einheiten
%td Gesamtpreis
%td{:colspan => "3",:style => "width:14em"}
= link_to '[Gruppe hinzufügen]', new_finance_group_order_article_path(order_article_id: order_article.id),
remote: true
= link_to 'Gruppe hinzufügen', 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])
%tr{:class => cycle('even', 'odd', :name => 'results')}[group_order_article]
%tr[group_order_article]
%td
%td{:style=>"width:50%"}
= group_order_article.group_order.ordergroup.name
%td{:id => "group_order_article_#{group_order_article.id}_quantity", :style => "white-space:nowrap"}
= group_order_article.result
= button_to "+", update_result_finance_group_order_article_path(group_order_article, modifier: '+'),
method: :put, remote: true, style: 'float:left'
= button_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
method: :put, remote: true
%td.currency
= link_to "+", update_result_finance_group_order_article_path(group_order_article, modifier: '+'),
method: :put, remote: true, class: 'btn btn-mini'
= link_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
method: :put, remote: true, class: 'btn btn-mini'
%td.numeric
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "")
%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"}
= link_to icon(:delete), finance_group_order_article_path(group_order_article), method: :delete,
remote: true
= link_to "Löschen", finance_group_order_article_path(group_order_article), method: :delete,
remote: true, class: 'btn btn-mini btn-danger'
%td
%tfoot
%tr{:class => cycle('even', 'odd', :name => 'results')}
%tr
%td
%td{:style => "width:8em"} Summe (FC-Preis)
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
= 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 => "")
%td{:colspan => "3"}
- reset_cycle('results')
%td{:colspan => "3"}

View file

@ -19,7 +19,8 @@
%td= order_article.price.tax
%td= order_article.price.deposit
%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
= link_to icon(:delete), finance_order_order_article_path(order_article.order, order_article), method: :delete,
remote: true, confirm: 'Bist du sicher?'
= 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'

View file

@ -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}
%tr{:id => "group_order_articles_#{order_article.id}", :class => "results", :style => "display:none"}

View 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

View file

@ -5,19 +5,23 @@
%table
%tr
%td Nettobetrag:
%td= number_to_currency(order.sum(:net))
%td.numeric= number_to_currency(order.sum(:net))
%tr
%td Bruttobetrag:
%td= number_to_currency(order.sum(:gross))
%td.numeric= number_to_currency(order.sum(:gross))
%tr
%td FC-Betrag:
%td= number_to_currency(order.sum(:fc))
%td.numeric= number_to_currency(order.sum(:fc))
%tr
%td Summe der Gruppenbeträge:
%td= number_to_currency(order.sum(:groups))
%td Gruppenbeträge:
%td.numeric= number_to_currency(order.sum(:groups))
%tr
%td FC Gewinn ohne Aufschlag:
%td= number_to_currency(order.profit(:without_markup => true))
%td
FC Gewinn
%small ohne Aufschlag:
%td.numeric= number_to_currency(order.profit(:without_markup => true))
%tr
%td FC Gewinn mit Aufschlag:
%td#order_profit= number_to_currency(order.profit)
%td
FC Gewinn
%small mit Aufschlag:
%td#order_profit.numeric= number_to_currency(order.profit)

View file

@ -1,16 +1,13 @@
-title "Bestellung abschließen"
%div{:style => "width: 40em"}
%p
Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.
%br/
Die Konten werden wie folgt belastet:
%table.list{:style => "width:35em"}
- for group_order in @order.group_orders
%tr{:class => cycle('even', 'odd')}
%td= group_order.ordergroup.name
%td= number_to_currency(group_order.price)
%p
%div{:style => "float:left"}
= button_to "Abschließen", close_finance_order_path(@order), method: :put
%div{:style => "float:right"}
= link_to 'Zurück zur Abrechnung', new_finance_order_path(order_id: @order.id)
%p
Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.
%br/
Die Konten werden wie folgt belastet:
%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)

View file

@ -1 +1,2 @@
$.fancybox('#{escape_javascript(render("edit_note"))}');
$('#modalContainer').html('#{j(render("edit_note"))}');
$('#modalContainer').modal();

View file

@ -1,63 +1,3 @@
%h1 Finanzbereich
.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)
- title "beendete Bestellungen"
.box_title
%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...
#ordersTable= render 'orders'

View file

@ -0,0 +1 @@
$('#ordersTable').html('#{j(render('orders'))}');

View file

@ -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

View file

@ -1,53 +1,49 @@
- title "#{@order.name} abrechnen"
.left_column{:style => 'width: 24em'}
.box_title
%h2 Zusammenfassung
.column_content#summary
= render :partial => "summary", :locals => {:order => @order}
- content_for :sidebar do
.well.well-small
%h3 Zusammenfassung
#summary= render 'summary', order: @order
- unless @order.stockit?
.middle_column{:style => 'width: 24em'}
.box_title
%h2 Rechnung
.column_content#invoice
= render :partial => "invoice", :locals => {:invoice => @order.invoice}
.well.well-small
%h3 Rechnung
#invoice= render 'invoice', invoice: @order.invoice
.right_column{:style => 'width: 20em'}
.box_title
%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
.well.well-small
%h3 Notizen/Protokoll
#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
.box_title
%h2 Kommentare
.column_content
#comments
= render :partial => 'shared/comments', locals: {comments: @order.comments}
.left_column{:style => 'width: 69%'}
.box_title
#editOrderNav
%ul
%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
.column_content
#results
= render partial: 'edit_results_by_articles'
%p= link_to_top
.well.well-small
%h3 Kommentare
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments}
.well.well-small
.btn-toolbar
.btn-group
- unless @order.invoice or @order.stockit?
= link_to "Rechnung anlegen", 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'
#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'}

View file

@ -1 +1 @@
$('#results').html('#{escape_javascript(render(partial: balancing_view_partial, locals: {order: @order}))}');
$('#results').html('#{j(render(balancing_view_partial, order: @order))}');

View file

@ -1,2 +1,2 @@
$.fancybox.close();
$('#note').html('#{escape_javascript(simple_format(@order.note))}');
$('#modalContainer').modal('hide');
$('#note').html('#{j(simple_format(@order.note))}');