diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp index c415e67..afaf3e8 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp @@ -369,13 +369,13 @@ $(function(){ fn_calculateTotal(); // 합계 재계산 }); - // 단가 입력 완료 시 콤마 자동 추가 + // 단가 입력 완료 시 포맷 적용 $(document).on("blur", ".item-price", function(){ var val = $(this).val().replace(/,/g, ""); if(!isNaN(val) && val !== "") { - $(this).val(addComma(val)); + $(this).val(Number(val).toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 2})); } - fn_calculateTotal(); // blur 시에도 합계 재계산 + fn_calculateTotal(); }); // 단가 입력 시 숫자만 입력 가능하도록 제한 및 실시간 콤마 처리 @@ -384,8 +384,8 @@ $(function(){ var originalVal = $(this).val(); var commasBefore = (originalVal.substring(0, cursorPos).match(/,/g) || []).length; - // 콤마 제거 후 숫자가 아닌 문자 제거 - var val = originalVal.replace(/,/g, "").replace(/[^0-9]/g, ""); + // 콤마 제거 후 숫자와 소수점 외 문자 제거 + var val = originalVal.replace(/,/g, "").replace(/[^0-9.]/g, ""); // 값 설정 (빈 문자열 포함) if(val !== "") { @@ -468,7 +468,7 @@ function fn_calculateAmount(row) { var qty = row.find(".item-qty").val().replace(/,/g, "") || "0"; var price = row.find(".item-price").val().replace(/,/g, "") || "0"; - var amount = parseInt(qty) * parseInt(price); + var amount = parseFloat(qty) * parseFloat(price); if(!isNaN(amount)) { var currencySymbol = getCurrencySymbol(); row.find(".item-amount").val(currencySymbol + addComma(amount)); @@ -482,9 +482,9 @@ function fn_calculateTotal() { // 품목 행만 순회 (계 행, 원화환산 행, 비고 행, 참조사항 행, 회사명 행 제외) $("#itemsTableBody tr").not(".total-row, .total-krw-row, .remarks-row, .notes-row, .footer-row").each(function(){ var amount = $(this).find(".item-amount").val() || "0"; - // 모든 비숫자 문자 제거 (통화 기호, 콤마 등) - amount = amount.replace(/[^0-9]/g, ""); - var numAmount = parseInt(amount) || 0; + // 모든 비숫자 문자 제거 (통화 기호, 콤마 등, 소수점은 유지) + amount = amount.replace(/[^0-9.]/g, ""); + var numAmount = parseFloat(amount) || 0; total += numAmount; }); @@ -499,13 +499,13 @@ function fn_calculateTotal() { // 원화환산 공급가액 계산 function fn_calculateTotalKRW(total) { var totalKRW = total * g_exchangeRate; - $("#totalAmountKRW").text("₩" + addComma(Math.round(totalKRW))); + $("#totalAmountKRW").text("₩" + addComma(totalKRW)); } -// 콤마 추가 +// 금액 포맷 (소수점 2자리 + 천단위 콤마) function addComma(num) { - var regexp = /\B(?=(\d{3})+(?!\d))/g; - return num.toString().replace(regexp, ','); + if(num === '' || num === null || num === undefined) return ''; + return Number(num).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); } // 통화 기호 반환 @@ -1262,8 +1262,8 @@ function fn_save() { specification: row.find(".item-spec").val() || "", quantity: quantity.replace(/[^0-9]/g, ""), // 숫자만 추출 unit: row.find(".item-unit").val() || "", - unit_price: unitPrice.replace(/[^0-9]/g, ""), // 숫자만 추출 - amount: amount.replace(/[^0-9]/g, ""), // 숫자만 추출 + unit_price: unitPrice.replace(/[^0-9.]/g, ""), + amount: amount.replace(/[^0-9.]/g, ""), note: row.find(".item-note").val() || "" }); }); diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate2.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate2.jsp index 0532eeb..c3dd8a7 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate2.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate2.jsp @@ -403,11 +403,11 @@ $(function(){ } } - // 숫자만 입력 가능하도록 제한 (unit_price, subtotal) + // 숫자와 소수점만 입력 가능하도록 제한 (unit_price, subtotal) $(document).on("keypress", ".item-price, .subtotal-amount", function(e) { - // 숫자(0-9), 백스페이스, 삭제, 탭, 엔터, 콤마만 허용 var charCode = (e.which) ? e.which : e.keyCode; - if (charCode != 8 && charCode != 9 && charCode != 13 && charCode != 44 && + // 숫자(0-9), 백스페이스, 삭제, 탭, 엔터, 콤마, 소수점(46) 허용 + if (charCode != 8 && charCode != 9 && charCode != 13 && charCode != 44 && charCode != 46 && (charCode < 48 || charCode > 57)) { e.preventDefault(); return false; @@ -508,7 +508,7 @@ function fn_calculateAmount(row) { var qty = row.find(".item-qty").val() || "1"; var price = row.find(".item-price").val().replace(/,/g, "") || "0"; - var amount = parseInt(qty) * parseInt(price); + var amount = parseFloat(qty) * parseFloat(price); if(!isNaN(amount)) { row.find(".item-amount").val(addComma(amount)); } @@ -520,7 +520,7 @@ function fn_calculateSubtotal(tbody) { tbody.find("tr:not(.category-row):not(.subtotal-row)").each(function() { var amount = $(this).find(".item-amount").val(); if(amount) { - var numAmount = parseInt(amount.replace(/,/g, "").replace(/-/g, "")); + var numAmount = parseFloat(amount.replace(/,/g, "").replace(/-/g, "")); if(!isNaN(numAmount)) { total += numAmount; } @@ -530,10 +530,10 @@ function fn_calculateSubtotal(tbody) { tbody.find(".subtotal-amount").val(addComma(total)); } -// 콤마 추가 +// 금액 포맷 (소수점 2자리 + 천단위 콤마) function addComma(num) { - var regexp = /\B(?=(\d{3})+(?!\d))/g; - return num.toString().replace(regexp, ','); + if(num === '' || num === null || num === undefined) return ''; + return Number(num).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); } // 카테고리 추가 @@ -709,7 +709,7 @@ function fn_calculateTotal() { // 초음파 CNC Machine의 AMOUNT 값 추가 var cncAmount = $(".category-section[data-category='cnc_machine'] .item-amount").val(); if(cncAmount && cncAmount !== "") { - var numVal = parseInt(cncAmount.replace(/,/g, "")); + var numVal = parseFloat(cncAmount.replace(/,/g, "")); if(!isNaN(numVal)) { total += numVal; } @@ -719,7 +719,7 @@ function fn_calculateTotal() { $(".subtotal-amount").each(function() { var val = $(this).val(); if(val && val !== "" && val !== "-") { - var numVal = parseInt(val.replace(/,/g, "")); + var numVal = parseFloat(val.replace(/,/g, "")); if(!isNaN(numVal)) { total += numVal; } @@ -1000,7 +1000,7 @@ function fn_save() { // 원화 환산 (TOTAL_AMOUNT_KRW) var totalAmountKrw = ""; if(totalAmount && totalAmount !== "" && !isNaN(totalAmount)) { - totalAmountKrw = Math.round(parseFloat(totalAmount) * exchangeRate).toString(); + totalAmountKrw = (parseFloat(totalAmount) * exchangeRate).toFixed(2); } var formData = { diff --git a/WebContent/WEB-INF/view/contractMgmt/orderFormView.jsp b/WebContent/WEB-INF/view/contractMgmt/orderFormView.jsp index 22b6df1..cf21f4c 100644 --- a/WebContent/WEB-INF/view/contractMgmt/orderFormView.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/orderFormView.jsp @@ -374,7 +374,7 @@ function fn_renderOrderForm(info, items){ } function fn_fmt(n){ - return Number(n).toLocaleString(); + return Number(n).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}); }
+ + + + + + + + + +| 생산WBS | ++ + | +
| 납품WBS | ++ + | +
diff --git a/WebContent/WEB-INF/view/contractMgmt/orderMgmtList.jsp b/WebContent/WEB-INF/view/contractMgmt/orderMgmtList.jsp
index cac118e..6496295 100644
--- a/WebContent/WEB-INF/view/contractMgmt/orderMgmtList.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/orderMgmtList.jsp
@@ -250,7 +250,7 @@ var columns = [
else if(currencyName.includes('유로') || currencyName === 'EUR') currencySymbol = '€';
else if(currencyName.includes('엔') || currencyName === 'JPY') currencySymbol = '¥';
else if(currencyName.includes('위안') || currencyName === 'CNY') currencySymbol = '¥';
- return currencySymbol + Number(value).toLocaleString();
+ return currencySymbol + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
// 12. 부가세
@@ -266,7 +266,7 @@ var columns = [
else if(currencyName.includes('유로') || currencyName === 'EUR') currencySymbol = '€';
else if(currencyName.includes('엔') || currencyName === 'JPY') currencySymbol = '¥';
else if(currencyName.includes('위안') || currencyName === 'CNY') currencySymbol = '¥';
- return currencySymbol + Number(value).toLocaleString();
+ return currencySymbol + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
// 13. 총액
@@ -282,7 +282,7 @@ var columns = [
else if(currencyName.includes('유로') || currencyName === 'EUR') currencySymbol = '€';
else if(currencyName.includes('엔') || currencyName === 'JPY') currencySymbol = '¥';
else if(currencyName.includes('위안') || currencyName === 'CNY') currencySymbol = '¥';
- return currencySymbol + Number(value).toLocaleString();
+ return currencySymbol + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
// 14. 원화총액
@@ -290,7 +290,7 @@ var columns = [
formatter: function(cell) {
var value = cell.getValue();
if(!value || value === '' || value === '0') return '';
- return '₩' + Number(value).toLocaleString();
+ return '₩' + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
// 15. 주문서첨부
@@ -421,7 +421,7 @@ function fn_calculateTotalFromGrid(){
}
console.log("✅ [주문서관리] 표시된 데이터 합계:", totalAmountKRW);
- $("#totalAmount").text(Number(totalAmountKRW).toLocaleString());
+ $("#totalAmount").text(Number(totalAmountKRW).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}));
}
function _fnc_datepick(){
diff --git a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
index ab33f75..ffaeed8 100644
--- a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
@@ -53,7 +53,7 @@
// 숫자 입력 필드에 콤마 자동 추가 및 금액 계산
$(document).on("keyup", "input:text[numberOnly]", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ $(this).val(addComma($(this).val().replace(/[^0-9.]/g, "")));
var itemId = $(this).closest("tr").attr("id");
if(itemId) {
@@ -95,10 +95,10 @@
fn_loadContractItems();
});
- // 콤마 추가 함수
+ // 금액 포맷 (소수점 2자리 + 천단위 콤마)
function addComma(data) {
- if(!data) return '';
- return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ if(!data && data !== 0) return '';
+ return Number(data).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
// 콤마 제거 함수
@@ -148,15 +148,15 @@
// 부가세 입력 가능 (기본값: 공급가액 × 10%)
// 공급가액 + 부가세 = 총액 (자동)
function fn_calculateItemAmount(itemId) {
- var quantity = parseInt(removeComma($("#" + itemId + " .item-quantity").val())) || 0;
- var unitPrice = parseInt(removeComma($("#" + itemId + " .item-unit-price").val())) || 0;
+ var quantity = parseFloat(removeComma($("#" + itemId + " .item-quantity").val())) || 0;
+ var unitPrice = parseFloat(removeComma($("#" + itemId + " .item-unit-price").val())) || 0;
// 공급가액 계산
var supplyPrice = quantity * unitPrice;
$("#" + itemId + " .item-supply-price").val(addComma(supplyPrice));
// 부가세 자동 계산 (공급가액의 10%)
- var vat = Math.round(supplyPrice * 0.1);
+ var vat = supplyPrice * 0.1;
$("#" + itemId + " .item-vat").val(addComma(vat));
// 총액 계산
@@ -166,8 +166,8 @@
// 부가세 직접 입력 시 총액만 재계산
function fn_calculateTotalFromVat(itemId) {
- var supplyPrice = parseInt(removeComma($("#" + itemId + " .item-supply-price").val())) || 0;
- var vat = parseInt(removeComma($("#" + itemId + " .item-vat").val())) || 0;
+ var supplyPrice = parseFloat(removeComma($("#" + itemId + " .item-supply-price").val())) || 0;
+ var vat = parseFloat(removeComma($("#" + itemId + " .item-vat").val())) || 0;
// 총액 계산
var totalAmount = supplyPrice + vat;
diff --git a/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp b/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp
index 67184fe..7d03259 100644
--- a/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp
+++ b/WebContent/WEB-INF/view/productionplanning/mBomPopupLeft.jsp
@@ -91,6 +91,9 @@ var materialList = [];
// 공급업체(가공업체) 목록 전역 변수
var supplyVendorList = [];
+// 환종 목록 전역 변수
+var currencyList = [];
+
$(function(){
// 최상위 프레임(mBomPopupHeaderFs.jsp)에서 프로젝트 수주수량 가져오기
try {
@@ -118,6 +121,9 @@ $(function(){
// 공급업체(가공업체) 목록 로드
fn_loadSupplyVendorList();
+ // 환종 목록 로드
+ fn_loadCurrencyList();
+
// Tabulator 초기화
fn_initGrid();
});
@@ -172,6 +178,31 @@ function fn_loadSupplyVendorList() {
});
}
+// 환종(통화) 목록 로드 (공통코드 0001533)
+function fn_loadCurrencyList() {
+ $.ajax({
+ url: "/admin/makeCodeSelect.do",
+ method: 'post',
+ data: { codeId: '0001533' },
+ dataType: 'json',
+ async: false,
+ success: function(data) {
+ if(data && data.RESULT) {
+ data.RESULT.forEach(function(item) {
+ var codeId = item.CODE_ID || '';
+ var codeName = item.CODE_NAME || '';
+ if(codeId && codeName) {
+ currencyList.push({id: codeId, text: codeName});
+ }
+ });
+ }
+ },
+ error: function() {
+ console.error("환종 목록 로드 실패");
+ }
+ });
+}
+
// Select2 커스텀 에디터 생성 함수
function createSelect2Editor(options) {
return function(cell, onRendered, success, cancel, editorParams) {
@@ -808,11 +839,29 @@ function fn_initGrid() {
return cell.getValue() || '-';
}
},
- // 숨김 컬럼: 공급업체 코드 (저장 시 필요)
- {
- field: 'VENDOR',
- visible: false
- },
+ // 숨김 컬럼: 공급업체 코드 (저장 시 필요)
+ {
+ field: 'VENDOR',
+ visible: false
+ },
+ {
+ headerHozAlign: 'center',
+ hozAlign: 'center',
+ width: 80,
+ title: '환종',
+ field: 'CURRENCY',
+ editor: false,
+ formatter: function(cell) {
+ var value = cell.getValue();
+ if(!value) return '-';
+ for(var i = 0; i < currencyList.length; i++) {
+ if(currencyList[i].id == value) {
+ return currencyList[i].text;
+ }
+ }
+ return value;
+ }
+ },
// 숨김 컬럼: 품의서 작성일 (저장 시 기존 값 유지)
{
field: 'PROPOSAL_DATE',
diff --git a/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtEquipList.jsp b/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtEquipList.jsp
new file mode 100644
index 0000000..7dc54b2
--- /dev/null
+++ b/WebContent/WEB-INF/view/productionplanning/prodPlanResultMgmtEquipList.jsp
@@ -0,0 +1,587 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ page import="com.pms.common.utils.*"%>
+<%@ page import="java.util.*" %>
+<%@include file= "/init.jsp" %>
+
+ +
+ + +
+