<?
						
						$query = "SELECT * FROM produk where kode LIKE '$prod%' and kode_operator LIKE '$prod' order by harga_jual asc";
						$exe = mysqli_query($conn,$query);
						$no = 1;
						while($record = mysqli_fetch_array($exe)){
                            
                            
                            $kode_p = $record['kode'];
							$nominal = $record['nominal'].".000";
							$nama = $record['nama'];
							$harga = $record['harga_jual'];
							//$pesan = $record['pesan'];
							$oprator = $record['kode_operator'];
							$gangguan = $record['gangguan'];
							$kosong = $record['kosong'];
							$catatan = $record['catatan'];
							
							$query2 = "SELECT harga FROM harga_grup where kode_level='$level' and kode_produk='$kode_p'";
							$exe2 = mysqli_query($conn,$query2);
							$jumlah=mysqli_num_rows($exe2);
							if ($jumlah == 0)
                            {
                            	$harga=$harga;
                            }
                            else{
							    while($record = mysqli_fetch_array($exe2)){
							     $harga = $record['harga'];
							    }
                            }

							$hitung=$harga+$markup;
							$harga1=number_format($hitung,0,',','.');
						
							if (empty($keterangan))
							{
							    $nominal="";
							}
							else
							{
							    $nama="";
							}

							if ($kosong == 0 && $gangguan == 0)
							{
								$status ='Open';
								echo "<tbody><tr><td><center>$no</center></td><td><center>$kode_p</center></td><td><center>$keterangan$nominal$nama</center></td><td><center>$harga1</center></td><td><center><font style='color:blue;'>$status</font></center></td></tr></tbody>";	
							}
							else if ($kosong == 1 && $gangguan == 0)
							{
								$status ='Kosong';
								echo "<tbody><tr><td><center>$no</center></td><td><center>$kode_p</center></td><td><center>$keterangan$nominal$nama</center></td><td><center>$harga1</center></td><td><center><font style='color:red;'>$status</font></center></td></tr></tbody>";
							}
							else if ($kosong == 0 && $gangguan == 1)
							{
								$status ='Gangguan';
								echo "<tbody><tr><td><center>$no</center></td><td><center>$kode_p</center></td><td><center>$keterangan$nominal$nama</center></td><td><center>$harga1</center></td><td><center><font style='color:red;'>$status</font></center></td></tr></tbody>";
							}
							else 
							{
								$status ='Close';
								echo "<tbody><tr><td><center>$no</center></td><td><center>$kode_p</center></td><td><center>$keterangan$nominal$nama</center></td><td><center>$harga1</center></td><td><center><font style='color:red;'>$status</font></center></td></tr></tbody>";
							}
							$no++;
						}
						?>