232 lines
8.8 KiB
PHP
232 lines
8.8 KiB
PHP
|
|
<!-- 스크린 가이드 레일 -->
|
|||
|
|
<?php
|
|||
|
|
// 1) 길이 기준 배열과 합계 초기화
|
|||
|
|
$lengths = [2438, 3000, 3500, 4000, 4300];
|
|||
|
|
$wall_rows = array_fill_keys($lengths, 0); // 벽면형 합계
|
|||
|
|
$side_rows = array_fill_keys($lengths, 0); // 측면형 합계
|
|||
|
|
|
|||
|
|
// 2) $eList 순회하며 조건에 맞는 길이 구간에 수량 누적
|
|||
|
|
foreach ($eList as $item) {
|
|||
|
|
$validLength = floatval($item['col23']); // 실제 사용 길이
|
|||
|
|
$railType = trim($item['col6']); // 레일 타입
|
|||
|
|
$surang = intval($item['col14']); // 수량
|
|||
|
|
|
|||
|
|
// 유효 길이가 해당 길이 기준 이하인 첫 번째 구간을 찾아 누적
|
|||
|
|
foreach ($lengths as $length) {
|
|||
|
|
if ($validLength <= $length) {
|
|||
|
|
if ($railType === '혼합형(120*70)(120*120)') {
|
|||
|
|
// 혼합형은 벽면·측면 둘 다에 수량을 더함
|
|||
|
|
$wall_rows[$length] += $surang;
|
|||
|
|
$side_rows[$length] += $surang;
|
|||
|
|
}
|
|||
|
|
elseif ($railType === '벽면형(120*70)') {
|
|||
|
|
// 벽면형은 수량*2로 계산
|
|||
|
|
$wall_rows[$length] += $surang * 2;
|
|||
|
|
}
|
|||
|
|
elseif ($railType === '측면형(120*120)') {
|
|||
|
|
// 측면형은 수량*2로 계산
|
|||
|
|
$side_rows[$length] += $surang * 2;
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// // 3) 결과 출력
|
|||
|
|
// echo '<pre>';
|
|||
|
|
|
|||
|
|
// // 각 길이별 벽면형 합계
|
|||
|
|
// echo "벽면형 합계:\n";
|
|||
|
|
// foreach ($wall_rows as $length => $sum) {
|
|||
|
|
// echo " {$length}mm 이하: {$sum}EA\n";
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// // 각 길이별 측면형 합계
|
|||
|
|
// echo "\n측면형 합계:\n";
|
|||
|
|
// foreach ($side_rows as $length => $sum) {
|
|||
|
|
// echo " {$length}mm 이하: {$sum}EA\n";
|
|||
|
|
// }
|
|||
|
|
// echo '</pre>';
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 4) 인덱스 배열로 변환 및 수량>0 필터링
|
|||
|
|
$wall_list = [];
|
|||
|
|
foreach ($wall_rows as $length => $sum) {
|
|||
|
|
if ($sum > 0) {
|
|||
|
|
$wall_list[] = ['length' => $length, 'sum' => $sum];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$side_list = [];
|
|||
|
|
foreach ($side_rows as $length => $sum) {
|
|||
|
|
if ($sum > 0) {
|
|||
|
|
$side_list[] = ['length' => $length, 'sum' => $sum];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$wall_count = count($wall_list);
|
|||
|
|
$side_count = count($side_list);
|
|||
|
|
$maxRows = max($wall_count, $side_count);
|
|||
|
|
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
<div class="row">
|
|||
|
|
<div class="col-sm-12">
|
|||
|
|
<div class="d-flex align-items-center justify-content-start">
|
|||
|
|
<table class="table avoid-break" style="border-collapse: collapse;">
|
|||
|
|
<?php if ($maxRows > 0): ?>
|
|||
|
|
<thead class="table-secondary">
|
|||
|
|
<tr>
|
|||
|
|
<?php if ($wall_count): ?>
|
|||
|
|
<th class="text-center">벽면형 (120×70)</th>
|
|||
|
|
<th class="text-center">길이</th>
|
|||
|
|
<th class="text-center">수량</th>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
<?php if ($side_count): ?>
|
|||
|
|
<th class="text-center">측면형 (120×120)</th>
|
|||
|
|
<th class="text-center">길이</th>
|
|||
|
|
<th class="text-center">수량</th>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
<?php for ($i = 0; $i < $maxRows; $i++): ?>
|
|||
|
|
<tr>
|
|||
|
|
<!-- 벽면형 -->
|
|||
|
|
<?php if ($i < $wall_count): ?>
|
|||
|
|
<?php if ($i === 0): ?>
|
|||
|
|
<td rowspan="<?= $maxRows ?>" class="text-center">
|
|||
|
|
<img src="../img/guiderail/guiderail_<?= $prodCode ?>_wall_120x70.jpg"
|
|||
|
|
alt="벽면형" width="120">
|
|||
|
|
</td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
<td class="text-center"><?= $wall_list[$i]['length'] ?></td>
|
|||
|
|
<td class="text-center"><?= $wall_list[$i]['sum'] ?></td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<!-- 측면형 -->
|
|||
|
|
<?php if ($i < $side_count): ?>
|
|||
|
|
<?php if ($i === 0): ?>
|
|||
|
|
<td rowspan="<?= $maxRows ?>" class="text-center">
|
|||
|
|
<img src="../img/guiderail/guiderail_<?= $prodCode ?>_side_120x120.jpg"
|
|||
|
|
alt="측면형" width="120">
|
|||
|
|
</td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
<td class="text-center"><?= $side_list[$i]['length'] ?></td>
|
|||
|
|
<td class="text-center"><?= $side_list[$i]['sum'] ?></td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</tr>
|
|||
|
|
<?php endfor; ?>
|
|||
|
|
|
|||
|
|
<!-- 하부 BASE 합계 -->
|
|||
|
|
<tr>
|
|||
|
|
<?php if ($wall_count): ?>
|
|||
|
|
<td colspan="2" class="text-center fw-bold blueBold">하부BASE (130×80)</td>
|
|||
|
|
<td class="text-center fw-bold">
|
|||
|
|
<?= array_sum(array_column($wall_list, 'sum')) ?>
|
|||
|
|
</td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
<?php if ($side_count): ?>
|
|||
|
|
<td colspan="2" class="text-center fw-bold blueBold">하부BASE (130×130)</td>
|
|||
|
|
<td class="text-center fw-bold">
|
|||
|
|
<?= array_sum(array_column($side_list, 'sum')) ?>
|
|||
|
|
</td>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</tr>
|
|||
|
|
</tbody>
|
|||
|
|
<?php else: ?>
|
|||
|
|
<tbody>
|
|||
|
|
<tr>
|
|||
|
|
<td colspan="6" class="text-center text-danger">데이터가 없습니다.</td>
|
|||
|
|
</tr>
|
|||
|
|
</tbody>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<!-- 가이드레일 연기차단재 -->
|
|||
|
|
<?php
|
|||
|
|
// 연기차단재(W50)
|
|||
|
|
if (True) {
|
|||
|
|
$smoke_data = [
|
|||
|
|
['length' => 2438, 'sum' => 0],
|
|||
|
|
['length' => 3000, 'sum' => 0],
|
|||
|
|
['length' => 3500, 'sum' => 0],
|
|||
|
|
['length' => 4000, 'sum' => 0],
|
|||
|
|
['length' => 4300, 'sum' => 0]
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
foreach ($eList as $item) {
|
|||
|
|
$validLength = floatval($item['col23']); // 셔터의 유효 길이
|
|||
|
|
|
|||
|
|
// 길이에 맞는 수량 계산
|
|||
|
|
for ($i = 0; $i < count($smoke_data); $i++) {
|
|||
|
|
$length = $smoke_data[$i]['length'];
|
|||
|
|
if ($validLength <= $length) {
|
|||
|
|
$smoke_data[$i]['sum'] += 4; // 1세트에 2개 레일 x 2개 기본적으로 연기차단재는 4개씩
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 연기차단재 데이터가 있는 경우만 출력
|
|||
|
|
$smoke_rows = [];
|
|||
|
|
foreach ($smoke_data as $row) {
|
|||
|
|
if ($row['sum'] > 0) {
|
|||
|
|
$smoke_rows[] = [
|
|||
|
|
'length' => $row['length'],
|
|||
|
|
'sum' => $row['sum']
|
|||
|
|
];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$smoke_rowspan = count($smoke_rows);
|
|||
|
|
|
|||
|
|
// 테이블 출력 시작
|
|||
|
|
echo '<div class="row">';
|
|||
|
|
echo '<div class="d-flex align-items-center justify-content-center">';
|
|||
|
|
echo '<table class="table avoid-break" style="border-collapse: collapse;">';
|
|||
|
|
|
|||
|
|
// 연기차단재 데이터 출력
|
|||
|
|
echo '<tbody>';
|
|||
|
|
echo '<tr>';
|
|||
|
|
|
|||
|
|
// 첫 번째 td (연기차단재 설명)
|
|||
|
|
echo '<td rowspan="2" class="text-center fw-bold orangeBlackBold">';
|
|||
|
|
echo '연기차단재(W50)<br>가이드레일 마감재 <span class="text-danger">"양쪽에"</span> 설치';
|
|||
|
|
echo '</td>';
|
|||
|
|
|
|||
|
|
// 두 번째 td (재료 설명)
|
|||
|
|
echo '<td rowspan="2" class="text-center orangeBlackBold">';
|
|||
|
|
echo 'EGI 0.8T +<br>화이바글라스코팅직물';
|
|||
|
|
echo '</td>';
|
|||
|
|
|
|||
|
|
// 세 번째 td (이미지)
|
|||
|
|
echo '<td rowspan="2" class="text-center ">';
|
|||
|
|
echo '<img src="../img/part/smokeban.jpg" alt="연기차단재" width="150">';
|
|||
|
|
echo '</td>';
|
|||
|
|
|
|||
|
|
// 네 번째 td (규격과 길이)
|
|||
|
|
echo '<td class="text-center fw-bold orangeBlackBold">규격[L]</td>';
|
|||
|
|
foreach ($smoke_rows as $row) {
|
|||
|
|
echo '<td class="text-center fw-bold">' . $row['length'] . '</td>';
|
|||
|
|
}
|
|||
|
|
echo '</tr>';
|
|||
|
|
|
|||
|
|
// 다섯 번째 td (수량)
|
|||
|
|
echo '<tr>';
|
|||
|
|
echo '<td class="text-center fw-bold orangeBlackBold">수량</td>';
|
|||
|
|
foreach ($smoke_rows as $row) {
|
|||
|
|
echo '<td class="text-center fw-bold">' . $row['sum'] . '</td>';
|
|||
|
|
}
|
|||
|
|
echo '</tr>';
|
|||
|
|
|
|||
|
|
echo '</tbody>';
|
|||
|
|
echo '</table>';
|
|||
|
|
echo '</div>';
|
|||
|
|
echo '</div>';
|
|||
|
|
}
|
|||
|
|
?>
|