prepare($sql); $stmh->bindValue(1, $num, PDO::PARAM_INT); $stmh->execute(); $row = $stmh->fetch(PDO::FETCH_ASSOC); include '_row.php'; // output_extra 테이블에서 데이터 불러오기 require_once $_SERVER['DOCUMENT_ROOT'] . '/output/load_output_extraTable.php'; } catch (PDOException $Exception) { echo "오류: ".$Exception->getMessage(); exit; } // echo '
';
// print_r($row['eList_screen']);
// echo '
'; // echo '
';
// echo 'eList_slat 
'; // print_r($row['eList_slat']); // echo '
'; // 데이터 처리: eList_screen과 eList_slat를 모두 반영 $dataLists = []; $screenorslat = ''; if(!empty($eList_screen) and $eList_screen !=='[]' and $eList_screen !=='{}' and $eList_screen !==null ) { $eList = json_decode($eList_screen, true); foreach ($eList as $row) { $railtype = $row['col6']; $boxsize = $row['col36']; if($boxsize == 'custom' ) $boxsize = $row['col36_custom']; $boxfrontbottom = $row['col36_frontbottom']; $boxrailwidth = $row['col36_railwidth']; $boxexitdirection = $row['col36_boxdirection']; } $surang = count($eList); $screenorslat = 'screen'; } else if(!empty($eList_slat) and $eList_slat !=='[]' and $eList_slat !=='{}' and $eList_slat !==null ) { $eList = json_decode($eList_slat, true); $screenorslat = 'slat'; foreach ($eList as $row) { $railtype = $row['col6']; $boxsize = $row['col37']; if($boxsize == 'custom' ) $boxsize = $row['col37_custom']; $boxfrontbottom = $row['col37_frontbottom']; $boxrailwidth = $row['col37_railwidth']; $boxexitdirection = $row['col37_boxdirection']; } $surang = count($eList); } // echo '
';
// print_r($eList);
// echo '
'; // 가이드레일 및 셔터박스 형태를 배열로 관리 $railConfigs = [ 'screen' => [ 'defaultRailType' => '벽면형', 'validSizes' => ['120*70', '120*120'], ], 'slat' => [ 'defaultRailType' => '측면형', 'validSizes' => ['130*75', '130*125'], ], ]; // 데이터 출력 foreach ($dataLists as $type => $eList) { if (!empty($eList)) { echo "
" . strtoupper($type) . " 데이터
"; foreach ($eList as $item) { $railType = $item['col6'] ?? $railConfigs[$type]['defaultRailType']; $boxSize = $item['col36'] ?? ($type === 'slat' ? $item['col37'] : ''); if ($boxSize === 'custom') { $boxSize = $item['col36_custom'] ?? $item['col37_custom'] ?? ''; } // echo "
"; // echo "
"; // echo "

레일 유형: $railType

"; // echo "

박스 크기: $boxSize

