<!DOCTYPE HTML>
<?php 
include('config.php');

$pt_autoid = $_POST['pt_autoid'];
$pagename = "Listing Produk";

if($pt_autoid){ $q_kategori = " AND pt_autoid = '$pt_autoid'";}
?>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo $pagename?></title>
    <?php include('../../common/script_css.php');?>

</head>
<body class="print_body">
<?php include('../../sys/navprint.php')?>
<div style="width:2000px;" class="px-2">
	<div>
    	<h5 class="bold">Listing Product</h5>
    </div>
    <table class="table" border="1" bordercolor="#CCCCCC" style="font-size:12px;" >
    <thead>
    	<tr class="bold">
        	<td style="width:30px;">No</td>
        	<td style="width:80px;">Product Code</td>
            <td style="width:220px;">Product Name</td>
            <td style="width:120px">Category</td>
            <td style="width:150px">Sub Category</td>
            <td class="tr" style="width:100px">Buy Price</td>
            <td class="tr" style="width:100px">Sell Price</td>
            <td style="width:250px">Description</td>            
	</tr>
	</thead>

<?php
$i = 1;
  $sql = " SELECT * FROM mst_product WHERE active = 1 $q_kategori ORDER BY pm_name";
  $dcon = $conn->query($sql) or die($sql);
  while($rs = $dcon->fetch_assoc()){
		
	$id = $rs['pm_autoid'];
/*
	$sqld = "SELECT * FROM dl_product_category  WHERE product_id = '$id'";
	$dcond = $conn->query($sqld) or die($sqld);
	$rowd = $dcond->fetch_array();
		$pc_autoid = $rowd['pc_autoid'];
		$sc_autoid = $rowd['sc_autoid'];
*/
?> 
	<tr>
    	<td><?php echo $i?></td>
        <td><?php echo $rs['pm_code']?></td>
        <td><?php echo $rs['pm_name']?></td>
        <td><?php echo $_pc_name[$pc_autoid]?></td>
        <td><?php echo $_sc_name[$sc_autoid]?></td>
        <td class="tr"><?php echo ($rs['pm_bprice'])?></td>
		<td class="tr"><?php echo ($rs['pm_sprice'])?></td>
        <td><?php echo $rs['pm_desc']?></td>
	</tr>
<?php 
$i = $i + 1;
} ?>

</div>
</body>

</html>