This commit is contained in:
admin
2026-02-07 20:04:42 +09:00
parent 331953bb7f
commit c60cbf2d9a
29 changed files with 1851 additions and 1246 deletions

View File

@@ -81,7 +81,7 @@
<div id="result"></div>
<script>
const API = "http://127.0.0.1:18080";
const API = "";
let accounts = [];
// ------------------------------------

View File

@@ -115,6 +115,22 @@
</style>
</head>
<body>
<button
onclick="location.href = 'index.html'"
class="back-button"
style="
margin: 0 0 20px 0;
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 首ページに戻る
</button>
<h2>仕訳入力</h2>
<div class="row">
@@ -295,9 +311,7 @@
<div id="printArea"></div>
<script>
let rowSeq = 0; // 各行唯一ID
const API = "http://127.0.0.1:18080";
const API = "";
// 千分位カンマフォーマット関数
function formatNumberInput(input) {
@@ -909,7 +923,7 @@
}
}
const API_BASE = "http://127.0.0.1:18080";
const API_BASE = "";
async function callApi(path) {
try {

View File

@@ -50,7 +50,7 @@
</table>
<script>
const API = "http://127.0.0.1:18080";
const API = "";
async function search() {
const from = document.getElementById("fromDate").value;

View File

@@ -54,12 +54,25 @@
</table>
<div style="margin-top: 16px">
<button onclick="window.close()">閉じる</button>
<button onclick="goBack()">一覧に戻る</button>
<button
onclick="goBack()"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 仕訳一覧に戻る
</button>
</div>
<script>
const API = "http://127.0.0.1:18080";
const API = "";
async function loadJournalEntry() {
const params = new URLSearchParams(window.location.search);

View File

@@ -40,7 +40,22 @@
<br /><br />
<button onclick="submitJournal()">保存</button>
<a href="index.html">← 戻る</a>
<button
onclick="location.href = 'index.html'"
class="back-button"
style="
margin: 0 0 20px 0;
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 首ページに戻る
</button>
<script src="js/api.js"></script>
<script src="js/journal.js"></script>

View File

@@ -1,4 +1,4 @@
const API_BASE = "http://127.0.0.1:18080";
const API_BASE = "";
async function apiGet(path, params = {}) {
const query = new URLSearchParams(params).toString();

View File

@@ -42,7 +42,7 @@ async function submitJournal() {
}
try {
await fetch("http://127.0.0.1:18080/journals", {
await fetch(`/journals`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({

View File

@@ -127,7 +127,7 @@ function recalcTotals() {
document.getElementById("totalDebit").innerText = formatNumber(finalDebit);
document.getElementById("totalCredit").innerText = formatNumber(finalCredit);
document.getElementById("diff").innerText = formatNumber(
finalDebit - finalCredit
finalDebit - finalCredit,
);
// 小計行を更新
@@ -144,7 +144,7 @@ function updateSubtotalRows() {
debit: sum.debit + Number(acc.opening_debit || 0),
credit: sum.credit + Number(acc.opening_credit || 0),
}),
{ debit: 0, credit: 0 }
{ debit: 0, credit: 0 },
);
// 対応する小計行を探して更新
@@ -167,7 +167,7 @@ async function loadOpeningBalances() {
accounts = data;
retainedEarnings = accounts.find(
(a) => a.account_name === "繰越利益剰余金" || a.account_name === "繰越利益"
(a) => a.account_name === "繰越利益剰余金" || a.account_name === "繰越利益",
);
const tbody = document.querySelector("#balanceTable tbody");
@@ -224,7 +224,7 @@ async function loadOpeningBalances() {
debit: sum.debit + Number(acc.opening_debit || 0),
credit: sum.credit + Number(acc.opening_credit || 0),
}),
{ debit: 0, credit: 0 }
{ debit: 0, credit: 0 },
);
const totalTr = document.createElement("tr");
@@ -243,14 +243,12 @@ async function loadOpeningBalances() {
});
// 年度锁定チェック
fetch(
`http://127.0.0.1:18080/opening-balances/lock-status?fiscal_year=${year}`
)
fetch(`/opening-balances/lock-status?fiscal_year=${year}`)
.then((res) => res.json())
.then((data) => {
isLocked = data.is_locked;
document.querySelector(
"button[onclick='saveOpeningBalances()']"
"button[onclick='saveOpeningBalances()']",
).disabled = isLocked;
if (isLocked) {
alert("この会計年度の期首残高は確定されています。");
@@ -273,7 +271,7 @@ async function saveOpeningBalances() {
(a) =>
a.account_name !== "繰越利益剰余金" &&
a.account_name !== "繰越利益" &&
(Number(a.opening_debit) !== 0 || Number(a.opening_credit) !== 0)
(Number(a.opening_debit) !== 0 || Number(a.opening_credit) !== 0),
)
.map((a) => ({
account_id: a.account_id,
@@ -282,7 +280,7 @@ async function saveOpeningBalances() {
}));
try {
await fetch("http://127.0.0.1:18080/opening-balances", {
await fetch(`/opening-balances`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({

View File

@@ -1,7 +1,13 @@
document.addEventListener("DOMContentLoaded", () => {
console.log("trial-balance.js 已执行");
// ===============================================
// trial-balance.js - 試算表データ読み込みスクリプト
// ===============================================
console.log("🔧 trial-balance.js ファイルが読み込まれました");
const API_URL = "http://127.0.0.1:18080/trial-balance";
// 初期读入関数
function initTrialBalance() {
console.log("✓ initTrialBalance() 関数が実行されました");
const API_URL = `/trial-balance`;
// デフォルト期間を計算5/31決算6月開始現在月末
function getDefaultPeriod() {
@@ -28,7 +34,7 @@ document.addEventListener("DOMContentLoaded", () => {
const lastDayOfMonth = new Date(fiscalEndYear, currentMonth, 0).getDate();
const dateTo = `${fiscalEndYear}-${String(currentMonth).padStart(
2,
"0"
"0",
)}-${String(lastDayOfMonth).padStart(2, "0")}`;
return { dateFrom, dateTo };
@@ -39,8 +45,13 @@ document.addEventListener("DOMContentLoaded", () => {
const url = `${API_URL}?date_from=${dateFrom}&date_to=${dateTo}`;
console.log("読み込み URL:", url);
// 加載中のステータス表示
const loadingEl = document.getElementById("loadingStatus");
if (loadingEl) loadingEl.style.display = "inline";
fetch(url)
.then((r) => {
console.log("API Response Status:", r.status);
if (!r.ok) throw new Error("API 返回错误: " + r.status);
return r.json();
})
@@ -116,10 +127,23 @@ document.addEventListener("DOMContentLoaded", () => {
totalClosing.toLocaleString();
document.getElementById("totalRatio").textContent =
data.totals?.ratio ?? "100.00";
// 加載中ステータスを非表示
const loadingEl = document.getElementById("loadingStatus");
if (loadingEl) loadingEl.style.display = "none";
})
.catch((err) => {
console.error("試算表読取失敗:", err);
alert("試算表読取失敗、コンソールログを確認してください");
const tbody = document.querySelector("#trialBalanceTable tbody");
if (tbody) {
tbody.innerHTML = `<tr><td colspan="7" style="text-align:center; color:red;">エラー: ${err.message}</td></tr>`;
}
// 加載中ステータスを非表示
const loadingEl = document.getElementById("loadingStatus");
if (loadingEl) loadingEl.style.display = "none";
alert(
`試算表読取失敗: ${err.message}\n\nコンソールログ(F12)を確認してください`,
);
});
}
@@ -170,9 +194,23 @@ document.addEventListener("DOMContentLoaded", () => {
});
// 初期読み込み5/31決算に対応
const defaultPeriod = getDefaultPeriod();
document.getElementById("dateFrom").value = defaultPeriod.dateFrom;
document.getElementById("dateTo").value = defaultPeriod.dateTo;
try {
const defaultPeriod = getDefaultPeriod();
document.getElementById("dateFrom").value = defaultPeriod.dateFrom;
document.getElementById("dateTo").value = defaultPeriod.dateTo;
loadTrialBalance(defaultPeriod.dateFrom, defaultPeriod.dateTo);
console.log("✓ 初期読み込み完了");
} catch (err) {
console.error("初期読み込みエラー:", err);
}
}
loadTrialBalance(defaultPeriod.dateFrom, defaultPeriod.dateTo);
});
// 複数の方式で初期化を実行iOS互換性を向上
document.addEventListener("DOMContentLoaded", initTrialBalance);
window.addEventListener("load", initTrialBalance);
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initTrialBalance);
} else {
// ページがすでに読み込まれている場合、すぐに実行
setTimeout(initTrialBalance, 100);
}

View File

@@ -22,7 +22,22 @@
<tbody id="ledger-body"></tbody>
</table>
<a href="index.html">← 試算表へ戻る</a>
<button
onclick="location.href = 'trial-balance.html'"
class="back-button"
style="
margin: 20px 0 0 0;
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 試算表に戻る
</button>
<script src="js/api.js"></script>
<script src="js/ledger.js"></script>

View File

@@ -40,7 +40,22 @@
<br />
<button onclick="saveOpeningBalances()">保存</button>
<button onclick="location.href = 'trial-balance.html'">← 戻る</button>
<button
onclick="location.href = 'trial-balance.html'"
class="back-button"
style="
margin: 0 0 20px 0;
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 試算表に戻る
</button>
<script src="js/api.js"></script>
<script src="js/opening_balance.js"></script>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
@@ -100,7 +100,7 @@
</table>
<script>
const API = "http://127.0.0.1:8000";
const API = "";
// --------------------
// 初期化
@@ -140,7 +140,7 @@
});
document.getElementById("totalBalance").innerText = Number(
data.total_balance
data.total_balance,
).toLocaleString();
}
@@ -154,7 +154,7 @@
const sel = document.getElementById("accountSelect");
sel.innerHTML = data.items
.map(
(i) => `<option value="${i.account_id}">${i.account_name}</option>`
(i) => `<option value="${i.account_id}">${i.account_name}</option>`,
)
.join("");

View File

@@ -160,7 +160,22 @@
</head>
<body>
<div class="container">
<a href="payroll.html" class="back-link">← 給与管理メニューに戻る</a>
<button
onclick="location.href = 'payroll.html'"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin-bottom: 20px;
"
>
← 給与管理メニューに戻る
</button>
<h1>給与管理 - 給与・賞与計算</h1>

View File

@@ -229,7 +229,22 @@
</head>
<body>
<div class="container">
<a href="payroll.html" class="back-link">← 給与管理メニューに戻る</a>
<button
onclick="location.href = 'payroll.html'"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin-bottom: 20px;
"
>
← 給与管理メニューに戻る
</button>
<h1>給与管理 - 従業員管理</h1>

View File

@@ -71,7 +71,22 @@
</head>
<body>
<div class="container">
<a href="payroll.html" class="back-link">← 給与管理メニューに戻る</a>
<button
onclick="location.href = 'payroll.html'"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin-bottom: 20px;
"
>
← 給与管理メニューに戻る
</button>
<h1>給与管理 - 給与設定</h1>

View File

@@ -171,7 +171,22 @@
</head>
<body>
<div class="container">
<a href="payroll.html" class="back-link">← 給与管理メニューに戻る</a>
<button
onclick="location.href = 'payroll.html'"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin-bottom: 20px;
"
>
← 給与管理メニューに戻る
</button>
<h1>給与管理 - 設定</h1>

View File

@@ -55,7 +55,21 @@
</head>
<body>
<div class="container">
<a href="../index.html" class="back-link">← メインメニューに戻る</a>
<button
onclick="location.href = '../index.html'"
class="back-button"
style="
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← メインメニューに戻る
</button>
<h1>給与管理システム</h1>
<p>従業員の給与計算、扶養管理、保険料・税金の管理を行います</p>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
@@ -6,7 +6,7 @@
<title>試算表</title>
<style>
body {
font-family: 'MS Gothic', 'Meiryo', sans-serif;
font-family: "MS Gothic", "Meiryo", sans-serif;
margin: 24px auto;
font-size: 15px;
max-width: 1400px;
@@ -39,7 +39,7 @@
.search-form button {
padding: 6px 20px;
margin: 0 5px;
background: #4CAF50;
background: #4caf50;
color: white;
border: none;
border-radius: 3px;
@@ -50,7 +50,7 @@
background: #45a049;
}
.search-form button.secondary {
background: #2196F3;
background: #2196f3;
}
.search-form button.secondary:hover {
background: #0b7dda;
@@ -96,22 +96,45 @@
</style>
</head>
<body>
<button
onclick="location.href = 'index.html'"
class="back-button"
style="
margin: 0 0 20px 0;
padding: 8px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
"
>
← 首ページに戻る
</button>
<h2>残高試算表(貸借・損益)</h2>
<div
id="loadingStatus"
style="display: none; color: #666; font-size: 12px; margin: 10px 0"
>
読み込み中...
</div>
<div class="search-form">
<label for="dateFrom">開始年月日:</label>
<input type="date" id="dateFrom" min="1900-01-01" max="2099-12-31" />
<label for="dateTo">終了年月日:</label>
<input type="date" id="dateTo" min="1900-01-01" max="2099-12-31" />
<button id="btnSearch">検索</button>
<button id="btnFullYear" class="secondary">全年度表示</button>
</div>
<div class="period-info">
<span id="periodInfo">令和7年 1月 1日 令和7年 12月31日</span>
<span style="margin-left: 20px;">単位: 円</span>
<span style="margin-left: 20px">単位: 円</span>
</div>
<table id="trialBalanceTable">
@@ -142,8 +165,29 @@
</table>
<script src="js/trial-balance.js"></script>
</body>
</html>
<!-- 立即初始化脚本iOS Safari 的外部脚本加载问题的备选方案 -->
<script>
// 确保脚本被加载和执行
console.log("trial-balance.html inline script 执行中...");
if (typeof initTrialBalance === "function") {
console.log("initTrialBalance 函数が見つかりました, 実行します");
initTrialBalance();
} else {
console.warn(
"initTrialBalance 関数が見つかりません。js/trial-balance.js が読み込まれていない可能性があります",
);
// タイムアウトで再度チェック
setTimeout(() => {
if (typeof initTrialBalance === "function") {
console.log("遅延実行: initTrialBalance を実行します");
initTrialBalance();
} else {
console.error("js/trial-balance.js が読み込まれていません!");
}
}, 500);
}
</script>
</body>
</html>

View File

@@ -266,7 +266,7 @@
</div>
<script>
const API_BASE = "http://localhost:8000";
const API_BASE = "";
function addTestResult(message, status = "info") {
const div = document.getElementById("testResults");