"; // echo "
"; // echo "
"; } } } // 행의 수는 배열의 크기와 동일하므로, count() 함수를 사용하여 구합니다. function getSLengthCode($length, $category) { switch ($category) { case '연기차단재': switch ($length) { case 'W50 × 3000': return '53'; case 'W50 × 4000': return '54'; case 'W80 × 3000': return '83'; case 'W80 × 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; // 카테고리가 없는 경우 } } // 기존에 저장된 값이 있는 경우 해당 값을 설정 // echo '
';
// print_r($row);
// echo '
'; foreach ($eList as $row) { $railtype = $row['col6']; } if(!isset($DB)) $DB = 'chandj'; try { // railtype에서 첫 3글자 추출 (한글이 포함될 수 있으므로 mb_substr 사용) $railtype_prefix = mb_substr($railtype, 0, 3, 'UTF-8'); // 벽면형, 측면형, 혼합형 // SQL 쿼리 작성 (check_type, prodCode, model_name 조건 추가) $sql = "SELECT * FROM {$DB}.guiderail WHERE check_type=? AND model_name=?"; $stmh = $pdo->prepare($sql); $stmh->bindValue(1, $railtype_prefix, PDO::PARAM_STR); // railtype에서 추출한 세 글자 $stmh->bindValue(2, $prodCode, PDO::PARAM_STR); // prodCode와 일치하는 값 $stmh->execute(); $row = $stmh->fetch(PDO::FETCH_ASSOC); // print_r($row); include '../guiderail/_row.php'; } catch (PDOException $Exception) { echo "오류: " . $Exception->getMessage(); exit; } ?>
현장명 : 가이드레일 모델 : 형태 :
$inputVal) { $bendingRateVal = $product['bendingRates'][$index]; $result = $inputVal - $bendingRateVal; $accumulatedSum += $result; $sums[] = $accumulatedSum; } return $sums; } // 혼합형일 경우는 2개를 순회한다. foreach ($typesToProcess as $currentType) { if($isMixedType) { // 혼합형일때는 분류해준다. if ($currentType === '벽면형') { $rail_length = $rail_length1; $rail_width = $rail_width1; } elseif ($currentType === '측면형') { $rail_length = $rail_length2; $rail_width = $rail_width2; } } include $_SERVER['DOCUMENT_ROOT'] . "/guiderail/fun_guiderail.php" ; $productData = getProductData($model_name, $finishing_type, $rail_length, $rail_width, $check_type); ?>
$product) { $length_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) { $railvalidLength = floatval($item['col23']); // 셔터의 유효 길이 $railType = trim($item['col6']); // 벽부형, 측면형, 혼합형 여부 판단 // 혼합형일 경우 1개씩 계산, 나머지는 2개씩 계산 for ($i = 0; $i < count($length_data); $i++) { $length = $length_data[$i]['length']; if ($railvalidLength <= $length) { $length_data[$i]['sum'] += ($railType == '혼합형(120*70)(120*120)') ? 1 : 2; break; } } } // 벽면형과 측면형을 혼합형일 때는 두 개씩, 나머지는 하나씩 출력 $wall_rows = []; $side_rows = []; if($screenorslat == 'screen') { foreach ($length_data as $row) { if ($row['sum'] > 0) { if ($railType == '혼합형(120*70)(120*120)') { $wall_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; $side_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } elseif ($railType == '벽면형(120*70)') { $wall_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } elseif ($railType == '측면형(120*120)') { $side_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } } } } else { // slat인 경우 foreach ($length_data as $row) { if ($row['sum'] > 0) { if ($railType == '혼합형(130*75)(130*125)') { $wall_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; $side_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } elseif ($railType == '벽면형(130*75)') { $wall_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } elseif ($railType == '측면형(135*125)') { $side_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } } } } // 합계 행 echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; // A각 표시 행 echo ''; echo ''; echo ''; } ?>
번호 재질 절곡치수   길이    수량    면적
' . $product['label'] . '' . $product['material'] . ' '; $lastSum = 0; // sums와 colors를 함께 사용하여 배경색을 설정 foreach ($product['sums'] as $index => $sum) { $backgroundColor = $product['colors'][$index] ? 'background-color: gray;' : ''; $foreColor = $product['colors'][$index] ? 'text-white ' : ''; echo '' . $sum . ''; $lastSum = $sum; } echo '' ; echo ''; echo ''; foreach ($length_data as $row) { if($row['sum']>0) { $length = $row['length']; echo ''; $surang = $row['sum']; echo ''; $area = intval($length) * $surang * $lastSum / 1000000 ; echo ''; echo ''; echo ''; } } echo ''; echo '
' . $length . '' . $surang . ' '. number_format($area,2) . '
'; echo '
'; foreach ($product['aAngles'] as $angle) { echo '' . ($angle ? 'A"' : ' ') . ''; } echo '
'1219', 'quantity' => intval($item['col38'])], ['length' => '2438', 'quantity' => intval($item['col39'])], ['length' => '3000', 'quantity' => intval($item['col40'])], ['length' => '3500', 'quantity' => intval($item['col41'])], ['length' => '4000', 'quantity' => intval($item['col42'])], ['length' => '4150', 'quantity' => intval($item['col43'])], ]; } elseif ($screenorslat === 'slat') { // 철재스라트 데이터 $finMaterial = $item['col7']; // SUS마감/EGI마감 $boxSize = $item['col37'] === 'custom' ? $item['col37_custom'] : $item['col37']; $frontBottom = $item['col37_frontbottom']; $railWidth = $item['col37_railwidth']; $exitDirection = $item['col37_boxdirection']; $boxtopcover_sum = $item['col45']; $sideFinSu = $item['col47']; $screenorslat = 'slat'; $boxLengths = [ ['length' => '1219', 'quantity' => intval($item['col39'])], ['length' => '2438', 'quantity' => intval($item['col40'])], ['length' => '3000', 'quantity' => intval($item['col41'])], ['length' => '3500', 'quantity' => intval($item['col42'])], ['length' => '4000', 'quantity' => intval($item['col43'])], ['length' => '4150', 'quantity' => intval($item['col44'])], ]; } // 동일한 형태의 셔터박스를 그룹화 $key = "{$boxSize}|{$frontBottom}|{$railWidth}|{$exitDirection}"; if (!isset($shutterData[$key])) { $shutterData[$key] = [ 'boxSize' => $boxSize, 'frontBottom' => $frontBottom, 'railWidth' => $railWidth, 'exitDirection' => $exitDirection, 'boxtopcover_sum' => $boxtopcover_sum, 'sideFinSu' => $sideFinSu, 'count' => 0, 'type' => $screenorslat, 'screenorslat' => $screenorslat, // 'boxLengths' => array_fill(0, count($boxLengths), 0), // 길이별 누적 수량 'boxsum' => array_fill(0, count($boxLengths), 0), // 길이별 누적 수량 'boxLengths' => $boxLengths , ]; } // 그룹화된 셔터박스 정보 업데이트 $shutterData[$key]['count']++; foreach ($boxLengths as $index => $lengthData) { $shutterData[$key]['boxsum'][$index] += $lengthData['quantity']; } } // echo '
';
// print_r($shutterData);
// echo '
'; // 셔터박스 데이터를 화면에 표시 ?> $shutter): ?>
셔터박스   (점검구방향: )    전면 밑:    레일폭:      가로(폭) x 세로(높이)
'; // print_r($productData); // echo ''; // 참조 해제 (필수는 아님, 안전하게 하기 위해) // unset($product); ?>
$product): ?> '; echo ''; echo ''; echo ''; $box_data = []; $length_data = [ ['length' => '1219', 'sum' => 0], ['length' => '2438', 'sum' => 0], ['length' => '3000', 'sum' => 0], ['length' => '3500', 'sum' => 0], ['length' => '4000', 'sum' => 0], ['length' => '4150', 'sum' => 0], ]; $found = false; foreach ($box_data as &$box_row) { if ($box_row['size'] === $boxSize) { $box_row['sum'] += $shutter['count']; $found = true; break; } } if (!$found) { $box_data[] = [ 'size' => $boxSize, 'sum' => $shutter['count'], ]; } // 길이와 수량 데이터 반영 foreach ($shutter['boxsum'] as $index => $quantity) { if ($quantity > 0) { $length_data[$index]['sum'] += $quantity; } } $box_rowspan = array_filter($box_data, function ($row) { return $row['sum'] > 0; }); $length_rowspan = count(array_filter($length_data, function($length) { return $length['sum'] > 0; })); echo ''; ; echo ''; // A각 표시 행 echo ''; echo ''; echo ''; ?>
번호 재질 절곡치수   길이    수량    면적
' . $product['label'] . ' EGI 1.55T'; $lastSum = 0; // sums와 colors를 함께 사용하여 배경색을 설정 foreach ($product['sums'] as $index => $sum) { $backgroundColor = $product['colors'][$index] ? 'background-color: gray;' : ''; $foreColor = $product['colors'][$index] ? 'text-white ' : ''; echo '' . $sum . ''; $lastSum =$sum; // 마지막 합을 저장 } echo '' ; echo '
'; echo ''; echo ''; if (!strpos($product['label'], '마구리(가로)') && !strpos($product['label'], '마구리(세로)') && !strpos($product['label'], '상부덮개' )) { foreach ($length_data as $row) { if($row['sum']>0) { $length = $row['length']; echo ''; if (strpos($product['label'], '마구리(가로)') ) { $surang = $sideFinSu; $length = $boxHeight + 104; } else if (strpos($product['label'], '마구리(세로)') ) { $surang = $sideFinSu; $length = $boxWidth + 104; } else if (strpos($product['label'], '상부덮개') !== false) { $surang = $boxtopcover_sum; } else if( $selected_check_typeFlat === '양쪽 점검구' and strpos($product['label'], '후면 코너부') !== false ) { $surang = $row['sum']*2; } else { $surang = $row['sum']; } echo ''; $area = intval($length) * $lastSum / 1000000 ; echo ''; echo ''; echo ''; } } } else if ( strpos($product['label'], '마구리(가로)') || strpos($product['label'], '마구리(세로)') ) { echo ''; if (strpos($product['label'], '마구리(가로)') ) { $surang = $sideFinSu; $length = $boxHeight + 104; } else if (strpos($product['label'], '마구리(세로)') ) { $surang = $sideFinSu; $length = $boxWidth + 104; } echo ''; $area = intval($length) * $lastSum / 1000000 * $surang; echo ''; echo ''; echo ''; } else if (strpos($product['label'], '상부덮개') ) { echo ''; $surang =$boxtopcover_sum; echo ''; $area = 1219 * $lastSum / 1000000 * $surang; echo ''; echo ''; echo ''; } echo ''; echo '
' . $length . '' . $surang . ' '. number_format($area,2) . '
' . $length . '' . $surang . ' '. number_format($area,2) . '
1219 ' . $surang . ' '. number_format($area,2) . '
'; echo '
'; echo '
'; foreach ($product['aAngles'] as $angle) { echo '' . ($angle ? 'A"' : ' ') . ''; } echo '
prepare($sql); $stmh->bindValue(1, $prodCode, PDO::PARAM_STR); // prodCode와 일치하는 값 $stmh->execute(); $row = $stmh->fetch(PDO::FETCH_ASSOC); include '../bottombar/_row.php'; } catch (PDOException $Exception) { echo "오류: ".$Exception->getMessage(); exit; } ?>
하장바세트 폭: x 높이:
[ 'size' => '(60*40)', 'length_3000' => 0, 'length_4000' => 0 ], '하단보강엘바' => [ 'size' => '(60*17)', 'length_3000' => 0, 'length_4000' => 0 ], '하단보강평철' => [ 'size' => '', 'length_3000' => 0, 'length_4000' => 0 ] ]; // 데이터를 누적하여 합산 foreach ($eList as $item) { } foreach ($eList as $item) { if ($screenorslat === 'screen') { // 스크린 데이터 $item_data['하단마감재']['length_3000'] += intval($item['col49']); $item_data['하단마감재']['length_4000'] += intval($item['col50']); $item_data['하단보강엘바']['length_3000'] += intval($item['col52']); $item_data['하단보강엘바']['length_4000'] += intval($item['col53']); $item_data['하단보강평철']['length_3000'] += intval($item['col55']); $item_data['하단보강평철']['length_4000'] += intval($item['col56']); } elseif ($screenorslat === 'slat') { // 철재스라트 데이터 $item_data['하단마감재']['length_3000'] += intval($item['col50']); $item_data['하단마감재']['length_4000'] += intval($item['col51']); } } ?>
$product): // 합계 행 echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; // A각 표시 행 echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; ?>
번호 재질 절곡치수   길이    수량    면적
' . $product['label'] . '' . $product['material'] . ''; // sums와 colors를 함께 사용하여 배경색을 설정 $lastSum = 0; foreach ($product['sums'] as $index => $sum) { $backgroundColor = $product['colors'][$index] ? 'background-color: gray;' : ''; $foreColor = $product['colors'][$index] ? 'text-white ' : ''; echo '' . $sum . ''; $lastSum = $sum; } echo ''; echo '
'; echo ''; echo ''; // 현재 제품에 해당하는 길이와 수량을 출력 (예: 하장바는 하단 마감재 데이터만 출력) $current_item_data = []; switch ($product['label']) { case '1번(하장바)': $current_item_data = $item_data['하단마감재']; break; case '2번(L-바)': $current_item_data = $item_data['하단보강엘바']; break; case '3번(평철)': $current_item_data = $item_data['하단보강평철']; break; // 추가적인 품목이 있다면 여기에 케이스를 추가 } // 해당 제품의 길이별 데이터 출력 if (!empty($current_item_data)) { if ($current_item_data['length_4000'] > 0) { echo ''; echo ''; echo ''; $area_4000 = $current_item_data['length_4000'] * 4000 * $lastSum / 1000000; echo ''; echo ''; } if ($current_item_data['length_3000'] > 0) { echo ''; echo ''; echo ''; $area_3000 = $current_item_data['length_3000'] * 4000 * $lastSum / 1000000; echo ''; echo ''; } } echo ''; echo '
4000 ' . $current_item_data['length_4000'] . '' . number_format($area_4000, 2) . '
3000 ' . $current_item_data['length_3000'] . '' . number_format($area_3000, 2) . '
'; echo '
'; echo '
'; foreach ($product['aAngles'] as $angle) { echo '' . ($angle ? 'A"' : ' ') . ''; } echo '
연기차단재 (레일용, 셔터박스용)
2438, 'sum' => 0], ['length' => 3000, 'sum' => 0], ['length' => 3500, 'sum' => 0], ['length' => 4000, 'sum' => 0], ['length' => 4300, 'sum' => 0] ]; foreach ($eList as $item) { if ($screenorslat === 'screen') { // 스크린 데이터 $quantities = [ floatval($item['col31']), // 2438 크기 수량 floatval($item['col32']), // 3000 크기 수량 floatval($item['col33']), // 3500 크기 수량 floatval($item['col34']), // 4000 크기 수량 floatval($item['col35']) // 4300 크기 수량 ]; // 각 크기에 맞는 수량을 smoke_data에 추가 for ($i = 0; $i < count($smoke_data); $i++) { $smoke_data[$i]['sum'] += $quantities[$i]; } } elseif ($screenorslat === 'slat') { // 철재스라트 데이터 $quantities = [ floatval($item['col32']), floatval($item['col33']), floatval($item['col34']), floatval($item['col35']), floatval($item['col36']) ]; // 각 크기에 맞는 수량을 smoke_data에 추가 for ($i = 0; $i < count($smoke_data); $i++) { $smoke_data[$i]['sum'] += $quantities[$i]; } } } // 연기차단재 데이터가 있는 경우만 출력 $smoke_rows = []; foreach ($smoke_data as $row) { if ($row['sum'] > 0) { $smoke_rows[] = [ 'length' => $row['length'], 'sum' => $row['sum'] ]; } } $smoke_rowspan = count($smoke_rows); // W80 기준 숫자 찾기 $smokeban80 = 0; foreach ($eList as $item) { if ($screenorslat === 'screen') { // 스크린 데이터 $smokeban80 += floatval($item['col47']); } elseif ($screenorslat === 'slat') { // 철재스라트 데이터 $smokeban80 += floatval($item['col48']); } } echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
세부품명재질      길이       수량
레일용 [W50]EGI 0.8T 화이바 글라스 코팅직물 '; echo ''; echo ''; $side_sum = 0; foreach ($smoke_data as $row) { if($row['sum']>0) { echo ''; echo ''; echo ''; echo ''; $side_sum += $row['sum']; } } echo ''; echo '
' . $row['length'] . '' . $row['sum'] . '
'; echo ''; echo '
케이스용 [W80] EGI 0.8T 화이바 글라스 코팅직물 '; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
3000' . $smokeban80 . '
'; echo '
'; echo '
'; echo '
'; ?>