修正
This commit is contained in:
@@ -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
@@ -142,7 +142,8 @@
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
window.location.href = "journal-entry.html";
|
||||
// 画面を閉じる
|
||||
window.close();
|
||||
}
|
||||
|
||||
loadJournalEntry();
|
||||
|
||||
Reference in New Issue
Block a user