@@ -32,6 +32,7 @@ end | |||||
get '/directorates/:id' do | get '/directorates/:id' do | ||||
@directorate = Directorate.get(params[:id]) | @directorate = Directorate.get(params[:id]) | ||||
@total = @directorate.payments.sum(:amount) | |||||
haml :directorate | haml :directorate | ||||
end | end | ||||
@@ -53,6 +54,7 @@ end | |||||
get '/suppliers/:id' do | get '/suppliers/:id' do | ||||
@supplier = Supplier.get(params[:id]) | @supplier = Supplier.get(params[:id]) | ||||
@total = @supplier.payments.sum(:amount) | |||||
haml :supplier | haml :supplier | ||||
end | end | ||||
@@ -79,6 +81,7 @@ end | |||||
get '/services/:id' do | get '/services/:id' do | ||||
@service = Service.get(params[:id]) | @service = Service.get(params[:id]) | ||||
@total = @service.payments.sum(:amount) | |||||
haml :service | haml :service | ||||
end | end | ||||
@@ -61,6 +61,7 @@ h1 | |||||
line-height: 1.4em; | line-height: 1.4em; | ||||
font-weight: bold; | font-weight: bold; | ||||
color: #86a11d; | color: #86a11d; | ||||
font-size: 180%; | |||||
} | } | ||||
h2 | h2 | ||||
@@ -27,4 +27,11 @@ | |||||
= payment.supplier.name | = payment.supplier.name | ||||
%td.right= sprintf("%0d", payment.amount) | %td.right= sprintf("%0d", payment.amount) | ||||
%tr | |||||
%td | |||||
%td | |||||
%td | |||||
%strong TOTAL | |||||
%td.right= sprintf("%0d", @total) | |||||
@@ -30,4 +30,11 @@ | |||||
= payment.supplier.name | = payment.supplier.name | ||||
%td.right= sprintf("%0d", payment.amount) | %td.right= sprintf("%0d", payment.amount) | ||||
%tr | |||||
%td | |||||
%td | |||||
%td | |||||
%strong TOTAL | |||||
%td.right= sprintf("%0d", @total) | |||||
@@ -31,4 +31,11 @@ | |||||
= payment.service.name | = payment.service.name | ||||
%td.right= sprintf("%0d", payment.amount) | %td.right= sprintf("%0d", payment.amount) | ||||
%tr | |||||
%td | |||||
%td | |||||
%td | |||||
%strong TOTAL | |||||
%td.right= sprintf("%0d", @total) | |||||