has_accounts 0.18.4 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/accounts_controller.rb +49 -0
- data/app/controllers/bank_accounts_controller.rb +2 -0
- data/app/controllers/bookings_controller.rb +67 -0
- data/app/models/bank_account.rb +3 -0
- data/app/models/booking.rb +19 -16
- data/app/views/accounts/_account.html.haml +12 -0
- data/app/views/accounts/_booking_item.html.haml +15 -0
- data/app/views/accounts/_booking_list_footer.html.haml +2 -0
- data/app/views/accounts/_booking_list_header.html.haml +8 -0
- data/app/views/accounts/_booking_list_paginate.html.haml +5 -0
- data/app/views/accounts/_booking_list_saldo.html.haml +8 -0
- data/app/views/accounts/_booking_list_turnover.html.haml +8 -0
- data/app/views/accounts/_carry_booking.html.haml +9 -0
- data/app/views/accounts/_edit_booking.html.haml +14 -0
- data/app/views/accounts/_edit_bookings.html.haml +15 -0
- data/app/views/accounts/_form.html.haml +7 -0
- data/app/views/accounts/_list_footer.html.haml +2 -0
- data/app/views/accounts/_list_header.html.haml +5 -0
- data/app/views/accounts/_show.html.haml +9 -0
- data/app/views/accounts/_show_bookings.html.haml +19 -0
- data/app/views/accounts/edit_bookings.html.haml +5 -0
- data/app/views/accounts/edit_bookings.js.erb +2 -0
- data/app/views/accounts/index.html.haml +9 -0
- data/app/views/accounts/show.html.haml +10 -0
- data/app/views/bank_accounts/_bank_account.html.haml +1 -0
- data/app/views/bank_accounts/_form.html.haml +10 -0
- data/app/views/bookings/_booking.html.haml +17 -0
- data/app/views/bookings/_form.html.haml +28 -0
- data/app/views/bookings/_list.html.haml +16 -0
- data/app/views/bookings/_new_form.html.haml +5 -0
- data/app/views/bookings/_sidebar.html.haml +6 -0
- data/app/views/bookings/_simple_form.html.haml +25 -0
- data/app/views/bookings/new.html.haml +8 -0
- data/app/views/bookings/select.html.haml +11 -0
- data/app/views/bookings/show.html.haml +7 -0
- data/app/views/bookings/simple_edit.html.haml +4 -0
- data/config/locales/de.yml +12 -6
- data/config/locales/en.yml +3 -0
- data/config/routes.rb +35 -0
- data/lib/has_accounts/version.rb +1 -1
- metadata +37 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
class AccountsController < AuthorizedController
|
2
|
+
# Scopes
|
3
|
+
has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
|
4
|
+
has_scope :by_text
|
5
|
+
|
6
|
+
def index
|
7
|
+
@accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings)
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
@account = Account.find(params[:id])
|
12
|
+
@bookings = apply_scopes(Booking).includes(:debit_account => :account_type, :credit_account => :account_type).by_account(@account)
|
13
|
+
|
14
|
+
if params[:only_credit_bookings]
|
15
|
+
@bookings = @bookings.where(:credit_account_id => @account.id)
|
16
|
+
end
|
17
|
+
if params[:only_debit_bookings]
|
18
|
+
@bookings = @bookings.where(:debit_account_id => @account.id)
|
19
|
+
end
|
20
|
+
@bookings = @bookings
|
21
|
+
@carry_booking = @bookings.all.first
|
22
|
+
|
23
|
+
show!
|
24
|
+
end
|
25
|
+
|
26
|
+
def csv_bookings
|
27
|
+
@account = Account.find(params[:id])
|
28
|
+
@bookings = apply_scopes(Booking).by_account(@account)
|
29
|
+
send_csv @bookings, :only => [:value_date, :title, :comments, :amount, 'credit_account.code', 'debit_account.code'], :filename => "%s-%s.csv" % [@account.code, @account.title]
|
30
|
+
end
|
31
|
+
|
32
|
+
def edit_bookings
|
33
|
+
@account = Account.find(params[:id])
|
34
|
+
@bookings = apply_scopes(Booking).by_account(@account)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_bookings
|
38
|
+
bookings = params[:bookings]
|
39
|
+
|
40
|
+
bookings.each do |id, attributes|
|
41
|
+
attributes.merge!({:credit_account_id => Account.find_by_code(attributes[:credit_account_code]).id})
|
42
|
+
attributes.merge!({:debit_account_id => Account.find_by_code(attributes[:debit_account_code]).id})
|
43
|
+
Booking.find(id).update_attributes(attributes)
|
44
|
+
end
|
45
|
+
|
46
|
+
account = Account.find(params[:id])
|
47
|
+
redirect_to account
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class BookingsController < AuthorizedController
|
2
|
+
# Scopes
|
3
|
+
has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
|
4
|
+
has_scope :by_text
|
5
|
+
|
6
|
+
# Actions
|
7
|
+
def index
|
8
|
+
# @bookings = apply_scopes(Booking).accessible_by(current_ability, :list).includes(:credit_account, :debit_account).paginate(:page => params[:page], :per_page => params[:per_page])
|
9
|
+
index!
|
10
|
+
end
|
11
|
+
|
12
|
+
def new
|
13
|
+
@booking = Booking.new(:value_date => Date.today)
|
14
|
+
# Only include base class records
|
15
|
+
@booking_templates = BookingTemplate.where(:type => [nil, 'BookingTemplate']).where("NOT(code LIKE '%:%')").paginate(:page => params[:page])
|
16
|
+
new!
|
17
|
+
end
|
18
|
+
|
19
|
+
def select_booking
|
20
|
+
@booking = Booking.find(params[:id]).dup
|
21
|
+
|
22
|
+
# Clear reference
|
23
|
+
@booking.reference = nil
|
24
|
+
|
25
|
+
increment_booking_code
|
26
|
+
# Take value date from form
|
27
|
+
@booking.value_date = params[:booking][:value_date]
|
28
|
+
|
29
|
+
render :action => 'simple_edit'
|
30
|
+
end
|
31
|
+
|
32
|
+
def simple_edit
|
33
|
+
new!
|
34
|
+
end
|
35
|
+
|
36
|
+
def select
|
37
|
+
@booking = Booking.new(params[:booking])
|
38
|
+
increment_booking_code
|
39
|
+
@booking_templates = BookingTemplate.where(:type => [nil, 'BookingTemplate']).where("NOT(code LIKE '%:%')").paginate(:page => params[:page])
|
40
|
+
@bookings = Booking.where("title LIKE ?", '%' + @booking.title + '%').order('value_date DESC').paginate(:page => params[:page])
|
41
|
+
end
|
42
|
+
|
43
|
+
def create
|
44
|
+
@booking = Booking.new(params[:booking])
|
45
|
+
|
46
|
+
create! do |success, failure|
|
47
|
+
success.html do
|
48
|
+
redirect_to new_booking_path
|
49
|
+
end
|
50
|
+
failure.html {render 'edit'}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def copy
|
55
|
+
original_booking = Booking.find(params[:id])
|
56
|
+
|
57
|
+
@booking = original_booking.dup
|
58
|
+
|
59
|
+
render 'edit'
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def increment_booking_code
|
65
|
+
@booking.code = (Booking.maximum(:code) || 0) + 1
|
66
|
+
end
|
67
|
+
end
|
data/app/models/bank_account.rb
CHANGED
data/app/models/booking.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Booking < ActiveRecord::Base
|
2
2
|
# Access restrictions
|
3
|
-
attr_accessible :title, :comments, :amount, :
|
3
|
+
attr_accessible :title, :comments, :amount, :value_date, :code
|
4
4
|
|
5
5
|
# Validation
|
6
6
|
validates_presence_of :debit_account, :credit_account, :title, :value_date
|
@@ -12,7 +12,9 @@ class Booking < ActiveRecord::Base
|
|
12
12
|
|
13
13
|
# Account
|
14
14
|
belongs_to :debit_account, :foreign_key => 'debit_account_id', :class_name => "Account"
|
15
|
+
attr_accessible :debit_account, :debit_account_id
|
15
16
|
belongs_to :credit_account, :foreign_key => 'credit_account_id', :class_name => "Account"
|
17
|
+
attr_accessible :credit_account, :credit_account_id
|
16
18
|
|
17
19
|
def debit_account_code
|
18
20
|
debit_account.code
|
@@ -30,10 +32,10 @@ class Booking < ActiveRecord::Base
|
|
30
32
|
|
31
33
|
def direct_account
|
32
34
|
return nil unless reference
|
33
|
-
|
35
|
+
|
34
36
|
return reference.direct_account if reference.respond_to? :direct_account
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
def contra_account(account = nil)
|
38
40
|
# Derive from direct_account if available
|
39
41
|
account ||= direct_account
|
@@ -48,7 +50,7 @@ class Booking < ActiveRecord::Base
|
|
48
50
|
return nil
|
49
51
|
end
|
50
52
|
end
|
51
|
-
|
53
|
+
|
52
54
|
def balance_account
|
53
55
|
return credit_account if credit_account.is_balance_account?
|
54
56
|
return debit_account if debit_account.is_balance_account?
|
@@ -70,7 +72,7 @@ class Booking < ActiveRecord::Base
|
|
70
72
|
where("date(value_date) <= :to", :to => to)
|
71
73
|
end
|
72
74
|
}
|
73
|
-
|
75
|
+
|
74
76
|
scope :by_account, lambda {|account_id|
|
75
77
|
{ :conditions => ["debit_account_id = :account_id OR credit_account_id = :account_id", {:account_id => account_id}] }
|
76
78
|
} do
|
@@ -78,7 +80,7 @@ class Booking < ActiveRecord::Base
|
|
78
80
|
def titles
|
79
81
|
find(:all, :group => :title).map{|booking| booking.title}
|
80
82
|
end
|
81
|
-
|
83
|
+
|
82
84
|
# Statistics per booking title.
|
83
85
|
#
|
84
86
|
# The statistics are an array of hashes with keys title, count, sum, average.
|
@@ -89,21 +91,21 @@ class Booking < ActiveRecord::Base
|
|
89
91
|
|
90
92
|
scope :by_text, lambda {|value|
|
91
93
|
text = '%' + value + '%'
|
92
|
-
|
94
|
+
|
93
95
|
amount = value.delete("'").to_f
|
94
96
|
if amount == 0.0
|
95
97
|
amount = nil unless value.match(/^[0.]*$/)
|
96
98
|
end
|
97
|
-
|
99
|
+
|
98
100
|
date = nil
|
99
101
|
begin
|
100
102
|
date = Date.parse(value)
|
101
103
|
rescue ArgumentError
|
102
104
|
end
|
103
|
-
|
105
|
+
|
104
106
|
where("title LIKE :text OR comments LIKE :text OR amount = :amount OR value_date = :value_date", :text => text, :amount => amount, :value_date => date)
|
105
107
|
}
|
106
|
-
|
108
|
+
|
107
109
|
# Returns array of all years we have bookings for
|
108
110
|
def self.fiscal_years
|
109
111
|
with_exclusive_scope do
|
@@ -153,11 +155,11 @@ class Booking < ActiveRecord::Base
|
|
153
155
|
def amount_as_string
|
154
156
|
'%0.2f' % amount
|
155
157
|
end
|
156
|
-
|
158
|
+
|
157
159
|
def amount_as_string=(value)
|
158
160
|
self.amount = value
|
159
161
|
end
|
160
|
-
|
162
|
+
|
161
163
|
def rounded_amount
|
162
164
|
if amount.nil?
|
163
165
|
return 0
|
@@ -174,17 +176,18 @@ class Booking < ActiveRecord::Base
|
|
174
176
|
# Set amount
|
175
177
|
new_booking[:amount] = amount
|
176
178
|
self.amount -= amount
|
177
|
-
|
179
|
+
|
178
180
|
# Update attributes
|
179
181
|
params.each{|key, value|
|
180
182
|
new_booking[key] = value
|
181
183
|
}
|
182
|
-
|
184
|
+
|
183
185
|
[self, new_booking]
|
184
186
|
end
|
185
|
-
|
187
|
+
|
186
188
|
# Reference
|
187
189
|
belongs_to :reference, :polymorphic => true, :touch => true, :inverse_of => :bookings
|
190
|
+
attr_accessible :reference_id, :reference_type
|
188
191
|
|
189
192
|
after_save :touch_previous_reference
|
190
193
|
def touch_previous_reference
|
@@ -218,7 +221,7 @@ class Booking < ActiveRecord::Base
|
|
218
221
|
balance
|
219
222
|
end
|
220
223
|
end
|
221
|
-
|
224
|
+
|
222
225
|
private
|
223
226
|
def notify_references
|
224
227
|
return unless reference and reference.respond_to?(:booking_saved)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%tr[account]
|
2
|
+
%td= account.code
|
3
|
+
%td= link_to account.title, url_for(account), {'data-href-container' => 'tr'}, :by_value_period => params[:by_value_period]
|
4
|
+
- if @date
|
5
|
+
%td{:style => "text-align: right"}= currency_fmt(account.saldo(@date))
|
6
|
+
- elsif params[:by_value_period]
|
7
|
+
%td{:style => "text-align: right"}= currency_fmt(account.saldo(params[:by_value_period][:from]..params[:by_value_period][:to]))
|
8
|
+
- else
|
9
|
+
%td{:style => "text-align: right"}= currency_fmt(account.saldo)
|
10
|
+
%td.action-links
|
11
|
+
= list_link_for(:edit, account)
|
12
|
+
= list_link_for(:delete, account)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
%tr[@booking]
|
2
|
+
%td= @booking.value_date
|
3
|
+
%td
|
4
|
+
= link_to @booking.title, @booking, {'data-href-container' => 'tr'}
|
5
|
+
- if @booking.comments.present?
|
6
|
+
%hr{:style => "height: 1px; margin: 0"}/
|
7
|
+
%i= @booking.comments
|
8
|
+
%td= link_to @booking.reference.to_s(:reference), @booking.reference unless @booking.reference.nil?
|
9
|
+
%td.currency= (@booking.credit_account == @account) ? currency_fmt(@booking.amount) : content_tag('i', link_to(@booking.credit_account.code, account_path(@booking.credit_account), :title => @booking.credit_account.title))
|
10
|
+
%td.currency= (@booking.debit_account == @account) ? currency_fmt(@booking.amount) : content_tag('i', link_to(@booking.debit_account.code, account_path(@booking.debit_account), :title => @booking.debit_account.title))
|
11
|
+
%td.currency= currency_fmt(@saldo)
|
12
|
+
%td.action-links
|
13
|
+
= list_link_for(:edit, [@account, @booking])
|
14
|
+
= list_link_for(:delete, [@account, @booking], :remote => true)
|
15
|
+
= list_link_for(:copy, @booking)
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%tr
|
2
|
+
- ## TODO: See http://groups.google.com/group/will_paginate/browse_thread/thread/5d702999d78e47e5
|
3
|
+
- url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
|
4
|
+
%th{:colspan => "6", :style => "text-align: right"}= will_paginate @bookings, :params => url_params.merge(:query => params[:query])
|
5
|
+
%th
|
@@ -0,0 +1,8 @@
|
|
1
|
+
- credit_turnover, debit_turnover = @account.turnover(@bookings)
|
2
|
+
%tr#booking_list_turnover{:style => "border-top: double 2px black"}
|
3
|
+
%td{:colspan => "3"}
|
4
|
+
Umsatz (#{h @bookings.first.value_date} bis #{h @bookings.last.value_date})
|
5
|
+
%td{:style => "text-align: right"}= currency_fmt(credit_turnover)
|
6
|
+
%td{:style => "text-align: right"}= currency_fmt(debit_turnover)
|
7
|
+
%td
|
8
|
+
%td
|
@@ -0,0 +1,14 @@
|
|
1
|
+
%tr
|
2
|
+
= f.fields_for "", edit_booking do |f|
|
3
|
+
%td.span2= f.text_field :value_date, :style => 'width: 96%'
|
4
|
+
%td.span6
|
5
|
+
= f.text_field :title, :style => 'width: 98%'
|
6
|
+
= f.text_field :comments, :style => 'width: 98%'
|
7
|
+
= f.hidden_field :reference_type, :value => 'Invoice'
|
8
|
+
= f.select :reference_id, suggested_invoices_for_booking(f.object), :include_blank => true, :style => 'width: 98%', :class => 'combobox'
|
9
|
+
%td.span1= f.text_field :amount, :style => 'width: 94%'
|
10
|
+
|
11
|
+
%td.span1= f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :style => 'width: 94%', :wrapper => :inline
|
12
|
+
%td.span1= f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :style => 'width: 94%', :wrapper => :inline
|
13
|
+
|
14
|
+
%td{:style => 'display:none'}= f.hidden_field :id
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
|
2
|
+
= paginated_section @bookings, :params => url_params.merge(:query => params[:query]) do
|
3
|
+
= simple_form_for :bookings, :url => update_bookings_account_path do |f|
|
4
|
+
%table.table.table-striped
|
5
|
+
%thead
|
6
|
+
%tr
|
7
|
+
%th= t_attr :value_date, Booking
|
8
|
+
%th= t_attr :title, Booking
|
9
|
+
%th= t_attr :amount, Booking
|
10
|
+
%th= t_attr :credit_account, Booking
|
11
|
+
%th= t_attr :debit_account, Booking
|
12
|
+
%tbody
|
13
|
+
= render :partial => 'edit_booking', :collection => @bookings, :locals => {:f => f}
|
14
|
+
|
15
|
+
= f.button :submit
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.tabbable
|
2
|
+
%ul.nav.nav-tabs
|
3
|
+
%li.active= link_to t_title(:journal, Account), '#tab-bookings', {:data => {:toggle => 'tab'}}
|
4
|
+
%li= link_to t_title(:info, Account), '#tab-info', {:data => {:toggle => 'tab'}}
|
5
|
+
%li= link_to t_title(:list, Attachment), '#tab-attachments', {:data => {:toggle => 'tab'}}
|
6
|
+
|
7
|
+
.tab-content
|
8
|
+
#tab-bookings.tab-pane.active= render 'show_bookings'
|
9
|
+
#tab-info.tab-pane= render "form"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
- url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
|
2
|
+
|
3
|
+
%table.table.table-striped.bookings.collection
|
4
|
+
%thead
|
5
|
+
= render 'accounts/booking_list_header'
|
6
|
+
- @saldo = @account.saldo(@carry_booking, false)
|
7
|
+
%tbody
|
8
|
+
= render 'accounts/carry_booking' unless @saldo == 0
|
9
|
+
|
10
|
+
- for @booking in @bookings
|
11
|
+
- amount = @booking.amount
|
12
|
+
- amount = -(amount) if @account.is_liability_account?
|
13
|
+
- @saldo -= amount if @booking.debit_account == @account
|
14
|
+
- @saldo += amount if @booking.credit_account == @account
|
15
|
+
= render 'accounts/booking_item'
|
16
|
+
%tfoot
|
17
|
+
= render 'accounts/booking_list_footer' unless @bookings.empty?
|
18
|
+
= paginate @bookings
|
19
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.contextual
|
2
|
+
= icon_link_to 'only_credit_bookings', url_for(:only_credit_bookings => true) unless params[:only_credit_bookings]
|
3
|
+
= icon_link_to 'only_debit_bookings', url_for(:only_debit_bookings => true) unless params[:only_debit_bookings]
|
4
|
+
= icon_link_to 'all_bookings', @account if params[:only_credit_bookings] || params[:only_debit_bookings]
|
5
|
+
= contextual_links_for
|
6
|
+
|
7
|
+
= boot_page_title
|
8
|
+
= render 'show'
|
9
|
+
|
10
|
+
= render 'bookings/sidebar'
|
@@ -0,0 +1 @@
|
|
1
|
+
= render 'accounts/account', :account => bank_account
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- item_action ||= lambda{|object| url_for(object)}
|
2
|
+
|
3
|
+
%tr[booking]
|
4
|
+
%td= booking.value_date
|
5
|
+
%td
|
6
|
+
= link_to booking.title, item_action.call(booking), 'data-href-container' => 'tr'
|
7
|
+
- if booking.comments.present?
|
8
|
+
%hr{:style => "height: 1px; margin: 0"}/
|
9
|
+
%i= booking.comments
|
10
|
+
%td= link_to booking.reference.to_s(:reference), booking.reference unless booking.reference.nil?
|
11
|
+
%td= link_to booking.credit_account.code, account_path(booking.credit_account), :title => booking.credit_account.title unless booking.credit_account.nil?
|
12
|
+
%td= link_to booking.debit_account.code, account_path(booking.debit_account), :title => booking.debit_account.title unless booking.debit_account.nil?
|
13
|
+
%td.currency= currency_fmt(booking.amount)
|
14
|
+
%td.action-links
|
15
|
+
= list_link_for(:edit, booking)
|
16
|
+
= list_link_for(:delete, booking, :remote => true)
|
17
|
+
= list_link_for(:copy, booking)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= simple_form_for @booking do |f|
|
2
|
+
.row-fluid
|
3
|
+
.span6
|
4
|
+
= f.input :title, :input_html => {"data-autofocus" => true}
|
5
|
+
.span6
|
6
|
+
= f.input :value_date, :as => :date_field
|
7
|
+
.row-fluid
|
8
|
+
.span6
|
9
|
+
= f.input :amount, :as => :string, :input_html => {:size => 12}
|
10
|
+
.span6
|
11
|
+
= f.input :code
|
12
|
+
|
13
|
+
.row-fluid
|
14
|
+
.span6
|
15
|
+
= f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
|
16
|
+
.span6
|
17
|
+
= f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
|
18
|
+
|
19
|
+
.row-fluid
|
20
|
+
.span12
|
21
|
+
= f.input :comments, :input_html => {:rows => 4, :class => 'span12'}
|
22
|
+
|
23
|
+
.row-fluid
|
24
|
+
.span12
|
25
|
+
= f.input :reference_type, :as => :hidden, :input_html => {:value => 'Invoice'}
|
26
|
+
//= f.association :reference, :collection => suggested_invoices_for_booking(@booking, :include_all => true), :as => :combobox, :include_blank => true
|
27
|
+
|
28
|
+
= f.button :submit
|
@@ -0,0 +1,16 @@
|
|
1
|
+
%table.table.table-striped.bookings.collection
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th= t_attr :valuta
|
5
|
+
%th= t_attr :title
|
6
|
+
%th= t_attr :reference
|
7
|
+
%th= t_attr :credit_account
|
8
|
+
%th= t_attr :debit_account
|
9
|
+
%th.currency= t_attr 'amount'
|
10
|
+
%th.action-links
|
11
|
+
%tbody
|
12
|
+
= render collection, :item_action => (item_action ||= nil)
|
13
|
+
|
14
|
+
= paginate collection
|
15
|
+
|
16
|
+
= render 'bookings/sidebar'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
= simple_form_for @booking, :url => select_bookings_path do |f|
|
2
|
+
= hidden_field_tag :stage, 'select'
|
3
|
+
= f.input :title, :input_html => {'data-autofocus' => true}
|
4
|
+
= f.input :value_date, :as => :date_field, :input_html => {:size => 10, :style => 'text-align: right'}
|
5
|
+
= f.button :submit
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- filter_name = :by_value_period
|
2
|
+
- content_for :sidebar do
|
3
|
+
- filters = current_tenant.fiscal_years.reverse.map do |period|
|
4
|
+
- value = {"from" => period[:from].to_s(:db), "to" => period[:to].to_s(:db)}
|
5
|
+
- {:value => value, :title => period[:to].year}
|
6
|
+
= boot_nav_filter(filter_name, [{:title => :all, :value => nil}] + filters)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
= simple_form_for @booking do |f|
|
2
|
+
|
3
|
+
.row-fluid
|
4
|
+
.span6
|
5
|
+
= f.input :title, :input_html => {"data-autofocus" => true}
|
6
|
+
.span6
|
7
|
+
= f.input :value_date, :as => :date_field
|
8
|
+
.row-fluid
|
9
|
+
.span6
|
10
|
+
= f.input :amount, :as => :string, :input_html => {:size => 12}
|
11
|
+
.span6
|
12
|
+
= f.input :code
|
13
|
+
|
14
|
+
.row-fluid
|
15
|
+
.span6
|
16
|
+
= f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
|
17
|
+
.span6
|
18
|
+
= f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
|
19
|
+
|
20
|
+
.row-fluid
|
21
|
+
.span12
|
22
|
+
= f.input :comments, :input_html => {:rows => 4}
|
23
|
+
|
24
|
+
= f.button :submit
|
25
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
= contextual_links
|
2
|
+
|
3
|
+
= boot_page_title :new
|
4
|
+
|
5
|
+
= render 'form'
|
6
|
+
|
7
|
+
%h3= t_model(BookingTemplate)
|
8
|
+
= render 'booking_templates/list', :item_action => lambda{|object| new_booking_booking_template_path(object)}
|
9
|
+
|
10
|
+
%h3= t_model(Booking)
|
11
|
+
= render 'bookings/list', :item_action => lambda{|object| select_booking_booking_path(object, :booking => params[:booking])}
|
data/config/locales/de.yml
CHANGED
@@ -45,18 +45,24 @@ de:
|
|
45
45
|
value: Betrag
|
46
46
|
|
47
47
|
# Title customizations
|
48
|
-
|
48
|
+
accounts:
|
49
49
|
index:
|
50
|
-
title:
|
51
|
-
|
50
|
+
title: Kontenplan
|
51
|
+
bank_accounts:
|
52
52
|
index:
|
53
53
|
title: Bankkonti
|
54
|
-
|
54
|
+
banks:
|
55
55
|
index:
|
56
56
|
title: Banken
|
57
|
-
|
57
|
+
account_types:
|
58
58
|
index:
|
59
59
|
title: Kontentypen
|
60
|
-
|
60
|
+
bookings:
|
61
61
|
index:
|
62
62
|
title: Buchungsjournal
|
63
|
+
copy:
|
64
|
+
title: Buchung kopieren
|
65
|
+
|
66
|
+
crud:
|
67
|
+
action:
|
68
|
+
copy: Kopieren
|
data/config/locales/en.yml
CHANGED
data/config/routes.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Routes
|
4
|
+
Rails.application.routes.draw do
|
5
|
+
# Bookings
|
6
|
+
resources :bookings do
|
7
|
+
collection do
|
8
|
+
post :select
|
9
|
+
get :simple_edit
|
10
|
+
end
|
11
|
+
member do
|
12
|
+
get :select_booking
|
13
|
+
get :copy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
resources :accounts do
|
18
|
+
member do
|
19
|
+
get :csv_bookings
|
20
|
+
get :edit_bookings
|
21
|
+
post :update_bookings
|
22
|
+
end
|
23
|
+
resources :bookings
|
24
|
+
resources :attachments
|
25
|
+
end
|
26
|
+
|
27
|
+
resources :banks
|
28
|
+
resources :bank_accounts do
|
29
|
+
member do
|
30
|
+
get :csv_bookings
|
31
|
+
end
|
32
|
+
resources :bookings
|
33
|
+
resources :attachments
|
34
|
+
end
|
35
|
+
end
|
data/lib/has_accounts/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_accounts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -85,6 +85,9 @@ extra_rdoc_files:
|
|
85
85
|
- MIT-LICENSE
|
86
86
|
- README.md
|
87
87
|
files:
|
88
|
+
- app/controllers/accounts_controller.rb
|
89
|
+
- app/controllers/bank_accounts_controller.rb
|
90
|
+
- app/controllers/bookings_controller.rb
|
88
91
|
- app/helpers/account_helper.rb
|
89
92
|
- app/models/account.rb
|
90
93
|
- app/models/account_scope_extension.rb
|
@@ -92,8 +95,40 @@ files:
|
|
92
95
|
- app/models/bank.rb
|
93
96
|
- app/models/bank_account.rb
|
94
97
|
- app/models/booking.rb
|
98
|
+
- app/views/accounts/_account.html.haml
|
99
|
+
- app/views/accounts/_booking_item.html.haml
|
100
|
+
- app/views/accounts/_booking_list_footer.html.haml
|
101
|
+
- app/views/accounts/_booking_list_header.html.haml
|
102
|
+
- app/views/accounts/_booking_list_paginate.html.haml
|
103
|
+
- app/views/accounts/_booking_list_saldo.html.haml
|
104
|
+
- app/views/accounts/_booking_list_turnover.html.haml
|
105
|
+
- app/views/accounts/_carry_booking.html.haml
|
106
|
+
- app/views/accounts/_edit_booking.html.haml
|
107
|
+
- app/views/accounts/_edit_bookings.html.haml
|
108
|
+
- app/views/accounts/_form.html.haml
|
109
|
+
- app/views/accounts/_list_footer.html.haml
|
110
|
+
- app/views/accounts/_list_header.html.haml
|
111
|
+
- app/views/accounts/_show.html.haml
|
112
|
+
- app/views/accounts/_show_bookings.html.haml
|
113
|
+
- app/views/accounts/edit_bookings.html.haml
|
114
|
+
- app/views/accounts/edit_bookings.js.erb
|
115
|
+
- app/views/accounts/index.html.haml
|
116
|
+
- app/views/accounts/show.html.haml
|
117
|
+
- app/views/bank_accounts/_bank_account.html.haml
|
118
|
+
- app/views/bank_accounts/_form.html.haml
|
119
|
+
- app/views/bookings/_booking.html.haml
|
120
|
+
- app/views/bookings/_form.html.haml
|
121
|
+
- app/views/bookings/_list.html.haml
|
122
|
+
- app/views/bookings/_new_form.html.haml
|
123
|
+
- app/views/bookings/_sidebar.html.haml
|
124
|
+
- app/views/bookings/_simple_form.html.haml
|
125
|
+
- app/views/bookings/new.html.haml
|
126
|
+
- app/views/bookings/select.html.haml
|
127
|
+
- app/views/bookings/show.html.haml
|
128
|
+
- app/views/bookings/simple_edit.html.haml
|
95
129
|
- config/locales/de.yml
|
96
130
|
- config/locales/en.yml
|
131
|
+
- config/routes.rb
|
97
132
|
- db/migrate/20111108000000_create_has_accounts_tables.rb
|
98
133
|
- db/migrate/20111109093857_use_string_for_account_number.rb
|
99
134
|
- db/migrate/20111230121259_bank_now_inherits_from_person.rb
|