mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
frontend invoice configuration page uses multiVAT
This commit is contained in:
parent
9286738b69
commit
16242d2127
@ -226,6 +226,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
// Is shown the modal dialog to select a payment gateway
|
||||
$scope.openSelectGatewayModal = false;
|
||||
|
||||
/**
|
||||
* Return the VAT rate applicable to the machine reservations
|
||||
* @return {number}
|
||||
*/
|
||||
$scope.getMachineExampleRate = function () {
|
||||
return $scope.invoice.multiVAT.rateMachine || $scope.invoice.VAT.rate;
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the invoices ordering criterion to the one provided
|
||||
* @param orderBy {string} ordering criterion
|
||||
|
@ -54,12 +54,12 @@
|
||||
</tr>
|
||||
|
||||
<tr class="invoice-vat invoice-editable vat-line italic" ng-click="openEditVAT()" ng-show="invoice.VAT.active">
|
||||
<td>{{ 'app.admin.invoices.including_VAT' | translate }} {{invoice.VAT.rate}} %</td>
|
||||
<td>{{30-(30/(invoice.VAT.rate/100+1)) | currency}}</td>
|
||||
<td translate translate-values="{RATE:getMachineExampleRate(), AMOUNT:(30.0 | currency)}">{{ 'app.admin.invoices.including_VAT' }}</td>
|
||||
<td>{{30-(30/(getMachineExampleRate()/100+1)) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-ht vat-line italic" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'app.admin.invoices.including_total_excluding_taxes' }}</td>
|
||||
<td>{{30/(invoice.VAT.rate/100+1) | currency}}</td>
|
||||
<td>{{30/(getMachineExampleRate()/100+1) | currency}}</td>
|
||||
</tr>
|
||||
<tr class="invoice-payed vat-line bold" ng-show="invoice.VAT.active">
|
||||
<td translate>{{ 'app.admin.invoices.including_amount_payed_on_ordering' }}</td>
|
||||
|
@ -58,6 +58,7 @@ class VatHistoryService
|
||||
# {start: 0000-01-01, end: fab-manager initial setup date, enabled: false}
|
||||
# ] => VAT was enabled at some point, and disabled at some other point later
|
||||
|
||||
date_rates = []
|
||||
if vat_rate_type.present?
|
||||
vat_rate_by_type = Setting.find_by(name: "invoice_VAT-rate_#{vat_rate_type}")&.history_values&.order(created_at: 'ASC')
|
||||
first_vat_rate_by_type = vat_rate_by_type&.select { |v| v.value.present? }&.first
|
||||
@ -87,7 +88,6 @@ class VatHistoryService
|
||||
end
|
||||
|
||||
# Now we have all the rates history, we can build the final chronology, depending on whether VAT was enabled or not
|
||||
date_rates = []
|
||||
vat_rate_history_values.each do |rate|
|
||||
# when the VAT rate was enabled, set the date it was enabled and the rate
|
||||
range = chronology.select { |p| rate.created_at.to_i.between?(p[:start].to_i, p[:end].to_i) }.first
|
||||
|
@ -495,13 +495,14 @@ en:
|
||||
details: "Details"
|
||||
amount: "Amount"
|
||||
machine_booking-3D_printer: "Machine booking - 3D printer"
|
||||
training_booking-3D_print: "Training booking - initiation to 3d printing"
|
||||
total_amount: "Total amount"
|
||||
total_including_all_taxes: "Total incl. all taxes"
|
||||
VAT_disabled: "VAT disabled"
|
||||
VAT_enabled: "VAT enabled"
|
||||
including_VAT: "Including VAT"
|
||||
including_VAT: "Including VAT {RATE}% of {AMOUNT}"
|
||||
including_total_excluding_taxes: "Including Total excl. taxes"
|
||||
including_amount_payed_on_ordering: "Including Amount payed on ordering"
|
||||
including_amount_payed_on_ordering: "Including amount payed on ordering"
|
||||
settlement_by_debit_card_on_DATE_at_TIME_for_an_amount_of_AMOUNT: "Settlement by debit card on {DATE} at {TIME}, for an amount of {AMOUNT}"
|
||||
important_notes: "Important notes"
|
||||
address_and_legal_information: "Address and legal information"
|
||||
|
Loading…
Reference in New Issue
Block a user