ERP-node/WebContent/WEB-INF/view/salesmgmt/contractMgmt/contractMgmtFormPopup.jsp

511 lines
18 KiB
Plaintext

<%
/**
* 계약관리 등록
* @since 2021.10.01
* @author kim
* @version 1.0
*
* << 개정 이력 >>
*
* 수정일 수정자 수정내용
* ---------------- --------------------- --------------------------------------------------------
* 2021.10.01 김효일 최초작성
**/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="java.util.*" %>
<%@ include file= "/init.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<link rel="stylesheet" href="/css/ions-basic.css">
<script type="text/javascript" src="/js/ions-common.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$('.select2').select2();
fnc_makeDatepick();
// 제품코드 검색
$("#btnGoodsSearch").click(function(){
window.open("/common/salesMgmt/searchGoods.do", "searchGoods", "width=1024, height=530", "menubars=no, scrollbars=yes, resizable=yes");
});
// 저장
$("#btnSave").click(function(){
fn_save();
});
// 삭제
$("#btnDelete").click(function(){
fn_delete();
});
// 닫기
$("#btnClose").click(function(){
self.close(0);
});
// 계약수량 입력
$("#goodsQty").keyup(function() {
// 계약금액, 부가세 계산
calcAmt();
});
// 계약단가 입력
$("#salePrice").keyup(function() {
// 계약금액, 부가세 계산
calcAmt();
});
});
// 계악관리 정보 등록
function fn_save(){
if(fnc_valitate("form1")){
var cancelFlag = $("#cancelFlag").val();
if (cancelFlag === "Y") {
if ($.trim($("#cancelBigo").val()) === "") {
Swal.fire("취소사유를 입력해 주세요.");
$("#cancelBiGo").focus();
return false;
}
}
if(confirm("등록 하시겠습니까?")){
saveProcess();
}
}
}
// 등록
function saveProcess(){
$.ajax({
url:"/contractMgmt/saveContractMgmt.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.RESULT.msg);
if (data.RESULT.result) {
opener.fn_search();
self.close();
}
},
error: function(jqxhr, status, error){
}
});
}
// 계약관리 정보 삭제
function fn_delete() {
if(confirm("삭제 하시겠습니까?")){
deleteProcess();
}
}
// 삭제
function deleteProcess(){
$.ajax({
url:"/contractMgmt/deleteContractMgmt.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.RESULT.msg);
if (data.RESULT.result) {
opener.fn_search();
self.close();
}
},
error: function(jqxhr, status, error){
}
});
}
// 고객 조회
function getCustomer(custCd) {
var param = "custCd=" + custCd;
$.ajax({
url:"/common/salesMgmt/customer.do",
type:"GET",
data:param,
dataType:"json",
success:function(data){
if (data.RESULT != "") {
var RESULT = data.RESULT;
$("#custBoss").val(RESULT.custboss);
$("#taxNo1").val(RESULT.taxno1);
$("#taxNo2").val(RESULT.taxno2);
$("#deptCd").val(RESULT.deptcd);
$("#deptNm").val(RESULT.deptnm);
$("#salesman").val(RESULT.salesman);
$("#salesmanNm").val(RESULT.salesman_nm);
}
},
error: function(jqxhr, status, error){
}
});
}
// 관리담당자 조회
function getBEmpList(deptCd) {
var param = "deptCd=" + deptCd;
$.ajax({
url:"/common/salesMgmt/bEmpList.do",
type:"GET",
data:param,
dataType:"json",
success:function(data){
var options = "<option value=''>선택</option>";
if (data.RESULT !="") {
options += data.RESULT;
}
$("#bEmpNo").html(options);
},
error: function(jqxhr, status, error){
}
});
}
//제품 선택
function goodsSelected(selectedItem) {
form1.goodsCd.value = selectedItem.goodsCd;
form1.goodsNm.value = selectedItem.goodsNm;
form1.goodsSpec.value = selectedItem.goodsSpec;
form1.cClassNm.value = selectedItem.cClassNm;
form1.goodsGuarantee.value = selectedItem.goodsGuarantee;
}
// 계약금액, 부가세 계산
function calcAmt() {
var goodsQty = $("#goodsQty").val(); // 계약수량 입력
var salePrice = $("#salePrice").val(); // 계약단가 입력
var saleAmt = Math.floor(goodsQty * salePrice); // 계약금액
var vatAmt = Math.floor(saleAmt * 0.1); // 부가세
$("#saleAmt").val(saleAmt);
$("#vatAmt").val(vatAmt);
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="orderNo" id="orderNo" value="${param.orderNo}">
<input type="hidden" name="orderSer" id="orderSer" value="${param.orderSer}">
<section>
<div class="plm_menu_name">
<h2>
<span>계약 등록</span>
</h2>
</div>
<div id="businessPopupFormWrap" >
<table class="pmsPopupForm">
<colgroup>
<col width="10%"/>
<col width="15%"/>
<col width="25%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
<col width="15%"/>
</colgroup>
<tr>
<td colspan="7" style="height:15px;"></td>
</tr>
<tr>
<td rowspan="5" class="sub_title">고객정보</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 고객</label></td>
<td colspan="5" class="input_sub_title">
<select name="custCd" id="custCd" onchange='getCustomer($(this).val())' required reqTitle="고객" type="select" style="width: 120px;" class="select2">
<option value="">선택</option>
<c:forEach var="customerList" items="${codeMap.customerList}">
${customerList}
</c:forEach>
</select>
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">대표자</label></td>
<td class="input_sub_title">
<input type="text" name="custBoss" id="custBoss" value="${info.CUSTBOSS}" disabled style="width:130px;" />
</td>
<td class="input_title" style="font-size:13px;"><label for="label">사업자번호</label></td>
<td class="input_sub_title">
<input type="text" name="taxNo1" id="taxNo1" value="${info.TAXNO1}" disabled style="width:130px;" />
</td>
<td class="input_sub_title"><label for="label">법인/주민번호</label></td>
<td class="input_sub_title">
<input type="text" name="taxNo2" id="taxNo2" value="${info.TAXNO2}" disabled style="width:130px;" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">계약부서</label></td>
<td class="input_sub_title">
<input type="text" name="deptNm" id="deptNm" value="${info.DEPTNM}" disabled style="width:130px;" />
<input type="hidden" name="deptCd" id="deptCd" value="${info.DEPTCD}" />
</td>
<td class="input_title" style="font-size:13px;"><label for="label">계약자</label></td>
<td colspan="3" class="input_sub_title">
<input type="text" name="salesmanNm" id="salesmanNm" value="${info.SALESMAN_NM}" disabled style="width:130px;" />
<input type="hidden" name="salesman" id="salesman" value="${info.SALESMAN}" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">* 관리부서</label></td>
<td class="input_sub_title">
<select name="bDeptCd" id="bDeptCd" onchange='getBEmpList($(this).val())' required reqTitle="관리부서" type="select" style="width: 120px;" class="select2">
<option value="">선택</option>
<c:forEach var="bDeptList" items="${codeMap.bDeptList}">
${bDeptList}
</c:forEach>
</select>
</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 관리담당자</label></td>
<td colspan="3" class="input_sub_title">
<select name="bEmpNo" id="bEmpNo" required reqTitle="관리담당자" type="select" style="width: 120px;" class="select2">
<option value="">선택</option>
<c:forEach var="bEmpList" items="${codeMap.bEmpList}">
${bEmpList}
</c:forEach>
</select>
</tr>
<tr>
<td colspan="8" style="height:15px;"></td>
</tr>
</table>
<br />
<br />
<table class="pmsPopupForm">
<colgroup>
<col width="10%"/>
<col width="10%"/>
<col width="*"/>
</colgroup>
<tr>
<td colspan="4" style="height:15px;"></td>
</tr>
<tr>
<td rowspan="4" class="sub_title">제품정보</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 제품코드</label></td>
<td colspan="2" class="input_sub_title">
<input type="text" name="goodsCd" id="goodsCd" value="${info.GOODSCD}" required reqTitle="제품" readonly style="width:130px;float:left;background-color:#efefef;" />
<span><input type="button" value="?" class="gray_btns" id="btnGoodsSearch"></span>
<input type="text" name="goodsNm" id="goodsNm" value="${info.GOODSNM}" required reqTitle="제품" disabled style="width:130px;" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">제품규격</label></td>
<td colspan="2" class="input_sub_title">
<input type="text" name="goodsSpec" id="goodsSpec" value="${info.GOODSSPEC}" disabled style="width:330px;" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">제품그룹</label></td>
<td colspan="2" class="input_sub_title">
<input type="text" name="cClassNm" id="cClassNm" value="${info.C_CLASSNM}" disabled style="width:330px;" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">보증기간</label></td>
<td colspan="2" class="input_sub_title">
<select name="goodsGuarantee" id="goodsGuarantee" type="select" style="width: 120px;">
<option value="">선택</option>
<option value="0" ${info.GOODSGUARANTEE eq '0' ? 'selected' : ''}>0</option>
<option value="6" ${info.GOODSGUARANTEE eq '6' ? 'selected' : ''}>6</option>
<option value="12" ${info.GOODSGUARANTEE eq '12' ? 'selected' : ''}>12</option>
<option value="18" ${info.GOODSGUARANTEE eq '18' ? 'selected' : ''}>18</option>
<option value="24" ${info.GOODSGUARANTEE eq '24' ? 'selected' : ''}>24</option>
<option value="27" ${info.GOODSGUARANTEE eq '27' ? 'selected' : ''}>27</option>
<option value="36" ${info.GOODSGUARANTEE eq '36' ? 'selected' : ''}>36</option>
<option value="48" ${info.GOODSGUARANTEE eq '48' ? 'selected' : ''}>48</option>
</select>
</td>
</tr>
<tr>
<td colspan="4" style="height:15px;"></td>
</tr>
</table>
<br />
<br />
<table class="pmsPopupForm">
<colgroup>
<col width="10%"/>
<col width="15%"/>
<col width="25%"/>
<col width="25%"/>
<col width="25%"/>
</colgroup>
<tr>
<td colspan="5" style="height:15px;"></td>
</tr>
<tr>
<td rowspan="6" class="sub_title">기본정보</td>
<c:if test="${param.actionType ne 'regist'}">
<td class="input_title" style="font-size:13px;"><label for="label">계약번호</label></td>
<td colspan="3" class="input_sub_title">
<input type="text" name="displayOrderNo" id="displayOrderNo" value="${info.ORDERNO}" disabled style="width:200px;" />
</td>
</c:if>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">* 사업부</label></td>
<td class="input_sub_title">
<select name="acntUnit" id="acntUnit" required reqTitle="사업부" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<option value="1" ${info.ACNTUNIT eq '1' ? 'selected':''}>크레인</option>
<option value="2" ${info.ACNTUNIT eq '2' ? 'selected':''}>특장</option>
<option value="7" ${info.ACNTUNIT eq '7' ? 'selected':''}>전략</option>
<option value="D" ${info.ACNTUNIT eq 'D' ? 'selected':''}>개발</option>
</select>
</td>
<td class="input_title"><label for="label">시장구분</label></td>
<td class="input_sub_title">
<select name="orderUnit" id="orderUnit" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<c:forEach var="orderUnitList" items="${codeMap.orderUnitList}">
${orderUnitList}
</c:forEach>
</select>
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">* 계약일자</label></td>
<td class="input_sub_title">
<input type="text" id="orderDate" name="orderDate" required reqTitle="계약일자" value="${info.ORDERDATE}" class="date_icon" style="width: 100px !important;background-color:#fff;" autocomplete="off" />
</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 최종납기일</label></td>
<td class="input_sub_title">
<input type="text" id="finishDate" name="finishDate" required reqTitle="최종납기일" value="${info.FINISHDATE}" class="date_icon" style="width: 100px !important;background-color:#fff;" autocomplete="off" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">판매구분</label></td>
<td width="21%" class="input_sub_title">
<select name="saleGB" id="saleGB" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<option value="0" ${info.SALEGB eq '0' ? 'selected':''}>일반</option>
<option value="1" ${info.SALEGB eq '1' ? 'selected':''}>대리점</option>
</select>
</td>
<td width="13%" class="input_title" style="font-size:13px;"><label for="label">판매유형</label></td>
<td width="48%" class="input_sub_title">
<select name="saleType" id="saleType" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<c:forEach var="saleTypeList" items="${codeMap.saleTypeList}">
${saleTypeList}
</c:forEach>
</select>
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">출하대상</label></td>
<td class="input_sub_title">
<select name="chulhaYN" id="chulhaYN" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<option value="0" ${info.CHULHAYN eq '0' ? 'selected':''}>무</option>
<option value="1" ${info.CHULHAYN eq '1' ? 'selected':''}>유</option>
</select>
</td>
<td class="input_title" style="font-size:13px;"><label for="label">제품구분</label></td>
<td class="input_sub_title">
<select name="goodsYN" id="goodsYN" type="select" style="width:150px;" class="select2">
<option value="">선택</option>
<option value="0" ${info.GOODSYN eq '0' ? 'selected':''}>제품</option>
<option value="1" ${info.GOODSYN eq '1' ? 'selected':''}>부품</option>
</select>
</td>
</tr>
<tr>
<td class="input_title"><label for="label">비고</label></td>
<td colspan="3" class="input_sub_title">
<textarea name="biGo" id="biGo" style="width:80%;height:50px;">${info.BIGO}</textarea>
</td>
</tr>
<tr>
<td colspan="5" style="height:15px;"></td>
</tr>
</table>
<br />
<br />
<table class="pmsPopupForm">
<colgroup>
<col width="15%"/>
<col width="10%"/>
<col width="15%"/>
<col width="10%"/>
<col width="15%"/>
<col width="10%"/>
<col width="25%"/>
</colgroup>
<tr>
<td colspan="7" style="height:15px;"></td>
</tr>
<tr>
<td ${param.actionType ne 'regist' ? 'rowspan=3' : 'rowspan=2'} class="sub_title">계약정보</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 계약수량</label></td>
<td class="input_sub_title">
<input type="text" name="goodsQty" id="goodsQty" required reqTitle="계약수량" value="${info.GOODSQTY}" maxlength="9" style="width:50px;" />
</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 계약단가</label></td>
<td colspan="4" class="input_sub_title">
<input type="text" name="salePrice" id="salePrice" required reqTitle="계약단가" value="${info.SALEPRICE}" maxlength="9" style="width:130px;" />
</td>
</tr>
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">* 계약금액</label></td>
<td class="input_sub_title">
<input type="text" name="saleAmt" id="saleAmt" required reqTitle="계약금액" value="${info.SALEAMT}" maxlength="9" style="width:130px;" />
</td>
<td class="input_title" style="font-size:13px;"><label for="label">* 부가세</label></td>
<td colspan="4" class="input_sub_title">
<input type="text" name="vatAmt" id="vatAmt" required reqTitle="부가세" value="${info.VATAMT}" maxlength="9" style="width:130px;" />
</td>
</tr>
<c:if test="${param.actionType ne 'regist'}">
<tr>
<td class="input_title" style="font-size:13px;"><label for="label">취소여부</label></td>
<td class="input_sub_title">
<select name="cancelFlag" id="cancelFlag" type="select" style="width:150px;" class="select2">
<option value="Y" ${info.CANCELFLAG eq 'Y' ? 'selected':''}>Y</option>
<option value="N" ${info.CANCELFLAG eq 'N' ? 'selected':''}>N</option>
</select>
</td>
<td class="input_title" style="font-size:13px;"><label for="label">취소사유</label></td>
<td colspan="7" class="input_sub_title">
<textarea style="width:90%;height:50px;" name="cancelBigo" id="cancelBigo">${info.CANCELBIGO}</textarea>
</td>
</tr>
</c:if>
<tr>
<td colspan="7" style="height:15px;"></td>
</tr>
</table>
<br />
<br />
</div>
<div class="btn_wrap">
<div class="plm_btn_wrap_center">
<c:if test="${(param.actionType ne 'view' and info.REG_USER_ID eq connectUserId) or 'regist' eq param.actionType or 'plm_admin' eq connectUserId}">
<input type="button" value="저장" id="btnSave" class="plm_btns">
</c:if>
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</section>
</form>
</body>
</html>