Browse Source

구매요청및 발주 현황 수정

dwkim 2 years ago
parent
commit
7ae4c32ce5

+ 3 - 1
src/main/webapp/js/app/locales/locale-ko.js

@@ -227,7 +227,9 @@ const ITP_MSG_LOCALE = (function() {
227 227
 			"shmtReqStCd": "출하상태코드",
228 228
 			"shmtQty": "출하수량",
229 229
 			"shmtAmt": "출하금액",
230
-			"whsDt": "입고일"
230
+			"whsDt": "입고일",
231
+			"pchReqDtlStNm": "요청상세상태",
232
+			"dlvDvsnNm": "배송구분"
231 233
 		},
232 234
 		"table": {
233 235
 			"brandId": "브랜드ID",

+ 63 - 36
src/main/webapp/js/app/pomng/ITP_POMNG02010.js

@@ -38,6 +38,7 @@ const POMNG02010_DETAIL_GRID_EMPTY = '#ITP_POMNG02010_DETAIL_jqGridEmpty';
38 38
 let ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
39 39
 
40 40
 let POMNG02010_GRID_LAST_ROW_ID;
41
+let SCREEN_MODE;
41 42
 
42 43
 
43 44
 //let ITP_COMMON_ASSGN_TASK = fn_make_common_cd_list(CODE_LIST, 'ASSGN_TASK', true, '담당업무');
@@ -149,7 +150,7 @@ const gridColModel = {
149 150
 			index: 'VIEW_CD', name: 'viewCd',
150 151
 			label: ITP_MSG_LOCALE.label.viewCd,
151 152
 			width: '10', fixed: false, align: 'center',
152
-			sortable: false, hidden: false
153
+			sortable: false, hidden: true
153 154
 		},
154 155
 		{
155 156
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
@@ -189,22 +190,36 @@ const gridColModel = {
189 190
 			index: 'UNIT_AMT', name: 'unitAmt',
190 191
 			label: ITP_MSG_LOCALE.label.unitAmt,
191 192
 			width: '10', fixed: false, align: 'center',
192
-			sortable: false, editable: false, edittype: 'text', hidden: false
193
+			sortable: false, editable: false, edittype: 'text', hidden: false,
194
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
193 195
 		},
194 196
 		{
195 197
 			index: 'PCH_REQ_QTY', name: 'pchReqQty',
196 198
 			label: ITP_MSG_LOCALE.label.pchReqQty, //단가
197 199
 			width: '10', fixed: false, align: 'right',
198 200
 			sortable: true, editable: true, edittype: 'text',
199
-			editrules: {required: true, number:true}
201
+			editrules: {required: true, number:true},
202
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
200 203
 		},
201 204
 		{
202 205
 			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
203 206
 			label: ITP_MSG_LOCALE.label.pchReqAmt,
204 207
 			width: '10', fixed: false, align: 'right',
208
+			sortable: false, editable: false, edittype: 'text', hidden: false,
209
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
210
+		},
211
+		{
212
+			index: 'PCH_REQ_DTL_ST_NM', name: 'pchReqDtlStNm',
213
+			label: ITP_MSG_LOCALE.label.pchReqDtlStNm,
214
+			width: '10', fixed: false, align: 'center',
205 215
 			sortable: false, editable: false, edittype: 'text', hidden: false
206 216
 		},
207
-
217
+		{
218
+			index: 'PCH_REQ_DTL_ST_CD', name: 'pchReqDtlStCd',
219
+			label: ITP_MSG_LOCALE.label.pchReqDtlStNm,
220
+			width: '10', fixed: false, align: 'right',
221
+			sortable: false, editable: false, edittype: 'text', hidden: true
222
+		},
208 223
 		{
209 224
 			index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
210 225
 			label: ITP_MSG_LOCALE.label.brandUnitUnqNo,
@@ -359,13 +374,18 @@ let pageObj = {
359 374
 					}
360 375
 				});
361 376
 			});
362
-
377
+			
363 378
 			$('body').on('click', function(e) {
364 379
 				var gridId = POMNG02010_DETAIL_GRID_ID.replace('#', '');
365 380
 				var rids = $(POMNG02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
366 381
 				var last_row_id = rids[rids.length - 1];
367
-				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');
382
+				
383
+				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');	
384
+				
385
+				pageObj.grid.recal();
368 386
 			});
387
+
388
+			
369 389
 		}
370 390
 	},
371 391
 	switchScreen: function(mode) {
@@ -380,6 +400,7 @@ let pageObj = {
380 400
 			$('#ITP_AJAX_POMNG02010_LIST_CONTAINER').show();
381 401
 			$('#ITP_FORM_POMNG02010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
382 402
 			$('#ITP_FORM_POMNG02010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
403
+			SCREEN_MODE = 'LIST' ;
383 404
 		} else if(mode == 'ADD') { // 등록
384 405
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE']);
385 406
 			$('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
@@ -390,6 +411,7 @@ let pageObj = {
390 411
 					$(this).val('').prop('selected', true);
391 412
 				}
392 413
 			});
414
+			SCREEN_MODE = 'DETAIL' ;
393 415
 			
394 416
 		} else if(mode == 'MODIFY') { // 수정
395 417
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE', '#ITP_BTN_POMNG02010_REQ']);
@@ -397,15 +419,16 @@ let pageObj = {
397 419
 			$('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
398 420
 			$('#ITP_FORM_POMNG02010_DETAIL .itp_form_info').show();
399 421
 			$('#ITP_FORM_POMNG02010_DETAIL .itp_form_change').hide();
400
-			
422
+			SCREEN_MODE = 'DETAIL' ;
401 423
 		} else if(mode == 'VIEW') { // 보기
402 424
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_MODIFY', '#ITP_BTN_POMNG02010_CANCELLIST']);
403 425
 			$('#ITP_AJAX_POMNG02010_VIEW_CONTAINER').show();
426
+			SCREEN_MODE = 'VIEW' ;
404 427
 		}
405 428
 	},
406 429
 	grid: {
407 430
 		init: function(mode, gridRows) {
408
-			
431
+			console.log(mode);
409 432
 			this.gridId = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_ID : POMNG02010_DETAIL_GRID_ID;
410 433
 			this.gridList = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST;
411 434
 			this.gridEmpty = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY;
@@ -455,7 +478,7 @@ let pageObj = {
455 478
 				colModel: gridColModel.detail,
456 479
 				data: gridRows,
457 480
 				multiselect: true,
458
-				cellEdit: (mode !== 'VIEW'),
481
+				//cellEdit: (mode !== 'VIEW'),
459 482
 				loadComplete: function(data) {
460 483
 					//console.log(data);
461 484
 					//$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
@@ -465,37 +488,38 @@ let pageObj = {
465 488
 				},
466 489
 				onCellSelect: function(rowid, cellIdx, cellValue) {
467 490
 					if(mode !== 'VIEW') {
468
-						//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
491
+						POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG02010_GRID_LAST_ROW_ID, POMNG02010_DETAIL_GRID_ID, ['pchReqUnqNo']);
469 492
 					}
470 493
 				}
471
-				,
472
-				afterSaveCell: function(rowid,name,val,iRow,iCol) {
473
-					
474
-					POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_chg_editable(rowid, POMNG02010_GRID_LAST_ROW_ID, POMNG02010_DETAIL_GRID_ID);
475
-					//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, iCol, POMNG02010_GRID_LAST_ROW_ID,  _this.gridId); 
476
-					
477
-					var unitAmt = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-1);
478
-					jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{pchReqAmt: parseInt(val)*parseInt(unitAmt)});
479
-					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
480
-					_this.recal();
481
-				}
482 494
 			};
483 495
 			itp_fn_grid_make_local(option);
484 496
 		},
485 497
 		recal: function() {
486
-			//PCH_REQ_AMT
487
-			
488
-			const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
489
-			var pchReqAmt = 0 ;
490
-			$.each(rowData, function(key, value) {
491
-				console.log(rowData);
492
-				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
493
-					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
494
-				}
498
+			console.log("recal call");
499
+			if (SCREEN_MODE === 'DETAIL') {
500
+				var ids = $(POMNG02010_DETAIL_GRID_ID).getDataIDs();
501
+				$.each(ids, function(idx, rowId) {
502
+					console.log("recal start");
503
+					var viewCd = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
504
+					var unitAmt = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
505
+					var pchReqQty = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'pchReqQty');
506
+					
507
+					if(viewCd != 'D' && unitAmt != null && unitAmt != '' && pchReqQty != null && pchReqQty != '') {		
508
+						jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{pchReqAmt: parseInt(unitAmt)*parseInt(pchReqQty)});
509
+					}
510
+				});
495 511
 				
496
-			});
512
+				const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
513
+				var pchReqAmt = 0 ;
514
+				$.each(rowData, function(key, value) {
515
+					// console.log(JSON.stringify(rowData));
516
+					if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
517
+						pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
518
+					}				
519
+				});
520
+				$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(itp_fn_number_comma(pchReqAmt));
521
+			}
497 522
 			
