<?php
	error_reporting(LC_ALL);
	ini_set('display_errors', 1);
	//get configs
	require_once('config.php');
	require_once('./../../../config.php');
	//auth :)
	if ($_REQUEST['pass'] != $print_conf['pass'])
		die ('Brak autoryzacji');
	//create db connection
	$db = mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
	mysql_query("USE ".$sugar_config['dbconfig']['db_name']);
	
	$res = mysql_query("SELECT id, document_no FROM ecmreceipts WHERE deleted='0' AND printed='0'");
	echo '<html><form action="print.php"><select id="receipt" name="receipt">';
	echo '<OBJECT id=ThermalLib height=0 width=0 
classid=clsid:904511D2-5407-4033-8DAD-07B33EC7317E><PARAM NAME="_Version" VALUE="65536"><PARAM NAME="_ExtentX" VALUE="26"><PARAM NAME="_ExtentY" VALUE="26"><PARAM NAME="_StockProps" VALUE="0"></OBJECT>';
	while ($row = mysql_fetch_assoc($res)) {
		echo '<option value="'.$row['id'].'">'.$row['document_no'].'</option>';
	}
	echo '</select>';
	echo '&nbsp&nbsp<button type="submit">Wybierz</button></form></html>';