- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
158 lines
5.2 KiB
PHP
158 lines
5.2 KiB
PHP
<?php
|
|
// 스크링 인정제품 모터 부분 (철재와는 col의 배열이 다름)
|
|
if (True) {
|
|
// 함수 호출을 통해 계산된 값을 가져옴
|
|
$specifications = calculateMotorSpecifications($eList);
|
|
$bracketSpec = calculateBracket($eList);
|
|
$bracketAngleSpec = calculateBracketAngle($eList);
|
|
|
|
// 모터 관련 데이터
|
|
$columns = [
|
|
$specifications['col1_sum'],
|
|
$specifications['col2_sum'],
|
|
$specifications['col3_sum'],
|
|
$specifications['col4_sum'],
|
|
$specifications['col5_sum'],
|
|
$specifications['col6_sum'],
|
|
$specifications['col7_sum']
|
|
];
|
|
// 연동제어기 관련 데이터
|
|
$other_columns = [
|
|
$specifications['col8_sum'],
|
|
$specifications['col9_sum'],
|
|
$specifications['col10_sum'],
|
|
];
|
|
|
|
// 모터별 전압 데이터 수집
|
|
$motorData = [
|
|
'220V' => [],
|
|
'380V' => []
|
|
];
|
|
|
|
foreach ($eList as $item) {
|
|
$motor_brand = isset($item['col18_brand']) ? $item['col18_brand'] : '';
|
|
$volt = isset($item['col18'] ) ? $item['col18'] : '';
|
|
$capacity = isset($item['col19'] ) ? $item['col19'] : '';
|
|
$quantity = isset($item['col14'] ) ? intval($item['col14']): 0;
|
|
|
|
// '없음' 단어가 포함되지 않은 경우만 처리
|
|
if ($volt && $capacity && $quantity > 0 && strpos($motor_brand, '없음') === false) {
|
|
// 해당 전압의 용량이 없으면 초기화
|
|
if (!isset($motorData[$volt][$capacity])) {
|
|
$motorData[$volt][$capacity] = 0;
|
|
}
|
|
// 수량 합산
|
|
$motorData[$volt][$capacity] += $quantity;
|
|
}
|
|
}
|
|
|
|
// HTML 구조 시작
|
|
echo '<div class="row ">';
|
|
|
|
// 1) 모터 부분
|
|
echo '<div class="col-sm-3 d-flex justify-content-start">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<thead>';
|
|
echo '<tr><th colspan="3" class="text-center lightgray">모터종류(KG)</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>';
|
|
|
|
// 모터 데이터 출력
|
|
foreach ($motorData as $volt => $capacities) {
|
|
foreach ($capacities as $capacity => $quantity) {
|
|
if ($quantity > 0) {
|
|
echo '<tr>';
|
|
echo '<td class="text-center">' . $capacity . '</td>';
|
|
echo '<td class="text-center">' . $volt . '</td>';
|
|
echo '<td class="text-center">' . $quantity . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
}
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>'; // 모터 부분 끝
|
|
|
|
// echo '<pre>';
|
|
// print_r($motorData);
|
|
// echo '</pre>';
|
|
|
|
// 2) 브라켓트 부분
|
|
echo '<div class="col-sm-6 d-flex align-items-top justify-content-center">';
|
|
echo '<table class="table" style="border-collapse: collapse;">';
|
|
echo '<thead>';
|
|
echo '<tr><th colspan="4" class="text-center lightgray">브라켓트 및 받침용 앵글</th></tr>';
|
|
echo '<tr><th class="text-center lightgray">브라켓 크기</th>';
|
|
echo '<th class="text-center lightgray">수량</th>';
|
|
echo '<th class="text-center lightgray">받침용 앵글 </th>';
|
|
echo '<th class="text-center lightgray">수량</th></tr>';
|
|
echo '</thead>';
|
|
echo '<tbody>';
|
|
|
|
// 브라켓과 앵글 데이터를 배열에 저장
|
|
$bracketData = array_values($bracketSpec['bracketSizes']); // 키를 숫자 인덱스로 변환
|
|
$angleData = array_values($bracketAngleSpec['bracketAngleSizes']); // 키를 숫자 인덱스로 변환
|
|
|
|
// 두 배열의 최대 길이를 구함
|
|
$maxRows = max(count($bracketData), count($angleData));
|
|
|
|
// 루프를 돌면서 데이터 출력
|
|
for ($i = 0; $i < $maxRows; $i++) {
|
|
echo '<tr>';
|
|
|
|
// 브라켓 데이터 출력 (해당 인덱스에 데이터가 있는지 확인)
|
|
if (isset($bracketData[$i])) {
|
|
echo '<td class="text-center">' . $bracketData[$i]['size'] . '</td>';
|
|
echo '<td class="text-center">' . $bracketData[$i]['quantity'] . '</td>';
|
|
} else {
|
|
// 데이터가 없으면 빈 칸 출력
|
|
echo '<td class="text-center">-</td>';
|
|
echo '<td class="text-center">-</td>';
|
|
}
|
|
|
|
// 앵글 데이터 출력 (해당 인덱스에 데이터가 있는지 확인)
|
|
if (isset($angleData[$i])) {
|
|
echo '<td class="text-center">' . $angleData[$i]['size'] . '</td>';
|
|
echo '<td class="text-center">' . $angleData[$i]['quantity'] * 4 . '</td>';
|
|
} else {
|
|
// 데이터가 없으면 빈 칸 출력
|
|
echo '<td class="text-center">-</td>';
|
|
echo '<td class="text-center">-</td>';
|
|
}
|
|
|
|
echo '</tr>';
|
|
}
|
|
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>'; // 브라켓트 부분 끝
|
|
|
|
// 3) 연동제어기 부분
|
|
echo '<div class="col-sm-3 d-flex align-items-top justify-content-center">';
|
|
echo '<table class="table" 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>';
|
|
|
|
$control_labels = ['매립', '노출', '뒷박스'];
|
|
for ($i = 0; $i < count($other_columns); $i++) {
|
|
if (intval(trim($other_columns[$i])) !== 0 && $other_columns[$i] !== '0') {
|
|
echo '<tr>';
|
|
echo '<td class="text-center">' . $control_labels[$i] . '</td>';
|
|
echo '<td class="text-center">' . $other_columns[$i] . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
}
|
|
|
|
echo '</tbody>';
|
|
echo '</table>';
|
|
echo '</div>'; // 연동제어기 부분 끝
|
|
|
|
echo '</div>'; // row 끝
|
|
}
|
|
?>
|