/**
* My Handy Restaurant
*
* http://www.myhandyrestaurant.org
*
* My Handy Restaurant is a restaurant complete management tool.
* Visit {@link http://www.myhandyrestaurant.org} for more info.
* Copyright (C) 2003-2005 Fabio De Pascale
* 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* @author		Fabio 'Kilyerd' De Pascale <*****@*****.**>
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
* @copyright	Copyright 2006-2012, Gjergj Sheldija
*/
function discount_save_to_source($discount_value)
{
    $olddiscount = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', 'discount', $_SESSION['sourceid']);
    $newdiscount = $olddiscount - abs($discount_value);
    $query = "UPDATE `sources` SET `discount` = '{$newdiscount}'\n\t\tWHERE `id` = '" . $_SESSION['sourceid'] . "'";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return mysql_errno();
    }
    return 0;
}
예제 #2
0
$t_groups = $tablePreStr . "groups";
$t_group_members = $tablePreStr . "group_members";
$t_group_subject = $tablePreStr . "group_subject";
$t_group_subject_comment = $tablePreStr . "group_subject_comment";
//定义读操作
dbtarget('r', $dbServs);
$dbo = new dbex();
$show_action = 0;
//权限判断
$role = api_proxy("group_member_by_role", $group_id, $user_id);
$role = $role[0];
if (($role == 0 || $role == 1) && isset($role)) {
    $show_action = 1;
}
$condition = "group_id={$group_id} and title like '%{$key_word}%'";
$order_by = "order by add_time desc";
$type = "getRs";
$dbo->setPages(20, $page_num);
//设置分页
$subject_rs = get_db_data($dbo, $t_group_subject, $condition, $order_by, $type);
$page_total = $dbo->totalPage;
//分页总数
//显示控制
$isset_data = "";
$none_data = "content_none";
$isNull = 0;
if (empty($subject_rs)) {
    $isNull = 1;
    $isset_data = "content_none";
    $none_data = "";
}
예제 #3
0
    $share_row = get_db_data($dbo, $t_share, $id_cols, $order_by, $type);
    if ($share_row['type_id'] == 6) {
        $link_re = $share_row['out_link'];
    } else {
        $link_re = $share_row['movie_link'];
    }
    //操作显示控制
    $action_ctrl = 'content_none';
    if ($share_row['user_id'] == $ses_uid) {
        $action_ctrl = '';
    }
    $share_com_rs = array();
    $type = "getRs";
    $dbo->setPages(20, $page_num);
    //设置分页
    $comment_rs = get_db_data($dbo, $t_share_com, $id_cols, $order_by, $type);
    $page_total = $dbo->totalPage;
    //分页总数
    $isNull = 0;
    $show_com = '';
    $show_error = 'content_none';
    $show_out_link = '';
    //锁定控制
    if ($share_row['is_pass'] == 0 && $is_admin == '') {
        $show_error = '';
        $error_str = $s_langpackage->s_lock;
    }
}
//控制数据显示
if (empty($comment_rs)) {
    $isNull = 1;
예제 #4
0
    $cols .= " and group_name like '%{$search}%' ";
}
//按群组标签名
if (get_argg('tag')) {
    $search = short_check(get_argg('tag'));
    $cols .= " and tag like '%{$search}%' ";
}
//按群组类型
if (get_argg('group_type_id')) {
    $search = intval(get_argg('group_type_id'));
    $cols .= " and group_type_id='{$search}' ";
}
$page_num = trim(get_argg('page'));
$condition = "{$cols} and is_pass=1";
$order_by = "order by member_count desc";
$type = "getRs";
$dbo->setPages(20, $page_num);
//设置分页
$search = get_db_data($dbo, $t_groups, $condition, $order_by, $type);
$page_total = $dbo->totalPage;
//分页总数
//显示控制
$isset_data = "";
$none_data = "content_none";
$isNull = 0;
if (empty($search)) {
    $isNull = 1;
    $isset_data = "content_none";
    $none_data = "";
}
$g_join_num = $g_langpackage->g_join_num;
예제 #5
0
function dishes_list_search($data)
{
    $output = '';
    $search = strtolower(trim($data['search']));
    if (empty($search)) {
        return '';
    }
    $query = "SELECT dishes.*\n\tFROM `dishes`\n\tWHERE (LCASE(`name`) LIKE '" . $search . "%'\n\t\tOR LCASE(`name`) LIKE '% " . $search . "%'\n\t\t)";
    if (!get_conf(__FILE__, __LINE__, "invisible_show")) {
        $query .= "AND `visible`='1'";
    }
    $query .= "\n\tAND dishes.deleted='0'\n\tORDER BY name ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return '';
    }
    $output .= '<table bgcolor="' . COLOR_TABLE_GENERAL . '">
	<tr>
	<th scope=col>' . ucfirst(phr('ID')) . '</th>
	<th scope=col>' . ucfirst(phr('NAME')) . '</th>
	<th scope=col>' . country_conf_currency(true) . '</th>
	</tr>
	';
    // ascii letter A
    $i = 65;
    unset($GLOBALS['key_binds_letters']);
    while ($arr = mysql_fetch_array($res)) {
        $class = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "categories", "htmlcolor", $arr['category']);
        $dishcat = $arr['category'];
        $dishid = $arr['id'];
        $dishobj = new dish($arr['id']);
        $dishname = $dishobj->name($_SESSION['language']);
        if ($dishname == null || strlen(trim($dishname)) == 0) {
            $dishname = $arr['name'];
        }
        $dishprice = $arr['price'];
        if ($dishcat > 0) {
            // letters array follows
            if ($i < 91) {
                $GLOBALS['key_binds_letters'][$i] = $dishid;
                $local_letter = chr($i);
                $i++;
            } else {
                $local_letter = '';
            }
            $output .= '<tr>
			<td bgcolor="' . $class . '">' . $local_letter . '</td>';
            $output .= '<td bgcolor="' . $class . '" onclick="order_select(' . $dishid . ',\'order_form\'); return false;"><a href="#" onclick="JavaScript:order_select(' . $dishid . ',\'order_form\'); return false;">' . $dishname . '</a></td>';
            $output .= '<td bgcolor="' . $class . '">' . $dishprice . '</td>
			</tr>';
        }
    }
    $output .= '
	</table>';
    return $output;
}
function print_orders($sourceid)
{
    /*
    name:
    print_orders($sourceid)
    returns:
    0 - no error
    1 - no orders to be printed
    2 - template parsing error
    3 - error setting orders printed
    other - mysql error number
    */
    $sourceid = $_SESSION['sourceid'];
    debug_msg(__FILE__, __LINE__, "BEGIN PRINTING");
    $query = "SELECT * FROM `orders` WHERE `sourceid`='{$sourceid}' AND `printed` IS NULL AND `suspend`='0' ORDER BY dest_id ASC, priority ASC, associated_id ASC, id ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return mysql_errno();
    }
    if (!mysql_num_rows($res)) {
        return ERR_ORDER_NOT_FOUND;
    }
    $newassociated_id = "";
    $tablenum = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "name", $sourceid);
    $tpl_print = new template();
    $output['orders'] = '';
    $msg = "";
    while ($arr = mysql_fetch_array($res)) {
        $oldassociated_id = $newassociated_id;
        $newassociated_id = $arr['associated_id'];
        if (isset($priority)) {
            $oldpriority = $priority;
        } else {
            $oldpriority = 0;
        }
        $priority = $arr['priority'];
        if ($oldassociated_id != "") {
            $olddestid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $oldassociated_id));
            $olddest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $olddestid);
            $olddestname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $olddestid);
        } else {
            $olddestid = 0;
        }
        $destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
        $dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
        $destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
        $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
        if ($destid != $olddestid || $priority != $oldpriority) {
            if ($destid != $olddestid && $olddestid != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($olddestid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    echo nl2br($msg) . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
                $tpl_print->reset_vars();
                $output['orders'] = '';
                $msg = str_replace("'", "", $msg);
                if ($outerr = print_line($olddestid, $msg)) {
                    return $outerr;
                }
            } elseif ($priority != $oldpriority && $oldpriority != "") {
                $tpl_print->assign("date", printer_print_date());
                $tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
                $tpl_print->assign("page_cut", printer_print_cut());
                // strips the last newline that has been put
                $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
                if (table_is_takeaway($sourceid)) {
                    $print_tpl_file = 'ticket_takeaway';
                } else {
                    $print_tpl_file = 'ticket';
                }
                if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
                    return $err;
                }
                if ($err = $tpl_print->parse()) {
                    $msg = "Error in " . __FUNCTION__ . " - ";
                    $msg .= 'error: ' . $err . "\n";
                    error_msg(__FILE__, __LINE__, $msg);
                    echo nl2br($msg) . "\n";
                    return ERR_PARSING_TEMPLATE;
                }
                $tpl_print->restore_curly();
                $msg = $tpl_print->getOutput();
                $tpl_print->reset_vars();
                $output['orders'] = '';
                $msg = str_replace("'", "", $msg);
                if ($outerr = print_line($destid, $msg)) {
                    return $outerr;
                }
            }
            if (table_is_takeaway($sourceid)) {
                $takeaway_data = takeaway_get_customer_data($sourceid);
                $output['takeaway'] = ucfirst(lang_get($dest_language, 'PRINTS_TAKEAWAY')) . " - ";
                $output['takeaway'] .= $takeaway_data['takeaway_hour'] . ":" . $takeaway_data['takeaway_minute'] . "\n";
                $output['takeaway'] .= $takeaway_data['takeaway_surname'] . "\n";
                $tpl_print->assign("takeaway", $output['takeaway']);
            }
            $output['table'] = ucfirst(lang_get($dest_language, 'PRINTS_TABLE')) . ": " . $tablenum;
            $tpl_print->assign("table", $output['table']);
            $user = new user($_SESSION['userid']);
            $output['waiter'] = ucfirst(lang_get($dest_language, 'PRINTS_WAITER')) . ": " . $user->data['name'];
            $tpl_print->assign("waiter", $output['waiter']);
            $output['priority'] = ucfirst(lang_get($dest_language, 'PRINTS_PRIORITY')) . ": " . $priority . "\n";
            $tpl_print->assign("priority", $output['priority']);
            $output['people'] = ucfirst(lang_get($dest_language, 'PRINTS_PEOPLE')) . ": " . table_people_number($sourceid) . "\n";
            $tpl_print->assign("people", $output['people']);
            $table = new table($sourceid);
            $table->fetch_data(true);
            if ($cust_id = $table->data['customer']) {
                $cust = new customer($cust_id);
                $output['customer'] = ucfirst(lang_get($dest_language, 'CUSTOMER')) . ": " . $cust->data['surname'] . ' ' . $cust->data['name'];
                $tpl_print->assign("customer_name", $output['customer']);
                $output['customer'] = $cust->data['address'];
                $tpl_print->assign("customer_address", $output['customer']);
                $output['customer'] = $cust->data['zip'];
                $tpl_print->assign("customer_zip_code", $output['customer']);
                $output['customer'] = $cust->data['city'];
                $tpl_print->assign("customer_city", $output['customer']);
                $output['customer'] = ucfirst(lang_get($dest_language, 'VAT_ACCOUNT')) . ": " . $cust->data['vat_account'];
                $tpl_print->assign("customer_vat_account", $output['customer']);
            }
        }
        $output['orders'] .= printer_print_row($arr, $destid);
        $printed_orders[] = $arr['id'];
        if ($newassociated_id != $oldassociated_id) {
            // if we're in this function, it means that we changed associated_id id
            // and also that mods have been printed on the same sheet
            if (CONF_PRINT_BARCODES && $arr['dishid'] != MOD_ID) {
                $output['orders'] .= print_barcode($newassociated_id);
            }
        }
        if (CONF_PRINT_BARCODES && $arr['dishid'] != MOD_ID) {
            $output['orders'] .= print_barcode($newassociated_id);
        }
        $tpl_print->assign("orders", $output['orders']);
    }
    $destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
    $dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
    $destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
    $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
    if (CONF_PRINT_BARCODES) {
        $tpl_print->assign("barcode", print_barcode($newassociated_id));
    }
    $tpl_print->assign("date", printer_print_date());
    $tpl_print->assign("gonow", printer_print_gonow($priority, $dest_language));
    $tpl_print->assign("page_cut", printer_print_cut());
    // strips the last newline that has been put
    $output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
    if (table_is_takeaway($sourceid)) {
        $print_tpl_file = 'ticket_takeaway';
    } else {
        $print_tpl_file = 'ticket';
    }
    if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
        return $err;
    }
    if ($err = $tpl_print->parse()) {
        $err_msg = "Error in " . __FUNCTION__ . " - ";
        $err_msg .= 'error: ' . $err . "\n";
        error_msg(__FILE__, __LINE__, $err_msg);
        echo nl2br($err_msg) . "\n";
        return ERR_PARSING_TEMPLATE;
    }
    $tpl_print->restore_curly();
    $msg = $tpl_print->getOutput();
    $tpl_print->reset_vars();
    $output['orders'] = '';
    $msg = str_replace("'", "", $msg);
    if ($outerr = print_line($destid, $msg)) {
        return $outerr;
    }
    foreach ($printed_orders as $val) {
        if ($err = print_set_printed($val)) {
            return $err;
        }
    }
    // there was an error setting orders as printed
    if ($err) {
        return ERR_ORDER_NOT_SET_AS_PRINTED;
    }
    return 0;
}
function categories_list_pos($data = '')
{
    $query = "SELECT * FROM `categories` WHERE `deleted`='0' ORDER BY id ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return '';
    }
    while ($arr = mysql_fetch_array($res)) {
        $catid = $arr['id'];
        $catimg = $arr['image'];
        if (!$catimg) {
            $catimg = IMAGE_CATEGORY_DEFAULT;
        }
        $backcommand = "order_create1";
        $bgcolor = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', 'htmlcolor', $catid);
        $link = 'orders.php?command=dish_list&amp;data[category]=' . $catid;
        if (isset($data['quantity']) && $data['quantity']) {
            $link .= '&amp;data[quantity]=' . $data['quantity'];
        }
        if (isset($data['priority']) && $data['priority']) {
            $link .= '&amp;data[priority]=' . $data['priority'];
        }
        $output .= '
			<a class="CategoryElement" href="#" onclick="loadDish(\'' . $link . '\');return(false);">
				<span style="text-indent:64px;display:block;height:100%;background:url(' . $catimg . ') no-repeat 1px 3px;">
					<strong>' . $arr['name'] . '</strong>
				</span>
			</a>
		';
    }
    return $output;
}
예제 #8
0
        }
        if ($deleteconfirm) {
            $delete = $_SESSION["delete"];
            unset($_SESSION["delete"]);
            delete_rows($delete);
        } else {
            if (isset($_GET['delete'])) {
                $delete = $_GET['delete'];
            } elseif (isset($_POST['delete'])) {
                $delete = $_POST['delete'];
            }
            if (is_array($delete)) {
                echo "\n\t\t\t\t" . GLOBALMSG_RECORDS_DELETE_CONFIRM . "<br><br>\n";
                $_SESSION["delete"] = $delete;
                for (reset($delete); list($key, $value) = each($delete);) {
                    $description = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "account_mgmt_main", "description", $key);
                    echo "<LI>" . $description . "</LI>";
                }
                echo "\n\t\t\t\t<table><tr><td>\n\t\t\t\t<form action=\"db.php\" method=\"GET\">\n\t\t\t\t<input type=\"hidden\" name=\"command\" value=\"delete\">\n";
                echo "\n\t\t\t\t<input type=\"hidden\" name=\"deleteconfirm\" value=\"1\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('YES')) . "\">\n\t\t\t\t</form></td>\n\t\t\t\t<td><form action=\"index.php\" method=\"GET\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('NO')) . "\">\n\t\t\t\t</form>\n\t\t\t\t</td></tr></table>\n\t\t\t\t";
            } else {
                echo GLOBALMSG_RECORD_NONE_SELECTED_ERROR . ".<br>";
            }
        }
        break;
}
if ($command != "delete") {
    unset($_SESSION["delete"]);
}
echo "<br><a href=\"#\" onclick=\"javascript:history.go(-1); return false\">" . ucfirst(phr('GO_BACK')) . "</a><br>\n";
echo "<br><a href=\"index.php\">" . ucfirst(phr('GO_MAIN_REPORT')) . "</a><br>";
예제 #9
0
function bill_print_receipt_id($receipt_id, $destid)
{
    $msg = "";
    $dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
    $table = 'account_mgmt_main';
    $query = "SELECT * FROM {$table} WHERE `id`='{$receipt_id}'";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return 0;
    }
    $arr = mysql_fetch_array($res);
    $internal_id = $arr['internal_id'];
    $type = $arr['type'];
    if ($type == 3) {
        $msg .= ucfirst(lang_get($dest_language, 'PRINTS_INVOICE')) . " " . ucfirst(lang_get($dest_language, 'PRINTS_NUMBER_ABBR')) . ": {$internal_id}";
    } elseif ($type == 4) {
        $msg .= ucfirst(lang_get($dest_language, 'PRINTS_BILL')) . " " . ucfirst(lang_get($dest_language, 'PRINTS_NUMBER_ABBR')) . ": {$internal_id}";
    } elseif ($type == 5) {
        $msg .= ucfirst(lang_get($dest_language, 'PRINTS_RECEIPT')) . " " . ucfirst(lang_get($dest_language, 'PRINTS_NUMBER_ABBR')) . ": {$internal_id}";
    }
    return $msg;
}
예제 #10
0
dbtarget('r', $dbServs);
$dbo = new dbex();
$share_rs = array();
switch ($mod) {
    case "mine":
        $id_cols = "user_id={$ses_uid}";
        break;
    default:
        $id_cols = "user_id={$userid}";
        break;
}
$order_by = "order by add_time desc";
$type = 'getRs';
$dbo->setPages(20, $page_num);
//设置分页
$share_rs = get_db_data($dbo, $t_share, $id_cols, $order_by, $type);
$page_total = $dbo->totalPage;
//分页总数
$button_show_mine = "";
$button_show_his = "content_none";
if ($is_self == 'Y') {
    $str_title = $s_langpackage->s_mine;
} else {
    $holder_name = get_hodler_name($url_uid);
    $str_title = str_replace("{holder}", $holder_name, $s_langpackage->s_who_share);
    $button_show_mine = "content_none";
    $button_show_his = "";
}
//控制数据显示
$content_data_none = "content_none";
$content_data_set = "";
예제 #11
0
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;
}
예제 #12
0
/**
* Check if the given table is takeaway
*
* This function reads the takeaway field value in the sources table and returns it.
*
* @param integer $table_id
* @return integer takeaway value from sources table
*/
function table_is_takeaway($table_id)
{
    $takeaway = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "takeaway", $table_id);
    return $takeaway;
}