<?php

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

$book_type=$_POST['type'];
$jobid=$_POST['jobid'];
if($book_type=='pendingproduct')
{     
	$sql="SELECT `job_id`,  `prodname`,  (`qnty` - `fresh`) as pending  FROM `jobvar` where `job_id` = '$jobid' group by  prodname ";
        
	$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'>PROD. CODE</th><th align='center'>PENDING QTY</th></thead>";
		echo "<tbody>";
		while($row = mysqli_fetch_array($items)) {
				
				echo "<tr><td align='center' class='prodcode'>$row[prodname]</td><td align='center' class='qty'>$row[pending]</td></tr>";
		}
	
		echo "</tbody>";
	}
	else
	{
		echo 0;
	}

}

mysqli_close($con);


?>