매출관리_마감정보등록 기능 추가

This commit is contained in:
2026-02-13 13:59:37 +09:00
parent 4030755447
commit 3bfc985604
4 changed files with 286 additions and 0 deletions

View File

@@ -69,6 +69,142 @@
fn_search();
});
// 마감정보입력 버튼
$("#btnDeadlineInfo").click(function(){
var targetObj = _tabulGrid.getSelectedData();
if(0 == targetObj.length){
Swal.fire("선택된 내용이 없습니다.");
return false;
}
// 선택된 OBJID 목록
var objIdList = [];
for(var i = 0; i < targetObj.length; i++){
objIdList.push(fnc_checkNull(targetObj[i].OBJID));
}
// 단건 선택 시 기존 마감정보 불러오기
var loadExisting = (targetObj.length === 1);
function openDeadlineInfoPopup(existingInfo) {
var taxType = (existingInfo && existingInfo.TAX_TYPE) ? existingInfo.TAX_TYPE : '';
var taxInvoiceDate = (existingInfo && existingInfo.TAX_INVOICE_DATE) ? existingInfo.TAX_INVOICE_DATE : '';
var exportDeclNo = (existingInfo && existingInfo.EXPORT_DECL_NO) ? existingInfo.EXPORT_DECL_NO : '';
var loadingDate = (existingInfo && existingInfo.LOADING_DATE) ? existingInfo.LOADING_DATE : '';
// hidden select에서 과세구분 옵션 HTML 가져오기
var taxTypeOptionsHtml = $('#hiddenTaxTypeList').html();
Swal.fire({
title: '마감정보입력',
width: '600px',
html:
'<div style="padding:10px;">' +
'<table style="width:100%; border-collapse:collapse;">' +
'<tr>' +
' <td style="padding:8px; text-align:right; width:40%; font-weight:bold; border:1px solid #ddd; background:#f5f5f5;">과세구분</td>' +
' <td style="padding:8px; border:1px solid #ddd;">' +
' <select id="swal_taxType" style="width:100%; padding:5px;">' +
taxTypeOptionsHtml +
' </select>' +
' </td>' +
'</tr>' +
'<tr>' +
' <td style="padding:8px; text-align:right; font-weight:bold; border:1px solid #ddd; background:#f5f5f5;">세금계산서발행일</td>' +
' <td style="padding:8px; border:1px solid #ddd;"><input type="text" id="swal_taxInvoiceDate" style="width:95%; padding:5px;" placeholder="YYYY-MM-DD" readonly></td>' +
'</tr>' +
'<tr>' +
' <td style="padding:8px; text-align:right; font-weight:bold; border:1px solid #ddd; background:#f5f5f5;">수출신고필증신고번호</td>' +
' <td style="padding:8px; border:1px solid #ddd;"><input type="text" id="swal_exportDeclNo" style="width:95%; padding:5px;"></td>' +
'</tr>' +
'<tr>' +
' <td style="padding:8px; text-align:right; font-weight:bold; border:1px solid #ddd; background:#f5f5f5;">선적일자</td>' +
' <td style="padding:8px; border:1px solid #ddd;"><input type="text" id="swal_loadingDate" style="width:95%; padding:5px;" placeholder="YYYY-MM-DD" readonly></td>' +
'</tr>' +
'</table>' +
'<div style="margin-top:10px; color:#666; font-size:12px;">선택된 ' + targetObj.length + '건의 데이터에 마감정보를 입력합니다.</div>' +
'</div>',
showCancelButton: true,
confirmButtonColor: '#2196F3',
cancelButtonColor: '#666',
confirmButtonText: '저장',
cancelButtonText: '닫기',
onOpen: function() {
// 날짜 필드 datepicker 초기화
$('#swal_taxInvoiceDate').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true
});
$('#swal_loadingDate').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true
});
// 기존 데이터 세팅
if(taxType) $('#swal_taxType').val(taxType);
if(taxInvoiceDate) $('#swal_taxInvoiceDate').val(taxInvoiceDate);
if(exportDeclNo) $('#swal_exportDeclNo').val(exportDeclNo);
if(loadingDate) $('#swal_loadingDate').val(loadingDate);
},
preConfirm: function() {
return {
taxType: $('#swal_taxType').val(),
taxInvoiceDate: $('#swal_taxInvoiceDate').val(),
exportDeclNo: $('#swal_exportDeclNo').val(),
loadingDate: $('#swal_loadingDate').val()
};
}
}).then(function(result) {
if (result.isConfirmed) {
var formData = result.value;
$.ajax({
url: "/revenueMgmt/saveDeadlineInfo.do",
type: "POST",
data: {
"objIdList": objIdList.join(','),
"taxType": formData.taxType,
"taxInvoiceDate": formData.taxInvoiceDate,
"exportDeclNo": formData.exportDeclNo,
"loadingDate": formData.loadingDate
},
dataType: "json",
success: function(data){
Swal.fire({
title: data.msg || '처리되었습니다.',
icon: data.result ? 'success' : 'error'
}).then(function() {
if(data.result) fn_search();
});
},
error: function(jqxhr, status, error){
Swal.fire({
title: '마감정보 저장 중 오류가 발생했습니다.',
text: error || jqxhr.statusText || '서버 오류',
icon: 'error'
});
}
});
}
});
}
// 단건 선택 시 그리드 데이터에서 기존 마감정보 가져오기
if(loadExisting) {
var row = targetObj[0];
openDeadlineInfoPopup({
TAX_TYPE: fnc_checkNull(row.TAX_TYPE),
TAX_INVOICE_DATE: fnc_checkNull(row.TAX_INVOICE_DATE),
EXPORT_DECL_NO: fnc_checkNull(row.EXPORT_DECL_NO),
LOADING_DATE: fnc_checkNull(row.LOADING_DATE)
});
} else {
openDeadlineInfoPopup(null);
}
});
$("#btnDeadline").click(function(){
var targetObj = _tabulGrid.getSelectedData();
@@ -295,6 +431,14 @@ var columns = [
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : 'S/N', field : 'SERIAL_NO'},
// 20. 품번
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PRODUCT_NO'},
// 21. 과세구분
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '과세구분', field : 'TAX_TYPE_NAME'},
// 22. 세금계산서발행일
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '세금계산서발행일', field : 'TAX_INVOICE_DATE'},
// 23. 수출신고필증신고번호
{headerHozAlign : 'center', hozAlign : 'left', width : '140', title : '수출신고필증신고번호', field : 'EXPORT_DECL_NO'},
// 24. 선적일자
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '선적일자', field : 'LOADING_DATE'},
/* 주석처리된 컬럼 - 필요시 활성화 */
/*
@@ -467,6 +611,11 @@ function fn_FileRegist(objId, docType, docTypeName){
<form name="form1" id="form1" method="post">
<input type="hidden" name="actionType" id="actionType">
<input type="hidden" name="shippingDateRequired" value="Y"> <!-- 출하일 필수 조건 -->
<!-- 과세구분 코드 (SweetAlert에서 사용) -->
<select id="hiddenTaxTypeList" style="display:none;">
<option value="">선택</option>
${codeMap.taxTypeList}
</select>
<div class="min_part_enroll">
<div class="content-box">
<div class="content-box-s">
@@ -476,6 +625,7 @@ function fn_FileRegist(objId, docType, docTypeName){
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="마감정보입력" class="plm_btns" id="btnDeadlineInfo" style="background-color: #2196F3; color: white;">
<input type="button" value="매출마감" class="plm_btns" id="btnDeadline" style="background-color: #4CAF50; color: white;">
</div>
</div>