瀏覽代碼

Added total amounts to directorates, services & suppliers

pull/3/head
Adrian Short 14 年之前
父節點
當前提交
20637fe085
共有 5 個檔案被更改,包括 26 行新增1 行删除
  1. +3
    -0
      app.rb
  2. +1
    -0
      public/style.css
  3. +7
    -0
      views/directorate.haml
  4. +8
    -1
      views/service.haml
  5. +7
    -0
      views/supplier.haml

+ 3
- 0
app.rb 查看文件

@@ -32,6 +32,7 @@ end

get '/directorates/:id' do
@directorate = Directorate.get(params[:id])
@total = @directorate.payments.sum(:amount)
haml :directorate
end

@@ -53,6 +54,7 @@ end

get '/suppliers/:id' do
@supplier = Supplier.get(params[:id])
@total = @supplier.payments.sum(:amount)
haml :supplier
end

@@ -79,6 +81,7 @@ end

get '/services/:id' do
@service = Service.get(params[:id])
@total = @service.payments.sum(:amount)
haml :service
end



+ 1
- 0
public/style.css 查看文件

@@ -61,6 +61,7 @@ h1
line-height: 1.4em;
font-weight: bold;
color: #86a11d;
font-size: 180%;
}

h2


+ 7
- 0
views/directorate.haml 查看文件

@@ -27,4 +27,11 @@
= payment.supplier.name
%td.right= sprintf("%0d", payment.amount)
%tr
%td
%td
%td
%strong TOTAL
%td.right= sprintf("%0d", @total)

+ 8
- 1
views/service.haml 查看文件

@@ -30,4 +30,11 @@
= payment.supplier.name
%td.right= sprintf("%0d", payment.amount)
%tr
%td
%td
%td
%strong TOTAL
%td.right= sprintf("%0d", @total)

+ 7
- 0
views/supplier.haml 查看文件

@@ -31,4 +31,11 @@
= payment.service.name
%td.right= sprintf("%0d", payment.amount)
%tr
%td
%td
%td
%strong TOTAL
%td.right= sprintf("%0d", @total)

Loading…
取消
儲存