mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(feature) Prepaid-packs purchases are exported to the accounting CSV file
This commit is contained in:
parent
51a2bed16c
commit
2fcda8a0ce
@ -2,6 +2,7 @@
|
||||
|
||||
- Support for Google Analytics V4
|
||||
- OAuth2 scopes are now configurable from the interface
|
||||
- Prepaid-packs purchases are exported to the accounting CSV file
|
||||
- Updated environment documentation
|
||||
- Updated react-i18next to 11.15.6
|
||||
- Updated i18next to 21.6.13
|
||||
|
@ -195,6 +195,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
|
||||
name: 'accounting_Space_label',
|
||||
value: settings.accounting_Space_label
|
||||
},
|
||||
packCode: {
|
||||
name: 'accounting_Pack_code',
|
||||
value: settings.accounting_Pack_code
|
||||
},
|
||||
packLabel: {
|
||||
name: 'accounting_Pack_label',
|
||||
value: settings.accounting_Pack_label
|
||||
},
|
||||
errorCode: {
|
||||
name: 'accounting_Error_code',
|
||||
value: settings.accounting_Error_code
|
||||
|
@ -868,7 +868,8 @@ angular.module('application.router', ['ui.router'])
|
||||
"'accounting_Machine_code', 'accounting_Machine_label', 'accounting_Training_code', 'accounting_Training_label', " +
|
||||
"'accounting_Event_code', 'accounting_Event_label', 'accounting_Space_code', 'accounting_Space_label', " +
|
||||
"'payment_gateway', 'accounting_Error_code', 'accounting_Error_label', 'payment_schedule_prefix', " +
|
||||
"'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency', 'invoice_prefix']"
|
||||
"'feature_tour_display', 'online_payment_module', 'stripe_public_key', 'stripe_currency', 'invoice_prefix', " +
|
||||
"'accounting_Pack_code', 'accounting_Pack_label']"
|
||||
}).$promise;
|
||||
}],
|
||||
stripeSecretKey: ['Setting', function (Setting) { return Setting.isPresent({ name: 'stripe_secret_key' }).$promise; }],
|
||||
|
@ -106,6 +106,16 @@
|
||||
<input type="text" id="spaceLabel" ng-model="settings.spaceLabel.value" class="form-control" placeholder="{{ 'app.admin.invoices.general_space_label' | translate }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label for="packCode" translate>{{ 'app.admin.invoices.accounting_Pack_code' }}</label>
|
||||
<input type="text" id="packCode" ng-model="settings.packCode.value" class="form-control" placeholder="{{ 'app.admin.invoices.general_pack_code' | translate }}"/>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="packLabel" translate>{{ 'app.admin.invoices.accounting_Pack_label' }}</label>
|
||||
<input type="text" id="packLabel" ng-model="settings.packLabel.value" class="form-control" placeholder="{{ 'app.admin.invoices.general_pack_label' | translate }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label for="spaceCode" translate>{{ 'app.admin.invoices.accounting_Error_code' }}</label>
|
||||
|
@ -128,7 +128,9 @@ class Setting < ApplicationRecord
|
||||
pack_only_for_subscription
|
||||
overlapping_categories
|
||||
extended_prices_in_same_day
|
||||
public_registrations] }
|
||||
public_registrations
|
||||
accounting_Pack_code
|
||||
accounting_Pack_label] }
|
||||
# WARNING: when adding a new key, you may also want to add it in:
|
||||
# - config/locales/en.yml#settings
|
||||
# - app/frontend/src/javascript/models/setting.ts#SettingName
|
||||
|
@ -69,6 +69,8 @@ class AccountingExportService
|
||||
end
|
||||
elsif invoice.main_item.object_type == 'WalletTransaction'
|
||||
rows << "#{wallet_row(invoice)}\n"
|
||||
elsif invoice.main_item.object_type == 'StatisticProfilePrepaidPack'
|
||||
rows << "#{pack_row(invoice)}\n"
|
||||
elsif invoice.main_item.object_type == 'Error'
|
||||
items = invoice.invoice_items.reject { |ii| ii.object_type == 'Subscription' }
|
||||
items.each do |item|
|
||||
@ -131,6 +133,16 @@ class AccountingExportService
|
||||
)
|
||||
end
|
||||
|
||||
def pack_row(invoice)
|
||||
row(
|
||||
invoice,
|
||||
account(invoice, :pack),
|
||||
account(invoice, :pack, type: :label),
|
||||
invoice.invoice_items.first.net_amount / 100.00,
|
||||
line_label: label(invoice)
|
||||
)
|
||||
end
|
||||
|
||||
# Generate the "VAT" row, which contains the credit to the VAT account, with VAT amount only
|
||||
def vat_row(invoice)
|
||||
total = invoice.invoice_items.map(&:net_amount).sum
|
||||
@ -216,6 +228,12 @@ class AccountingExportService
|
||||
else
|
||||
puts "WARN: Invoice #{invoice.id} is not a wallet credit"
|
||||
end
|
||||
when :pack
|
||||
if invoice.main_item.object_type == 'StatisticProfilePrepaidPack'
|
||||
Setting.find_by(name: "accounting_Pack_#{type}")&.value
|
||||
else
|
||||
puts "WARN: Invoice #{invoice.id} has no prepaid-pack"
|
||||
end
|
||||
when :error
|
||||
Setting.find_by(name: "accounting_Error_#{type}")&.value
|
||||
else
|
||||
|
@ -673,6 +673,10 @@ en:
|
||||
general_space_code: "Accounting code for all spaces"
|
||||
accounting_Space_label: "Spaces label"
|
||||
general_space_label: "Account label for all spaces"
|
||||
accounting_Pack_code: "Prepaid-pack code"
|
||||
general_pack_code: "Accounting code for prepaid-packs"
|
||||
accounting_Pack_label: "Prepaid-pack label"
|
||||
general_pack_label: "Account label for prepaid-packs"
|
||||
accounting_Error_code: "Errors code"
|
||||
general_error_code: "Accounting code for erroneous invoices"
|
||||
accounting_Error_label: "Errors label"
|
||||
|
Loading…
x
Reference in New Issue
Block a user