This commit is contained in:
admin
2026-02-20 15:47:27 +09:00
parent c60cbf2d9a
commit 584530937b
108 changed files with 12112 additions and 416 deletions

View File

@@ -203,11 +203,14 @@
if (lines.length < 2) return showError("仕訳行は2行以上必要です");
if (d !== c) return showError("借方合計と貸方合計が一致していません");
// 仕訳IDを親IDとして取得逆仕訳が存在する場合)
// 仕訳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;
// 【修正仕訳】の original_entry_id は、修正元の仕訳ID
// 如果当前是修正版本,传递它的 original_entry_id(真正的原始版本)
// 如果当前是原始版本,传递它自己的 journal_entry_id
const originalEntryId =
srcData?.original_entry_id || srcData?.journal_entry_id || null;
const payload = {
entry_date: entryDate,
@@ -216,7 +219,7 @@
tax_paid_account_id: null,
tax_received_account_id: null,
rounding_mode: "floor",
parent_entry_id: parentEntryId,
original_entry_id: originalEntryId,
};
try {
@@ -227,8 +230,17 @@
});
const data = await res.json();
if (!res.ok) return showError(data.detail || "登録失敗");
showOk(`修正版仕訳を登録しましたID: ${data.journal_entry_id}`);
// 登録成功 - 親窓口の検索を再実行してから画面を閉じる
alert(`登録しましたID: ${data.journal_entry_id}`);
localStorage.removeItem("editSource");
// 親窓口(列表页)の searchJournalsを呼び出す
if (window.opener && window.opener.searchJournals) {
window.opener.searchJournals();
}
window.close();
} catch {
showError("通信エラー");
}
@@ -246,10 +258,8 @@
}
function cancelEdit() {
if (confirm("編集をキャンセルして一覧画面に戻りますか?")) {
localStorage.removeItem("editSource");
window.location.href = "journal-list.html";
}
localStorage.removeItem("editSource");
window.close();
}
</script>
</body>

File diff suppressed because it is too large Load Diff

View File

@@ -142,7 +142,8 @@
}
function goBack() {
window.location.href = "journal-entry.html";
// 画面を閉じる
window.close();
}
loadJournalEntry();