환율 저장 시 , 제거

This commit is contained in:
2025-10-22 09:54:56 +09:00
parent 07b147ff9e
commit 7f67967add
4 changed files with 22 additions and 12 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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