修正
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
<h2>修正仕訳入力</h2>
|
||||
|
||||
<label>仕訳日</label>
|
||||
<input type="date" id="entryDate" />
|
||||
<input type="date" id="entryDate" min="1900-01-01" max="9999-12-31" />
|
||||
|
||||
<label>摘要</label>
|
||||
<input type="text" id="description" style="width: 60%" />
|
||||
@@ -143,6 +143,12 @@
|
||||
tr.querySelectorAll("input")[0].value = line.debit || "";
|
||||
tr.querySelectorAll("input")[1].value = line.credit || "";
|
||||
}
|
||||
|
||||
// 入力時に合計を自動更新
|
||||
tr.querySelectorAll("input").forEach((input) => {
|
||||
input.addEventListener("input", recalc);
|
||||
input.addEventListener("change", recalc);
|
||||
});
|
||||
}
|
||||
|
||||
function removeRow(btn) {
|
||||
@@ -197,6 +203,12 @@
|
||||
if (lines.length < 2) return showError("仕訳行は2行以上必要です");
|
||||
if (d !== c) return showError("借方合計と貸方合計が一致していません");
|
||||
|
||||
// 逆仕訳IDを親IDとして取得(逆仕訳が存在する場合)
|
||||
const src = localStorage.getItem("editSource");
|
||||
const srcData = src ? JSON.parse(src) : null;
|
||||
// 【修正後】仕訳のparent_entry_idは、直前に作成された逆仕訳のID
|
||||
const parentEntryId = srcData?.reversed_journal_entry_id || null;
|
||||
|
||||
const payload = {
|
||||
entry_date: entryDate,
|
||||
description: desc,
|
||||
@@ -204,6 +216,7 @@
|
||||
tax_paid_account_id: null,
|
||||
tax_received_account_id: null,
|
||||
rounding_mode: "floor",
|
||||
parent_entry_id: parentEntryId,
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user