Merge pull request #61 from internetee/107279984-credit_balance

107279984 credit balance
This commit is contained in:
Timo Võhmar 2016-01-12 14:33:08 +02:00
commit 8e79e67d9d
6 changed files with 49 additions and 5 deletions

View file

@ -29,13 +29,24 @@
.form-group
= f.label t(:receipt_date_until)
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:receipt_date_until), autocomplete: 'off'
.col-md-6{style: 'padding-top: 25px;'}
.col-md-3
.form-group
= label_tag t(:results_per_page)
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-default.search
 
%span.glyphicon.glyphicon-search
 
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
.row
.col-md-3
.col-md-3
.col-md-2
.col-md-4{class: 'text-right'}
= t(:starting_balance) + " #{@sum.to_a.map(&:sum).sum.to_f} EUR"
%hr
.row
@ -55,6 +66,7 @@
%th{class: 'col-xs-2'}
= sort_link(@q, 'sum')
%tbody
-total = @sum.to_a.map(&:sum).sum.to_f
- @account_activities.each do |x|
%tr
%td= link_to(x.account.registrar.try(:code), admin_registrar_path(x.account.registrar))
@ -63,7 +75,15 @@
%td= l(x.created_at)
- c = x.sum > 0.0 ? 'text-success' : 'text-danger'
- s = x.sum > 0.0 ? "+#{x.sum} #{x.currency}" : "#{x.sum} #{x.currency}"
-total += x.sum
%td{class: c}= s
- if @account_activities.count > 0
%tr
%td
%td
%td
%td{class: 'text-right'}= t(:total)
%td{class: total > 0 ? 'text-success' : 'text-danger'}= total > 0 ? "+#{total} EUR" : "#{total} EUR"
.row
.col-md-12
= paginate @account_activities

View file

@ -8,15 +8,18 @@
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-6'}
%th{class: 'col-xs-4'}
= sort_link(@q, 'name')
%th{class: 'col-xs-6'}
%th{class: 'col-xs-4'}
= sort_link(@q, 'reg_no', t(:reg_no))
%th{class: 'col-xs-4'}
= t(:credit_balance)
%tbody
- @registrars.each do |x|
%tr
%td= link_to(x, [:admin, x])
%td= x.reg_no
%td= "#{x.balance}"
.row
.col-md-12
= paginate @registrars

View file

@ -32,6 +32,9 @@
%dt= t(:id)
%dd= @registrar.code
%dt= t(:credit_balance)
%dd= @registrar.balance
.col-md-6
.panel.panel-default
.panel-heading