mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Created job for sending monthly invoices
This commit is contained in:
parent
a5f803b57a
commit
d589aa1681
18 changed files with 1103 additions and 43 deletions
|
@ -4,11 +4,12 @@
|
|||
= @invoice
|
||||
.col-sm-8
|
||||
%h1.text-right.text-center-xs
|
||||
- if @invoice.unpaid?
|
||||
= link_to(t(:payment_received), new_admin_bank_statement_path(invoice_id: @invoice.id), class: 'btn btn-default')
|
||||
- unless @invoice.monthly_invoice
|
||||
- if @invoice.unpaid?
|
||||
= link_to(t(:payment_received), new_admin_bank_statement_path(invoice_id: @invoice.id), class: 'btn btn-default')
|
||||
|
||||
- if @invoice.paid? and !@invoice.cancelled?
|
||||
= link_to(t(:cancel_payment), cancel_paid_admin_invoices_path(invoice_id: @invoice.id), method: 'post', data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
|
||||
- if @invoice.paid? && !@invoice.cancelled?
|
||||
= link_to(t(:cancel_payment), cancel_paid_admin_invoices_path(invoice_id: @invoice.id), method: 'post', data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')
|
||||
|
||||
= link_to(t('.download_btn'), download_admin_invoice_path(@invoice), class: 'btn btn-default')
|
||||
= link_to(t('.deliver_btn'), new_admin_invoice_delivery_path(@invoice), class: 'btn btn-default')
|
||||
|
|
277
app/views/invoice/monthly_pdf.haml
Normal file
277
app/views/invoice/monthly_pdf.haml
Normal file
|
@ -0,0 +1,277 @@
|
|||
%html{lang: I18n.locale.to_s}
|
||||
%head
|
||||
%meta{charset: "utf-8"}
|
||||
:css
|
||||
.container {
|
||||
margin: auto;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.col-md-12 {
|
||||
|
||||
}
|
||||
|
||||
.col-md-6 {
|
||||
width: 49%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.col-xs-4 {
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.col-xs-2 {
|
||||
width: 16%;
|
||||
}
|
||||
|
||||
.col-md-3 {
|
||||
width: 24%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.left {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
dt {
|
||||
float: left;
|
||||
width: 100px;
|
||||
clear: left;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
line-height: 1.42857;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-left: 120px;
|
||||
line-height: 1.42857;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
border: 0px;
|
||||
border-top: 1px solid #DDD;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
thead th {
|
||||
border-bottom: 2px solid #DDD;
|
||||
border-top: 0px;
|
||||
}
|
||||
|
||||
td {
|
||||
border-top: 1px solid #DDD;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 1px;
|
||||
border: 0;
|
||||
color: #DDD;
|
||||
background-color: #DDD;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.pull-down {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
#header {
|
||||
position: relative;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 106px;
|
||||
height: 102px;
|
||||
}
|
||||
|
||||
#header-content {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
#footer {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
%body
|
||||
.container
|
||||
#header.row
|
||||
.col-sm-6.left
|
||||
#header-content
|
||||
%h1
|
||||
= @invoice
|
||||
.col-sm-6.right
|
||||
%img{src: "#{Rails.root}/public/eis-logo-black-et.png"}
|
||||
.clear
|
||||
%hr
|
||||
.row
|
||||
.col-md-6.left
|
||||
%h4
|
||||
Details
|
||||
%hr
|
||||
%dl.dl-horizontal
|
||||
%dt= t(:issue_date)
|
||||
%dd= l @invoice.issue_date
|
||||
|
||||
- if @invoice.cancelled?
|
||||
%dt= Invoice.human_attribute_name :cancelled_at
|
||||
%dd= l @invoice.cancelled_at
|
||||
|
||||
%dt= t(:due_date)
|
||||
- if @invoice.cancelled?
|
||||
%dd= t(:cancelled)
|
||||
- else
|
||||
%dd= l @invoice.due_date
|
||||
|
||||
%dt= t(:issuer)
|
||||
%dd= @invoice.seller_contact_name
|
||||
|
||||
- if @invoice.description.present?
|
||||
%dt= t(:description)
|
||||
%dd=@invoice.description
|
||||
|
||||
%dt= Invoice.human_attribute_name :reference_no
|
||||
%dd= @invoice.reference_no
|
||||
|
||||
.col-md-6.right
|
||||
%h4= t(:client)
|
||||
%hr
|
||||
%dl.dl-horizontal
|
||||
%dt= t(:name)
|
||||
%dd= @invoice.buyer_name
|
||||
|
||||
%dt= t(:reg_no)
|
||||
%dd= @invoice.buyer_reg_no
|
||||
|
||||
- if @invoice.buyer_address.present?
|
||||
%dt= Invoice.human_attribute_name :address
|
||||
%dd= @invoice.buyer_address
|
||||
|
||||
- if @invoice.buyer_country.present?
|
||||
%dt= t(:country)
|
||||
%dd= @invoice.buyer_country
|
||||
|
||||
- if @invoice.buyer_phone.present?
|
||||
%dt= t(:phone)
|
||||
%dd= @invoice.buyer_phone
|
||||
|
||||
- if @invoice.buyer_url.present?
|
||||
%dt= t(:url)
|
||||
%dd= @invoice.buyer_url
|
||||
|
||||
- if @invoice.buyer_email.present?
|
||||
%dt= t(:email)
|
||||
%dd= @invoice.buyer_email
|
||||
|
||||
.clear
|
||||
.row.pull-down
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-1'}= t(:code)
|
||||
%th{class: 'col-xs-1'}= InvoiceItem.human_attribute_name :quantity
|
||||
%th{class: 'col-xs-1'}= t(:unit)
|
||||
%th{class: 'col-xs-5'}= t(:description)
|
||||
%th{class: 'col-xs-2'}= t(:price)
|
||||
%th{class: 'col-xs-2'}= t(:total)
|
||||
%tbody
|
||||
- @invoice.each do |invoice_item|
|
||||
%tr
|
||||
%td= invoice_item.product_id
|
||||
%td= invoice_item.quantity
|
||||
%td= invoice_item.unit
|
||||
%td= invoice_item.description
|
||||
- if invoice_item.price && invoice_item.quantity
|
||||
%td= currency(invoice_item.price)
|
||||
%td= "#{currency((invoice_item.price * invoice_item.quantity).round(3))} #{@invoice.currency}"
|
||||
- else
|
||||
%td= ''
|
||||
%td= ''
|
||||
%tfoot
|
||||
%tr
|
||||
%th{colspan: 4}
|
||||
%th= Invoice.human_attribute_name :subtotal
|
||||
%td= number_to_currency(0)
|
||||
%tr
|
||||
%th.no-border{colspan: 4}
|
||||
%th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}"
|
||||
%td= number_to_currency(0)
|
||||
%tr
|
||||
%th.no-border{colspan: 4}
|
||||
%th= t(:total)
|
||||
%td= number_to_currency(0)
|
||||
|
||||
#footer
|
||||
%hr
|
||||
.row
|
||||
.col-md-3.left
|
||||
= @invoice.seller_name
|
||||
%br
|
||||
= @invoice.seller_address
|
||||
%br
|
||||
= @invoice.seller_country
|
||||
%br
|
||||
= "#{t('reg_no')} #{@invoice.seller_reg_no}"
|
||||
%br
|
||||
= "#{Registrar.human_attribute_name :vat_no} #{@invoice.seller_vat_no}"
|
||||
|
||||
.col-md-3.left
|
||||
= @invoice.seller_phone
|
||||
%br
|
||||
= @invoice.seller_email
|
||||
%br
|
||||
= @invoice.seller_url
|
||||
|
||||
.col-md-3.text-right.left
|
||||
= t(:bank)
|
||||
%br
|
||||
= t(:iban)
|
||||
%br
|
||||
= t(:swift)
|
||||
|
||||
.col-md-3.left
|
||||
= @invoice.seller_bank
|
||||
%br
|
||||
= @invoice.seller_iban
|
||||
%br
|
||||
= @invoice.seller_swift
|
|
@ -234,7 +234,7 @@
|
|||
%td= invoice_item.unit
|
||||
%td= invoice_item.quantity
|
||||
%td= currency(invoice_item.price)
|
||||
%td= "#{currency(invoice_item.item_sum_without_vat)} #{@invoice.currency}"
|
||||
%td= "#{currency(invoice_item.item_sum_without_vat)} #{@invoice.currency}"
|
||||
%tfoot
|
||||
%tr
|
||||
%th{colspan: 3}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue