[verified] Implement account valuation history for issue 12
This commit is contained in:
@@ -75,15 +75,28 @@ def page_assets(db_path: str) -> None:
|
||||
st.divider()
|
||||
render_section_label("🔒", "월말 스냅샷 Preview / Close")
|
||||
st.caption("Preview는 DB를 변경하지 않습니다. 같은 기준일을 다시 close하면 정정 사유가 필요하며 기존 행을 덮어쓰지 않고 새 correction run을 append합니다.")
|
||||
c1, c2, c3 = st.columns([1, 1.5, 1.5])
|
||||
c1, c2, c3, c4 = st.columns([1, 1, 1.5, 1.5])
|
||||
basis_date = c1.text_input("마감 기준일", value=f"{current_kst_month()}-01", help="YYYY-MM-DD")
|
||||
close_note = c2.text_input("Close 출처 메모", value="month-end close")
|
||||
correction_reason = c3.text_input("정정 사유(재마감 시 필수)", value="")
|
||||
selection_policy = c2.selectbox("선택 정책", ["exact", "as_of"], format_func=lambda value: "정확히 해당일" if value == "exact" else "기준일 현재(as-of)")
|
||||
close_note = c3.text_input("Close 출처 메모", value="month-end close")
|
||||
correction_reason = c4.text_input("정정 사유(재마감 시 필수)", value="")
|
||||
p1, p2 = st.columns(2)
|
||||
approval_required = st.checkbox("조건부 close 승인 명시", value=False)
|
||||
approval_cols = st.columns(3)
|
||||
approved_by = approval_cols[0].text_input("승인자")
|
||||
approval_reason = approval_cols[1].text_input("승인 사유")
|
||||
approval_reference = approval_cols[2].text_input("승인 근거 참조")
|
||||
allow_missing = st.checkbox("누락 제외 허용", value=False)
|
||||
allow_carry = st.checkbox("as-of 이월 허용", value=False)
|
||||
if p1.button("스냅샷 Preview", type="secondary"):
|
||||
st.session_state["asset_snapshot_preview"] = assets_gateway.preview_asset_snapshot_close(basis_date, db_path=db_path)
|
||||
st.session_state["asset_snapshot_preview"] = assets_gateway.preview_asset_snapshot_close(basis_date, selection_policy=selection_policy, db_path=db_path)
|
||||
if p2.button("스냅샷 Close 실행", type="primary"):
|
||||
st.session_state["asset_snapshot_close"] = assets_gateway.close_asset_snapshot(basis_date, source_note=close_note, correction_reason=correction_reason, db_path=db_path)
|
||||
st.session_state["asset_snapshot_close"] = assets_gateway.close_asset_snapshot(
|
||||
basis_date, source_note=close_note, correction_reason=correction_reason,
|
||||
selection_policy=selection_policy, allow_missing_exclusions=allow_missing,
|
||||
allow_as_of_carry_forward=allow_carry, approved_by=approved_by if approval_required else "",
|
||||
approval_reason=approval_reason if approval_required else "", approval_reference=approval_reference if approval_required else "", db_path=db_path,
|
||||
)
|
||||
clear_cache()
|
||||
preview = st.session_state.get("asset_snapshot_preview")
|
||||
close_res = st.session_state.get("asset_snapshot_close")
|
||||
|
||||
Reference in New Issue
Block a user