$pro_cat_id[$row['cat_id']] = $row['cat_name'] . ' (' . $pro_count . ')';
}
unset($db_query);
$left_column = '';
$right_column = '';
$left_column .= '
<div class="text-center section-title">Danh sách mặt hàng</div>
<div id="mindow-listing-product">';
/*
    Phần hiển thị danh sách mặt hàng
*/
$listing_menu = '';
$list = new dataGrid('pro_id', 30, '#mindow-listing-product');
$list->add('pro_name', 'Tên mặt hàng', 'string', 1, 0);
$list->add('', 'ĐVT');
$list->addSearch('', 'pro_cat_id', 'array', $pro_cat_id, getValue('pro_cat_id'));
/*
    Câu lệnh SQL đếm bản ghi
    Câu lệnh điều kiện hiển thị các bản ghi
*/
$sql_search = '';
$search_cat_id = getValue('pro_cat_id');
if ($search_cat_id) {
    $sql_search .= ' AND pro_cat_id = ' . $search_cat_id . ' ';
}
$db_count = new db_count('SELECT count(*) AS count
                          FROM products
                          WHERE 1 ' . $list->sqlSearch() . $sql_search);
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
示例#2
0
}
//list kho hàng
$list_stores = array();
foreach (category_type('stores') as $store) {
    $list_stores[$store['cat_id']] = $store['cat_name'];
}
#Bắt đầu với datagrid
$list = new dataGrid($id_field, 3000, '#listing-product');
$list->add('pro_id', 'Mã hàng', 'string', 0, 1);
$list->add('pro_code', 'Mã có sẵn', 'string', 0, 1);
$list->add('pro_name', 'Tên hàng', 'string', 1, 1);
$list->add('pro_unit_id', 'Đơn vị tính');
$list->add('pro_instock', 'Tồn tối thiểu');
$list->add('pro_quantity', 'Tồn kho');
$store_id = getValue('store_id', 'int', 'GET', $configuration['con_default_store']);
$list->addSearch('Kho hàng', 'store_id', 'array', $list_stores, getValue('store_id', 'int', 'GET', $store_id));
$sql_search = '';
$sql_search .= ' AND store_id = ' . $store_id . ' ';
//Request with ajax
if ($isAjaxRequest) {
    $cat_id = getValue('cat_id', 'int', 'POST', 0);
    if ($cat_id) {
        $sql_search .= ' AND pro_cat_id = ' . $cat_id;
    }
}
$db_count = new db_count('SELECT count(*) as count
                            FROM ' . $bg_table . '
                            LEFT JOIN product_quantity ON pro_id = product_id
                            WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                            ');
$total = $db_count->total;
示例#3
0
    //đếm số thực đơn trong cate này
    $db_count = new db_count('SELECT count(*) AS count FROM menus WHERE men_cat_id = ' . $row['cat_id']);
    $men_count = $db_count->total;
    unset($db_count);
    $men_cat_id[$row['cat_id']] = $row['cat_name'] . ' (' . $men_count . ')';
}
$left_column = '';
$right_column = '';
$left_column .= '
<div id="mindow-listing-menu">';
//Danh sách mặt hàng
$listing_menu = '';
$list = new dataGrid('men_id', 100, '#mindow-listing-menu');
$list->add('men_name', 'Tên thực đơn', 'string', 1, 0);
$list->add('', 'ĐVT');
$list->addSearch('', 'men_cat_id', 'array', $men_cat_id, getValue('men_cat_id'));
$sql_search = '';
$search_cat_id = getValue('men_cat_id', 'int', 'GET', 0);
if ($search_cat_id) {
    $sql_search .= ' AND men_cat_id = ' . $search_cat_id . ' ';
}
// dem ban ghi trong menu
$db_count = new db_count('SELECT count(*) AS count
                          FROM menus
                          WHERE 1 ' . $list->sqlSearch() . $sql_search);
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM menus
                            WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                            ORDER BY ' . $list->sqlSort() . ' men_id ASC