ERP-node/WebContent/WEB-INF/view/as/asMngFormPopUp_CS.jsp

898 lines
37 KiB
Plaintext
Raw Normal View History

2025-08-21 09:41:46 +09:00
<%@ 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_jqGrid.jsp"%>
<%
Map info = (HashMap)(request.getAttribute("info"));
boolean isModify = true;
if(info!=null &&
( CommonUtils.checkNull(info.get("APPR_STATUS_NAME")).equals( "결재중" )
||CommonUtils.checkNull(info.get("APPR_STATUS_NAME")).equals( "결재완료" )
)
){
isModify = false;
}
%>
<c:set var="isModify" value="<%= isModify %>"/>
<c:set var="now" value="<%=new java.util.Date() %>"/>
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<style>
.in_table_scroll_wrap {
height: 80% !important;
}
.dropzone {
margin-top: 0px !important;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('.select2').select2();
fnc_datepick();
fn_getApprLine(); //결재라인
//select code
//var jsonLevel3_csmCategory_data = $.parseJSON($("#jsonLevel3_csmCategory").val()); //조치내역서 유형
//fnc_setCodeStepSelectByJsonLevel3(jsonLevel3_csmCategory_data, $("#category_h"), $("#category_m"), $("#category_l")); //유형 대,중,소
var jqGridSelect_SUPPLY = $.parseJSON($("#jqGridSelect_SUPPLY").val()); //업체
//당사프로젝트번호 변경시
$("select#contract_objid").change(function(){
$("#customer_name, #setup, #release_dt").val("");
if($(this).val()!=""){
var list = fnc_getJsonAllDataListBySqlId({"sqlId":"releaseMgmt.getReleaseMgmtList", "contract_mgmt_objid":$(this).val()});
if(fnc_checkNull( list )!=""){
var row = list[0];
$("#customer_name").val( row["CUSTOMER_NAME"] );
$("#setup" ).val( row["SETUP" ] );
$("#release_dt" ).val( row["RELEASE_DATE" ] );
}
}
});
if("${info.CS_CATEGORY}"!=""){
fnc_getCodeListAppend("${info.CS_CATEGORY}","category_h","${info.CATEGORY_H}");
}
$("#cs_category").change(function(){
if($(this).val()!=""){
fnc_getCodeListAppend($(this).val(),"category_h","");
}
});
//사용부품 -----------------------------------------------------------------------------------------------------
gridPart = $("#gridPart").jqGrid({
url: ""
,datatype: "local"
,data : $.parseJSON($("#gridPartData").val())
,colNames: ["OBJID","PARENT_OBJID","품번","품명","사양(규격)","수량","현재고수량","단가","공급가"]
,colModel: [
{name:"OBJID" , index:"", width: 0, align:"center", hidden: true, sortable:false, editable:false}
,{name:"PARENT_OBJID" , index:"", width: 0, align:"center", hidden: true, sortable:false, editable:false}
,{name:"PART_NO" , index:"", width:120, align:"center", hidden:false, sortable:false, editable: true}
,{name:"PART_NAME" , index:"", width:120, align:"center", hidden:false, sortable:false, editable: true}
,{name:"SPEC" , index:"", width:100, align:"center", hidden:false, sortable:false, editable: true}
,{name:"QTY" , index:"", width:80, align:"center", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridPartFn.calcRowAll(e); }} ]
}
}
,{name:"CUR_QTY" , index:"", width:80, align:"center", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridPartFn.calcRowAll(e); }} ]
}
}
,{name:"PRICE" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridPartFn.calcRowAll(e); }} ]
}
}
,{name:"SUP_PRICE" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridPartFn.calcRowAll(e); }} ]
}
}
]
,ignoreCase : true //로컬 검색 및 정렬이 대,소문자를 구분하지 않도록 하려면true
,rownumbers : true //row번호 표시
,viewrecords : true //pager가 있을경우 표시되는 record number
,autowidth : true //그리드 너비가 자동으로 부모 요소의 너비로 다시 계산
,sortable : false //마우스로 열을 끌어다 놓아 열을 재정렬
,shrinkToFit : true //모든 열은 너비에 비례하여 크기가 조정
,forceFit : false //컬럼의 width를 변화시킬때 그리드의 width를 고정 여부
,multiselect : <% if(isModify){ %>true<% }else{ %>false<% } %> //선택가능. 체크박스표시
,height : 120
,rowNum : "${countPerPage}"
,jsonReader : {repeatitems: false}
,mtype :"POST"
,footerrow : true //바닥합계
,userDataOnFooter: true //바닥합계
,loadComplete: function(data){ //모든 서버 요청 직후에 실행
var gid = $(this).attr("id");
var grid_wrap_div = $("#gbox_"+gid);
setTimeout("fn_jqGrid_init($('#"+gid+"'), false);", 50); //윈도우크기 비례 자동조절
//footer 커스텀..
$.each($("#"+gid).getGridParam("colModel"), function(i,o){
if(o.hidden){
return true; //continue;
}else if(o.name == "PRICE"){
return false; //break;
}
$(".ui-jqgrid-ftable td:visible:eq(1)", grid_wrap_div).remove();
});
$(".ui-jqgrid-ftable td:visible:eq(0)", grid_wrap_div).attr({"colspan":"5"}).css({"width":"","font-size":"20px"}).removeClass("ui-state-default");
//$(".ui-jqgrid-ftable td:visible:eq(1)", grid_wrap_div).attr({id:"summuryTotalSUP_PRICE"});
var sty = "text-align:right; border: 0 0; font-weight: 700; font-size: 13px; width:100%; height:24px; border: 1px solid #eee;";
$(".ui-jqgrid-ftable td:visible:eq(1)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_SUP_PRICE' id='TOTAL_SUP_PRICE' />");
$("#"+gid).jqGrid("footerData", "set", { "rn":"계(원)", "SUP_PRICE": "" });
setTimeout("gridPartFn.footerSummary();", 50);
}
,gridComplete: function(){ //모든 프로세스가 완료된 후에 발생,페이징 등을 정렬 한 후에 발생
}
});
//작업시간-----------------------------------------------------------------------------------------------------
gridWork = $("#gridWork").jqGrid({
url: ""
,datatype: "local"
,data : $.parseJSON($("#gridWorkData").val())
,colNames: ["OBJID","PARENT_OBJID","업체명","시작일","종료일","작업일수","작업인원","day/M","노무비","경비"]
,colModel: [
{name:"OBJID" , index:"", width: 0, align:"center", hidden: true, sortable:false, editable:false}
,{name:"PARENT_OBJID" , index:"", width: 0, align:"center", hidden: true, sortable:false, editable:false}
,{name:"SUPPLY_OBJID" , index:"", width:100, align:"center", hidden:false, sortable:false, editable: true
,edittype :"select"
,formatter :"select"
,editoptions:{
value: jqGridSelect_SUPPLY
,dataInit: function(e){ e.style.width = "92%"; e.style.fontSize = 13; }
,dataEvents: [
{type:"change", fn:function(e) {
//var row = $(e.target).closest("tr.jqgrow");
//gridFn.getStep2Cd(this);
}}
]
}
}
,{name:"FORM_DATE" , index:"", width:100, align:"center", hidden:false, sortable:false, editable: true
,editoptions:{
dataInit: function(e){ $(e).datepicker({changeMonth:true, changeYear:true}); }
}
}
,{name:"TO_DATE" , index:"", width:100, align:"center", hidden:false, sortable:false, editable: true
,editoptions:{
dataInit: function(e){ $(e).datepicker({changeMonth:true, changeYear:true}); }
}
}
,{name:"WORK_DAY" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridWorkFn.calcRowAll(e); }} ]
}
}
,{name:"WORK_PERSON" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridWorkFn.calcRowAll(e); }} ]
}
}
,{name:"WORK_DAY_M" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridWorkFn.calcRowAll(e); }} ]
}
}
,{name:"LABOR_COST" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridWorkFn.footerSummary(); }} ]
}
}
,{name:"EXPENSES" , index:"", width:100, align: "right", hidden:false, sortable:false, editable: true
,formatter: "integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; e.style.fontSize = 13; }
,dataEvents: [ {type:"change", fn:function(e) { gridWorkFn.footerSummary(); }} ]
}
}
]
,ignoreCase : true //로컬 검색 및 정렬이 대,소문자를 구분하지 않도록 하려면true
,rownumbers : false //row번호 표시
,viewrecords : true //pager가 있을경우 표시되는 record number
,autowidth : true //그리드 너비가 자동으로 부모 요소의 너비로 다시 계산
,sortable : false //마우스로 열을 끌어다 놓아 열을 재정렬
,shrinkToFit : true //모든 열은 너비에 비례하여 크기가 조정
,forceFit : false //컬럼의 width를 변화시킬때 그리드의 width를 고정 여부
,multiselect : <% if(isModify){ %>true<% }else{ %>false<% } %> //선택가능. 체크박스표시
,height : 120
,rowNum : "${countPerPage}"
,jsonReader : {repeatitems: false}
,mtype :"POST"
,footerrow : true //바닥합계
,userDataOnFooter: true //바닥합계
,loadComplete: function(data){ //모든 서버 요청 직후에 실행
var gid = $(this).attr("id");
var grid_wrap_div = $("#gbox_"+gid);
setTimeout("fn_jqGrid_init($('#"+gid+"'), false);", 50); //윈도우크기 비례 자동조절
//footer 커스텀..
$.each($("#"+gid).getGridParam("colModel"), function(i,o){
if(o.hidden){
return true; //continue;
}else if(o.name == "TO_DATE"){
return false; //break;
}
$(".ui-jqgrid-ftable td:visible:eq(1)", grid_wrap_div).remove();
});
<% if(isModify){ %>
$(".ui-jqgrid-ftable td:visible:eq(0)", grid_wrap_div).attr({"colspan":"5"}).css({"width":"","font-size":"20px"}).removeClass("ui-state-default");
$(".ui-jqgrid-ftable td:visible:eq(0)", grid_wrap_div).text("총작업시간");
<% }else{ %>
$(".ui-jqgrid-ftable td:visible:eq(0)", grid_wrap_div).attr({"colspan":"3"}).css({"width":"","font-size":"20px"}).removeClass("ui-state-default");
$(".ui-jqgrid-ftable td:visible:eq(0)", grid_wrap_div).text("총작업시간");
<% } %>
var sty = "text-align:right; border: 0 0; font-weight: 700; font-size: 13px; width:100%; height:24px; border: 1px solid #eee;";
$(".ui-jqgrid-ftable td:visible:eq(1)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_WORK_DAY' id='TOTAL_WORK_DAY' />");
$(".ui-jqgrid-ftable td:visible:eq(2)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_WORK_PERSON' id='TOTAL_WORK_PERSON' />");
$(".ui-jqgrid-ftable td:visible:eq(3)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_WORK_DAY_M' id='TOTAL_WORK_DAY_M' />");
$(".ui-jqgrid-ftable td:visible:eq(4)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_LABOR_COST' id='TOTAL_LABOR_COST' />");
$(".ui-jqgrid-ftable td:visible:eq(5)", grid_wrap_div).html("<input type='text' readonly style='"+sty+"' name='TOTAL_EXPENSES' id='TOTAL_EXPENSES' />");
setTimeout("gridWorkFn.footerSummary();", 50);
}
,gridComplete: function(){ //모든 프로세스가 완료된 후에 발생,페이징 등을 정렬 한 후에 발생
}
});
<% if(isModify){ %>
$("#btnSave" ).click(function(){ fn_save(); });
gridPartFn.opennEdit(); //수정가능
$("#btnAddPart" ).click(function(){
//gridPartFn.addRow();
fn_openPartMngListPopUp();
});
$("#btnDelPart" ).click(function(){ gridPartFn.delRow(); });
gridWorkFn.opennEdit(); //수정가능
$("#btnAddWork" ).click(function(){ gridWorkFn.addRow(); });
$("#btnDelWork" ).click(function(){ gridWorkFn.delRow(); });
$("#btnAppr").click(function(){ //결재상신
if(fnc_valitate("form1")){
gridPartFn.closeEdit();
gridWorkFn.closeEdit();
if(gridPart.getRowData().length == 0){
Swal.fire('저장할 사용부품이 존재 하지 않습니다');
gridPartFn.opennEdit()
gridWorkFn.opennEdit();
return;
}
if(gridWork.getRowData().length == 0){
Swal.fire('저장할 작업시간이 존재 하지 않습니다');
gridPartFn.opennEdit()
gridWorkFn.opennEdit();
return;
}
gridPartFn.opennEdit()
gridWorkFn.opennEdit();
var objId = "${info.OBJID}";
var title = encodeURIComponent("CS조치내역서 상신 - " + $("#title").val());
window.open("/approval/registApproval.do?targetType=CSM&targetObjId="+objId+"&approvalTitle="+title+"&callbackFnc=fn_save_appr_process","registApproval","width=700,height=700");
}
});
<% }else{ %>
$('select, input:text, textarea').filter(':visible').attr("disabled","");
$('input:button').filter(':visible').not('#btnClose').remove();
<% } %>
setTimeout("$(window).scrollTop(0);", 50);
});
var gridPartFn = {
addRow : function() {
var newId = gridPart.getGridParam("reccount")+1;
var addData = {
"OBJID" : ""
,"PARENT_OBJID" : "${info.OBJID}"
,"PART_NO" : ""
,"PART_NAME" : ""
,"SPEC" : ""
,"QTY" : ""
,"CUR_QTY" : ""
,"PRICE" : ""
,"SUP_PRICE" : ""
};
gridPart.addRowData(newId, addData);
gridPart.jqGrid("editRow", newId);
}
,delRow : function(){
var selectedRowIds = gridPart.jqGrid("getGridParam","selarrrow");
if(selectedRowIds.length==0){
Swal.fire("삭제할 행을 선택해주십시오.");
return false;
}
for(var i = selectedRowIds.length - 1; i >= 0; i--){
gridPart.delRowData(selectedRowIds[i]);
}
gridPartFn.footerSummary();
}
,opennEdit : function() { //수정가능
var ids = gridPart.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
gridPart.jqGrid("editRow",ids[i]);
}
}
,closeEdit : function() { //수정불가
var ids = gridPart.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
gridPart.jqGrid("saveRow", ids[i], /*successFunction*/null, /*url*/"clientArray"/*, extraparam, aftersavefunc,errorfunc, afterrestorefunc*/);
}
}
,calcRowAll : function(e){ //행 모든 컬럼 계산
if(!$.isNumeric( fnc_checkNullDefaultValue($(e.target).val(),"0")) ){
Swal.fire("숫자를 입력해주세요"); $(e.target).select(); return;
}else{
$(e.target).val(fnc_addComma($(e.target).val().replace(/[^0-9]/g,"")));
}
var $g = $("#gridPart");
//var rowId = $g.jqGrid('getGridParam', 'selrow'); //선택된행 번호
var rowId = e.target.id.split("_")[0]; //수정중인 행번호 (행선택은 안될수있음)
var v1 = Number( $g.find("#"+rowId+"_QTY").val().replace(/,/gi,"") );
var v2 = Number( $g.find("#"+rowId+"_PRICE").val().replace(/,/gi,"") );
if(e.target.id == rowId+"_QTY" || e.target.id == rowId+"_PRICE" ){
//공급가 = 수량 *단가
$g.find("#"+rowId+"_SUP_PRICE").val( numberWithCommas(v1 * v2));
}
this.footerSummary();
}
,footerSummary: function(){ //자동합계
var gid = gridPart.attr("id");
var grid_wrap_div = $("#gbox_"+gid);
var colSum1 = 0;
<% if(isModify){ %>
$("input[name=SUP_PRICE]", grid_wrap_div).each(function(){
var supPrice = $(this).val().replace(/,/gi,"");
if($.isNumeric(supPrice)){
colSum1 += parseInt(supPrice);
}
});
<% }else{ %>
$.each(gridPart.getDataIDs(), function(i,o){
if($.isNumeric( gridPart.getCell(o, "SUP_PRICE") )){ colSum1 += parseInt( gridPart.getCell(o, "SUP_PRICE") ); }
});
<% } %>
$("#TOTAL_"+"SUP_PRICE", grid_wrap_div).val(numberWithCommas(colSum1+"")); //공급가
}
}
var gridWorkFn = {
addRow : function() {
var newId = gridWork.getGridParam("reccount")+1;
var addData = {
"OBJID" : ""
,"PARENT_OBJID" : "${info.OBJID}"
,"SUPPLY_OBJID" : ""
,"FORM_DATE" : ""
,"TO_DATE" : ""
,"WORK_DAY" : ""
,"WORK_PERSON" : ""
,"WORK_DAY_M" : ""
,"LABOR_COST" : ""
,"EXPENSES" : ""
};
gridWork.addRowData(newId, addData);
gridWork.jqGrid("editRow", newId);
}
,delRow : function(){
var selectedRowIds = gridWork.jqGrid("getGridParam","selarrrow");
if(selectedRowIds.length==0){
Swal.fire("삭제할 행을 선택해주십시오.");
return false;
}
for(var i = selectedRowIds.length - 1; i >= 0; i--){
gridWork.delRowData(selectedRowIds[i]);
}
gridWorkFn.footerSummary();
}
,opennEdit : function() { //수정가능
var ids = gridWork.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
gridWork.jqGrid("editRow",ids[i]);
}
}
,closeEdit : function() { //수정불가
var ids = gridWork.jqGrid("getDataIDs");
for (var i = 0; i < ids.length; i++) {
gridWork.jqGrid("saveRow", ids[i], /*successFunction*/null, /*url*/"clientArray"/*, extraparam, aftersavefunc,errorfunc, afterrestorefunc*/);
}
}
,calcRowAll : function(e){ //행 모든 컬럼 계산
if(!$.isNumeric( fnc_checkNullDefaultValue($(e.target).val(),"0")) ){
Swal.fire("숫자를 입력해주세요"); $(e.target).select(); return;
}else{
$(e.target).val(fnc_addComma($(e.target).val().replace(/[^0-9]/g,"")));
}
var $g = $("#gridWork");
//var rowId = $g.jqGrid('getGridParam', 'selrow'); //선택된행 번호
var rowId = e.target.id.split("_")[0]; //수정중인 행번호 (행선택은 안될수있음)
var v1 = Number( $g.find("#"+rowId+"_WORK_DAY").val().replace(/,/gi,"") );
var v2 = Number( $g.find("#"+rowId+"_WORK_PERSON").val().replace(/,/gi,"") );
if(e.target.id == rowId+"_WORK_DAY" || e.target.id == rowId+"_WORK_PERSON" ){
//공급가 = 수량 *단가
$g.find("#"+rowId+"_WORK_DAY_M").val( numberWithCommas((v1 * v2)));
}
this.footerSummary();
}
,footerSummary: function(){ //자동합계
var gid = gridWork.attr("id");
var grid_wrap_div = $("#gbox_"+gid);
var colSum1 = 0;
var colSum2 = 0;
var colSum3 = 0;
var colSum4 = 0;
var colSum5 = 0;
<% if(isModify){ %>
$("input[name=WORK_DAY] ", grid_wrap_div).each(function(){
var work_day = $(this).val().replace(/,/gi,"");
if($.isNumeric(work_day)){
colSum1 += parseInt(work_day);
}
});
$("input[name=WORK_PERSON]", grid_wrap_div).each(function(){
var work_person = $(this).val().replace(/,/gi,"");
if($.isNumeric(work_person)){
colSum2 += parseInt(work_person);
}
});
$("input[name=WORK_DAY_M] ", grid_wrap_div).each(function(){
var work_day_m = $(this).val().replace(/,/gi,"");
if($.isNumeric(work_day_m)){
colSum3 += parseInt(work_day_m);
}
});
$("input[name=LABOR_COST] ", grid_wrap_div).each(function(){
var labor_cost = $(this).val().replace(/,/gi,"");
if($.isNumeric(labor_cost)){
colSum4 += parseInt(labor_cost);
}
});
$("input[name=EXPENSES] ", grid_wrap_div).each(function(){
var expenses = $(this).val().replace(/,/gi,"");
if($.isNumeric(expenses)){
colSum5 += parseInt(expenses);
}
});
<% }else{ %>
$.each(gridWork.getDataIDs(), function(i,o){
if($.isNumeric( gridWork.getCell(o, "WORK_DAY" ) )){ colSum1 += parseInt( gridWork.getCell(o, "WORK_DAY" ) ); }
if($.isNumeric( gridWork.getCell(o, "WORK_PERSON") )){ colSum2 += parseInt( gridWork.getCell(o, "WORK_PERSON") ); }
if($.isNumeric( gridWork.getCell(o, "WORK_DAY_M" ) )){ colSum3 += parseInt( gridWork.getCell(o, "WORK_DAY_M" ) ); }
if($.isNumeric( gridWork.getCell(o, "LABOR_COST" ) )){ colSum4 += parseInt( gridWork.getCell(o, "LABOR_COST" ) ); }
if($.isNumeric( gridWork.getCell(o, "EXPENSES" ) )){ colSum5 += parseInt( gridWork.getCell(o, "EXPENSES" ) ); }
});
<% } %>
$("#TOTAL_"+"WORK_DAY" , grid_wrap_div).val(numberWithCommas(colSum1+"")); //작업일수
$("#TOTAL_"+"WORK_PERSON", grid_wrap_div).val(numberWithCommas(colSum2+"")); //작업인원
$("#TOTAL_"+"WORK_DAY_M" , grid_wrap_div).val(numberWithCommas(colSum3+"")); //day/M
$("#TOTAL_"+"LABOR_COST" , grid_wrap_div).val(numberWithCommas(colSum4+"")); //노무비
$("#TOTAL_"+"EXPENSES" , grid_wrap_div).val(numberWithCommas(colSum5+"")); //경비
}
}
//상신된 결재라인가져오기
function fn_getApprLine(){
$.ajax({
url:"/common/getApprovalLine.do",
type:"POST",
data:{"objId":"${info.OBJID}"},
dataType:"json",
async:false,
success:function(data){
$.each(data.RESULT, function(i,o){
if(i==0){
$("#appr"+i ).text( o.WRITER );
$("#appr"+i+"_date").text( o.REGDATE );
}
$("#appr"+(i+1) ).text( o.TARGET_USER_NAME );
$("#appr"+(i+1)+"_date").text( fnc_checkNull(o.PROC_DATE)!=""?o.PROC_DATE:" " );
});
},
error: function(jqxhr, status, error){
}
});
}
function fn_save(){
if(fnc_validate('form1')){
if(confirm("저장하시겠습니까?")){
gridPartFn.closeEdit();
gridWorkFn.closeEdit();
if(gridPart.getRowData().length == 0){
Swal.fire('저장할 사용부품이 존재 하지 않습니다');
gridPartFn.opennEdit();
gridWorkFn.opennEdit();
return;
}
if(gridWork.getRowData().length == 0){
Swal.fire('저장할 작업시간이 존재 하지 않습니다');
gridPartFn.opennEdit();
gridWorkFn.opennEdit();
return;
}
fn_save_process();
}
}
}
function fn_save_appr_process(){
$("#status").val("0000101"); //결재중
fn_save_process();
}
function fn_save_process(){
gridPartFn.closeEdit();
gridWorkFn.closeEdit();
//합계 콤마 제거
$("input[id^=TOTAL]", $(".footrow")).each(function(i,o){ $(this).val( $(this).val().replaceAll(",","") ); });
$.ajax({
url:"/as/saveas.do"
,type:"POST"
,data: $("#form1").serialize()
+"&jqGridPart="+JSON.stringify(gridPart.getRowData())
+"&jqGridWork="+JSON.stringify(gridWork.getRowData())
,dataType:"json"
,async:false
,success:function(data){
alert(data.message);
opener.fn_search();
self.close();
}
,error: function(jqxhr, status, error){
}
});
}
//계약제품, 업체명으로 BOM에 등록된 부품정보를 자동 추가
//function addBomPart(){
// gridPart.clearGridData();
//
// var contract_mgmt_objid = $("#contract_objid").val();
// var supply_code = $("#PARTNER_OBJID").val();
//
// if(fnc_checkNull(contract_mgmt_objid)!="" && fnc_checkNull(supply_code)!=""){
// $.ajax({
// url:"/partMng/getPartLinkedBomContractList.do"
// ,type:"POST"
// ,data:{
// "contract_mgmt_objid": contract_mgmt_objid
// ,"supply_code": supply_code
// }
// ,dataType:"json"
// ,async:false
// ,success:function(data){
// $.each(data.RESULT, function(i,o){
// var rowData = new Map();
// rowData.put("PART_OBJID" , o.PART_OBJID );
// rowData.put("PART_NAME" , o.PART_NAME );
// rowData.put("PART_NO" , o.PART_NO );
// rowData.put("DO_NO" , o.DO_NO );
// rowData.put("THICKNESS" , o.THICKNESS );
// rowData.put("WIDTH" , o.WIDTH );
// rowData.put("HEIGHT" , o.HEIGHT );
// rowData.put("OUT_DIAMETER" , o.OUT_DIAMETER );
// rowData.put("IN_DIAMETER" , o.IN_DIAMETER );
// rowData.put("LENGTH" , o.LENGTH );
// rowData.put("INVEN_TOTAL_QTY", o.INVEN_TOTAL_QTY );
//
// fn_addRow(rowData);
// });
// }
// ,error: function(jqxhr, status, error){
// }
// });
// }
//}
//행추가시 품목선택 팝업
function fn_openPartMngListPopUp(){
var target = "partMngListPopUp";
var url = "/partMng/partMngListPopUp.do?callbackFnc=fn_addRow&callType=purchaseOrder";
window.open(url,target,"width=1600,height=800");
}
//품목선택 callbackFnc
function fn_addRow(rowData){
//console.log(rowData);
var addData = {
"OBJID" : ""
,"PARENT_OBJID" : "${info.OBJID}"
,"PART_NO" : rowData.map.PART_NO
,"PART_NAME" : rowData.map.PART_NAME
,"SPEC" : rowData.map.SPEC
,"QTY" : rowData.map.QTY
,"CUR_QTY" : rowData.map.INVEN_TOTAL_QTY
,"PRICE" : ""
,"SUP_PRICE" : ""
}
var newId = gridPart.getGridParam("reccount")+1;
gridPart.addRowData(newId, addData);
gridPart.jqGrid("editRow", newId);
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objId" id="objId" value="${info.OBJID }">
<input type="hidden" name="status" id="status" value="${info.STATUS }">
<input type="hidden" name="service_no" id="service_no" value="${info.SERVICE_NO}">
<textarea style="display:none; visibility: hidden;" id="jqGridSelect_SUPPLY">${code_map.jqGridSelect_SUPPLY}</textarea><!-- 코드동적설정 -->
<textarea style="display:none; visibility: hidden;" id="jsonLevel3_csmCategory">${code_map.jsonLevel3_csmCategory}</textarea><!-- 코드동적설정 -->
<section>
<div class="plm_menu_name" style="display:flex;">
<h2 style="width:50%;text-align:center;margin-top:10px;">
<span style="font-size:30px;">Customer Service Management </br> (조치내역서)</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" style="text-align:center;" rowspan="3" >
<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>
<td class="input_title" style="text-align:center;">
<label>조치팀(승인)</label>
</td>
</tr>
<tr style="border-spacing: 0;border-bottom:1px solid #ccc; height: 50px;">
<td class="input_sub_title" style="text-align:center;" id="appr0"></td>
<td class="input_sub_title" style="text-align:center;" id="appr1"></td>
<td class="input_sub_title" style="text-align:center;" id="appr2"></td>
<td class="input_sub_title" style="text-align:center;" id="appr3"></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;" id="appr0_date"></td>
<td class="input_sub_title" style="text-align:center;" id="appr1_date"></td>
<td class="input_sub_title" style="text-align:center;" id="appr2_date"></td>
<td class="input_sub_title" style="text-align:center;" id="appr3_date"></td>
</tr>
</table>
</div>
<div id="businessPopupFormWrap">
<div>
<table class="pmsPopupForm">
<colgroup>
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
</colgroup>
<tr>
<td class="input_title"><label for="">제품구분</label></td>
<td class="input_sub_title"><select name="product" id="product" class="select2" required reqTitle="제품구분" type="select"><option value="">전체</option>${code_map.product}</select></td>
<td class="input_title"><label for="">당사 프로젝트번호</label></td>
<td class="input_sub_title"><select name="contract_objid" id="contract_objid" class="select2" required reqTitle="당사 프로젝트번호" type="select"><option value="">전체</option>${code_map.project_no}</select></td>
<td class="input_title"><label for="">고객사(명)</label></td><!-- 자동표시 -->
<td class="input_sub_title"><input type="text" name="customer_name" id="customer_name" value="${info.CUSTOMER_NAME }" readonly></td>
<td class="input_title"><label for="">셋업지</label></td><!-- 자동표시 -->
<td class="input_sub_title"><input type="text" name="setup" id="setup" value="${info.SETUP }" readonly></td>
</tr>
<tr>
<td class="input_title"><label for="">출고일</label></td><!-- 자동표시 -->
<td class="input_sub_title"><input type="text" name="release_date" id="release_dt" value="${info.RELEASE_DATE }" readonly></td>
<td class="input_title"><label for="">CS구분</label></td>
<td class="input_sub_title"><select name="cs_category" id="cs_category" class="select2" ><option value="">전체</option>${code_map.cs_category}</select></td>
<td class="input_title"><label for="">유형</label></td>
<td class="input_sub_title"><select name="category_h" id="category_h" class="select2" def-value="${info.CATEGORY_H}" reqTitle="유형" type="select"><option value="">전체</option></select></td>
<td class="input_title"><label for="">유/무상</label></td>
<td class="input_sub_title"><select name="warranty" id="warranty" class="select2" required reqTitle="유/무상" type="select"><option value="">전체</option>${code_map.warranty}</select></td>
</tr>
<tr>
<%-- <td class="input_title"><label for="">유형(대)</label></td>
<td class="input_sub_title"><select name="category_h" id="category_h" class="select2" def-value="${info.CATEGORY_H}" required reqTitle="유형(대)" type="select"><option value="">전체</option></select></td>
<td class="input_title"><label for="">유형(중)</label></td>
<td class="input_sub_title"><select name="category_m" id="category_m" class="select2" def-value="${info.CATEGORY_M}"><option value="">전체</option></select></td>
<td class="input_title"><label for="">유형(소)</label></td>
<td class="input_sub_title"><select name="category_l" id="category_l" class="select2" def-value="${info.CATEGORY_L}"><option value="">전체</option></select></td> --%>
<td class="input_title"><label for="">조치담당자</label></td>
<td class="input_sub_title"><select name="manager_id" id="manager_id" class="select2" required reqTitle="조치담당자" type="select"><option value="">전체</option>${code_map.manager_id}</select></td>
<td class="input_title"><label for="">조치완료일</label></td>
<td class="input_sub_title"><input type="text" name="act_date" id="act_date" value="${info.ACT_DATE }"></td>
<td class="input_title"><label for="">제목</label></td>
<td class="input_sub_title" colspan="3"><input type="text" name="title" id="title" value="${info.TITLE }" required reqTitle="제목" ></td>
</tr>
</table>
</div>
<div>
<table class="pmsPopupForm" style="border:3px solid #000000; height:200px;">
<tr>
<td style="border-right:1px solid #000000;text-align:center;" >
<span>문제점(현상)</span>
<textarea placeholder="문제점(현상)" id="before_contents" name="before_contents" style="border:3px solid #ccc; width:100%; height:170px;">${info.BEFORE_CONTENTS}</textarea>
</td>
<td style="border-right:1px solid #000000;text-align:center;" >
<jsp:include page="/WEB-INF/view/common/fileWidget_include.jsp">
<jsp:param name="fileType" value="AS_IMG_01" />
<jsp:param name="fileTypeTxt" value="AS 이미지01" />
<jsp:param name="viewType" value="IMG1" />
<jsp:param name="imgStyle" value="width:96% !important; height:132px; margin:0;padding:0;" />
<jsp:param name="isModify" value="<%=isModify %>" />
<jsp:param name="targetObjid" value="${info.OBJID}" />
<jsp:param name="actionType" value="${param.actionType}" />
<jsp:param name="writer" value="${info.WRITER}" />
<jsp:param name="connectUserId" value="${connectUserId}" />
</jsp:include>
</td>
<td style="border-right:1px solid #000000;text-align:center;" >
<span>조치내역</span>
<textarea placeholder="조치내역" id="after_contents" name="after_contents" style="border:3px solid #ccc; width:100%; height:170px;">${info.AFTER_CONTENTS}</textarea>
</td>
<td style="border-right:1px solid #000000;text-align:center;">
<jsp:include page="/WEB-INF/view/common/fileWidget_include.jsp">
<jsp:param name="fileType" value="AS_IMG_02" />
<jsp:param name="fileTypeTxt" value="AS 이미지02" />
<jsp:param name="viewType" value="IMG1" />
<jsp:param name="imgStyle" value="width:96% !important; height:132px; margin:0;padding:0;" />
<jsp:param name="isModify" value="<%=isModify %>" />
<jsp:param name="targetObjid" value="${info.OBJID}" />
<jsp:param name="actionType" value="${param.actionType}" />
<jsp:param name="writer" value="${info.WRITER}" />
<jsp:param name="connectUserId" value="${connectUserId}" />
</jsp:include>
</td>
</tr>
</table>
</div>
</div>
<div id="businessPopupFormWrap">
<table style="width: 100%;">
<colgroup>
<col width="10%">
<col width="90%">
</colgroup>
<tr>
<td><h3 style="margin-top:0px;">사용부품</h3></td>
<td style="float:right; margin-top:5px;">
<input type="button" value="추가" class="plm_btns" id="btnAddPart">
<input type="button" value="삭제" class="plm_btns" id="btnDelPart">
</td>
</tr>
</table>
<div class="plm_table_wrap" >
<table id="gridPart"></table>
<!-- <div id="gridPartPager"></div> -->
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridPartData">${gridPartData}<c:if test="${empty gridPartData}">[]</c:if></textarea><!-- [{},{},{}] -->
</div>
</div>
<div id="businessPopupFormWrap">
<table style="width: 100%;">
<colgroup>
<col width="10%">
<col width="90%">
</colgroup>
<tr>
<td><h3 style="margin-top:0px;">작업시간(Hr)</h3></td>
<td style="float:right; margin-top:5px;">
<input type="button" value="추가" class="plm_btns" id="btnAddWork">
<input type="button" value="삭제" class="plm_btns" id="btnDelWork">
</td>
</tr>
</table>
<div class="plm_table_wrap" style="overflow-x: auto;">
<table id="gridWork"></table>
<!-- <div id="gridWorkPager"></div> -->
<textarea style="width:0px; height:0px; visibility: hidden;" id="gridWorkData">${gridWorkData}<c:if test="${empty gridWorkData}">[]</c:if></textarea><!-- [{},{},{}] -->
</div>
</div>
<div id="businessPopupFormWrap">
<table class="pmsPopupForm">
<colgroup>
<col width="10%">
<col width="90%">
</colgroup>
<tr>
<td class="input_title"><label for="">파일첨부</label></td>
<td>
<jsp:include page="/WEB-INF/view/common/fileWidget_include.jsp">
<jsp:param name="fileType" value="AS_DOC_01" />
<jsp:param name="fileTypeTxt" value="AS 파일02" />
<jsp:param name="viewType" value="LIST" />
<jsp:param name="isModify" value="<%=isModify %>" />
<jsp:param name="targetObjid" value="${info.OBJID}" />
<jsp:param name="actionType" value="${param.actionType}" />
<jsp:param name="writer" value="${info.WRITER}" />
<jsp:param name="connectUserId" value="${connectUserId}" />
</jsp:include>
</td>
</tr>
</table>
</div>
<div class="btn_wrap" style="height: 50px;">
<div class="plm_btn_wrap_center">
<% if(isModify){ %>
<input type="button" value="결재상신" id="btnAppr" class="plm_btns">
<input type="button" value="저장" id="btnSave" class="plm_btns create">
<% } %>
<input type="button" value="닫기" id="btnClose" class="plm_btns" onclick="javascript: self.close(0); return false;">
</div>
</div>
</section>
</form>
</body>
</html>