|
|
|
|
@ -175,7 +175,7 @@
|
|
|
|
|
</td>
|
|
|
|
|
<td rowspan="2" class="op-cell b-right-0 b-bottom-0">X</td>
|
|
|
|
|
<td rowspan="2" class="b-right-0 b-bottom-0">
|
|
|
|
|
<input type="text" id="vltnArea" class="input decimalMask" value=""/><!-- 위반면적 -->
|
|
|
|
|
<input type="text" id="vltnArea" class="input decimalMask" value="" readonly/><!-- 위반면적 -->
|
|
|
|
|
</td>
|
|
|
|
|
<td rowspan="2" class="op-cell b-right-0 b-bottom-0">X</td>
|
|
|
|
|
<td class="b-right-0 b-bottom-0 pad-0">
|
|
|
|
|
@ -244,6 +244,7 @@
|
|
|
|
|
<div class="popup_foot">
|
|
|
|
|
<c:if test="${mode ne 'V'}">
|
|
|
|
|
<button type="button" id="btnSave" class="newbtns bg1">저장</button>
|
|
|
|
|
<button type="button" id="btnDel" class="newbtns bg6" style="display: none;">삭제</button>
|
|
|
|
|
</c:if>
|
|
|
|
|
<button type="button" class="newbtns bg2 modalclose" id="btnClose">닫기</button>
|
|
|
|
|
</div>
|
|
|
|
|
@ -266,6 +267,7 @@
|
|
|
|
|
crdnNo: '${crdnNo}',
|
|
|
|
|
impltTaskSeCd: '${impltTaskSeCd}',
|
|
|
|
|
impltTaskSeCdNm: '${impltTaskSeCdNm}',
|
|
|
|
|
levyInfoIdSelect: null,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 그리드 관련 객체
|
|
|
|
|
@ -423,11 +425,162 @@
|
|
|
|
|
/**
|
|
|
|
|
* 중요로직: 행 선택 시 공통 처리 함수
|
|
|
|
|
* rowData를 통해 actInfoId 설정 및 다른 그리드 새로고침
|
|
|
|
|
* 기존 부과정보가 있는 경우 snapshot 데이터로 화면 복원
|
|
|
|
|
* @param {Object} rowData - 선택된 행의 데이터
|
|
|
|
|
*/
|
|
|
|
|
var handleRowSelection = function(rowData) {
|
|
|
|
|
LevyPrvntcPopup.levyInfoIdSelect = null;
|
|
|
|
|
if (!rowData) return;
|
|
|
|
|
|
|
|
|
|
console.log('행 선택됨:', rowData);
|
|
|
|
|
$('#actInfoId').val(rowData.actInfoId); // 위반행위 키 먼저 설정
|
|
|
|
|
|
|
|
|
|
// 기존 부과정보 조회
|
|
|
|
|
var existingLevyInfoUrl = '<c:url value="/crdn/crndRegistAndView/crdnLevyPrvntc/selectLevyInfoByActInfoId.ajax"/>';
|
|
|
|
|
var requestData = {
|
|
|
|
|
crdnYr: LevyPrvntcPopup.crdnYr,
|
|
|
|
|
crdnNo: LevyPrvntcPopup.crdnNo,
|
|
|
|
|
impltTaskSeCd: LevyPrvntcPopup.impltTaskSeCd, // 부과예고 고정값
|
|
|
|
|
actInfoId: rowData.actInfoId
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: existingLevyInfoUrl,
|
|
|
|
|
type: 'GET',
|
|
|
|
|
data: requestData,
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
console.log('기존 부과정보 조회 결과:', response);
|
|
|
|
|
|
|
|
|
|
if (response.success && response.data) {
|
|
|
|
|
// 기존 부과정보가 있는 경우 - snapshot 데이터로 화면 복원
|
|
|
|
|
var existingData = response.data;
|
|
|
|
|
setLevyInfoToForm(existingData);
|
|
|
|
|
$("#btnSave").text('수정');
|
|
|
|
|
console.log('기존 부과정보로 화면 복원 완료');
|
|
|
|
|
} else {
|
|
|
|
|
// 기존 부과정보가 없는 경우 - 행위정보로 기본값 설정
|
|
|
|
|
setActInfoToForm(rowData);
|
|
|
|
|
$("#btnSave").text('등록');
|
|
|
|
|
console.log('신규 등록 모드 - 행위정보로 기본값 설정 완료');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function(xhr, status, error) {
|
|
|
|
|
console.error('기존 부과정보 조회 중 오류 발생:', error);
|
|
|
|
|
// 오류 발생 시 행위정보로 기본값 설정
|
|
|
|
|
setActInfoToForm(rowData);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 기존 부과정보로 화면 설정
|
|
|
|
|
* @param {Object} existingData - 기존 부과정보 데이터
|
|
|
|
|
*/
|
|
|
|
|
var setLevyInfoToForm = function(existingData) {
|
|
|
|
|
|
|
|
|
|
LevyPrvntcPopup.levyInfoIdSelect = existingData.levyInfoId;
|
|
|
|
|
|
|
|
|
|
// 위반면적 설정
|
|
|
|
|
$('#vltnArea').val(existingData.vltnArea || '').trigger('change');
|
|
|
|
|
|
|
|
|
|
// 산정률1 설정 (행위유형)
|
|
|
|
|
$('#cmpttnRtDisplay').val((existingData.cmpttnRt || '') + ' %');
|
|
|
|
|
$('#cmpttnRtCd').val(existingData.cmpttnRtCd || '');
|
|
|
|
|
$('#cmpttnRt').val(existingData.cmpttnRt || '');
|
|
|
|
|
$('#cmpttnRtRate').val(existingData.cmpttnRtRate || ''); // 계산용 비율값
|
|
|
|
|
|
|
|
|
|
// 기초공사구분 및 비율
|
|
|
|
|
$('#bscsCstrnSeCd').val(existingData.bscsCstrnSeCd || '');
|
|
|
|
|
$('#bscsCstrnRt').val(existingData.bscsCstrnRt || '');
|
|
|
|
|
|
|
|
|
|
// 건물기준시가액
|
|
|
|
|
$('#bldgNewPrcCrtrAmtNo').val(existingData.bldgNewPrcCrtrAmtNo || '');
|
|
|
|
|
$('#bldgNewPrcCrtrAmtDisplay').val(existingData.bldgNewPrcCrtrAmtDisplay || ''); // 건축물용도명
|
|
|
|
|
$('#bldgNewPrcCrtrAmt').val(existingData.bldgCrtrMprcAmt || '').trigger('focus');
|
|
|
|
|
|
|
|
|
|
// 구조지수
|
|
|
|
|
$('#strctIdxCd').val(existingData.strctIdxCd || '');
|
|
|
|
|
$('#strctIdx_nm').val(existingData.strctIdxCdNm || ''); // 구조지수명
|
|
|
|
|
$('#strctIdx').val(existingData.strctIdx || '');
|
|
|
|
|
|
|
|
|
|
// 용도지수
|
|
|
|
|
$('#usgIdxCd').val(existingData.usgIdxCd || '');
|
|
|
|
|
$('#usgIdx_nm').val(existingData.usgIdxCdNm || ''); // 용도지수명
|
|
|
|
|
$('#usgIdx').val(existingData.usgIdx || '');
|
|
|
|
|
|
|
|
|
|
// 위치지수
|
|
|
|
|
$('#pstnIdxNo').val(existingData.pstnIdxNo || '');
|
|
|
|
|
$('#pstnIdx_nm').val(existingData.oalp || '').trigger('focus'); // 공시지가
|
|
|
|
|
$('#pstnIdx').val(existingData.pstnIdx || '');
|
|
|
|
|
|
|
|
|
|
// 경과년수별잔가율
|
|
|
|
|
$('#elpsYrRdvlrt_yr').val((existingData.elpsYrRdvlrtYr || '') + ' 년'); // 행위시작년도
|
|
|
|
|
$('#elpsYrRdvlrt').val(existingData.elpsYrRdvlrt || '');
|
|
|
|
|
|
|
|
|
|
// 산정률2
|
|
|
|
|
$('#cmpttnRt2Cd').val(existingData.cmpttnRt2Cd || '');
|
|
|
|
|
$('#cmpttnRt2').val(existingData.cmpttnRt2 || '');
|
|
|
|
|
$('#cmpttnRt2Display').val((existingData.cmpttnRt2 || '') + ' %');
|
|
|
|
|
$('#cmpttnRt2Rate').val(existingData.cmpttnRt2Rate || ''); // 계산용 비율값
|
|
|
|
|
|
|
|
|
|
// 가감산 정보
|
|
|
|
|
$('#adtnRtCd').val(existingData.adtnRtCd || '');
|
|
|
|
|
$('#adtnRt').val(existingData.adtnRt || '');
|
|
|
|
|
$('#adtnRtRate').val(existingData.adtnRtRate || ''); // 계산용 비율값
|
|
|
|
|
$('#sbtrRtCd').val(existingData.sbtrRtCd || '');
|
|
|
|
|
$('#sbtrRt').val(existingData.sbtrRt || '');
|
|
|
|
|
$('#sbtrRtRate').val(existingData.sbtrRtRate || ''); // 계산용 비율값
|
|
|
|
|
|
|
|
|
|
// 가감산시행령률
|
|
|
|
|
$('#adsbmtnEnfcRt').val(existingData.adsbmtnEnfcRt || '100');
|
|
|
|
|
$('#adsbmtnEnfcRtDisplay').val((existingData.adsbmtnEnfcRt || '100') + ' %');
|
|
|
|
|
|
|
|
|
|
// 산정액 및 부과총액
|
|
|
|
|
$('#cmpttnAmt').val(existingData.cmpttnAmt || '').trigger('focus');
|
|
|
|
|
$('#levyWholAmt').val(existingData.levyWholAmt || '');
|
|
|
|
|
$('#levyWholAmtDisplay').text((existingData.levyWholAmt ? Number(existingData.levyWholAmt).toLocaleString() : '0') + ' 원');
|
|
|
|
|
|
|
|
|
|
// 시가표준액
|
|
|
|
|
$('#standardMarketPrice').val(existingData.mprcStdAmt || '');
|
|
|
|
|
$('#standardMarketPrice_top').val(existingData.mprcStdAmt || '').trigger('focus');
|
|
|
|
|
|
|
|
|
|
// 건축물과세시가
|
|
|
|
|
$('#taxableMarketPrice').val(existingData.bdstTxtnMprc || '');
|
|
|
|
|
|
|
|
|
|
// 기초공사율 계산을 위한 기준 비율들 저장 (hidden으로)
|
|
|
|
|
if (!$('#bscsCstrnYBdstCmpttnRt').length) {
|
|
|
|
|
$('<input type="hidden" id="bscsCstrnYBdstCmpttnRt">').appendTo('body');
|
|
|
|
|
$('<input type="hidden" id="bscsCstrnNBdstCmpttnRt">').appendTo('body');
|
|
|
|
|
$('<input type="hidden" id="dupEtbldgBdstCmpttnRt">').appendTo('body');
|
|
|
|
|
}
|
|
|
|
|
$('#bscsCstrnYBdstCmpttnRt').val(existingData.bscsCstrnYBdstCmpttnRt || '');
|
|
|
|
|
$('#bscsCstrnNBdstCmpttnRt').val(existingData.bscsCstrnNBdstCmpttnRt || '');
|
|
|
|
|
$('#dupEtbldgBdstCmpttnRt').val(existingData.dupEtbldgBdstCmpttnRt || '');
|
|
|
|
|
|
|
|
|
|
// 가감산 버튼 텍스트 업데이트
|
|
|
|
|
if (existingData.adtnRt && parseFloat(existingData.adtnRt) > 0) {
|
|
|
|
|
$('#btnOpenAddPopup').text('+ 가산 [' + existingData.adtnRt + '%]');
|
|
|
|
|
} else {
|
|
|
|
|
$('#btnOpenAddPopup').text('+ 가산 [0%]');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (existingData.sbtrRt && parseFloat(existingData.sbtrRt) > 0) {
|
|
|
|
|
$('#btnOpenMinusPopup').text('- 감산 [' + existingData.sbtrRt + '%]');
|
|
|
|
|
} else {
|
|
|
|
|
$('#btnOpenMinusPopup').text('- 감산 [0%]');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#btnDel').show();
|
|
|
|
|
|
|
|
|
|
console.log('기존 부과정보로 화면 복원 완료:', existingData);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 행위정보로 기본값 설정 (신규 등록 모드)
|
|
|
|
|
* @param {Object} rowData - 선택된 행의 데이터
|
|
|
|
|
*/
|
|
|
|
|
var setActInfoToForm = function(rowData) {
|
|
|
|
|
var vltnArea = rowData.calcArea; // 면적 - 조치면적 : 위반면적
|
|
|
|
|
$('#vltnArea').val(vltnArea).trigger('change'); // 위반면적, change 이벤트 트리거
|
|
|
|
|
|
|
|
|
|
@ -463,8 +616,6 @@
|
|
|
|
|
|
|
|
|
|
// 산정액 계산 함수 호출
|
|
|
|
|
calculateLevyAmount();
|
|
|
|
|
|
|
|
|
|
$('#actInfoId').val(rowData.actInfoId); // 위반행위 키
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.instance.on('focusChange', function(ev) {
|
|
|
|
|
@ -506,6 +657,11 @@
|
|
|
|
|
self.save();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 저장 버튼
|
|
|
|
|
$('#btnDel').on('click', function () {
|
|
|
|
|
self.del();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 닫기 버튼 이벤트 바인딩
|
|
|
|
|
$('.modalclose').on('click', function (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
@ -523,27 +679,45 @@
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#bscsCstrnSeCd').on('change', function () { // 기초공사구분 변경 시
|
|
|
|
|
var focusedCell = self.grid.instance.getFocusedCell();
|
|
|
|
|
if (focusedCell && focusedCell.rowKey !== null) {
|
|
|
|
|
var rowData = self.grid.instance.getRow(focusedCell.rowKey);
|
|
|
|
|
if (rowData) {
|
|
|
|
|
var selectedValue = $(this).val();
|
|
|
|
|
var rate = 0;
|
|
|
|
|
if (selectedValue === '1') {
|
|
|
|
|
rate = rowData.bscsCstrnYBdstCmpttnRt;
|
|
|
|
|
} else if (selectedValue === '2') {
|
|
|
|
|
rate = rowData.bscsCstrnNBdstCmpttnRt;
|
|
|
|
|
} else if (selectedValue === '3') {
|
|
|
|
|
rate = rowData.dupEtbldgBdstCmpttnRt;
|
|
|
|
|
} else {
|
|
|
|
|
rate = "";
|
|
|
|
|
var selectedValue = $(this).val();
|
|
|
|
|
var rate = '';
|
|
|
|
|
|
|
|
|
|
// 먼저 기존 부과정보에서 온 hidden 값들 확인
|
|
|
|
|
var bscsCstrnYRate = $('#bscsCstrnYBdstCmpttnRt').val();
|
|
|
|
|
var bscsCstrnNRate = $('#bscsCstrnNBdstCmpttnRt').val();
|
|
|
|
|
var dupEtbldgRate = $('#dupEtbldgBdstCmpttnRt').val();
|
|
|
|
|
|
|
|
|
|
// 기존 부과정보에서 온 값이 있으면 사용, 없으면 그리드에서 조회
|
|
|
|
|
if (bscsCstrnYRate || bscsCstrnNRate || dupEtbldgRate) {
|
|
|
|
|
// 기존 부과정보 기준 비율 사용
|
|
|
|
|
if (selectedValue === '1') {
|
|
|
|
|
rate = bscsCstrnYRate || '';
|
|
|
|
|
} else if (selectedValue === '2') {
|
|
|
|
|
rate = bscsCstrnNRate || '';
|
|
|
|
|
} else if (selectedValue === '3') {
|
|
|
|
|
rate = dupEtbldgRate || '';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 그리드에서 현재 선택된 행 데이터 사용
|
|
|
|
|
var focusedCell = self.grid.instance.getFocusedCell();
|
|
|
|
|
if (focusedCell && focusedCell.rowKey !== null) {
|
|
|
|
|
var rowData = self.grid.instance.getRow(focusedCell.rowKey);
|
|
|
|
|
if (rowData) {
|
|
|
|
|
if (selectedValue === '1') {
|
|
|
|
|
rate = rowData.bscsCstrnYBdstCmpttnRt || '';
|
|
|
|
|
} else if (selectedValue === '2') {
|
|
|
|
|
rate = rowData.bscsCstrnNBdstCmpttnRt || '';
|
|
|
|
|
} else if (selectedValue === '3') {
|
|
|
|
|
rate = rowData.dupEtbldgBdstCmpttnRt || '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$('#bscsCstrnRt').val(rate).trigger('focus'); // 기초공사율 설정
|
|
|
|
|
|
|
|
|
|
// 자동계산 함수 호출
|
|
|
|
|
calculateAuto();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#bscsCstrnRt').val(rate).trigger('focus'); // 기초공사율 설정
|
|
|
|
|
|
|
|
|
|
// 자동계산 함수 호출
|
|
|
|
|
calculateAuto();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 산정률2 선택 시 산정률2 input에 값 설정
|
|
|
|
|
@ -607,9 +781,8 @@
|
|
|
|
|
// 폼 데이터 수집
|
|
|
|
|
var formData = this.collectFormData();
|
|
|
|
|
|
|
|
|
|
var url = this.mode === 'C' ?
|
|
|
|
|
'<c:url value="/crdn/crndRegistAndView/crdnLevyPrvntc/insertLevyInfo.ajax"/>' :
|
|
|
|
|
'<c:url value="/crdn/crndRegistAndView/crdnLevyPrvntc/updateLevyInfo.ajax"/>';
|
|
|
|
|
// 신규/수정 자동 판단 API 사용
|
|
|
|
|
var url = '<c:url value="/crdn/crndRegistAndView/crdnLevyPrvntc/saveLevyInfo.ajax"/>';
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
@ -617,13 +790,10 @@
|
|
|
|
|
data: formData,
|
|
|
|
|
success: function(response) {
|
|
|
|
|
if (response && response.success) {
|
|
|
|
|
alert(response.message || '부과예고가 성공적으로 저장되었습니다.');
|
|
|
|
|
if (window.opener && window.opener.refreshCrdnList) {
|
|
|
|
|
window.opener.refreshCrdnList();
|
|
|
|
|
}
|
|
|
|
|
window.close();
|
|
|
|
|
alert(response.message || '부과예고 [이행강제금 산출조사서 정보]가 성공적으로 저장되었습니다.');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
alert(response.message || '저장 중 오류가 발생했습니다.');
|
|
|
|
|
alert(response.message || '부과예고 [이행강제금 산출조사서 정보] 저장 중 오류가 발생했습니다.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -636,7 +806,7 @@
|
|
|
|
|
collectFormData: function() {
|
|
|
|
|
return {
|
|
|
|
|
mode: $('#mode').val(),
|
|
|
|
|
levyInfoId: $('#levyInfoId').val() || null,
|
|
|
|
|
levyInfoId: LevyPrvntcPopup.levyInfoIdSelect || null,
|
|
|
|
|
crdnYr: $('#crdnYr').val(),
|
|
|
|
|
crdnNo: $('#crdnNo').val(),
|
|
|
|
|
impltInfoId: $('#impltInfoId').val(),
|
|
|
|
|
@ -706,6 +876,31 @@
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 저장
|
|
|
|
|
* 중요한 로직 주석: 폼 데이터와 그리드에서 선택된 이행 대상자 정보를 수집하여 저장 요청을 보냅니다.
|
|
|
|
|
*/
|
|
|
|
|
del: function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
if( !confirm("선택한 [이행강제금 산출조사서 정보] 를 삭제 하시겠습니까?") ) return false;
|
|
|
|
|
// 신규/수정 자동 판단 API 사용
|
|
|
|
|
var url = '<c:url value="/crdn/crndRegistAndView/crdnLevyPrvntc/delLevyInfo.ajax"/>';
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
type: 'POST',
|
|
|
|
|
data: {"levyInfoId":LevyPrvntcPopup.levyInfoIdSelect},
|
|
|
|
|
success: function(response) {
|
|
|
|
|
if (response && response.success) {
|
|
|
|
|
alert(response.message || '부과예고 [이행강제금 산출조사서 정보]가 성공적으로 삭제되었습니다.');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
alert(response.message || '삭제 중 오류가 발생했습니다.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|