修正
This commit is contained in:
@@ -23,6 +23,7 @@ class JournalEntryRequest(BaseModel):
|
||||
tax_paid_account_id: Optional[int] = None # 仮払消費税等 勘定
|
||||
tax_received_account_id: Optional[int] = None # 仮受消費税等 勘定
|
||||
rounding_mode: str = "round" # "round", "floor", or "ceil"
|
||||
parent_entry_id: Optional[int] = None # 修正元の仕訳ID
|
||||
|
||||
class JournalEntryUpdateRequest(BaseModel):
|
||||
description: str
|
||||
@@ -58,7 +59,8 @@ def get_journal_entries(
|
||||
je.fiscal_year,
|
||||
je.version,
|
||||
COALESCE(SUM(jl.debit), 0) as debit_total,
|
||||
COALESCE(SUM(jl.credit), 0) as credit_total
|
||||
COALESCE(SUM(jl.credit), 0) as credit_total,
|
||||
STRING_AGG(DISTINCT CASE WHEN jl.tax_rate IS NOT NULL THEN jl.tax_rate::text END, ', ' ORDER BY CASE WHEN jl.tax_rate IS NOT NULL THEN jl.tax_rate::text END) as tax_rates
|
||||
FROM journal_entries je
|
||||
LEFT JOIN journal_lines jl ON je.journal_entry_id = jl.journal_entry_id
|
||||
WHERE je.is_deleted = false
|
||||
@@ -74,7 +76,8 @@ def get_journal_entries(
|
||||
je.fiscal_year,
|
||||
je.version,
|
||||
COALESCE(SUM(jl.debit), 0) as debit_total,
|
||||
COALESCE(SUM(jl.credit), 0) as credit_total
|
||||
COALESCE(SUM(jl.credit), 0) as credit_total,
|
||||
STRING_AGG(DISTINCT CASE WHEN jl.tax_rate IS NOT NULL THEN jl.tax_rate::text END, ', ' ORDER BY CASE WHEN jl.tax_rate IS NOT NULL THEN jl.tax_rate::text END) as tax_rates
|
||||
FROM journal_entries je
|
||||
LEFT JOIN journal_lines jl ON je.journal_entry_id = jl.journal_entry_id
|
||||
WHERE je.is_deleted = false
|
||||
@@ -202,15 +205,17 @@ def create_reverse_entry(journal_id: int):
|
||||
fiscal_year,
|
||||
version,
|
||||
is_deleted,
|
||||
created_by
|
||||
created_by,
|
||||
parent_entry_id
|
||||
)
|
||||
VALUES (%s, %s, %s, 1, false, %s)
|
||||
VALUES (%s, %s, %s, 1, false, %s, %s)
|
||||
RETURNING journal_entry_id
|
||||
""", (
|
||||
header["entry_date"],
|
||||
f"[逆仕訳] {header['description']}",
|
||||
header["fiscal_year"],
|
||||
"system"
|
||||
"system",
|
||||
journal_id # 逆仕訳の元となる仕訳ID
|
||||
))
|
||||
|
||||
new_entry_id = cur.fetchone()["journal_entry_id"]
|
||||
@@ -322,15 +327,17 @@ def create_journal_entry(req: JournalEntryRequest):
|
||||
fiscal_year,
|
||||
version,
|
||||
is_deleted,
|
||||
created_by
|
||||
created_by,
|
||||
parent_entry_id
|
||||
)
|
||||
VALUES (%s, %s, %s, 1, false, %s)
|
||||
VALUES (%s, %s, %s, 1, false, %s, %s)
|
||||
RETURNING journal_entry_id
|
||||
""", (
|
||||
req.entry_date,
|
||||
req.description,
|
||||
fiscal_year,
|
||||
"system"
|
||||
"system",
|
||||
req.parent_entry_id
|
||||
))
|
||||
|
||||
entry_id = cur.fetchone()["journal_entry_id"]
|
||||
|
||||
Reference in New Issue
Block a user