chore: 年度リストを昇順に変更

This commit is contained in:
admin
2026-06-07 21:58:20 +09:00
parent 91632ea5b6
commit 4a500ff5e9
25 changed files with 1531 additions and 67 deletions

View File

@@ -254,6 +254,41 @@ function initTrialBalance() {
}
}
// 年度ドロップダウンを読み込む
async function loadFiscalYears() {
try {
const res = await fetch("/trial-balance/fiscal-years");
if (!res.ok) return;
const years = await res.json();
const sel = document.getElementById("fiscalYear");
if (!sel) return;
years.forEach((fy) => {
const opt = document.createElement("option");
opt.value = JSON.stringify({
date_from: fy.date_from,
date_to: fy.date_to,
});
opt.textContent = fy.label;
sel.appendChild(opt);
});
} catch (e) {
console.warn("年度一覧取得失敗:", e);
}
}
loadFiscalYears();
// 年度選択 → 開始・終了日を自動セット(ユーザーは自由に変更可能)
document.getElementById("fiscalYear").addEventListener("change", function () {
if (!this.value) return;
try {
const { date_from, date_to } = JSON.parse(this.value);
document.getElementById("dateFrom").value = date_from;
document.getElementById("dateTo").value = date_to;
} catch (e) {
/* ignore */
}
});
// 檢索按鈕的事件
document.getElementById("btnSearch").addEventListener("click", () => {
const dateFrom = document.getElementById("dateFrom").value;