mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
Merge branch 'hotfix' into 2-0-rc1
This commit is contained in:
commit
456e2c42b4
@ -154,11 +154,11 @@
|
||||
|
||||
<tr class="invoice-vat invoice-editable vat-line italic" ng-click="openEditVAT()" ng-show="invoice.VAT.active">
|
||||
<td>{{ 'including_VAT' | translate }} {{invoice.VAT.rate}} %</td>
|
||||
<td>{{30*invoice.VAT.rate/100 | currency}}</td>
|
||||
<td>{{30/(invoice.VAT.rate/100+1) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-ht vat-line italic" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'including_total_excluding_taxes' }}</td>
|
||||
<td>{{30-(30*invoice.VAT.rate/100) | currency}}</td>
|
||||
<td>{{30-(30/(invoice.VAT.rate/100+1)) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-payed vat-line bold" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'including_amount_payed_on_ordering' }}</td>
|
||||
|
@ -117,7 +117,7 @@ class Invoice < ActiveRecord::Base
|
||||
reference
|
||||
end
|
||||
|
||||
# only for debug
|
||||
# for debug & used by rake task "fablab:regenerate_invoices"
|
||||
def regenerate_invoice_pdf
|
||||
pdf = ::PDF::Invoice.new(self).render
|
||||
File.binwrite(file, pdf)
|
||||
|
@ -138,7 +138,7 @@ module PDF
|
||||
data += [ [I18n.t('invoices.total_including_all_taxes'), number_to_currency(total)] ]
|
||||
|
||||
vat_rate = Setting.find_by({name: 'invoice_VAT-rate'}).value.to_f
|
||||
vat = total * vat_rate / 100
|
||||
vat = total / (vat_rate / 100 + 1)
|
||||
data += [ [I18n.t('invoices.including_VAT_RATE', RATE: vat_rate), number_to_currency(vat)] ]
|
||||
data += [ [I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total-vat)] ]
|
||||
data += [ [I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total)] ]
|
||||
|
@ -26,14 +26,7 @@ namespace :fablab do
|
||||
start_date = Time.new(year.to_i, month.to_i, 1)
|
||||
end_date = start_date.next_month
|
||||
puts "-> Start regenerate the invoices between #{I18n.l start_date, format: :long} in #{I18n.l end_date-1.minute, format: :long}"
|
||||
index = '000'
|
||||
invoices = Invoice.only_invoice.where("created_at >= :start_date AND created_at < :end_date", {start_date: start_date, end_date: end_date}).order(created_at: :asc)
|
||||
invoices.each do |i|
|
||||
i.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}#{i.stp_invoice_id ? '/VL' : ''}")
|
||||
if i.avoir
|
||||
i.avoir.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}/A")
|
||||
end
|
||||
end
|
||||
invoices.each(&:regenerate_invoice_pdf)
|
||||
puts "-> Done"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user