cm^2 변환: 1cm^2 = 100mm^2)
$area_cm2 = ($number * $calWidth * $calHeight) / 1000; // mm² 단위로 변환
// 무게 계산 (g 단위) -> kg로 변환
$weight_g = $area_cm2 * $density; // g 단위
$weight_kg = $weight_g / 1000; // kg 단위로 변환
// 누적 계산을 위한 static 변수
static $SUS_total = 0;
static $EGI_total = 0;
// 누적 합계 처리
if (strpos($calItem, 'SUS') !== false) {
$SUS_total += $weight_kg;
} elseif (strpos($calItem, 'EGI') !== false) {
$EGI_total += $weight_kg;
}
// 소수점 둘째 자리까지 포맷팅
return [
'current_weight' => number_format($weight_kg, 2),
'SUS_total' => number_format($SUS_total, 2),
'EGI_total' => number_format($EGI_total, 2)
];
}
function getSLengthCode($length, $category) {
switch ($category) {
case '연기차단재50':
switch ($length) {
case '3000':
return '53';
case '4000':
return '54';
default:
return null; // 해당하는 값이 없을 경우
}
case '연기차단재80':
switch ($length) {
case '3000':
return '83';
case '4000':
return '84';
default:
return null; // 해당하는 값이 없을 경우
}
case '기타':
switch ($length) {
case '1219':
return '12';
case '2438':
return '24';
case '3000':
return '30';
case '3500':
return '35';
case '4000':
return '40';
case '4150':
return '41';
case '4200':
return '42';
case '4300':
return '43';
default:
return null; // 해당하는 값이 없을 경우
}
default:
return null; // 카테고리가 없는 경우
}
}
// 출고일이 존재할 경우에만 다음날 계산
if ($outdate) {
// 출고일을 DateTime 객체로 변환
$date = new DateTime($outdate);
// 1일 더하기
$date->modify('+1 day');
// 형식화된 날짜 (예: Y-m-d 형식)로 출력
$outdateplusone = $date->format('Y-m-d');
} else {
// 출고일이 없을 경우 기본값
$outdateplusone = '';
}
$orderdate = isset($_REQUEST['orderdate']) ? $_REQUEST['orderdate'] : ''; // 발주일
$prodCode = isset($_REQUEST['prodCode']) ? $_REQUEST['prodCode'] : ''; // prodCode 받기
$warrantyNum = isset($_REQUEST['warrantyNum']) ? $_REQUEST['warrantyNum'] : ''; // warrantyNum 받기
// 추가된 변수 받기
$delivery = isset($_REQUEST['delivery']) ? $_REQUEST['delivery'] : ''; // 배송 옵션 받기
$outworkplace = isset($_REQUEST['outworkplace']) ? $_REQUEST['outworkplace'] : ''; // 출고 작업장 받기
$outputplace = isset($_REQUEST['outputplace']) ? $_REQUEST['outputplace'] : ''; // 배송 주소지
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 "검색결과가 없습니다.
";
} else {
$row = $stmh->fetch(PDO::FETCH_ASSOC);
include "_row.php";
// output_extra 테이블에서 데이터 불러오기
require_once $_SERVER['DOCUMENT_ROOT'] . '/output/load_output_extraTable.php';
// $prodCode 값에 따라 $prodItem 값 설정
if ($prodCode === "KSE01" || $prodCode === "KSS01") {
$prodItem = "철재";
} else {
$prodItem = "철재";
}
}
} catch (PDOException $Exception) {
print "오류: " . $Exception->getMessage();
}
// JSON 문자열을 PHP 배열로 디코딩합니다.
//스크린발주서 읽기
$eList = json_decode($eList_slat, true);
// 행의 수는 배열의 크기와 동일하므로, count() 함수를 사용하여 구합니다.
$surang = count($eList);
// 데이터베이스에서 recordbending 컬럼 값을 가져온 후 디코딩
$recordbending = isset($recordbending) ? json_decode($recordbending, true) : [];
// print_r($recordbending);
// JSON 데이터를 JavaScript 변수로 변환
echo "";
// 행의 수를 출력하거나 활용할 수 있습니다.
// echo "행의 수: " . $surang . "
";
$THscreenSu = $surang + 2 ;
// 디코딩된 데이터가 배열인지 확인합니다.
if (!is_array($eList)) {
echo "데이터가 정상적이지 않습니다. 확인바랍니다.";
exit;
}
else {
foreach ($eList as $item) {
$prodcode = $item['col4'];
$GuiderailType = $item['col6'];
$FinishMat = $item['col7'];
$prodname = '';
}
}
$indateStr = date("m/d", strtotime($indate));
$todayStr = date("m/d");
?>