コード例 #1
0
    function list_orders_pos($output = 'orders_list', $orderid = 0, $mods = false)
    {
        if ($this->is_empty()) {
            return 1;
        }
        global $tpl;
        $tmp = '
		<table class="receipt-table">';
        $tpl->append($output, $tmp);
        if (!$orderid) {
            $tmp = '
				<thead>
					<tr>
						<th scope=col>' . ucfirst(phr('NUMBER_ABBR')) . '</th>
						<th scope=col>' . ucfirst(phr('NAME')) . '</th>
						<th scope=col> </th>
						<th scope=col>' . ucfirst(phr('PRIORITY_ABBR')) . '</th>
						<th scope=col>' . ucfirst(phr('PRICE')) . '</th>
						<th scope=col> </th>
						<th scope=col> </th>
						<th scope=col> </th>
					</tr>
				</thead>';
            $tpl->append($output, $tmp);
        } else {
            $tmp = '
				<thead>
				<tr height="10px">
				<th colspan="9"><font size="-2">' . ucfirst(phr('LAST_OPERATION')) . '</font></th>
				</tr>
				</thead>';
            $tpl->append($output, $tmp);
        }
        $tmp = '
		<tbody>';
        $tpl->append($output, $tmp);
        $query = "SELECT * FROM `orders` WHERE `sourceid`='" . $this->id . "'";
        if ($orderid && $mods) {
            $query .= " AND `associated_id`='" . $orderid . "'";
        } elseif ($orderid && !$mods) {
            $query .= " AND `id`='" . $orderid . "'";
        }
        if (!get_conf(__FILE__, __LINE__, "orders_show_deleted")) {
            $query .= " AND `deleted`='0'";
        }
        $query .= " ORDER BY priority ASC, associated_id ASC, dishid DESC, id ASC";
        $res = common_query($query, __FILE__, __LINE__);
        if (!$res) {
            return mysql_errno();
        }
        while ($arr = mysql_fetch_array($res)) {
            $ord = new order($arr['id']);
            $dishnames[] = $ord->table_row_name($arr);
            unset($ord);
        }
        $res = common_query($query, __FILE__, __LINE__);
        if (!$res) {
            return mysql_errno();
        }
        while ($arr = mysql_fetch_array($res)) {
            $ord = new order($arr['id']);
            $tmp = $ord->table_row_pos($arr);
            $tpl->append($output, $tmp);
            unset($ord);
        }
        $class = COLOR_TABLE_TOTAL;
        // prints a line with the grand total
        $tmp = '
			<tr>
			<td>&nbsp;</td>
			<td><strong>' . ucfirst(phr('TOTAL')) . '</strong></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><strong>' . $this->total() . '</strong></td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			</tr>
			</tbody>
			</table>';
        if (!$orderid) {
            $tpl->append($output, $tmp);
        }
        // prints a line with the grand total
        $tmp = '
			</tbody>
			</table>';
        if ($orderid) {
            $tpl->append($output, $tmp);
        }
        return 0;
    }