diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 172ad74..e1336b0 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -78,8 +78,22 @@ def ledger_journal #journal_operations is an array containing hash generated by plpgsql procedure typed : # accid int, pid int, jdate date, oldb real, balance real, newb real, jid int, jnumber int + @journal_operations = Report.report_ledger_journal(periods, from_account_number, to_account_number,current_user.current_company, @car, @unit, @project, @journal_type) + @diff = Hash.new + + @journal_operations.each do |jo| + if @diff[:"#{jo["accid"]}"].nil? + @diff[:"#{jo["accid"]}"] = jo["balance"].to_f + else + @diff[:"#{jo["accid"]}"] += jo["balance"].to_f + end + end + + @journal_operations = @journal_operations.paginate(:page => params[:page],:per_page => 1000) + + # TODO: determine diff end def subsidiary_ledger_balance @@ -151,6 +165,7 @@ def subsidiary_ledger_journal end end + @journal_operations = @journal_operations.paginate(:page => params[:page],:per_page => 1000) end def open_closed_operations @@ -175,8 +190,7 @@ def dagbok @unit = (unit == 'null' ? nil : Unit.find(unit)) @project = ( project == 'null' ? nil : Project.find(project)) @car = ( car == 'null' ? nil : Car.find(car)) - @journal_type = ( journal_type == 'null' ? nil : JournalType.find(journal_type)) - + @journal_type = ( journal_type == 'null' ? nil : JournalType.find(journal_type)) end private diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4af8a2f..31556fd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,7 @@ <%= stylesheet_link_tag 'dodo' %> <%= stylesheet_link_tag 'application' %> <%= stylesheet_link_tag 'jquery-ui' %> + <%= stylesheet_link_tag 'pagination' %> <%= javascript_include_tag :defaults %> <%= javascript_include_tag "dodo" %> <%= javascript_include_tag "date" %> diff --git a/app/views/reports/ledger_journal.html.erb b/app/views/reports/ledger_journal.html.erb index 81f3bd8..cf79b75 100644 --- a/app/views/reports/ledger_journal.html.erb +++ b/app/views/reports/ledger_journal.html.erb @@ -1,3 +1,4 @@ +

<%= current_user.current_company.to_s %> - <%= current_user.to_s %> (<%= Date.today %>)

<%= t(:ledger_balance_period, :scope=>:reports) %><%= title_to_periods_range({:from_period=>@first_period_to_balance, :to_period=>@last_period_to_balance}) %><%= result_from_date(:period => @result_from) %>

<% unless @unit.blank?%> @@ -15,6 +16,13 @@ <%#accid int, pid int, jdate date, oldb real, balance real, newb real, jid int, jnumber int%> +<%#= will_paginate @journal_operations %> + +
+ <%= will_paginate @journal_operations, :container => false %> +
+ + @@ -103,7 +111,7 @@ <%= number_with_precision(jo["newb"], :locale =>I18n.locale) %> <%end%> diff --git a/app/views/reports/subsidiary_ledger_journal.html.erb b/app/views/reports/subsidiary_ledger_journal.html.erb index a62e1a1..c079118 100644 --- a/app/views/reports/subsidiary_ledger_journal.html.erb +++ b/app/views/reports/subsidiary_ledger_journal.html.erb @@ -20,6 +20,9 @@ <% end %> +
+ <%= will_paginate @journal_operations %> +
- <%= number_with_precision(diff, :locale =>I18n.locale) %> + <%= number_with_precision(@diff[:"#{jo["accid"]}"], :locale =>I18n.locale) %>
diff --git a/public/stylesheets/pagination.css b/public/stylesheets/pagination.css new file mode 100644 index 0000000..cb0b7a9 --- /dev/null +++ b/public/stylesheets/pagination.css @@ -0,0 +1,54 @@ +/* + Document : pagination + Created on : 29 déc. 2011, 16:18:10 + Author : marven + Description: + Purpose of the stylesheet follows. +*/ + +.digg_pagination { + background: white; + cursor: default; + /* self-clearing method: */ } + .digg_pagination a, .digg_pagination span, .digg_pagination em { + padding: 0.2em 0.5em; + display: block; + float: left; + margin-right: 1px; } + .digg_pagination .disabled { + color: #999999; + border: 1px solid #dddddd; } + .digg_pagination .current { + font-style: normal; + font-weight: bold; + background: #2e6ab1; + color: white; + border: 1px solid #2e6ab1; } + .digg_pagination a { + text-decoration: none; + color: #105cb6; + border: 1px solid #9aafe5; } + .digg_pagination a:hover, .digg_pagination a:focus { + color: #000033; + border-color: #000033; } + .digg_pagination .page_info { + background: #2e6ab1; + color: white; + padding: 0.4em 0.6em; + width: 22em; + margin-bottom: 0.3em; + text-align: center; } + .digg_pagination .page_info b { + color: #000033; + background: #6aa6ed; + padding: 0.1em 0.25em; } + .digg_pagination:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; } + * html .digg_pagination { + height: 1%; } + *:first-child + html .digg_pagination { + overflow: hidden; }