mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +01:00
(feat) add payment transfer/check to accounting settings
This commit is contained in:
parent
ff80216d9b
commit
cf998e6220
@ -3,6 +3,7 @@
|
||||
## Next release
|
||||
|
||||
- improvement: Allow the admin to update payment method only the overdue subscription item without cancel PayZen subscription
|
||||
- improvement: add payment transfer/check to accounting settings
|
||||
|
||||
## v6.3.11 2024 February 2
|
||||
|
||||
|
@ -13,6 +13,8 @@ class OpenAPI::V1::AccountingController < OpenAPI::V1::BaseController
|
||||
@codes = {
|
||||
card: Setting.get('accounting_payment_card_code'),
|
||||
wallet: Setting.get('accounting_payment_wallet_code'),
|
||||
transfer: Setting.get('accounting_payment_transfer_code'),
|
||||
check: Setting.get('accounting_payment_check_code'),
|
||||
other: Setting.get('accounting_payment_other_code')
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,18 @@ export const AccountingCodesSettings: React.FC<AccountingCodesSettingsProps> = (
|
||||
<FormInput register={register} id="accounting_payment_wallet_code" label={t('app.admin.accounting_codes_settings.code')} />
|
||||
<FormInput register={register} id="accounting_payment_wallet_label" label={t('app.admin.accounting_codes_settings.label')} />
|
||||
</div>
|
||||
<h5>{t('app.admin.accounting_codes_settings.transfer')}</h5>
|
||||
<div className="others">
|
||||
<FormInput register={register} id="accounting_payment_transfer_journal_code" label={t('app.admin.accounting_codes_settings.journal_code')} />
|
||||
<FormInput register={register} id="accounting_payment_transfer_code" label={t('app.admin.accounting_codes_settings.code')} />
|
||||
<FormInput register={register} id="accounting_payment_transfer_label" label={t('app.admin.accounting_codes_settings.label')} />
|
||||
</div>
|
||||
<h5>{t('app.admin.accounting_codes_settings.check')}</h5>
|
||||
<div className="others">
|
||||
<FormInput register={register} id="accounting_payment_check_journal_code" label={t('app.admin.accounting_codes_settings.journal_code')} />
|
||||
<FormInput register={register} id="accounting_payment_check_code" label={t('app.admin.accounting_codes_settings.code')} />
|
||||
<FormInput register={register} id="accounting_payment_check_label" label={t('app.admin.accounting_codes_settings.label')} />
|
||||
</div>
|
||||
<h5>{t('app.admin.accounting_codes_settings.other')}</h5>
|
||||
<div className="others">
|
||||
<FormInput register={register} id="accounting_payment_other_journal_code" label={t('app.admin.accounting_codes_settings.journal_code')} />
|
||||
|
@ -113,6 +113,12 @@ export const accountingSettings = [
|
||||
'accounting_payment_other_code',
|
||||
'accounting_payment_other_label',
|
||||
'accounting_payment_other_journal_code',
|
||||
'accounting_payment_transfer_code',
|
||||
'accounting_payment_transfer_label',
|
||||
'accounting_payment_transfer_journal_code',
|
||||
'accounting_payment_check_code',
|
||||
'accounting_payment_check_label',
|
||||
'accounting_payment_check_journal_code',
|
||||
'accounting_wallet_code',
|
||||
'accounting_wallet_label',
|
||||
'accounting_wallet_journal_code',
|
||||
|
@ -74,6 +74,12 @@ module SettingsHelper
|
||||
accounting_payment_other_code
|
||||
accounting_payment_other_label
|
||||
accounting_payment_other_journal_code
|
||||
accounting_payment_transfer_code
|
||||
accounting_payment_transfer_label
|
||||
accounting_payment_transfer_journal_code
|
||||
accounting_payment_check_code
|
||||
accounting_payment_check_label
|
||||
accounting_payment_check_journal_code
|
||||
accounting_wallet_code
|
||||
accounting_wallet_label
|
||||
accounting_wallet_journal_code
|
||||
|
@ -13,6 +13,10 @@ class AccountingLine < ApplicationRecord
|
||||
# else
|
||||
if invoice.paid_by_card?
|
||||
'card'
|
||||
elsif invoice.paid_by_transfer?
|
||||
'transfer'
|
||||
elsif invoice.paid_by_check?
|
||||
'check'
|
||||
else
|
||||
'other'
|
||||
end
|
||||
|
@ -167,6 +167,10 @@ class Invoice < PaymentDocument
|
||||
res.push(means: :card, amount: amount_paid)
|
||||
elsif paid_by_wallet?
|
||||
res.push(means: :wallet, amount: amount_paid)
|
||||
elsif paid_by_transfer?
|
||||
res.push(means: :transfer, amount: amount_paid)
|
||||
elsif paid_by_check?
|
||||
res.push(means: :check, amount: amount_paid)
|
||||
else
|
||||
res.push(means: :other, amount: amount_paid)
|
||||
end
|
||||
@ -202,6 +206,14 @@ class Invoice < PaymentDocument
|
||||
(wallet_transaction && wallet_amount.positive?) || payment_method == 'wallet'
|
||||
end
|
||||
|
||||
def paid_by_transfer?
|
||||
payment_method == 'transfer'
|
||||
end
|
||||
|
||||
def paid_by_check?
|
||||
payment_method == 'check'
|
||||
end
|
||||
|
||||
def render_resource
|
||||
{ partial: 'api/invoices/invoice', locals: { invoice: self } }
|
||||
end
|
||||
|
@ -276,6 +276,8 @@ en:
|
||||
card: "Card payments"
|
||||
wallet_debit: "Virtual wallet payments"
|
||||
other: "Other payment means"
|
||||
transfer: "Transfer"
|
||||
check: "Check"
|
||||
wallet_credit: "Virtual wallet credit"
|
||||
VAT: "VAT"
|
||||
sales: "Sales"
|
||||
|
@ -702,6 +702,12 @@ Setting.set('accounting_payment_wallet_journal_code', 'WA01') unless Setting.fin
|
||||
Setting.set('accounting_payment_other_code', '5803') unless Setting.find_by(name: 'accounting_payment_other_code').try(:value)
|
||||
Setting.set('accounting_payment_other_label', 'Payments on site') unless Setting.find_by(name: 'accounting_payment_other_label').try(:value)
|
||||
Setting.set('accounting_payment_other_journal_code', 'SI01') unless Setting.find_by(name: 'accounting_payment_other_journal_code').try(:value)
|
||||
Setting.set('accounting_payment_transfer_code', '5804') unless Setting.find_by(name: 'accounting_payment_transfer_code').try(:value)
|
||||
Setting.set('accounting_payment_transfer_label', 'Transfer Payments ') unless Setting.find_by(name: 'accounting_payment_transfer_label').try(:value)
|
||||
Setting.set('accounting_payment_transfer_journal_code', 'TR01') unless Setting.find_by(name: 'accounting_payment_transfer_journal_code').try(:value)
|
||||
Setting.set('accounting_payment_check_code', '5805') unless Setting.find_by(name: 'accounting_payment_check_code').try(:value)
|
||||
Setting.set('accounting_payment_check_label', 'Payments by check') unless Setting.find_by(name: 'accounting_payment_check_label').try(:value)
|
||||
Setting.set('accounting_payment_check_journal_code', 'CH01') unless Setting.find_by(name: 'accounting_payment_check_journal_code').try(:value)
|
||||
Setting.set('accounting_wallet_code', '4191') unless Setting.find_by(name: 'accounting_wallet_code').try(:value)
|
||||
Setting.set('accounting_wallet_label', 'Wallet credit') unless Setting.find_by(name: 'accounting_wallet_label').try(:value)
|
||||
Setting.set('accounting_wallet_journal_code', 'WC01') unless Setting.find_by(name: 'accounting_wallet_journal_code').try(:value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user