瀏覽代碼

구매요청 생성

marseyes 2 年之前
父節點
當前提交
e6a8f766ec
共有 2 個文件被更改,包括 42 次插入47 次删除
  1. 40 47
      src/main/webapp/js/app/pomng/ITP_POMNG01010.js
  2. 2 0
      src/main/webapp/js/app/stockmng/ITP_STOCKMNG04010.js

+ 40 - 47
src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -18,35 +18,16 @@ require(['config'], function() {
18 18
  *******************************************************/
19 19
 
20 20
 /*화면 변수*/
21
-/*
22
-const POMNG01010_GRID_ID = '#ITP_POMNG01010_jqGrid';
23
-const POMNG01010_GRID_LIST = '#ITP_POMNG01010_jqGrid_list';
24
-const POMNG01010_GRID_PAGER = '#ITP_POMNG01010_jqGridPager';
25
-const POMNG01010_GRID_EMPTY = '#ITP_POMNG01010_jqGridEmpty';
26
-
27
-const POMNG01010_VIEW_GRID_ID = '#ITP_POMNG01010_VIEW_jqGrid';
28
-const POMNG01010_VIEW_GRID_LIST = '#ITP_POMNG01010_VIEW_jqGrid_list';
29
-const POMNG01010_VIEW_GRID_PAGER = '#ITP_POMNG01010_VIEW_jqGridPager';
30
-const POMNG01010_VIEW_GRID_EMPTY = '#ITP_POMNG01010_VIEW_jqGridEmpty';
31
-*/
32 21
 const POMNG01010_DETAIL_GRID_ID = '#ITP_POMNG01010_DETAIL_jqGrid';
33 22
 const POMNG01010_DETAIL_GRID_LIST = '#ITP_POMNG01010_DETAIL_jqGrid_list';
34 23
 const POMNG01010_DETAIL_GRID_PAGER = '#ITP_POMNG01010_DETAIL_jqGridPager';
35 24
 const POMNG01010_DETAIL_GRID_EMPTY = '#ITP_POMNG01010_DETAIL_jqGridEmpty';  // ==>dwkim html확인필요
36 25
 
37
-/*
38
-let ITP_FORM_POMNG01010_DETAIL_IS_DUPLICATE = false;
39
-let ITP_FORM_POMNG01010_DETAIL_IS_WRITING = false;
40
-*/
26
+let POMNG01010_DETAIL_GRID_LAST_ROW_ID;
41 27
 
42 28
 /*API URL*/
43 29
 let API_DETAIL_INIT_INFO = '/api/pomng/init-pchReq'
44
-//let API_DETAIL_GRID_LIST = '/api/affl/detail-grid-list';
45
-//let API_DETAIL_INFO = '/api/affl/info-affl';
46
-//let COMPANY_INFO_COMPANY = '/api/affl/info-affl';
47 30
 let API_DETAIL_SAVE = '/api/pomng/save-pchReq';
48
-//let API_CHECK_DUPLICATE = '/api/affl/check-duplicate';
49
-//let API_INTI_USERPW = '/api/user/inti-userpw';
50 31
 
51 32
 /*화면 Grid ColModel   ==>선택박스 항목 추가 부분  */
52 33
 const gridColModel = {
@@ -81,20 +62,23 @@ const gridColModel = {
81 62
 			index: 'UNIT_AMT', name: 'unitAmt',
82 63
 			label: ITP_MSG_LOCALE.label.unitAmt,
83 64
 			width: '10', fixed: false, align: 'center',
84
-			sortable: false, editable: false, edittype: 'text', hidden: false
65
+			sortable: false, editable: false, edittype: 'text', hidden: false, 
66
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
85 67
 		},
86 68
 		{
87 69
 			index: 'PCH_REQ_QTY', name: 'pchReqQty',
88 70
 			label: ITP_MSG_LOCALE.label.pchReqQty, //수량
89 71
 			width: '10', fixed: false, align: 'right',
90
-			sortable: true, editable: true, edittype: 'text',
91
-			editrules: { number:true}
72
+			sortable: false, editable: true, edittype: 'text',
73
+			editrules: { number:true }, 
74
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
92 75
 		},
93 76
 		{
94 77
 			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
95 78
 			label: ITP_MSG_LOCALE.label.pchReqAmt,
96 79
 			width: '10', fixed: false, align: 'right',
97
-			sortable: false, editable: false, edittype: 'text', hidden: false
80
+			sortable: false, editable: false, edittype: 'text', hidden: false, 
81
+			formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
98 82
 		},
99 83
 
100 84
 		{
@@ -184,8 +168,6 @@ let pageObj = {
184 168
 			$('#ITP_TAB_POMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
185 169
 			$('#ITP_FORM_POMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate() + 5)));
186 170
 			
187
-			
188
-			
189 171
 			//납품장소 필드 readonly
190 172
 			$('#ITP_FORM_POMNG01010_DETAIL_WHS_NM').attr('readonly', true);
191 173
 			$('#ITP_FORM_POMNG01010_DETAIL_LOCATION_NM').attr('readonly', true);
@@ -217,9 +199,15 @@ let pageObj = {
217 199
 					}
218 200
 				});
219 201
 			});
220
-
202
+			
221 203
 			$('body').on('click', function(e) {
222
-				// afflUserObj.grid.resetGrid(e);
204
+				var gridId = POMNG01010_DETAIL_GRID_ID.replace('#', '');
205
+				var rids = $(POMNG01010_DETAIL_GRID_ID).jqGrid('getDataIDs');
206
+				var last_row_id = rids[rids.length - 1];
207
+				
208
+				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG01010_DETAIL');	
209
+				
210
+				pageObj.grid.recal();			
223 211
 			});
224 212
 
225 213
 		}
@@ -269,22 +257,18 @@ let pageObj = {
269 257
 				colModel: gridColModel.detail,
270 258
 				data: gridData,
271 259
 				multiselect: true,
272
-				cellEdit: true,
260
+				// cellEdit: true,
261
+				onCellSelect: function(rowId, cellIdx, cellValue) {
262
+					POMNG01010_DETAIL_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG01010_DETAIL_GRID_LAST_ROW_ID, POMNG01010_DETAIL_GRID_ID, ['pchReqQty']);
263
+		   		},
273 264
 				loadComplete: function(data) {
274 265
 					_this.clearData();
275
-				},
276
-				afterSaveCell: function(rowid,name,val,iRow,iCol) {
277
-					// 구매요청금액 계산 (기존금액과 )
278
-					var unitAmt = jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-1);
279
-					jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{pchReqAmt: parseInt(val)*parseInt(unitAmt)});
280
-					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
281
-					_this.recal();
282 266
 				}
