<?php


include("connect.php");
include("functions.php");



?>
<table>
	<thead>
		<tr>
			<th>Line</th>
			<th>Group</th>
			<th>SKU</th>
			<th>Old Description</th>
			<th>New Description</th>
			<th>Notes</th>
		</tr>
	</thead>
	
<tbody>
<?php
$query = "SELECT * FROM INVENTORY WHERE Line LIKE 'BUL' AND `Group` LIKE 'INC'";
$result = mysqli_query($con, $query);
while($row = mysqli_fetch_array($result)){
	$item = new Item($row['Group'], $row['Line'], $row['SKU']);
?>
	<tr>
		<td><?= $item->Line ?></td>
		<td><?= $item->Group ?></td>
		<td><?= $item->SKU ?></td>
		<td><?= $item->Description . " " . $item->Notes ?></td>
		<td><?php
		if($item->Notes != ""){
			echo "" . str_ireplace("Bulb Type: ", "", $item->Description) . " Bulb " . substr($item->Notes, 6, stripos($item->Notes, "Watt")+4-6) . " / " .
		$item->getAttribute("Filament") .
		" / " . $item->getAttribute("Base") .
		" " . $item->getAttribute("Light color");
		echo $item->getAttribute("Light temperature")?" " . $item->getAttribute("Light temperature") . "K":"";	
		}else{
			echo $item->Description;
		}
		
		?></td>
		<td></td>
	</tr>
<?php
}

?>
</tbody>
</table>