Merge branch 'V2025111104'

This commit is contained in:
leeheejin
2025-11-12 18:56:54 +09:00
14 changed files with 2674 additions and 276 deletions

View File

@@ -24,6 +24,11 @@ $(document).ready(function(){
//날짜
_fnc_datepick();
// 그리드 높이 동적 계산 (Total 합계 영역 + 여유 공간 80px)
fnc_calculateContentHeight("gridDiv", 80);
$(window).resize(function() {
fnc_calculateContentHeight("gridDiv", 80);
});
$('.select2').select2();
@@ -96,14 +101,14 @@ $(document).ready(function(){
});
var columns = [
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
}
},
// rowSelection 제거 - fnc_tabul_search의 showCheck 파라미터로 자동 추가됨
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주번호', field : 'PO_NO' },
@@ -182,64 +187,49 @@ var columns = [
//var grid;
function fn_search(){
// 그리드 조회 및 Total 합계 업데이트를 위한 커스텀 AJAX
$.ajax({
url: "/contractMgmt/contractGridList.do",
type: "POST",
data: $("#form1").serializeObject(),
dataType: "json",
beforeSend: function(){
_startLoading("Loading...");
},
complete: function(){
_endLoading();
},
success: function(response) {
// 그리드 데이터 설정
if(_tabulGrid){
_tabulGrid.setData(response.RESULTLIST || []);
} else {
// 그리드 초기화
_tabulGrid = new Tabulator("#mainGrid", {
layout: _tabul_layout_fitColumns,
columns: columns,
data: response.RESULTLIST || [],
selectable: true
});
}
// 조회된 전체 데이터의 합계 계산
var totalSupplyPrice = 0;
var totalVat = 0;
var totalAmount = 0;
if(response.RESULTLIST && response.RESULTLIST.length > 0) {
response.RESULTLIST.forEach(function(row) {
var supplyPrice = parseFloat(row.ORDER_SUPPLY_PRICE_SUM || 0);
var vat = parseFloat(row.ORDER_VAT_SUM || 0);
var amount = parseFloat(row.ORDER_TOTAL_AMOUNT_SUM || 0);
totalSupplyPrice += supplyPrice;
totalVat += vat;
totalAmount += amount;
});
}
// 합계 표시
$("#totalSupplyPrice").text(Number(totalSupplyPrice).toLocaleString());
$("#totalVat").text(Number(totalVat).toLocaleString());
$("#totalAmount").text(Number(totalAmount).toLocaleString());
// 페이징 HTML 업데이트
if(response.PAGE_HTML){
$(".table_paging_wrap").html(response.PAGE_HTML);
}
},
error: function(jqxhr, status, error){
alert("데이터 조회 중 오류가 발생했습니다.");
console.error(error);
}
});
// fnc_tabul_search로 페이징 처리
_tabulGrid = fnc_tabul_search(
_tabul_layout_fitColumns,
_tabulGrid,
"/contractMgmt/contractGridList.do",
columns,
true
);
// 데이터 렌더링 완료 후 합계 계산 (한 번만 실행)
if(_tabulGrid) {
// 기존 이벤트 제거 후 재등록
_tabulGrid.off("renderComplete");
_tabulGrid.on("renderComplete", function(){
fn_calculateTotalFromGrid();
});
}
}
// 그리드에 표시된 데이터의 원화총액 합계 계산
function fn_calculateTotalFromGrid(){
if(!_tabulGrid) {
console.log("⚠️ [주문서관리] 그리드가 초기화되지 않음");
$("#totalAmount").text("0");
return;
}
// 현재 그리드에 표시된 데이터만 가져오기
var data = _tabulGrid.getData();
var totalAmountKRW = 0;
console.log("🔍 [주문서관리] 표시된 데이터 개수:", data.length);
if(data.length > 0) {
// ORDER_TOTAL_AMOUNT_KRW 합산
data.forEach(function(row) {
var amountKRW = parseFloat(row.ORDER_TOTAL_AMOUNT_KRW || 0);
totalAmountKRW += amountKRW;
});
}
console.log("✅ [주문서관리] 표시된 데이터 합계:", totalAmountKRW);
$("#totalAmount").text(Number(totalAmountKRW).toLocaleString());
}
function _fnc_datepick(){
@@ -716,23 +706,17 @@ function openProjectFormPopUp(objId){
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
</td>
</tr>
</table>
</div>
<!-- Total 합계 표시 영역 -->
<div style="padding: 3px 10px; background: #f5f5f5; border-radius: 3px; margin: 10px 0;">
<span style="font-weight: bold; font-size: 12px; margin-right: 20px;">
Total 공급가액: <span id="totalSupplyPrice" style="color: #2196F3;">0</span> 원
</span>
<span style="font-weight: bold; font-size: 12px; margin-right: 20px;">
Total 부가세: <span id="totalVat" style="color: #FF9800;">0</span> 원
</span>
<span style="font-weight: bold; font-size: 12px;">
Total 총액: <span id="totalAmount" style="color: #4CAF50;">0</span> 원
</span>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</table>
</div>
<!-- Total 합계 표시 영역 (그리드 위) -->
<div style="padding:5px 10px; background: #f5f5f5;">
<span style="font-weight: bold; font-size: 13px;">
수주 금액 : <span id="totalAmount" style="color: #4CAF50;">0</span> 원
</span>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</div>
</div>
</form>