diff --git a/app/models/concerns/registrar/book_keeping.rb b/app/models/concerns/registrar/book_keeping.rb index be281fb56..e1c980ee2 100644 --- a/app/models/concerns/registrar/book_keeping.rb +++ b/app/models/concerns/registrar/book_keeping.rb @@ -6,10 +6,9 @@ module Registrar::BookKeeping included do scope :with_cash_accounts, (lambda do - joins(:accounts) - .where('accounts.account_type = ? AND test_registrar != ?', - Account::CASH, - true) + joins(:accounts).where('accounts.account_type = ? AND test_registrar != ?', + Account::CASH, + true) end) end diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml index f64bd9cc4..42f7d769c 100644 --- a/app/views/admin/invoices/show.haml +++ b/app/views/admin/invoices/show.haml @@ -25,6 +25,9 @@ .col-md-6= render 'registrar/invoices/partials/seller' .col-md-6= render 'registrar/invoices/partials/buyer' .row - .col-md-12= render 'registrar/invoices/partials/items' + - if @invoice.monthly_invoice + .col-md-12= render 'registrar/invoices/partials/monthly_invoice_items' + - else + .col-md-12= render 'registrar/invoices/partials/items' .row .col-md-12= render 'registrar/invoices/partials/payment_orders' diff --git a/app/views/registrar/invoices/partials/_monthly_invoice_items.haml b/app/views/registrar/invoices/partials/_monthly_invoice_items.haml new file mode 100644 index 000000000..787218ea3 --- /dev/null +++ b/app/views/registrar/invoices/partials/_monthly_invoice_items.haml @@ -0,0 +1,38 @@ +%h4= t(:items) +%hr +.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) \ No newline at end of file diff --git a/app/views/registrar/invoices/show.haml b/app/views/registrar/invoices/show.haml index 5e6104091..dd19a0bea 100644 --- a/app/views/registrar/invoices/show.haml +++ b/app/views/registrar/invoices/show.haml @@ -13,7 +13,10 @@ .col-md-6= render 'registrar/invoices/partials/seller' .col-md-6= render 'registrar/invoices/partials/buyer' .row - .col-md-12= render 'registrar/invoices/partials/items' + - if @invoice.monthly_invoice + .col-md-12= render 'registrar/invoices/partials/monthly_invoice_items' + - else + .col-md-12= render 'registrar/invoices/partials/items' - if @invoice.payable? .row.semifooter