mirror of
https://github.com/internetee/registry.git
synced 2025-05-30 09:30:03 +02:00
Improve invoice view
This commit is contained in:
parent
43e111add0
commit
6a47f38e80
14 changed files with 167 additions and 44 deletions
BIN
app/assets/images/eis-logo-et.png
Normal file
BIN
app/assets/images/eis-logo-et.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -13,16 +13,28 @@ html
|
||||||
min-height: 100%
|
min-height: 100%
|
||||||
|
|
||||||
body
|
body
|
||||||
padding-bottom: 60px
|
padding-bottom: 130px
|
||||||
|
|
||||||
body > .container
|
body > .container
|
||||||
height: 100%
|
height: 100%
|
||||||
background: #fff
|
background: #fff
|
||||||
padding: 60px 30px 30px 30px
|
padding: 60px 30px 30px 30px
|
||||||
|
|
||||||
|
h1, h2, h3, h4
|
||||||
|
margin-bottom: 0px !important
|
||||||
|
|
||||||
|
hr
|
||||||
|
margin-top: 10px !important
|
||||||
|
margin-bottom: 10px !important
|
||||||
|
|
||||||
|
.no-border
|
||||||
|
border: 0 !important
|
||||||
|
|
||||||
.footer
|
.footer
|
||||||
position: absolute
|
position: absolute
|
||||||
bottom: 0
|
bottom: 0
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 60px
|
height: 130px
|
||||||
background-color: black
|
background: image_url('bg.jpg')
|
||||||
|
color: white !important
|
||||||
|
background-size: 100%
|
||||||
|
|
|
@ -7,4 +7,24 @@ class Invoice < ActiveRecord::Base
|
||||||
def seller_address
|
def seller_address
|
||||||
[seller_street, seller_city, seller_state, seller_zip].reject(&:blank?).compact.join(', ')
|
[seller_street, seller_city, seller_state, seller_zip].reject(&:blank?).compact.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def buyer_address
|
||||||
|
[buyer_street, buyer_city, buyer_state, buyer_zip].reject(&:blank?).compact.join(', ')
|
||||||
|
end
|
||||||
|
|
||||||
|
def items
|
||||||
|
invoice_items
|
||||||
|
end
|
||||||
|
|
||||||
|
def total_without_vat
|
||||||
|
items.map(&:item_total_without_vat).sum
|
||||||
|
end
|
||||||
|
|
||||||
|
def total_vat
|
||||||
|
total_without_vat * vat_prc
|
||||||
|
end
|
||||||
|
|
||||||
|
def total
|
||||||
|
total_without_vat + total_vat
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
class InvoiceItem < ActiveRecord::Base
|
class InvoiceItem < ActiveRecord::Base
|
||||||
belongs_to :invoice
|
belongs_to :invoice
|
||||||
|
|
||||||
|
def item_total_without_vat
|
||||||
|
amount * price
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,9 +67,9 @@ class Registrar < ActiveRecord::Base
|
||||||
invoice_items_attributes: [
|
invoice_items_attributes: [
|
||||||
{
|
{
|
||||||
description: 'prepayment',
|
description: 'prepayment',
|
||||||
item_unit: 'piece',
|
unit: 'piece',
|
||||||
item_amount: 1,
|
amount: 1,
|
||||||
item_price: amount
|
price: amount
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
%h4= t('buyer')
|
||||||
|
%hr
|
||||||
|
%dl.dl-horizontal
|
||||||
|
%dt= t('name')
|
||||||
|
%dd= @invoice.buyer_name
|
||||||
|
|
||||||
|
%dt= t('reg_no')
|
||||||
|
%dd= @invoice.buyer_reg_no
|
||||||
|
|
||||||
|
%dt= t('address')
|
||||||
|
%dd= @invoice.buyer_address
|
||||||
|
|
||||||
|
%dt= t('phone')
|
||||||
|
%dd= @invoice.buyer_phone
|
||||||
|
|
||||||
|
%dt= t('url')
|
||||||
|
%dd= @invoice.buyer_url
|
||||||
|
|
||||||
|
%dt= t('email')
|
||||||
|
%dd= @invoice.buyer_email
|
17
app/views/registrar/invoices/partials/_details.haml
Normal file
17
app/views/registrar/invoices/partials/_details.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
%h4= t('details')
|
||||||
|
%hr
|
||||||
|
%dl.dl-horizontal
|
||||||
|
/ %dt= t('document_name')
|
||||||
|
/ %dd= t(@invoice.document_name)
|
||||||
|
|
||||||
|
%dt= t('issue_date')
|
||||||
|
%dd= l(@invoice.created_at)
|
||||||
|
|
||||||
|
%dt= t('due_date')
|
||||||
|
%dd= l(@invoice.due_date)
|
||||||
|
|
||||||
|
%dt= t('payment_term')
|
||||||
|
%dd= t(@invoice.payment_term)
|
||||||
|
|
||||||
|
%dt= t('description')
|
||||||
|
%dd= @invoice.description
|
32
app/views/registrar/invoices/partials/_items.haml
Normal file
32
app/views/registrar/invoices/partials/_items.haml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
%h4= t('items')
|
||||||
|
%hr
|
||||||
|
.table-responsive
|
||||||
|
%table.table.table-hover.table-condensed
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-4'}= t('description')
|
||||||
|
%th{class: 'col-xs-2'}= t('unit')
|
||||||
|
%th{class: 'col-xs-2'}= t('amount')
|
||||||
|
%th{class: 'col-xs-2'}= t('price')
|
||||||
|
%th{class: 'col-xs-2'}= t('total')
|
||||||
|
%tbody
|
||||||
|
- @invoice.items.each do |x|
|
||||||
|
%tr
|
||||||
|
%td= t(x.description)
|
||||||
|
%td= x.unit
|
||||||
|
%td= x.amount
|
||||||
|
%td= x.price
|
||||||
|
%td= x.item_total_without_vat
|
||||||
|
%tfoot
|
||||||
|
%tr
|
||||||
|
%th{colspan: 3}
|
||||||
|
%th= t('total_without_vat')
|
||||||
|
%td= @invoice.total_without_vat
|
||||||
|
%tr
|
||||||
|
%th.no-border{colspan: 3}
|
||||||
|
%th= t('vat', vat_prc: (@invoice.vat_prc * 100).round)
|
||||||
|
%td= @invoice.total_vat
|
||||||
|
%tr
|
||||||
|
%th.no-border{colspan: 3}
|
||||||
|
%th= t('total')
|
||||||
|
%td= @invoice.total
|
|
@ -1,37 +1,35 @@
|
||||||
.panel.panel-default
|
%h4= t('seller')
|
||||||
.panel-heading
|
%hr
|
||||||
%h3.panel-title= t('general')
|
%dl.dl-horizontal
|
||||||
.panel-body
|
%dt= t('name')
|
||||||
%dl.dl-horizontal
|
%dd= @invoice.seller_name
|
||||||
%dt= t('name')
|
|
||||||
%dd= @invoice.seller_name
|
|
||||||
|
|
||||||
%dt= t('reg_no')
|
%dt= t('reg_no')
|
||||||
%dd= @invoice.seller_reg_no
|
%dd= @invoice.seller_reg_no
|
||||||
|
|
||||||
%dt= t('iban')
|
%dt= t('iban')
|
||||||
%dd= @invoice.seller_iban
|
%dd= @invoice.seller_iban
|
||||||
|
|
||||||
%dt= t('bank')
|
%dt= t('bank')
|
||||||
%dd= @invoice.seller_bank
|
%dd= @invoice.seller_bank
|
||||||
|
|
||||||
%dt= t('swift')
|
%dt= t('swift')
|
||||||
%dd= @invoice.seller_swift
|
%dd= @invoice.seller_swift
|
||||||
|
|
||||||
%dt= t('vat_no')
|
%dt= t('vat_no')
|
||||||
%dd= @invoice.seller_vat_no
|
%dd= @invoice.seller_vat_no
|
||||||
|
|
||||||
%dt= t('address')
|
%dt= t('address')
|
||||||
%dd= @invoice.seller_address
|
%dd= @invoice.seller_address
|
||||||
|
|
||||||
%dt= t('phone')
|
%dt= t('phone')
|
||||||
%dd= @invoice.seller_phone
|
%dd= @invoice.seller_phone
|
||||||
|
|
||||||
%dt= t('url')
|
%dt= t('url')
|
||||||
%dd= @invoice.seller_url
|
%dd= @invoice.seller_url
|
||||||
|
|
||||||
%dt= t('email')
|
%dt= t('email')
|
||||||
%dd= @invoice.seller_email
|
%dd= @invoice.seller_email
|
||||||
|
|
||||||
%dt= t('issuer')
|
%dt= t('issuer')
|
||||||
%dd= @invoice.seller_contact_name
|
%dd= @invoice.seller_contact_name
|
||||||
|
|
17
app/views/registrar/invoices/partials/_total.haml
Normal file
17
app/views/registrar/invoices/partials/_total.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
%h4= t('total')
|
||||||
|
%hr
|
||||||
|
%dl.dl-horizontal
|
||||||
|
/ %dt= t('document_name')
|
||||||
|
/ %dd= t(@invoice.document_name)
|
||||||
|
|
||||||
|
%dt= t('issue_date')
|
||||||
|
%dd= l(@invoice.created_at)
|
||||||
|
|
||||||
|
%dt= t('due_date')
|
||||||
|
%dd= l(@invoice.due_date)
|
||||||
|
|
||||||
|
%dt= t('payment_term')
|
||||||
|
%dd= t(@invoice.payment_term)
|
||||||
|
|
||||||
|
%dt= t('description')
|
||||||
|
%dd= @invoice.description
|
|
@ -2,11 +2,11 @@
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
.col-md-6= render 'registrar/invoices/partials/seller'
|
.col-md-6= render 'registrar/invoices/partials/seller'
|
||||||
.col-md-6= render 'registrar/invoices/partials/buyer'
|
.col-md-6= render 'registrar/invoices/partials/details'
|
||||||
/ .row
|
.row
|
||||||
/ .col-md-12= render 'admin/domains/partials/tech_contacts'
|
.col-md-12= render 'registrar/invoices/partials/buyer'
|
||||||
/ .row
|
.row
|
||||||
/ .col-md-12= render 'admin/domains/partials/admin_contacts'
|
.col-md-12= render 'registrar/invoices/partials/items'
|
||||||
/ .row
|
/ .row
|
||||||
/ .col-md-12= render 'admin/domains/partials/statuses'
|
/ .col-md-12= render 'admin/domains/partials/statuses'
|
||||||
/ .row
|
/ .row
|
||||||
|
|
|
@ -647,3 +647,6 @@ en:
|
||||||
amount: 'Amount'
|
amount: 'Amount'
|
||||||
please_pay_the_following_invoice: 'Please pay the following invoice'
|
please_pay_the_following_invoice: 'Please pay the following invoice'
|
||||||
invoice_no: 'Invoice no. %{no}'
|
invoice_no: 'Invoice no. %{no}'
|
||||||
|
seller: 'Seller'
|
||||||
|
prepayment: 'Prepayment'
|
||||||
|
vat: 'VAT (%{vat_prc}%)'
|
||||||
|
|
|
@ -4,9 +4,9 @@ class CreateInvoiceItems < ActiveRecord::Migration
|
||||||
t.integer :invoice_id
|
t.integer :invoice_id
|
||||||
# t.string :product_code
|
# t.string :product_code
|
||||||
t.string :description, null: false
|
t.string :description, null: false
|
||||||
t.string :item_unit
|
t.string :unit
|
||||||
t.integer :item_amount
|
t.integer :amount
|
||||||
t.decimal :item_price
|
t.decimal :price
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
|
@ -209,9 +209,9 @@ ActiveRecord::Schema.define(version: 20150413140933) do
|
||||||
create_table "invoice_items", force: :cascade do |t|
|
create_table "invoice_items", force: :cascade do |t|
|
||||||
t.integer "invoice_id"
|
t.integer "invoice_id"
|
||||||
t.string "description", null: false
|
t.string "description", null: false
|
||||||
t.string "item_unit"
|
t.string "unit"
|
||||||
t.integer "item_amount"
|
t.integer "amount"
|
||||||
t.decimal "item_price"
|
t.decimal "price"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue