瀏覽代碼

Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-view
ㅅㄷㄴㅅ
# Conflicts:
# src/main/webapp/js/app/locales/locale-ko.js
# src/main/webapp/js/app/pomng/ITP_POMNG02010.js

dwkim 2 年之前
父節點
當前提交
164653394a

+ 50 - 36
src/main/webapp/app/pomng/POMNG03010.html

@@ -2,12 +2,13 @@
2 2
 	<div class="itp_cont">
3 3
 		<article class="itp_detail">
4 4
 			<div class="itp_det_head fix">
5
-				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>구매발주 생성-팝업있음</strong></h2>
5
+				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>구매발주 생성</strong></h2>
6 6
 				<div class="pull-right itp_cicon">
7
-					<button type="button" id="ITP_BTN_POMNG03010_SRH" class="btn btn-success btn-sm CTPO" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;발주생성&nbsp;</button>
8
-					<button type="button" id="ITP_BTN_POMNG03010_MODIFY" class="btn btn-success btn-sm NCPO" style="display: inline-block;"><i class="glyphicon "></i> &nbsp;신규발주생성&nbsp;</button>
9
-					<button type="button" id="ITP_BTN_POMNG03010_NEWREG" class="btn btn-primary btn-sm PRRJ" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;구매요청 반려&nbsp;</button>
10
-					<button type="button" id="ITP_BTN_POMNG03010_CANCELLIST" class="btn btn-warning btn-sm PO"><i class="glyphicon "></i> &nbsp;&nbsp;발주&nbsp;&nbsp;</button>
7
+					<button type="button" id="ITP_BTN_POMNG03010_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;조회&nbsp;&nbsp;</button>
8
+					<button type="button" id="ITP_BTN_POMNG03010_POCREATE" class="btn btn-success btn-sm CTPO" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;발주생성&nbsp;</button>
9
+					<button type="button" id="ITP_BTN_POMNG03010_NEWPOCREATE" class="btn btn-success btn-sm NCPO" style="display: inline-block;"><i class="glyphicon "></i> &nbsp;신규발주생성&nbsp;</button>
10
+					<button type="button" id="ITP_BTN_POMNG03010_REJECT" class="btn btn-primary btn-sm PRRJ" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;구매요청 반려&nbsp;</button>
11
+					<button type="button" id="ITP_BTN_POMNG03010_PO" class="btn btn-warning btn-sm PO"><i class="glyphicon "></i> &nbsp;&nbsp;발주&nbsp;&nbsp;</button>
11 12
 					<button type="button" id="ITP_BTN_POMNG03010_CANCELLIST" class="btn btn-warning btn-sm PRB"><i class="glyphicon "></i> &nbsp;취소/목록&nbsp;</button>
12 13
 				</div>
13 14
 			</div>
@@ -17,34 +18,38 @@
17 18
 						<div class="itp_srh_border fix">
18 19
 							<div class="col-xs-12">
19 20
 								<form id="ITP_FORM_POMNG03010_SEARCH" class="form-horizontal">
21
+									<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_SBRAND_ID" name="sbrandId" value="">
22
+									<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_SSTORE_ID" name="sstoreId" value="">
20 23
 									<div class="form-group">
21 24
 										<div class="col-xs-2 itp_ip itp_noMar">
22
-											<select id="ITP_FORM_POMNG04010_SERVICE_DLV_REQ_DT" class="form-control itp_input" name="serviceDlvReqDt">
25
+											<select id="ITP_FORM_POMNG03010_SERVICE_DLV_REQ_DT" class="form-control itp_input" name="serviceDlvReqDt">
23 26
 												<option value="A">납기요청일*</option>											
24 27
 											</select>
25 28
 										</div>											
26 29
 										<div class="col-xs-3 itp_ip itp_noMar">
27 30
 											<div class="input-daterange input-group date">
28
-												<input type="text" id="ITP_FORM_POMNG03010_SEARCH_DLV_REQ_DT" class="form-control itp_input" name="sdlvReqDt" value="">
31
+												<input type="text" id="ITP_FORM_POMNG03010_SEARCH_FROM_DT" class="form-control itp_input" name="fromDt" value="">
29 32
 												<span class="input-group-addon itp_date_to">~</span>
30
-												<input type="text" id="ITP_FORM_POMNG03010_SEARCH_DLV_CMPLT_DT" class="form-control itp_input" name="sdlvCmpltDt" value="">
33
+												<input type="text" id="ITP_FORM_POMNG03010_SEARCH_TO_DT" class="form-control itp_input" name="toDt" value="">
31 34
 											</div>
32 35
 										</div>
33 36
 									</div>
34 37
 									<div class="form-group" style="padding-top: 10px; border-top: 1px dotted #ccc;">
35 38
 										<div class="col-xs-2 itp_ip itp_noMar">
36
-											<input type="text" id="ITP_FORM_POMNG03010_SEARCH_SPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" />
39
+											<input type="text" id="ITP_FORM_POMNG03010_SEARCH_SSPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" />
40
+											<input type="hidden" id="ITP_FORM_POMNG03010_SEARCH_SSPPLY_ID" class="form-control itp_input" name="sspplyId" />
37 41
 										</div>
38 42
 										<div class="col-xs-1 itp_in" style="padding:0px; width:8%;">
39
-											<button type="button" id="ITP_BTN_POMNG03010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
40
-											<button type="button" id="ITP_BTN_POMNG03010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
43
+											<button type="button" id="ITP_FORM_POMNG03010_SSEARCH_SSPPLY_NM" class="btn btn-success btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
44
+											<button type="button" id="ITP_FORM_POMNG03010_SDELETE_SSPPLY_NM" class="btn btn-primary btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
41 45
 						                </div>
42 46
 										<div class="col-xs-2 itp_ip itp_noMar">
43
-											<input type="text" id="ITP_FORM_POMNG03010_SEARCH_DLV_PLACE" class="form-control itp_input" name="sdlvPlace" placeholder="매장/창고" />
47
+											<input type="text" id="ITP_FORM_POMNG03010_SEARCH_SWHS_NM" class="form-control itp_input" name="swhsNm" placeholder="매장/창고" />
48
+											<input type="hidden" id="ITP_FORM_POMNG03010_SEARCH_SWHS_ID" class="form-control itp_input" name="swhsId"  />
44 49
 										</div>
45 50
 										<div class="col-xs-1 itp_in" style="padding:0px; width:10%;">
46
-											<button type="button" id="ITP_BTN_POMNG03010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
47
-											<button type="button" id="ITP_BTN_POMNG03010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
51
+											<button type="button" id="ITP_FORM_POMNG03010_SSEARCH_SWHS_NM" class="btn btn-success btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
52
+											<button type="button" id="ITP_FORM_POMNG03010_SDELETE_SWHS_NM" class="btn btn-primary btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
48 53
 						                </div>
49 54
 										<div class="col-xs-4 itp_ip itp_noMar">
50 55
 											<input type="text" id="ITP_FORM_POMNG03010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="품목번호 or 품목명" />
@@ -68,9 +73,22 @@
68 73
 						<div class="col-xs-12">
69 74
 							<form id="ITP_FORM_POMNG03010_DETAIL" class="form-horizontal">
70 75
 								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_VIEW_CD" name="viewCd" value="C">
76
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_JOB_CD" name="jobCd" value="R">
77
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_BRAND_ID" name="brandId" value="">
78
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_STORE_ID" name="storeId" value="">
79
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_SPPLY_ID" name="spplyId" value="">
80
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_WHS_ID" name="whsId" value="">
81
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_LOCATION" name="location" value="">
82
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID" name="shmtWhsId" value="">
83
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION" name="shmtLocation" value="">
84
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_PODR_MGR_ID" name="podrMgrId" value="">
85
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_PODR_MGR_TEL_NO" name="podrMgrTelNo" value="">
86
+								
87
+								
88
+								
71 89
 					
72 90
 								<section class="itp_form_sec">
73
-									<h4 class="itp_form_tit">구매발주상세-발주생성</h4>
91
+									<h4 class="itp_form_tit">구매발주상세</h4>
74 92
 									<div class="itp_form_in">	
75 93
 										<div class="form-group">
76 94
 											<label class="col-xs-2 itp_lb">브랜드 *</label>
@@ -84,7 +102,7 @@
84 102
 											<label class="col-xs-2 itp_lb">공급업체명</label>
85 103
 											<div class="col-xs-4 itp_ip fnPchReqNm"></div>
86 104
 											<label class="col-xs-2 itp_lb">발주일자</label>
87
-											<div class="col-xs-4 itp_ip fnPoorDt"></div>
105
+											<div class="col-xs-4 itp_ip fnPodrDt"></div>
88 106
 										</div>
89 107
 									</div>
90 108
 									<div class="itp_form_in">	
@@ -92,8 +110,6 @@
92 110
 											<label class="col-xs-2 itp_lb">납품장소</label>
93 111
 											<div class="col-xs-4 itp_ip">
94 112
 												<div class="col-xs-a itp_in fnWhsNm"></div>
95
-												<div class="col-xs-a itp_in ">-</div>
96
-												<div class="col-xs-4 itp_in fnDtlLcn"></div>
97 113
 											</div>
98 114
 											<label class="col-xs-2 itp_lb">발주 총 금액</label>
99 115
 											<div class="col-xs-4 itp_ip fnPodrAmt"></div>
@@ -103,13 +119,11 @@
103 119
 										<div class="form-group">
104 120
 											<label class="col-xs-2 itp_lb">발주담당자</label>
105 121
 											<div class="col-xs-4 itp_ip fnPodrMgrNm"></div>
106
-											<label class="col-xs-2 itp_lb">배송구분</label>
122
+											<label class="col-xs-2 itp_lb">배송구분111</label>
107 123
 											<div class="col-xs-4 itp_ip">
108 124
 												<div class="col-xs-5 itp_in">
109
-													<select id="ITP_FORM_POMNG03010_VIEW_DLV_DVSN" class="form-control itp_input" name="dlvDvsn">
110
-														<option value="">본사배송</option>											
111
-														<option value="">공급사직송</option>											
112
-													</select>
125
+												    <select id="ITP_FORM_POMNG03010_DETAIL_DLV_DVSN" data-select-code="DLV_DVSN" data-check-required="empty" class="form-control itp_input" name="dlvDvsn">
126
+												    </select>
113 127
 												</div>
114 128
 											</div>
115 129
 										</div>
@@ -127,7 +141,7 @@
127 141
 											<label class="col-xs-2 itp_lb">출하창고</label>
128 142
 											<div class="col-xs-4 itp_ip">
129 143
 												<div class="col-xs-5 itp_in">
130
-													<input type="text" id="ITP_FORM_POMNG03010_DELETE_SHMT_WHS_NM" class="form-control itp_input" name="shmtWhsNm" />
144
+													<input type="text" id="ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM" class="form-control itp_input" name="shmtWhsNm" />
131 145
 												</div>
132 146
 												<div class="col-xs-4 itp_in" style="padding-left: 3px;">
133 147
 													<button type="button" id="ITP_BTN_POMNG03010_SEARCH_SHMT_WHS_NM" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
@@ -152,11 +166,11 @@
152 166
 						</div>
153 167
 					</div>
154 168
 				</div>
155
-				<div id="ITP_AJAX_POMNG03010_VIEW_CONTAINER">
169
+				<div id="ITP_AJAX_POMNG03010_NDETAIL_CONTAINER">
156 170
 					<div class="itp_form itp_type1 fix">
157 171
 						<div class="col-xs-12">
158
-							<form id="ITP_FORM_POMNG03010_VIEW" class="form-horizontal">
159
-								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_VIEW_CD" name="viewCd" value="C">
172
+							<form id="ITP_FORM_POMNG03010_NDETAIL" class="form-horizontal">
173
+								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_NDETAIL_CD" name="viewCd" value="C">
160 174
 					
161 175
 								<section class="itp_form_sec">
162 176
 									<h4 class="itp_form_tit">구매발주상세-신규발주생성</h4>
@@ -173,7 +187,7 @@
173 187
 											<label class="col-xs-2 itp_lb">공급업체명</label>
174 188
 											<div class="col-xs-4 itp_ip">
175 189
 												<div class="col-xs-5 itp_in">
176
-													<input type="text" id="ITP_FORM_POMNG03010_VIEW_SPPLY_NM" class="form-control itp_input" name="spplyNm" />
190
+													<input type="text" id="ITP_FORM_POMNG03010_NDETAIL_SPPLY_NM" class="form-control itp_input" name="spplyNm" />
177 191
 												</div>
178 192
 												<div class="col-xs-4 itp_in" style="padding-left: 3px;">
179 193
 													<button type="button" id="ITP_BTN_POMNG03010_SEARCH_SPPLY_NM" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
@@ -189,7 +203,7 @@
189 203
 											<label class="col-xs-2 itp_lb">납품장소</label>
190 204
 											<div class="col-xs-4 itp_ip">
191 205
 												<div class="col-xs-5 itp_in">
192
-													<input type="text" id="ITP_FORM_POMNG03010_VIEW_WHS_NM" class="form-control itp_input" name="whsNm"  />
206
+													<input type="text" id="ITP_FORM_POMNG03010_NDETAIL_WHS_NM" class="form-control itp_input" name="whsNm"  />
193 207
 												</div>
194 208
 												<div class="col-xs-4 itp_in" style="padding-left: 3px;">
195 209
 													<button type="button" id="ITP_BTN_POMNG03010_SEARCH_WHS_NM" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
@@ -226,15 +240,15 @@
226 240
 										<div class="itp_table_head fix" style="background:#f5f5f5;">
227 241
 											<h4 class="itp_table_tit">발주 품목</h4>
228 242
 											<div class="pull-right itp_cicon">
229
-												<button type="button" id="ITP_BTN_POMNG03010_VIEW_ADDROW" class="btn btn-primary btn-sm ARB" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;품목추가&nbsp;&nbsp;</button>
230
-												<button type="button" id="ITP_BTN_POMNG03010_VIEW_DELROW" class="btn btn-danger btn-sm DRB"><i class="glyphicon "></i>&nbsp;&nbsp;품목삭제&nbsp;&nbsp;</button>
243
+												<button type="button" id="ITP_BTN_POMNG03010_NDETAIL_ADDROW" class="btn btn-primary btn-sm ARB" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;품목추가&nbsp;&nbsp;</button>
244
+												<button type="button" id="ITP_BTN_POMNG03010_NDETAIL_DELROW" class="btn btn-danger btn-sm DRB"><i class="glyphicon "></i>&nbsp;&nbsp;품목삭제&nbsp;&nbsp;</button>
231 245
 											</div>
232 246
 										</div>
233
-										<div id="ITP_POMNG03010_VIEW_jqGrid_list" class="itp_tb_list">
234
-										  <div id="ITP_POMNG03010_VIEW_jqGridView" class="itp_views fix"></div>
235
-										  <table id="ITP_POMNG03010_VIEW_jqGrid"></table>
236
-										  <div id="ITP_POMNG03010_VIEW_jqGridPager"></div>
237
-										  <div id="ITP_POMNG03010_VIEW_jqGridEmpty" class="itp_no_data"></div>
247
+										<div id="ITP_POMNG03010_NDETAIL_jqGrid_list" class="itp_tb_list">
248
+										  <div id="ITP_POMNG03010_NDETAIL_jqGridView" class="itp_views fix"></div>
249
+										  <table id="ITP_POMNG03010_NDETAIL_jqGrid"></table>
250
+										  <div id="ITP_POMNG03010_NDETAIL_jqGridPager"></div>
251
+										  <div id="ITP_POMNG03010_NDETAIL_jqGridEmpty" class="itp_no_data"></div>
238 252
 										</div>
239 253
 									</div>
240 254
 								</section>												

+ 30 - 7
src/main/webapp/js/app/locales/locale-ko.js

@@ -177,13 +177,35 @@ const ITP_MSG_LOCALE = (function() {
177 177
 			"pchOdrStCd": "발주상태코드",
178 178
 			"pchOdrStNm": "발주상태명",
179 179
 			"podrDt": "발주일자",
180
-			"dlvReqDt": "납품요일",
180
+			"dlvReqDt": "납품요일",
181 181
 			"whsNm": "납품장소",
182 182
 			"podrTotalAmt": "총 발주금액",
183 183
 			"podrItemQty": "발주품목수",
184 184
 			"podrMgrNm": "발주담당자",
185
-			"pchPodrDtlNo": "항번",
186
-			"podrQty": "발주수량",
185
+            "pchPodrDtlNo": "발주항번",
186
+            "podrQty": "발주수량",
187
+            "podrAmt": "발주금액",
188
+            "dlvSttmtUnqNo": "납품번호",
189
+            "dlvSttmtDtlNo": "납품항번",
190
+            "dlvQty": "납품수량",
191
+            "whsQty": "입고수량",
192
+            "dlvSchDt": "납품예정일",
193
+            "dlvCmpltDt": "납품일자",
194
+            "whsCnfmNm": "입고확인자",
195
+            "dlvMgrNm": "납품자명",
196
+            "dlvMgrTelNo": "납품자전화번호",
197
+            "whsAmt": "입고금액",
198
+            "pchReqNm": "구매요청명",
199
+            "pchReqDt": "구매요청일",
200
+            "pchReqItemQty": "요청품목수",
201
+            "pchReqTotalAmt": "요청금액",
202
+            "pchReqRjctDt": "반려일자",
203
+            "pchReqRjctNm": "반려자",
204
+            "pchReqMgrNm": "요청자명",
205
+            "whsLocationNm": "납품창고",
206
+            "pchReqStNm": "요청상태명",
207
+            "pchReqUnqNo": "구매요청번호",
208
+            "viewNm": "신규여부",
187 209
 			"podrAmt": "발주금액",
188 210
 			"pchReqNm": "구매요청명",
189 211
 			"pchReqDt": "구매요청일",
@@ -198,7 +220,8 @@ const ITP_MSG_LOCALE = (function() {
198 220
 			"viewNm": "신규여부",
199 221
 			"pchOrdAmt": "발주금액",
200 222
 			"pchOrdSpplyAmt": "본사납품금액",
201
-			"whsPassQty": "발주가능수량"
223
+			"locationNm": "입고처",
224
+			"whsPassQty": "출고가능수량"
202 225
 		},
203 226
 		"table": {
204 227
 			"brandId": "브랜드ID",
@@ -282,9 +305,9 @@ const ITP_MSG_LOCALE = (function() {
282 305
 				"deletFaq": "TOP5에서도 함께 제거됩니다.<br>삭제 하시겠습니까?",
283 306
 				"tmpSave": "임시저장 하시겠습니까?",
284 307
 				"reqSave": "구매요청 하시겠습니까?",
285
-				"lackReqAmt": "구매한도가 부족합니다.",
286
-				"diffWrite": "수정은 작성자만 가능합니다.",
287
-				"notWrite": "수정할 수 없는 상태입니다."
308
+                "lackReqAmt": "구매한도가 부족합니다.",
309
+                "diffWrite": "수정은 작성자만 가능합니다.",
310
+                "notWrite": "수정할 수 없는 상태입니다."
288 311
 			},
289 312
 			"login": {
290 313
 				"help": "아이디와 비밀번호를 입력하세요.",

+ 835 - 0
src/main/webapp/js/app/pomng/ITP_POMNG03010.js

@@ -0,0 +1,835 @@
1
+require(['config'], function() {
2
+	require([
3
+		'kakao.map.util'
4
+	], function($) {
5
+		pageObj.init();
6
+	});
7
+});
8
+
9
+/********************************************************
10
+ --------------------------------------------------------
11
+ - Object 목록								            -
12
+ --------------------------------------------------------
13
+ * const gridColModel = {}	: 화면 Grid Object			*
14
+ * let pageObj = {}			: 화면공통 Object			*
15
+ * let listObj = {}			: 목록화면 Object			*
16
+ * let viewObj = {}			: 상세화면 Object			*
17
+ * let modifyObj = {}		: 수정화면 Object			*
18
+ * let createObj = {}		: 신규화면 Object			*
19
+ *******************************************************/
20
+
21
+/*화면 변수*/
22
+const POMNG03010_GRID_ID = '#ITP_POMNG03010_jqGrid';
23
+const POMNG03010_GRID_LIST = '#ITP_POMNG03010_jqGrid_list';
24
+const POMNG03010_GRID_PAGER = '#ITP_POMNG03010_jqGridPager';
25
+const POMNG03010_GRID_EMPTY = '#ITP_POMNG03010_jqGridEmpty';
26
+
27
+const POMNG03010_DETAIL_GRID_ID = '#ITP_POMNG03010_DETAIL_jqGrid';
28
+const POMNG03010_DETAIL_GRID_LIST = '#ITP_POMNG03010_DETAIL_jqGrid_list';
29
+const POMNG03010_DETAIL_GRID_PAGER = '#ITP_POMNG03010_DETAIL_jqGridPager';
30
+const POMNG03010_DETAIL_GRID_EMPTY = '#ITP_POMNG03010_DETAIL_jqGridEmpty';
31
+
32
+const POMNG03010_NDETAIL_GRID_ID = '#ITP_POMNG03010_NDETAIL_jqGrid';
33
+const POMNG03010_NDETAIL_GRID_LIST = '#ITP_POMNG03010_NDETAIL_jqGrid_list';
34
+const POMNG03010_NDETAIL_GRID_PAGER = '#ITP_POMNG03010_NDETAIL_jqGridPager';
35
+const POMNG03010_NDETAIL_GRID_EMPTY = '#ITP_POMNG03010_NDETAIL_jqGridEmpty';
36
+
37
+let ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
38
+
39
+/*API URL*/
40
+let API_DETAIL_GRID_LIST 		= '/api/pomng/po-target-grid-list';	// 목록
41
+let API_DETAIL_REJECT_LIST  	= '/api/pomng/reject-pchreq-target'; // 구매요청 선택한건 반려 처리 대상 리스트 
42
+let API_DETAIL_POPASS_CHK   	= '/api/pomng/po/chk-pchOrd'; // 목록에서 선택한 구매요청건에 대해 발주가능여부 체크 함
43
+let API_DETAIL_PO_INIT_INFO    	= '/api/pomng/po/init-pchOrd'; // 구매요청발주생성 오픈시 호출하여 데이타 세팅함
44
+let API_DETAIL_NEW_INIT_INFO    = '/api/pomng/po/init-poOrd'; // 신규발주생성 오픈시 호출하여 데이타 세팅함
45
+let API_DETAIL_SAVE 		    = '/api/pomng/po/save-pchPo';			// 저장
46
+
47
+
48
+/*화면 Grid ColModel*/
49
+const gridColModel = {
50
+	list: [
51
+		{
52
+			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
53
+			label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청고유번호
54
+			width: '10', fixed: false, align: 'center',
55
+			sortable: false, hidden: true
56
+		},
57
+		{
58
+			index: 'PCH_REQ_DTL_NO', name: 'pchReqDtlNo',
59
+			label: ITP_MSG_LOCALE.label.pchReqDtlNo, //구매요청상세번호
60
+			width: '13', fixed: false, align: 'center',
61
+			sortable: false, hidden: true
62
+		},
63
+		{
64
+			index: 'BRAND_ID', name: 'brandId',
65
+			label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
66
+			width: '10', fixed: false, align: 'center',
67
+			sortable: false, hidden: true
68
+		},
69
+		{
70
+			index: 'BRAND_NM', name: 'brandNm',
71
+			label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
72
+			width: '10', fixed: false, align: 'center',
73
+			sortable: false, hidden: false
74
+		},
75
+		{
76
+			index: 'STORE_ID', name: 'storeId',
77
+			label: ITP_MSG_LOCALE.label.storeId, //매장아이디
78
+			width: '13', fixed: false, align: 'center',
79
+			sortable: false, hidden: true
80
+		},
81
+		{
82
+			index: 'STORE_NM', name: 'storeNm',
83
+			label: ITP_MSG_LOCALE.label.storeNm, //매장명
84
+			width: '15', fixed: false, align: 'center',
85
+			sortable: false, hidden: true
86
+		},
87
+		{
88
+			index: 'SPPLY_ID', name: 'spplyId',
89
+			label: ITP_MSG_LOCALE.label.spplyId, //공급사아이디
90
+			width: '15', fixed: false, align: 'center',
91
+			sortable: false, hidden: true
92
+		},
93
+		{
94
+			index: 'SPPLY_NM', name: 'spplyNm',
95
+			label: ITP_MSG_LOCALE.label.spplyNm, //공급사명
96
+			width: '6', fixed: false, align: 'left',
97
+			sortable: false, hidden: false
98
+		},
99
+		{
100
+			index: 'WHS_ID', name: 'whsId',
101
+			label: ITP_MSG_LOCALE.label.whsId, //창고아이디
102
+			width: '10', fixed: false, align: 'center',
103
+			sortable: false, hidden: true
104
+		},
105
+		{
106
+			index: 'WHS_NM', name: 'whsNm',
107
+			label: ITP_MSG_LOCALE.label.whsNm, //창고명
108
+			width: '10', fixed: false, align: 'left',
109
+			sortable: false, hidden: false
110
+		},
111
+		{
112
+			index: 'LOCATION', name: 'location',
113
+			label: ITP_MSG_LOCALE.label.location, //창고상세코드
114
+			width: '10', fixed: false, align: 'center',
115
+			sortable: false, hidden: true
116
+		},
117
+		{
118
+			index: 'LOCATION_NM', name: 'locationNm',
119
+			label: ITP_MSG_LOCALE.label.locationNm, //창고상세명
120
+			width: '10', fixed: false, align: 'center',
121
+			sortable: false, hidden: true
122
+		},
123
+		{
124
+			index: 'ITEM_ID', name: 'itemId',
125
+			label: ITP_MSG_LOCALE.label.itemId, //품목아이디
126
+			width: '10', fixed: false, align: 'center',
127
+			sortable: false, hidden: false
128
+		},
129
+		{
130
+			index: 'ITEM_NM', name: 'itemNm',
131
+			label: ITP_MSG_LOCALE.label.itemNm, //품목명
132
+			width: '10', fixed: false, align: 'left',
133
+			sortable: false, hidden: false
134
+		},
135
+		{
136
+			index: 'UNIT_AMT', name: 'unitAmt',
137
+			label: ITP_MSG_LOCALE.label.unitAmt, //구매요청단가
138
+			width: '10', fixed: false, align: 'right',
139
+			sortable: false, hidden: true
140
+		},
141
+		{
142
+			index: 'PO_UNIT_AMT', name: 'poUnitAmt',
143
+			label: ITP_MSG_LOCALE.label.poUnitAmt, //발주단가
144
+			width: '10', fixed: false, align: 'right',
145
+			sortable: false, hidden: true
146
+		},
147
+		{
148
+			index: 'PCH_REQ_QTY', name: 'pchReqQty',
149
+			label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
150
+			width: '10', fixed: false, align: 'right',
151
+			sortable: false, hidden: false
152
+		},
153
+		{
154
+			index: 'DLV_REQ_DT', name: 'dlvReqDt',
155
+			label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
156
+			width: '10', fixed: false, align: 'center',
157
+			sortable: false, hidden: false
158
+		},
159
+		{
160
+			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
161
+			label: ITP_MSG_LOCALE.label.pchReqAmt, //납품요청금액
162
+			width: '10', fixed: false, align: 'right',
163
+			sortable: false, hidden: false
164
+		},
165
+		{
166
+			index: 'PCH_ORD_AMT', name: 'pchOrdAmt',
167
+			label: ITP_MSG_LOCALE.label.pchOrdSpplyAmt, //본사납품금액
168
+			width: '10', fixed: false, align: 'right',
169
+			sortable: false, hidden: false
170
+		},
171
+		{
172
+			index: 'LEAD_TIME', name: 'leadTime',
173
+			label: ITP_MSG_LOCALE.label.leadTime, //리드타임
174
+			width: '10', fixed: false, align: 'right',
175
+			sortable: false, hidden: false
176
+		}
177
+	],
178
+	detail: [
179
+		{
180
+			index: 'VIEW_CD', name: 'viewCd',
181
+			label: ITP_MSG_LOCALE.label.viewCd,
182
+			width: '10', fixed: false, align: 'center',
183
+			sortable: false, hidden: true
184
+		},
185
+		{
186
+			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
187
+			label: ITP_MSG_LOCALE.label.pchReqUnqNo,  //구매요청번호
188
+			width: '20', fixed: false, align: 'center',
189
+			sortable: false, hidden: true, edittype: 'text',
190
+			 editable: false
191
+		},
192
+		{
193
+			index: 'PCH_REQ_DTL_NO', name: 'pchReqDtlNo',
194
+			label: ITP_MSG_LOCALE.label.pchReqDtlNo, //구매요청항번
195
+			width: '30', fixed: false, align: 'center',
196
+			sortable: true, editable: false, edittype: 'text',
197
+			hidden: true
198
+		},
199
+		{
200
+			index: 'ITEM_ID', name: 'itemId',
201
+			label: ITP_MSG_LOCALE.label.itemId, // 품목아이디
202
+			width: '10', fixed: false, align: 'center',
203
+			sortable: false, editable: false, edittype: 'text',
204
+			hidden: false
205
+		},
206
+		{
207
+			index: 'ITEM_NM', name: 'itemNm',
208
+			label: ITP_MSG_LOCALE.label.itemNm, //품목명
209
+			width: '10', fixed: false, align: 'left',
210
+			sortable: false, editable: false, edittype: 'text',
211
+			hidden: false
212
+		},
213
+		{
214
+			index: 'UNIT_AMT', name: 'unitAmt',
215
+			label: ITP_MSG_LOCALE.label.unitAmt, //단가
216
+			width: '10', fixed: false, align: 'right',
217
+			sortable: false, editable: false, edittype: 'text',
218
+			hidden: false
219
+		},
220
+		{
221
+			index: 'UNIT', name: 'unit',
222
+			label: ITP_MSG_LOCALE.label.unit, //단위
223
+			width: '10', fixed: false, align: 'center',
224
+			sortable: false, editable: false, edittype: 'text',
225
+			hidden: false
226
+		},
227
+		{
228
+			index: 'PCH_REQ_QTY', name: 'pchReqQty',
229
+			label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
230
+			width: '10', fixed: false, align: 'right',
231
+			sortable: false, editable: false, edittype: 'text',
232
+			hidden: false
233
+		},
234
+		{
235
+			index: 'PODR_QTY', name: 'podrQty',
236
+			label: ITP_MSG_LOCALE.label.podrQty, //발주수량
237
+			width: '10', fixed: false, align: 'right',
238
+			sortable: false, editable: true, edittype: 'text',
239
+			editrules: {required: true}, hidden: false
240
+		},
241
+		{
242
+			index: 'PODR_AMT', name: 'podrAmt',
243
+			label: ITP_MSG_LOCALE.label.podrAmt, //발주금액
244
+			width: '10', fixed: false, align: 'right',
245
+			sortable: false, editable: false, edittype: 'text',
246
+			hidden: false
247
+		},
248
+		{
249
+			index: 'DLV_REQ_DT', name: 'dlvReqDt',
250
+			label: ITP_MSG_LOCALE.label.dlvReqDt, //납기요청일
251
+			width: '10', fixed: false, align: 'center',
252
+			sortable: false, editable: false, edittype: 'text',
253
+			hidden: false
254
+		},
255
+		{
256
+			index: 'WHS_PASS_QTY', name: 'whsPassQty',
257
+			label: ITP_MSG_LOCALE.label.whsPassQty, //출고가능수량
258
+			width: '10', fixed: false, align: 'right',
259
+			sortable: false, editable: false, edittype: 'text',
260
+			hidden: false
261
+		},
262
+		{
263
+			index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
264
+			label: ITP_MSG_LOCALE.label.brandUnitUnqNo, //브랜드단가고유번호
265
+			width: '10', fixed: false, align: 'center',
266
+			sortable: false, editable: false, edittype: 'text',
267
+			hidden: true
268
+		},
269
+		{
270
+			index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
271
+			label: ITP_MSG_LOCALE.label.storeUnitUnqNo, //매장단가고유번호
272
+			width: '10', fixed: false, align: 'center',
273
+			sortable: false, editable: false, edittype: 'text',
274
+			hidden: true
275
+		}
276
+	]
277
+};
278
+
279
+/*화면공통 Object*/
280
+let pageObj = {
281
+	init: function () {
282
+		this.ui.init();
283
+		this.event.init();
284
+		this.action();
285
+	},
286
+	ui: {
287
+		init: function () {
288
+			this.view();
289
+			this.grid();
290
+			this.ready();
291
+		},
292
+		view: function() {
293
+			// 버튼 권한설정
294
+			fn_proc_btn_auth('POMNG03010');
295
+
296
+			// 공통코드 표시
297
+			$('select').each(function() {
298
+				if($(this).data('select-code')) {
299
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
300
+				}
301
+			});
302
+
303
+			// 조회일자 지정
304
+			var now = new Date();
305
+			$('#ITP_TAB_POMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
306
+			$('#ITP_FORM_POMNG03010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
307
+			$('#ITP_FORM_POMNG03010_SEARCH_TO_DT').datepicker('setDate', new Date());
308
+			
309
+		},
310
+		grid: function() {
311
+			itp_fn_jqgrid_resize(POMNG03010_GRID_ID, POMNG03010_GRID_LIST, 'lg');
312
+			listObj.empty.init();
313
+			itp_fn_fire_window_resize();
314
+		},
315
+		ready: function() {
316
+			listObj.init();
317
+		}
318
+	},
319
+	action: function () {
320
+		var _this = this;
321
+		// 검색 납품장소
322
+		$('#ITP_FORM_POMNG03010_SSEARCH_SWHS_NM').on('click', function() {
323
+			console.log("=================================");
324
+			_this.popup('SW');
325
+		});
326
+		// 검색 납품장소 텍스트 삭제 버튼 클릭
327
+		$('#ITP_FORM_POMNG03010_SDELETE_SWHS_NM').on('click', function() {
328
+			console.log("=================================");
329
+			$('#ITP_FORM_POMNG03010_SEARCH_SWHS_NM').val('');
330
+			$('#ITP_FORM_POMNG03010_SEARCH_SWHS_ID').val('');
331
+			
332
+		});
333
+		
334
+		// 검색 공급사 
335
+		$('#ITP_FORM_POMNG03010_SSEARCH_SSPPLY_NM').on('click', function() {
336
+			console.log("=================================");
337
+			_this.popup('SS');
338
+		});
339
+		// 검색 텍스트 삭제 버튼 클릭
340
+		$('#ITP_FORM_POMNG03010_SDELETE_SSPPLY_NM').on('click', function() {
341
+			console.log("=================================");
342
+			$('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_NM').val('');
343
+			$('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_ID').val('');
344
+			
345
+		});
346
+		
347
+		
348
+		// 상세 출하창고
349
+		$('#ITP_BTN_POMNG03010_SEARCH_SHMT_WHS_NM').on('click', function() {
350
+			console.log("=================================");
351
+			_this.popup('SHW');
352
+		});
353
+		// 검색 납품장소 텍스트 삭제 버튼 클릭
354
+		$('#ITP_BTN_POMNG03010_DELETE_SHMT_WHS_NM').on('click', function() {
355
+			console.log("=================================");
356
+			$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val('');
357
+			$('#ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val('');
358
+			$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM').val('');
359
+			
360
+		});
361
+		
362
+	},
363
+	popup: function (arg) {
364
+		var popFn ;
365
+		// 팝업
366
+		if (arg == "SW") {
367
+			popFn = this.callback.searWhs;
368
+		} else if (arg == "SS") {
369
+			popFn = this.callback.searSpply;
370
+		}  else if (arg == "SHW") {
371
+			popFn = this.callback.searShmtWhs;
372
+		}
373
+		
374
+		const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
375
+		if (arg == "SW") {
376
+			fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
377
+		} else if (arg == "SS") {
378
+			fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
379
+		} else if (arg == "SHW") {
380
+			const key1 = {brandId:fn_make_user_info.get('brandId')};
381
+			fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
382
+		}
383
+		
384
+		
385
+	},
386
+	callback: {
387
+		searWhs: function(rowDataPop) {
388
+			console.log(rowDataPop);
389
+			if(rowDataPop) {
390
+				$('#ITP_FORM_POMNG03010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
391
+				$('#ITP_FORM_POMNG03010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
392
+			}
393
+			
394
+		},
395
+		searSpply: function(rowDataPop) {
396
+			console.log(rowDataPop);
397
+			if(rowDataPop) {
398
+				$('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
399
+				$('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
400
+			}
401
+			
402
+		},
403
+		searShmtWhs: function(rowDataPop) {
404
+			console.log(rowDataPop);
405
+			if(rowDataPop) {
406
+				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM').val(rowDataPop.whsNm + " - " + rowDataPop.locationNm);
407
+				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(rowDataPop.whsId);
408
+				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(rowDataPop.location);
409
+			}
410
+			
411
+		}
412
+	},
413
+	event: {
414
+		init: function () {
415
+			this.button();
416
+		},
417
+		button: function () {
418
+			// 버튼 클릭 이벤트
419
+			$('button').each(function() {
420
+				var id = $(this).attr('id');
421
+				$(this).on('click', function() {
422
+					switch (id) {
423
+						case 'ITP_BTN_POMNG03010_SRH'					: listObj.button.search();			break;	// 조회 버튼 클릭
424
+						case 'ITP_BTN_POMNG03010_POCREATE'				: listObj.button.chkpo(); 		break;	// prpo 버튼
425
+						case 'ITP_BTN_POMNG03010_NEWPOCREATE'			: listObj.button.newpocreate();	break;	// 신규po 버튼
426
+						case 'ITP_BTN_POMNG03010_REJECT'				: listObj.button.reject(); 		break;	// 반려
427
+						case 'ITP_BTN_POMNG03010_PO'					: modifyObj.button.save(); 			break;	// 발주
428
+						case 'ITP_BTN_POMNG03010_CANCELLIST'			: createObj.button.cancel(); 		break;	// 취소/목록 버튼
429
+						case 'ITP_BTN_POMNG03010_DETAIL_ADDROW'			: pageObj.grid.button.addRow(); 	break;	// 품목추가
430
+						case 'ITP_BTN_POMNG03010_DETAIL_DELROW'			: pageObj.grid.button.delRow(); 	break;	// 품목삭제
431
+					}
432
+				});
433
+			});
434
+
435
+		}
436
+	},
437
+	switchScreen: function(mode) {
438
+		$('.itp_det_head').find('button[id^="ITP_BTN_POMNG03010_"]').each(function(i) {
439
+			$(this).hide();
440
+		});
441
+		$('#ITP_TAB_POMNG03010').find('div[id$="_CONTAINER"]').each(function(i) {
442
+			$(this).hide();
443
+		});
444
+		if(mode == 'LIST') { // 목록
445
+			$('#ITP_AJAX_POMNG03010_LIST_CONTAINER').show();
446
+			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_SRH', '#ITP_BTN_POMNG03010_POCREATE','#ITP_BTN_POMNG03010_NEWPOCREATE', '#ITP_BTN_POMNG03010_REJECT']);
447
+			$('#ITP_FORM_POMNG03010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
448
+			$('#ITP_FORM_POMNG03010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
449
+		} else if(mode == 'NPC') { // 신규발주등록
450
+			$('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
451
+			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST', '#ITP_BTN_POMNG03010_DETAIL_ADDROW', '#ITP_BTN_POMNG03010_DETAIL_DELROW']);
452
+			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
453
+			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
454
+			
455
+			$('#ITP_FORM_POMNG03010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
456
+				$(this).attr('id') === 'ITP_FORM_POMNG03010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
457
+				if(elem.type === 'select') {
458
+					$(this).val('').prop('selected', true);
459
+				}
460
+			});
461
+			
462
+			
463
+			// 가맹점 정보 설정
464
+			/*
465
+			$('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
466
+			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
467
+			$('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
468
+
469
+			$('#ITP_FORM_POMNG03010_DETAIL .fnStoreNm').text('(자동부여)');
470
+			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').removeAttr('readonly');
471
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').hide();
472
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
473
+				if($(this).data('check-required')) $(this).data('check-required', '');
474
+				$(this).attr('disabled', true);
475
+			});
476
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').show();
477
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
478
+				if($(this).data('check-required')) $(this).data('check-required', 'empty');
479
+				$(this).attr('disabled', false);
480
+			});
481
+			*/
482
+			var now = new Date();
483
+			$('#ITP_TAB_POMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
484
+			$('#ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+5)));
485
+		} else if(mode == 'POC') { // 구매요청 발주
486
+			$('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
487
+			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST']);
488
+			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
489
+			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
490
+			/*
491
+			$('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
492
+			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
493
+			$('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
494
+
495
+			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').attr('readonly', true);
496
+			// $('#ITP_BTN_POMNG03010_RESET_PW').show();
497
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').show();
498
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
499
+				if($(this).data('check-required')) $(this).data('check-required', 'empty');
500
+				$(this).attr('disabled', false);
501
+			});
502
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').hide();
503
+			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
504
+				if($(this).data('check-required')) $(this).data('check-required', '');
505
+				$(this).attr('disabled', true);
506
+			});
507
+			*/
508
+
509
+		} 
510
+		/*
511
+		else if(mode == 'VIEW') { // 보기
512
+			$('#ITP_AJAX_POMNG03010_VIEW_CONTAINER').show();
513
+			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_MODIFY', '#ITP_BTN_POMNG03010_CANCELLIST']);
514
+		}
515
+		*/
516
+	}
517
+};
518
+
519
+/*목록화면 Object*/
520
+let listObj = {
521
+	init: function () {
522
+		this.grid.init();
523
+	},
524
+	itp_POMNG03010_search: false,
525
+	button: {
526
+		search: function() {
527
+			listObj.itp_POMNG03010_search = true;
528
+			let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
529
+			param.gridSize = $.jgrid.defaults.rowNum;
530
+			param.gridPage = $.jgrid.defaults.page;
531
+			$(POMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
532
+		},
533
+		pocreate: function(param) {
534
+			pageObj.switchScreen('POC');
535
+			itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
536
+			modifyObj.init(param);
537
+		},
538
+		newpocreate: function() {
539
+			pageObj.switchScreen('NPC');
540
+			itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
541
+			createObj.init();
542
+		},
543
+		reject: function() {
544
+			//팝업 오픈
545
+			//pageObj.switchScreen('NPC');
546
+			//itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
547
+			//createObj.init();
548
+		},
549
+		chkpo: function() {	
550
+			let gridUpdateData = [];
551
+			console.log("==================");
552
+			const rowKey = $(POMNG03010_GRID_ID).getGridParam('selrow');
553
+			console.log(rowKey);
554
+		    if (!rowKey) {
555
+				console.log("################");
556
+		    	return;
557
+		    }
558
+	
559
+		    var selectedIds = $(POMNG03010_GRID_ID).getGridParam('selarrrow');
560
+			
561
+		    for (var i=selectedIds.length-1; i>=0; i--) {
562
+				gridUpdateData.push($(POMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]));	
563
+			}
564
+			
565
+			let param = {};
566
+			param.brandId=fn_make_user_info.get('brandId');
567
+			param.gridUpdateData = gridUpdateData;
568
+			console.log(JSON.stringify(param));
569
+			var chkFn = function(result) {
570
+				console.log(result);
571
+				if (result.code == "Y") {
572
+					//발수 생성화면으로 전화 
573
+					listObj.button.pocreate(param);
574
+				}
575
+			};
576
+			fn_ajax_call(API_DETAIL_POPASS_CHK, JSON.stringify(param), chkFn, 'POST');
577
+		}, 
578
+	},
579
+	empty: {
580
+		init: function() {
581
+			var _this = this;
582
+			this.push();
583
+			$(POMNG03010_GRID_EMPTY).on('click', function() {
584
+				_this.back();
585
+				_this.itp_POMNG03010_param.gridSize = $.jgrid.defaults.rowNum;
586
+				$(POMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_POMNG03010_param)}).trigger('reloadGrid');
587
+			});
588
+		},
589
+		itp_POMNG03010_param: {},
590
+		push: function() {
591
+			let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
592
+			listObj.itp_POMNG03010_param = param;
593
+		},
594
+		back: function() {
595
+			$('#ITP_FORM_POMNG03010_SEARCH_FROM_DT').val(this.itp_POMNG03010_param.fromDt);
596
+			$('#ITP_FORM_POMNG03010_SEARCH_TO_DT').val(this.itp_POMNG03010_param.toDt);
597
+			$('#ITP_FORM_POMNG03010_SEARCH_SPPLY_ID').val(this.itp_POMNG03010_param.sspplyId);
598
+			$('#ITP_FORM_POMNG03010_SEARCH_SPPLY_NM').val(this.itp_POMNG03010_param.sspplyNm);
599
+			$('#ITP_FORM_POMNG03010_SEARCH_WHS_NM').val(this.itp_POMNG03010_param.swhsNm);
600
+			$('#ITP_FORM_POMNG03010_SEARCH_WHS_ID').val(this.itp_POMNG03010_param.swhsId);
601
+			$('#ITP_FORM_POMNG03010_SEARCH_ITEM_NM').val(this.itp_POMNG03010_param.sitemNm);
602
+		}
603
+	},
604
+	grid: {
605
+		init: function () {
606
+			// 데이터 없을때
607
+			listObj.empty.push();
608
+			this.search();
609
+		},
610
+		colModel: gridColModel.list,
611
+		search: function() {
612
+			pageObj.switchScreen('LIST');
613
+			this.unload();
614
+			this.load();
615
+		},
616
+		load: function() {
617
+			let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
618
+			param.gridSize = $.jgrid.defaults.rowNum;
619
+			
620
+			var option = {
621
+				multiselect: true,
622
+				autowidth: true,
623
+				gridId: POMNG03010_GRID_ID,
624
+				colModel: gridColModel.list,
625
+				param: param,
626
+				url: DOMAIN + API_DETAIL_GRID_LIST,
627
+				pager: POMNG03010_GRID_PAGER,
628
+				loadComplete: function(data) {
629
+					console.log(data);
630
+					itp_fn_grid_load_complete(data, POMNG03010_GRID_ID, true, 'number', 'POMNG03010', listObj.itp_POMNG03010_search, listObj.empty, true, data.gridRecords, true);
631
+					var ids = $(POMNG03010_GRID_ID).getDataIDs();
632
+					$.each(ids, function(idx, rowId) {
633
+						$(POMNG03010_GRID_ID).jqGrid('setCell', rowId, 'storeId', '', ITP_GRID_COL_STYLE.link);
634
+					});
635
+				},
636
+				onPaging: function(action) {
637
+					itp_fn_grid_paging(POMNG03010_GRID_ID, action, param);
638
+				}
639
+			};
640
+			itp_fn_grid_make_remote(option);
641
+		},
642
+		button: {
643
+		},
644
+		unload : function() {
645
+			$.jgrid.gridUnload(POMNG03010_GRID_ID);
646
+		},
647
+		clearData : function() {
648
+			$(POMNG03010_GRID_ID).jqGrid('clearGridData', true);
649
+			$(POMNG03010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
650
+			$(POMNG03010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
651
+			$(POMNG03010_GRID_EMPTY).show();
652
+		}
653
+	}
654
+};
655
+
656
+/*수정화면 Object*/
657
+let modifyObj = {
658
+	init: function (param) {
659
+		this.load(param);
660
+	},
661
+	button: {
662
+		modify: function (param) {
663
+			itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
664
+			const selectVal = $('#ITP_FORM_POMNG03010_VIEW_STORE_ID').val();
665
+			const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
666
+			var param = $.param(key);
667
+			console.log(param);
668
+			modifyObj.load(param);
669
+		},
670
+		save: function() {
671
+			const formId = '#ITP_FORM_POMNG03010_DETAIL';
672
+			itp_fn_form_clear_validate(null, formId);
673
+
674
+			// console.log($(formId).serializeObject());
675
+			if (itp_fn_form_event.isValid(formId)) {
676
+				var modalFn = {
677
+					callBack: () => {
678
+						itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
679
+						
680
+						let gridInsertData = [];
681
+						const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
682
+						
683
+						$.each(rowData, function(key, value) {
684
+							gridInsertData.push(value);
685
+						});
686
+		
687
+						let param = $(formId).serializeObject();
688
+						param.gridInsertData = gridInsertData;
689
+						
690
+						var searhFn = function () {
691
+							ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
692
+							modifyObj.grid.clearData();
693
+							createObj.button.cancel();
694
+						}
695
+						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
696
+					}
697
+				};
698
+				itp_fn_modal_confirm('발주 진행 하시겠습니까?', modalFn);
699
+			}
700
+		}
701
+	},
702
+	
703
+	load: function(param) {
704
+		fn_ajax_call(API_DETAIL_PO_INIT_INFO, JSON.stringify(param), this.callback, 'POST');
705
+	},
706
+	callback: function (result) {
707
+		console.log(result);
708
+		pageObj.switchScreen('POC');
709
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_VIEW_CD').val('C');
710
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(result.brandId);
711
+		$('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(result.brandNm);
712
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(result.storeId);
713
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SPPLY_ID').val(result.spplyId);
714
+		$('#ITP_FORM_POMNG03010_DETAIL .fnPchReqNm').text(result.spplyNm);
715
+		$('#ITP_FORM_POMNG03010_DETAIL .fnPodrDt').text(result.podrDt);
716
+		$('#ITP_FORM_POMNG03010_DETAIL .fnWhsNm').text(result.dlvPlace);
717
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_WHS_ID').val(result.whsId);
718
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_LOCATION').val(result.location);
719
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_PODR_MGR_ID').val(result.podrMgrId);
720
+		$('#ITP_FORM_POMNG03010_DETAIL .fnPodrMgrNm').text(result.podrMgrNm);
721
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_PODR_MGR_TEL_NO').val(result.podrMgrTelNo);
722
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_DVSN').val(result.dlvDvsn);
723
+		//$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_').val(result.dlvDvsnNm);
724
+		$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(result.podrTotalAmt);
725
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').val(result.dlvReqDt);
726
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(result.shmtWhsId);
727
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DELETE_SHMT_WHS_NM').val(result.shmtWhsNm + " - " + result.shmtLocationNm );
728
+		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(result.shmtLocation);
729
+		
730
+		// 품목  리스트 조회
731
+		modifyObj.grid.init('DETAIL', result.itemList);
732
+		// modifyObj.grid.load(result.spplyMgrList);
733
+	},
734
+	grid: {
735
+		init: function(mode, gridRows) {
736
+			this.gridId = POMNG03010_DETAIL_GRID_ID;
737
+			this.gridList = POMNG03010_DETAIL_GRID_LIST;
738
+			this.gridEmpty = POMNG03010_DETAIL_GRID_EMPTY;
739
+			this.gridRows = gridRows;
740
+			this.load(mode, gridRows);
741
+		},
742
+		gridId: '',
743
+		mode: 'DETAIL',
744
+		button: {},
745
+		gridList: '',
746
+		gridEmpty: '',
747
+		gridRows: '',
748
+		load: function(mode, gridRows) {
749
+			var _this = this;
750
+			var option = {
751
+				gridId: _this.gridId,
752
+				colModel: gridColModel.detail,
753
+				data: gridRows,
754
+				cellEdit: true,
755
+				multiselect: false,
756
+				// cellEdit: (mode !== 'VIEW'),
757
+				loadComplete: function(data) {
758
+					console.log(data);
759
+					$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
760
+					(Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
761
+				},
762
+				onCellSelect: function(rowid, cellIdx, cellValue) {
763
+					console.log('mode ===> ' + mode);
764
+					POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
765
+				},
766
+				afterSaveCell: function(rowid,name,val,iRow,iCol) {
767
+					// 구매요청금액 계산 (기존금액과 )
768
+					var	unitAmt = jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-3);
769
+					jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{podrAmt: parseInt(val)*parseInt(unitAmt)});	
770
+					
771
+					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
772
+					_this.recal();
773
+				}
774
+			};
775
+			itp_fn_grid_make_local(option);
776
+		},
777
+		recal: function() {
778
+			//PCH_REQ_AMT
779
+			console.log("==========================================");
780
+			const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
781
+			var podrAmt = 0 ;
782
+			console.log("####################################");
783
+			$.each(rowData, function(key, value) {
784
+				console.log(rowData);
785
+				if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
786
+					podrAmt = podrAmt + parseInt(value.podrAmt) ;
787
+				}
788
+				
789
+			});
790
+			$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
791
+		},
792
+		clearData : function() {
793
+			$(POMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
794
+			$(POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
795
+			$(POMNG03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
796
+			$(POMNG03010_DETAIL_GRID_EMPTY).show();
797
+		}
798
+	},
799
+};
800
+
801
+/*신규화면 Object*/
802
+let createObj = {
803
+	init: function () {
804
+		$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
805
+		$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
806
+		
807
+	},
808
+	button: {
809
+		cancel: function() {
810
+			document.getElementById('ITP_FORM_POMNG03010_DETAIL').reset();
811
+			listObj.grid.search();
812
+		},
813
+		save: function() {
814
+			const formId = '#ITP_FORM_POMNG03010_DETAIL';
815
+			itp_fn_form_clear_validate(null, formId);
816
+
817
+			// console.log($(formId).serializeObject());
818
+			if (itp_fn_form_event.isValid(formId)) {
819
+				var modalFn = {
820
+					callBack: (args) => {
821
+						itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
822
+						let param = $(formId).serializeObject();
823
+						console.log(JSON.stringify(param));
824
+						var searhFn = function () {
825
+							ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
826
+							listObj.grid.search();
827
+						}
828
+						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
829
+					}
830
+				};
831
+				itp_fn_modal_confirm('저장 하시겠습니까?', modalFn);
832
+			}
833
+		}
834
+	}
835
+};