<?php

include '../../db_connect.php';

$book_type=$_POST['type'];

if($book_type=='pendingproduct')
{       
	$sql="SELECT jobid, gencode as prodcode, colorcode, (qty-fresh-demage) as 'pending', qty FROM `jobregdet` inner join prodreg on prodcode = code   where (qty-fresh-demage) >0 and `jobregdet`.status = '70'  group by jobid";
        
	$items = mysqli_query($con,$sql);
	//if result set is not empty
	if(mysqli_num_rows($items)!=0)
	{
		echo "<table width='100%' cellspacing='0' border='0' ><thead><th align='center'>Job id</th><th align='center'>Style Code </th><th align='center'>Pending</th><th align='center'>Qty</th></thead>";
		echo "<tbody>";
		while($row = mysqli_fetch_array($items)) {
				
				echo "<tr><td align='center' class='job_id'><a href='jobentry.php?jobid=$row[jobid]&mode=newrec' onClick='positionedPopup(this.href,1200,650);return false'>$row[jobid]</a></td><td align='center' class='prodcode'>$row[prodcode]</td><td align='center' class='fresh'>$row[pending]</td><td align='center' class='qnty'>$row[qty]</td></tr>";
		}
	
		echo "</tbody>";
	}
	else
	{
		echo 0;
	}

}

mysqli_close($con);


?>