修正
This commit is contained in:
@@ -5,33 +5,109 @@
|
||||
<title>試算表</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-family: 'MS Gothic', 'Meiryo', sans-serif;
|
||||
margin: 24px;
|
||||
font-size: 13px;
|
||||
}
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.search-form {
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
padding: 15px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.search-form label {
|
||||
margin-right: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.search-form input {
|
||||
margin-right: 15px;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #999;
|
||||
border-radius: 3px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.search-form button {
|
||||
padding: 6px 20px;
|
||||
margin: 0 5px;
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
}
|
||||
.search-form button:hover {
|
||||
background: #45a049;
|
||||
}
|
||||
.search-form button.secondary {
|
||||
background: #2196F3;
|
||||
}
|
||||
.search-form button.secondary:hover {
|
||||
background: #0b7dda;
|
||||
}
|
||||
.period-info {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
th,
|
||||
td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #999;
|
||||
padding: 5px 8px;
|
||||
text-align: right;
|
||||
}
|
||||
th {
|
||||
background: #f5f5f5;
|
||||
background: #e8e8e8;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
td.left {
|
||||
text-align: left;
|
||||
}
|
||||
td.right {
|
||||
text-align: right;
|
||||
}
|
||||
tr.total-row td {
|
||||
background-color: #d8d8d8 !important;
|
||||
font-weight: bold;
|
||||
border-top: 2px solid #666;
|
||||
}
|
||||
tfoot td {
|
||||
font-weight: bold;
|
||||
background: #fafafa;
|
||||
background: #e0e0e0;
|
||||
border-top: 2px solid #333;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>試算表</h2>
|
||||
<h2>残高試算表(貸借・損益)</h2>
|
||||
|
||||
<div class="search-form">
|
||||
<label for="dateFrom">開始年月日:</label>
|
||||
<input type="date" id="dateFrom" />
|
||||
|
||||
<label for="dateTo">終了年月日:</label>
|
||||
<input type="date" id="dateTo" />
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<table id="trialBalanceTable">
|
||||
<thead>
|
||||
@@ -39,9 +115,10 @@
|
||||
<th class="left">科目コード</th>
|
||||
<th class="left">科目名称</th>
|
||||
<th>期首残高</th>
|
||||
<th>借方合計</th>
|
||||
<th>贷方合計</th>
|
||||
<th>借方発生額</th>
|
||||
<th>貸方発生額</th>
|
||||
<th>期末残高</th>
|
||||
<th>構成比(%)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -54,54 +131,14 @@
|
||||
<td id="totalDebit">0</td>
|
||||
<td id="totalCredit">0</td>
|
||||
<td id="totalClosing">0</td>
|
||||
<td id="totalRatio">100.00</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
const API_BASE = "http://127.0.0.1:18080"; // 和你后端一致
|
||||
|
||||
async function loadTrialBalance() {
|
||||
const res = await fetch(`${API_BASE}/trial-balance`);
|
||||
if (!res.ok) {
|
||||
alert("試算表の取得に失敗しました");
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
const tbody = document.querySelector("#trialBalanceTable tbody");
|
||||
tbody.innerHTML = "";
|
||||
|
||||
data.accounts.forEach((acc) => {
|
||||
const tr = document.createElement("tr");
|
||||
tr.innerHTML = `
|
||||
<td class="left">${acc.account_code}</td>
|
||||
<td class="left">${acc.account_name}</td>
|
||||
<td>${Number(acc.opening_balance).toLocaleString()}</td>
|
||||
<td>${Number(acc.debit).toLocaleString()}</td>
|
||||
<td>${Number(acc.credit).toLocaleString()}</td>
|
||||
<td>${Number(acc.closing_balance).toLocaleString()}</td>
|
||||
`;
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
|
||||
// totals
|
||||
document.getElementById("totalOpening").innerText = Number(
|
||||
data.totals.opening_balance
|
||||
).toLocaleString();
|
||||
document.getElementById("totalDebit").innerText = Number(
|
||||
data.totals.debit
|
||||
).toLocaleString();
|
||||
document.getElementById("totalCredit").innerText = Number(
|
||||
data.totals.credit
|
||||
).toLocaleString();
|
||||
document.getElementById("totalClosing").innerText = Number(
|
||||
data.totals.closing_balance
|
||||
).toLocaleString();
|
||||
}
|
||||
|
||||
loadTrialBalance();
|
||||
<script src="js/trial-balance.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user