- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
548 lines
21 KiB
PHP
548 lines
21 KiB
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
$title_message = '철재스라트 발주서';
|
|
$tablename = 'output';
|
|
$item ='발주서';
|
|
$emailTitle ='발주서';
|
|
$QCadmin = false ;
|
|
if($user_name=='이세희' || $user_name=='개발자' || $user_name=='함신옥')
|
|
$QCadmin = true ;
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
|
?>
|
|
<title> <?=$title_message?> </title>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
</head>
|
|
<body>
|
|
|
|
<?php
|
|
// JavaScript에서 전달된 변수들 받기
|
|
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/estimate/fetch_unitprice.php");
|
|
$pdo = db_connect();
|
|
try {
|
|
$sql = "select * from {$DB}.{$tablename} where num = ? ";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh->execute();
|
|
$count = $stmh->rowCount();
|
|
if ($count < 1) {
|
|
print "검색결과가 없습니다.<br>";
|
|
} else {
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
include "_row.php";
|
|
// output_extra 테이블에서 데이터 불러오기
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/output/load_output_extraTable.php';
|
|
}
|
|
} catch (PDOException $Exception) {
|
|
print "오류: " . $Exception->getMessage();
|
|
}
|
|
|
|
// JSON 문자열을 PHP 배열로 디코딩합니다.
|
|
$eList = json_decode($estimateSlatList, true); // 발주서가 곧 해당 파일의 견적파일에 해당된다.
|
|
|
|
// 행의 수는 배열의 크기와 동일하므로, count() 함수를 사용하여 구합니다.
|
|
$surang = count($eList);
|
|
|
|
// 행의 수를 출력하거나 활용할 수 있습니다.
|
|
// echo "행의 수: " . $surang . "<br>";
|
|
|
|
$THscreenSu = $surang + 2 ;
|
|
|
|
// 디코딩된 데이터가 배열인지 확인합니다.
|
|
if (!is_array($eList)) {
|
|
echo "데이터가 정상적이지 않습니다. 확인바랍니다.";
|
|
exit;
|
|
}
|
|
|
|
else {
|
|
foreach ($eList as $item) {
|
|
$prodcode = $item['col4'];
|
|
$items1 = ['KQTS01'];
|
|
$items2 = ['KTE01'];
|
|
|
|
// $prodcode가 $items1 배열에 있는 경우
|
|
if (in_array($prodcode, $items1)) {
|
|
$prodname = '국민방화투시형스틸셔터';
|
|
}
|
|
// $prodcode가 $items2 배열에 있는 경우
|
|
elseif (in_array($prodcode, $items2)) {
|
|
$prodname = '국민방화 스틸 셔터';
|
|
} else {
|
|
$prodname = 'Unknown'; // $prodcode가 어느 배열에도 없는 경우
|
|
}
|
|
}
|
|
}
|
|
|
|
// 데이터베이스에서 ordersheet_slat 컬럼 값을 가져온 후 디코딩
|
|
$ordersheet_slat = isset($ordersheet_slat) ? json_decode($ordersheet_slat, true) : [];
|
|
|
|
// print_r($ordersheet_slat);
|
|
|
|
// JSON 데이터를 JavaScript 변수로 변환
|
|
echo "<script>";
|
|
echo "var ordersheet_slatData = " . json_encode($ordersheet_slat) . ";";
|
|
echo "</script>";
|
|
|
|
// print '거래처 번호 : ';
|
|
// print_r($secondordnum);
|
|
$indateStr = date("m/d", strtotime($indate));
|
|
$todayStr = date("m/d");
|
|
|
|
?>
|
|
|
|
<div class="container mt-2">
|
|
<div class="d-flex align-items-center justify-content-end mt-1 m-1">
|
|
<div class="d-flex align-items-center">
|
|
<span class="me-5">(<?php echo isset($warranty) && $warranty === '인정' ? '인정' : ''; ?><?php echo isset($slatcheck) && $slatcheck === '1' ? ', 스크린' : ''; ?><?php echo isset($motor) && $motor === '1' ? ', 모터' : ''; ?><?php echo isset($steel) && $steel === '1' ? ', 절곡' : ''; ?><?php echo isset($partscheck) && $partscheck === '1' ? ', 부자재' : ''; ?>)</span>
|
|
</div>
|
|
<button type="button" class="btn btn-dark btn-sm mx-3" onclick='location.reload();' title="새로고침"> <i class="bi bi-arrow-clockwise"></i> </button>
|
|
<button class="btn btn-dark btn-sm me-1 ms-1 saveData" > <i class="bi bi-floppy2-fill"></i> 서버 저장 </button>
|
|
<button type="button" class="btn btn-dark btn-sm ms-1 me-1" onclick="generatePDF()"> PDF 저장 </button>
|
|
<button type="button" class="btn btn-dark btn-sm ms-1 me-1" onclick="sendmail();"> <i class="bi bi-envelope-arrow-up"></i> 전송 </button>
|
|
<button type="button" class="btn btn-secondary btn-sm ms-5 " onclick="self.close();"> <i class="bi bi-x-lg"></i> 닫기 </button>
|
|
</div>
|
|
</div>
|
|
|
|
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data" onkeydown="return captureReturnKey(event)" >
|
|
|
|
<input type="hidden" id="mode" name="mode" value="<?= isset($mode) ? $mode : '' ?>">
|
|
<input type="hidden" id="num" name="num" value="<?= isset($num) ? $num : '' ?>">
|
|
<input type="hidden" id="user_name" name="user_name" value="<?= isset($user_name) ? $user_name : '' ?>">
|
|
<input type="hidden" id="update_log" name="update_log" value="<?= isset($update_log) ? $update_log : NULL ?>">
|
|
<input type="hidden" id="tablename" name="tablename" value="<?= isset($tablename) ? $tablename : '' ?>">
|
|
<input type="hidden" id="item_name" name="item_name" value="<?= isset($item_name) ? $item_name : '' ?>">
|
|
<input type="hidden" id="ordersheet_slat" name="ordersheet_slat">
|
|
|
|
|
|
<div id="content-to-print">
|
|
<br>
|
|
<div class="container mt-3">
|
|
<div class="row">
|
|
<div class="d-flex align-items-center justify-content-center">
|
|
<table class="table " style="border-collapse: collapse;">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="5" rowspan="4" class="text-center" style="width:70%;">
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<img src="../img/kdlogo.png" alt="경동기업" class="me-1" style="width:100%; height:auto;">
|
|
</div>
|
|
<div class="col-sm-10">
|
|
<div class="d-flex align-items-center justify-content-center m-1">
|
|
<span class="text-dark ms-2 me-2 fs-1" > 발 </span>
|
|
<span class="text-dark ms-2 me-2 fs-1" > 주 </span>
|
|
<span class="text-dark ms-2 fs-1" > 서 </span>
|
|
</div>
|
|
<br>
|
|
<div class="d-flex align-items-center justify-content-center mt-2">
|
|
<span class="text-dark ms-2 " style="font-size:10px;" > 전화 : 031-983-5130 | 팩스 : 02-6911-6315 | 이메일 : kd5130@naver.com </span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</th>
|
|
<th class="text-center " style="width:5%;">로트번호</th>
|
|
<th colspan="3" class="text-center text-danger fw-bold fs-6" style="width:30%; background-color:yellow;"> <?=$lotNum?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th rowspan="3" class="text-center fw-bold" style="height:100px;">결 재</th>
|
|
<th class="text-center p-1 clickable" style="width : 70px; height:22px; padding:2px; cursor:pointer;" id="writer">작성</th>
|
|
<th class="text-center p-1 clickable" style="width : 70px; height:22px; padding:2px; cursor:pointer;" id="reviewer">검토</th>
|
|
<th class="text-center p-1 clickable approval-only" style="width : 90px; height:22px; padding:2px; cursor:pointer;" id="approver">승인</th>
|
|
</tr>
|
|
<tr style="height:40px;">
|
|
<th class="text-center" id="writerDisplay"></th>
|
|
<th class="text-center" id="reviewerDisplay"></th>
|
|
<th class="text-center" id="approvalDisplay"></th>
|
|
</tr>
|
|
<th class="text-center" style="height:22px; padding:2px;">판매/<?=$orderman?></th>
|
|
<th class="text-center" style="height:22px; padding:2px;">회계</th>
|
|
<th class="text-center" style="height:22px; padding:2px;">생산관리</th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center blueBlackBold" >상 품 명</th>
|
|
<th class="text-center blueBlackBold"><?=$prodname?></th>
|
|
<th class="text-center blueBlackBold">제품명</th>
|
|
<th class="text-center blueBlackBold"><?=$prodcode?></th>
|
|
<th class="text-center blueBlackBold">인정번호</th>
|
|
<th colspan="4" class="text-center blueBlackBold fw-bold"><?=$warrantyNum?></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="d-flex align-items-center justify-content-start ">
|
|
<table class="table table-bordered" style="border-collapse: collapse;">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2" class="text-center align-middle lightgray" style="width:33%;">신 청 업 체</th>
|
|
<th colspan="2" class="text-center align-middle lightgray" style="width:33%;">신 청 내 용</th>
|
|
<th colspan="2" class="text-center align-middle lightgray" style="width:33%;">납 품 정 보</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">발주일</th>
|
|
<th class="text-center"><?=specialDate($orderdate)?></th>
|
|
<th class="text-center align-middle lightgray">현 장 명</th>
|
|
<th colspan="3" class="text-center text-primary fw-bold"><?=$outworkplace?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">발주처</th>
|
|
<th class="text-center"><?=$secondord?> </th>
|
|
<th class="text-center align-middle lightgray">납기요청일</th>
|
|
<th colspan="1" class="text-center text-primary fw-bold"><?=specialDate($outdateplusone)?> </th>
|
|
<th class="text-center align-middle lightgray">인수담당자</th>
|
|
<th colspan="1" class="text-center text-primary fw-bold"><?=$orderman?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">발주 담당자</th>
|
|
<th class="text-center"><?=$orderman?></th>
|
|
<th class="text-center align-middle lightgray">출고일</th>
|
|
<th colspan="1" class="text-center text-primary fw-bold"><?=specialDate($outdate)?> </th>
|
|
<th class="text-center align-middle lightgray">인수자연락처</th>
|
|
<th class="text-center text-primary fw-bold"><?=$_SESSION['hp']?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">담당자 연락처</th>
|
|
<th class="text-center text-dark fw-bold"><?=$_SESSION['hp']?> </th>
|
|
<th class="text-center align-middle lightgray">셔터총수량</th>
|
|
<th class="text-center"> <?=$surang ?> (개소) </th>
|
|
<th class="text-center align-middle lightgray">배 송 방 법</th>
|
|
<th class="text-center"> <?=$delivery ?> </th>
|
|
</tr>
|
|
<tr>
|
|
<th class="text-center align-middle lightgray">배송지 주소</th>
|
|
<th colspan="5" class="text-center"><?=$outputplace?></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="d-flex align-items-center justify-content-start ">
|
|
<table class="table" style="border-collapse: collapse; padding:5;">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center fw-bold w120px" >
|
|
* 별도 추가사항
|
|
</td>
|
|
<td class="text-center fw-bold fs-6" style="background-color:yellow; padding:15!important;" >
|
|
<?=$displayText?>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="d-flex align-items-center justify-content-start ">
|
|
<table class="table" style="border-collapse: collapse; padding:15;">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center fw-bold fs-6" style="padding:15!important;" >
|
|
아래와 같이 주문하오니 품질 및 납기일을 준수하여 주시기 바랍니다.
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<?php
|
|
// 자재앞에 순서를 적어주는 변수 예시) 1. 철재, 2. 모터, 3. 절곡품, 4. 부자재, 5. 소모품
|
|
$partCounter = 1;
|
|
?>
|
|
<!-- 철재 체크 되어 있으면 철재 출력 -->
|
|
<?php if(isset($slatcheck) && $slatcheck === '1') { ?>
|
|
<div class="row mt-2 ">
|
|
<div class="d-flex align-items-center justify-content-start">
|
|
<?php echo $partCounter . '. 슬랫(SLAT) - EGI 1.55T'; ?>
|
|
</div>
|
|
</div>
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/slat.php'; ?> <!-- 모터, 발주서, 출고증, 확인서 등등 공통 -->
|
|
<?php $partCounter++; } ?>
|
|
|
|
<!-- 모터 체크 되어 있으면 모터 출력 -->
|
|
<?php if(isset($motor) && $motor === '1') { ?>
|
|
<div class="row mt-2 ">
|
|
<div class="d-flex align-items-center justify-content-start">
|
|
<?php echo $partCounter . '. 모터'; ?>
|
|
</div>
|
|
</div>
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/motor_slat.php'; ?> <!-- 모터, 발주서, 출고증, 확인서 등등 공통 -->
|
|
<?php $partCounter++; } ?>
|
|
|
|
|
|
<!-- 절곡품 체크 되어 있으면 절곡품 출력 -->
|
|
<?php if(isset($steel) && $steel === '1') { ?>
|
|
<div class="row mt-2 ">
|
|
<div class="d-flex align-items-center justify-content-start">
|
|
<?php echo $partCounter . '. 절곡품'; ?>
|
|
<br>
|
|
<?php
|
|
|
|
// 가이드레일 정보 표시
|
|
if (trim($prodcode) == "KQTS01" ) {
|
|
$result = $partCounter . "-1. 가이드레일 - SUS 1.55T ";
|
|
} elseif ($prodcode == "KTE01") {
|
|
$result = $partCounter . "-2. 가이드레일 - EGI 1.55T ";
|
|
}
|
|
echo $result;
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/guiderail_slat.php'; ?> <!-- 가이드레일 공통사항 발주서 등 -->
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/shutterbox_slat.php'; ?> <!-- 출고증, 발주서 등등 공통셔터박스 내용 -->
|
|
|
|
|
|
<div class="row mt-2">
|
|
<div class="d-flex justify-content-start ">
|
|
<?php echo $partCounter . '-3. 하단마감재'; ?> <br>
|
|
<?php
|
|
if (trim($prodcode) == "KQTS01" or trim($prodcode) == "KTS01") {
|
|
$result = "하단마감재(SUS 1.55T) ";
|
|
} else {
|
|
$result = "하단마감재(EGI 1.55T) ";
|
|
}
|
|
echo $result . '</div></div>' ;
|
|
?>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/bottombar_slat.php'; ?> <!-- 하단마감재 발주서 등등 공통 -->
|
|
<?php $partCounter++; } ?>
|
|
|
|
<!-- 부자재 체크 되어 있으면 부자재 출력 -->
|
|
<?php if(isset($partscheck) && $partscheck === '1') { ?>
|
|
<div class="row mt-2">
|
|
<div class="d-flex justify-content-start">
|
|
<?php echo $partCounter . '. 부자재 - 감기샤프트, 각파이프, 앵글'; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/subgoods_slat.php'; ?> <!-- 부자재 발주서 등등 공통 -->
|
|
<?php $partCounter++; } ?>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/etc.php'; ?> <!-- 소모품 등 발주서 등등 공통 -->
|
|
|
|
</div>
|
|
</div> <!-- end of container -->
|
|
|
|
</form>
|
|
<!-- 페이지로딩 -->
|
|
<script>
|
|
|
|
$(document).on('click', '.saveData', function() {
|
|
saveData();
|
|
});
|
|
|
|
// 결재 취소 기능
|
|
$(document).on('click', '.remove-approval', function() {
|
|
// 승인자 정보를 지우고 화면에서 숨김
|
|
$('#approvalDisplay').html('').hide();
|
|
|
|
// JSON 데이터에서 승인자의 정보 제거
|
|
let formData = JSON.parse($('#ordersheet_slat').val() || '[]');
|
|
const approvalIndex = formData.findIndex(item => item.approval);
|
|
|
|
if (approvalIndex !== -1) {
|
|
formData[approvalIndex].approval.approver.name = '';
|
|
formData[approvalIndex].approval.approver.date = '';
|
|
}
|
|
|
|
// JSON 문자열로 다시 저장
|
|
$('#ordersheet_slat').val(JSON.stringify(formData));
|
|
|
|
Toastify({
|
|
text: "승인 정보가 삭제되었습니다.",
|
|
duration: 2000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #ff5f6d, #ffc371)"
|
|
},
|
|
}).showToast();
|
|
|
|
saveData();
|
|
});
|
|
|
|
// 삽입/수정하는 모듈
|
|
function saveData() {
|
|
// 결재 부분 정보 저장
|
|
let approvalData = {
|
|
writer: {
|
|
name: $('#writerDisplay').html().split('<br>')[0] || '',
|
|
date: $('#writerDisplay').html().split('<br>')[1] || ''
|
|
},
|
|
reviewer: {
|
|
name: $('#reviewerDisplay').html().split('<br>')[0] || '',
|
|
date: $('#reviewerDisplay').html().split('<br>')[1] || ''
|
|
},
|
|
approver: {
|
|
name: $('#approvalDisplay').clone().children('i').remove().end().html().split('<br>')[0] || '',
|
|
date: $('#approvalDisplay').clone().children('i').remove().end().html().split('<br>')[1] || ''
|
|
}
|
|
};
|
|
|
|
|
|
let formData = [];
|
|
formData.push({ approval: approvalData });
|
|
|
|
// 추가 정보 저장
|
|
formData.push({ num: $('#num').val() });
|
|
formData.push({ tablename: $('#tablename').val() });
|
|
formData.push({ update_log: $('#update_log').val() });
|
|
|
|
|
|
// JSON 문자열로 변환
|
|
let jsonString = JSON.stringify(formData);
|
|
|
|
// 숨겨진 필드에 JSON 데이터 설정
|
|
$('#ordersheet_slat').val(jsonString);
|
|
|
|
$("#overlay").show(); // 오버레이 표시
|
|
$("button").prop("disabled", true); // 모든 버튼 비활성화
|
|
|
|
// 폼데이터 전송시 사용함 Get form
|
|
var form = $('#board_form')[0];
|
|
var datasource = new FormData(form);
|
|
|
|
showMsgModal(2); // 파일저장중
|
|
|
|
$.ajax({
|
|
enctype: 'multipart/form-data',
|
|
processData: false,
|
|
contentType: false,
|
|
cache: false,
|
|
timeout: 600000,
|
|
url: "insert_ordersheet_slat.php",
|
|
type: "post",
|
|
data: datasource,
|
|
dataType: "json",
|
|
success: function(data) {
|
|
// console.log(data);
|
|
setTimeout(function() {
|
|
$("button").prop("disabled", false); // 모든 버튼 활성화
|
|
hideMsgModal();
|
|
$("#overlay").hide(); // 오버레이 숨김
|
|
|
|
Toastify({
|
|
text: "저장완료",
|
|
duration: 3000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #00b09b, #96c93d)"
|
|
},
|
|
}).showToast();
|
|
|
|
}, 1000);
|
|
},
|
|
error: function(jqxhr, status, error) {
|
|
console.log(jqxhr, status, error);
|
|
alert("An error occurred: " + error);
|
|
}
|
|
});
|
|
}
|
|
|
|
// 결재부분 클릭처리
|
|
$(document).on('click', '.clickable', function() {
|
|
const isQCadmin = <?= json_encode($QCadmin); ?>; // 관리자인 경우 true
|
|
const userName = <?= json_encode($user_name); ?>; // 현재 사용자 이름
|
|
const todayStr = <?= json_encode($todayStr); ?>; // 오늘 날짜
|
|
|
|
let targetId = $(this).attr('id') + 'Display';
|
|
|
|
// 작성과 검토는 누구나 가능
|
|
if ($(this).attr('id') === 'writer' ) {
|
|
$('#' + targetId).html(userName + '<br>' + todayStr);
|
|
}
|
|
else if ($(this).attr('id') === 'reviewer') {
|
|
$('#' + targetId).html(userName + '<br>' + todayStr);
|
|
$('#reviewer_sub').val(userName );
|
|
}
|
|
// 승인 버튼은 관리자만 가능
|
|
else if ($(this).attr('id') === 'approver') {
|
|
if (!isQCadmin) {
|
|
alert('승인 권한이 없습니다.');
|
|
return;
|
|
}
|
|
|
|
// 승인자의 이름과 오늘 날짜 표시
|
|
$('#approvalDisplay').html(
|
|
userName + '<br>' + todayStr +
|
|
' <i class="bi bi-x-circle remove-approval" style="cursor: pointer;"></i>'
|
|
);
|
|
$('#approvalDisplay').show();
|
|
|
|
// 결재 정보를 업데이트하여 저장 로직에 반영
|
|
updateApprovalData(userName, todayStr);
|
|
saveData(); // 저장까지 실행하기
|
|
}
|
|
});
|
|
|
|
// 결재 정보 업데이트 함수
|
|
function updateApprovalData(userName, date) {
|
|
let approvalData = {
|
|
writer: {
|
|
name: $('#writerDisplay').text().split('<br>')[0] || '',
|
|
date: $('#writerDisplay').text().split('<br>')[1] || ''
|
|
},
|
|
reviewer: {
|
|
name: $('#reviewerDisplay').text().split('<br>')[0] || '',
|
|
date: $('#reviewerDisplay').text().split('<br>')[1] || ''
|
|
},
|
|
approver: {
|
|
name: $('#approvalDisplay').text().split('<br>')[0] || '',
|
|
date: $('#approvalDisplay').text().split('<br>')[1] || ''
|
|
}
|
|
};
|
|
|
|
let formData = JSON.parse($('#ordersheet_slat').val() || '[]');
|
|
const approvalIndex = formData.findIndex(item => item.approval);
|
|
|
|
if (approvalIndex !== -1) {
|
|
formData[approvalIndex].approval = approvalData;
|
|
} else {
|
|
formData.push({ approval: approvalData });
|
|
}
|
|
|
|
$('#ordersheet_slat').val(JSON.stringify(formData));
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
if (ordersheet_slatData.length > 0) {
|
|
console.log(ordersheet_slatData);
|
|
|
|
// 결재 부분 정보 설정
|
|
const approval = ordersheet_slatData.find(item => item.approval);
|
|
if (approval) {
|
|
$('#writerDisplay').html((approval.approval.writer.name || '') + '<br>' + (approval.approval.writer.date || ''));
|
|
$('#reviewerDisplay').html((approval.approval.reviewer.name || '') + '<br>' + (approval.approval.reviewer.date || ''));
|
|
if (approval.approval.approver.name && approval.approval.approver.date) {
|
|
$('#approvalDisplay').show();
|
|
$('#approvalDisplay').html(
|
|
approval.approval.approver.name + '<br>' + approval.approval.approver.date +
|
|
' <i class="bi bi-x-circle remove-approval" style="cursor: pointer;"></i>'
|
|
);
|
|
} else {
|
|
$('#approvalDisplay').hide().html('');
|
|
}
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'] . '/' . $tablename . '/common/pdfEmailJS.php'; ?> <!-- pdf저장 및 Email 전송 모듈 JS 불러오기 -->
|
|
|
|
</body>
|
|
</html>
|