function order_fast_dishid_form()
{
    $data['nolabel'] = 1;
    $data['priority'] = 1;
    $tmp = dishlist_form_start(false);
    $tmp .= priority_radio($data);
    $tmp .= quantity_list($data);
    $tmp .= input_dish_id($start_data);
    $tmp .= dishlist_form_end();
    return $tmp;
}
function toplist_show()
{
    global $tpl;
    $_SESSION['order_added'] = 0;
    $query = "SELECT * FROM `last_orders`";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return ERR_MYSQL;
    }
    if (!mysql_num_rows($res)) {
        return 1;
    }
    while ($arr = mysql_fetch_array($res)) {
        $dishid = $arr['dishid'];
        if ($dishid == MOD_ID || $dishid == SERVICE_ID) {
            continue;
        }
        if (!isset($toplist[$dishid])) {
            $toplist[$dishid] = 0;
        }
        $toplist[$dishid]++;
    }
    if (!is_array($toplist)) {
        return 0;
    }
    arsort($toplist);
    reset($toplist);
    $chk[1] = "";
    $chk[2] = "";
    $chk[3] = "";
    $tmp = '
	<form action="orders.php" method="POST" name="toplist_form">
	<INPUT TYPE="HIDDEN" NAME="command" VALUE="create">
	<INPUT TYPE="HIDDEN" NAME="dishid" VALUE="0">';
    if (CONF_TOPLIST_HIDE_QUANTITY) {
        $tmp .= '
		<INPUT TYPE="HIDDEN" NAME="data[quantity]" VALUE="1">';
    }
    if (CONF_TOPLIST_HIDE_PRIORITY) {
        $tmp .= '
		' . ucfirst(phr('PRIORITY')) . ':
		<input type="radio" ' . $chk[1] . ' name="data[priority]" value=1>1
		<input type="radio" ' . $chk[2] . ' name="data[priority]" value=2>2
		<input type="radio" ' . $chk[3] . ' name="data[priority]" value=3>3';
    }
    $tmp .= '
	<table bgcolor="' . COLOR_TABLE_GENERAL . '">
	<tbody>
		<tr align="center">
			<td colspan="4">
				<b>' . ucfirst(phr('TOPLIST')) . '(' . ucfirst(phr('LASTS')) . ' ' . CONF_TOPLIST_SAVED_NUMBER . ')</b>
				&nbsp;&nbsp;
				<a href="orders.php?command=set_show_toplist">
				<img src="' . ROOTDIR . '/images/waiter/fileclose.png" border="0" alt="' . ucphr('HIDE_TOPLIST') . '">
				</a>
			</td>
		</tr>
';
    $i = 0;
    while ($i < get_conf(__FILE__, __LINE__, "top_list_show_top")) {
        if (list($key, $value) = each($toplist)) {
            $category = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', 'category', $key);
            $bgcolor = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', 'htmlcolor', $category);
            $tmp .= '
		<tr bgcolor="' . $bgcolor . '">';
            if (table_is_takeaway($_SESSION['sourceid'])) {
                $tmp .= '
			<input type="hidden" name="data[priority]" value=1>';
            } elseif (!$i && !CONF_TOPLIST_HIDE_PRIORITY) {
                $tmp .= '
			<td rowspan="' . (get_conf(__FILE__, __LINE__, "top_list_show_top") + 1) . '" bgcolor="' . COLOR_TABLE_GENERAL . '">
			1<input type="radio" ' . $chk[1] . ' name="data[priority]" value=1><br />
			2<input type="radio" ' . $chk[2] . ' name="data[priority]" value=2><br />
			3<input type="radio" ' . $chk[3] . ' name="data[priority]" value=3><br />
			</td>';
            }
            if (!$i && !CONF_TOPLIST_HIDE_QUANTITY) {
                $qtydata['nolabel'] = 1;
                $tmp .= '
			<td rowspan="' . (get_conf(__FILE__, __LINE__, "top_list_show_top") + 1) . '" bgcolor="' . COLOR_TABLE_GENERAL . '">
			' . quantity_list($qtydata) . '
			</td>';
            }
            $dishobj = new dish($key);
            $dishname = $dishobj->name($_SESSION['language']);
            $tmp .= '
			<td>
				' . $value . '
			</td>';
            $tmp .= '
			<td valign="middle" onclick="order_select(\'' . $key . '\',\'toplist_form\');">
			<a href="#" onclick="JavaScript:order_select(\'' . $key . '\',\'toplist_form\'); return false;">
			' . $dishname . '
			</a>
			</td>';
            $tmp .= '
		</tr>';
        }
        $i++;
    }
    $tmp .= '
	</table>
	</form>';
    $tpl->assign('toplist', $tmp);
    return 0;
}