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

<?php
//important================================
include "config_form.php"; //important
//important================================


//important================================
include "config_header.php"; //important
//important================================


echo "<section class='view_toolbar'>";
    echo "<div class='view_toolbar_left' style='width:80%;'>";
		echo "<font size=5 ><span class='fa fa-cubes fa-1x'></span> <b>Product Setting</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>";



if($_REQUEST["filter_product_category"]!="")
{
    $_SESSION["list_filter"]["filter_product_category"]=$_REQUEST["filter_product_category"];
}

if($_SESSION["list_filter"]["filter_product_category"]=="")
{
    $_SESSION["list_filter"]["filter_product_category"]="ALL";
}




if($_REQUEST["filter_product_vendor"]!="")
{
    $_SESSION["list_filter"]["filter_product_vendor"]=$_REQUEST["filter_product_vendor"];
}

if($_SESSION["list_filter"]["filter_product_vendor"]=="")
{
    $_SESSION["list_filter"]["filter_product_vendor"]="ALL";
}



//-------------toggle filter button---------------------
if($_REQUEST["filter_product_color"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_color"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_color"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_color"]="YES";
	}
}



if($_REQUEST["filter_product_size"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_size"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_size"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_size"]="YES";
	}
}


if($_REQUEST["filter_product_pattern"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_pattern"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_pattern"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_pattern"]="YES";
	}
}


if($_REQUEST["filter_product_featured"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_featured"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_featured"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_featured"]="YES";
	}
}


if($_REQUEST["filter_product_inventory"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_inventory"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_inventory"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_inventory"]="YES";
	}
}


if($_REQUEST["filter_product_discount"]!="")
{
	
	if($_SESSION["list_filter"]["filter_product_discount"]=="YES")
	{
	    $_SESSION["list_filter"]["filter_product_discount"]="";
	}
	else {
		$_SESSION["list_filter"]["filter_product_discount"]="YES";
	}
}


//for regional price:
$query_region = "select * 
			from t_".$key_table_prefix."_price_region 
			where reg_status = 'ACTIVE' 
			order by reg_code ";
$result_region = mysqli_query($dbconn, $query_region);
while($line_region = mysqli_fetch_array($result_region,MYSQLI_ASSOC))
{

	$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m ";	
	//$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m input_error";	
}







