Bladeren bron

구매결재관련 수정 조치함

dwkim 2 jaren geleden
bovenliggende
commit
6fb12d764f
3 gewijzigde bestanden met toevoegingen van 90 en 28 verwijderingen
  1. 21 12
      src/main/webapp/js/app/config.js
  2. 64 11
      src/main/webapp/js/app/pomng/ITP_POMNG01010.js
  3. 5 5
      src/main/webapp/main.html

+ 21 - 12
src/main/webapp/js/app/config.js

@@ -2409,39 +2409,48 @@ function itp_fn_modal_confirm(msg, fn, args) {
2409 2409
 	}
2410 2410
 };
2411 2411
 // 구매요청확인
2412
-function itp_fn_modal_confirm_req1(msg, fn, args) {
2412
+function itp_fn_modal_confirm_req1(param, fn, args) {
2413 2413
 	$('#ITP_MODAL_PR_ALERT_CANCEL').show();
2414 2414
 	$('#ITP_MODAL_PR_ALERT').modal('show');
2415
-	$('#ITP_MODAL_PR_ALERT').find('.itp_alert_txt').html(msg);
2415
+	$('#ITP_MODAL_PR_ALERT').find('.fnDlvReqDt').html(param.dlvReqDt);
2416
+	$('#ITP_MODAL_PR_ALERT').find('.fnItemcnt').html(param.itemcnt + " 개");
2417
+	$('#ITP_MODAL_PR_ALERT').find('.fnPchReqAmt').html(param.dlvReqAmt + " 원");
2418
+	
2416 2419
 	if (fn !== undefined || typeof fn !== 'undefined') {
2420
+		console.log("config button");
2417 2421
 		$('#ITP_MODAL_PR_ALERT_CONFIRM').off('click');
2418 2422
 		$('#ITP_MODAL_PR_ALERT_CONFIRM').on('click', function() {
2423
+			console.log("config button function");
2419 2424
 			fn.callBack(args);
2420 2425
 			$('#ITP_MODAL_PR_ALERT').modal('hide');
2421 2426
 		});
2422 2427
 	}
2423 2428
 };
2424 2429
 //선불매장결제확인
2425
-function itp_fn_modal_confirm_req2(msg, fn, args) {
2426
-	$('#ITP_MODAL_ADV_ALERT_CANCEL').show();
2430
+function itp_fn_modal_confirm_req2(param, fn, args) {
2431
+	$('#ITP_MODAL_ALERT_ADV_CANCEL').show();
2427 2432
 	$('#ITP_MODAL_ADV_ALERT').modal('show');
2428
-	$('#ITP_MODAL_ADV_ALERT').find('.itp_alert_txt').html(msg);
2433
+	$('#ITP_MODAL_ADV_ALERT').find('.fnDlvReqDt').html(param.dlvReqDt);
2434
+	$('#ITP_MODAL_ADV_ALERT').find('.fnItemcnt').html(param.itemcnt + " 개");
2435
+	$('#ITP_MODAL_ADV_ALERT').find('.fnDlvReqAmt').html(param.dlvReqAmt + " 원");
2429 2436
 	if (fn !== undefined || typeof fn !== 'undefined') {
2430
-		$('#ITP_MODAL_ADV_ALERT_CONFIRM').off('click');
2431
-		$('#ITP_MODAL_ADV_ALERT_CONFIRM').on('click', function() {
2437
+		$('#ITP_MODAL_ALERT_ADV_CONFIRM').off('click');
2438
+		$('#ITP_MODAL_ALERT_ADV_CONFIRM').on('click', function() {
2432 2439
 			fn.callBack(args);
2433 2440
 			$('#ITP_MODAL_ADV_ALERT').modal('hide');
2434 2441
 		});
2435 2442
 	}
2436 2443
 };
2437 2444
 //구매한도부족알림
2438
-function itp_fn_modal_confirm_req3(msg, fn, args) {
2439
-	$('#ITP_MODAL_LM_ALERT_CANCEL').show();
2445
+function itp_fn_modal_confirm_req3(param, fn, args) {
2446
+	$('#ITP_MODAL_ALERT_LM_CANCEL').show();
2440 2447
 	$('#ITP_MODAL_LM_ALERT').modal('show');
2441
-	$('#ITP_MODAL_LM_ALERT').find('.itp_alert_txt').html(msg);
2448
+	$('#ITP_MODAL_LM_ALERT').find('.fnDlvReqDt').html(param.dlvReqDt);
2449
+	$('#ITP_MODAL_LM_ALERT').find('.fnItemcnt').html(param.itemcnt + " 개");
2450
+	$('#ITP_MODAL_LM_ALERT').find('.fnDlvReqAmt').html(param.dlvReqAmt + " 원");
2442 2451
 	if (fn !== undefined || typeof fn !== 'undefined') {
2443
-		$('#ITP_MODAL_LM_ALERT_CONFIRM').off('click');
2444
-		$('#ITP_MODAL_LM_ALERT_CONFIRM').on('click', function() {
2452
+		$('#ITP_MODAL_ALERT_LM_CONFIRM').off('click');
2453
+		$('#ITP_MODAL_ALERT_LM_CONFIRM').on('click', function() {
2445 2454
 			fn.callBack(args);
2446 2455
 			$('#ITP_MODAL_LM_ALERT').modal('hide');
2447 2456
 		});

+ 64 - 11
src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -347,8 +347,11 @@ let createObj = {
347 347
 			var dlvReqDt = $('#ITP_FORM_POMNG01010_DETAIL_DLV_REQ_DT').val();
348 348
 			var itemcnt  = $(POMNG01010_DETAIL_GRID_ID).getGridParam('reccount');
349 349
 			var dlvReqAmt = $('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text();
350
+			
350 351
 			var reqMsg = "";
351 352
 			
353
+			var apprArg = {};
354
+			
352 355
 			//정산 타입이 무정산이면 스킵
353 356
 			var apprTypeCd = "Y" // Y 정상결재, NP 선불, NA 후불   
354 357
 			
@@ -363,6 +366,8 @@ let createObj = {
363 366
 					var pchReqAtm = itp_fn_currency_unfmatter($('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text(),"","");
364 367
 					
365 368
 					if (parseInt(pchActAtm) < parseInt(pchReqAtm)) {
369
+						dlvReqAmt = itp_fn_number_comma(String(parseInt(pchReqAtm) - parseInt(pchActAtm)));
370
+						console.log(dlvReqAmt);
366 371
 						if (loanDvsn == 'LD01') {
367 372
 							apprTypeCd = 'NP';
368 373
 						} else {
@@ -407,12 +412,25 @@ let createObj = {
407 412
 				if (chkQtyYn == "Y") return;
408 413
 				
409 414
 				if (arg == 'PR20') {
410
-					console.log(apprTypeCd);
415
+					
416
+					apprArg.dlvReqDt = dlvReqDt;
417
+					apprArg.itemcnt = itemcnt;
418
+					apprArg.dlvReqAmt = dlvReqAmt;
419
+					
420
+					console.log("-----------------------");
421
+					console.log(dlvReqAmt, apprArg.dlvReqAmt);
422
+					
411 423
 					if (apprTypeCd == "Y") {  // 여신 구분, 여신금액
412
-						reqMsg = ' 납품요청일 : ' + dlvReqDt + '<br> 품목수 : ' + itemcnt + '<br> 구매요청금액 : ' + dlvReqAmt + '<br><br>' + ITP_MSG_LOCALE.message.ajax.reqSave ;
413
-						itp_fn_modal_confirm(reqMsg, createObj.button.saveReq(arg), null);	
424
+						
425
+						var prIngFn =  {
426
+							callBack: function(args) {
427
+									createObj.button.saveLastReq(arg);
428
+								}
429
+							};
430
+						itp_fn_modal_confirm_req1(apprArg, prIngFn, arg);
431
+							
414 432
 					} else // 금액 부족시 
415
-						createObj.button.saveApprReq(arg,apprTypeCd);
433
+						createObj.button.saveApprReq(apprArg,apprTypeCd, arg);
416 434
 					} 
417 435
 					
418 436
 				} else {
@@ -456,16 +474,16 @@ let createObj = {
456 474
 						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');				
457 475
 					}
458 476
 				};
459
-			itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.tmpSave, saveFn, null);
477
+			itp_fn_modal_confirm_req1(ITP_MSG_LOCALE.message.ajax.tmpSave, saveFn, null);
460 478
 		},
461
-		saveApprReq: function(arg, apprTypeCd) {
479
+		saveApprReq: function(param, apprTypeCd, arg) {
462 480
 			var apprFn =  {
463
-				callBack: function(args,apprTypeCd) {
481
+				callBack: function(args) {
464 482
 						// 결재금액이 부족하여 결재란으로 이동처리
465 483
 						var popFn = function(rowDataPop) {
466 484
 							// 결재 성공시 승인처리함 
467 485
 							console.log(rowDataPop);
468
-							createObj.button.saveReq(arg);
486
+							createObj.button.saveLastReq(arg);
469 487
 						};			
470 488
 						// 결제 팝업 : LD01(선불(충전)), LD02(후불(신용))
471 489
 						// 결제타입코드 : 10(선불(충전)), 20(후불(결제)), 30(후불(선결제))		
@@ -486,11 +504,46 @@ let createObj = {
486 504
 				};
487 505
 			
488 506
 			if (apprTypeCd == 'NP') {  // 선불
489
-				itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.tmpSave, apprFn, null);
507
+				itp_fn_modal_confirm_req2(param, apprFn, arg);
490 508
 			} else { //후불
491
-				itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.tmpSave, apprFn, null);
509
+				itp_fn_modal_confirm_req3(param, apprFn, arg);
492 510
 			}
493
-		}	
511
+		},
512
+		saveLastReq: function(arg) {
513
+			const formId = '#ITP_FORM_POMNG01010_DETAIL';
514
+			
515
+			$(formId).val(arg);
516
+			let gridInsertData = [];
517
+			let gridUpdateData = [];
518
+			let gridDeleteData = [];
519
+			
520
+			const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
521
+			
522
+			$.each(rowData, function(key, value) {
523
+				if (value.viewCd !== 'R') {
524
+					if (value.viewCd === 'C') {
525
+						gridInsertData.push(value);
526
+					} else if (value.viewCd === 'U') {
527
+						gridUpdateData.push(value);
528
+					} else if (value.viewCd === 'D') {
529
+						gridDeleteData.push(value);
530
+					}
531
+				}
532
+			});
533
+			
534
+			//if (chkQtyYn == "Y") return;
535
+			
536
+			let param = $(formId).serializeObject();
537
+			param.gridInsertData = gridInsertData;
538
+			param.gridUpdateData = gridUpdateData;
539
+			param.gridDeleteData = gridDeleteData;
540
+			console.log(JSON.stringify(param));
541
+			var searhFn = function() {
542
+				createObj.newinit();
543
+			};
544
+			fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');				
545
+				
546
+		},	
494 547
 			
495 548
 	},
496 549
 	load: function() {

+ 5 - 5
src/main/webapp/main.html

@@ -347,17 +347,17 @@
347 347
 								<div class="itp_alt_box">
348 348
 									<label>납품요청일</label>
349 349
 									<span>:</span>
350
-									<div class="fnDlvReqDt">2022.12.11</div>
350
+									<div class="fnDlvReqDt"></div>
351 351
 								</div>
352 352
 								<div class="itp_alt_box">
353 353
 									<label>품목수</label>
354 354
 									<span>:</span>
355
-									<div class="fnItemcnt">2개</div>
355
+									<div class="fnItemcnt"></div>
356 356
 								</div>
357 357
 								<div class="itp_alt_box">
358
-									<label>구매금액</label>
358
+									<label>추가결재금액</label>
359 359
 									<span>:</span>
360
-									<div class="fnDlvReqAmt">424,000원</div>
360
+									<div class="fnDlvReqAmt"></div>
361 361
 								</div>
362 362
 								<label style="margin:10px 0;">선불매장이므로 결재를 하셔야 구매요청이 진행이 됩니다.<br>결재를 하시겠습니까?</label>
363 363
 							</div>
@@ -386,7 +386,7 @@
386 386
 									<div class="fnItemcnt"></div>
387 387
 								</div>
388 388
 								<div class="itp_alt_box">
389
-									<label>구매금액</label>
389
+									<label>추가결재금액</label>
390 390
 									<span>:</span>
391 391
 									<div class="fnDlvReqAmt"></div>
392 392
 								</div>