<?php session_start();
		if (isset($_SESSION['logged']) && $_SESSION['logged'] == 'yes') {
			include ('../../../scripts/classes.php'); if ($_SESSION['lang']=="EN"){$lang="EN"; include ('../../../lang/en.php'); }elseif ($_SESSION['lang']=="GR"){$lang="GR";include ('../../../lang/gr.php');}else{$lang="EN"; include ('../../../lang/en.php');}	
			$mods = getCLSModules('POS'); foreach ($mods as $modules){extract($modules);} $mod_name == true ? $_POS==1 : exit(); //check if POS is enabled		
			
            //webnail QUERY TO get user
			$array = getGlobalSettings(); //Retrieve Global Settings	
			$page_title = $lbl_mode_edit_print; //Assign Page Title
			$mode = $lbl_mode_edit_print; //Assign Mode
?>	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $page_title ?></title>
<link rel="shortcut icon" href="../../../img/favicon.png" />
<link href="../../../cms1.css" rel="stylesheet" type="text/css" /> 
</head>
<body>
<script>top.document.title = self.document.title;</script>
	<div>
		<fieldset>
		<legend><?php echo $mode ?></legend>
			<div class="align-left">
				<div class="" id="messagebox" style="visibility:hidden">
					<ul>
						<li><input type="text" readonly="readonly" style="border:none; background:none; width:300px" id="messagetext" value="" /></li>
					</ul>
				</div>
			<?php
    ################################################################################
    ## +---------------------------------------------------------------------------+
    ## | 1. Creating & Calling:                                                    | 
    ## +---------------------------------------------------------------------------+
    ##  *** define a relative (virtual) path to datagrid.class.php file
    ##  *** (relatively to the current file)
    ##  *** RELATIVE PATH ONLY ***     
      define ("DATAGRID_DIR", "../../../datagrid/");                     /* Ex.: "datagrid/" */ 
      define ("PEAR_DIR", "../../../datagrid/pear/");                    /* Ex.: "datagrid/pear/" */
    
      require_once(DATAGRID_DIR.'datagrid.class.php');
      require_once(PEAR_DIR.'PEAR.php');
      require_once(PEAR_DIR.'DB.php');  
    ##
    ##  *** creating variables that we need for database connection 
      // includes database connection parameters
      include_once('../../../datagrid/config.inc.php');   
      ob_start();
      $db_conn = DB::factory('mysql');  /* don't forget to change on appropriate db type */
      $result_conn = $db_conn->connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));
      if(DB::isError($result_conn)){ die($result_conn->getDebugInfo()); }   
    ##  *** put a primary key on the first place 
      $sql = "SELECT
	  			id,
				printout,
				header_text,
				header_font,
				header_font_weight,
				header_font_height,
				header_font_width,
				header_line_height,
				header_line_top,
				header_orientation,
				detail_text,
				detail_font,
				detail_font_weight,
				detail_font_height,
				detail_font_width,
				detail_line_height,
				detail_line_top,
				detail_orientation,
				footer_text,
				footer_font,
				footer_font_weight,
				footer_font_height,
				footer_font_width,
				footer_line_height,	
				footer_line_top,
				footer_orientation,
				barcode_type,
				barcode_height,
				barcode_width,
				barcode_left,
				barcode_orientation,
				bottom_margin,
				default_id,
				'<img src=\"../../../img/add_note.gif\" alt=\"Print Example\" />' AS example
            FROM core_printouts
			WHERE default_id<>'0'
			";
	//webnail custom code for textareas		
	$sql_result = mysqli_query($mysqli, $sql) or die("Query failed : " . mysqli_error($mysqli));
		if (mysqli_num_rows($sql_result) == 0){
			//exit();
		}else{
			$row = mysqli_fetch_array($sql_result, MYSQLI_ASSOC);
			$header_text = $row['header_text'];	
			$detail_text = $row['detail_text'];
			$footer_text = $row['footer_text'];
		}		
    ##  *** set needed options and create a new class instance 
      $debug_mode = false;        /* display SQL statements while processing */    
      $messaging = true;          /* display system messages on a screen */ 
      $unique_prefix = "pri_";    /* prevent overlays - must be started with a letter */
      $dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
	  //webnail get current mode
	  $mode = isset($_GET[$unique_prefix.'mode']) ? $_GET[$unique_prefix.'mode'] : ""; 	  
    ##  *** set encoding and collation (default: utf8/utf8_unicode_ci)
      $dg_encoding = "utf8";
      $dg_collation = "utf8_unicode_ci";
      $dgrid->SetEncoding($dg_encoding, $dg_collation);
    ##  *** set data source with needed options
      $default_order_field = "id";
      $default_order_type = "ASC";
      $dgrid->DataSource($db_conn, $sql, $default_order_field, $default_order_type);     
    ## +---------------------------------------------------------------------------+
    ## | 2. General Settings:                                                      | 
    ## +---------------------------------------------------------------------------+
	##  *** allow multirow operations
        $multirow_option = false;
        $dgrid->AllowMultirowOperations($multirow_option);
        $multirow_operations = array(
            "edit"  => array("view"=>false),
            "delete"  => array("view"=>false),
            "details" => array("view"=>false), 
        );
        $dgrid->SetMultirowOperations($multirow_operations);
		//get language
		if ($_SESSION['lang']=="EN"){$dg_language = "en";}elseif ($_SESSION['lang']=="GR"){	$dg_language = "gk";}else{$dg_language = "en";}
		$dgrid->SetInterfaceLang($dg_language);  
         ##  *** set modes for operations ("type" => "link|button|image")
    ##  *** "view" - view mode | "edit" - add/edit/details modes
    ##  *** "byFieldValue"=>"fieldName" - make the field to be a link to edit mode page
    $modes = array(
         "add"	  =>array("view"=>false, "edit"=>false, "type"=>"button", "show_add_button"=>"outside"),
         "edit"	  =>array("view"=>true, "edit"=>true,  "type"=>"image" ),
         "cancel"  =>array("view"=>true, "edit"=>true,  "type"=>"button"),
         "details" =>array("view"=>true, "edit"=>true, "type"=>"image"),
         "delete"  =>array("view"=>false, "edit"=>false,  "type"=>"image"),
    );
    $dgrid->SetModes($modes);   
    ##  *** set CSS class for datagrid
    ##  *** "default|blue|gray|green|pink|empty|x-blue|x-gray|x-green" or your own css style
     $css_class = "default";
     $dgrid->SetCssClass($css_class);
    ##  *** set DataGrid caption
    $dg_caption = "";
      $dgrid->SetCaption($dg_caption);    
    ## +---------------------------------------------------------------------------+
    ## | 3. Printing & Exporting Settings:                                         | 
    ## +---------------------------------------------------------------------------+
    ##  *** set printing option: true(default) or false 
      $printing_option = true;
      $dgrid->AllowPrinting($printing_option);
	  $exporting_option = true;
		$exporting_directory = "../../../exports/";               
		$export_all = true;
		$dgrid->AllowExporting($exporting_option, $exporting_directory, $export_all);
		$exporting_types = array("excel"=>"true", "pdf"=>"false", "xml"=>"false");
		$dgrid->AllowExportingTypes($exporting_types);
    
    ## +---------------------------------------------------------------------------+
    ## | 4. Sorting & Paging Settings:                                             | 
    ## +---------------------------------------------------------------------------+
    ##  *** set paging option: true(default) or false 
      $paging_option = true;
      $rows_numeration = false;
      $numeration_sign = "#";       
      $dgrid->AllowPaging($paging_option, $rows_numeration, $numeration_sign);
    ##  *** set paging settings
      $bottom_paging = array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
      $top_paging = array();
      $pages_array = array("20"=>"20", "25"=>"25", "50"=>"50", "100"=>"100", "250"=>"250", "500"=>"500", "1000"=>"1000");
      $default_page_size = 20;
      $dgrid->SetPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size);
    
    ## +---------------------------------------------------------------------------+
    ## | 5. Filter Settings:                                                       | 
    ## +---------------------------------------------------------------------------+
    ##  *** set filtering option: true or false(default)
      $filtering_option = true;
      $show_search_type = true;
      $dgrid->AllowFiltering($filtering_option, $show_search_type);
    ##  *** set additional filtering settings
    ##  *** tips: use "," (comma) if you want to make search by some words, for ex.: hello, bye, hi
      $filtering_fields = array(
		$lbl_grid_description=>array("type"=>"textbox", "table"=>"core_printouts", "field"=>"printout", "filter_condition"=>"", "show_operator"=>"false", "default_operator"=>"like", "case_sensitive"=>"false","comparison_type"=>"string", "width"=>"", "on_js_event"=>"") 
	 );
      $dgrid->SetFieldsFiltering($filtering_fields);
    
    ## +---------------------------------------------------------------------------+
    ## | 6. View Mode Settings:                                                    | 
    ## +---------------------------------------------------------------------------+
    ##  *** set view mode table properties
      $vm_table_properties = array("width"=>"100%");
      $dgrid->SetViewModeTableProperties($vm_table_properties);  
    ##  *** set columns in view mode
    ##  *** Ex.: "on_js_event"=>"onclick='alert(\"Yes!!!\");'"
    ##  ***      "barchart" : number format in SELECT SQL must be equal with number format in max_value
      $vm_colimns = array(
        "id" => array("header"=>$lbl_grid_code, "type"=>"label", "align"=>"left", "width"=>"20px", "wrap"=>"nowrap", "text_length"=>"-1", "tooltip"=>"true", "tooltip_type"=>"floating", "case"=>"normal", "summarize"=>"false", "sort_type"=>"string", "sort_by"=>"", "visible"=>"true", "on_js_event"=>"",  "field_data"=>"", "rel"=>"", "title"=>""),
        "printout"     => array("header"=>$lbl_grid_printout, "type"=>"label", "align"=>"left", "width"=>"", "wrap"=>"nowrap", "text_length"=>"-1", "tooltip"=>"true", "tooltip_type"=>"floating", "case"=>"normal", "summarize"=>"false", "sort_type"=>"string", "sort_by"=>"", "visible"=>"true", "on_js_event"=>""),
    	 'example'=>array("header"=>$lbl_grid_example_template, "type"=>"link", "align"=>"center", "summarize"=>"false", "visible"=>"true", "on_js_event"=>"onClick=\"return confirmSubmit()\"", "field_key"=>"id", "field_key_1"=>"template", "field_data"=>"field_name_2", "rel"=>"", "target"=>"_self", "href"=>"printouts.php?pri_mode=activate&pri_rid={0}&pri_tem={1}", "sortable"=>"false", "width"=>"40px"),	
//   	 'activate'=>array("header"=>$lbl_grid_activate_template, "type"=>"link", "align"=>"center", "summarize"=>"false", "visible"=>"true", "on_js_event"=>"onClick=\"return confirmSubmit()\"", "field_key"=>"id", "field_key_1"=>"template", "field_data"=>"field_name_2", "rel"=>"", "target"=>"_self", "href"=>"printouts.php?pri_mode=activate&pri_rid={0}&pri_def={1}", "sortable"=>"false", "width"=>"40px"),		 	 	
//		 "image"  => array("header"=>$lbl_grid_image, "type"=>"image",  "align"=>"center", "width"=>"40x", "wrap"=>"nowrap", "text_length"=>"-1", "tooltip"=>"false", "tooltip_type"=>"floating|simple", "case"=>"normal|upper|lower|camel", "summarize"=>"false", "sort_type"=>"string|numeric", "sort_by"=>"", "visible"=>"true", "on_js_event"=>"", "target_path"=>"img/", "default"=>"default_image.ext", "image_width"=>"40px", "image_height"=>"30px", "magnify"=>"true", "magnify_type"=>"magnifier", "magnify_power"=>"5"),
//        "active"     => array("header"=>$lbl_grid_active, "type"=>"checkbox",  "align"=>"center", "sort_type"=>"string", "sort_by"=>"", "visible"=>"true", "on_js_event"=>"", "true_value"=>1, "false_value"=>0)  				
      );
      $dgrid->SetColumnsInViewMode($vm_colimns);
    
    
    ## +---------------------------------------------------------------------------+
    ## | 7. Add/Edit/Details Mode Settings:                                        | 
    ## +---------------------------------------------------------------------------+
    ##  *** set add/edit mode table properties
	$em_columns = array();
      $em_table_properties = array("width"=>"100%");
      $dgrid->SetEditModeTableProperties($em_table_properties);
    ##  *** set details mode table properties
      $dm_table_properties = array("width"=>"100%");
      $dgrid->SetDetailsModeTableProperties($dm_table_properties);
    ##  ***  set settings for add/edit/details modes
      $table_name  = "core_printouts";
      $primary_key = "id";
      $condition   = "";
      $dgrid->SetTableEdit($table_name, $primary_key, $condition);
   	if ($mode=="add"){	
      $em_columns = array(); //no additions 														
	  }elseif ($mode=="details"){
	  $fill_from_array_1= array(""=>"None", "transaction_id"=>"Transaction ID", "barcode_id"=>"Barcode ID");	  
	  $em_columns = array(
            "id"   =>array("header"=>$lbl_grid_code, "type"=>"label"),				
            "printout"=>array("header"=>$lbl_grid_printout, "type"=>"label"),	
			"delimiter_1"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_header</legend></div>"),   			
			"header_text"=>array("header"=>$lbl_grid_text, "type"=>"label"),	
			"header_font"=>array("header"=>$lbl_grid_font, "type"=>"label"),
			"header_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"label"),	
			"header_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"label"),
			"header_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"label"),
			"header_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"label"),
			"header_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"label"),
			"header_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"label"),
			"delimiter_2"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_detail</legend></div>"),   	
			"detail_text"=>array("header"=>$lbl_grid_text, "type"=>"label"),	
			"detail_font"=>array("header"=>$lbl_grid_font, "type"=>"label"),	
			"detail_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"label"),
			"detail_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"label"),
			"detail_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"label"),
			"detail_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"label"),
			"detail_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"label"),
			"detail_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"label"),
			"delimiter_3"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_footer</legend></div>"),  			
			"footer_text"=>array("header"=>$lbl_grid_text, "type"=>"label"),	
			"footer_font"=>array("header"=>$lbl_grid_font, "type"=>"label"),	
			"footer_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"label"),
			"footer_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"label"),
			"footer_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"label"),
			"footer_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"label"),
			"footer_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"label"),
			"footer_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"label"),		
			//"deafult_id"=>array("header"=>$lbl_grid_default_id, "type"=>"label"),	
            "delimiter_4"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_barcode</legend></div>"),
			"barcode_type"=>array("header"=>$lbl_grid_barcode_type, "type"=>"enum", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array_1, "view_type"=>"radiobutton"),
			"barcode_height"=>array("header"=>$lbl_grid_barcode_height, "type"=>"label"),	
			"barcode_width"=>array("header"=>$lbl_grid_barcode_width, "type"=>"label"),		
			"barcode_left"=>array("header"=>$lbl_grid_barcode_left, "type"=>"label"),	
			"barcode_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"label"),	
			"bottom_margin"=>array("header"=>$lbl_grid_bottom_margin, "type"=>"label"),	
	  );	   
	  }elseif ($mode=="edit"){
	  
	  $fill_from_array = array("Arial"=>"Arial", "Arial Narrow"=>"Arial Narrow", "Calibri"=>"Calibri", "Times New Roman"=>"Times New Roman", "Tahoma"=>"Tahoma", "Verdana"=>"Verdana");
 $fill_from_array_1= array(""=>"None", "transaction_id"=>"Transaction ID", "barcode_id"=>"Barcode ID");	  
 $fill_from_array_2= array("PRINTER_FW_THIN"=>"Thin", "PRINTER_FW_MEDIUM"=>"Medium", "PRINTER_FW_HEAVY"=>"Bold");	 
	  $em_columns = array(
	  
            "id"   =>array("header"=>$lbl_grid_code, "type"=>"label", "width"=>"30px", "title"=>"", "readonly"=>"true", "visible"=>"true"),	
            "printout"=>array("header"=>$lbl_grid_screen, "type"=>"label", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),
			"delimiter_1"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_header</legend></div>"), 
			"delimiter_2"    =>array("inner_html"=>"<div align='center'><textarea id='ryyheader_text' name='ryyheader_text' rows='2', cols='40'>$header_text</textarea></div>"),   			
            //"header_text"=>array("header"=>$lbl_grid_text, "type"=>"textarea",   "req_type"=>"ry", "width"=>"300px", "title"=>"", "readonly"=>"false", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "edit_type"=>"simple", "resizable"=>"false", "upload_images"=>"false", "rows"=>"2", "cols"=>"50"),
            "header_font"=>array("header"=>$lbl_grid_font, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array, "view_type"=>"radiobutton"),	
            "header_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array_2, "view_type"=>"radiobutton"),				
            "header_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "header_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "header_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),
            "header_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),			
            "header_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"textbox", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),			
			"delimiter_3" =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_detail</legend></div>"), 
			"delimiter_4"    =>array("inner_html"=>"<div>$lbl_you_can_use_variables</div>"),			  	
			"delimiter_5" =>array("inner_html"=>"<div align='center'><textarea id='ryydetail_text' name='ryydetail_text' rows='5', cols='40'>$detail_text</textarea></div>"),   				
            "detail_font"=>array("header"=>$lbl_grid_font, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array, "view_type"=>"radiobutton"),
            "detail_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array_2, "view_type"=>"radiobutton"),				
            "detail_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "detail_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "detail_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),		
            "detail_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),				
            "detail_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"textbox", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),							
			"delimiter_6"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_footer</legend></div>"),    
			"delimiter_7" =>array("inner_html"=>"<div align='center'><textarea id='ryyfooter_text' name='ryyfooter_text' rows='3', cols='40'>$footer_text</textarea></div>"),	"footer_font"=>array("header"=>$lbl_grid_font, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array, "view_type"=>"radiobutton"),
            "footer_font_weight"=>array("header"=>$lbl_grid_font_weight, "type"=>"enum", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array_2, "view_type"=>"radiobutton"),				
            "footer_font_height"=>array("header"=>$lbl_grid_font_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "footer_font_width"=>array("header"=>$lbl_grid_font_width, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),	
            "footer_line_height"=>array("header"=>$lbl_grid_line_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),		
            "footer_line_top"=>array("header"=>$lbl_grid_line_top, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),				
            "footer_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"textbox", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),											  
  			"delimiter_8"    =>array("inner_html"=>"<div align='center'><legend>$lbl_grid_barcode</legend></div>"),           
			"barcode_type"=>array("header"=>$lbl_grid_barcode_type, "type"=>"enum", "req_type"=>"sy", "width"=>"100px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "source"=>$fill_from_array_1, "view_type"=>"radiobutton"),	
            "barcode_height"=>array("header"=>$lbl_grid_barcode_height, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),		
            "barcode_width"=>array("header"=>$lbl_grid_barcode_width, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),			
            "barcode_left"=>array("header"=>$lbl_grid_barcode_left, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),						
            "barcode_orientation"=>array("header"=>$lbl_grid_orientation, "type"=>"textbox", "req_type"=>"ry", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),						
            "bottom_margin"=>array("header"=>$lbl_grid_bottom_margin, "type"=>"textbox", "req_type"=>"rn", "width"=>"30px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>""),														
	 );		 
	  }
      $dgrid->SetColumnsInEditMode($em_columns);
    ##  *** set auto-generated columns in edit mode
      $auto_column_in_edit_mode = false;
      $dgrid->SetAutoColumnsInEditMode($auto_column_in_edit_mode);
     
    ## +---------------------------------------------------------------------------+
    ## | 8. Bind the DataGrid:                                                     | 
    ## +---------------------------------------------------------------------------+
    ##  *** bind the DataGrid and draw it on the screen
      $dgrid->Bind();        
      ob_end_flush();
	
	if(isset($_GET[$unique_prefix.'mode']) && ($_GET[$unique_prefix.'mode'] == "activate") ){
  	// PREPARE THE IDs selected FOR A QUERY
		$template =$_GET['pri_rid'];
		$mode='demo';
		printTestReceipt($template, 0, 0, 0, 0,$mode);//call print test receipt
	}		
?>

			</div>
		</fieldset>
	</div>
</body>
</html>
<?php 
} else {
    header('Location: login.php');
}
?>