diff --git a/WebContent/WEB-INF/classes/com/pms/salesmgmt/mapper/goodsMgmt.xml b/WebContent/WEB-INF/classes/com/pms/salesmgmt/mapper/goodsMgmt.xml
index 49ce75c..f9f534b 100644
--- a/WebContent/WEB-INF/classes/com/pms/salesmgmt/mapper/goodsMgmt.xml
+++ b/WebContent/WEB-INF/classes/com/pms/salesmgmt/mapper/goodsMgmt.xml
@@ -243,20 +243,20 @@
,#{class1} /* */
,#{class2} /* */
,#{goodsGuarantee}:: INTEGER /* 보증기간 */
- ,#{costAmt}:: BIGINT /* 판매금액 */
- ,#{saleAmt}:: BIGINT /* */
- ,#{saftyQty}:: BIGINT /* */
- ,#{royalty}:: BIGINT /* */
+ ,#{costAmt}:: NUMERIC /* 판매금액 */
+ ,#{saleAmt}:: NUMERIC /* */
+ ,#{saftyQty}:: NUMERIC /* */
+ ,#{royalty}:: NUMERIC /* */
,#{regYmd} /* 등록일자 */
,#{delYmd} /* 단종일자 */
,#{remark} /* 비고 */
,#{commiYn} /* 판매수수료적용여부 */
,#{commiGb} /* 방식/수식 */
,#{commiGive} /* */
- ,#{cCommiPer}:: BIGINT /* 크레인(%) */
- ,#{tCommiPer}:: BIGINT /* 특장(%) */
- ,#{cCommiAmt}:: BIGINT /* 크레인(금액) */
- ,#{tCommiAmt}:: BIGINT /* 특장(금액) */
+ ,#{cCommiPer}:: NUMERIC /* 크레인(%) */
+ ,#{tCommiPer}:: NUMERIC /* 특장(%) */
+ ,#{cCommiAmt}:: NUMERIC /* 크레인(금액) */
+ ,#{tCommiAmt}:: NUMERIC /* 특장(금액) */
,#{gb1} /* 영업소 */
,now() /* 생성일시 */
,#{cretEmpNo} /* 생성자 */
@@ -276,20 +276,20 @@
,Class1 = #{class1} /* */
,Class2 = #{class2} /* */
,GoodsGuarantee = #{goodsGuarantee}:: INTEGER /* 보증기간 */
- ,Cost_Amt = #{costAmt}:: BIGINT /* 판매금액 */
- ,Sale_Amt = #{saleAmt}:: BIGINT /* */
- ,SaftyQty = #{saftyQty}:: BIGINT /* */
- ,Royalty = #{royalty}:: BIGINT /* */
+ ,Cost_Amt = #{costAmt}:: NUMERIC /* 판매금액 */
+ ,Sale_Amt = #{saleAmt}:: NUMERIC /* */
+ ,SaftyQty = #{saftyQty}:: NUMERIC /* */
+ ,Royalty = #{royalty}:: NUMERIC /* */
,RegYmd = #{regYmd} /* 등록일자 */
,DelYmd = #{delYmd} /* 단종일자 */
,Remark = #{remark} /* 비고 */
,CommiYN = #{commiYn} /* 판매수수료적용여부 */
,CommiGB = #{commiGb} /* 방식/수식 */
,CommiGive = #{commiGive} /* */
- ,CCommiPer = #{cCommiPer}:: BIGINT /* 크레인(%) */
- ,TCommiPer = #{tCommiPer}:: BIGINT /* 특장(%) */
- ,CCommiAmt = #{cCommiAmt}:: BIGINT /* 크레인(금액) */
- ,TCommiAmt = #{tCommiAmt}:: BIGINT /* 특장(금액) */
+ ,CCommiPer = #{cCommiPer}:: NUMERIC /* 크레인(%) */
+ ,TCommiPer = #{tCommiPer}:: NUMERIC /* 특장(%) */
+ ,CCommiAmt = #{cCommiAmt}:: NUMERIC /* 크레인(금액) */
+ ,TCommiAmt = #{tCommiAmt}:: NUMERIC /* 특장(금액) */
,GB1 = #{gb1} /* 영업소 */
,EDIT_DATE = now() /* 수정일시 */
,EditEmpNo = #{cretEmpNo} /* 수정자 */
diff --git a/WebContent/WEB-INF/view/contractMgmt/contracMgmtFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/contracMgmtFormPopup.jsp
index 318f075..c7309de 100644
--- a/WebContent/WEB-INF/view/contractMgmt/contracMgmtFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/contracMgmtFormPopup.jsp
@@ -66,7 +66,21 @@
*/
}
$("input:text[numberOnly]").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ if($(this).attr("id") === "facility_qty") {
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
+ } else {
+ $(this).val(fnc_addComma($(this).val().replace(/[^0-9.]/g, "")));
+ }
+ });
+ $("input:text[numberOnly]").on("blur", function() {
+ var val = $(this).val();
+ if(val && val !== '') {
+ if($(this).attr("id") === "facility_qty") {
+ $(this).val(formatInteger(removeComma(val)));
+ } else {
+ $(this).val(formatMoney(removeComma(val)));
+ }
+ }
});
$('.select2').select2();
@@ -153,7 +167,7 @@
});
function addComma(data) {
- return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ return formatMoney(data);
}
function fnc_setFileDropZone2(divId, targetObjId, docType, docTypeName,
@@ -457,7 +471,7 @@
}
function fnc_numberOnly(obj) {
- $("#" + obj.attr("id")).val(addComma(obj.val().replace(/[^0-9]/g, "")));
+ $("#" + obj.attr("id")).val(fnc_addComma(obj.val().replace(/[^0-9.]/g, "")));
//.replace(/[^0-9]/g,""))
}
@@ -677,7 +691,7 @@
|
"
+ value=""
reqTitle="수주가(통화)" numberOnly /> |
@@ -685,7 +699,7 @@
|
"
+ value=""
reqTitle="원화 환산금액" numberOnly /> |
|
|
diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp
index bc921fc..674a789 100644
--- a/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp
@@ -68,7 +68,21 @@
// 숫자만 입력 처리
$("input:text[numberOnly]").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ if($(this).hasClass("item-order-quantity") || $(this).attr("id") === "facility_qty") {
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
+ } else {
+ $(this).val(fnc_addComma($(this).val().replace(/[^0-9.]/g, "")));
+ }
+ });
+ $("input:text[numberOnly]").on("blur", function() {
+ var val = $(this).val();
+ if(val && val !== '') {
+ if($(this).hasClass("item-order-quantity") || $(this).attr("id") === "facility_qty") {
+ $(this).val(formatInteger(removeComma(val)));
+ } else {
+ $(this).val(formatMoney(removeComma(val)));
+ }
+ }
});
$('.select2').select2();
@@ -117,7 +131,7 @@
});
function addComma(data) {
- return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ return formatMoney(data);
}
function removeComma(data) {
@@ -378,7 +392,11 @@
// 숫자만 입력 처리 및 금액 계산
$("#" + itemId + " .item-order-quantity, #" + itemId + " .item-order-unit-price, #" + itemId + " .item-order-supply-price, #" + itemId + " .item-order-vat, #" + itemId + " .item-order-total-amount").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ if($(this).hasClass("item-order-quantity")) {
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
+ } else {
+ $(this).val(fnc_addComma($(this).val().replace(/[^0-9.]/g, "")));
+ }
// 수주 금액 계산
if($(this).hasClass("item-order-quantity") || $(this).hasClass("item-order-unit-price")) {
@@ -429,7 +447,7 @@
}
// 수주 정보 설정
- if(existingData.orderQuantity) $("#" + itemId + " .item-order-quantity").val(addComma(existingData.orderQuantity));
+ if(existingData.orderQuantity) $("#" + itemId + " .item-order-quantity").val(formatInteger(existingData.orderQuantity));
if(existingData.orderUnitPrice) $("#" + itemId + " .item-order-unit-price").val(addComma(existingData.orderUnitPrice));
if(existingData.orderSupplyPrice) $("#" + itemId + " .item-order-supply-price").val(addComma(existingData.orderSupplyPrice));
if(existingData.orderVat) $("#" + itemId + " .item-order-vat").val(addComma(existingData.orderVat));
@@ -530,9 +548,9 @@
// 수주 정보 (Machine이고 프로젝트가 있으면 수량 readonly)
html += '';
if(isMachine && hasProject) {
- html += '';
+ html += '';
} else {
- html += '';
+ html += '';
}
html += ' | ';
html += '';
@@ -598,7 +616,11 @@
// 숫자만 입력 처리 및 금액 계산
$("#" + itemId + " .item-order-quantity, #" + itemId + " .item-order-unit-price, #" + itemId + " .item-order-supply-price, #" + itemId + " .item-order-vat, #" + itemId + " .item-order-total-amount").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ if($(this).hasClass("item-order-quantity")) {
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
+ } else {
+ $(this).val(fnc_addComma($(this).val().replace(/[^0-9.]/g, "")));
+ }
if($(this).hasClass("item-order-quantity") || $(this).hasClass("item-order-unit-price")) {
fn_calculateItemAmount(itemId);
@@ -623,8 +645,8 @@
// 품목별 금액 계산
function fn_calculateItemAmount(itemId) {
- var quantity = parseInt(removeComma($("#" + itemId + " .item-order-quantity").val())) || 0;
- var unitPrice = parseInt(removeComma($("#" + itemId + " .item-order-unit-price").val())) || 0;
+ var quantity = parseFloat(removeComma($("#" + itemId + " .item-order-quantity").val())) || 0;
+ var unitPrice = parseFloat(removeComma($("#" + itemId + " .item-order-unit-price").val())) || 0;
// 공급가액 계산
var supplyPrice = quantity * unitPrice;
@@ -641,8 +663,8 @@
// 부가세 직접 입력 시 총액만 재계산
function fn_calculateTotalFromVat(itemId) {
- var supplyPrice = parseInt(removeComma($("#" + itemId + " .item-order-supply-price").val())) || 0;
- var vat = parseInt(removeComma($("#" + itemId + " .item-order-vat").val())) || 0;
+ var supplyPrice = parseFloat(removeComma($("#" + itemId + " .item-order-supply-price").val())) || 0;
+ var vat = parseFloat(removeComma($("#" + itemId + " .item-order-vat").val())) || 0;
// 총액 계산
var totalAmount = supplyPrice + vat;
@@ -651,7 +673,7 @@
// 공급가액 직접 입력 시 부가세와 총액 재계산
function fn_calculateFromSupplyPrice(itemId) {
- var supplyPrice = parseInt(removeComma($("#" + itemId + " .item-order-supply-price").val())) || 0;
+ var supplyPrice = parseFloat(removeComma($("#" + itemId + " .item-order-supply-price").val())) || 0;
// 부가세 자동 계산 (공급가액의 10%)
var vat = Math.round(supplyPrice * 0.1);
diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateFormPopup.jsp
index f16c21d..e8c44eb 100644
--- a/WebContent/WEB-INF/view/contractMgmt/estimateFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/estimateFormPopup.jsp
@@ -19,144 +19,145 @@ $(function(){
//금액1(원)
$("#contract_product_price").change(function(){
- var contract_product_price = $(this).val().replace(/,/gi,"");
+ var contract_product_price = parseFloat($(this).val().replace(/,/gi,"")) || 0;
- var qty = $("#qty").val().replace(/,/gi,"");
+ var qty = parseInt($("#qty").val().replace(/,/gi,""), 10) || 0;
- var sale = $("#sale").val().replace(/,/gi,"");
+ var sale = parseFloat($("#sale").val().replace(/,/gi,""));
+ if (isNaN(sale) || $("#sale").val().replace(/,/gi,"") === "") sale = 1;
- var other_price = $("#other_price").val().replace(/,/gi,"");
+ var other_price = parseFloat($("#other_price").val().replace(/,/gi,"")) || 0;
- if (isNaN(contract_product_price) || ""==contract_product_price) contract_product_price = 0;
-
- if (isNaN(other_price) || ""==other_price) other_price = 0;
- if (isNaN(qty) || ""==qty) qty = 0;
- if (isNaN(sale) || ""==sale) sale = 1;
-
- var product_price = (parseInt(contract_product_price) * parseInt(qty));
+ var product_price = contract_product_price * qty;
if (isNaN(product_price)) product_price = 0;
- $("#product_price").val(addComma(product_price));
+ $("#product_price").val(formatMoney(product_price));
- var total_price = parseInt(product_price)+parseInt(other_price);
+ var total_price = product_price + other_price;
if (isNaN(total_price)) total_price = 0;
- $("#total_price").val(addComma(total_price));
+ $("#total_price").val(formatMoney(total_price));
var final_price = "";
if($("#sale").val()==""){
- final_price = parseInt(total_price) * sale;
+ final_price = total_price * sale;
}else{
- final_price = parseInt(total_price) - (parseInt(total_price) * (parseInt(sale) / 100));
+ final_price = total_price - (total_price * (sale / 100));
}
if (isNaN(final_price)) final_price = 0;
- $("#final_total_price").val(addComma(final_price));
+ $("#final_total_price").val(formatMoney(final_price));
});
//수량(원)
$("#qty").change(function(){
- var contract_product_price = $("#contract_product_price").val().replace(/,/gi,"");
+ var contract_product_price = parseFloat($("#contract_product_price").val().replace(/,/gi,"")) || 0;
- var qty = $(this).val().replace(/,/gi,"");
+ var qty = parseInt($(this).val().replace(/,/gi,""), 10) || 0;
- var sale = $("#sale").val().replace(/,/gi,"");
+ var sale = parseFloat($("#sale").val().replace(/,/gi,""));
+ if (isNaN(sale) || $("#sale").val().replace(/,/gi,"") === "") sale = 1;
- var other_price = $("#other_price").val().replace(/,/gi,"");
+ var other_price = parseFloat($("#other_price").val().replace(/,/gi,"")) || 0;
- if (isNaN(contract_product_price) || ""==contract_product_price) contract_product_price = 0;
-
- if (isNaN(other_price) || ""==other_price) other_price = 0;
- if (isNaN(qty) || ""==qty) qty = 0;
- if (isNaN(sale) || ""==sale) sale = 1;
-
- var product_price = (parseInt(contract_product_price) * parseInt(qty));
+ var product_price = contract_product_price * qty;
if (isNaN(product_price)) product_price = 0;
- $("#product_price").val(addComma(product_price));
+ $("#product_price").val(formatMoney(product_price));
- var total_price = parseInt(product_price)+parseInt(other_price);
+ var total_price = product_price + other_price;
if (isNaN(total_price)) total_price = 0;
- $("#total_price").val(addComma(total_price));
+ $("#total_price").val(formatMoney(total_price));
var final_price = "";
if($("#sale").val()==""){
- final_price = parseInt(total_price) * sale;
+ final_price = total_price * sale;
}else{
- final_price = parseInt(total_price) - (parseInt(total_price) * (parseInt(sale) / 100));
+ final_price = total_price - (total_price * (sale / 100));
}
if (isNaN(final_price)) final_price = 0;
- $("#final_total_price").val(addComma(final_price));
+ $("#final_total_price").val(formatMoney(final_price));
});
//기타비용
$("#other_price").change(function(){
- var contract_product_price = $("#contract_product_price").val().replace(/,/gi,"");
+ var contract_product_price = parseFloat($("#contract_product_price").val().replace(/,/gi,"")) || 0;
- var qty = $("#qty").val().replace(/,/gi,"");
+ var qty = parseInt($("#qty").val().replace(/,/gi,""), 10) || 0;
- var sale = $("#sale").val().replace(/,/gi,"");
+ var sale = parseFloat($("#sale").val().replace(/,/gi,""));
+ if (isNaN(sale) || $("#sale").val().replace(/,/gi,"") === "") sale = 1;
- var other_price = $(this).val().replace(/,/gi,"");
+ var other_price = parseFloat($(this).val().replace(/,/gi,"")) || 0;
- if (isNaN(contract_product_price) || ""==contract_product_price) contract_product_price = 0;
-
- if (isNaN(other_price) || ""==other_price) other_price = 0;
- if (isNaN(qty) || ""==qty) qty = 0;
- if (isNaN(sale) || ""==sale) sale = 1;
-
- var product_price = (parseInt(contract_product_price) * parseInt(qty));
+ var product_price = contract_product_price * qty;
if (isNaN(product_price)) product_price = 0;
- $("#product_price").val(addComma(product_price));
+ $("#product_price").val(formatMoney(product_price));
- var total_price = parseInt(product_price)+parseInt(other_price);
+ var total_price = product_price + other_price;
if (isNaN(total_price)) total_price = 0;
- $("#total_price").val(addComma(total_price));
+ $("#total_price").val(formatMoney(total_price));
var final_price = "";
if($("#sale").val()==""){
- final_price = parseInt(total_price) * sale;
+ final_price = total_price * sale;
}else{
- final_price = parseInt(total_price) - (parseInt(total_price) * (parseInt(sale) / 100));
+ final_price = total_price - (total_price * (sale / 100));
}
if (isNaN(final_price)) final_price = 0;
- $("#final_total_price").val(addComma(final_price));
+ $("#final_total_price").val(formatMoney(final_price));
});
//할인
$("#sale").change(function(){
- var total_price = $("#total_price").val().replace(/,/gi,"");
- var sale = $(this).val().replace(/,/gi,"");
-
- if (isNaN(total_price)) total_price = 0;
+ var total_price = parseFloat($("#total_price").val().replace(/,/gi,"")) || 0;
+ var saleRaw = $(this).val().replace(/,/gi,"");
+ var sale = parseFloat(saleRaw);
+ if (isNaN(sale) || saleRaw === "") sale = 1;
var final_price = "";
if($("#sale").val()==""){
- final_price = parseInt(total_price) * sale;
+ final_price = total_price * sale;
}else{
- final_price = parseInt(total_price) - (parseInt(total_price) * (parseInt(sale) / 100));
+ final_price = total_price - (total_price * (sale / 100));
}
if (isNaN(final_price)) final_price = 0;
- $("#final_total_price").val(addComma(final_price));
+ $("#final_total_price").val(formatMoney(final_price));
});
$("input:text[numberOnly]").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g,"")));
+ var $t = $(this);
+ if ($t.attr("id") === "qty") {
+ $t.val(formatInteger($t.val().replace(/[^0-9]/g,"")));
+ } else {
+ $t.val(fnc_addComma($t.val().replace(/[^0-9.]/g, "")));
+ }
+ });
+ $("input:text[numberOnly]").on("blur", function() {
+ var $t = $(this);
+ var val = $t.val();
+ if (val && val !== '') {
+ if ($t.attr("id") === "qty") {
+ $t.val(formatInteger(removeComma(val)));
+ } else {
+ $t.val(formatMoney(removeComma(val)));
+ }
+ }
});
@@ -285,7 +286,7 @@ function set_contract(USER_ID){
function addComma(data) {
- return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ return formatMoney(data);
}
function set_customer(OBJID){
@@ -463,14 +464,15 @@ function fileDelete(fileObjId, areaId){
}
}
function fnc_numberOnly(obj){
- $("#"+obj.attr("id")).val(addComma(obj.val().replace(/[^0-9]/g,"")));
+ var id = obj.attr("id");
+ if (id === "qty") {
+ $("#"+id).val(formatInteger(obj.val().replace(/[^0-9]/g,"")));
+ } else {
+ $("#"+id).val(fnc_addComma(obj.val().replace(/[^0-9.]/g,"")));
+ }
//.replace(/[^0-9]/g,""))
}
-$("input:text[numberOnly]").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g,"")));
- });
-
@@ -622,7 +624,7 @@ $("input:text[numberOnly]").on("keyup", function() {
| --%>
- " maxlength="100" numberOnly />
+ " maxlength="100" numberOnly />
|
@@ -643,20 +645,20 @@ $("input:text[numberOnly]").on("keyup", function() {
|
- " maxlength="100" numberOnly readonly/>
+ " maxlength="100" numberOnly readonly/>
|
|
- " maxlength="100" numberOnly />
+ " maxlength="100" numberOnly />
|
|
- " maxlength="100" numberOnly readonly />
+ " maxlength="100" numberOnly readonly />
|
@@ -664,12 +666,12 @@ $("input:text[numberOnly]").on("keyup", function() {
|
- " maxlength="100" numberOnly />
+ " maxlength="100" numberOnly />
|
|
- " maxlength="100" numberOnly readonly />
+ " maxlength="100" numberOnly readonly />
|
diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp
index ef1a202..2c55ab8 100644
--- a/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/estimateList_new.jsp
@@ -606,18 +606,25 @@ function fn_delete(){
data: {
"objId": objIds
},
- traditional: true, // 배열 파라미터를 올바르게 전송
+ traditional: true,
dataType:"json",
success:function(data){
- if(data.result == 'true'){
+ if(data.result == 'true' || data.result === true){
var successMessage = deleteCount === 1
? '삭제되었습니다.'
: deleteCount + '개의 항목이 삭제되었습니다.';
Swal.fire(successMessage);
fn_search();
- };
+ } else {
+ Swal.fire({
+ title: '삭제 불가',
+ text: data.msg || '삭제할 수 없습니다.',
+ icon: 'warning'
+ });
+ }
}
,error: function(jqxhr, status, error){
+ Swal.fire('삭제 중 오류가 발생했습니다.');
}
});
}
diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp
index 571cc21..2263119 100644
--- a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp
@@ -100,7 +100,23 @@
*/
}
$("input:text[numberOnly]").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ var $t = $(this);
+ if ($t.attr("id") === "facility_qty" || $t.hasClass("item-quantity")) {
+ $t.val(formatInteger($t.val().replace(/[^0-9]/g, "")));
+ } else {
+ $t.val(fnc_addComma($t.val().replace(/[^0-9.]/g, "")));
+ }
+ });
+ $("input:text[numberOnly]").on("blur", function() {
+ var $t = $(this);
+ var val = $t.val();
+ if (val && val !== '') {
+ if ($t.attr("id") === "facility_qty" || $t.hasClass("item-quantity")) {
+ $t.val(formatInteger(removeComma(val)));
+ } else {
+ $t.val(formatMoney(removeComma(val)));
+ }
+ }
});
$('.select2').select2();
@@ -223,7 +239,7 @@
});
function addComma(data) {
- return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ return formatMoney(data);
}
function fnc_setFileDropZone2(divId, targetObjId, docType, docTypeName,
@@ -584,11 +600,11 @@
// 숫자만 입력 처리 및 콤마 추가
$("#" + itemId + " .item-quantity").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
});
// 이미 저장된 수량에 콤마 추가
var qtyInput = $("#" + itemId + " .item-quantity");
- qtyInput.val(addComma(qtyInput.val()));
+ qtyInput.val(formatInteger(removeComma(qtyInput.val())));
// 품목 정보 저장
itemList.push({
@@ -803,7 +819,16 @@
}
function fnc_numberOnly(obj) {
- $("#" + obj.attr("id")).val(addComma(obj.val().replace(/[^0-9]/g, "")));
+ var isQty = obj.attr("id") === "facility_qty" || obj.hasClass("item-quantity");
+ var formatted = isQty
+ ? formatInteger(obj.val().replace(/[^0-9]/g, ""))
+ : fnc_addComma(obj.val().replace(/[^0-9.]/g, ""));
+ var tid = obj.attr("id");
+ if (tid) {
+ $("#" + tid).val(formatted);
+ } else {
+ obj.val(formatted);
+ }
//.replace(/[^0-9]/g,""))
}
// Drag & Drop 관련 함수 주석처리 끝 */
@@ -1331,7 +1356,7 @@
// 숫자만 입력 처리
$("#" + itemId + " .item-quantity").on("keyup", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
+ $(this).val(formatInteger($(this).val().replace(/[^0-9]/g, "")));
});
// 품목 정보 저장
@@ -1994,7 +2019,7 @@
|
-
+
|
@@ -2181,14 +2206,14 @@
|
"
+ value=""
reqTitle="수주가(통화)" numberOnly /> |
|
"
+ value=""
reqTitle="원화 환산금액" numberOnly /> |
|
|
diff --git a/WebContent/WEB-INF/view/contractMgmt/itemPriceCompareList.jsp b/WebContent/WEB-INF/view/contractMgmt/itemPriceCompareList.jsp
index ad4e741..e8d212b 100644
--- a/WebContent/WEB-INF/view/contractMgmt/itemPriceCompareList.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/itemPriceCompareList.jsp
@@ -148,7 +148,7 @@ $(function(){
{title: "품명", field: "PART_NAME", hozAlign: "left", minWidth: 120},
// 견적 정보
{title: "견적수량", field: "EST_QUANTITY", hozAlign: "right", minWidth: 70, cssClass: "estimate-cell",
- formatter: function(cell) { return formatNumber(cell.getValue()); }
+ formatter: function(cell) { return formatInteger(cell.getValue()); }
},
{title: "견적단가", field: "EST_UNIT_PRICE", hozAlign: "right", minWidth: 80, cssClass: "estimate-cell",
formatter: function(cell) { return formatNumber(cell.getValue()); }
@@ -161,7 +161,7 @@ $(function(){
},
// 수주 정보
{title: "수주수량", field: "ORDER_QUANTITY", hozAlign: "right", minWidth: 70, cssClass: "order-cell",
- formatter: function(cell) { return formatNumber(cell.getValue()); }
+ formatter: function(cell) { return formatInteger(cell.getValue()); }
},
{title: "수주단가", field: "ORDER_UNIT_PRICE", hozAlign: "right", minWidth: 80, cssClass: "order-cell",
formatter: function(cell) { return formatNumber(cell.getValue()); }
@@ -174,7 +174,7 @@ $(function(){
},
// 판매 정보
{title: "판매수량", field: "SALES_QUANTITY", hozAlign: "right", minWidth: 70, cssClass: "sales-cell",
- formatter: function(cell) { return formatNumber(cell.getValue()); }
+ formatter: function(cell) { return formatInteger(cell.getValue()); }
},
{title: "판매단가", field: "SALES_UNIT_PRICE", hozAlign: "right", minWidth: 80, cssClass: "sales-cell",
formatter: function(cell) { return formatNumber(cell.getValue()); }
@@ -209,10 +209,16 @@ $(function(){
fn_search();
});
-// 숫자 포맷
+// 금액·단가 (소수 둘째 자리 고정)
function formatNumber(num) {
- if(num == null || num == '' || isNaN(num) || num == 0) return '-';
- return parseFloat(num).toLocaleString('ko-KR');
+ if(!num || num === '' || isNaN(num)) return '-';
+ return Number(num).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
+}
+
+// 수량 (정수, 천단위 구분)
+function formatInteger(num) {
+ if(num == null || num === '' || isNaN(num)) return '-';
+ return Number(num).toLocaleString(undefined, {maximumFractionDigits: 0});
}
// 조회
diff --git a/WebContent/WEB-INF/view/contractMgmt/itemPriceComparePopup.jsp b/WebContent/WEB-INF/view/contractMgmt/itemPriceComparePopup.jsp
index b897421..d00e037 100644
--- a/WebContent/WEB-INF/view/contractMgmt/itemPriceComparePopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/itemPriceComparePopup.jsp
@@ -180,16 +180,16 @@ $(function() {
});
});
-// 숫자 포맷 (천단위 콤마)
+// 숫자 포맷 (천단위 콤마, 소수 둘째 자리)
function formatNumber(num) {
if(num == null || num == '' || isNaN(num)) return '-';
- return parseFloat(num).toLocaleString('ko-KR');
+ return Number(num).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
// 통화 포맷
function formatCurrency(num, currency) {
if(num == null || num == '' || isNaN(num)) return '-';
- var formatted = parseFloat(num).toLocaleString('ko-KR');
+ var formatted = Number(num).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
if(currency == 'KRW' || currency == '원') {
return '₩' + formatted;
} else if(currency == 'USD' || currency == '달러') {
@@ -275,35 +275,35 @@ function formatCurrency(num, currency) {
${item.EST_QUANTITY} |
-
+
|
-
+
|
-
+
|
${item.ORDER_QUANTITY} |
-
+
|
-
+
|
-
+
|
${item.SALES_QUANTITY} |
-
+
|
-
+
|
-
+
|
@@ -328,28 +328,28 @@ function formatCurrency(num, currency) {
| ${totalEstQuantity} |
- |
-
+
|
-
+
|
${totalOrderQuantity} |
- |
-
+
|
-
+
|
${totalSalesQuantity} |
- |
-
+
|
-
+
|
- |
diff --git a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
index ffaeed8..3d8a802 100644
--- a/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
+++ b/WebContent/WEB-INF/view/contractMgmt/orderRegistFormPopup.jsp
@@ -51,28 +51,46 @@
// console.log("===== 수주등록 팝업 로드됨 =====");
// console.log("useEstimateTemplate 값:", "${useEstimateTemplate}");
- // 숫자 입력 필드에 콤마 자동 추가 및 금액 계산
+ // 입력 중: 수량은 정수만, 나머지는 소수점 허용
$(document).on("keyup", "input:text[numberOnly]", function() {
- $(this).val(addComma($(this).val().replace(/[^0-9.]/g, "")));
+ if($(this).hasClass("item-quantity")) {
+ $(this).val(addCommaInput($(this).val().replace(/[^0-9]/g, "")));
+ } else {
+ $(this).val(addCommaInput($(this).val().replace(/[^0-9.]/g, "")));
+ }
var itemId = $(this).closest("tr").attr("id");
if(itemId) {
- // 수주수량 또는 수주단가가 변경되면 공급가액, 부가세, 총액 모두 재계산
if($(this).hasClass("item-quantity") || $(this).hasClass("item-unit-price")) {
fn_calculateItemAmount(itemId);
}
- // 수주부가세만 변경되면 총액만 재계산
else if($(this).hasClass("item-vat")) {
fn_calculateTotalFromVat(itemId);
}
}
});
- // 페이지 로드 시 기존 값에 콤마 표시
+ // 입력 완료(blur): 수량은 정수 콤마, 나머지는 소수점 2자리
+ $(document).on("blur", "input:text[numberOnly]", function() {
+ var val = $(this).val();
+ if(val && val !== '') {
+ if($(this).hasClass("item-quantity")) {
+ $(this).val(addCommaInt(removeComma(val)));
+ } else {
+ $(this).val(addComma(removeComma(val)));
+ }
+ }
+ });
+
+ // 페이지 로드 시: 수량은 정수 콤마, 나머지는 소수점 2자리
$("input:text[numberOnly]").each(function() {
var val = $(this).val();
if(val && val !== '') {
- $(this).val(addComma(val.replace(/,/g, "")));
+ if($(this).hasClass("item-quantity")) {
+ $(this).val(addCommaInt(val.replace(/,/g, "")));
+ } else {
+ $(this).val(addComma(val.replace(/,/g, "")));
+ }
}
});
@@ -95,10 +113,30 @@
fn_loadContractItems();
});
- // 금액 포맷 (소수점 2자리 + 천단위 콤마)
+ // 표시용 포맷 (천단위 콤마 + 소수점 2자리)
function addComma(data) {
if(!data && data !== 0) return '';
- return Number(data).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
+ var num = Number(String(data).replace(/,/g, ''));
+ if(isNaN(num)) return '';
+ return num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
+ }
+
+ // 정수 표시용 포맷 (천단위 콤마, 소수점 없음)
+ function addCommaInt(data) {
+ if(!data && data !== 0) return '';
+ var num = Math.round(Number(String(data).replace(/,/g, '')));
+ if(isNaN(num)) return '';
+ return num.toLocaleString();
+ }
+
+ // 입력 중 포맷 (천단위 콤마만, 소수점 강제 안함)
+ function addCommaInput(data) {
+ if(!data && data !== 0) return '';
+ var str = String(data).replace(/,/g, '');
+ if(str === '' || isNaN(str)) return '';
+ var parts = str.split('.');
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+ return parts.length > 1 ? parts[0] + '.' + parts[1] : parts[0];
}
// 콤마 제거 함수
@@ -243,8 +281,8 @@
$("#itemListBody").append(html);
- // 콤마 추가
- $("#" + itemId + " .item-quantity").val(addComma($("#" + itemId + " .item-quantity").val()));
+ // 콤마 추가 (수량은 정수, 금액은 소수점 2자리)
+ $("#" + itemId + " .item-quantity").val(addCommaInt(removeComma($("#" + itemId + " .item-quantity").val())));
$("#" + itemId + " .item-unit-price").val(addComma($("#" + itemId + " .item-unit-price").val()));
$("#" + itemId + " .item-supply-price").val(addComma($("#" + itemId + " .item-supply-price").val()));
$("#" + itemId + " .item-vat").val(addComma($("#" + itemId + " .item-vat").val()));
diff --git a/WebContent/WEB-INF/view/costMgmt/purchaseListPopUp.jsp b/WebContent/WEB-INF/view/costMgmt/purchaseListPopUp.jsp
index f8fb1b9..7f129af 100644
--- a/WebContent/WEB-INF/view/costMgmt/purchaseListPopUp.jsp
+++ b/WebContent/WEB-INF/view/costMgmt/purchaseListPopUp.jsp
@@ -91,8 +91,8 @@ function openPartMngPopup(objId){
${item.UNIT_NAME}
|
- |
- |
+ |
+ |
diff --git a/WebContent/WEB-INF/view/purchaseOrder/deliveryMngAcceptancePartList.jsp b/WebContent/WEB-INF/view/purchaseOrder/deliveryMngAcceptancePartList.jsp
index f76b09d..672842d 100644
--- a/WebContent/WEB-INF/view/purchaseOrder/deliveryMngAcceptancePartList.jsp
+++ b/WebContent/WEB-INF/view/purchaseOrder/deliveryMngAcceptancePartList.jsp
@@ -151,7 +151,7 @@ var columns = [
else if(cn.includes('유로') || cn === 'EUR') s = '€';
else if(cn.includes('엔') || cn === 'JPY') s = '¥';
else if(cn.includes('위안') || cn === 'CNY') s = '¥';
- return s + Number(value).toLocaleString();
+ return s + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
{headerHozAlign : 'center', hozAlign : 'right', minWidth : 90, widthGrow : 1, title : '입고금액', field : 'TOTAL_DELIVERY_PRICE',
@@ -165,7 +165,7 @@ var columns = [
else if(cn.includes('유로') || cn === 'EUR') s = '€';
else if(cn.includes('엔') || cn === 'JPY') s = '¥';
else if(cn.includes('위안') || cn === 'CNY') s = '¥';
- return s + Number(value).toLocaleString();
+ return s + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
{headerHozAlign : 'center', hozAlign : 'right', minWidth : 90, widthGrow : 1, title : '미입고금액', field : 'TOTAL_NOT_DELIVERY_PRICE',
@@ -179,7 +179,7 @@ var columns = [
else if(cn.includes('유로') || cn === 'EUR') s = '€';
else if(cn.includes('엔') || cn === 'JPY') s = '¥';
else if(cn.includes('위안') || cn === 'CNY') s = '¥';
- return s + Number(value).toLocaleString();
+ return s + Number(value).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
},
{headerHozAlign:'center', hozAlign:'center', minWidth:90, widthGrow:1.1, title:'수입검사 검사현황', field:'INSPECTION_STATUS'},
diff --git a/WebContent/WEB-INF/view/purchaseOrder/deliveryMngList.jsp b/WebContent/WEB-INF/view/purchaseOrder/deliveryMngList.jsp
index f03a63f..5bfe430 100644
--- a/WebContent/WEB-INF/view/purchaseOrder/deliveryMngList.jsp
+++ b/WebContent/WEB-INF/view/purchaseOrder/deliveryMngList.jsp
@@ -517,7 +517,7 @@ function fn_downmater(){
|
<%-- | --%>
|
- |
+ |
|
${item.DELIVERY_DATE} |
${item.WRITER_NAME} |
diff --git a/WebContent/WEB-INF/view/purchaseOrder/deliveryResultFormCostPopUp.jsp b/WebContent/WEB-INF/view/purchaseOrder/deliveryResultFormCostPopUp.jsp
index dfe4c8e..aee20c8 100644
--- a/WebContent/WEB-INF/view/purchaseOrder/deliveryResultFormCostPopUp.jsp
+++ b/WebContent/WEB-INF/view/purchaseOrder/deliveryResultFormCostPopUp.jsp
@@ -14,6 +14,31 @@ String userId = CommonUtils.checkNull(person.getUserId());
<%=Constants.SYSTEM_NAME%>
-
+
+
+
diff --git a/WebContent/init_new.jsp b/WebContent/init_new.jsp
index 50df74a..25bce28 100644
--- a/WebContent/init_new.jsp
+++ b/WebContent/init_new.jsp
@@ -78,7 +78,7 @@ pageContext.setAttribute("newLineChar", "\n");
-
+
diff --git a/WebContent/js/common.js b/WebContent/js/common.js
index 1d97f00..f76d9aa 100644
--- a/WebContent/js/common.js
+++ b/WebContent/js/common.js
@@ -3552,4 +3552,35 @@ function initPartSelect2Ajax(partNoSelectId, partNameSelectId, partObjIdInputId,
$(partNoSelectId).on('select2:clear', partNoClearHandler);
$(partNameSelectId).on('select2:select', partNameSelectHandler);
$(partNameSelectId).on('select2:clear', partNameClearHandler);
+}
+
+/**
+ * 금액 표시용 포맷 (천단위 콤마 + 소수점 2자리 고정)
+ * 예: 1005.04 → "1,005.04", 1000 → "1,000.00"
+ */
+function formatMoney(data) {
+ if(!data && data !== 0) return '';
+ var num = Number(String(data).replace(/,/g, ''));
+ if(isNaN(num)) return '';
+ return num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
+}
+
+/**
+ * 정수 표시용 포맷 (천단위 콤마, 소수점 없음)
+ * 예: 2.00 → "2", 1000 → "1,000"
+ */
+function formatInteger(data) {
+ if(!data && data !== 0) return '';
+ var num = Math.round(Number(String(data).replace(/,/g, '')));
+ if(isNaN(num)) return '';
+ return num.toLocaleString();
+}
+
+/**
+ * 콤마 제거 함수
+ * 예: "1,005.04" → "1005.04"
+ */
+function removeComma(data) {
+ if(!data) return '';
+ return data.toString().replace(/,/g, '');
}
\ No newline at end of file
diff --git a/src/com/pms/common/utils/CommonUtils.java b/src/com/pms/common/utils/CommonUtils.java
index de016f5..1a3e11b 100644
--- a/src/com/pms/common/utils/CommonUtils.java
+++ b/src/com/pms/common/utils/CommonUtils.java
@@ -1795,6 +1795,13 @@ public class CommonUtils {
DecimalFormat formatter = new DecimalFormat("#,##0.###");
return formatter.format(num);
}
+
+ // 소수점 2자리 고정 포맷 (천단위 콤마 포함)
+ public static String numberFormatDecimal2(String num) {
+ if(isBlank(num)) return num;
+ DecimalFormat formatter = new DecimalFormat("#,##0.00");
+ return formatter.format(Double.parseDouble(num.replace(",", "")));
+ }
public static Map requestLogApi(HttpServletRequest request,Map paramMap,String useType){
Map resultMap = new HashMap();
diff --git a/src/com/pms/salesmgmt/mapper/goodsMgmt.xml b/src/com/pms/salesmgmt/mapper/goodsMgmt.xml
index 49ce75c..f9f534b 100644
--- a/src/com/pms/salesmgmt/mapper/goodsMgmt.xml
+++ b/src/com/pms/salesmgmt/mapper/goodsMgmt.xml
@@ -243,20 +243,20 @@
,#{class1} /* */
,#{class2} /* */
,#{goodsGuarantee}:: INTEGER /* 보증기간 */
- ,#{costAmt}:: BIGINT /* 판매금액 */
- ,#{saleAmt}:: BIGINT /* */
- ,#{saftyQty}:: BIGINT /* */
- ,#{royalty}:: BIGINT /* */
+ ,#{costAmt}:: NUMERIC /* 판매금액 */
+ ,#{saleAmt}:: NUMERIC /* */
+ ,#{saftyQty}:: NUMERIC /* */
+ ,#{royalty}:: NUMERIC /* */
,#{regYmd} /* 등록일자 */
,#{delYmd} /* 단종일자 */
,#{remark} /* 비고 */
,#{commiYn} /* 판매수수료적용여부 */
,#{commiGb} /* 방식/수식 */
,#{commiGive} /* */
- ,#{cCommiPer}:: BIGINT /* 크레인(%) */
- ,#{tCommiPer}:: BIGINT /* 특장(%) */
- ,#{cCommiAmt}:: BIGINT /* 크레인(금액) */
- ,#{tCommiAmt}:: BIGINT /* 특장(금액) */
+ ,#{cCommiPer}:: NUMERIC /* 크레인(%) */
+ ,#{tCommiPer}:: NUMERIC /* 특장(%) */
+ ,#{cCommiAmt}:: NUMERIC /* 크레인(금액) */
+ ,#{tCommiAmt}:: NUMERIC /* 특장(금액) */
,#{gb1} /* 영업소 */
,now() /* 생성일시 */
,#{cretEmpNo} /* 생성자 */
@@ -276,20 +276,20 @@
,Class1 = #{class1} /* */
,Class2 = #{class2} /* */
,GoodsGuarantee = #{goodsGuarantee}:: INTEGER /* 보증기간 */
- ,Cost_Amt = #{costAmt}:: BIGINT /* 판매금액 */
- ,Sale_Amt = #{saleAmt}:: BIGINT /* */
- ,SaftyQty = #{saftyQty}:: BIGINT /* */
- ,Royalty = #{royalty}:: BIGINT /* */
+ ,Cost_Amt = #{costAmt}:: NUMERIC /* 판매금액 */
+ ,Sale_Amt = #{saleAmt}:: NUMERIC /* */
+ ,SaftyQty = #{saftyQty}:: NUMERIC /* */
+ ,Royalty = #{royalty}:: NUMERIC /* */
,RegYmd = #{regYmd} /* 등록일자 */
,DelYmd = #{delYmd} /* 단종일자 */
,Remark = #{remark} /* 비고 */
,CommiYN = #{commiYn} /* 판매수수료적용여부 */
,CommiGB = #{commiGb} /* 방식/수식 */
,CommiGive = #{commiGive} /* */
- ,CCommiPer = #{cCommiPer}:: BIGINT /* 크레인(%) */
- ,TCommiPer = #{tCommiPer}:: BIGINT /* 특장(%) */
- ,CCommiAmt = #{cCommiAmt}:: BIGINT /* 크레인(금액) */
- ,TCommiAmt = #{tCommiAmt}:: BIGINT /* 특장(금액) */
+ ,CCommiPer = #{cCommiPer}:: NUMERIC /* 크레인(%) */
+ ,TCommiPer = #{tCommiPer}:: NUMERIC /* 특장(%) */
+ ,CCommiAmt = #{cCommiAmt}:: NUMERIC /* 크레인(금액) */
+ ,TCommiAmt = #{tCommiAmt}:: NUMERIC /* 특장(금액) */
,GB1 = #{gb1} /* 영업소 */
,EDIT_DATE = now() /* 수정일시 */
,EditEmpNo = #{cretEmpNo} /* 수정자 */
diff --git a/src/com/pms/salesmgmt/service/ContractMgmtService.java b/src/com/pms/salesmgmt/service/ContractMgmtService.java
index 4944207..c3ac5b9 100644
--- a/src/com/pms/salesmgmt/service/ContractMgmtService.java
+++ b/src/com/pms/salesmgmt/service/ContractMgmtService.java
@@ -611,12 +611,12 @@ public class ContractMgmtService {
String target_project_no= CommonUtils.checkNull(paramMap.get("target_project_no_direct"));
int overhaul_order = Integer.parseInt(CommonUtils.checkNull(paramMap.get("overhaul_order"),"1"));
int project_cnt= Integer.parseInt(CommonUtils.checkNull(paramMap.get("facility_qty"), "1"));
- long contract_price_currency= Long.parseLong(CommonUtils.checkNull(paramMap.get("contract_price_currency"), "0"));
- long contract_price= Long.parseLong(CommonUtils.checkNull(paramMap.get("contract_price"), "0"));
+ double contract_price_currency= Double.parseDouble(CommonUtils.checkNull(paramMap.get("contract_price_currency"), "0").replace(",", ""));
+ double contract_price= Double.parseDouble(CommonUtils.checkNull(paramMap.get("contract_price"), "0").replace(",", ""));
//수주가와 금액은 대수로 나누어서 등록
- paramMap.put("contract_price_currency", contract_price_currency/project_cnt + "");
- paramMap.put("contract_price", contract_price/project_cnt + "");
+ paramMap.put("contract_price_currency", String.valueOf(contract_price_currency/project_cnt));
+ paramMap.put("contract_price", String.valueOf(contract_price/project_cnt));
if("0000964".equals(result_cd)){
resultList = sqlSession.selectOne("contractMgmt.getProjectListBycontractObjid", paramMap);
@@ -847,6 +847,22 @@ public class ContractMgmtService {
String[] objIds = request.getParameterValues("objId");
+ // 프로젝트가 생성된 건이 있는지 먼저 체크
+ List hasProjectList = new ArrayList();
+ for(int i=0; i 0 ? amount / quantity : amount;
+ double unitPrice = quantity > 0 ? amount / quantity : amount;
// JSON 형식으로 품목 데이터 생성
String itemJson = "[{" +
@@ -2164,13 +2180,13 @@ private String makeEstimateMailContents(Map contractInfo, Map estimateTemplate,
contents.append("");
contents.append("");
- long totalAmount = 0;
+ double totalAmount = 0;
for(int i = 0; i < estimateItems.size(); i++){
Map item = estimateItems.get(i);
String amount = CommonUtils.checkNull(item.get("amount"));
if(!"".equals(amount)){
try {
- totalAmount += Long.parseLong(amount.replace(",", ""));
+ totalAmount += Double.parseDouble(amount.replace(",", ""));
} catch(Exception e){}
}
@@ -2451,24 +2467,24 @@ private String encodeImageToBase64(String imagePath) {
item.put("order_quantity", estimateItem.get("quantity"));
item.put("order_unit_price", estimateItem.get("unit_price"));
- // 공급가액 계산
- Object quantity = estimateItem.get("quantity");
- Object unitPrice = estimateItem.get("unit_price");
- long supplyPrice = 0;
-
- if(quantity != null && unitPrice != null) {
- try {
- long qty = Long.parseLong(quantity.toString().replaceAll("[^0-9]", ""));
- long price = Long.parseLong(unitPrice.toString().replaceAll("[^0-9]", ""));
- supplyPrice = qty * price;
- } catch(Exception e) {
- System.out.println("금액 계산 실패: " + e.getMessage());
- }
+ // 공급가액 계산 (소수점 단가 지원)
+ Object quantity = estimateItem.get("quantity");
+ Object unitPrice = estimateItem.get("unit_price");
+ double supplyPrice = 0;
+
+ if(quantity != null && unitPrice != null) {
+ try {
+ double qty = Double.parseDouble(quantity.toString().replaceAll("[^0-9.]", ""));
+ double price = Double.parseDouble(unitPrice.toString().replaceAll("[^0-9.]", ""));
+ supplyPrice = qty * price;
+ } catch(Exception e) {
+ System.out.println("금액 계산 실패: " + e.getMessage());
}
-
- item.put("order_supply_price", supplyPrice);
- item.put("order_vat", Math.round(supplyPrice * 0.1));
- item.put("order_total_amount", supplyPrice + Math.round(supplyPrice * 0.1));
+ }
+
+ item.put("order_supply_price", supplyPrice);
+ item.put("order_vat", Math.round(supplyPrice * 0.1));
+ item.put("order_total_amount", supplyPrice + Math.round(supplyPrice * 0.1));
System.out.println("계산 완료 - 공급가액: " + supplyPrice + ", 부가세: " + Math.round(supplyPrice * 0.1));
}
@@ -2601,12 +2617,12 @@ private String encodeImageToBase64(String imagePath) {
// 공급가액 계산 (수량 * 단가)
Object quantity = templateItem.get("quantity");
Object unitPrice = templateItem.get("unit_price");
- long supplyPrice = 0;
+ double supplyPrice = 0;
if(quantity != null && unitPrice != null) {
try {
- long qty = Long.parseLong(quantity.toString().replaceAll("[^0-9]", ""));
- long price = Long.parseLong(unitPrice.toString().replaceAll("[^0-9]", ""));
+ double qty = Double.parseDouble(quantity.toString().replaceAll("[^0-9.]", ""));
+ double price = Double.parseDouble(unitPrice.toString().replaceAll("[^0-9.]", ""));
supplyPrice = qty * price;
} catch(Exception e) {
// 계산 실패 시 0
@@ -2614,7 +2630,7 @@ private String encodeImageToBase64(String imagePath) {
}
orderItem.put("ORDER_SUPPLY_PRICE", supplyPrice);
- orderItem.put("ORDER_VAT", Math.round(supplyPrice * 0.1)); // 부가세 10%
+ orderItem.put("ORDER_VAT", Math.round(supplyPrice * 0.1));
orderItem.put("ORDER_TOTAL_AMOUNT", supplyPrice + Math.round(supplyPrice * 0.1));
items.add(orderItem);
@@ -2674,9 +2690,9 @@ private String encodeImageToBase64(String imagePath) {
// 2. 품목 정보 저장 (CONTRACT_ITEM 테이블)
String itemsJson = CommonUtils.checkNull(paramMap.get("items_json"));
- long totalSupplyPrice = 0;
- long totalVat = 0;
- long totalAmount = 0;
+ double totalSupplyPrice = 0;
+ double totalVat = 0;
+ double totalAmount = 0;
if(!"".equals(itemsJson)){
try {
@@ -2743,13 +2759,13 @@ private String encodeImageToBase64(String imagePath) {
}
}
- // 합계 계산
+ // 합계 계산 (소수점 지원)
try {
- totalSupplyPrice += Long.parseLong(orderSupplyPrice);
- totalVat += Long.parseLong(orderVat);
- totalAmount += Long.parseLong(orderTotalAmount);
+ totalSupplyPrice += Double.parseDouble(orderSupplyPrice);
+ totalVat += Double.parseDouble(orderVat);
+ totalAmount += Double.parseDouble(orderTotalAmount);
} catch (NumberFormatException e) {
- // 숫자 변환 실패 시 무시
+ System.out.println("합계 계산 실패 - supply:" + orderSupplyPrice + ", vat:" + orderVat + ", total:" + orderTotalAmount);
}
}
} catch (Exception e) {
@@ -2797,11 +2813,11 @@ private String encodeImageToBase64(String imagePath) {
System.out.println("품목 개수: " + contractItems.size() + "개 - 프로젝트 " + (hasProject ? "업데이트" : "생성") + " 시작" + (isMachine ? " (Machine - 수량별 생성)" : ""));
for(Map item : contractItems) {
- // 수량 가져오기
+ // 수량 가져오기 (소수점 형태 "2.00"도 처리)
Object quantityObj = item.get("ORDER_QUANTITY") != null ? item.get("ORDER_QUANTITY") : item.get("QUANTITY");
int itemQuantity = 1;
try {
- itemQuantity = Integer.parseInt(String.valueOf(quantityObj));
+ itemQuantity = (int) Double.parseDouble(String.valueOf(quantityObj).replaceAll("[^0-9.]", ""));
} catch (Exception e) {
itemQuantity = 1;
}
@@ -2938,11 +2954,11 @@ private String encodeImageToBase64(String imagePath) {
String contract_objid= CommonUtils.checkNull(paramMap.get("contractObjId"));
paramMap.put("objId", contract_objid);
- // 품목별 수주 정보 업데이트 및 합계 계산
+ // 품목별 수주 정보 업데이트 및 합계 계산 (소수점 단가 지원)
String itemsJson = CommonUtils.checkNull(paramMap.get("items_json"));
- long totalSupplyPrice = 0;
- long totalVat = 0;
- long totalAmount = 0;
+ double totalSupplyPrice = 0;
+ double totalVat = 0;
+ double totalAmount = 0;
if(!"".equals(itemsJson)){
try {
@@ -2968,13 +2984,13 @@ private String encodeImageToBase64(String imagePath) {
sqlSession.update("contractMgmt.updateContractItemOrderInfo", itemMap);
- // 합계 계산
+ // 합계 계산 (소수점 지원)
try {
- totalSupplyPrice += Long.parseLong(orderSupplyPrice);
- totalVat += Long.parseLong(orderVat);
- totalAmount += Long.parseLong(orderTotalAmount);
+ totalSupplyPrice += Double.parseDouble(orderSupplyPrice);
+ totalVat += Double.parseDouble(orderVat);
+ totalAmount += Double.parseDouble(orderTotalAmount);
} catch (NumberFormatException e) {
- // 숫자 변환 실패 시 무시
+ System.out.println("합계 계산 실패 - supplyPrice:" + orderSupplyPrice + ", vat:" + orderVat + ", total:" + orderTotalAmount);
}
}
} catch (Exception e) {
@@ -3031,11 +3047,11 @@ private String encodeImageToBase64(String imagePath) {
System.out.println("품목 개수: " + contractItems.size() + "개 - 프로젝트 " + (hasProject ? "업데이트" : "생성") + " 시작" + (isMachine ? " (Machine - 수량별 생성)" : ""));
for(Map item : contractItems) {
- // 수량 가져오기
+ // 수량 가져오기 (소수점 형태 "2.00"도 처리)
Object quantityObj = item.get("ORDER_QUANTITY") != null ? item.get("ORDER_QUANTITY") : item.get("QUANTITY");
int itemQuantity = 1;
try {
- itemQuantity = Integer.parseInt(String.valueOf(quantityObj));
+ itemQuantity = (int) Double.parseDouble(String.valueOf(quantityObj).replaceAll("[^0-9.]", ""));
} catch (Exception e) {
itemQuantity = 1;
}
diff --git a/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java b/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
index 0ae5ab2..8506a28 100644
--- a/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
+++ b/src/com/pms/salesmgmt/service/SalesNcollectMgmtService.java
@@ -639,8 +639,8 @@ public Map saveSaleRegistration(HttpServletRequest request, Map<
int supplyQty = Integer.parseInt((String) paramMap.get("supplyQty"));
totalSupplyQty += supplyQty;
- // 화면에서 입력한 공급가
- BigDecimal supplyAmt = new BigDecimal(Integer.parseInt((String) paramMap.get("supplyAmt")));
+ // 화면에서 입력한 공급가 (소수점 지원)
+ BigDecimal supplyAmt = new BigDecimal(((String) paramMap.get("supplyAmt")).replace(",", ""));
// 매출수량이 계약관리의 계약수량보다 많을 수 없음
if (totalSupplyQty > goodsQty) {
@@ -908,8 +908,8 @@ public Map saveSaleRegistration(HttpServletRequest request, Map<
paramMap.put("acntUnit", acntUnit);
- // 화면에서 입력한 수금금액
- BigDecimal rcptAmt = new BigDecimal(Integer.parseInt((String) paramMap.get("rcptAmt")));
+ // 화면에서 입력한 수금금액 (소수점 지원)
+ BigDecimal rcptAmt = new BigDecimal(((String) paramMap.get("rcptAmt")).replace(",", ""));
BigDecimal collectRcptAmt = new BigDecimal(0); // 수금금액
if (StringUtils.isBlank((String) paramMap.get("rcptNo"))) { //매출번호 없으면
diff --git a/src/com/pms/service/PurchaseOrderService.java b/src/com/pms/service/PurchaseOrderService.java
index b8df446..394db2e 100644
--- a/src/com/pms/service/PurchaseOrderService.java
+++ b/src/com/pms/service/PurchaseOrderService.java
@@ -1944,7 +1944,7 @@ public class PurchaseOrderService {
try {
double orderQty = Double.parseDouble(orderQtyStr);
double price = Double.parseDouble(partnerPrice);
- totalPrice = String.valueOf((long)(orderQty * price));
+ totalPrice = String.valueOf(orderQty * price);
} catch (NumberFormatException e) {
totalPrice = "0";
}