-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #341 from diegosteiner/develop
Release 24.12.1-rc1
- Loading branch information
Showing
97 changed files
with
1,638 additions
and
656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
module Manage | ||
class VatCategoriesController < BaseController | ||
load_and_authorize_resource :vat_category | ||
|
||
def index | ||
@vat_categories = @vat_categories.where(organisation: current_organisation).ordered | ||
respond_with :manage, @vat_categories | ||
end | ||
|
||
def edit | ||
respond_with :manage, @vat_category | ||
end | ||
|
||
def create | ||
@vat_category.organisation = current_organisation | ||
@vat_category.save | ||
respond_with :manage, location: manage_vat_categories_path | ||
end | ||
|
||
def update | ||
@vat_category.update(vat_category_params) | ||
respond_with :manage, location: manage_vat_categories_path | ||
end | ||
|
||
def destroy | ||
@vat_category.discarded? ? @vat_category.destroy : @vat_category.discard! | ||
respond_with :manage, @vat_category, location: manage_vat_categories_path | ||
end | ||
|
||
private | ||
|
||
def vat_category_params | ||
locale_params = I18n.available_locales.map { |locale| ["label_#{locale}"] } | ||
params.require(:vat_category).permit(:percentage, :accounting_vat_code, locale_params.flatten) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
module Accounting | ||
JournalEntry = Data.define(:id, :account, :date, :tax_code, :text, :amount, :side, :cost_center, | ||
:index, :amount_type, :source, :reference, :currency, :booking) do | ||
extend ActiveModel::Translation | ||
extend ActiveModel::Naming | ||
|
||
def initialize(**args) | ||
args.symbolize_keys! | ||
defaults = { id: nil, index: nil, tax_code: nil, text: nil, cost_center: nil, source: nil } | ||
side = args.delete(:side) if %i[soll haben].include?(args[:side]) | ||
date = args.delete(:date)&.then { _1.try(:to_date) || Date.parse(_1).to_date } | ||
super(**defaults, **args, side:, date:) | ||
end | ||
|
||
def soll? | ||
side == :soll | ||
end | ||
|
||
def haben? | ||
side == :haben | ||
end | ||
|
||
def soll_account | ||
account if soll? | ||
end | ||
|
||
def haben_account | ||
account if haben? | ||
end | ||
|
||
def valid? | ||
(soll_account.present? || haben_account.present?) && amount.present? | ||
end | ||
|
||
def to_s | ||
[ | ||
(id || index).presence&.then { "[#{_1}]" }, | ||
soll_account, | ||
'->', | ||
haben_account, | ||
ActiveSupport::NumberHelper.number_to_currency(amount, unit: currency), | ||
':', | ||
text | ||
].compact.join(' ') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AccountingSettings < Settings | ||
attribute :tenant_debitor_account_nr_base, :integer, default: -> { 0 } | ||
attribute :debitor_account_nr, :string | ||
attribute :currency_account_nr, :string | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.