- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
169 lines
6.0 KiB
PHP
169 lines
6.0 KiB
PHP
<!-- 감기샤프트 -->
|
|
<?php
|
|
if (true) {
|
|
// 감기샤프트 데이터를 누적하기 위한 배열 (혼합)
|
|
$shaft_data = [];
|
|
|
|
// 고정 감기샤프트 항목 (기존 방식)
|
|
$fixed_shaft = [
|
|
'4인치_3000' => 0,
|
|
'4인치_4500' => 0,
|
|
'4인치_6000' => 0,
|
|
'5인치_6000' => 0,
|
|
'5인치_7000' => 0,
|
|
'5인치_8200' => 0,
|
|
];
|
|
|
|
// 부속자재 데이터
|
|
$subs_data = [
|
|
'각파이프_3000' => 0,
|
|
'각파이프_6000' => 0,
|
|
'앵글_2500' => 0,
|
|
'마환봉_3000' => 0,
|
|
];
|
|
|
|
// 누적 처리
|
|
foreach ($eList as $item) {
|
|
// 2인치, 3인치일 경우만 동적 shaft_data 처리
|
|
$inch = isset($item['col59_inch']) ? $item['col59_inch'] : '2인치';
|
|
$length = isset($item['col59_length']) ? $item['col59_length'] : '300';
|
|
$qty = isset($item['col59']) ? intval($item['col59']) : 0;
|
|
|
|
if (in_array($inch, ['2인치', '3인치'])) {
|
|
$shaft_key = "{$inch}_{$length}";
|
|
if (!isset($shaft_data[$shaft_key])) {
|
|
$shaft_data[$shaft_key] = 0;
|
|
}
|
|
$shaft_data[$shaft_key] += $qty;
|
|
}
|
|
|
|
// 기존 방식 고정 컬럼들 (4~5인치 감기샤프트)
|
|
$fixed_shaft['4인치_3000'] += intval($item['col60']);
|
|
$fixed_shaft['4인치_4500'] += intval($item['col61']);
|
|
$fixed_shaft['4인치_6000'] += intval($item['col62']);
|
|
$fixed_shaft['5인치_6000'] += intval($item['col63']);
|
|
$fixed_shaft['5인치_7000'] += intval($item['col64']);
|
|
$fixed_shaft['5인치_8200'] += intval($item['col65']);
|
|
|
|
// 부속자재
|
|
$subs_data['각파이프_3000'] += intval($item['col68']);
|
|
$subs_data['각파이프_6000'] += intval($item['col69']);
|
|
$subs_data['마환봉_3000'] += intval($item['col70']);
|
|
$subs_data['앵글_2500'] += intval($item['col71']);
|
|
}
|
|
|
|
// 출력 시작
|
|
echo '<div class="row">';
|
|
|
|
// 감기샤프트 출력
|
|
echo '<div class="col-sm-6 justify-content-start">';
|
|
echo '<table class="table avoid-break" style="border-collapse: collapse;">';
|
|
echo '<thead>';
|
|
echo '<tr><th colspan="2" class="text-center lightgray">감기샤프트</th></tr>';
|
|
echo '<tr><th class="text-center lightgray">규격</th><th class="text-center lightgray">수량</th></tr>';
|
|
echo '</thead>';
|
|
echo '<tbody>';
|
|
|
|
// 감기샤프트 데이터 출력 전: 정렬
|
|
uksort($shaft_data, function($a, $b) {
|
|
// 1. 인치 숫자 추출 (2인치 → 2, 4인치 → 4 등)
|
|
preg_match('/(\d+)인치/', $a, $matchA);
|
|
preg_match('/(\d+)인치/', $b, $matchB);
|
|
|
|
$inchA = isset($matchA[1]) ? intval($matchA[1]) : 0;
|
|
$inchB = isset($matchB[1]) ? intval($matchB[1]) : 0;
|
|
|
|
if ($inchA !== $inchB) {
|
|
return $inchA - $inchB;
|
|
}
|
|
|
|
// 2. 길이 숫자 추출 (ex: _3000 → 3000)
|
|
preg_match('/_(\d+)/', $a, $lenA);
|
|
preg_match('/_(\d+)/', $b, $lenB);
|
|
|
|
$lengthA = isset($lenA[1]) ? intval($lenA[1]) : 0;
|
|
$lengthB = isset($lenB[1]) ? intval($lenB[1]) : 0;
|
|
|
|
return $lengthA - $lengthB;
|
|
});
|
|
|
|
// 동적 2/3인치 출력
|
|
foreach ($shaft_data as $label => $quantity) {
|
|
if ($quantity > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center blueBold">' . str_replace('_', ' ', $label) . '</td>';
|
|
echo '<td class="text-center fw-bold">' . $quantity . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
|
|
// 고정 4/5인치 출력
|
|
foreach ($fixed_shaft as $label => $quantity) {
|
|
if ($quantity > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center blueBold">' . str_replace('_', ' ', $label) . '</td>';
|
|
echo '<td class="text-center fw-bold">' . $quantity . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>'; // 감기샤프트 끝
|
|
|
|
// 부속자재 출력
|
|
echo '<div class="col-sm-6">';
|
|
echo '<table class="table avoid-break" style="border-collapse: collapse;">';
|
|
echo '<thead>';
|
|
echo '<tr><th colspan="3" class="text-center lightgray">부속자재</th></tr>';
|
|
echo '<tr><th class="text-center lightgray">구성품</th><th class="text-center lightgray">길이</th><th class="text-center lightgray">수량</th></tr>';
|
|
echo '</thead>';
|
|
echo '<tbody>';
|
|
|
|
// 각파이프 (rowspan)
|
|
$pipe_rowspan = 0;
|
|
if ($subs_data['각파이프_3000'] > 0) $pipe_rowspan++;
|
|
if ($subs_data['각파이프_6000'] > 0) $pipe_rowspan++;
|
|
|
|
if ($pipe_rowspan > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center blueBold" rowspan="' . $pipe_rowspan . '">각파이프</td>';
|
|
if ($subs_data['각파이프_3000'] > 0) {
|
|
echo '<td class="text-center fw-bold">3000</td>';
|
|
echo '<td class="text-center fw-bold">' . $subs_data['각파이프_3000'] . '</td>';
|
|
echo '</tr>';
|
|
if ($subs_data['각파이프_6000'] > 0) echo '<tr>';
|
|
}
|
|
if ($subs_data['각파이프_6000'] > 0) {
|
|
echo '<td class="text-center fw-bold">6000</td>';
|
|
echo '<td class="text-center fw-bold">' . $subs_data['각파이프_6000'] . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
|
|
// 앵글
|
|
if ($subs_data['앵글_2500'] > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center blueBold">앵글<br>(40*40*3T)</td>';
|
|
echo '<td class="text-center fw-bold">2500</td>';
|
|
echo '<td class="text-center fw-bold">' . $subs_data['앵글_2500'] . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
// 마환봉
|
|
if ($subs_data['마환봉_3000'] > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center blueBold">마환봉<br>(6mm)</td>';
|
|
echo '<td class="text-center fw-bold">3000</td>';
|
|
echo '<td class="text-center fw-bold">' . $subs_data['마환봉_3000'] . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>'; // 부속자재 끝
|
|
|
|
echo '</div>'; // 전체 row 끝
|
|
}
|
|
?>
|