<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/instock/commonRequest.php'; // 구글드라이브 세션 파일 포함
$title_message = '수입검사 성적서'; 
$tablename = 'instock'; 
$item = $title_message;
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';   

?>
<title> <?=$title_message?> </title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/style_inspection.css">
</head>
<body>	

<?php
// JavaScript에서 전달된 변수들 받기
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';  

require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.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();
    
	$row = $stmh->fetch(PDO::FETCH_ASSOC);
	include "_row.php";

} catch (PDOException $Exception) {
    print "오류: " . $Exception->getMessage();
}

$iList = isset($iList) ? json_decode($iList, true) : [];

$orderman = $user_name;	
$todayStr = date("m/d");

$indateStr = date("m/d", strtotime($inspection_date));

// JSON 데이터를 JavaScript 변수로 변환
echo "<script>";
echo "var iListData = " . json_encode($iList) . ";" ;
echo "</script>";

$item_name = isset($row['item_name']) ? $row['item_name'] : '';
$item_name = str_replace(' ', '', $item_name); // 모든 공백 제거

$spec = isset($row['specification']) ? $row['specification'] : '';
$spec = str_replace(' ', '', $spec); // 모든 공백 제거


?>