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 @@ +
- <%= number_with_precision(diff, :locale =>I18n.locale) %> + <%= number_with_precision(@diff[:"#{jo["accid"]}"], :locale =>I18n.locale) %> |