Bladeren bron

남품서생성 완료

yhl88 2 jaren geleden
bovenliggende
commit
7688c7af81
1 gewijzigde bestanden met toevoegingen van 53 en 15 verwijderingen
  1. 53 15
      src/main/webapp/js/app/ordmng/ITP_ORDMNG02010.js

+ 53 - 15
src/main/webapp/js/app/ordmng/ITP_ORDMNG02010.js

@@ -172,8 +172,12 @@ let pageObj = {
172 172
 			});
173 173
 			
174 174
 			$('body').on('click', function(e) {
175
-				var gridId = ORDMNG02010_DETAIL_GRID_ID.replace('#', '');
176
-				itp_fn_grid_reset_selection(e, ORDMNG02010_GRID_LAST_ROW_ID, gridId, 'ORDMNG02010');
175
+				var gridId = (ORDMNG02010_DETAIL_GRID_ID).replace('#', '');
176
+				var rids = $(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
177
+				var last_row_id = rids[rids.length - 1];
178
+				
179
+				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'ORDMNG02010_DETAIL');
180
+				modifyObj.button.recal();
177 181
 			})
178 182
 		}
179 183
 	},
@@ -374,6 +378,27 @@ let modifyObj = {
374 378
 				}
375 379
 			};
376 380
 			itp_fn_modal_confirm('저장 하시겠습니까?', modalFn);
381
+		},
382
+		recal: function() {
383
+			var ids = $(ORDMNG02010_DETAIL_GRID_ID).getDataIDs();
384
+			$.each(ids, function(idx, rowId) {
385
+				var unitAmt = jQuery(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
386
+				var shmtQty = jQuery(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'shmtQty');
387
+				if (!isNaN(unitAmt) && !isNaN(shmtQty)) {
388
+					if (unitAmt != null && unitAmt != '' && shmtQty != null && shmtQty != '') {
389
+						jQuery(ORDMNG02010_DETAIL_GRID_ID).jqGrid('setRowData', rowId, {podrAmt: parseInt(unitAmt) * parseInt(shmtQty)});
390
+					}
391
+				}				
392
+			});
393
+			
394
+			const rowData = $(ORDMNG02010_DETAIL_GRID_ID).getRowData();
395
+			var podrTotalAmt = 0;
396
+			$.each(rowData, function(key, value) {
397
+				if(value.podrAmt != null && value.podrAmt != "") {
398
+					podrTotalAmt = podrTotalAmt + parseInt(value.podrAmt);
399
+				}
400
+			});
401
+			$('#ITP_FORM_ORDMNG02010_DETAIL .fnPodrTotalAmt').text(itp_fn_number_comma(podrTotalAmt));
377 402
 		}
378 403
 	},
