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

?>

<div  align=left >
<?php


$cell_width="100";


$this_url="report/stock_in_by_vendor/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 "<section class='view_toolbar'>";
    echo "<div class='view_toolbar_left' style='width:50%;'>";
		echo "<font size=5 ><span class='fa fa-sign-in fa-1x'></span> <b>Stock In By Vendor Report</b></font>";

		echo "<br>";
	    
    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>";



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


	




//----------------------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>";

*/



//----------------------filters 2-------------------------------------------------------------


echo "<section class='view_toolbar' >";
	echo "<div class='view_toolbar_search_field'>";
		echo "<span class='fa fa-filter fa-lg'></span> Vendor";
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
		echo "<select class='dropdown dropdown-l' name='vendor'  >";
			
			$query_filter="select * from t_".$key_table_prefix."_vendor order by vdr_code ";
			echo "<option value=''>All Vendor</option>";
			$result_filter = mysqli_query($dbconn,$query_filter) or die("Listing failed- Err msg  ". mysqli_error($dbconn));
			while($line_filter=mysqli_fetch_array($result_filter,MYSQLI_ASSOC))
			{
				echo "<option value='".$line_filter["vdr_code"]."'>";
				echo "".$line_filter["vdr_code"]." - ".$line_filter["vdr_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-calendar fa-lg'></span> Start Date";
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
		
			echo "<input type=text class='textbox textbox-s' name='start_date' value='".date("Y-m-01")."' onfocus=blur() >";
			echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop)gfPop.fStartPop(document.form_stock_in_by_vendor_report.start_date,document.form_stock_in_by_vendor_report.end_date);"."return false;\" HIDEFOCUS>";
			//echo "<img class=\"PopcalTrigger\" align=\"absmiddle\" "."src=".$addon_path.$theme_path."icon/calendar.gif border=0>";
			echo " <span class='fa fa-calendar fa-lg'></font>";
			echo "</a>"; 
			
			
	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-calendar fa-lg'></span> End Date";
	echo "</div>";
	echo "<div class='view_toolbar_search_button'>";
		
			echo "<input type=text class='textbox textbox-s' name='end_date' value='".date("Y-m-d")."' onfocus=blur() >";
			echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop)gfPop.fEndPop(document.form_stock_in_by_vendor_report.start_date,document.form_stock_in_by_vendor_report.end_date);"."return false;\" HIDEFOCUS>";
			//echo "<img class=\"PopcalTrigger\" align=\"absmiddle\" "."src=".$addon_path.$theme_path."icon/calendar.gif border=0>";
			echo " <span class='fa fa-calendar fa-lg'></font>";
			echo "</a>"; 
	
	
	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/stock_in_by_vendor/index.php?warehouse='+document.form_stock_in_by_vendor_report.warehouse.value+'&vendor='+document.form_stock_in_by_vendor_report.vendor.value+'&start='+document.form_stock_in_by_vendor_report.start_date.value+'&end='+document.form_stock_in_by_vendor_report.end_date.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";

?>
