This commit is contained in:
admin
2026-05-22 23:05:38 +09:00
parent e8690d130b
commit ebc87f96f9
6 changed files with 1783 additions and 1214 deletions

View File

@@ -10,7 +10,6 @@ html {
}
@media screen and (max-width: 767px) {
/* ── body 余白を縮小 ── */
body {
padding: 12px !important;
@@ -18,8 +17,12 @@ html {
}
/* ── h1・h2 フォントサイズ ── */
h1 { font-size: 1.35rem !important; }
h2 { font-size: 1.1rem !important; }
h1 {
font-size: 1.35rem !important;
}
h2 {
font-size: 1.1rem !important;
}
/* ================================================================
テーブル: 横スクロール
@@ -320,5 +323,4 @@ html {
width: 100% !important;
box-sizing: border-box !important;
}
}

View File

@@ -863,7 +863,19 @@
<div class="search-buttons">
<button onclick="searchJournals()">🔍 検索</button>
<button onclick="printSearchResults()">🖨️ 印刷</button>
<button onclick="clearSearchConditions()" style="background: #6c757d; color: white; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer;">🔄 条件クリア</button>
<button
onclick="clearSearchConditions()"
style="
background: #6c757d;
color: white;
border: none;
padding: 6px 14px;
border-radius: 4px;
cursor: pointer;
"
>
🔄 条件クリア
</button>
</div>
</div>
@@ -2830,7 +2842,8 @@
// 複数行フォームへのコピー
function copyJournalToDetailForm(data) {
document.getElementById("detailEntryDate").value = data.entry_date;
document.getElementById("detailDescription").value = data.description || "";
document.getElementById("detailDescription").value =
data.description || "";
// 既存行をクリア
document.getElementById("detailLinesTbody").innerHTML = "";
@@ -2846,10 +2859,14 @@
accountInput.dataset.accountId = acc.account_id;
}
if (Number(line.debit) > 0) {
tr.querySelector(".detail-debit").value = Number(line.debit).toLocaleString();
tr.querySelector(".detail-debit").value = Number(
line.debit,
).toLocaleString();
}
if (Number(line.credit) > 0) {
tr.querySelector(".detail-credit").value = Number(line.credit).toLocaleString();
tr.querySelector(".detail-credit").value = Number(
line.credit,
).toLocaleString();
}
if (line.line_description) {
tr.querySelector(".detail-line-memo").value = line.line_description;
@@ -2879,58 +2896,121 @@
// 新UIでは簡易的にフォームに反映最初の借方行の科目 + 最初の貸方行を取引手段に設定)
if (data.lines && data.lines.length > 0) {
// 借方と貸方を分類
const debitLines = data.lines.filter((l) => Number(l.debit) > 0);
const creditLines = data.lines.filter((l) => Number(l.credit) > 0);
// 借方と貸方を分類
const debitLines = data.lines.filter((l) => Number(l.debit) > 0);
const creditLines = data.lines.filter((l) => Number(l.credit) > 0);
// 仮払/仮受消費税行を除外して主要な科目を特定
const mainDebit = debitLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return (
acc &&
!acc.account_name.includes("仮払消費税") &&
!acc.account_name.includes("仮受消費税")
// 仮払/仮受消費税行を除外して主要な科目を特定
const mainDebit = debitLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return (
acc &&
!acc.account_name.includes("仮払消費税") &&
!acc.account_name.includes("仮受消費税")
);
});
const mainCredit = creditLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return (
acc &&
!acc.account_name.includes("仮払消費税") &&
!acc.account_name.includes("仮受消費税")
);
});
// 税額行を検出
const taxDebitLine = debitLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return acc && acc.account_name.includes("仮払消費税");
});
const taxCreditLine = creditLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return acc && acc.account_name.includes("仮受消費税");
});
if (mainDebit && mainCredit) {
// 支出パターン: 借方=科目, 貸方=取引手段
if (taxDebitLine) {
// 支出(仮払消費税あり)
document.querySelector(
'input[name="entryType"][value="expense"]',
).checked = true;
const kamokuAcc = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
});
const mainCredit = creditLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return (
acc &&
!acc.account_name.includes("仮払消費税") &&
!acc.account_name.includes("仮受消費税")
const methodAcc = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
});
// 税額行を検出
const taxDebitLine = debitLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return acc && acc.account_name.includes("仮払消費税");
});
const taxCreditLine = creditLines.find((l) => {
const acc = accounts.find((a) => a.account_id === l.account_id);
return acc && acc.account_name.includes("仮受消費税");
});
if (mainDebit && mainCredit) {
// 支出パターン: 借方=科目, 貸方=取引手段
if (taxDebitLine) {
// 支出(仮払消費税あり)
if (kamokuAcc) {
document.getElementById("entryAccountInput").value =
`${kamokuAcc.account_code} ${kamokuAcc.account_name}`;
document.getElementById("entryAccountInput").dataset.accountId =
kamokuAcc.account_id;
}
if (methodAcc) {
document.getElementById("entryMethodInput").value =
`${methodAcc.account_code} ${methodAcc.account_name}`;
document.getElementById("entryMethodInput").dataset.accountId =
methodAcc.account_id;
}
const totalAmount = Number(mainCredit.credit);
document.getElementById("entryAmount").value =
totalAmount.toLocaleString();
document.getElementById("entryTaxAmount").value = Number(
taxDebitLine.debit,
).toLocaleString();
} else if (taxCreditLine) {
// 収入(仮受消費税あり)
document.querySelector(
'input[name="entryType"][value="income"]',
).checked = true;
const kamokuAcc = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
const methodAcc = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
if (kamokuAcc) {
document.getElementById("entryAccountInput").value =
`${kamokuAcc.account_code} ${kamokuAcc.account_name}`;
document.getElementById("entryAccountInput").dataset.accountId =
kamokuAcc.account_id;
}
if (methodAcc) {
document.getElementById("entryMethodInput").value =
`${methodAcc.account_code} ${methodAcc.account_name}`;
document.getElementById("entryMethodInput").dataset.accountId =
methodAcc.account_id;
}
const totalAmount = Number(mainDebit.debit);
document.getElementById("entryAmount").value =
totalAmount.toLocaleString();
document.getElementById("entryTaxAmount").value = Number(
taxCreditLine.credit,
).toLocaleString();
} else {
// 消費税なし - 借方科目が費用/資産 → 支出、それ以外は収入
const kamokuAccD = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
const isExpense =
kamokuAccD &&
(kamokuAccD.account_code.startsWith("8") ||
kamokuAccD.account_code.startsWith("1") ||
kamokuAccD.account_code.startsWith("2") ||
kamokuAccD.account_code.startsWith("3") ||
kamokuAccD.account_code.startsWith("4"));
if (isExpense) {
document.querySelector(
'input[name="entryType"][value="expense"]',
).checked = true;
const kamokuAcc = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
document.getElementById("entryAccountInput").value =
`${kamokuAccD.account_code} ${kamokuAccD.account_name}`;
document.getElementById("entryAccountInput").dataset.accountId =
kamokuAccD.account_id;
const methodAcc = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
if (kamokuAcc) {
document.getElementById("entryAccountInput").value =
`${kamokuAcc.account_code} ${kamokuAcc.account_name}`;
document.getElementById(
"entryAccountInput",
).dataset.accountId = kamokuAcc.account_id;
}
if (methodAcc) {
document.getElementById("entryMethodInput").value =
`${methodAcc.account_code} ${methodAcc.account_name}`;
@@ -2938,116 +3018,47 @@
"entryMethodInput",
).dataset.accountId = methodAcc.account_id;
}
const totalAmount = Number(mainCredit.credit);
document.getElementById("entryAmount").value =
totalAmount.toLocaleString();
document.getElementById("entryTaxAmount").value = Number(
taxDebitLine.debit,
document.getElementById("entryAmount").value = Number(
mainDebit.debit,
).toLocaleString();
} else if (taxCreditLine) {
// 収入(仮受消費税あり)
} else {
document.querySelector(
'input[name="entryType"][value="income"]',
).checked = true;
const kamokuAcc = accounts.find(
const kamokuAccC = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
const methodAcc = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
if (kamokuAcc) {
if (kamokuAccC) {
document.getElementById("entryAccountInput").value =
`${kamokuAcc.account_code} ${kamokuAcc.account_name}`;
`${kamokuAccC.account_code} ${kamokuAccC.account_name}`;
document.getElementById(
"entryAccountInput",
).dataset.accountId = kamokuAcc.account_id;
).dataset.accountId = kamokuAccC.account_id;
}
if (methodAcc) {
document.getElementById("entryMethodInput").value =
`${methodAcc.account_code} ${methodAcc.account_name}`;
document.getElementById(
"entryMethodInput",
).dataset.accountId = methodAcc.account_id;
}
const totalAmount = Number(mainDebit.debit);
document.getElementById("entryAmount").value =
totalAmount.toLocaleString();
document.getElementById("entryTaxAmount").value = Number(
taxCreditLine.credit,
document.getElementById("entryMethodInput").value =
`${kamokuAccD.account_code} ${kamokuAccD.account_name}`;
document.getElementById("entryMethodInput").dataset.accountId =
kamokuAccD.account_id;
document.getElementById("entryAmount").value = Number(
mainDebit.debit,
).toLocaleString();
} else {
// 消費税なし - 借方科目が費用/資産 → 支出、それ以外は収入
const kamokuAccD = accounts.find(
(a) => a.account_id === mainDebit.account_id,
);
const isExpense =
kamokuAccD &&
(kamokuAccD.account_code.startsWith("8") ||
kamokuAccD.account_code.startsWith("1") ||
kamokuAccD.account_code.startsWith("2") ||
kamokuAccD.account_code.startsWith("3") ||
kamokuAccD.account_code.startsWith("4"));
if (isExpense) {
document.querySelector(
'input[name="entryType"][value="expense"]',
).checked = true;
document.getElementById("entryAccountInput").value =
`${kamokuAccD.account_code} ${kamokuAccD.account_name}`;
document.getElementById(
"entryAccountInput",
).dataset.accountId = kamokuAccD.account_id;
const methodAcc = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
if (methodAcc) {
document.getElementById("entryMethodInput").value =
`${methodAcc.account_code} ${methodAcc.account_name}`;
document.getElementById(
"entryMethodInput",
).dataset.accountId = methodAcc.account_id;
}
document.getElementById("entryAmount").value = Number(
mainDebit.debit,
).toLocaleString();
} else {
document.querySelector(
'input[name="entryType"][value="income"]',
).checked = true;
const kamokuAccC = accounts.find(
(a) => a.account_id === mainCredit.account_id,
);
if (kamokuAccC) {
document.getElementById("entryAccountInput").value =
`${kamokuAccC.account_code} ${kamokuAccC.account_name}`;
document.getElementById(
"entryAccountInput",
).dataset.accountId = kamokuAccC.account_id;
}
document.getElementById("entryMethodInput").value =
`${kamokuAccD.account_code} ${kamokuAccD.account_name}`;
document.getElementById(
"entryMethodInput",
).dataset.accountId = kamokuAccD.account_id;
document.getElementById("entryAmount").value = Number(
mainDebit.debit,
).toLocaleString();
}
document.getElementById("entryTaxRate").value = "0";
document.getElementById("entryTaxAmount").value = "";
}
document.getElementById("entryTaxRate").value = "0";
document.getElementById("entryTaxAmount").value = "";
}
}
}
// ページ上部の仕訳入力フォームにスクロール
window.scrollTo({ top: 0, behavior: "smooth" });
// ページ上部の仕訳入力フォームにスクロール
window.scrollTo({ top: 0, behavior: "smooth" });
const dateInput = document.getElementById("entryDate");
dateInput.focus();
const dateInput = document.getElementById("entryDate");
dateInput.focus();
showAlert(
`仕訳を複製しました。\n\n※ このコピーは新規仕訳として独立した記録になります。\n※ 日付と摘要を必要に応じて修正してから登録してください。`,
"success",
);
showAlert(
`仕訳を複製しました。\n\n※ このコピーは新規仕訳として独立した記録になります。\n※ 日付と摘要を必要に応じて修正してから登録してください。`,
"success",
);
}
// --------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1783,14 +1783,18 @@
// 源泉税控除対象人数を計算(給与と同じロジック)
const bDependentCount = employee.dependents
? employee.dependents.filter((d) => {
if (d.valid_to && new Date(d.valid_to) < new Date()) return false;
if (d.valid_to && new Date(d.valid_to) < new Date())
return false;
if (!d.birth_date) return false;
const birthDate = new Date(d.birth_date);
const targetYear = bonus.bonus_year;
const yearEnd = new Date(targetYear, 11, 31);
let age = yearEnd.getFullYear() - birthDate.getFullYear();
const monthDiff = yearEnd.getMonth() - birthDate.getMonth();
if (monthDiff < 0 || (monthDiff === 0 && yearEnd.getDate() < birthDate.getDate())) {
if (
monthDiff < 0 ||
(monthDiff === 0 && yearEnd.getDate() < birthDate.getDate())
) {
age--;
}
return age >= 16;
@@ -1969,10 +1973,10 @@
<div class="form-group">
<label>賞与種別</label>
<select name="bonus_type">
<option value="夏季賞与" ${bonus.bonus_type === '夏季賞与' ? 'selected' : ''}>夏季賞与</option>
<option value="冬季賞与" ${bonus.bonus_type === '冬季賞与' ? 'selected' : ''}>冬季賞与</option>
<option value="決算賞与" ${bonus.bonus_type === '決算賞与' ? 'selected' : ''}>決算賞与</option>
<option value="その他" ${bonus.bonus_type === 'その他' ? 'selected' : ''}>その他</option>
<option value="夏季賞与" ${bonus.bonus_type === "夏季賞与" ? "selected" : ""}>夏季賞与</option>
<option value="冬季賞与" ${bonus.bonus_type === "冬季賞与" ? "selected" : ""}>冬季賞与</option>
<option value="決算賞与" ${bonus.bonus_type === "決算賞与" ? "selected" : ""}>決算賞与</option>
<option value="その他" ${bonus.bonus_type === "その他" ? "selected" : ""}>その他</option>
</select>
</div>
</div>
@@ -2451,7 +2455,7 @@
const bonusPaymentDate = bonus.payment_date
? (() => {
const d = new Date(bonus.payment_date);
return `${d.getFullYear()}${String(d.getMonth()+1).padStart(2,'0')}${String(d.getDate()).padStart(2,'0')}`;
return `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, "0")}${String(d.getDate()).padStart(2, "0")}`;
})()
: `${bonus.bonus_year}${String(bonus.bonus_month).padStart(2, "0")}${getLastDayOfMonth(bonus.bonus_year, bonus.bonus_month)}`;
if (currentKey && currentKey !== currentKey_new) {

View File

@@ -118,16 +118,17 @@
>
<div class="icon">📄</div>
<h2>源泉徴収票</h2>
<p>給与所得の源泉徴収票を発行します(本人用・区役所用・税務署用 各1部</p>
<p>
給与所得の源泉徴収票を発行します(本人用・区役所用・税務署用 各1部
</p>
</div>
<div
class="menu-card"
onclick="location.href = 'nenkin-portal.html'"
>
<div class="menu-card" onclick="location.href = 'nenkin-portal.html'">
<div class="icon">📋</div>
<h2>社会保険電子文書</h2>
<p>日本年金機構からの電子文書(保険料通知・賞与内訳等)を管理します</p>
<p>
日本年金機構からの電子文書(保険料通知・賞与内訳等)を管理します
</p>
</div>
</div>

File diff suppressed because it is too large Load Diff