?> <?php echo $form->text(array('label' => 'URL file', 'name' => 'mod_listfile', 'id' => 'mod_listfile', 'placeholder' => 'Cách nhau bởi dấu |')); ?> <?php echo $form->form_action(array('label' => array('Thêm mới', 'Nhập lại'), 'type' => array('submit', 'reset'))); ?> <?php echo $form->form_close(); ?> </div> <div id="list_module"> <?php //select module $db_module = new db_query("SELECT * FROM modules ORDER BY mod_order ASC"); $listmodule = $db_module->resultArray(); unset($db_module); $i = 0; ?> <?php foreach ($listmodule as $mod) { if (!file_exists("../../modules/" . $mod["mod_path"] . "/inc_security.php") && !file_exists("../../core/" . $mod["mod_path"] . "/inc_security.php")) { continue; } $filepath = file_exists("../../modules/" . $mod["mod_path"] . "/inc_security.php") ? 'modules' : 'core'; if (file_exists("../../" . $filepath . "/" . $mod["mod_path"] . "/inc_security.php")) { require_once "../../" . $filepath . "/" . $mod["mod_path"] . "/inc_security.php"; $i++; ?> <?php echo $form->form_open('quickedit' . $mod['mod_id'], 'quickeditmodule.php?record_id=' . $mod['mod_id']);
function get_category_thuoc() { $ll = new db_query('SELECT cat_id, cat_name FROM categories WHERE cat_type = ' . CATEGORY_TYPE_THUOC); return $ll->resultArray(); }
<?php $isAdmin = isset($_SESSION["isAdmin"]) ? intval($_SESSION["isAdmin"]) : 0; $user_id = isset($_SESSION["user_id"]) ? intval($_SESSION["user_id"]) : 0; $sql = ''; if ($isAdmin != 1) { $sql = ' INNER JOIN admin_users_right ON(adu_admin_module_id = mod_id AND adu_admin_id = ' . $user_id . ')'; } $db_menu = new db_query("SELECT * \n\t\t\t\t\t\t FROM modules\n\t\t\t\t\t\t " . $sql . "\n\t\t\t\t\t\t ORDER BY mod_order ASC, mod_id ASC"); ?> <ul> <?php $menu = $db_menu->resultArray(); foreach ($menu as $mod) { if (!file_exists("modules/" . $mod["mod_path"] . "/inc_security.php") && !file_exists("core/" . $mod["mod_path"] . "/inc_security.php")) { continue; } $filepath = file_exists("modules/" . $mod["mod_path"] . "/inc_security.php") ? 'modules' : 'core'; ?> <li class="module_link"> <label class="module_name collapsed" data-toggle="collapse" data-target="#module_<?php echo $mod['mod_id']; ?> " > <span class="menu-label"><?php echo $mod['mod_name']; ?> </span><i class="fa fa-angle-right"></i> </label> <?php $arraySub = explode("|", $mod["mod_listname"]);
$left_control = ''; $right_control = ''; $footer_control = ''; $left_column_title = 'Nhóm khách hàng'; $right_column_title = 'Danh sách khách hàng'; $left_column = ''; $right_column = ''; $context_menu = ''; $add_btn = getPermissionValue('add'); $edit_btn = getPermissionValue('edit'); $trash_btn = getPermissionValue('trash'); //control button trái $left_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1); $db_cus_cat = "SELECT *FROM customer_cat ORDER BY cus_cat_id"; $rs_cus_cat = new db_query($db_cus_cat); $list_category = $rs_cus_cat->resultArray(); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); $all_count = $db_count->total; unset($db_count); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $trash_count = $db_count->total; unset($db_count); ob_start(); ?> <ul class="list-unstyled list-vertical-crm"> <li data-cat="all"> <label class="active cat_name"><b><i class="fa fa-list fa-fw"></i> Tất cả (<?php echo $all_count; ?> )</b></label> </li>
<?php //lấy ra list các danh mục bệnh $db_cat_disease = new db_query('SELECT * FROM cat_disease WHERE cdi_parent_id = 0 AND cdi_id <> ' . OTHER_DISEASE); $cat_disease = $db_cat_disease->resultArray(); unset($db_cat_disease); $rainTpl->assign('cat_disease', $cat_disease);
function searchRecord() { // TODO: Implement searchRecord() method. //Hàm tìm kiếm ở header $cat_id = getValue($this->cat_field, 'str', 'GET', ''); $html = ''; $this->_listAdd(); $class_context_menu = 'menu-normal'; switch ($cat_id) { case 'all': $this->list->addHiddenHeader($this->cat_field, $cat_id); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch()); $sql = 'SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch(); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $this->list->addHiddenHeader($this->cat_field, $cat_id); $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $this->bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($this->bg_table); $this->list->limit($total); break; default: $cat_id = (int) $cat_id; $this->list->addHiddenCondition($this->cat_field, $cat_id, 'int'); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' AND ' . $this->cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' AND ' . $this->cat_field . ' = ' . $cat_id . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $this->list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $list_column = $this->_listColumn($row); $i++; $html .= $this->list->start_tr($i, $row[$this->id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$this->id_field] . ')" data-record_id="' . $row[$this->id_field] . '"'); $html .= $list_column; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $this->add($html); }
function showInfo() { $array_return = array(); $cat_id = getValue('cat_id', 'int', 'POST', 0); $db_cus_cat = 'SELECT * FROM customer_cat WHERE cus_cat_id = ' . $cat_id . ''; $rs_cus_cat = new db_query($db_cus_cat); $list_category = $rs_cus_cat->resultArray(); foreach ($list_category as $cat) { $array_return = array('cus_cat_sales' => format_number($cat['cus_cat_sales']), 'cus_cat_discount' => $cat['cus_cat_discount']); } unset($db_cus_cat); die(json_encode($array_return)); }
$isSuperAdmin = getValue('isSuperAdmin', 'int', 'SESSION', 0); $isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; //Lấy ra config nhà hàng if ($isAdmin) { $sql_configuration = 'SELECT * FROM configurations WHERE con_admin_id = ' . $admin_id . ' LIMIT 1'; } else { $sql_configuration = 'SELECT * FROM configurations LEFT JOIN admin_users ON adm_id WHERE con_admin_id = ' . $user_config . ' LIMIT 1'; } $db_con = new db_query($sql_configuration); $configuration = mysqli_fetch_assoc($db_con->result); unset($db_con); //lấy danh sách bàn trong cửa hàng hiện tại $db_desk = new db_query('SELECT * FROM desks LEFT JOIN sections ON sec_id = des_sec_id LEFT JOIN service_desks ON sed_id = sec_service_desk WHERE sed_agency_id = ' . $configuration['con_default_agency']); $_list_desk = $db_desk->resultArray(); unset($db_desk); //lấy danh sách khu vực trong cửa hàng hiện tại $db_section = new db_query('SELECT * FROM sections LEFT JOIN service_desks ON sed_id = sec_service_desk WHERE sed_agency_id = ' . $configuration['con_default_agency']); $_list_section = $db_section->resultArray(); unset($db_section); $load_header = $css_global . $js_global; $load_header .= '<title>Hệ thống quản lý CMS</title>';
function listRecord() { global $id_field; global $bg_table; global $cat_field; $cat_id = getValue('cat_id', 'str', 'POST', 0); $html = ''; $class_context_menu = 'menu-normal'; #Bắt đầu với datagrid $list = new dataGrid($id_field, 30); /*code something*/ $list->add('', 'Tên cửa hàng'); $list->add('', 'Điện thoại'); switch ($cat_id) { case 'all': $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch()); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC ' . $list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($bg_table); $list->limit($total); break; default: $cat_id = (int) $cat_id; $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' AND ' . $cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' AND ' . $cat_field . ' = ' . $cat_id . ' ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC ' . $list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $i++; $html .= $list->start_tr($i, $row[$id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$id_field] . ')" data-record_id="' . $row[$id_field] . '"'); /*code something */ $html .= '<td>' . $row['sed_name'] . '</td>'; $html .= '<td class="right">' . $row['sed_phone'] . '</td>'; $html .= $list->end_tr(); } $html .= $list->showFooter(); echo $html; }
$isAdmin = getValue("isAdmin", "int", "SESSION", 0); $isSuperAdmin = getValue('isSuperAdmin', 'int', 'SESSION', 0); if (!$isAdmin) { redirect('index.php'); } //ajax $isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; if ($isAjaxRequest) { $action = getValue('action', 'str', 'POST', ''); switch ($action) { case 'changeAgency': $age_id = getValue('age_id', 'int', 'POST', 0); $db_age = new db_query('SELECT sed_id, sed_name FROM service_desks WHERE sed_agency_id = ' . $age_id); $list_service_desk = $db_age->resultArray(); foreach ($list_service_desk as $k => $v) { ?> <option value="<?php echo $v['sed_id']; ?> "><?php echo $v['sed_name']; ?> </option> <?php } break; } die; }
function loadMenuDetail() { //contextmenuclass cho phần chi tiết thực đơn $class_context_menu = ''; $record_id = getValue('record_id', 'int', 'POST', ''); $table = 'menu_products'; $html = ''; //Thêm hidden menu_id để gửi trong form công thức chế biến $html .= $this->form->hidden(array('name' => 'selected_menu', 'id' => 'selected_menu', 'value' => $record_id)); $this->list->add('', 'Nguyên liệu'); $this->list->add('', 'SL'); $this->list->add('', 'ĐVT'); $db_count = new db_count('SELECT count(*) as count FROM ' . $table . ' WHERE mep_menu_id = ' . $record_id . $this->list->sqlSearch()); $total = $db_count->total; unset($db_count); $sql = 'SELECT * FROM ' . $table . ' LEFT JOIN products ON pro_id = mep_product_id LEFT JOIN units ON uni_id = pro_unit_id WHERE mep_menu_id = ' . $record_id . $this->list->sqlSearch() . ' ORDER BY ' . $this->list->sqlSort() . ' pro_name ASC ' . $this->list->limit($total); $db_listing = new db_query($sql); $array_row = $db_listing->resultArray(); unset($db_listing); $total_row = count($array_row); $html .= $this->list->showHeader($total_row, '', 'id="menu_product_listing"'); $i = 0; foreach ($array_row as $row) { $i++; $html .= $this->list->start_tr($i, 'product_' . $row['pro_id'], 'class="' . $class_context_menu . ' menu-product-item" onclick="active_menu_product(' . $row['pro_id'] . ')" data-record_id="' . $row['pro_id'] . '" data-menu_id = "' . $record_id . '"'); $html .= '<td>' . $row['pro_name'] . '</td>'; $html .= '<td>' . $row['mep_quantity'] . '</td>'; $html .= '<td>' . $row['uni_name'] . '</td>'; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $html .= '<div class="pos_bottom alert-warning text-left"> <label>Lưu ý:</label> <br/> Định lượng nguyên liệu của một thực đơn dựa vào số lượng chế biến của nguyên liệu( chính là mặt hàng trong kho hàng). Nếu bạn muốn quản lý kho hàng và các mặt hàng được tự động trừ khi phục vụ thực đơn. Bạn phải tạo định lượng theo số lượng tương ứng. <br/> Với các mặt hàng không phải chế biến, có nghĩa là nhập về có thể bán được ngay(vd: bia, nước ngọt ...) thì bạn cũng phải tạo định lượng chế biến là 1 để khi bán hàng kho hàng tự động trừ tương ứng <label>Số lượng tồn của thực đơn</label> được tính toán dựa trên công thức chế biến của thực đơn đó và số lượng tồn của các nguyên liệu trong kho hàng. </div>'; $this->add($html); }
function category_type($type, $parent_id = null) { if ($parent_id !== null) { $parent_id = (int) $parent_id; $db_query = new db_query('SELECT * FROM categories_multi WHERE cat_type ="' . $type . '" AND cat_parent_id = ' . $parent_id); } else { $db_query = new db_query('SELECT * FROM categories_multi WHERE cat_type ="' . $type . '"'); } $result = $db_query->resultArray(); return $result; }
<i class="fa fa-arrow-right fl pull_span"></i> <input class="form-control datetime-local input_date fl" value="' . date('d/m/Y') . '" id="end_date" type="text"> </label> <button class="btn btn-success" onclick="fillCustomers()"><i class="fa fa-check-circle-o"></i> Lọc dữ liệu </button> <button class="btn btn-danger"><i class="fa fa-file-excel-o"></i> Xuất excel </button> </div> <div class="clearfix"></div> '; // phấn menu left //lấy ra danh mục $bg_table = "customers"; $list_category = array(); $db_cat_customer = new db_query('SELECT * FROM customer_cat'); $list_category = $db_cat_customer->resultArray(); unset($db_cat_customer); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); unset($db_count); ob_start(); ?> <ul id="tree" class="list_category"> <li> <label><input type="checkbox" name="all_customers" id="chk_all"> <b>Tất cả</b> </label> </li> <li class="cat_parent list-vertical-item" > <?php //foreach lại 1 lần nữa trong mảng categoy để lấy ra các category con của cat cha hiện tại foreach ($list_category as $cat_child) {
unset($db_count_desk); // lay ra vi tri ban $db_position_section = new db_query("SELECT * FROM desks\n LEFT JOIN sections ON des_sec_id = sec_id\n WHERE des_id = " . intval($desk_id)); $data_pos_sec = mysqli_fetch_assoc($db_position_section->result); unset($db_position_section); if (!$data_pos_sec) { return; } $desk_name = $data_pos_sec['des_name'] . ' - ' . $data_pos_sec['sec_name']; // lay ra danh sach khach hang $db_customer = new db_query('SELECT * FROM customers ORDER BY cus_id ASC'); $list_cus = $db_customer->resultArray(); unset($db_customer); // lay ra danh sach nhan vien $db_user = new db_query('SELECT * FROM users ORDER BY use_id ASC'); $list_use = $db_user->resultArray(); unset($db_user); //lay ra gio vao ban $db_current_desk = new db_query("SELECT cud_start_time FROM current_desk\n WHERE cud_desk_id = " . intval($desk_id)); $data_current_desk = mysqli_fetch_assoc($db_current_desk->result); unset($db_current_desk); $start_time = date('d/m/Y h:i', $data_current_desk['cud_start_time']); //danh sach thuc don $db_categories_menus = new db_query('SELECT * FROM categories_multi WHERE cat_type = "' . MENU_CAT_TYPE . '"'); $list_menu = ''; while ($data_cat_menu = mysqli_fetch_assoc($db_categories_menus->result)) { // danh sach cat_menu $list_menu .= '<li id="cat-menu-' . $data_cat_menu['cat_id'] . '"> <div class="name-price cat-menu"> <div class="menu-list-name">' . $data_cat_menu['cat_name'] . '</div>
} //Phần hiển thị //Khởi tạo $left_control = ''; $right_control = ''; $left_column = ''; $right_column = ''; $context_menu = ''; $add_btn = getPermissionValue('add'); $edit_btn = getPermissionValue('edit'); $trash_btn = getPermissionValue('trash'); //control button trái $left_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1); $list_category = array(); $db_agencies = new db_query('SELECT * FROM agencies'); $list_category = $db_agencies->resultArray(); unset($db_agencies); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); $all_count = $db_count->total; unset($db_count); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $trash_count = $db_count->total; unset($db_count); ob_start(); ?> <ul class="list-unstyled list-vertical-crm"> <li data-cat="all"> <label class="active cat_name"><b><i class="fa fa-list fa-fw"></i> Tất cả (<?php echo $all_count; ?> )</b></label>
function searchRecord() { // TODO: Implement searchRecord() method. global $configuration; //Hàm tìm kiếm ở header $cat_id = getValue($this->cat_field, 'str', 'GET', ''); $html = ''; $this->_listAdd(); $class_context_menu = 'menu-normal'; //list kho hàng $list_stores = array(); foreach (category_type('stores') as $store) { $list_stores[$store['cat_id']] = $store['cat_name']; } $store_id = getValue('store_id', 'int', 'GET', $configuration['con_default_store']); $this->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 . ' '; switch ($cat_id) { case 'all': $this->list->addHiddenHeader($this->cat_field, $cat_id); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $this->list->addHiddenHeader($this->cat_field, $cat_id); $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $this->bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($this->bg_table); $this->list->limit($total); break; default: $cat_id = (int) $cat_id; $this->list->addHiddenCondition($this->cat_field, $cat_id, 'int'); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' AND ' . $this->cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' AND ' . $this->cat_field . ' = ' . $cat_id . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $this->list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $list_column = $this->_listColumn($row); $i++; $html .= $this->list->start_tr($i, $row[$this->id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$this->id_field] . ')" data-record_id="' . $row[$this->id_field] . '"'); $html .= $list_column; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $this->add($html); }