<?php


//All this setting can be configured accordingly for the view display
  	
  	//===Row Limit per page========
	$limit=50;
  
  	
    //===Search Label =============
    //no need to specify field for search after v7.1 framework
	//$listing_search_label[1]="Name";
	//$listing_search_label[2]="User ID";
	//$listing_search_label[3]="Email";
	
		
	//===Search Fields==========
	$listing_search_field[1]="pdt_code";
	$listing_search_field[2]="pdt_barcode";
	$listing_search_field[3]="pdt_name";
	$listing_search_field[4]="pdt_price";
	$listing_search_field[5]="pdt_description";
        
        
        
  	//===Header Label =============
  	$listing_header[1]="Modified Date";
	$listing_header[2]="Code";
	$listing_header[3]="Name";
	$listing_header[4]="Barcode";
	$listing_header[5]="Price";
	$listing_header[6]="Uom";
	$listing_header[7]="Inventory";
	$listing_header[8]="Featured";
	$listing_header[9]="Price 1";
	$listing_header[10]="Price 2";
	$listing_header[11]="Price 3";
	$listing_header[12]="Price 4";
	$listing_header[13]="Price 5";
	$listing_header[14]="Discount";
	
		
	//===Database Fields==========
	$listing_content[1]="modified_date";
	$listing_content[2]="pdt_code";
	$listing_content[3]="pdt_name";
	$listing_content[4]="pdt_barcode";
     $listing_content[5]="pdt_price";
     $listing_content[6]="pdt_uom";
     $listing_content[7]="pdt_inventory_tracking";
     $listing_content[8]="pdt_featured";
	$listing_content[9]="pdt_price_group_1";
	$listing_content[10]="pdt_price_group_2";
	$listing_content[11]="pdt_price_group_3";
	$listing_content[12]="pdt_price_group_4";
	$listing_content[13]="pdt_price_group_5";
	$listing_content[13]="pdt_price_group_5";
	$listing_content[14]="pdt_discount_allow";
	
	
	
	
	//===Column width==========
	$listing_width[1]="40";
	$listing_width[2]="90";
	$listing_width[3]="200";
	$listing_width[4]="90";
	$listing_width[5]="50";
	$listing_width[6]="40";
	$listing_width[7]="60";
	$listing_width[8]="50";
	
	$listing_width[9]="50";
	$listing_width[10]="50";
	$listing_width[11]="50";
	$listing_width[12]="50";
	$listing_width[13]="50";
	$listing_width[14]="50";
	
	
        //===Column align==========
	$listing_align[1]="left";
    $listing_align[2]="left";
    $listing_align[3]="left";
    $listing_align[4]="left";
    $listing_align[5]="right";
    $listing_align[6]="right";
    $listing_align[7]="left";
    $listing_align[8]="left";
    $listing_align[9]="right";
    $listing_align[10]="right";
    $listing_align[11]="right";
    $listing_align[12]="right";
    $listing_align[13]="right";
    $listing_align[14]="left";
        
	//==Listing Url===============
	$this_url="mod/product/index.php";
	$display_url="mod/product/display.php";
	
	$print_url="mod/product/print.php";

	
	
	//===Main SQL query=============
    $query="SELECT * , date_format(modified_date,'%d-%m-%Y') as modified_date_f FROM $form_table_name ";
    //$query=$query." where client_id = '".$CurrentUserID."' ";
    $query=$query." where ifnull(client_id,0) >= 0 ";
    
    
    
    
    
    
    if($_SESSION["list_filter"]["filter_product_category"]!="ALL")
    {
	    if($_SESSION["list_filter"]["filter_product_category"]=="UNSPECIFIED")
	    {
		    $query=$query." and (ifnull(pdt_category_code,'') = '' or ifnull(pdt_category_code,'') = '0'  ) ";
	    }
	    else {
		    $query=$query." and pdt_category_code = '".$_SESSION["list_filter"]["filter_product_category"]."' ";   
	    }
	    
	    
	    
	    
    }
    
    if($_SESSION["list_filter"]["filter_product_vendor"]!="ALL")
    {
	    $query=$query." and pdt_vendor_code = '".$_SESSION["list_filter"]["filter_product_vendor"]."' ";   
    }
    
    	if($_SESSION["list_filter"]["filter_product_color"]=="YES")
    	{
    	    $query=$query." and pdt_select_color = 'YES' ";   
    	}
	
	if($_SESSION["list_filter"]["filter_product_size"]=="YES")
    	{
    	    $query=$query." and pdt_select_size = 'YES' ";   
    	}
	
	if($_SESSION["list_filter"]["filter_product_pattern"]=="YES")
    	{
    	    $query=$query." and pdt_select_pattern = 'YES' ";   
    	}
	
	if($_SESSION["list_filter"]["filter_product_featured"]=="YES")
    	{
    	    $query=$query." and pdt_featured = 'YES' ";   
    	}
	
	if($_SESSION["list_filter"]["filter_product_featured"]=="YES")
     {
 	   $query=$query." and pdt_featured = 'YES' ";   
     }
	
	if($_SESSION["list_filter"]["filter_product_inventory"]=="YES")
     {
 	   $query=$query." and pdt_inventory_tracking = 'YES' ";   
     }
	
	
	if($_SESSION["list_filter"]["filter_product_discount"]=="YES")
     {
 	   $query=$query." and pdt_discount_allow = 'YES' ";   
     }
	
	

    
	
	
	//==Action Button Setting======
	$action_cell=true;
	$action_cell_edit=true;
	$action_cell_delete=true;
?>