修正
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
button {
|
||||
padding: 6px;
|
||||
}
|
||||
#linesTable td input {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
@@ -122,10 +126,11 @@
|
||||
<table id="linesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>科目</th>
|
||||
<th>借方</th>
|
||||
<th>貸方</th>
|
||||
<th>操作</th>
|
||||
<th style="width: 220px">科目</th>
|
||||
<th style="width: 120px">借方</th>
|
||||
<th style="width: 120px">貸方</th>
|
||||
<th style="width: 180px">摘要(行)</th>
|
||||
<th style="width: 60px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
@@ -135,6 +140,7 @@
|
||||
<th id="debitTotal" class="right">0</th>
|
||||
<th id="creditTotal" class="right">0</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@@ -277,7 +283,11 @@
|
||||
filtered = accounts.filter((acc) => {
|
||||
const code = acc.account_code.toLowerCase();
|
||||
const name = acc.account_name.toLowerCase();
|
||||
return code.includes(searchText) || name.includes(searchText);
|
||||
return (
|
||||
code.includes(searchText) ||
|
||||
name.includes(searchText) ||
|
||||
`${code} ${name}`.includes(searchText)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -426,8 +436,9 @@
|
||||
<div class="account-dropdown"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td><input type="number" min="0"></td>
|
||||
<td><input type="number" min="0"></td>
|
||||
<td><input type="number" min="0" style="text-align:right"></td>
|
||||
<td><input type="number" min="0" style="text-align:right"></td>
|
||||
<td><input type="text" class="line-memo-input" placeholder="行摘要(任意)"></td>
|
||||
<td><button onclick="removeRow(this)">削除</button></td>
|
||||
`;
|
||||
|
||||
@@ -453,6 +464,9 @@
|
||||
const creditVal = Number(line.credit) || 0;
|
||||
numberInputs[0].value = debitVal > 0 ? String(debitVal) : "";
|
||||
numberInputs[1].value = creditVal > 0 ? String(creditVal) : "";
|
||||
// 摘要(行)を設定
|
||||
const memoInput = tr.querySelector(".line-memo-input");
|
||||
if (memoInput) memoInput.value = line.line_description || "";
|
||||
}
|
||||
|
||||
// 入力時に合計を自動更新
|
||||
@@ -540,8 +554,15 @@
|
||||
const numberInputs = tr.querySelectorAll("input[type='number']");
|
||||
const debit = Number(numberInputs[0]?.value || 0);
|
||||
const credit = Number(numberInputs[1]?.value || 0);
|
||||
const lineDesc =
|
||||
tr.querySelector(".line-memo-input")?.value.trim() || undefined;
|
||||
if (debit === 0 && credit === 0) return;
|
||||
lines.push({ account_id: accountId, debit, credit });
|
||||
lines.push({
|
||||
account_id: accountId,
|
||||
debit,
|
||||
credit,
|
||||
...(lineDesc ? { line_description: lineDesc } : {}),
|
||||
});
|
||||
d += debit;
|
||||
c += credit;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user