P16-01-DISMISS: 一般従業員の通常操作での解雇(退職金を含む。P16-01 の補助の作業。原単位への加算 0)

This commit is contained in:
Agent Control Runner
2026-10-24 12:49:31 +09:00
parent 0b59d7c23c
commit b06fec17c7
17 changed files with 2503 additions and 17 deletions
+21 -2
View File
@@ -32,6 +32,13 @@ const LOAN_INTEREST_CATEGORY: StringName = &"LOAN_INTEREST"
const LOAN_INTEREST_PAYMENT_CATEGORY: StringName = &"LOAN_INTEREST_PAYMENT"
const NON_PROFIT_CATEGORIES: Array[StringName] = [TOP_UP_CATEGORY, RANK_TAX_PAYMENT_CATEGORY, LOAN_INTEREST_PAYMENT_CATEGORY]
## A14 (2026-10-23): dismissing a general employee pays three days of the effective daily
## wage, from the front fund with the hidden fund covering the rest. It is booked to its
## own expense account, apart from WAGE, and counted with the operating costs.
const SEVERANCE_EXPENSE: StringName = &"STAFF_SEVERANCE_EXPENSE"
const SEVERANCE_CATEGORY: StringName = &"STAFF_SEVERANCE"
const SEVERANCE_DAYS := 3
static func rank_tax(sales: int) -> int:
return maxi(sales, 0) / 100 * RANK_TAX_PERCENT + maxi(sales, 0) % 100 * RANK_TAX_PERCENT / 100
@@ -42,6 +49,10 @@ static func loan_interest(outstanding_principal: int) -> int:
+ maxi(outstanding_principal, 0) % 100 * LOAN_INTEREST_PERCENT_PER_DAY / 100
static func severance(daily_wage: int) -> int:
return maxi(daily_wage, 0) * SEVERANCE_DAYS
static func is_back_fund_service(tags: Array) -> bool:
for tag: StringName in BACK_FUND_TAGS:
if tag in tags:
@@ -66,12 +77,20 @@ static func prepare_accounts(economy: EconomyService) -> bool:
for account_id: StringName in expected:
if not economy.register_account(account_id, bool(expected[account_id])):
return false
return true
return _prepare_severance_account(economy)
for account_id: StringName in expected:
if not economy.has_account(account_id) \
or economy.account_allows_negative(account_id) != bool(expected[account_id]):
return false
return true
return _prepare_severance_account(economy)
## A save from before the severance gains its empty expense account the same way; the
## balances, the other accounts and the history are unchanged.
static func _prepare_severance_account(economy: EconomyService) -> bool:
if economy.has_account(SEVERANCE_EXPENSE):
return not economy.account_allows_negative(SEVERANCE_EXPENSE)
return economy.register_account(SEVERANCE_EXPENSE, false)
static func outstanding_principal(economy: EconomyService) -> int: