fix(m01): 흐름 합계 끝수 = 비용 출력 상자에 실린 로직 자신의 끝수 · 새 로직만 기본 1원 미만 버림
왼쪽 흐름 보기 소계 · 계와 오른쪽 원가 합계가 같은 끝수를 씀(Round.totalRoundOf) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EauA2ATmqNRbeV48s9CcBr
This commit is contained in:
@@ -107,3 +107,15 @@ export function showRounded(v: number, r?: CfRound): string {
|
||||
let totalNow: CfRound = { places: 0, method: "버림" };
|
||||
void defaultTotalRound().then((r) => (totalNow = r));
|
||||
export const totalRoundNow = (): CfRound => totalNow;
|
||||
|
||||
/** 그 로직의 합계 끝수 — 비용 출력 상자에 끝수가 실려 있으면 그것(옛 로직을 옮긴 흐름은 자신의 끝수) ·
|
||||
* 없으면 기본(새 로직 = 일위대가표 계금 1원 미만 버림) */
|
||||
export function totalRoundOf(
|
||||
lg: { boxes: { kind: string; output?: { cost: string; round?: CfRound } }[] },
|
||||
fallback: CfRound,
|
||||
): CfRound {
|
||||
const hit = lg.boxes.find(
|
||||
(b) => b.kind === "output" && b.output?.cost !== "값" && b.output?.round,
|
||||
);
|
||||
return hit?.output?.round ?? fallback;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,14 @@ import { formatMoney } from "../../M01_MasterData/M01_MasterData_UI_Logic_Money"
|
||||
import type { CfEvalOptions, CfEvalResult, CfValues } from "./M02_DF_Eval";
|
||||
import type { CfBox, CfLogic, CfRound } from "./M02_DF_Model";
|
||||
import { showValue } from "./M02_DF_OutputPanel";
|
||||
import { defaultTotalRound, itemRoundNow, roundBy, roundText, showRounded } from "./M02_DF_Round";
|
||||
import {
|
||||
defaultTotalRound,
|
||||
itemRoundNow,
|
||||
roundBy,
|
||||
roundText,
|
||||
showRounded,
|
||||
totalRoundOf,
|
||||
} from "./M02_DF_Round";
|
||||
import { renderVerify, type CfSel } from "./M02_DF_Verify";
|
||||
import "./M02_DF_Summary.css";
|
||||
|
||||
@@ -69,18 +76,20 @@ export function renderSummary(
|
||||
? ts("Total")
|
||||
: ts("Per", { per: /^\d/.test(perUnit) ? perUnit : `1${perUnit}` });
|
||||
const { cost } = result;
|
||||
/** 합계 끝수 — 비용 출력 상자에 실린 끝수(옮긴 로직의 자신 끝수) · 없으면 기본 1원 미만 버림 */
|
||||
const sumRound = totalRoundOf(lg, totalRound);
|
||||
const big = el("p", {
|
||||
className: "m02-dfsum__big",
|
||||
children: [
|
||||
el("span", { text: money ? perText : ts("Total") }),
|
||||
el("strong", { text: `${formatMoney(roundBy(totalRound, cost.계))} ${ts("Won")}` }),
|
||||
el("strong", { text: `${formatMoney(roundBy(sumRound, cost.계))} ${ts("Won")}` }),
|
||||
],
|
||||
});
|
||||
const costs = el("dl", {
|
||||
className: "m02-dfsum__costs",
|
||||
children: COSTS.flatMap((c) => [
|
||||
el("dt", { text: ts(COST_KEY[c]) }),
|
||||
el("dd", { text: formatMoney(roundBy(totalRound, cost[c])) }),
|
||||
el("dd", { text: formatMoney(roundBy(sumRound, cost[c])) }),
|
||||
]),
|
||||
});
|
||||
|
||||
@@ -161,7 +170,7 @@ export function renderSummary(
|
||||
: []),
|
||||
el("p", {
|
||||
className: "m02-dfsum__muted",
|
||||
text: `${ts("RoundTotal")}: ${roundText(totalRound)}`,
|
||||
text: `${ts("RoundTotal")}: ${roundText(sumRound)}`,
|
||||
}),
|
||||
verifyHost,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user