283 267
 			};
284 268
 			itp_fn_grid_make_local(option);
285 269
 		},
286 270
 		clearData: function() {
287
-			console.log(this.gridId);
271
+			// console.log(this.gridId);
288 272
 			$(POMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
289 273
 			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
290 274
 			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
@@ -292,19 +276,28 @@ let pageObj = {
292 276
 			$(POMNG01010_DETAIL_GRID_EMPTY).show();
293 277
 		},
294 278
 		recal: function() {
295
-			//PCH_REQ_AMT
296
-			console.log("==========================================");
279
+			
280
+			var ids = $(POMNG01010_DETAIL_GRID_ID).getDataIDs();
281
+			$.each(ids, function(idx, rowId) {
282
+				
283
+				var viewCd = jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
284
+				var unitAmt = jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
285
+				var pchReqQty = jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'pchReqQty');
286
+				
287
+				if(viewCd != 'D' && unitAmt != null && unitAmt != '' && pchReqQty != null && pchReqQty != '') {		
288
+					jQuery(POMNG01010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{pchReqAmt: parseInt(unitAmt)*parseInt(pchReqQty)});
289
+				}
290
+			});
291
+			
297 292
 			const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
298
-			console.log("####################################");
299 293
 			var pchReqAmt = 0 ;
300 294
 			$.each(rowData, function(key, value) {
301
-				 console.log(rowData);
295
+				// console.log(JSON.stringify(rowData));
302 296
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
303 297
 					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
304
-				}
305
-				
298
+				}				
306 299
 			});
307
-			$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text(pchReqAmt);
300
+			$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text(itp_fn_number_comma(pchReqAmt));
308 301
 		},
309 302
 		unload: function() {
310 303
 			$.jgrid.gridUnload(this.gridId);
@@ -336,6 +329,8 @@ let createObj = {
336 329
 	},
337 330
 	button: {
338 331
 		save: function(arg) {
332
+			$('body').trigger('click');
333
+			
339 334
 			const formId = '#ITP_FORM_POMNG01010_DETAIL';
340 335
 			itp_fn_form_clear_validate(null, formId);
341 336
 			$('#ITP_FORM_POMNG01010_DETAIL_PCH_REQ_ST_CD').val(arg);
@@ -414,7 +409,6 @@ let createObj = {
414 409
 		fn_ajax_call(API_DETAIL_INIT_INFO, key, this.callback, 'GET');
415 410
 	},
416 411
 	callback: function(result) {
417
-		console.log(result);
418 412
 
419 413
 		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_VIEW_CD').val('C');
420 414
 
@@ -432,8 +426,7 @@ let createObj = {
432 426
 		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqMgrNm').text(result.userNm);
433 427
 		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text("0");
434 428
 		$('#ITP_FORM_POMNG01010_DETAIL .fnLoanDvsnNm').text(result.loanDvsnNm);
435
-		$('#ITP_FORM_POMNG01010_DETAIL .fnPchActAmt').text(result.ordUseAmt);
436
-		
429
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchActAmt').text(result.ordUseAmt);		
437 430
 
438 431
 		pageObj.grid.init();
439 432
 	}

+ 2 - 0
src/main/webapp/js/app/stockmng/ITP_STOCKMNG04010.js

@@ -642,6 +642,8 @@ let createObj = {
642 642
 			listObj.grid.search();
643 643
 		},
644 644
 		save: function() {
645
+			$('body').trigger('click');
646
+			
645 647
 			var detailViewCd = $('#ITP_FORM_STOCKMNG04010_DETAIL_VIEW_CD').val();
646 648
 			const formId = '#ITP_FORM_STOCKMNG04010_DETAIL';
647 649
 			itp_fn_form_clear_validate(null, formId);