Files
Aislo/tools/est-test/native-settings.js
T

94 lines
2.7 KiB
JavaScript

const EstSettings = (() => {
function show() {
const project = EstApp.state.project;
EstActions.form(
"계산 환경 설정",
[
{
name: "head",
label: "일위대가 성분 소수자리",
type: "number",
value: project.options.HeadDigits || 0,
},
{
name: "estimate",
label: "내역 성분 소수자리",
type: "number",
value: project.options.EstDigits || 0,
},
{
name: "total",
value: project.options.TotalFix ? "1" : "0",
label: "도급액 고정",
choices: [
["0", "해제"],
["1", "원가 LinkIndex 55행 금액에 고정"],
],
},
{
name: "fit",
value: project.options.TotalFit ? "1" : "0",
label: "성분 합계 맞춤",
choices: [
["0", "해제"],
["1", "최대 나머지 배분"],
],
},
{
name: "dollar",
value: project.options.DollarCostCut ? "1" : "0",
label: "외화 원화환산 천원 절사",
choices: [
["0", "원 단위"],
["1", "천원 단위"],
],
},
{
name: "jdl",
value: project.options.JDLCalcMethod ? "1" : "0",
label: "운전사 중간금액 소수1자리 절사",
choices: [
["0", "해제"],
["1", "사용"],
],
},
{
name: "materials",
value: project.options.GCToWonga ? "1" : "0",
label: "순직접공사비 재료비 처리",
choices: [
["0", "간접재료비"],
["1", "직접재료비"],
],
},
{
name: "procurement",
value: project.options.GangubExceptJodalRatio ? "1" : "0",
label: "산업안전보건관리비의 관급자재대에서 조달수수료",
choices: [
["0", "포함"],
["1", "제외"],
],
},
],
(values) => {
if (![values.head, values.estimate].every((n) => Number.isInteger(n) && n >= 0 && n <= 6))
throw Error("소수 자릿수는 0~6 정수입니다.");
EstApp.change(() =>
Object.assign(project.options, {
HeadDigits: values.head,
EstDigits: values.estimate,
TotalFix: values.total === "1",
TotalFit: values.fit === "1",
DollarCostCut: values.dollar === "1",
JDLCalcMethod: values.jdl === "1",
GCToWonga: values.materials === "1",
GangubExceptJodalRatio: values.procurement === "1",
}),
);
},
);
}
return { show };
})();