//============================================FORM SUBMITTED======================================================
if ($_SERVER[REQUEST_METHOD] == 'POST') {
$error_msg="";
$password_confirmation=false;
$password_temp="";

	for($i=1;$i<=count($form_field);$i++)
	{
		
		
		if($form_field_type[$i]=="DROPDOWN")
		{
			
			if($form_field_checking[$i]=="COMPULSORY")
			{
				if($_REQUEST[$form_field[$i]]=="")
					{
						$error_msg=$error_msg."<li>".$form_field_label[$i]."</li>";	  
						$form_field_class[$i]=$form_field_class[$i]." select_error";
					}
			}	
			
		}
		elseif($form_field_type[$i]=="QUANTITY")
		{
			if(($form_field_checking[$i]=="COMPULSORY")and($_REQUEST[$form_field[$i]]==""))
			{
				$error_msg=$error_msg."<li>".$form_field_label[$i]."</li>";	  
				$form_field_class[$i]=$form_field_class[$i]." input_error";
				
			}
			else
			{
				if($_REQUEST[$form_field[$i]]!="")
				{
						if(!is_numeric($_REQUEST[$form_field[$i]]))
						{
							$error_msg=$error_msg."<li>".$form_field_label[$i]." must be number value only.</li>";	  
							$form_field_class[$i]=$form_field_class[$i]." input_error";
						}
						else
						{
							if(stripos($_REQUEST[$form_field[$i]],'.'))
							{
								$error_msg=$error_msg."<li>".$form_field_label[$i]." must be integer value only.</li>";	  
								$form_field_class[$i]=$form_field_class[$i]." input_error";
							}
						}
				}			
				
			}	
			
			
		}
		elseif($form_field_type[$i]=="PRICE")
		{
			if(($form_field_checking[$i]=="COMPULSORY")and($_REQUEST[$form_field[$i]]==""))
			{
				$error_msg=$error_msg."<li>".$form_field_label[$i]."</li>";	  
				$form_field_class[$i]=$form_field_class[$i]." input_error";
				
			}
			else
			{
				if($_REQUEST[$form_field[$i]]!="")
				{
						if(!is_numeric($_REQUEST[$form_field[$i]]))
						{
				
							$error_msg=$error_msg."<li>".$form_field_label[$i]." must be numeric value only.</li>";	  
							$form_field_class[$i]=$form_field_class[$i]." input_error";
						}
				}
				
			}	
			
			
		}
		else
		{
			if($form_field_checking[$i]=="COMPULSORY")
			{
				if($_REQUEST[$form_field[$i]]=="")
					{
						$error_msg=$error_msg."<li>".$form_field_label[$i]."</li>";	  
						$form_field_class[$i]=$form_field_class[$i]." input_error";
					}
			}	
			
			
		}
		
		
		if($form_field_checking[$i]=="PASSWORD1")
		{
			if($_REQUEST[$form_field[$i]]=="")
				{
					 
				}
			else
				{
					$password_temp=$_REQUEST[$form_field[$i]];
				}
		}	
		
		if($form_field_checking[$i]=="PASSWORD2")
		{
			if($_REQUEST[$form_field[$i]]=="")
				{
					if($password_temp!="")
					{
						$error_msg=$error_msg."<li>Password confirmation</li>";	
						$form_field_class[$i]=$form_field_class[$i]." input_error";
					}
				}
			else
				{
				 	if($password_temp=="")
				 	{
						$error_msg=$error_msg."<li>Password</li>";	
						$form_field_class[$i-1]=$form_field_class[$i-1]." input_error";
					}
					else
					{
						if($password_temp!=$_REQUEST[$form_field[$i]])
					 	{
							$error_msg=$error_msg."<li>Password Confirmation Not Match</li>";
							$form_field_class[$i]=$form_field_class[$i]." input_error";
							$form_field_class[$i-1]=$form_field_class[$i-1]." input_error";	
						}
					}
				 	
				
				}
		}
                
                
        if($form_field_unique[$i]=="YES")
		{
            if($_REQUEST[$form_field[$i]]!="")
            {
                    $query_duplicate="select * from $form_table_name
                                where ".$form_field[$i]." = '".$_REQUEST[$form_field[$i]]."'
                                and  not ".$form_key_id." = '".$_REQUEST[$form_key_id]."'
                                 ";
                    $result_duplicate = mysqli_query($dbconn,$query_duplicate) or die("Error in Duplication Checking");
                    if($line_duplicate = mysqli_fetch_array($result_duplicate,MYSQLI_ASSOC))
                    {
                        
                        $error_msg=$error_msg."<li>Duplicate entry found for ".$form_field_label[$i]."</li>";	  
                        $form_field_class[$i]=$form_field_class[$i]." input_error";
                    }
                
                
                }
                
        }   
	}



	
	//for regional price:
	$query_region = "select * 
				from t_".$key_table_prefix."_price_region 
				where reg_status = 'ACTIVE' 
				order by reg_code ";
	$result_region = mysqli_query($dbconn, $query_region);
	while($line_region = mysqli_fetch_array($result_region,MYSQLI_ASSOC))
	{
	
		$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m ";	
		//$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m input_error";	
		
		
		if($_REQUEST["region_price_".$line_region["reg_id"].""]!="")
		{
				if(!is_numeric($_REQUEST["region_price_".$line_region["reg_id"].""]))
				{
		
					$error_msg=$error_msg."<li>Regional Price ".$line_region["reg_name"]." must be numeric value only.</li>";	  
					$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m input_error";	
				}
		}
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	if($error_msg=="")
		{
	
		if($_REQUEST[$form_key_id]=="")
			{	
			  	$query="";
				$query=$query."INSERT INTO $form_table_name(";
				for($i=1;$i<=count($form_field);$i++)
				{
				 
				 	if($form_field_type[$i]=="PASSWORD")
				 	{
				 	 	if(($form_field_checking[$i]=="PASSWORD1")&&($_REQUEST[$form_field[$i]]!=""))
				 	 	{
							$query=$query."".$form_field[$i].",";
						}
					}
					elseif(($form_field_type[$i]!="FILE")AND($form_field_type[$i]!="FILE_PHOTO"))
					{
						$query=$query."".$form_field[$i].",";
					}
					
				}
				
				if($_REQUEST["relationkey"]!="")
				{
					$query=$query." ".$header_save_field.",";
				}
				
                $query=$query."client_id,";
                
				$query=$query."created_by,";
				$query=$query."modified_by,";
				$query=$query."created_date,";
				$query=$query."modified_date";
				$query=$query.")VALUES(";
				for($i=1;$i<=count($form_field);$i++)
				{
				 	if($form_field_type[$i]=="PASSWORD")
				 	{
				 	 	if(($form_field_checking[$i]=="PASSWORD1")&&($_REQUEST[$form_field[$i]]!=""))
				 	 	{
				 	 	 	
							$query=$query."'".md5($_REQUEST[$form_field[$i]])."',";
						}
					}
					elseif(($form_field_type[$i]!="FILE")AND($form_field_type[$i]!="FILE_PHOTO"))
					{
						if(($form_field_type[$i]=="PRICE")or($form_field_type[$i]=="QUANTITY"))
						{
								if($_REQUEST[$form_field[$i]]!="")
								{
										$query=$query."'".toMySQLString($_REQUEST[$form_field[$i]])."',";
								}
								else{
										$query=$query."null,";		
								}
								
						}
						else{
								$query=$query."'".toMySQLString($_REQUEST[$form_field[$i]])."',";		
						}
						
					}
					
				}
				
				if($_REQUEST["relationkey"]!="")
				{
					$query=$query." '".$_REQUEST["relationkey"]."',";
				}
                
                
                $query=$query."'".$client_id."',";
				$query=$query."'".$CurrentUserID."',";
				$query=$query."'".$CurrentUserID."',";
				$query=$query."'".date("Y-m-d H:i:s")."',";
				$query=$query."'".date("Y-m-d H:i:s")."'";
				$query=$query.");";		
				
				$result = mysqli_query($dbconn,$query) or die("Creation failed- Err msg  ". mysqli_error($dbconn));
				$_REQUEST[$form_key_id]=mysqli_insert_id($dbconn);
				$_REQUEST["action"]="EDIT";
	    		$message_type="CREATED";//to be shown at bottom
	    		mon_log_audit($CurrentUserFullName,$CurrentUserID,$form_key_id,$_REQUEST[$form_key_id],$message_type);
			}
		else
			{	
			  	$query="";
			  	$query=$query."UPDATE $form_table_name SET ";
			  
				for($i=1;$i<=count($form_field);$i++)
				{
				 
				 	if($form_field_type[$i]=="PASSWORD")
				 	{
				 	 	if(($form_field_checking[$i]=="PASSWORD1")&&($_REQUEST[$form_field[$i]]!=""))
				 	 	{
							$query=$query."".$form_field[$i]."='".md5($_REQUEST[$form_field[$i]])."',";
						}
					}
					elseif(($form_field_type[$i]!="FILE")AND($form_field_type[$i]!="FILE_PHOTO"))
					{
						
						if(($form_field_type[$i]=="PRICE")or($form_field_type[$i]=="QUANTITY"))
						{
								if($_REQUEST[$form_field[$i]]!="")
								{
										$query=$query."".$form_field[$i]."='".toMySQLString($_REQUEST[$form_field[$i]])."',";
								}
								else{
										$query=$query."".$form_field[$i]." = null,";		
								}
								
						}
						else{
								$query=$query."".$form_field[$i]."='".toMySQLString($_REQUEST[$form_field[$i]])."',";
						}
						
						
						
					}
					
				}
				if($_REQUEST["relationkey"]!="")
				{
					$query=$query." ".$header_save_field."='".$_REQUEST["relationkey"]."',";
				}
				$query=$query."modified_by='".$CurrentUserID."',";
				$query=$query."MODIFIED_DATE='".date("Y-m-d H:i:s")."' ";
				$query=$query."WHERE $form_key_id=".$_REQUEST[$form_key_id];
				$query=$query.";";	
				
			
			
				$result = mysqli_query($dbconn,$query) or die("Saving failed- Err msg  ". mysqli_error($dbconn).$query);
				
				$message_type="UPDATED";//to be shown at bottom
	    		mon_log_audit($CurrentUserName,$CurrentUserID,$form_key_id,$_REQUEST[$form_key_id],$message_type);
			}			
	    	
		
		
		
			//clear
			$query_clear="delete from t_".$key_table_prefix."_product_region_price
			 		where rpr_product_id = '".$_REQUEST[$form_key_id]."' ";
			$result_clear = mysqli_query($dbconn, $query_clear);
			
			
			
			//for regional price:
			$query_region = "select * 
						from t_".$key_table_prefix."_price_region 
						where reg_status = 'ACTIVE' 
						order by reg_code ";
			$result_region = mysqli_query($dbconn, $query_region);
			while($line_region = mysqli_fetch_array($result_region,MYSQLI_ASSOC))
			{
			
				$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m ";	
				//$form_field_class_region[$line_region["reg_id"]]="textbox textbox-m input_error";	
				
				
				if($_REQUEST["region_price_".$line_region["reg_id"].""]!="")
				{
					
					//insert:
					$query_insert_region_price = "insert into t_".$key_table_prefix."_product_region_price 
									(
									rpr_product_id,
									rpr_region_id,
									rpr_price,
									created_date,
									modified_date,
									created_by,
									modified_by
									)
									VALUES
									(
									'".$_REQUEST[$form_key_id]."',	
									'".$line_region["reg_id"]."',
									'".$_REQUEST["region_price_".$line_region["reg_id"].""]."',
									'".date("Y-m-d H:i:s")."',
									'".date("Y-m-d H:i:s")."',
									'".$CurrentUserID."',
									'".$CurrentUserID."'
									)
									;";
					$result_insert_region_price = mysqli_query($dbconn, $query_insert_region_price);
					
					
					
					
					
				}
				
				
			}
			
			
			
			
			
			
			//=================compute qr code===========================================
			
			$qr_string=$_REQUEST["pdt_barcode"];
			if($qr_string!="")
			{
				include "../../plugin/phpqrcode/qrlib.php";
				QRcode::png($qr_string,realpath("../../")."/qr_codes/".$qr_string.".png");
					
			}
			
			
			
			
	    }
    else
	    {
	      	$message_type="FAIL";//to be shown at bottom  	
		}
		
			for($i=1;$i<=count($form_field);$i++)
			{
			 	if($form_field_type[$i]=="PASSWORD")
				{
				 $form_field_value[$i]="";
				}
				else
				{
				 $form_field_value[$i]=$_REQUEST[$form_field[$i]];		
				}
					
			}
			
}
?>



<?php
//=====================SYSTEM Script(DO NOT CHANGE): DELETION=======================================================
	if(($_REQUEST[$form_key_id]!="")and($_REQUEST["action"]== 'MARK'))
	  	{
			if(isset($_SESSION["PDT_MARKING"][$_REQUEST[$form_key_id]]))
			{
				unset($_SESSION["PDT_MARKING"][$_REQUEST[$form_key_id]]);
			}
			else {
				$_SESSION["PDT_MARKING"][$_REQUEST[$form_key_id]] = $_REQUEST[$form_key_id];
			}
			
		
	  	}
//=====================END of SYSTEM Script(DO NOT CHANGE): DELETION=======================================================
?>



<?php
//=====================SYSTEM Script(DO NOT CHANGE): DELETION=======================================================
	if(($_REQUEST[$form_key_id]!="")and($_REQUEST["action"]== 'DELETE'))
	  	{
	  	  		$query="";
			  	$query=$query."DELETE from $form_table_name ";
				$query=$query."WHERE $form_key_id =".$_REQUEST[$form_key_id].";";
				$result = mysqli_query($dbconn,$query) or die("Deletion failed- Err msg  ". mysqli_error($dbconn));
	  	 		$message_type="DELETED";//to be shown at bottom  	
	  	}
//=====================END of SYSTEM Script(DO NOT CHANGE): DELETION=======================================================
?>



<?php
//=====================SYSTEM Script(DO NOT CHANGE): ACTION BUTTONS=======================================================

//$action_button_id=1;
//$action_button[$action_button_id]="Action My";
	if(($_REQUEST["ids"]!="")and($_REQUEST["action"]== 'ACTION'.$action_button_id))
	  	{
	  	 
	  	 	$id_array=explode(',',$_REQUEST["ids"]);
	  	 
	  	 	foreach($id_array as $ivalue)
	  	 	{
	  	  		$query="";
			  	$query=$query."update  $form_table_name set XXXXXXX = '' , ";
			  	$query=$query."modified_by='".$CurrentUserID."',";
				$query=$query."MODIFIED_DATE='".date("Y-m-d H:i:s")."' ";
				$query=$query."WHERE $form_key_id = '".$ivalue."';";
			//	$result = mysqli_query($dbconn,$query) or die("Update failed- Err msg  ". mysqli_error($dbconn));
	  	 		$message_type="UPDATED";//to be shown at bottom  	
	  	 	}
	  	 	
	  	 	if($message_type=="UPDATED"){
					displaymessage("Please defined action at <b>Action Button configuration</b>!",$message_type);
			}
	  	}
	  	
//=====================END of SYSTEM Script(DO NOT CHANGE): DELETION=======================================================
?>





<?php
//==================================GET THE LISTING=======================================================

//important================================
include "config_view.php";
//important================================	


	if ($_REQUEST["offset"]=="")
		{ $offset = 0;}
	else
		{ $offset=$_REQUEST["offset"]; }
		

		
	if ($_REQUEST["order_by"]=="")
		{ 
		
		$sql_order_by=" order by ".$form_key_id." desc  ";	
		//$order_by=1;
		}
	else
		{ 
		 $sql_order_by=" order by ".$listing_content[$_REQUEST["order_by"]]." "; 
		 $order_by=$_REQUEST["order_by"];
		}
  	
	if ($_REQUEST["sort_by"]=="")
		{ $sql_sort_by = " ";}
	else
		{ 
		 $sql_sort_by=" desc "; 
		 $sort_by=$_REQUEST["sort_by"];
		 }



	



	if ($_REQUEST["search_word"]=="")
		{ 
			$search_word = "";
			//$sql_search=" WHERE xxx=xxx ";	
			
		}
	else
		{
			$search_word = $_REQUEST["search_word"];
			$sql_search="";
			if(isset($listing_search_field))
			{
				foreach($listing_search_field as $field_to_search)
				{
					
					if($sql_search=="")
					{
						$sql_search="  ".$field_to_search." like '%".$_REQUEST["search_word"]."%' ";
					}
					else
					{
						$sql_search=$sql_search." OR  ".$field_to_search." like '%".$_REQUEST["search_word"]."%' ";	
					}
					
					
					
				}
			}
			
			
			if($field_to_search!="")
			{
				$sql_search	= " AND ( ".$sql_search." ) ";
			}
			
			
			
			
		}
	
		
	$query=$query.$sql_search;
	$query=$query.$sql_order_by." ".$sql_sort_by."  ";  
	$display_limit = " LIMIT " . $offset . "," . $limit.";";

	$extraurl=$relation_url."&order_by=".$order_by."&sort_by=".$sort_by."&search_word=".$search_word."&search_field=".$_REQUEST["search_field"];
	$result = mysqli_query($dbconn,$query." ".$display_limit) or die("Listing failed- Err msg  ". mysqli_error($dbconn));
	$num_rows = mysqli_num_rows($result);
	
	
	
	
	
	
	
	//----------------------filters 0-------------------------------------------------------------
	
	
	echo "<section class='view_toolbar' >";
		echo "<div class='view_toolbar_search_field'>";
			echo "<span class='fa fa-filter fa-lg'></span> Filter Product with Settings";
		echo "</div>";
		echo "<div class='view_toolbar_filter' style='border:0px solid #ff0000;'>";
			
			if($sys_system_master_setting_line["set_use_product_color"]=="YES")
			{
				
				
				echo "<div   class='view_toolbar_filter_box'>";			
					echo "<div class='fa-stack fa-lg'  style='cursor:pointer; ' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_color=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
						if($_SESSION["list_filter"]["filter_product_color"]=="YES")
						{
							$this_button_color="color_green";
						}
						else {
							$this_button_color="color_grey";
						}
						echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-tint fa-stack-1x color_white" ></i>';
					echo "</div> Color ";
				echo "</div>";
			}
			
			
			
			if($sys_system_master_setting_line["set_use_product_size"]=="YES")
			{	
				echo "<div   class='view_toolbar_filter_box'>";				
					echo "<div class='fa-stack fa-lg'  style='cursor:pointer; ' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_size=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
					if($_SESSION["list_filter"]["filter_product_size"]=="YES")
					{
						$this_button_color="color_green";
					}
					else {
						$this_button_color="color_grey";
					}
						echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-arrows-h fa-stack-1x color_white" ></i>';
					echo "</div> Size ";
				echo "</div>";	
					
			}
			
			if($sys_system_master_setting_line["set_use_product_pattern"]=="YES")
			{	
				
				echo "<div class='view_toolbar_filter_box'>";			
					echo "<div class='fa-stack fa-lg'  style='cursor:pointer; ' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_pattern=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
					if($_SESSION["list_filter"]["filter_product_pattern"]=="YES")
					{
						$this_button_color="color_green";
					}
					else {
						$this_button_color="color_grey";
					}
						echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-puzzle-piece fa-stack-1x color_white" ></i>';
					echo "</div> Pattern";
				echo "</div>";
				
			}
			
			echo "<div   class='view_toolbar_filter_box'>";			
				echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_featured=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
				if($_SESSION["list_filter"]["filter_product_featured"]=="YES")
				{
					$this_button_color="color_green";
				}
				else {
					$this_button_color="color_grey";
				}	
					echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-lightbulb-o fa-stack-1x color_white" ></i>';
				echo "</div> Featured ";
			echo "</div>";
			
			echo "<div   class='view_toolbar_filter_box'>";			
				echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_inventory=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
				if($_SESSION["list_filter"]["filter_product_inventory"]=="YES")
				{
					$this_button_color="color_green";
				}
				else {
					$this_button_color="color_grey";
				}	
					echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-cubes fa-stack-1x color_white" ></i>';
				echo "</div> Inventory ";
			echo "</div>";
				
			echo "<div   class='view_toolbar_filter_box'>";			
				echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_discount=YES&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
				if($_SESSION["list_filter"]["filter_product_discount"]=="YES")
				{
					$this_button_color="color_green";
				}
				else {
					$this_button_color="color_grey";
				}
					echo '<i class="fa fa-square fa-stack-2x '.$this_button_color.'"  ></i><i class="fa fa-cut fa-stack-1x color_white" ></i>';
				echo "</div> Discount ";
			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> Product Category";
		echo "</div>";
		echo "<div class='view_toolbar_search_button'>";
			echo "<select class='dropdown dropdown-l' onchange=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_category='+this.value+'&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\" >";
				
				$query_filter="select * from t_".$key_table_prefix."_category order by cat_sorting, cat_code , cat_name  ";
				
				
				
				if($_SESSION["list_filter"]["filter_product_category"]=="ALL")
				{
					echo "<option value='ALL' selected >All</option>";
				}
				else {
					echo "<option value='ALL' >All</option>";	
				}
				
				
				if($_SESSION["list_filter"]["filter_product_category"]=="UNSPECIFIED")
				{
					echo "<option value='UNSPECIFIED' selected >Unspecified</option>";
				}
				else {
					echo "<option value='UNSPECIFIED' >Unspecified</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))
				{
					if($_SESSION["list_filter"]["filter_product_category"]==$line_filter["cat_code"])
					{
						echo "<option value='".$line_filter["cat_code"]."' selected >".$line_filter["cat_code"]." - ".$line_filter["cat_name"]."</option>";
					}
					else {
						echo "<option value='".$line_filter["cat_code"]."'>".$line_filter["cat_code"]." - ".$line_filter["cat_name"]."</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' onchange=\"mon_send_get('$this_url','?offset=0".$extraurl."&filter_product_vendor='+this.value+'&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\" >";
				
				$query_filter="select * from t_".$key_table_prefix."_vendor order by vdr_code ";
				echo "<option value='ALL'>All</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))
				{
					if($_SESSION["list_filter"]["filter_product_vendor"]==$line_filter["vdr_code"])
					{
						echo "<option value='".$line_filter["vdr_code"]."' selected >".$line_filter["vdr_code"]." - ".$line_filter["vdr_name"]."</option>";
					}
					else {
						echo "<option value='".$line_filter["vdr_code"]."'>".$line_filter["vdr_code"]." - ".$line_filter["vdr_name"]."</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'>";
	
			//----search panel and navigation-----------------
			
			echo "<input type='text' class='textbox textbox-full' name=view_search id='search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."' value='".$search_word."'> ";
			
			
		
			/*	
			echo "<select id='search_field_".$form_key_id."_".$_REQUEST[$form_key_id]."' class='dropdown dropdown-search'>";
			for($i=1;$i<=count($listing_search_label);$i++)
			{
			 	if($_REQUEST["search_field"]==$i)
			 	{echo "<option value='$i' selected>".$listing_search_label[$i]."</option>";}
			 	else
			 	{echo "<option value='$i' >".$listing_search_label[$i]."</option>";}
				
			}
		
			echo "</select> ";
			
			*/
			
		echo "</div>";
		echo "<div class='view_toolbar_search_button'>";
			
			//echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value+'&search_field='+document.getElementById('search_field_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
			echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\">";
				echo '<i class="fa fa-square fa-stack-2x color_blue"  ></i><i class="fa fa-search fa-stack-1x color_white" ></i>';
			echo "</div>";
				
			echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('".$this_url."','?offset=0".$relation_url."','div_main')\">";
				echo '<i class="fa fa-square fa-stack-2x color_grey"  ></i><i class="fa fa-bars fa-stack-1x color_white" ></i>';
			echo "</div>";
			
			
		
		echo "</div>";
		echo "<div class='view_toolbar_action_button'>";
			
				
			
		if($action_cell)
		{
			if(isset($action_button))
			{
				foreach($action_button as $actbtton_id=>$action_button_name)
				{
					echo "<input type=button  value='".$action_button_name."' class=button onclick=\"mon_send_get('$this_url','?offset=0".$extraurl."&search_word='+document.getElementById('search_word_".$form_key_id."_".$_REQUEST[$form_key_id]."').value+'&search_field='+document.getElementById('search_field_".$form_key_id."_".$_REQUEST[$form_key_id]."').value+'&action=ACTION".$actbtton_id."&ids='+document.getElementById('id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."').value,'div_main')\"> ";
						
				}	
			}
					
						
						
				//print barcode sticker:
				
				
				if(count($_SESSION["PDT_MARKING"])>0)
				{
					echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"print_page('print/product_barcode/index.php')\">";
						echo '<i class="fa fa-square fa-stack-2x" style="color:#E67E22;" ></i><i class="fa fa-qrcode fa-stack-1x color_white" ></i>';
					echo "</div>";
					
					echo  "<span style='margin-left:-12px;margin-top:-6px;position:absolute;border-radius:50px;padding:3px;background:#CF000F;'><font size=1 color=#fff>".count($_SESSION["PDT_MARKING"])."</font></span>";	
				}
				else {
					
					echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"alert('Please mark the product checkbox')\">";
						echo '<i class="fa fa-square fa-stack-2x" style="color:#E67E22;" ></i><i class="fa fa-qrcode fa-stack-1x color_white" ></i>';
					echo "</div>";# code...
				}
				
	
	
				echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_next_focus_field='id_".$form_field[1]."';mon_send_get('".$this_url."','?action=NEW&offset=".$offset.$relation_url."','div_main')\">";
					echo '<i class="fa fa-square fa-stack-2x color_green"  ></i><i class="fa fa-plus fa-stack-1x color_white" ></i>';
				echo "</div>";
				
						
  
		}
		echo "</div>";
				
				
	echo "</section>";	
			
	
	
			
	if($message_type=="DELETED"){
		displaymessage("Item has been deleted!",$message_type);
	}
	
	
	
	
	
	
	//=======================End of SYSTEM Script(DO NOT CHANGE)====================

?>

<?php	
	//=================SYSTEM Script(DO NOT CHANGE) : Listing Header==================================
	echo "<section class='view_header'>";
	
	/*
	for($i=1;$i<=count($listing_header);$i++)
	{
		echo "<div class='view_header_column'>";
	
			echo "<table align=left width=100% cellspacing=0 ><tr><td rowspan=2 class='listing_header_cell_td'>";
				echo "".$listing_header[$i]."";
			echo "</td><td>";
				echo "<a href='#' onclick=\"mon_send_get('$this_url','?order_by=".$i.""."&search_word=".$search_word."&search_field=".$_REQUEST["search_field"].$relation_url."','div_main')\">";
				if(($order_by==$i)&&($sort_by==""))
				{
					echo "<img src='".$addon_path.$theme_path."icon/active_up.gif' border=0 align=right></a>";
				}
				else
				{
					echo "<img src='".$addon_path.$theme_path."icon/inactive_up.gif' border=0 align=right></a>";
				}
				
			echo "</td></tr>";
			
			echo "<tr><td>";
				echo "<a href='#' onclick=\"mon_send_get('$this_url','?order_by=".$i."&sort_by=desc"."&search_word=".$search_word."&search_field=".$_REQUEST["search_field"].$relation_url."','div_main')\">";
					if(($order_by==$i)&&($sort_by=="desc"))
				{
					echo "<img src='".$addon_path.$theme_path."icon/active_down.gif' border=0 align=right></a>";
				}
				else
				{
					echo "<img src='".$addon_path.$theme_path."icon/inactive_down.gif' border=0 align=right></a>";
				}
			echo "</td></tr></table>";
		echo "</div>";
	}
	
	*/
	
	
	echo "</section>";
	//=================End of SYSTEM Script(DO NOT CHANGE): Listing Header===========================
	
?>	










<?php

	//=================SYSTEM Script(DO NOT CHANGE):Open New Form Panel=====================
	if(($_REQUEST["action"]=="NEW")and($message_type!="CREATED"))
	{
	 
	  	
		if($message_type=="CREATED"){
		  	displaymessage("Information has been created as at ".date("g:i:s a"),$message_type);
		}
		if($message_type=="UPDATED"){
		  	displaymessage("Information has been updated as at ".date("g:i:s a"),$message_type);
		}
		if($message_type=="FAIL"){
		  	displaymessage($error_msg,$message_type);
		}
		
		include "form.php";	
		
	}
	
	//===================End of SYSTEM Script(DO NOT CHANGE):Open Form Panel=================
?>
	
	
	
	
<?php



	if(($_REQUEST[$form_key_id]!="")and($_REQUEST["action"]== 'UPLOAD_PHOTO_PANEL'))
	  	{
			
			
			include "photo_upload_panel.php";
			
		
		}
		
		
		
		
		
		
	//---------EDIT Panel (DO NOT CHANGE)---------------------------
	if(($_REQUEST[$form_key_id]!="")and($_REQUEST["action"]== 'EDIT'))
	  		{
	  	
	  		 	$query_get="SELECT * FROM $form_table_name ";
	  		 	$query_get=$query_get." WHERE $form_key_id = '".$_REQUEST[$form_key_id]."';";
	  		 	$result_get=mysqli_query($dbconn,$query_get)or die("Get Data failed- Err msg  ". mysqli_error($dbconn));
	  		  	
	  		 	if($line_get=mysqli_fetch_array($result_get,MYSQLI_ASSOC))
	  		 	{
	  		 	 
					for($i=1;$i<=count($form_field);$i++)
						{
						 
						 	if($form_field_type[$i]=="PASSWORD")
							{
							 $form_field_value[$i]="";
							}
							else
							{
							 $form_field_value[$i]=$line_get[$form_field[$i]];	
							}
						 
						
						}
						
						
						unset($region_price_value);
						
						$query_get_region_price = "SELECT * FROM t_".$key_table_prefix."_product_region_price  ";
			  		 	$query_get_region_price = $query_get_region_price." WHERE rpr_product_id = '".$_REQUEST[$form_key_id]."';";
			  		 	$result_get_region_price = mysqli_query($dbconn,$query_get_region_price)or die("Get Data failed- Err msg  ". mysqli_error($dbconn));
			  		  	
			  		 	while($line_get_region_price=mysqli_fetch_array($result_get_region_price,MYSQLI_ASSOC))
			  		 	{
							$region_price_value[$line_get_region_price["rpr_region_id"]]=$line_get_region_price["rpr_price"];
						}
						
						
						
				}
	  
		
			    
				
		
				if($message_type=="CREATED"){
				  	displaymessage("Information has been created as at ".date("g:i:s a"),$message_type);
				}
				if($message_type=="UPDATED"){
				  	displaymessage("Information has been updated as at ".date("g:i:s a"),$message_type);
				}
				if($message_type=="FAIL"){
				  	displaymessage($error_msg,$message_type);
				  		for($i=1;$i<=count($form_field);$i++)
						{
						 	if($form_field_type[$i]=="PASSWORD")
							{
							 $form_field_value[$i]="";
							}
							else
							{
							 $form_field_value[$i]=$_REQUEST[$form_field[$i]];	
							}
								
						}
						
						
						$query_get_region_price = "SELECT * FROM t_".$key_table_prefix."_product_region_price  ";
			  		 	$query_get_region_price = $query_get_region_price." WHERE rpr_product_id = '".$_REQUEST[$form_key_id]."';";
			  		 	$result_get_region_price = mysqli_query($dbconn,$query_get_region_price)or die("Get Data failed- Err msg  ". mysqli_error($dbconn));
			  		 	while($line_get_region_price=mysqli_fetch_array($result_get_region_price,MYSQLI_ASSOC))
			  		 	{
							$region_price_value[$line_get_region_price["rpr_region_id"]] = $_REQUEST["region_price_".$line_get_region_price["reg_id"].""];
						}
						
						
						
						
				}
			
				
				
			include "form.php";	
			
			}

?>
	
	
	
	
	
	
<?php	
	
	echo "<section class='view_content'>";
	
	
				//==================================first row=============================================================
				echo "<div class='view_list_title_row'>";
					
					echo "<div class='view_list_title_content'>";
						echo "<div style='min-width:20px;' class='view_list_title_row_count'  >";
							echo "#";
						echo "</div>";
						
						
						for($i=1;$i<=count($listing_header);$i++)
						{
							if($listing_content[$i]=="modified_date")
							{
								
							}
							else
							{
								echo "<div style='width:".$listing_width[$i]."px;' class='view_list_title_content_object'  >";
									echo "".$listing_header[$i]."<br>";
								echo "</div>";
							}
							
						}
						
					echo "</div>";
					
					
					if($action_cell)
					{
						echo "<div class='view_list_title_content'>";
						echo "</div>";
					}	
				
				echo "</div>";
			
			
			
			
			
			
			
			
				
		//==================================Data row=============================================================	
		$count=$offset;
		while($line=mysqli_fetch_array($result,MYSQLI_ASSOC))
			{
				
		
	 	
				$count=$count+1;
				if($_REQUEST[$form_key_id]==$line[$form_key_id])
				{
					echo "<div class='view_row'>";
				}
				else
				{
					echo "<div class='view_row'>";
				}
				
				
				
					
				//======================================================================================	
					
					
				echo "<div class='view_row_content'>";
					
					
					echo "<div style='min-width:20px;' class='view_row_count'  >";
					echo "".$count."";
					echo "</div>";
					
					
					for($i=1;$i<=count($listing_header);$i++)
					{
						
						/*
						if($form_field_type[$i]=="FILE_PHOTO")
								{
											
									$query_file="select fil_id, fil_storage_method from t_".$key_table_prefix."_file 
												where fil_mod='".$form_key_id."'
												and fil_mod_id='".$line[$form_key_id]."'
												and fil_mod_field='".$form_field[$i]."'
												";
												
									$result_file=mysqli_query($dbconn,$query_file) or die("Retrieval failed- Err msg  ". mysqli_error($dbconn));
									if($line_file=mysqli_fetch_array($result_file,MYSQLI_ASSOC))
									{
										
										 if($line_file["fil_storage_method"]=="OS")
											{
										    echo "<img  class='thumbnail_img' src='".$file_storage_folder.$line_file["fil_id"].".jpg' onclick=\"mon_send_get('$display_url','?$form_key_id=".$line[$form_key_id]."','div_display')\" >";	
											}
										 else
											{
											echo "<img  class='thumbnail_img' src='mod/uploader/file.php?id=".$line_file["fil_id"]."' onclick=\"mon_send_get('$display_url','?$form_key_id=".$line[$form_key_id]."','div_display')\" >";	
											}
									$photo_showed=true;
									} 
									
								}//end display photo
							
							
							*/
						
						
						
						
							
						
						if($listing_content[$i]=="modified_date")
						{
							
						}
						else
						{
							echo "<div style='width:".$listing_width[$i]."px;' class='view_row_content_object'  >";
							echo "<font class='view_row_content_label'>".$listing_header[$i]."</font>";
							
							
							
							
							
								echo "<font class='view_row_content_text'>";
									$this_text=$line[$listing_content[$i]];
									$this_text=str_replace(chr(10),"<br>",$this_text);
									$this_text = str_replace($search_word, "<span class='view_search_hightlight' >".$search_word."</span>", $this_text);
									
																									
									
									echo "".$this_text."";
									
									
									if($listing_content[$i]=="pdt_name")
									{
										echo "<br><font size=1 color=#BDC3C7 >".str_replace(chr(10),"<br>",$line["pdt_description"])."</font>";
										
									}
									if($listing_content[$i]=="pdt_barcode")
									{
										echo "<br>";
										echo "<img src='qr_codes/".$line["pdt_barcode"].".png' width=50 onerror=\"this.style.visibility='hidden'\" >";
										
									}
									
									if($listing_content[$i]=="pdt_code")
									{
										
										
										$query_display="SELECT pho_product_code FROM t_".$key_table_prefix."_product_photo";
										$query_display=$query_display." WHERE pho_product_code = '".$line["pdt_code"]."';";
										$result_display=mysqli_query($dbconn,$query_display)or die("Get Data failed- Err msg  ". mysqli_error($dbconn));
												
										if($line_display=mysqli_fetch_array($result_display,MYSQLI_ASSOC))
										{
					
											echo "<br><br><div style='width: 50px;
    height: 50px;
    position: relative;
    overflow: hidden;
    border-radius: 20%;'>";
											
												echo "<img src='mod/product/photo.php?code=".$line["pdt_code"]."' style=' display: inline;
    margin: 0 auto;
    height: 100%;
    width: auto;' >";
												
												
											echo "</div>";

										}
										
										
									}
									
									
									if($listing_content[$i]=="pdt_inventory_tracking")
									{
										echo "<br><font size=1 color=#BDC3C7 >".$line["pdt_inventory_costing_mode"]."</font>";
										
									}
									
									
									if($listing_content[$i]=="pdt_price")
									{
										
										
										
										$query_region_price="select count(rpr_id) as total 
											from t_".$key_table_prefix."_product_region_price 
											where rpr_product_id = '".$line["pdt_id"]."' ";
										$result_region_price = mysqli_query($dbconn,$query_region_price);
										if($line_region_price = mysqli_fetch_array($result_region_price,MYSQLI_ASSOC))
										{
											if($line_region_price["total"]>0)
											{
												echo "<br><font color=#F39C12 size=1 >Regional</font>";	
											}
										}
										
										
										if($line["pdt_price_group_1"]>0)
										{
											echo "<br><font color=#8E44AD size=1 >Group</font>";	
										}
										
										if($line["pdt_scale_price_1"]>0)
										{
											echo "<br><font color=#27AE60 size=1 >Scale</font>";	
										}
										
											
										
										
									}
									
								echo "</font><br>";
							
							echo "</div>";
						}
						
						
						
					}
						
						
					
				echo "</div>";
					
					
				//======================================================================================
				
				if($action_cell)
					{
						echo "<div class='view_row_button'>";
						
						
						
						
						if($action_cell_edit)
						{
							
							

							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_next_focus_field='id_".$form_field[1]."';mon_send_get('$this_url','?$form_key_id=".$line[$form_key_id]."&action=UPLOAD_PHOTO_PANEL&offset=".$offset.$extraurl."','div_main')\" >";
								echo '<i class="fa fa-square fa-stack-2x " style="color:#BDC3C7;"  ></i><i class="fa fa-photo fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_add_tab('Balance Adjustment','mod/balance_adjustment/index.php','?$form_key_id=".$line[$form_key_id]."')\" >";
								echo '<i class="fa fa-square fa-stack-2x " style="color:#663399;"  ></i><i class="fa fa-balance-scale fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_add_tab('Product Page','mod/product_page/index.php','?$form_key_id=".$line[$form_key_id]."')\" >";
								echo '<i class="fa fa-square fa-stack-2x " style="color:#F39C12;"  ></i><i class="fa fa-folder-open fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$print_url','?$form_key_id=".$line[$form_key_id]."','div_display')\" >";
								echo '<i class="fa fa-square fa-stack-2x color_green"  ></i><i class="fa fa-barcode fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_send_get('$display_url','?$form_key_id=".$line[$form_key_id]."','div_display')\" >";
								echo '<i class="fa fa-square fa-stack-2x color_blue"  ></i><i class="fa fa-eye fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_next_focus_field='id_".$form_field[1]."';mon_send_get('$this_url','?$form_key_id=".$line[$form_key_id]."&action=EDIT&offset=".$offset.$extraurl."','div_main')\" >";
								echo '<i class="fa fa-square fa-stack-2x color_grey"  ></i><i class="fa fa-pencil fa-stack-1x color_white" ></i>';
							echo "</div>";
							
						}
					
						if($action_cell_delete)
						{
							
							echo "<div class='fa-stack fa-lg'  style='cursor:pointer;' onclick=\"mon_delete_item('$this_url','?$form_key_id=".$line[$form_key_id]."&action=DELETE&offset=".$offset.$extraurl."','div_main');\" >";
								echo '<i class="fa fa-square fa-stack-2x color_red"  ></i><i class="fa fa-trash-o fa-stack-1x color_white" ></i>';
							echo "</div>";
							
							
						        
						}
						
						
						for($i=1;$i<=count($sub_item_url);$i++)
						{
						
							echo "<button class='button_blue' value='".$sub_item_label[$i]."'  onclick=\"mon_add_tab('".$line[$sub_item_label_dymamic_field[$i]]."','".$sub_item_url[$i]."','?".$sub_item_key[$i]."=".$line[$sub_item_key[$i]]."');\" >";
							echo "<span class='fa fa-trash-o fa-1x'></span> ".$sub_item_label[$i]."</button>";
						
						
						}
						
						
						
						/*
						echo "<input class='view_row_checkbox' type=checkbox name='' id='id_chckbox_".$count."' value='' onclick=\"if(this.checked){document.getElementById('id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."').value=document.getElementById('id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."').value+',".$line[$form_key_id]."'}else{document.getElementById('id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."').value=document.getElementById('id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."').value.replace(/,".$line[$form_key_id]."/,'')}\">";
						*/
						
						
						if(isset($_SESSION["PDT_MARKING"][$line[$form_key_id]]))
						{
							echo "<input checked class='view_row_checkbox' type=checkbox name='' id='id_chckbox_".$count."' value='' onclick=\"mon_send_get('$this_url','?$form_key_id=".$line[$form_key_id]."&action=MARK&offset=".$offset.$extraurl."','div_main')\">";
						}
						else {
							echo "<input class='view_row_checkbox' type=checkbox name='' id='id_chckbox_".$count."' value='' onclick=\"mon_send_get('$this_url','?$form_key_id=".$line[$form_key_id]."&action=MARK&offset=".$offset.$extraurl."','div_main')\">";
						}
						
						
						
						
						
						
						
						
						
						
						echo "<br>";
						
						echo "<font class='view_row_button_info'>";
							echo "<span class='fa fa-calendar'></span> ".$line["modified_date_f"]." ";	
							//echo "<span class='fa fa-male'></span> <i>Cre: ".mon_get_userfullname($line["created_by"])."</i><br>";
							echo "<span class='fa fa-male'></span> ".mon_get_userfullname($line["modified_by"])."";
						echo "</font>";
							
							
						echo "</div>";
					}	
				
				
				
				
				echo "</div>";
			
				
			} 
		
	
	
	
	echo "</section>";
	echo "<section class='view_pager'>";	
		if($count>0)
		{
			recordsetNav($query, $this_url, $offset, $limit, $tablewidth='100%', $verbiage=1, $displaytotal=1, $extraurl, $blocksize=10);
		}
		else
		{
		 	echo "<font color=#cccccc >No Record</font>";
		 
		}
	
	echo "</section>";		
		 echo "<input type=hidden value='' name='checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."' id='id_checbox_list_".$form_key_id."_".$_REQUEST[$form_key_id]."' >";
		//====================End of SYSTEM Script(DO NOT CHANGE):View Start==============================
?>



<?php include "../../includes/end_ajax.php";?>