ERP-node/WebContent/WEB-INF/view/materMgmt/materSupWriteFormPopup.jsp

311 lines
12 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*"%>
<%@include file="/init_jqGrid.jsp"%>
<!DOCTYPE html>
<html>
<head>
<!-- //JSTL 페이징 변수선언 -->
<c:set var="now" value="<%=new java.util.Date() %>" />
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<c:set var="fileDocType" value="MATER_MASTER" />
<c:set var="fileDocTypeName" value="발주등록" />
<script type="text/javascript">
var grid;
$(document).ready(function(){
$("#btnsearch").click(function(){
$("#process_cd").val($("#process1_cd option:selected").text());
gridFn.search();
});
$("#btnSave").click(function(){
fn_save();
});
$(".select2").select2();
fnc_datepick(); //달력
var gridsupply_cd = $.parseJSON($("#gridsupply_cd").val()); //jqGrid 계정과목
grid = $("#expenseDetailGrid").jqGrid({
url: ""
,datatype: "local"
,colNames: ["OBJID","PROJECT_ID","마스터OBJID","품명","품번","규격(재질)","제조사","수량","후처리","부품구분","공급업체","Rev","Date"]
,colModel: [
{name:"PART_MGMT_OBJID",index:"PART_MGMT_OBJID", width: 0, align:"center", hidden: true, sortable:false, editable:true}
,{name:"PROJECT_MGMT_OBJID",index:"PROJECT_MGMT_OBJID", width: 0, align:"center", hidden: true, sortable:false, editable:true}
,{name:"MATERIAL_MASTER_OBJID",index:"MATERIAL_MASTER_OBJID", width: 0, align:"center", hidden: true, sortable:false, editable:false}
/* ,{name:"PART_LEVEL",index:"PART_LEVEL", width: 30, align:"center", hidden: false, sortable:false, editable:false} */
,{name:"PART_NAME",index:"PART_NAME", width: 300, align:"left", hidden: false, sortable:false, editable:false}
,{name:"PART_NO",index:"PART_NO", width: 280, align:"left", hidden: false, sortable:false, editable:false}
,{name:"SPEC_CD",index:"SPEC_CD", width: 150, align:"left", hidden: false, sortable:false, editable:false}
,{name:"MFA_CD",index:"MFA_CD", width: 90, align:"center", hidden: false, sortable:false, editable:false}
,{name:"QTY",index:"QTY", width: 90, align:"center", hidden: false, sortable:false, editable:false}
,{name:"PROCESS_NAME",index:"PROCESS_NAME", width: 90, align:"center", hidden: false, sortable:false, editable:false}
,{name:"SORT_NAME",index:"SORT_NAME", width: 90, align:"center", hidden: false, sortable:false, editable:false}
,{name:"SUP_CD" ,index:"SUP_CD" , width:150, align:"center", hidden:false, sortable:false, editable: true
,edittype :"select"
,formatter :"select"
,editoptions:{
value: gridsupply_cd
,dataInit: function(e){
e.style.width = "92%";
e.style.fontSize = 13;
}
}
}
,{name:"REV",index:"REV", width: 90, align:"center", hidden: false, sortable:false, editable:false}
,{name:"REL_DATE",index:"REL_DATE", width: 90, align:"center", hidden: false, sortable:false, editable:false}
]
,rownumbers : true
,viewrecords : true
,height : 550
,multiselect : false
,shrinkToFit : false
,autowidth : true
,sortable : false
,rowNum : 10000
,forceFit : false //컬럼의 width를 변화시킬때 그리드의 width를 고정 여부
,jsonReader : {repeatitems: false}
,mtype :"POST"
,footerrow : false //바닥합계
,userDataOnFooter: true //바닥합계
,loadComplete: function(){
//footer 커스텀..
/* $(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(1)").remove();
$(".ui-jqgrid-ftable td:eq(0)").attr({"colspan":"7", "rowspan":"2"});
$(".ui-jqgrid-ftable td:eq(0)").css({"width":""});
$(".ui-jqgrid-ftable td:eq(1)").attr({id:"summuryTotalCARD_USED"});
$(".ui-jqgrid-ftable td:eq(2)").attr({id:"summuryTotalCASH_USED"});
$(".ui-jqgrid-ftable td:eq(3)").attr({id:"summuryTotalPAYMENT" });
$(".ui-jqgrid-ftable tbody").append("<tr class=\"ui-widget-content footrow footrow-ltr\"><td colspan=\"3\" id=\"summuryTotal\" style=\"text-align:right\"></td></tr>");
$("#expenseDetailGrid").jqGrid("footerData", "set", { "rn":"정 산 지 급 액(원)", "CARD_USED": "", "CASH_USED": "", "PAYMENT": "" });
*/ }
});
//
});
function setDefault(){
var date = new Date();
var _yyyy = date.getFullYear();
var _mm = (date.getMonth() <10?"0":"") + (date.getMonth()+1);
var _dd = (date.getDate() <10?"0":"") + date.getDate();
var now_date = _yyyy+"-"+_mm+"-"+_dd;
if($("#bnsStartDate").val()==""){
$("#bnsStartDate").val(now_date);
}
if($("#bnsEndDate").val()==""){
$("#bnsEndDate").val(now_date);
}
if($("#regDate").val()==""){
$("#regDate").val(now_date);
}
}
var gridFn = {
opennEdit : function() { //수정가능
var ids = grid.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
grid.jqGrid("editRow",ids[i]);
}
}
,closeEdit : function() { //수정불가
var ids = grid.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
grid.jqGrid("saveRow", ids[i], /*successFunction*/null, /*url*/"clientArray"/*, extraparam, aftersavefunc,errorfunc, afterrestorefunc*/);
}
}
,search : function() {
grid.setGridParam({
url: "/materMgmt/searchPartSupMgmt.do"
,datatype : "json"
,postData : $("#form1").serialize()
,loadComplete : function(data) {
gridFn.footerSummary();
}
,gridComplete : function() {
gridFn.opennEdit(); //수정가능
}
}).trigger("reloadGrid");
grid.setGridParam({url: "", datatype : "local"});
}
,footerSummary: function(){ //자동합계
$("select[id*=_SUP_CD]").each(function(){
$(this).select2();
} );
}
}
function fn_save(){
if(fnc_valitate("form1")){
if(""==grid.getRowData()){
Swal.fire('저장할 품목이 존재 하지 않습니다');
return;
}
if(confirm("저장 하시겠습니까?")){
//return;
/* Swal.fire($("#form1").serialize());
return; */
gridFn.closeEdit();
$.ajax({
url:"/materMgmt/materMgmtSupSave.do"
,type:"POST"
,data: $("#form1").serialize() + "&jqGrid="+ encodeURIComponent(JSON.stringify(grid.getRowData()))
,dataType:"json"
,success:function(data){
if(data =="SUCCESS"){
Swal.fire("저장되었습니다.");
self.close();
};
//if(typeof opener.fn_search =="function"){ opener.fn_search() };
//self.close();
}
,error: function(jqxhr, status, error){
}
});
}
}
}
</script>
</head>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="process_cd" id="process_cd">
<section>
<div class="plm_menu_name">
<h2><span>발주관리_업체등록</span></h2>
</div>
<div id="expenseApplyPopupFormWrap1" style="margin:8px">
<table class="pmsPopupForm">
<colgroup>
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
<col width="7%" />
<col width="6%" />
<col width="6%" />
<col width="6%" />
</colgroup>
<tr>
<td class="input_title"><label for="projectno">프로젝트 No.</label></td>
<td class="input_sub_title">
<select name="projectno" id="projectno" reqTitle="Project No" type="select" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.projectno}
</select>
</td>
<td class="input_title"><label for="sort_cd">부품구분 </label></td>
<td>
<select name="sort_cd" id="sort_cd" reqTitle="부품구분" type="select" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.sort_cd}
</select>
</td>
<td class="input_title"><label for="partNo">품번</label></td>
<td class="input_sub_title">
<input type="text" name="part_no" id="part_no" />
</td>
<%-- <td class="input_title"><label for="sort_cd">부품구분</label></td>
<td class="input_sub_title">
<select name="sort_cd" id="sort_cd" type="select" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.sort_cd}
</select>
</td> --%>
<td class="input_title"><label for="sup_cd">업체명</label></td>
<td class="input_sub_title">
<select name="sup_cd" id="sup_cd" reqTitle="업체명" type="select" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.supply_cd}
</select>
</td>
<td class="input_title"><label for="sup_cd">기등록된 공급업체</label></td>
<td class="input_sub_title">
<select name="sup_gubun" id="sup_gubun" reqTitle="기등록된 공급업체" type="select" class="select2" autocomplete="off">
<option value="">미제외</option>
<option value="1">제외</option>
</select>
</td>
<%-- <td class="input_title"><label for="search_fromDate">Date</label></td>
<td colspan="2">
<input type="text" id="search_fromDate" name="search_fromDate" class="date_icon" value="${param.search_fromDate}" style="width:130px !important;" autocomplete="off">
~ <input type="text" id="search_toDate" name="search_toDate" class="date_icon" value="${param.search_toDate}" style="width:130px !important;" autocomplete="off">
</td> --%>
</tr>
<tr>
<td colspan="11" align="right" style="padding:3px">
<input type="button" value="조회" class="plm_btns" id="btnsearch" name="btnsearch" style="background:#dfeffc;display:inline-block;float:none">
<input type="button" value="저장" class="plm_btns" id="btnSave" name="btnSave" style="background:#dfeffc;display:inline-block;float:none">
<input type="button" value="닫기" class="plm_btns" style="background:#dfeffc;display:inline-block;float:none" onclick="window.close();" >
</td>
</tr>
</table>
</div>
<div id="plm_table_wrap1" style="padding:0 8 0 8;">
<div style="">
<div style="height:450px;">
<table id="expenseDetailGrid""></table>
<!-- <div id="jqGridPager"></div> -->
</div>
</div>
</div>
<!-- <div class="btn_wrap">
<div class="plm_btn_wrap" style="padding:20 8 0 8; text-align: right;">
<input type="button" value="행추가" class="plm_btns" id="btnAdd" name="btnAdd" style="background: #dfeffc">
<input type="button" value="행삭제" class="plm_btns" id="btnDel" name="btnDel" style="background: #dfeffc">
</div>
</div> -->
<!-- <div style="padding:10 8 0 8; font-weight: 500; font-size: 12px;">
※ 작성요령<br/>
1) 식대는 끼니수(몇식)<br/>
2) 숙박은 몇인/몇박<br/>
3) 차량거리(Km), 이용차량(법인/자차, 자차(가솔린/경유/전기차/하이브리드)) 구분
</div> -->
</section>
<input type="hidden" name="material_master_objid" id="material_master_objid" value="${objId}"><%-- MATERIAL_MASTER_OBJID --%>
<%-- <textarea style="width:0px; height:0px; visibility: hidden;" id="gridExpSortCd">${code_map.gridExpSortCd}</textarea>
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridExpSubmCd">${code_map.gridExpSubmCd}</textarea><!-- 코드동적설정 -->
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridExpSubdCd">${code_map.gridExpSubdCd}</textarea><!-- 코드동적설정 --> --%>
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridsupply_cd">${code_map.gridsupply_cd}</textarea>
</form>
</body>
</html>