Files
njts-accounting-core/backend/sql/insert_opening_balances_2025.sql
2026-01-13 16:29:34 +09:00

68 lines
2.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 既存の期首残高データを削除
DELETE FROM opening_balances;
-- 2025年度2025年6月1日2026年5月31日期首残高データ
-- ★残高試算表_20250724.pdf の「当期残高」列より2025年5月31日時点
INSERT INTO opening_balances (fiscal_year, account_id, opening_debit, opening_credit) VALUES
-- 現金101: 0
-- 普通預金102: 3,231,129
(2025, (SELECT account_id FROM accounts WHERE account_code = '102'), 3231129, 0),
-- 売掛金201: 3,083,000
(2025, (SELECT account_id FROM accounts WHERE account_code = '201'), 3083000, 0),
-- 未収入金202: 17,842,822短期貸付金の代わり
(2025, (SELECT account_id FROM accounts WHERE account_code = '202'), 17842822, 0),
-- 前渡金203 仮払金): 387,400
(2025, (SELECT account_id FROM accounts WHERE account_code = '203'), 387400, 0),
-- 工具器具備品406: 345,383
(2025, (SELECT account_id FROM accounts WHERE account_code = '406'), 345383, 0),
-- 差入保証金410: 220,000
(2025, (SELECT account_id FROM accounts WHERE account_code = '410'), 220000, 0),
-- 買掛金501: 9,376,260貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '501'), 0, 9376260),
-- 未払金502: 0
-- 未払費用503: 1,087,312貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '503'), 0, 1087312),
-- 未払法人税等504: 1,525,500貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '504'), 0, 1525500),
-- 未払消費税等505: 1,245,200貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '505'), 0, 1245200),
-- 預り金506: 669,316貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '506'), 0, 669316),
-- 資本金601: 6,000,000貸方
(2025, (SELECT account_id FROM accounts WHERE account_code = '601'), 0, 6000000);
-- 繰越利益剰余金602: 5,206,146 は自動計算されるため入力不要
-- 確認用クエリ
SELECT
a.account_code,
a.account_name,
ob.opening_debit,
ob.opening_credit
FROM opening_balances ob
JOIN accounts a ON ob.account_id = a.account_id
WHERE ob.fiscal_year = 2025
ORDER BY a.account_code;
-- 合計確認
SELECT
SUM(opening_debit) as total_debit,
SUM(opening_credit) as total_credit,
SUM(opening_debit) - SUM(opening_credit) as diff
FROM opening_balances
WHERE fiscal_year = 2025;