diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp index 0766ebb..7ad8c60 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp @@ -303,12 +303,18 @@ var itemsData = fn_collectItemsData(); console.log("최종 전송 데이터:", JSON.stringify(itemsData, null, 2)); + // 환율에서 콤마 제거 + var exchangeRate = $("#exchange_rate").val(); + if(exchangeRate) { + $("#exchange_rate").val(exchangeRate.replace(/,/g, '')); + } + // 기본 폼 데이터 var formData = $("#form1").serialize(); // 품목 데이터를 JSON 문자열로 추가 formData += "&items_json=" + encodeURIComponent(JSON.stringify(itemsData)); - + $.ajax({ url : "/contractMgmt/saveContractMgmtInfo.do", type : "POST", diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp index 342c1bb..669d267 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateTemplate1.jsp @@ -615,6 +615,7 @@ function fn_save() { // 계 행, 원화환산 행, 비고 행 제외하고 품목 행만 저장 $("#itemsTableBody tr").not(".total-row, .total-krw-row, .remarks-row").each(function(idx) { var row = $(this); + var quantity = row.find(".item-qty").val() || ""; var unitPrice = row.find(".item-price").val() || ""; var amount = row.find(".item-amount").val() || ""; @@ -622,10 +623,10 @@ function fn_save() { seq: idx + 1, description: row.find(".item-desc").val() || "", specification: row.find(".item-spec").val() || "", - quantity: row.find(".item-qty").val() || "", + quantity: quantity.replace(/,/g, ""), // 콤마 제거 unit: row.find(".item-unit").val() || "", - unit_price: unitPrice.replace(/,/g, ""), - amount: amount.replace(/,/g, "").replace(/₩/g, ""), + unit_price: unitPrice.replace(/,/g, ""), // 콤마 제거 + amount: amount.replace(/,/g, "").replace(/₩/g, ""), // 콤마와 ₩ 제거 note: row.find(".item-note").val() || "" }); }); @@ -643,6 +644,9 @@ function fn_save() { var totalAmount = $("#totalAmount").text().replace(/,/g, ""); var totalAmountKRW = $("#totalAmountKRW").text().replace(/,/g, ""); + // 디버깅: 품목 데이터 확인 + console.log("저장할 품목 데이터:", items); + var formData = { objId: contractObjId, template_type: "1", diff --git a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp index 0903ac2..1d6eb60 100644 --- a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp @@ -285,6 +285,12 @@ // 품목 데이터를 JSON으로 변환 $("#items_json").val(JSON.stringify(items)); + // 환율에서 콤마 제거 + var exchangeRate = $("#exchange_rate").val(); + if(exchangeRate) { + $("#exchange_rate").val(exchangeRate.replace(/,/g, '')); + } + $.ajax({ url : "/contractMgmt/saveOrderInfo.do", type : "POST", diff --git a/src/com/pms/salesmgmt/mapper/contractMgmt.xml b/src/com/pms/salesmgmt/mapper/contractMgmt.xml index 844c376..635c225 100644 --- a/src/com/pms/salesmgmt/mapper/contractMgmt.xml +++ b/src/com/pms/salesmgmt/mapper/contractMgmt.xml @@ -4132,14 +4132,8 @@ WHERE item->>'specification', item->>'quantity', item->>'unit', - CASE - WHEN item->>'unit_price' = '' THEN NULL - ELSE (item->>'unit_price')::NUMERIC - END, - CASE - WHEN item->>'amount' = '' THEN NULL - ELSE (item->>'amount')::NUMERIC - END, + item->>'unit_price', + item->>'amount', item->>'note', item->>'remark' FROM json_array_elements(#{items_json}::json) AS item