<?php include "../../includes/start_ajax.php";

?>

<div  align=left >
<?php


$cell_width="100";


$this_url="report/stock_balance/index.php";


$query_pdt_count="select count(pdt_id) as total,
			pdt_category_code
			from t_".$key_table_prefix."_product 
			group by pdt_category_code ; ";
$result_pdt_count =mysqli_query($dbconn,$query_pdt_count);
while($line_pdt_count = mysqli_fetch_array($result_pdt_count,MYSQLI_ASSOC))
{
	$category_product_count[$line_pdt_count["pdt_category_code"]]=$line_pdt_count["total"];
}






echo "<form name='form_balance_report' >";



echo "<section class='view_toolbar'>";
               echo "<div class='view_toolbar_left' style='width:50%;'>";
					echo "<span class='fa fa-tasks'></span> Logistic Scanning Report";
               echo "</div>";
               echo "<div class='view_toolbar_right'>";	

			

				echo "<div class='fa-stack fa-lg'  style='cursor:pointer;float:right;'  onclick=\"mon_refresh_tab(mon_current_selected_tab);\" >";
					echo "<i class='fa fa-square fa-stack-2x color_red'   ></i><i class='fa fa-refresh fa-stack-1x color_white' ></i>";
				echo "</div>";
					

               echo "</div>";
	echo "</section>";
	




//----------------------filters 1-------------------------------------------------------------


echo "<section class='view_toolbar' >";
	echo "<div class='view_toolbar_search_field'>";
		echo "<span class='fa fa-filter fa-lg'></span> Warehouse";
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
		
		echo "<select class='dropdown dropdown-auto' name='warehouse' >";
			
			
			
			echo "<option value=''>All Warehouses</option>";
			
			
			
			$query_whs="select * from t_".$key_table_prefix."_warehouse order by whs_code ; ";
			$result_whs =mysqli_query($dbconn,$query_whs);
			
			while($line_whs = mysqli_fetch_array($result_whs,MYSQLI_ASSOC))
			{
				
				echo "<option value='".$line_whs["whs_code"]."' >";
				
				
					echo $line_whs["whs_code"];
					echo " - ";
					echo $line_whs["whs_name"];
				echo "</option>";
				
			}


		
			echo "</select>";
	
	
	echo "</div>";
	echo "<div class='view_toolbar_action_button'>";
		echo "<br>";
	echo "</div>";
		
echo "</section>";




echo "<section class='view_toolbar' >";
	echo "<div class='view_toolbar_search_field'>";
		echo "<span class='fa fa-filter fa-lg'></span> Product Category";
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
		
	echo "<select class='dropdown dropdown-auto' name='category' >";
		echo "<option value='' >All Categories</option>";	
		
		$query_cat="select * from t_".$key_table_prefix."_category order by cat_code ; ";
		$result_cat =mysqli_query($dbconn,$query_cat);
		while($line_cat = mysqli_fetch_array($result_cat,MYSQLI_ASSOC))
		{
			
			
			echo "<option value='".$line_cat["cat_code"]."' >";
				echo $line_cat["cat_code"];
				echo " - ";
				echo $line_cat["cat_name"];
				
				echo " (".($category_product_count[$line_cat["cat_code"]]+0).")";
				
			echo "</option>";
			
		}
	echo "</select>";
	
	
	echo "</div>";
	echo "<div class='view_toolbar_action_button'>";
		echo "<br>";
	echo "</div>";
		
echo "</section>";






echo "<section class='view_toolbar' >";
	echo "<div class='view_toolbar_search_field'>";
		
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
	
	
		echo "  <input type=button class='button button-blue' name='generate_report'  value='Generate Report' onclick=\"print_page('print/scanning_report/index.php?warehouse='+encodeURIComponent(document.form_balance_report.warehouse.value.replace(/&/g, '%26'))+'&category='+document.form_balance_report.category.value)\">";
	
	
		
	echo "</div>";
	echo "<div class='view_toolbar_action_button'>";
			echo "<br>";
	echo "</div>";
		
echo "</section>";




echo "<div style='float:left;height:200px;'></div>";

echo "</form>";
?>
</div>
<?php include "../../includes/end_ajax.php";

?>
