ERP-node/WebContent/WEB-INF/view/usedMng/usedMngFormPopUp.jsp

602 lines
19 KiB
Plaintext

<%@ 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" %>
<%
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
String userId = CommonUtils.checkNull(person.getUserId());
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<script>
$(document).ready(function(){
$("#btnClose").click(function(){
self.close(0);
});
$("#btnSave").click(function(){
fn_save();
});
$("#REPAIR_AMOUNT").keyup(function(){
var targetVal = Number(fnc_checkNullDefaultValue(this.value,0));
var salesAmount = Number(fnc_checkNullDefaultValue($("#SALES_AMOUNT").val(),0));
$("#INPUT_AMOUNT").val(targetVal+salesAmount);
});
$("#SALES_AMOUNT").keyup(function(){
var targetVal = Number(fnc_checkNullDefaultValue(this.value,0));
var repairAmount = Number(fnc_checkNullDefaultValue($("#REPAIR_AMOUNT").val(),0));
$("#INPUT_AMOUNT").val(targetVal+repairAmount);
});
fnc_datepick();
fn_getApprovalLine();
fnc_getCodeListAppend("<%=Constants.DIVISION_CD%>","DIVISION","${resultMap.DIVISION}");
fn_getCodeListAppend("<%=Constants.USED_MNG_STATUS_CD%>","STATUS","${resultMap.STATUS}");
fnc_getCodeListAppend("<%=Constants.INVENTORY_LOCATION_CD%>","LOCATION","${resultMap.LOCATION}");
fn_getProjectNoList("SALES_TARGET","${resultMap.SALES_TARGET}");
$("#INPUT_AMOUNT").val(Number(fnc_checkNullDefaultValue("${resultMap.REPAIR_AMOUNT}",0))+Number(fnc_checkNullDefaultValue("${resultMap.SALES_AMOUNT}",0)));
$("#USE_YN").val("${resultMap.USE_YN}");
});
</script>
<script>
//codeId를 부모로 사용하는 코드의 정보목록을 가져온다.
function fn_getCodeListAppend(codeId,selectboxId,selectedVal){
var resultList = fnc_getCodeList(codeId);
if(0 < resultList.length){
$("#"+selectboxId).empty();
$("#"+selectboxId).append("<option value=''>선택</option>");
for (var i = 0; i < resultList.length; i++) {
var commonCodeId = resultList[i].CODE_ID;
var commonCodeName = resultList[i].CODE_NAME;
var appendText = "";
if(commonCodeName == "결재중" || commonCodeName == "반려" || commonCodeName == "결재완료"){
appendText = "disabled";
}
$("#"+selectboxId).append("<option value='"+commonCodeId+"' "+appendText+">"+commonCodeName+"</option>");
}
$("#"+selectboxId).val(selectedVal);
}
}
function fn_getProjectNoList(selectboxId,selectedVal){
$.ajax({
url:"/common/getProjectNoList.do",
type:"POST",
data:{},
dataType:"json",
async:false,
success:function(data){
var resultList = data;
if(0 < resultList.length){
$("#"+selectboxId).empty();
$("#"+selectboxId).append("<option value=''>선택</option>");
for (var i = 0; i < resultList.length; i++) {
var projectNoObjId = resultList[i].ORDER_MGMT_OBJID;
var projectNo = resultList[i].PROJECT_NO;
$("#"+selectboxId).append("<option value='"+projectNoObjId+"'>"+projectNo+"</option>");
}
$("#"+selectboxId).val(selectedVal);
}
},
error: function(jqxhr, status, error){
}
});
}
function openUsedMngFilePopup(objId,title,docType){
var hiddenForm = document.hiddenForm;
var url = "/usedMng/usedMngFilePopUp.do";
var popUpSize = "width=600, height=250";
if(docType == "USED_MNG_IMAGE"){
url = "/usedMng/usedMngImageFilePopUp.do";
popUpSize = "width=600, height=520";
}
var target = "usedMngFilePopUp";
window.open(url,target,popUpSize+", menubars=no, scrollbars=yes, resizable=yes");
hiddenForm.action = url;
hiddenForm.DOC_TYPE.value = docType;
hiddenForm.TITLE.value = title;
hiddenForm.OBJID.value = objId;
hiddenForm.target = target;
hiddenForm.submit();
}
//해당 금형관리의 결재정보를 가져온다.
function fn_getApprovalLine(){
var scheduleList = new Array();
<c:forEach items="${approvalList}" var="approvalItem">
var seq = "${approvalItem.SEQ}";
var targetUserName = "${approvalItem.TARGET_USER_NAME}";
var procDate = "${approvalItem.PROC_DATE}";
if(1 == seq){
$("#reviewerName").append(targetUserName);
$("#reviewerDate").append(procDate);
}
if(2 == seq){
$("#confirmName").append(targetUserName);
$("#confirmDate").append(procDate);
}
</c:forEach>
}
function fn_save(){
if(fnc_valitate("form1")){
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/usedMng/saveUsedMng.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.message);
opener.fn_search();
self.close();
},
error: function(jqxhr, status, error){
}
});
}
}
}
function fn_getUsedMngFormPopUpFileInfo(){
$.ajax({
url:"/usedMng/getUsedMngFormPopUpFileInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
var resultMap = data;
var imgCnt = resultMap.USED_MNG_IMAGE_CNT;
var fileCnt = resultMap.USED_MNG_REPAIR_CNT;
if(0 < imgCnt){
$("#USED_MNG_IMAGE").text("■");
}else{
$("#USED_MNG_IMAGE").text("□");
}
if(0 < fileCnt){
$("#USED_MNG_REPAIR").text("■");
}else{
$("#USED_MNG_REPAIR").text("□");
}
},
error: function(jqxhr, status, error){
}
});
}
</script>
<style>
.input_title {border-left:1px solid #ccc;}
.input_sub_title {border-left:1px solid #ccc;}
.pmsPopupForm tr:last-child td{border-bottom:1px solid #ccc;}
</style>
<body>
<form name="hiddenForm" id="hiddenForm" method="post">
<input type="hidden" name="OBJID" id="OBJID">
<input type="hidden" name="TITLE" id="TITLE">
<input type="hidden" name="DOC_TYPE" id="DOC_TYPE">
<input type="hidden" name="actionType" id="actionType">
<input type="hidden" name="division" id="division">
<input type="hidden" name="status" id="status">
</form>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="OBJID" id="OBJID" value="${resultMap.OBJID}">
<input type="hidden" name="actionType" id="actionType" value="${param.actionType}">
<section>
<div class="plm_menu_name" style="display:flex;">
<h2 style="width:50%;text-align:center;margin-top:15px;">
<span style="font-size:30px;">중고장비매입</span>
</h2>
<table class="pmsPopupForm" style="width:50%;background:white;">
<colgroup>
<col width="20%">
<col width="20%">
<col width="20%">
<col width="20%">
</colgroup>
<tr style="border-spacing: 0;border-bottom:1px solid #ccc;border-left:1px solid #ccc;">
<td class="input_title" rowspan="3" style="text-align:center;">
<label>결재</label>
</td>
<td class="input_title" style="text-align:center;">
<label>작성자</label>
</td>
<td class="input_title" style="text-align:center;">
<label>검토</label>
</td>
<td class="input_title" style="text-align:center;">
<label>승인</label>
</td>
</tr>
<tr style="border-spacing: 0;border-bottom:1px solid #ccc;">
<td class="input_sub_title" style="text-align:center;">
${resultMap.WRITER_TITLE}<!-- 작성자이름 -->
</td>
<td class="input_sub_title" style="text-align:center;" id="reviewerName"></td>
<td class="input_sub_title" style="text-align:center;" id="confirmName"></td>
</tr>
<tr style="border-spacing: 0;border-bottom:1px solid #ccc;border-left:1px solid #ccc;">
<td class="input_sub_title" style="text-align:center;">
${resultMap.REGDATE_TITLE}<!-- 작성일자 -->
</td>
<td class="input_sub_title" style="text-align:center;" id="reviewerDate"></td>
<td class="input_sub_title" style="text-align:center;" id="confirmDate"></td>
</tr>
</table>
</div>
<div id="businessPopupFormWrap">
<!-- <div class="form_popup_title">&nbsp;&nbsp;&nbsp;영업활동 등록</div> -->
<table class="pmsPopupForm">
<colgroup>
<col width="10.5%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="*%">
</colgroup>
<tr>
<td class="input_sub_title" rowspan="4">매입정보</td>
<td class="input_title">
<label for="">장비번호</label>
</td>
<td class="input_sub_title" colspan="5">
<input type="hidden" name="EQUIPMENT_NUMBER" id="EQUIPMENT_NUMBER" value="${resultMap.EQUIPMENT_NUMBER}">
<input type="text" value="${resultMap.EQUIPMENT_NUMBER}" placeholder="${null eq resultMap.EQUIPMENT_NUMBER ? '저장 시 자동체번됩니다.':''}" disabled>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">구분</label>
</td>
<td class="input_sub_title">
<select name="DIVISION" id="DIVISION">
<c:choose>
<c:when test="${empty divisionList}">
<option value="">선택</option>
</c:when>
<c:otherwise>
<option value="">선택</option>
<c:forEach var="item" items="${divisionList}" varStatus="varStatus">
<option value="${item.CODE_ID}">${item.CODE_NAME}</option>
</c:forEach>
</c:otherwise>
</c:choose>
</select>
</td>
<td class="input_title">
<label for="">매입처</label>
</td>
<td class="input_sub_title">
<input type="text" name="BUYER" id="BUYER" value="${resultMap.BUYER}">
</td>
<td class="input_title">
<label for="">이미지</label>
</td>
<td class="input_sub_title" style="text-align:center;">
<a href="#" onclick="openUsedMngFilePopup('${resultMap.OBJID}','중고관리 이미지','USED_MNG_IMAGE');" id="USED_MNG_IMAGE">${0 < resultMap.USED_MNG_IMAGE_CNT ? '■':'□'}</a>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">매입금액</label>
</td>
<td class="input_sub_title">
<input type="number" name="PURCHASE_AMOUNT" id="PURCHASE_AMOUNT" value="${resultMap.PURCHASE_AMOUNT}">
</td>
<td class="input_title">
<label for="">매입일</label>
</td>
<td class="input_sub_title">
<input type="text" name="PURCHASE_DATE" id="purchase_date" value="${resultMap.PURCHASE_DATE_TITLE}">
</td>
<td class="input_title">
<label for="">Location</label>
</td>
<td class="input_sub_title">
<select name="LOCATION" id="LOCATION">
<option>선택</option>
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">특이사항</label>
</td>
<td class="input_sub_title" colspan="5">
<textarea id="UNIQUENESS" name="UNIQUENESS" style="width:99.9%;resize:none;height:100%;" placeholder="특이사항을 입력하세요.">${resultMap.UNIQUENESS}</textarea>
</td>
</tr>
</table>
<table class="pmsPopupForm" style="margin-top:10px;height:200px;">
<colgroup>
<col width="10.5%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="*%">
</colgroup>
<tr>
<td class="input_sub_title" rowspan="7">장비상세</td>
<td class="input_title">
<label for="">중량</label>
</td>
<td class="input_sub_title">
<input type="text" id="WEIGHT" name="WEIGHT" value="${resultMap.WEIGHT}">
</td>
<td class="input_title">
<label for="">SPAN</label>
</td>
<td class="input_sub_title">
<input type="text" name="SPAN" id="SPAN" value="${resultMap.SPAN}">
</td>
<td class="input_title">
<label for="">길이</label>
</td>
<td class="input_sub_title">
<input type="text" name="LENGTH" id="LENGTH" value="${resultMap.LENGTH}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">양정</label>
</td>
<td class="input_sub_title">
<input type="text" name="HEAD" id="HEAD" value="${resultMap.HEAD}"></select>
</td>
<td class="input_title">
<label for="">목높이</label>
</td>
<td class="input_sub_title">
<input type="text" name="NECK_HEIGHT" id="NECK_HEIGHT" value="${resultMap.NECK_HEIGHT}">
</td>
<td class="input_title">
<label for="">휠베이스</label>
</td>
<td class="input_sub_title">
<input type="text" name="WHEEL_BASE" id="WHEEL_BASE" value="${resultMap.WHEEL_BASE}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">권상</label>
</td>
<td class="input_sub_title">
<input type="text" name="WINDING" id="WINDING" value="${resultMap.WINDING}">
</td>
<td class="input_title">
<label for="">RAIL</label>
</td>
<td class="input_sub_title">
<input type="text" name="RAIL" id="RAIL" value="${resultMap.RAIL}">
</td>
<td class="input_title">
<label for="">휠사이즈</label>
</td>
<td class="input_sub_title">
<input type="text" name="WHEEL_SIZE" id="WHEEL_SIZE" value="${resultMap.WHEEL_SIZE}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">횡행</label>
</td>
<td class="input_sub_title">
<input type="text" name="TRANSVERSE" id="TRANSVERSE" value="${resultMap.TRANSVERSE}">
</td>
<td class="input_title">
<label for="">베이스철판</label>
</td>
<td class="input_sub_title">
<input type="text" name="BASE_PLATE" id="BASE_PLATE" value="${resultMap.BASE_PLATE}">
</td>
<td class="input_title">
<label for="">피니언기어</label>
</td>
<td class="input_sub_title">
<input type="text" name="PINION_GEAR" id="PINION_GEAR" value="${resultMap.PINION_GEAR}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">전기</label>
</td>
<td class="input_sub_title">
<input type="text" name="ELECTRIC" id="ELECTRIC" value="${resultMap.ELECTRIC}">
</td>
<td class="input_title">
<label for=""></label>
</td>
<td class="input_sub_title"></td>
<td class="input_title">
<label for="">프레임</label>
</td>
<td class="input_sub_title">
<input type="text" name="FRAME" id="FRAME" value="${resultMap.FRAME}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">상하판</label>
</td>
<td class="input_sub_title">
<input type="text" name="UPPER_LOWER_PLATE" id="UPPER_LOWER_PLATE" value="${resultMap.UPPER_LOWER_PLATE}">
</td>
<td class="input_title">
<label for=""></label>
</td>
<td class="input_sub_title"></td>
<td class="input_title">
<label for="">내폭</label>
</td>
<td class="input_sub_title">
<input type="text" name="INNER_WIDTH" id="INNER_WIDTH" value="${resultMap.INNER_WIDTH}">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">측면판</label>
</td>
<td class="input_sub_title">
<input type="text" name="SIDE_PLATE" id="SIDE_PLATE" value="${resultMap.SIDE_PLATE}">
</td>
<td class="input_title">
<label for=""></label>
</td>
<td class="input_sub_title"></td>
<td class="input_title">
<label for="">외폭</label>
</td>
<td class="input_sub_title">
<input type="text" name="OUTER_WIDTH" id="OUTER_WIDTH" value="${resultMap.OUTER_WIDTH}">
</td>
</tr>
</table>
<table class="pmsPopupForm" style="margin-top:10px;">
<colgroup>
<col width="10.5%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="*%">
</colgroup>
<tr>
<td class="input_sub_title">수리정보</td>
<td class="input_title">
<label for="">수리내역</label>
</td>
<td class="input_sub_title" style="text-align:center;">
<a href="#" onclick="openUsedMngFilePopup('${resultMap.OBJID}','중고관리 수리내역','USED_MNG_REPAIR');" id="USED_MNG_REPAIR">${0 < resultMap.USED_MNG_REPAIR_CNT ? '■':'□'}</a>
</td>
<td class="input_title">
<label for="">수리금액</label>
</td>
<td class="input_sub_title">
<input type="number" name="REPAIR_AMOUNT" id="REPAIR_AMOUNT" value="${resultMap.REPAIR_AMOUNT}">
</td>
<td class="input_title">
<label for="">사용유무</label>
</td>
<td class="input_sub_title">
<select name="USE_YN" id="USE_YN">
<option value="">선택</option>
<option value="Y">Y</option>
<option value="N">N</option>
</select>
</td>
</tr>
</table>
<table class="pmsPopupForm" style="margin-top:10px;">
<colgroup>
<col width="10.5%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="*%">
</colgroup>
<tr>
<td class="input_sub_title">판매정보</td>
<td class="input_title">
<label for="">판매대상</label>
</td>
<td class="input_sub_title">
<select name="SALES_TARGET" id="SALES_TARGET"></select>
</td>
<td class="input_title">
<label for="">판매금액</label>
</td>
<td class="input_sub_title">
<input type="number" name="SALES_AMOUNT" id="SALES_AMOUNT" value="${resultMap.SALES_AMOUNT}">
</td>
<td class="input_title">
<label for="">투입금액</label>
</td>
<td class="input_sub_title">
<input type="text" name="INPUT_AMOUNT" id="INPUT_AMOUNT">
</td>
</tr>
</table>
<table class="pmsPopupForm" style="margin-top:10px;">
<colgroup>
<col width="10.5%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="20%">
<col width="10.5%">
<col width="*%">
</colgroup>
<tr>
<td class="input_title" style="border:none;">
<label for="">상태</label>
</td>
<td class="input_sub_title" colspan="6">
<select name="STATUS" id="STATUS"></select>
</td>
</tr>
</table>
</div>
<div class="btn_wrap">
<div class="plm_btn_wrap_center">
<c:choose>
<c:when test="${resultMap.WRITER eq connectUserId or param.actionType eq 'regist' or 'plm_admin' eq connectUserId}">
<input type="button" value="저장" id="btnSave" class="plm_btns create">
</c:when>
<c:otherwise></c:otherwise>
</c:choose>
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</section>
</form>
</body>
</html>