This commit is contained in:
admin
2026-01-22 21:05:48 +09:00
parent 3d91356877
commit 536266d70b
11 changed files with 236 additions and 85 deletions

View File

@@ -2,95 +2,94 @@
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>試算表</title>
<title>NJTS 会計システム - メイン</title>
<link rel="stylesheet" href="css/style.css" />
<style>
body {
font-family: system-ui, -apple-system, "Yu Gothic UI",
"Hiragino Kaku Gothic ProN", "メイリオ", sans-serif;
padding: 24px;
}
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
max-width: 980px;
margin: 0 auto;
}
.card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
background: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.card h2 {
margin-top: 0;
}
.btn {
display: inline-block;
padding: 10px 14px;
border-radius: 6px;
background: #007bff;
color: #fff;
text-decoration: none;
}
header {
max-width: 980px;
margin: 0 auto 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
header h1 {
margin: 0;
font-size: 20px;
}
</style>
</head>
<body>
<h1>試算表</h1>
<header>
<h1>NJTS</h1>
</header>
<label>
期間:
<input type="date" id="from" min="1900-01-01" max="2099-12-31" />
<input type="date" id="to" min="1900-01-01" max="2099-12-31" />
</label>
<button onclick="loadTrialBalance()">表示</button>
<main class="grid">
<section class="card">
<h2>会計システム</h2>
<p>
会計モジュールの主要画面へ移動します。仕訳入力、試算表、元帳に移動できます。
</p>
<p>
<a class="btn" href="journal-entry.html">仕訳入力へ</a>
<a
class="btn"
href="trial-balance.html"
style="margin-left: 10px; background: #28a745"
>試算表へ</a
>
</p>
</section>
<table id="trial-table">
<thead>
<tr>
<th>科目コード</th>
<th>科目名</th>
<th>期首</th>
<th>借方</th>
<th>贷方</th>
<th>期末</th>
</tr>
</thead>
<tbody></tbody>
</table>
<section class="card">
<h2>給与システム</h2>
<p>給与・賞与の計算や従業員管理を行います。</p>
<p><a class="btn" href="payroll.html">給与システムを開く</a></p>
</section>
</main>
<h3>💰 当前资金状况</h3>
<table border="1" cellpadding="6" style="border-collapse: collapse">
<thead>
<tr style="background: #f5f5f5">
<th>账户</th>
<th style="text-align: right">余额</th>
</tr>
</thead>
<tbody id="cashBalanceBody">
<tr>
<td colspan="2">读取中...</td>
</tr>
</tbody>
<tfoot>
<tr style="font-weight: bold">
<td>合计</td>
<td id="cashBalanceTotal" style="text-align: right">-</td>
</tr>
</tfoot>
</table>
<script src="js/api.js"></script>
<script src="js/trial_balance.js"></script>
<script>
const API_BASE = "http://127.0.0.1:18080";
function formatYen(v) {
return "¥ " + Number(v).toLocaleString("ja-JP");
}
async function loadCashBalance() {
const body = document.getElementById("cashBalanceBody");
const totalEl = document.getElementById("cashBalanceTotal");
body.innerHTML = "<tr><td colspan='2'>读取中...</td></tr>";
totalEl.innerText = "-";
try {
const res = await fetch(`${API_BASE}/cash/balance`);
const data = await res.json();
body.innerHTML = "";
data.items.forEach((item) => {
const tr = document.createElement("tr");
tr.innerHTML = `
<td>${item.account_name}</td>
<td style="text-align:right;">${formatYen(item.balance)}</td>
`;
body.appendChild(tr);
});
totalEl.innerText = formatYen(data.total_balance);
} catch (e) {
body.innerHTML = `<tr><td colspan="2">读取失败</td></tr>`;
// dropdown toggle
const toggle = document.getElementById("accountingToggle");
const menu = document.getElementById("accountingMenu");
toggle.addEventListener("click", (e) => {
menu.style.display = menu.style.display === "block" ? "none" : "block";
});
// click outside to close
document.addEventListener("click", (e) => {
if (!toggle.contains(e.target) && !menu.contains(e.target)) {
menu.style.display = "none";
}
}
// 页面加载时自动读取
window.addEventListener("DOMContentLoaded", loadCashBalance);
});
</script>
</body>
</html>

View File

@@ -532,7 +532,9 @@
</div>
<script>
const API_BASE = "http://localhost:18080";
// Use relative API paths so frontend works when served via nginx on the NAS.
// The nginx service will proxy API requests to the backend container.
const API_BASE = "";
let employeeMap = {};
// sanitize input to digits only and limit length

View File

@@ -549,7 +549,7 @@
</div>
<script>
const API_BASE = "http://localhost:18080";
const API_BASE = "";
let currentEmployee = null;
// 年齢計算関数

View File

@@ -207,7 +207,7 @@
</div>
<script>
const API_BASE = "http://localhost:18080";
const API_BASE = "";
let employees = [];
async function loadEmployees() {

View File

@@ -94,6 +94,13 @@
table th {
background: #f0f0f0;
}
/* Add alternating row background for readability */
table tbody tr:nth-child(odd) {
background: #ffffff;
}
table tbody tr:nth-child(even) {
background: #f8f9fb;
}
.filter-section {
background: #f9f9f9;
padding: 15px;
@@ -598,7 +605,7 @@
</div>
<script>
const API_BASE = "http://localhost:18080";
const API_BASE = "";
// =====================================================
// タブ切り替え