540 lines
18 KiB
Plaintext
540 lines
18 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(){
|
|
|
|
var gridrecv_userid = $.parseJSON($("#gridrecv_userid").val()); //jqGrid 계정과목
|
|
|
|
$("#btnSearch").click(function(){
|
|
gridFn.modify_search();
|
|
});
|
|
|
|
|
|
$("#btnSave").click(function(){
|
|
fn_save();
|
|
});
|
|
|
|
$("#btnDel").click(function(){
|
|
gridFn.delRow();
|
|
});
|
|
|
|
|
|
$("#sup_cd").change(function(){
|
|
fn_change_sup_cd(this.value);
|
|
});
|
|
|
|
|
|
|
|
$("#btnAppr").click(function(){
|
|
var objId = "${objId}";
|
|
if(""==grid.getRowData()){
|
|
Swal.fire('저장할 품목이 존재 하지 않습니다');
|
|
return;
|
|
}
|
|
|
|
var title = $("#title").val();
|
|
|
|
window.open("/approval/registApproval.do?targetType=MATERIAL_APPLY&targetObjId="+objId+"&approvalTitle="+title+"&callbackFnc=fn_appr_status","registApproval","width=700,height=700");
|
|
});
|
|
|
|
|
|
|
|
$(".select2").select2();
|
|
|
|
fnc_datepick(); //달력
|
|
|
|
grid = $("#expenseDetailGrid").jqGrid({
|
|
url: ""
|
|
,datatype: "local"
|
|
,colNames: ["OBJID","마스터OBJID","detailOBJID","Level","품명","품번","규격(재질)","제조사","수량","후처리","부품구분","공급업체","Rev","Date","단가","공급금액","입고요청일","입고일","첨부파일","입고수량","인수자","인수일","인수수량"]
|
|
,colModel: [
|
|
{name:"PART_MGMT_OBJID",index:"PART_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:"MATERIAL_DETAIL_OBJID",index:"MATERIAL_DETAIL_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
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"PART_NAME",index:"PART_NAME", width: 350, align:"left", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"PART_NO",index:"PART_NO", width: 280, align:"left", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"SPEC_NAME",index:"SPEC_NAME", width: 150, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MFA_NAME",index:"MFA_CD", width: 90, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"QTY",index:"QTY", width: 50, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"PROCESS_NAME",index:"PROCESS_NAME", width: 80, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"SORT_NAME",index:"SORT_NAME", width: 90, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"SUP_NAME",index:"SUP_NAME", width: 130, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"REV",index:"REV", width: 50, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"REL_DATE",index:"REL_DATE", width: 100, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"UNIT_PRICE",index:"UNIT_PRICE", width: 100, align:"right", hidden: false, sortable:false, editable:false ,formatter: "integer", formatoptions:{thousandsSeparator:","}
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"PRICE",index:"PRICE", width: 100, align:"right", hidden: false, sortable:false, editable:false ,formatter: "integer", formatoptions:{thousandsSeparator:","}
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"RECV_DATE",index:"RECV_DATE", width: 100, align:"center", hidden: false, sortable:false, editable:false
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"REC_DATE" ,index:"REC_DATE" , width:80, align: "center", hidden:false, sortable:false, editable: true,
|
|
editoptions : { dataInit : function(e)
|
|
{
|
|
$(e).datepicker();
|
|
e.style.fontSize = 12;
|
|
e.style.textAlign = "center";
|
|
}
|
|
}
|
|
}
|
|
/* ,{name:"REC_DATE",index:"REC_DATE", width: 100, align:"center", hidden: false, sortable:false, editable:true} */
|
|
,{name:"FILE_CNT",index:"FILE_CNT", width: 60, align:"center", hidden: false, sortable:false, editable:false,formatter: imageFormatter
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
}
|
|
}
|
|
}
|
|
,{name:"RECEIVE_QTY",index:"RECEIVE_QTY", width: 60, align:"center", hidden: false, sortable:false, editable:true
|
|
,editoptions : { dataInit : function(e)
|
|
{
|
|
e.style.fontSize = 12;
|
|
e.style.textAlign = "center";
|
|
}
|
|
}
|
|
}
|
|
/* ,{name:"ACQ_USER_ID",index:"ACQ_USER_ID", width: 100, align:"center", hidden: false, sortable:false, editable:true} */
|
|
,{name:"ACQ_USER_ID" ,index:"ACQ_USER_ID" , width:100, align:"center", hidden:false, sortable:false, editable: true
|
|
,edittype :"select"
|
|
,formatter :"select"
|
|
,editoptions:{
|
|
value: gridrecv_userid
|
|
,dataInit: function(e){
|
|
e.style.width = "92%";
|
|
e.style.fontSize = 12;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
,{name:"ACQ_DATE" ,index:"ACQ_DATE" , width:80, align: "center", hidden:false, sortable:false, editable: true,
|
|
editoptions : { dataInit : function(e)
|
|
{
|
|
$(e).datepicker();
|
|
e.style.fontSize = 12;
|
|
e.style.textAlign = "center";
|
|
}
|
|
}
|
|
}
|
|
,{name:"ACQ_QTY",index:"ACQ_QTY", width: 60, align:"center", hidden: false, sortable:false, editable:true
|
|
,editoptions:{
|
|
dataInit : function(e){
|
|
e.style.fontSize = 12;
|
|
e.style.textAlign = "center";
|
|
}
|
|
}
|
|
}
|
|
]
|
|
,rownumbers : true
|
|
,viewrecords : true
|
|
,height : 550
|
|
,multiselect : false
|
|
,shrinkToFit : false
|
|
,autowidth : false
|
|
,sortable : false
|
|
,rowNum : 5000
|
|
,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": "" });
|
|
*/ }
|
|
,onCellSelect: function(rowid,icol,cellcontent,e){
|
|
|
|
var value = grid.jqGrid('getCell', rowid, 'MATERIAL_DETAIL_OBJID');
|
|
if(icol==19){
|
|
fn_Recfilepopup(value);
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
//
|
|
|
|
//gridFn.modify_search();
|
|
});
|
|
|
|
|
|
function imageFormatter(cellvalue, options, rowObject)
|
|
{
|
|
var url='<img src="/images/file_empty.png" width="15px" height="15px" />'
|
|
if(cellvalue != 0){
|
|
url='<img src="/images/folder_blue.png" width="15px" height="15px" />'
|
|
}
|
|
return url;
|
|
}
|
|
|
|
function fn_appr_status(){
|
|
$("#status_cd").val("PURSTCD00200");
|
|
gridFn.closeEdit();
|
|
$.ajax({
|
|
url:"/materMgmt/materMgmtSave.do"
|
|
,type:"POST"
|
|
,data: $("#form1").serialize() + "&jqGrid="+ encodeURIComponent(JSON.stringify(grid.getRowData()))
|
|
,dataType:"json"
|
|
,success:function(data){
|
|
/* if(data =="SUCCESS"){
|
|
Swal.fire("저장되었습니다.");
|
|
};
|
|
if(typeof opener.fn_search =="function"){ opener.fn_search() }; */
|
|
self.close();
|
|
}
|
|
,error: function(jqxhr, status, error){
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
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*/);
|
|
}
|
|
}
|
|
,delRow : function(){
|
|
var selectedRowIds = grid.jqGrid("getGridParam","selarrrow");
|
|
if(selectedRowIds.length==0){
|
|
Swal.fire("삭제할 행을 선택해주십시오.");
|
|
return false;
|
|
}
|
|
for(var i = selectedRowIds.length - 1; i >= 0; i--){
|
|
grid.delRowData(selectedRowIds[i]);
|
|
}
|
|
}
|
|
,search : function() {
|
|
grid.setGridParam({
|
|
url: "/materMgmt/searchPartMgmt.do"
|
|
,datatype : "json"
|
|
,postData : $("#form1").serialize()
|
|
,loadComplete : function(data) {
|
|
gridFn.footerSummary();
|
|
}
|
|
,gridComplete : function() {
|
|
gridFn.opennEdit(); //수정가능
|
|
}
|
|
}).trigger("reloadGrid");
|
|
grid.setGridParam({url: "", datatype : "local"});
|
|
}
|
|
,modify_search : function() {
|
|
grid.setGridParam({
|
|
url: "/materMgmt/searchMaterPartMgmt.do"
|
|
,datatype : "json"
|
|
,postData : $("#form1").serialize()
|
|
,loadComplete : function(data) {
|
|
gridFn.footerSummary();
|
|
}
|
|
,gridComplete : function() {
|
|
gridFn.opennEdit(); //수정가능
|
|
}
|
|
}).trigger("reloadGrid");
|
|
grid.setGridParam({url: "", datatype : "local"});
|
|
}
|
|
,footerSummary: function(){ //자동합계
|
|
var colSum1 = 0;
|
|
var colSum2 = 0;
|
|
var colSum3 = 0;
|
|
$("input[id*=UNIT_PRICE]").each(function(){ if($.isNumeric($(this).val())){ colSum1 += parseInt($(this).val()); } });
|
|
//$("input[id*=CASH_USED]").each(function(){ if($.isNumeric($(this).val())){ colSum2 += parseInt($(this).val()); } });
|
|
//$("input[id*=PAYMENT]" ).each(function(){ if($.isNumeric($(this).val())){ colSum3 += parseInt($(this).val()); } });
|
|
|
|
//$("#total_amount").val(numberWithCommas(colSum1+""));
|
|
//$("#summuryTotalCASH_USED").text(numberWithCommas(colSum2+""));
|
|
//$("#summuryTotalPAYMENT" ).text(numberWithCommas(colSum3+""));
|
|
//$("#summuryTotal").text(numberWithCommas((colSum1+colSum2-colSum3)+""));
|
|
|
|
var ids = grid.jqGrid("getDataIDs");
|
|
var total =0;
|
|
for (var i = 0; i < ids.length; i++) {
|
|
if($.isNumeric(grid.jqGrid('getCell', i+1, 'PRICE'))){
|
|
total = parseInt(total) + parseInt(grid.jqGrid('getCell', i+1, 'PRICE'));
|
|
}
|
|
|
|
}
|
|
|
|
$("#total_amount").val(total);
|
|
}
|
|
}
|
|
|
|
//코드값을 받아와서 동적으로 selectbox 생성
|
|
function fn_change_sup_cd(code){
|
|
var val=code;
|
|
|
|
var params = "codeId="+val;
|
|
//초기화
|
|
$("#supply_name").empty();
|
|
$("#reg_no").empty();
|
|
$("#supply_address").empty();
|
|
$("#supply_busname").empty();
|
|
$("#supply_stockname").empty();
|
|
$("#supply_tel_no").empty();
|
|
$("#supply_fax_no").empty();
|
|
$.ajax({
|
|
type : "POST",
|
|
url : "/admin/makeSupCdSelect.do",
|
|
data : params,
|
|
dataType:"json",
|
|
async: false,
|
|
success: function(data){
|
|
if(data.RESULT.length > 0){
|
|
console.log(data.RESULT[0]);
|
|
$("#supply_name").text(data.RESULT[0].SUPPLY_NAME);
|
|
$("#reg_no").text(data.RESULT[0].REG_NO);
|
|
$("#supply_address").text(data.RESULT[0].SUPPLY_ADDRESS);
|
|
$("#supply_busname").text(data.RESULT[0].SUPPLY_BUSNAME);
|
|
$("#supply_stockname").text(data.RESULT[0].SUPPLY_STOCKNAME);
|
|
$("#supply_tel_no").text(data.RESULT[0].SUPPLY_TEL_NO);
|
|
$("#supply_fax_no").text(data.RESULT[0].SUPPLY_FAX_NO);
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function fn_save(){
|
|
if(fnc_valitate("form1")){
|
|
|
|
if(confirm("저장 하시겠습니까?")){
|
|
|
|
gridFn.closeEdit();
|
|
$.ajax({
|
|
url:"/materMgmt/materRecSaveDetail.do"
|
|
,type:"POST"
|
|
,data: $("#form1").serialize() + "&jqGrid="+ encodeURIComponent(JSON.stringify(grid.getRowData()))
|
|
,dataType:"json"
|
|
,success:function(data){
|
|
if(data =="SUCCESS"){
|
|
Swal.fire("저장되었습니다.");
|
|
};
|
|
fn_gridresearch();
|
|
}
|
|
,error: function(jqxhr, status, error){
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//SR자료등록 팝업
|
|
function fn_Recfilepopup(objId){
|
|
var objId = objId;
|
|
var docType ="RECV"
|
|
var docTypeName = "RECV"
|
|
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName+"&callbackFnc=fn_gridresearch";
|
|
var url="/projectConcept/FileRegistPopup.do";
|
|
|
|
<c:if test="${'KM2721' eq connectUserId or 'plm_admin' eq connectUserId}">
|
|
url="/common/FileRegistPopup.do";
|
|
</c:if>
|
|
window.open(url+params, "", "width=800, height=335");
|
|
}
|
|
|
|
|
|
function fn_gridresearch(){
|
|
gridFn.modify_search();
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<form name="form1" id="form1" action="" method="post">
|
|
<div class="content-box">
|
|
<div class="content-box-s">
|
|
<div class="plm_menu_name">
|
|
<h2>
|
|
<span>자재관리_발주 현황</span>
|
|
</h2>
|
|
</div>
|
|
<div id="plmSearchZon">
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td class="align_r">
|
|
<label for="" class="">Project No.</label>
|
|
</td>
|
|
<td>
|
|
<select name="projectno" id="projectno" style="width:100px;">
|
|
<option value="">전체</option>
|
|
${code_map.projectno}
|
|
</select>
|
|
</td>
|
|
|
|
<td class="align_r">
|
|
<label for="" class="">부품구분</label>
|
|
</td>
|
|
<td>
|
|
<select name="sort_cd" id="sort_cd" style="width:140px;">
|
|
<option value="">전체</option>
|
|
${code_map.sort_cd}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<section class="contents_page_basic_margin">
|
|
<div class="btn_wrap">
|
|
<div class="plm_btn_wrap">
|
|
<!-- 이광민 신재혁 부장 권한 -->
|
|
<c:if test="${'KM2721' eq connectUserId or 'SJH9397' eq connectUserId or 'plm_admin' eq connectUserId}">
|
|
<input type="button" value="저장" class="plm_btns" id="btnSave">
|
|
</c:if>
|
|
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="plm_table_wrap1" style="padding:0 8 0 8;margin-top:15px">
|
|
<div style="height:550px;width:100%;overflow-x:scroll;">
|
|
<table id="expenseDetailGrid""></table>
|
|
<!-- <div id="jqGridPager"></div> -->
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridrecv_userid">${code_map.gridrecv_userid}</textarea><!-- 코드동적설정 -->
|
|
|
|
<%-- <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><!-- 코드동적설정 --> --%>
|
|
|
|
</form>
|
|
</body>
|
|
</html> |