feat(796-2d): 단가산출 상세 탭 소계 · 합계가 합밖 · 제외 단계 줄을 안 더함 — 엔진 줄 표지 합밖 · 상세 줄 합 밖 배지 · 박스 소계 · 합계 표지 줄 뺌(금액 셈 그대로)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,8 @@ export interface HoRowLike {
|
||||
bundle: string;
|
||||
merge: boolean;
|
||||
amount: number | null;
|
||||
/** 합계 밖 줄(엔진 `합밖`) — 보이되 소계에 안 더함 */
|
||||
out?: boolean;
|
||||
}
|
||||
export interface HoMerged<T> {
|
||||
idx: number;
|
||||
@@ -80,7 +82,7 @@ export function boxesOf<T extends HoRowLike>(list: T[], always: string[] = []):
|
||||
const merged = new Map<string, HoMerged<T>>();
|
||||
for (const e of list) {
|
||||
const b = take(e.bundle);
|
||||
b.소계 += e.amount ?? 0;
|
||||
if (!e.out) b.소계 += e.amount ?? 0;
|
||||
if (!e.merge) {
|
||||
b.줄.push(e);
|
||||
continue;
|
||||
@@ -112,6 +114,7 @@ const TEXT = {
|
||||
Per: ["{n} — {v} 원/{u}", "{n} — {v} KRW/{u}"],
|
||||
Edited: ["시험 고침", "Trial edit"],
|
||||
EditedM02: ["변경 항목", "Override"],
|
||||
Out: ["합 밖", "Outside total"],
|
||||
} as const satisfies Record<string, readonly [string, string]>;
|
||||
const th = (k: keyof typeof TEXT): string => TEXT[k][currentLanguageIndex as 0 | 1] ?? TEXT[k][0];
|
||||
const boxName = (b: string): string => (b in TEXT ? th(b as keyof typeof TEXT) : b);
|
||||
@@ -333,6 +336,7 @@ function entries(ctx: HoContext): Entry[] {
|
||||
price: shown,
|
||||
linePrice: shown,
|
||||
amount: line ? line.금액 : null,
|
||||
out: !!line?.합밖,
|
||||
warn: line?.단위경고,
|
||||
extra: false,
|
||||
line,
|
||||
@@ -360,6 +364,7 @@ function entries(ctx: HoContext): Entry[] {
|
||||
price: "",
|
||||
linePrice: "",
|
||||
amount: line ? line.금액 : null,
|
||||
out: !!line?.합밖,
|
||||
extra: true,
|
||||
line,
|
||||
logic: false,
|
||||
@@ -463,6 +468,7 @@ function nameCell(e: Entry, label: string, tag: string): HTMLElement {
|
||||
: el("div", { text: label }),
|
||||
...(e.share && label === e.name ? [createBadge(`${e.share} ${tl("Share")}`, "accent")] : []),
|
||||
...(e.spec ? [el("div", { className: "ui-text ui-text--muted", text: e.spec })] : []),
|
||||
...(e.out ? [createBadge(th("Out"), "warning")] : []),
|
||||
...(e.warn ? [createBadge(`${tx("Calc_UnitWarn")} · ${e.warn}`, "warning")] : []),
|
||||
...(tag ? [createBadge(tag, "accent")] : []),
|
||||
],
|
||||
@@ -671,7 +677,9 @@ export function buildHo(ctx: HoContext): HTMLElement[] {
|
||||
const sums = Object.fromEntries(
|
||||
FOOT_KEYS.map((g) => [
|
||||
g,
|
||||
rounddown(all.filter((e) => e.group === g).reduce((s, e) => s + (e.amount ?? 0), 0)),
|
||||
rounddown(
|
||||
all.filter((e) => e.group === g && !e.out).reduce((s, e) => s + (e.amount ?? 0), 0),
|
||||
),
|
||||
]),
|
||||
) as Record<FootKey, number>; // 751-3 비목 소계 = 줄 합 1 원 버림 · 계 = 셋 합(서버와 같은 값)
|
||||
const total = FOOT_KEYS.reduce((s, g) => s + sums[g], 0);
|
||||
|
||||
Reference in New Issue
Block a user