diff --git a/tools/est-test/native-actions.js b/tools/est-test/native-actions.js
index 7c92f39d0..e311a2d54 100644
--- a/tools/est-test/native-actions.js
+++ b/tools/est-test/native-actions.js
@@ -140,6 +140,7 @@ const EstActions = (() => {
if (confirm("저장하지 않은 입력을 비우고 새 내역서를 만드시겠습니까?")) {
EstApp.setProject(EstNative.empty());
if (typeof EstDefaults !== "undefined") await EstDefaults.applyNew();
+ if (typeof EstFormsLibrary !== "undefined") await EstFormsLibrary.applyDefault();
}
} else if (name === "sample") {
if (confirm("현재 작업을 REA 샘플로 바꾸시겠습니까?"))
diff --git a/tools/est-test/native-forms-library.js b/tools/est-test/native-forms-library.js
index f5b14a3e7..dd429db74 100644
--- a/tools/est-test/native-forms-library.js
+++ b/tools/est-test/native-forms-library.js
@@ -1,6 +1,8 @@
// 원본 원가계산서 양식(TFRMWONGABASE popupSaveAs·popupFormats·popupLoadFrom)과 양식목록(TFRMFORMATFILELIST)
// — 현재 원가 표를 이름 붙여 서버 보관함(data/forms.json)에 등록하고, 목록에서 열기·삭제, 파일로 내려받기·불러오기.
+// 기본양식으로 저장(popupSaveAsMain): 이름 「기본양식」 — 새 내역서를 만들 때 원가계산서로 쓴다.
const EstFormsLibrary = (() => {
+ const DEFAULT = "기본양식";
// 원가 표 양식으로 남길 필드 — 금액(Cost)은 계산 결과라 남기지 않는다.
function strip(rows) {
return rows.map((row) => {
@@ -23,7 +25,7 @@ const EstFormsLibrary = (() => {
forms = await list();
EstApp.showDialog(
"원가계산서 양식 목록",
- `현재 원가계산서의 항목·수식·요율을 양식으로 등록하고, 다른 공사에서 열어 씁니다. 금액은 열 때 다시 계산합니다.
| 양식 이름 | 행 | 등록 | 작업 |
${forms.map((f) => `| ${esc(f.name)} | ${f.data.length} | ${esc(f.saved.slice(0, 10))} | |
`).join("") || '| 등록된 양식이 없습니다. |
'}
`,
+ `현재 원가계산서의 항목·수식·요율을 양식으로 등록하고, 다른 공사에서 열어 씁니다. 금액은 열 때 다시 계산합니다.
| 양식 이름 | 행 | 등록 | 작업 |
${forms.map((f) => `| ${esc(f.name)} | ${f.data.length} | ${esc(f.saved.slice(0, 10))} | |
`).join("") || '| 등록된 양식이 없습니다. |
'}
`,
);
state.formsLibrary = forms;
}
@@ -52,6 +54,18 @@ const EstFormsLibrary = (() => {
body: JSON.stringify({ kind: "wonga", name: title, data }),
});
await show(state);
+ } else if (name === "wonga-form-default") {
+ if (!confirm("현재 원가계산서를 새 내역서의 기본양식으로 저장하시겠습니까?")) return;
+ await EstApp.api("/api/forms", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ kind: "wonga",
+ name: DEFAULT,
+ data: strip(validRows(state.project.tables.Wonga)),
+ }),
+ });
+ await show(state);
} else if (name === "wonga-form-open") {
const form = state.formsLibrary?.find((f) => f.name === node.dataset.name);
if (!form) throw Error("양식을 찾을 수 없습니다. 목록을 다시 여세요.");
@@ -92,6 +106,7 @@ const EstFormsLibrary = (() => {
const names = new Set([
"wonga-forms",
"wonga-form-register",
+ "wonga-form-default",
"wonga-form-open",
"wonga-form-delete",
"wonga-form-export",
@@ -107,5 +122,13 @@ const EstFormsLibrary = (() => {
return true;
}
- return { strip, validRows, handle };
+ // 새 내역서에 기본양식 원가계산서
+ async function applyDefault() {
+ const form = (await list()).find((f) => f.name === DEFAULT);
+ if (form)
+ EstApp.change((project) => (project.tables.Wonga = structuredClone(validRows(form.data))));
+ return Boolean(form);
+ }
+
+ return { strip, validRows, applyDefault, handle };
})();
diff --git a/tools/est-test/native-wonga-tools.js b/tools/est-test/native-wonga-tools.js
index cb144ac48..9788dcdf4 100644
--- a/tools/est-test/native-wonga-tools.js
+++ b/tools/est-test/native-wonga-tools.js
@@ -282,6 +282,26 @@ const EstWongaTools = (() => {
}
function handle(name, state) {
+ if (name === "wonga-content-del") {
+ // 내용 삭제(popupContentDel A7): 연결·금액·비율·요율·산출근거·자리 비움, 이름·기호·계산방식 유지, 재계산 없음
+ const rows = state.project.tables.Wonga || [],
+ picked = [...state.selection].filter((i) => rows[i]);
+ if (state.view !== "Wonga" || !picked.length)
+ throw Error("원가계산서에서 지울 줄을 고르세요.");
+ EstApp.change((project) => {
+ for (const i of picked)
+ Object.assign(project.tables.Wonga[i], {
+ LinkIndex: 0,
+ Cost: 0,
+ Biul: "",
+ Youl: "",
+ VSusic: "",
+ Diget: 0,
+ Checked: false,
+ });
+ }, false);
+ return true;
+ }
if (name === "wonga-sname") {
EstApp.change(
(project) => (project.options.WongaSNameShow = !project.options.WongaSNameShow),