<?php
session_start();
ob_start();
$father = $_SESSION["user_id"];
if(!isset($_SESSION["user_id"])){header("location:../logout.php");}
	include "../actions/dbPDO.php";	?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
      	<title>سيارات مع السعر</title>
         <link rel="stylesheet" href="../dist/css/bootstrap.css"/>
      	 <link rel="stylesheet" href="../css/day.css"media="print"/>
				 <script src="../js/jquery.js"></script>
				 <script src="../dist/js/umd/popper.min.js"></script>
			 	<script src="../dist/js/bootstrap.js"></script>
	 </head>
    <body onLoad="javscript:window.close( window.print())" >
			<div class="container">
						<h6 style="font-weight:bold;font-size:10pt;" >حصر السيارات مع السعر</h6>
								<div class="row" style="padding:0 ;">
									<div class="col-xs-12"style="float:right;">
	 											<table class="table table-bordered">
	 												<thead>
	 													 <tr>
															 		<th class="text-center" width="6%">م</th>
	 																<th class="text-center" width="12%">الطراز</th>
	 																<th class="text-center" width="13%">لوحة رقم</th>
	 																<th class="text-center" width="7%">موديل</th>
	 																<th class="text-center" width="26%">الشركة المالكة</th>
																	<th class="text-center" width="12%">تاريخ الشراء</th>
																	<th class="text-center" width="7%">سعر الشراء</th>
	 																<th class="text-center" width="17%">ملاحظات</th>
	 													 </tr>
	 												 </thead>
	 													 <tbody id="tstandby">
	<?php
	 			$output = ''; $talef = "";
	 				$sql =$db->prepare("SELECT cars.brand , cars.kind , concat(cars.letters,' ' ,cars.numbers) as PL , cars.model ,cars.carstatus , cars.lic_expire ,
					 								cars.total_cost , supplycomp.supp_name ,cars.start,supplycomp.supp_id
															from cars , supplycomp
												where cars.woner = supplycomp.supp_id   ORDER BY supp_id , model ");
	 							$sql->execute();
	 						if($sql->rowCount()>0)
	 						{ $ss = 1 ;
	 				while($row = $sql->fetch())
	 						{ $talef = $row['carstatus'] ;
								if($talef == 6){$talef ="سيارة تالف" ;}else{$talef = "" ;}
	 							$output .= '<tr>
															<td>' . $ss . '</td>
	 														<td>' . $row['kind'] . '</td>
	 														<td>' . $row['PL'] . '</td>
	 														<td class="text-center" >' . $row['model'] . '</td>
	 														<td>' . $row['supp_name'] . '</td>
															<td>' . $row['start'] . '</td>
															<td>' . $row['total_cost'] . '</td>
															<td>'.$talef.'</td></tr>'; $ss = $ss + 1 ;
	 																		}
	 															 }
	 															 else {$output .= '<tr><td colspan="8">لا يوجد سجلات ...</td></tr>';}
	 															 echo $output;
	 															 ?>
	 													 </tbody>
	 												 <tfoot></tfoot>
	 											 </table>
										</div>
							</div> <!-- end of table row -->

				</div><!-- main fluied container -->
    </body>
</html>
