Created namespace 'finance' and moved invoices into it.
This commit is contained in:
parent
30f3d199d3
commit
1d85b880f2
17 changed files with 163 additions and 133 deletions
|
@ -1,4 +1,4 @@
|
||||||
class InvoicesController < ApplicationController
|
class Finance::InvoicesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@invoices = Invoice.find(:all, :order => "date DESC")
|
@invoices = Invoice.find(:all, :order => "date DESC")
|
||||||
|
@ -39,7 +39,7 @@ class InvoicesController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @invoice.save
|
if @invoice.save
|
||||||
flash[:notice] = 'Invoice was successfully created.'
|
flash[:notice] = 'Invoice was successfully created.'
|
||||||
format.html { redirect_to(@invoice) }
|
format.html { redirect_to([:finance, @invoice]) }
|
||||||
format.xml { render :xml => @invoice, :status => :created, :location => @invoice }
|
format.xml { render :xml => @invoice, :status => :created, :location => @invoice }
|
||||||
else
|
else
|
||||||
format.html { render :action => "new" }
|
format.html { render :action => "new" }
|
||||||
|
@ -56,7 +56,7 @@ class InvoicesController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @invoice.update_attributes(params[:invoice])
|
if @invoice.update_attributes(params[:invoice])
|
||||||
flash[:notice] = 'Invoice was successfully updated.'
|
flash[:notice] = 'Invoice was successfully updated.'
|
||||||
format.html { redirect_to(@invoice) }
|
format.html { redirect_to([:finance, @invoice]) }
|
||||||
format.xml { head :ok }
|
format.xml { head :ok }
|
||||||
else
|
else
|
||||||
format.html { render :action => "edit" }
|
format.html { render :action => "edit" }
|
||||||
|
@ -72,7 +72,7 @@ class InvoicesController < ApplicationController
|
||||||
@invoice.destroy
|
@invoice.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(invoices_path) }
|
format.html { redirect_to(finance_invoices_path) }
|
||||||
format.xml { head :ok }
|
format.xml { head :ok }
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -12,6 +12,7 @@ class FinanceController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@financial_transactions = FinancialTransaction.find(:all, :order => "created_on DESC", :limit => 8)
|
@financial_transactions = FinancialTransaction.find(:all, :order => "created_on DESC", :limit => 8)
|
||||||
@orders = Order.find(:all, :conditions => 'finished = 1 AND booked = 0', :order => 'ends DESC')
|
@orders = Order.find(:all, :conditions => 'finished = 1 AND booked = 0', :order => 'ends DESC')
|
||||||
|
@unpaid_invoices = Invoice.unpaid
|
||||||
end
|
end
|
||||||
|
|
||||||
#list all ordergroups
|
#list all ordergroups
|
||||||
|
|
|
@ -21,6 +21,8 @@ class Invoice < ActiveRecord::Base
|
||||||
validates_presence_of :supplier_id
|
validates_presence_of :supplier_id
|
||||||
validates_uniqueness_of :date, :scope => [:supplier_id]
|
validates_uniqueness_of :date, :scope => [:supplier_id]
|
||||||
|
|
||||||
|
named_scope :unpaid, :conditions => { :paid_on => nil }
|
||||||
|
|
||||||
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
|
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
|
||||||
def amount=(amount)
|
def amount=(amount)
|
||||||
self[:amount] = String.delocalized_decimal(amount)
|
self[:amount] = String.delocalized_decimal(amount)
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
%h1 Finanzbereich
|
%h1 Finanzbereich
|
||||||
.left_column{:style => 'width: 50%'}
|
.left_column{:style => 'width: 50%'}
|
||||||
|
.box_title
|
||||||
|
%h2 Unpaid invoices
|
||||||
|
.column_content
|
||||||
|
%p= link_to "Show all invoices", invoices_path
|
||||||
|
%table.list
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Date
|
||||||
|
%th Amount
|
||||||
|
%th Supplier
|
||||||
|
%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 "Edit", edit_invoice_path(invoice)
|
||||||
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2 letzte Überweisungen
|
%h2 letzte Überweisungen
|
||||||
.column_content
|
.column_content
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h1>Editing invoice</h1>
|
<h1>Editing invoice</h1>
|
||||||
|
|
||||||
<% form_for(@invoice) do |f| %>
|
<% form_for([:finance, @invoice]) do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -32,5 +32,5 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to 'Show', @invoice %> |
|
<%= link_to 'Show', [:finance, @invoice] %> |
|
||||||
<%= link_to 'Back', invoices_path %>
|
<%= link_to 'Back', finance_invoices_path %>
|
38
app/views/finance/invoices/index.html.erb
Normal file
38
app/views/finance/invoices/index.html.erb
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<% title "Invoices" %>
|
||||||
|
|
||||||
|
<table class="list" style="width:70em">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Supplier</th>
|
||||||
|
<th>Number</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Paid on</th>
|
||||||
|
<th>Amount</th>
|
||||||
|
<th>Delivery</th>
|
||||||
|
<th>Note</th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% for invoice in @invoices %>
|
||||||
|
<tr>
|
||||||
|
<td><%=h invoice.supplier.name %></td>
|
||||||
|
<td><%=h invoice.number %></td>
|
||||||
|
<td><%= invoice.date %></td>
|
||||||
|
<td><%= invoice.paid_on %></td>
|
||||||
|
<td><%= invoice.amount %></td>
|
||||||
|
<td><%=h invoice.delivery_id %></td>
|
||||||
|
<td><%=h truncate(invoice.note) %></td>
|
||||||
|
<td><%= link_to 'Show', finance_invoice_path(invoice) %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_finance_invoice_path(invoice) %></td>
|
||||||
|
<td><%= link_to 'Destroy', finance_invoice_path(invoice), :confirm => 'Are you sure?', :method => :delete %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<%= link_to 'New invoice', new_finance_invoice_path %>
|
|
@ -1,6 +1,6 @@
|
||||||
<h1>New invoice</h1>
|
<h1>New invoice</h1>
|
||||||
|
|
||||||
<% form_for(@invoice) do |f| %>
|
<% form_for([:finance, @invoice]) do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -32,4 +32,4 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to 'Back', invoices_path %>
|
<%= link_to 'Back', finance_invoices_path %>
|
|
@ -36,5 +36,5 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_invoice_path(@invoice) %> |
|
<%= link_to 'Edit', edit_finance_invoice_path(@invoice) %> |
|
||||||
<%= link_to 'Back', invoices_path %>
|
<%= link_to 'Back', finance_invoices_path %>
|
|
@ -3,8 +3,8 @@
|
||||||
#start_nav
|
#start_nav
|
||||||
= render :partial => 'start_nav'
|
= render :partial => 'start_nav'
|
||||||
|
|
||||||
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
|
|
||||||
.right_column{:style => "width:70%"}
|
.right_column{:style => "width:70%"}
|
||||||
|
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
|
||||||
.box_title
|
.box_title
|
||||||
%h2=_ "Tasks"
|
%h2=_ "Tasks"
|
||||||
.column_content
|
.column_content
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
%p{:style => "clear:both"}= link_to _("My tasks"), :controller => "tasks", :action => "myTasks"
|
%p{:style => "clear:both"}= link_to _("My tasks"), :controller => "tasks", :action => "myTasks"
|
||||||
|
|
||||||
- unless @messages.empty?
|
- unless @messages.empty?
|
||||||
.right_column{:style => "width:70%"}
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2=_ "Unread messages"
|
%h2=_ "Unread messages"
|
||||||
.column_content
|
.column_content
|
||||||
|
@ -39,9 +38,7 @@
|
||||||
// Current orders
|
// Current orders
|
||||||
= render :partial => 'ordering/currentOrders'
|
= render :partial => 'ordering/currentOrders'
|
||||||
|
|
||||||
|
|
||||||
// OrderGroup overview
|
// OrderGroup overview
|
||||||
.right_column{:style => "width:70%"}
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2=_ "My ordergroup"
|
%h2=_ "My ordergroup"
|
||||||
.column_content
|
.column_content
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<% title "Invoices" %>
|
|
||||||
|
|
||||||
<table class="list" style="width:70em">
|
|
||||||
<tr>
|
|
||||||
<th>Supplier</th>
|
|
||||||
<th>Number</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Paid on</th>
|
|
||||||
<th>Amount</th>
|
|
||||||
<th>Delivery</th>
|
|
||||||
<th>Note</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% for invoice in @invoices %>
|
|
||||||
<tr>
|
|
||||||
<td><%=h invoice.supplier.name %></td>
|
|
||||||
<td><%=h invoice.number %></td>
|
|
||||||
<td><%= invoice.date %></td>
|
|
||||||
<td><%= invoice.paid_on %></td>
|
|
||||||
<td><%= invoice.amount %></td>
|
|
||||||
<td><%=h invoice.delivery_id %></td>
|
|
||||||
<td><%=h truncate(invoice.note) %></td>
|
|
||||||
<td><%= link_to 'Show', invoice %></td>
|
|
||||||
<td><%= link_to 'Edit', edit_invoice_path(invoice) %></td>
|
|
||||||
<td><%= link_to 'Destroy', invoice, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%= link_to 'New invoice', new_invoice_path %>
|
|
|
@ -31,7 +31,7 @@
|
||||||
:subnav => [
|
:subnav => [
|
||||||
{ :name => "Ordergroups", :url => "/finance/listOrdergroups" },
|
{ :name => "Ordergroups", :url => "/finance/listOrdergroups" },
|
||||||
{ :name => "Balance orders", :url => "/finance/listOrders" },
|
{ :name => "Balance orders", :url => "/finance/listOrders" },
|
||||||
{ :name => "Invoices", :url => invoices_path }
|
{ :name => "Invoices", :url => finance_invoices_path }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ :name => "Administration", :url => "/admin", :active => ["admin"],
|
{ :name => "Administration", :url => "/admin", :active => ["admin"],
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
- if @orderGroup
|
|
||||||
.right_column{:style => "width:70%"}
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2=_ "Running orders"
|
%h2=_ "Running orders"
|
||||||
.column_content
|
.column_content
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
%th= _('Available')
|
%th= _('Available')
|
||||||
%th{:class => "currency"}= number_to_currency(@orderGroup.account_balance - @currentOrdersValue - @nonbookedOrdersValue)
|
%th{:class => "currency"}= number_to_currency(@orderGroup.account_balance - @currentOrdersValue - @nonbookedOrdersValue)
|
||||||
|
|
||||||
|
.right_column{:style => "width:70%"}
|
||||||
// Current Orders
|
// Current Orders
|
||||||
|
- if @orderGroup
|
||||||
= render :partial => "currentOrders"
|
= render :partial => "currentOrders"
|
||||||
|
|
||||||
// finished, nonbooked Orders
|
// finished, nonbooked Orders
|
||||||
- unless @finishedOrders.empty?
|
- unless @finishedOrders.empty?
|
||||||
.right_column{:style => "width:70%"}
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2= _('unrecorded orders')
|
%h2= _('unrecorded orders')
|
||||||
.column_content
|
.column_content
|
||||||
|
@ -36,7 +37,6 @@
|
||||||
|
|
||||||
// bookedOrders
|
// bookedOrders
|
||||||
- unless @bookedOrders.empty?
|
- unless @bookedOrders.empty?
|
||||||
.right_column{:style => "width:70%"}
|
|
||||||
.box_title
|
.box_title
|
||||||
%h2= _('balanced orders')
|
%h2= _('balanced orders')
|
||||||
.column_content
|
.column_content
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
ActionController::Routing::Routes.draw do |map|
|
ActionController::Routing::Routes.draw do |map|
|
||||||
|
|
||||||
map.resources :invoices
|
map.namespace :finance do |finance|
|
||||||
|
finance.resources :invoices
|
||||||
|
end
|
||||||
|
|
||||||
|
#map.resources :invoices
|
||||||
map.resources :suppliers,
|
map.resources :suppliers,
|
||||||
:has_many => [:deliveries],
|
:has_many => [:deliveries],
|
||||||
:collection => { :shared_suppliers => :get }
|
:collection => { :shared_suppliers => :get }
|
||||||
|
|
|
@ -291,7 +291,8 @@ div.box_title {
|
||||||
div.column_content {
|
div.column_content {
|
||||||
background: #e4eed6;
|
background: #e4eed6;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 10px; }
|
padding: 10px;
|
||||||
|
margin-bottom: 2em; }
|
||||||
div.column_content h2 {
|
div.column_content h2 {
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
|
|
|
@ -291,7 +291,8 @@ div.box_title {
|
||||||
div.column_content {
|
div.column_content {
|
||||||
background: #e4eed6;
|
background: #e4eed6;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 10px; }
|
padding: 10px;
|
||||||
|
margin-bottom: 2em; }
|
||||||
div.column_content h2 {
|
div.column_content h2 {
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
|
|
|
@ -329,6 +329,7 @@ div.column_content
|
||||||
:background = !boxContent
|
:background = !boxContent
|
||||||
:color black
|
:color black
|
||||||
:padding 10px
|
:padding 10px
|
||||||
|
margin-bottom: 2em
|
||||||
h2
|
h2
|
||||||
:color black
|
:color black
|
||||||
:font-size 1.3em
|
:font-size 1.3em
|
||||||
|
|
Loading…
Reference in a new issue