541 lines
17 KiB
Plaintext
541 lines
17 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>
|
|
<c:set var="now" value="<%=new java.util.Date() %>" />
|
|
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
|
|
|
|
<script type="text/javascript">
|
|
var grid;
|
|
$(document).ready(function(){
|
|
$('.select2').select2();
|
|
$("#btnsearch").click(function(){
|
|
|
|
$("#process_cd").val($("#process1_cd option:selected").text());
|
|
|
|
gridFn.search();
|
|
});
|
|
|
|
$("#sup_cd").change(function(){
|
|
fn_change_sup_cd(this.value);
|
|
});
|
|
|
|
$("#btnSave").click(function(){
|
|
fn_save();
|
|
});
|
|
|
|
$("#Year").change(function(){
|
|
Swal.fire('123');
|
|
//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");
|
|
});
|
|
|
|
grid = $("#expenseDetailGrid").jqGrid({
|
|
url: ""
|
|
,datatype: "local"
|
|
,colNames: ["OBJID","1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]
|
|
,colModel: [
|
|
{name:"OBJID",index:"OBJID", width: 0, align:"center", hidden: true, sortable:false, editable:false}
|
|
,{name:"MON1" ,index:"MON1" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON2" ,index:"MON2" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON3" ,index:"MON3" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON4" ,index:"MON4" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON5" ,index:"MON5" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON6" ,index:"MON6" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON7" ,index:"MON7" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON8" ,index:"MON8" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON9" ,index:"MON9" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON10" ,index:"MON10" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON11" ,index:"MON11" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
,{name:"MON12" ,index:"MON12" , width:120, align: "right", hidden:false, sortable:false, editable: true
|
|
,formatter: "integer"
|
|
,editoptions:{
|
|
dataEvents: [
|
|
{type:"change", fn:function(e) {
|
|
gridFn.footerSummary();
|
|
}}
|
|
]
|
|
,dataInit: function(e){
|
|
e.style.textAlign = "right";
|
|
e.style.fontSize = 13;
|
|
}
|
|
}
|
|
}
|
|
|
|
]
|
|
,rownumbers : true
|
|
,viewrecords : true
|
|
,height : 25
|
|
,multiselect : false
|
|
,shrinkToFit : false
|
|
,autowidth : true
|
|
,sortable : false
|
|
,rowNum : 3
|
|
,forceFit : false //컬럼의 width를 변화시킬때 그리드의 width를 고정 여부
|
|
,jsonReader : {repeatitems: false}
|
|
,mtype :"POST"
|
|
,footerrow : true //바닥합계
|
|
,userDataOnFooter: true //바닥합계
|
|
,loadComplete: function(){
|
|
|
|
//헤더 부분 늘리기
|
|
//$("#expenseDetailGrid_rn").css("width","70px");
|
|
|
|
//footer 커스텀..
|
|
$(".ui-state-default.jqgrid-rownum").text("합계");
|
|
//$(".ui-state-default.jqgrid-rownum").css("width","70px");
|
|
|
|
//$(".ui-state-default.jqgrid-rownum").text("합계");
|
|
//$(".ui-state-default.jqgrid-rownum").text("합계");
|
|
|
|
$(".ui-jqgrid-ftable td:eq(1)").remove();
|
|
$(".ui-jqgrid-ftable td:eq(1)").attr({id:"SUM1"});
|
|
$(".ui-jqgrid-ftable td:eq(2)").attr({id:"SUM2"});
|
|
$(".ui-jqgrid-ftable td:eq(3)").attr({id:"SUM3"});
|
|
$(".ui-jqgrid-ftable td:eq(4)").attr({id:"SUM4"});
|
|
$(".ui-jqgrid-ftable td:eq(5)").attr({id:"SUM5"});
|
|
$(".ui-jqgrid-ftable td:eq(6)").attr({id:"SUM6"});
|
|
$(".ui-jqgrid-ftable td:eq(7)").attr({id:"SUM7"});
|
|
$(".ui-jqgrid-ftable td:eq(8)").attr({id:"SUM8"});
|
|
$(".ui-jqgrid-ftable td:eq(9)").attr({id:"SUM9"});
|
|
$(".ui-jqgrid-ftable td:eq(10)").attr({id:"SUM10"});
|
|
$(".ui-jqgrid-ftable td:eq(11)").attr({id:"SUM11"});
|
|
$(".ui-jqgrid-ftable td:eq(12)").attr({id:"SUM12"});
|
|
}
|
|
,onCellSelect: function(rowid,icol,cellcontent,e){
|
|
|
|
}
|
|
|
|
});
|
|
|
|
gridFn.modify_search();
|
|
|
|
|
|
setTimeout(function() {
|
|
gridFn.addRowAuto();
|
|
|
|
//$(".ui-state-default.jqgrid-rownum").eq(0).text("공급가액");
|
|
//$(".ui-state-default.jqgrid-rownum").eq(0).css("width","70px");
|
|
|
|
//$(".ui-state-default.jqgrid-rownum").eq(1).text("세액");
|
|
//$(".ui-state-default.jqgrid-rownum").eq(1).css("width","300px");
|
|
}, 1000);
|
|
|
|
|
|
});
|
|
|
|
|
|
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]);
|
|
}
|
|
}
|
|
,addRowAuto : function() {
|
|
for(var i = 0; i < 2; i++){
|
|
var newId = grid.getGridParam("reccount")+1;
|
|
var addData = {
|
|
"OBJID": "",
|
|
"MON1" : "",
|
|
"MON2" : "",
|
|
"MON3" : "",
|
|
"MON4" : "",
|
|
"MON5" : "",
|
|
"MON6" : "",
|
|
"MON7" : "",
|
|
"MON8" : "",
|
|
"MON9" : "",
|
|
"MON10" : "",
|
|
"MON11" : "",
|
|
"MON12" : ""
|
|
};
|
|
grid.addRowData(newId, addData);
|
|
grid.jqGrid("editRow", newId);
|
|
}
|
|
}
|
|
,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/modifysearchPartMgmt.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;
|
|
var colSum4 = 0;
|
|
var colSum5 = 0;
|
|
var colSum6 = 0;
|
|
var colSum7 = 0;
|
|
var colSum8 = 0;
|
|
var colSum9 = 0;
|
|
var colSum10 = 0;
|
|
var colSum11 = 0;
|
|
var colSum12 = 0;
|
|
$("input[id*=MON1]").each(function(){ if($.isNumeric($(this).val())){ colSum1 += parseInt($(this).val()); } });
|
|
$("input[id*=MON2]").each(function(){ if($.isNumeric($(this).val())){ colSum2 += parseInt($(this).val()); } });
|
|
$("input[id*=MON3]").each(function(){ if($.isNumeric($(this).val())){ colSum3 += parseInt($(this).val()); } });
|
|
$("input[id*=MON4]").each(function(){ if($.isNumeric($(this).val())){ colSum4 += parseInt($(this).val()); } });
|
|
$("input[id*=MON5]").each(function(){ if($.isNumeric($(this).val())){ colSum5 += parseInt($(this).val()); } });
|
|
$("input[id*=MON6]").each(function(){ if($.isNumeric($(this).val())){ colSum6 += parseInt($(this).val()); } });
|
|
$("input[id*=MON7]").each(function(){ if($.isNumeric($(this).val())){ colSum7 += parseInt($(this).val()); } });
|
|
$("input[id*=MON8]").each(function(){ if($.isNumeric($(this).val())){ colSum8 += parseInt($(this).val()); } });
|
|
$("input[id*=MON9]").each(function(){ if($.isNumeric($(this).val())){ colSum9 += parseInt($(this).val()); } });
|
|
$("input[id*=MON10]").each(function(){ if($.isNumeric($(this).val())){ colSum10 += parseInt($(this).val()); } });
|
|
$("input[id*=MON11]").each(function(){ if($.isNumeric($(this).val())){ colSum11 += parseInt($(this).val()); } });
|
|
$("input[id*=MON12]").each(function(){ if($.isNumeric($(this).val())){ colSum12 += 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()); } });
|
|
|
|
$("#SUM1").text(numberWithCommas(colSum1+""));
|
|
$("#SUM2").text(numberWithCommas(colSum2+""));
|
|
$("#SUM3").text(numberWithCommas(colSum3+""));
|
|
$("#SUM4").text(numberWithCommas(colSum4+""));
|
|
$("#SUM5").text(numberWithCommas(colSum5+""));
|
|
$("#SUM6").text(numberWithCommas(colSum6+""));
|
|
$("#SUM7").text(numberWithCommas(colSum7+""));
|
|
$("#SUM8").text(numberWithCommas(colSum8+""));
|
|
$("#SUM9").text(numberWithCommas(colSum9+""));
|
|
$("#SUM10").text(numberWithCommas(colSum10+""));
|
|
$("#SUM11").text(numberWithCommas(colSum11+""));
|
|
$("#SUM12").text(numberWithCommas(colSum12+""));
|
|
|
|
//$("#total_amount").val(numberWithCommas(colSum1+""));
|
|
//$("#summuryTotalCASH_USED").text(numberWithCommas(colSum2+""));
|
|
//$("#summuryTotalPAYMENT" ).text(numberWithCommas(colSum3+""));
|
|
//$("#summuryTotal").text(numberWithCommas((colSum1+colSum2-colSum3)+""));
|
|
|
|
}
|
|
}
|
|
|
|
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("저장되었습니다.");
|
|
};
|
|
if(typeof opener.fn_search =="function"){ opener.fn_search() };
|
|
gridFn.modify_search();
|
|
}
|
|
,error: function(jqxhr, status, error){
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
function fn_gridresearch(){
|
|
gridFn.modify_search();
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<form name="form1" id="form1" action="" method="post">
|
|
<input type="hidden" name="process_cd" id="process_cd">
|
|
<input type="hidden" name="status_cd" id="status_cd">
|
|
<input type="hidden" name="material_master_objid" id="material_master_objid" value="${info.MATERIAL_MASTER_OBJID}">
|
|
<section>
|
|
<div class="plm_menu_name">
|
|
<h2><span>매입가등록</span></h2>
|
|
</div>
|
|
|
|
<div style="font-size:12px;float:left;margin:13px 13px 5px 13px">연도
|
|
<select name="Year" id="Year" class="select2" autocomplete="off">
|
|
<option value="">선택</option>
|
|
<c:forEach begin="${sysYear-4}" end="${sysYear}" var="req_year">
|
|
<option value="${req_year}"${param.Year eq req_year ? 'selected':'' }>${req_year}</option>
|
|
</c:forEach>
|
|
</select>
|
|
</div>
|
|
<div class="btn_wrap" style="margin-right:8px">
|
|
<div class="plm_btn_wrap">
|
|
<!-- <input type="button" value="조회" class="plm_btns" id="btnsearch" name="btnsearch" style="background:#dfeffc"> -->
|
|
|
|
<c:if test="${info.RECV_USERID eq connectUserId or 'plm_admin' eq connectUserId}">
|
|
<input type="button" value="저장" class="plm_btns" id="btnSave" name="btnSave" style="background:#dfeffc">
|
|
</c:if>
|
|
<!-- <input type="button" value="삭제" class="plm_btns" id="btnDel" name="btnDel" style="background:#dfeffc"> -->
|
|
<input type="button" value="닫기" class="plm_btns" style="background:#dfeffc" onclick="window.close();" >
|
|
<!-- <input type="button" value="결재상신" class="plm_btns" id="btnAppr" name="btnAppr" style="background:#dfeffc"> -->
|
|
</div>
|
|
</div>
|
|
<div style="clear:both"></div>
|
|
<style>.ui-jqgrid-bdiv {height:100px!important}</style>
|
|
<div id="plm_table_wrap1" style="padding:0 8 0 8;margin-top:15px">
|
|
<div style="">
|
|
<div style="height:100px;">
|
|
<table id="expenseDetailGrid""></table>
|
|
<!-- <div id="jqGridPager"></div> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<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> |