498
-			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
499 523
 		},
500 524
 		clearData : function() {
501 525
 			$(this.gridId).jqGrid('clearGridData', true);
@@ -664,15 +688,17 @@ let viewObj = {
664 688
 		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqNm').text(result.pchReqNm);
665 689
 		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqStNm').text(result.pchReqStNm);
666 690
 		$('#ITP_FORM_POMNG02010_VIEW .pchReqMgrNm').text(result.pchReqMgrNm);
667
-		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqTotalAmt').text(result.pchReqTotalAmt);
691
+		
692
+		
693
+		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqTotalAmt').text(itp_fn_number_comma(result.pchReqTotalAmt));
668 694
 		$('#ITP_FORM_POMNG02010_VIEW .fnDlvReqDt').text(result.dlvReqDt);
669 695
 		$('#ITP_FORM_POMNG02010_VIEW .fnWhsNm').text(result.whsNm + " - " + result.locationNm);
670 696
 		$('#ITP_FORM_POMNG02010_VIEW .fnLoanDvsnNm').text(result.loanDvsnNm);
671 697
 		$('#ITP_FORM_POMNG02010_VIEW .fnOrdUseAmt').text(result.ordUseAmt);
672 698
 		$('#ITP_FORM_POMNG02010_VIEW .fnNote').text(result.note);
673
-		$('#ITP_FORM_POMNG02010_VIEW .fnRjctDt').text(result.pchReqRjctDt);
674
-		$('#ITP_FORM_POMNG02010_VIEW .fnRjctMgrNm').text(result.pchReqRjctNm);
675
-		$('#ITP_FORM_POMNG02010_VIEW .fnRjctRsn').text(result.pchReqRjctRsn);
699
+		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctDt').text(result.pchReqRjctDt);
700
+		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctNm').text(result.pchReqRjctNm);
701
+		$('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctRsn').text(result.pchReqRjctRsn);
676 702
 		
677 703
 		
678 704
 		
@@ -712,6 +738,7 @@ let modifyObj = {
712 738
 			modifyObj.load(param);
713 739
 		},
714 740
 		save: function(arg) {
741
+			$('body').trigger('click');
715 742
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
716 743
 			itp_fn_form_clear_validate(null, formId);
717 744
 			

+ 91 - 59
src/main/webapp/js/app/pomng/ITP_POMNG03010.js

@@ -51,12 +51,6 @@ let API_DETAIL_PASSQTY 		    = '/api/stock/mng/whs-passqty-list';			// 창고선
51 51
 /*화면 Grid ColModel*/
52 52
 const gridColModel = {
53 53
 	list: [
54
-		{
55
-			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
56
-			label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청고유번호
57
-			width: '10', fixed: false, align: 'center',
58
-			sortable: false, hidden: true
59
-		},
60 54
 		{
61 55
 			index: 'PCH_REQ_DTL_NO', name: 'pchReqDtlNo',
62 56
 			label: ITP_MSG_LOCALE.label.pchReqDtlNo, //구매요청상세번호
@@ -75,6 +69,24 @@ const gridColModel = {
75 69
 			width: '10', fixed: false, align: 'center',
76 70
 			sortable: false, hidden: false
77 71
 		},
72
+		{
73
+			index: 'DLV_DVSN', name: 'dlvDvsn',
74
+			label: ITP_MSG_LOCALE.label.dlvDvsnNm, //배송구분
75
+			width: '10', fixed: false, align: 'center',
76
+			sortable: false, hidden: true
77
+		},
78
+		{
79
+			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
80
+			label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청고유번호
81
+			width: '10', fixed: false, align: 'center',
82
+			sortable: false, hidden: false
83
+		},
84
+		{
85
+			index: 'DLV_DVSN_NM', name: 'dlvDvsnNm',
86
+			label: ITP_MSG_LOCALE.label.dlvDvsnNm, //배송구분
87
+			width: '10', fixed: false, align: 'center',
88
+			sortable: false, hidden: false
89
+		},
78 90
 		{
79 91
 			index: 'STORE_ID', name: 'storeId',
80 92
 			label: ITP_MSG_LOCALE.label.storeId, //매장아이디
@@ -139,19 +151,22 @@ const gridColModel = {
139 151
 			index: 'UNIT_AMT', name: 'unitAmt',
140 152
 			label: ITP_MSG_LOCALE.label.unitAmt, //구매요청단가
141 153
 			width: '10', fixed: false, align: 'right',
142
-			sortable: false, hidden: true
154
+			sortable: false, hidden: true,
155
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
143 156
 		},
144 157
 		{
145 158
 			index: 'PO_UNIT_AMT', name: 'poUnitAmt',
146 159
 			label: ITP_MSG_LOCALE.label.poUnitAmt, //발주단가
147 160
 			width: '10', fixed: false, align: 'right',
148
-			sortable: false, hidden: true
161
+			sortable: false, hidden: true,
162
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
149 163
 		},
150 164
 		{
151 165
 			index: 'PCH_REQ_QTY', name: 'pchReqQty',
152 166
 			label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
153 167
 			width: '10', fixed: false, align: 'right',
154
-			sortable: false, hidden: false
168
+			sortable: false, hidden: false,
169
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
155 170
 		},
156 171
 		{
157 172
 			index: 'DLV_REQ_DT', name: 'dlvReqDt',
@@ -163,13 +178,15 @@ const gridColModel = {
163 178
 			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
164 179
 			label: ITP_MSG_LOCALE.label.pchReqAmt, //납품요청금액
165 180
 			width: '10', fixed: false, align: 'right',
166
-			sortable: false, hidden: false
181
+			sortable: false, hidden: false,
182
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
167 183
 		},
168 184
 		{
169 185
 			index: 'PCH_ORD_AMT', name: 'pchOrdAmt',
170 186
 			label: ITP_MSG_LOCALE.label.pchOrdSpplyAmt, //본사납품금액
171 187
 			width: '10', fixed: false, align: 'right',
172
-			sortable: false, hidden: false
188
+			sortable: false, hidden: false,
189
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
173 190
 		},
174 191
 		{
175 192
 			index: 'LEAD_TIME', name: 'leadTime',
@@ -183,13 +200,13 @@ const gridColModel = {
183 200
 			index: 'VIEW_CD', name: 'viewCd',
184 201
 			label: ITP_MSG_LOCALE.label.viewCd,
185 202
 			width: '10', fixed: false, align: 'center',
186
-			sortable: false, hidden: false
203
+			sortable: false, hidden: true
187 204
 		},
188 205
 		{
189 206
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
190 207
 			label: ITP_MSG_LOCALE.label.pchReqUnqNo,  //구매요청번호
191 208
 			width: '20', fixed: false, align: 'center',
192
-			sortable: false, hidden: true, edittype: 'text',
209
+			sortable: false, hidden: false, edittype: 'text',
193 210
 			 editable: false
194 211
 		},
195 212
 		{
@@ -218,7 +235,8 @@ const gridColModel = {
218 235
 			label: ITP_MSG_LOCALE.label.unitAmt, //단가
219 236
 			width: '10', fixed: false, align: 'right',
220 237
 			sortable: false, editable: false, edittype: 'text',
221
-			hidden: false
238
+			hidden: false,
239
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
222 240
 		},
223 241
 		{
224 242
 			index: 'UNIT', name: 'unit',
@@ -232,21 +250,24 @@ const gridColModel = {
232 250
 			label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
233 251
 			width: '10', fixed: false, align: 'right',
234 252
 			sortable: false, editable: false, edittype: 'text',
235
-			hidden: false
253
+			hidden: false,
254
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
236 255
 		},
237 256
 		{
238 257
 			index: 'PODR_QTY', name: 'podrQty',
239 258
 			label: ITP_MSG_LOCALE.label.podrQty, //발주수량
240 259
 			width: '10', fixed: false, align: 'right',
241 260
 			sortable: false, editable: true, edittype: 'text',
242
-			editrules: {required: true}, hidden: false
261
+			editrules: {required: true}, hidden: false,
262
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
243 263
 		},
244 264
 		{
245 265
 			index: 'PODR_AMT', name: 'podrAmt',
246 266
 			label: ITP_MSG_LOCALE.label.podrAmt, //발주금액
247 267
 			width: '10', fixed: false, align: 'right',
248 268
 			sortable: false, editable: false, edittype: 'text',
249
-			hidden: false
269
+			hidden: false,
270
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
250 271
 		},
251 272
 		{
252 273
 			index: 'DLV_REQ_DT', name: 'dlvReqDt',
@@ -260,7 +281,8 @@ const gridColModel = {
260 281
 			label: ITP_MSG_LOCALE.label.whsPassQty, //출고가능수량
261 282
 			width: '10', fixed: false, align: 'right',
262 283
 			sortable: false, editable: false, edittype: 'text',
263
-			hidden: false
284
+			hidden: false,
285
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
264 286
 		},
265 287
 		{
266 288
 			index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
@@ -445,9 +467,9 @@ let pageObj = {
445 467
 			for (var i=selectedIds.length-1; i>=0; i--) {
446 468
 				selRowData = $(POMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]);
447 469
 			}
448
-			console.log(selRowData);
470
+			
449 471
 			const key1 = {pchReqUnqNo:selRowData.pchReqUnqNo, storeId:selRowData.storeId};
450
-			//console.log(key);
472
+			
451 473
 			fn_call_popup('biz', 'BIZPOP_PO_REJECT', '#ITP_ASIDE', popFn, key1, 'S');
452 474
 		} 
453 475
 		
@@ -470,16 +492,14 @@ let pageObj = {
470 492
 		},
471 493
 		searNSpply: function(rowDataPop) {
472 494
 			if(rowDataPop) {
473
-				//console.log(rowDataPop);
495
+			
474 496
 				var pspplyId = $('#ITP_FORM_POMNG03010_NDETAIL_SPPLY_ID').val();
475
-				//console.log(pspplyId);
497
+			
476 498
 				if (pspplyId == "") {
477
-				//	console.log("null");
499
+				
478 500
 					$('#ITP_FORM_POMNG03010_NDETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
479 501
 					$('#ITP_FORM_POMNG03010_NDETAIL_SPPLY_ID').val(rowDataPop.spplyId);
480 502
 				} else {
481
-					//$('#Table_ID').getGridParam('reccount');
482
-				//	console.log("cpzm");
483 503
 					var records = $(POMNG03010_NDETAIL_GRID_ID).getGridParam('reccount')
484 504
 					if (records != 0) {
485 505
 						if (pspplyId != rowDataPop.spplyId ) {
@@ -526,7 +546,6 @@ let pageObj = {
526 546
 		},
527 547
 		poRej: function(rowDataPop) {
528 548
 			if(rowDataPop) {
529
-				console.log(rowDataPop);
530 549
 				
531 550
 				if (rowDataPop.retVal == "Y") {
532 551
 				  modifyObj.button.rejectSave(rowDataPop);
@@ -559,6 +578,16 @@ let pageObj = {
559 578
 					}
560 579
 				});
561 580
 			});
581
+			
582
+			$('body').on('click', function(e) {
583
+				
584
+				var gridId = ((SCREEN_MODE === 'NPC') ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).replace('#', '');
585
+				var rids = $( (SCREEN_MODE === 'NPC') ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('getDataIDs');
586
+				var last_row_id = rids[rids.length - 1];
587
+				
588
+				itp_fn_grid_reset_selection(e, last_row_id, gridId, (SCREEN_MODE === 'NPC') ?  'POMNG03010_NDETAIL' : 'POMNG03010_DETAIL');	
589
+				pageObj.grid.recal();
590
+			});
562 591
 
563 592
 		}
564 593
 	},
@@ -654,8 +683,7 @@ let pageObj = {
654 683
 					});
655 684
 					
656 685
 					if (diffchk == "Y") return;
657
-					//console.log(chkSpplyNm);
658
-					//console.log(diffchk);
686
+				
659 687
 					if (spplyId == "" ) {
660 688
 						$('#ITP_FORM_POMNG03010_NDETAIL_SPPLY_ID').val(chkSpplyId);
661 689
 						$('#ITP_FORM_POMNG03010_NDETAIL_SPPLY_NM').val(chkSpplyNm);
@@ -717,7 +745,7 @@ let pageObj = {
717 745
 				gridId: _this.gridId,
718 746
 				colModel: gridColModel.detail,
719 747
 				data: gridRows,
720
-				cellEdit: true,
748
+				//cellEdit: true,
721 749
 				multiselect: (mode === 'NPC'),
722 750
 				loadComplete: function(data) {
723 751
 					$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_LIST : POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
@@ -726,36 +754,41 @@ let pageObj = {
726 754
 					
727 755
 				},
728 756
 				onCellSelect: function(rowid, cellIdx, cellValue) {
729
-					//POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
730
-				},
731
-				afterSaveCell: function(rowid,name,val,iRow,iCol) {
732
-					// 구매요청금액 계산 (기존금액과 )
733
-					var	unitAmt  = jQuery(_this.gridId).jqGrid('getCell',rowid,iCol-3);
734
-					jQuery(_this.gridId).jqGrid('setRowData',rowid,{podrAmt: parseInt(val)*parseInt(unitAmt)});	
735
-					
736
-					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
737
-					pageObj.grid.recal( mode,_this.gridId);
757
+					POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
738 758
 				}
739 759
 			};
740 760
 			itp_fn_grid_make_local(option);
741 761
 		},
742
-		recal: function(mode, gridId) {
762
+		recal: function() {
743 763
 			//PCH_REQ_AMT
744
-			const rowData = $(gridId).getRowData();
745
-			var podrAmt = 0 ;
746
-			$.each(rowData, function(key, value) {
747
-				if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
748
-					podrAmt = podrAmt + parseInt(value.podrAmt) ;
749
-				}
764
+			if (SCREEN_MODE == 'NPC' || SCREEN_MODE === 'POC') {
765
+				var ids = $((SCREEN_MODE === 'NPC') ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).getDataIDs();
766
+				$.each(ids, function(idx, rowId) {
767
+					var viewCd = jQuery(SCREEN_MODE === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
768
+					var unitAmt = jQuery(SCREEN_MODE === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
769
+					var podrQty = jQuery(SCREEN_MODE === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'podrQty');
770
+					
771
+					if(viewCd != 'D' && unitAmt != null && unitAmt != '' && podrQty != null && podrQty != '') {
772
+					
773
+						jQuery(SCREEN_MODE === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{podrAmt: parseInt(unitAmt)*parseInt(podrQty)});
774
+					}
775
+				});
750 776
 				
751
-			});
777
+				const rowData = $((SCREEN_MODE == 'NPC') ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).getRowData();
778
+				var podrAmt = 0 ;
779
+				$.each(rowData, function(key, value) {
780
+					if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
781
+						podrAmt = podrAmt + parseInt(value.podrAmt) ;
782
+					}
783
+					
784
+				});
752 785
 			
753
-			if (mode == 'NPC')  {
754
-				$('#ITP_FORM_POMNG03010_NDETAIL .fnPodrAmt').text(podrAmt);	
755
-			} else {
756
-				$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
786
+				if (SCREEN_MODE == 'NPC')  {
787
+					$('#ITP_FORM_POMNG03010_NDETAIL .fnPodrAmt').text(podrAmt);	
788
+				} else {
789
+					$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
790
+				}
757 791
 			}
758
-			
759 792
 		},
760 793
 		clearData : function(mode) {
761 794
 			$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
@@ -920,7 +953,7 @@ let modifyObj = {
920 953
 			listObj.grid.search();
921 954
 		},
922 955
 		rejectSave: function(param) {
923
-			console.log(param);
956
+		
924 957
 			var modalFn = {
925 958
 					callBack: () => {
926 959
 						var searhFn = function () {
@@ -934,7 +967,7 @@ let modifyObj = {
934 967
 				itp_fn_modal_confirm('구매요청 반려 하시겠습니까?', modalFn);
935 968
 		},
936 969
 		save: function() {
937
-			
970
+			$('body').trigger('click');
938 971
 			const formId = (SCREEN_MODE == 'NPC' ? '#ITP_FORM_POMNG03010_NDETAIL' : '#ITP_FORM_POMNG03010_DETAIL');
939 972
 			itp_fn_form_clear_validate(null, formId);
940 973
 
@@ -943,16 +976,16 @@ let modifyObj = {
943 976
 				
944 977
 				if (SCREEN_MODE == 'NPC') {
945 978
 					const rowData1 = $(POMNG03010_NDETAIL_GRID_ID).getRowData();
946
-					//console.log("stsrt");
979
+				
947 980
 					var dataCnt = 0;
948 981
 					$.each(rowData1, function(key, value) {
949 982
 						console.log(value.viewCd);
950 983
 						if (value.viewCd != 'D') {
951
-							console.log("count");
984
+						
952 985
 							dataCnt = dataCnt + 1;
953 986
 						} 
954 987
 					});
955
-					//console.log(dataCnt);
988
+					
956 989
 					
957 990
 					if (dataCnt == 0) {
958 991
 						alert( "발주 생성할 품목내역이 없습니다.");
@@ -1011,6 +1044,7 @@ let modifyObj = {
1011 1044
 							pageObj.grid.clearData();
1012 1045
 							modifyObj.button.cancel();
1013 1046
 						}
1047
+						console.log(JSON.stringify(param));
1014 1048
 						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
1015 1049
 					}
1016 1050
 				};
@@ -1040,7 +1074,7 @@ let modifyObj = {
1040 1074
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_PODR_MGR_TEL_NO').val(result.podrMgrTelNo);
1041 1075
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_DVSN').val(result.dlvDvsn);
1042 1076
 		//$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_').val(result.dlvDvsnNm);
1043
-		$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(result.podrTotalAmt);
1077
+		$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(itp_fn_number_comma(result.podrTotalAmt));
1044 1078
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').val(result.dlvReqDt);
1045 1079
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(result.shmtWhsId);
1046 1080
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DELETE_SHMT_WHS_NM').val(result.shmtWhsNm + " - " + result.shmtLocationNm );
@@ -1057,8 +1091,6 @@ let modifyObj = {
1057 1091
 	},
1058 1092
 	passQtyCallback: function (result) {
1059 1093
 		
1060
-		console.log(result);
1061
-		console.log(result.size());
1062 1094
 		
1063 1095
 		/*
1064 1096
 		if ($(gridId).jqGrid('getCell', rowId, 'viewCd') === 'R') {