379 404
 	empty: {
@@ -405,7 +430,6 @@ let modifyObj = {
405 430
 		$('#ITP_FORM_ORDMNG02010_DETAIL .fnBrandNm').text(result.brandNm);										// 브랜드
406 431
 		$('#ITP_FORM_ORDMNG02010_DETAIL .fnPchPodrUnqNo').text(result.invPoInfoList[0].pchPodrUnqNo);			// 발주번호		
407 432
 		$('#ITP_FORM_ORDMNG02010_DETAIL .fnDlvRegDt').text(result.dlvReqDt);									// 납품서생성일자
408
-		$('#ITP_FORM_ORDMNG02010_DETAIL .fnPodrTotalAmt').text(result.podrTotalAmt);							// 발주총금액
409 433
 		$('#ITP_FORM_ORDMNG02010_DETAIL .fnWhsNm').text(result.whsNm);											// 발주총금액
410 434
 		$('#ITP_FORM_ORDMNG02010_DETAIL .fnDeliTelNo').text(result.deliTelNo);									// 납품장소연락처
411 435
 		$('#ITP_FORM_ORDMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_DLV_SCH_DT').val(result.dlvSchDt);			// 납품예정일
@@ -421,7 +445,7 @@ let modifyObj = {
421 445
     			selRowData = $(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getRowData', selectedIds[i]);		//cell 선택
422 446
     		}
423 447
     		let podrQty = selRowData.podrQty;
424
-    		if(Number(value) > Number(podrQty)) {
448
+    		if(Number(value) > Number(podrQty) || value == null || value == '') {
425 449
 				return [false, '발주수량 이하 값 입력'];
426 450
 			} else if (Number(value) < 0) {
427 451
 				return [false, '음수 입력 불가'];
@@ -464,62 +488,69 @@ let modifyObj = {
464 488
 					{
465 489
 						index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
466 490
 						label: ITP_MSG_LOCALE.label.pchPodrUnqNo,
467
-						width: '10', fixed: false, align: 'center',
491
+						width: '8', fixed: false, align: 'center',
468 492
 						sortable: false, hidden: true
469 493
 					},
470 494
 					{
471 495
 						index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
472 496
 						label: ITP_MSG_LOCALE.label.pchPodrDtlNo,  		//발주항번
473
-						width: '20', fixed: false, align: 'center',
497
+						width: '8', fixed: false, align: 'center',
474 498
 						sortable: false, hidden: false, edittype: 'text',
475 499
 						editable: false
476 500
 					},
477 501
 					{
478 502
 						index: 'ITEM_ID', name: 'itemId',
479 503
 						label: ITP_MSG_LOCALE.label.itemId, 			//품목번호
480
-						width: '20', fixed: false, align: 'center',
504
+						width: '10', fixed: false, align: 'center',
481 505
 						sortable: false, hidden: false, edittype: 'text',
482 506
 						editable: false
483 507
 					},
484 508
 					{
485 509
 						index: 'ITEM_NM', name: 'itemNm',
486 510
 						label: ITP_MSG_LOCALE.label.itemNm,  			//품목명
487
-						width: '20', fixed: false, align: 'center',
511
+						width: '10', fixed: false, align: 'center',
488 512
 						sortable: false, hidden: false, edittype: 'text',
489 513
 						editable: false
490 514
 					},
491 515
 					{
492 516
 						index: 'UNIT', name: 'unit',
493 517
 						label: ITP_MSG_LOCALE.label.unit,  				//기본단위
494
-						width: '20', fixed: false, align: 'center',
518
+						width: '8', fixed: false, align: 'center',
495 519
 						sortable: false, hidden: false, edittype: 'text',
496 520
 						editable: false
497 521
 					},
522
+					{
523
+						index: 'UNIT_AMT', name: 'unitAmt',
524
+						label: ITP_MSG_LOCALE.label.unitAmt,  			//단가
525
+						width: '20', fixed: false, align: 'center',
526
+						sortable: false, hidden: true, edittype: 'text',
527
+						editable: false
528
+					},
498 529
 					{
499 530
 						index: 'PODR_QTY', name: 'podrQty',
500 531
 						label: ITP_MSG_LOCALE.label.podrQty,  			//발주수량
501
-						width: '20', fixed: false, align: 'center',
532
+						width: '8', fixed: false, align: 'center',
502 533
 						sortable: false, hidden: false, edittype: 'text',
503 534
 						editable: false
504 535
 					},
505 536
 					{
506 537
 						index: 'SHMT_QTY', name: 'shmtQty',
507 538
 						label: ITP_MSG_LOCALE.label.shmtQty, 	 		//출하수량
508
-						width: '20', fixed: false, align: 'center',
539
+						width: '8', fixed: false, align: 'center',
509 540
 						sortable: false, hidden: false, edittype: 'text',
510 541
 						editable: true, editrules: {number: true, custom: true, custom_func: shmtQtyValue}
511 542
 					},
512 543
 					{
513 544
 						index: 'EXPRY_YN', name: 'expryYn',
514 545
 						label: ITP_MSG_LOCALE.label.expryYn,  			//유통기한여부
515
-						width: '20', fixed: false, align: 'center',
546
+						width: '10', fixed: false, align: 'center',
516 547
 						sortable: false, hidden: false, edittype: 'text',
517 548
 						editable: false
518 549
 					},
519 550
 					{
520 551
 						index: 'EXPRY_DATE', name: 'expryDate',
521 552
 						label: ITP_MSG_LOCALE.label.expryDate,  		//유통기한일자
522
-						width: '20', fixed: false, align: 'center',
553
+						width: '10', fixed: false, align: 'center',
523 554
 						sortable: false, hidden: false, 
524 555
 						editable: true, sorttype: 'date',
525 556
 				        editoptions: {dataInit: function(e) {$(e).datepicker(ITP_DATE_LANGUAGE);}},
@@ -528,10 +559,17 @@ let modifyObj = {
528 559
 					{
529 560
 						index: 'REMARK', name: 'deliDesc',				//API 비고 키
530 561
 						label: ITP_MSG_LOCALE.label.remark,  			//locale-ko 비고 값
531
-						width: '20', fixed: false, align: 'center',
562
+						width: '10', fixed: false, align: 'center',
532 563
 						sortable: false, hidden: false, edittype: 'text',
533 564
 						editable: true
534
-					}
565
+					},
566
+					{
567
+						index: 'PODR_AMT', name: 'podrAmt',
568
+						label: ITP_MSG_LOCALE.label.podrAmt,  		//발주금액
569
+						width: '20', fixed: false, align: 'center',
570
+						sortable: false, hidden: true, edittype: 'text',
571
+						editable: false
572
+					},
535 573
 				],
536 574
 				data: gridData,
537 575
 				multiselect: true,