function _loadFormEditRecord() { parent::_loadFormEditRecord(); // TODO: Change the autogenerated stub $list_cat = category_type($this->cat_type); $array_cat = array(' -- Chọn danh mục thực đơn -- '); foreach ($list_cat as $cat) { if (!$cat['cat_parent_id']) { $array_cat[$cat['cat_id']] = ' ☛ ' . $cat['cat_name']; } foreach ($list_cat as $cat_child) { if ($cat_child['cat_parent_id'] == $cat['cat_id']) { $array_cat[$cat_child['cat_id']] = ' ♦ ' . $cat_child['cat_name']; } } } $array_unit = array(0 => ' - Chọn đơn vị tính - '); $db_query = new db_query('SELECT * FROM units'); while ($row = mysqli_fetch_assoc($db_query->result)) { $array_unit[$row['uni_id']] = $row['uni_name']; } $this->add($this->form->text(array('label' => 'Tên thực đơn', 'name' => 'men_name', 'id' => 'men_name', 'require' => 1, 'errorMsg' => 'Bạn chưa nhập tên thực đơn', 'value' => $this->f['men_name']))); $this->add($this->form->select(array('label' => 'Đơn vị tính', 'name' => 'men_unit_id', 'id' => 'men_unit_id', 'option' => $array_unit, 'selected' => $this->f['men_unit_id'], 'require' => 1, 'errorMsg' => 'Bạn chưa nhập đơn vị tính'))); $this->add($this->form->select(array('label' => 'Danh mục', 'name' => 'men_cat_id', 'id' => 'men_cat_id', 'option' => $array_cat, 'selected' => $this->f['men_cat_id'], 'require' => 1, 'errorMsg' => 'Bạn chưa chọn danh mục thực đơn'))); $this->add($this->form->number(array('label' => 'Giá bán chính', 'name' => 'men_price', 'id' => 'men_price', 'require' => 1, 'addon' => 'vnđ', 'errorMsg' => 'Bạn chưa nhập giá bán chính', 'value' => $this->f['men_price']))); $this->add($this->form->number(array('label' => 'Giá bán 2', 'name' => 'men_price1', 'id' => 'men_price1', 'addon' => 'vnđ', 'value' => $this->f['men_price1']))); $this->add($this->form->number(array('label' => 'Giá bán 3', 'name' => 'men_price2', 'id' => 'men_price2', 'addon' => 'vnđ', 'value' => $this->f['men_price2']))); $this->add($this->form->textarea(array('label' => 'Ghi chú', 'name' => 'men_note', 'id' => 'men_note', 'value' => $this->f['men_note']))); $this->add($this->form->ajaxUploadFile(array('label' => 'Ảnh đại diện', 'name' => 'men_image', 'id' => 'men_image', 'browse_id' => 'browse_img', 'viewer_id' => 'viewer_img', 'value' => get_picture_path($this->f['men_image'])))); }
function _loadFormEditRecord() { $list_cat = category_type($this->cat_type); $array_cat = array('' => ' -- Chọn nhóm nhân viên -- '); foreach ($list_cat as $cat) { $array_cat[$cat['cat_id']] = $cat['cat_name']; } unset($db_query); parent::_loadFormEditRecord(); // TODO: Change the autogenerated stub $db_age = new db_query('SELECT * FROM agencies'); $list_agencies = array(); while ($row = mysqli_fetch_assoc($db_age->result)) { $list_agencies[$row['age_id']] = $row['age_name']; } $this->add($this->form->text(array('label' => 'Tên nhân viên', 'name' => 'use_name', 'id' => 'use_name', 'require' => 1, 'errorMsg' => 'Bạn chưa nhập tên nhân viên', 'value' => $this->f['use_name']))); $this->add($this->form->select(array('label' => 'Thuộc cửa hàng', 'name' => 'use_agency_id', 'id' => 'use_agency_id', 'option' => $list_agencies, 'selected' => $this->f['use_agency_id'], 'require' => 1, 'errorMsg' => 'Bạn chưa chọn cửa hàng'))); $this->add($this->form->text(array('label' => 'Địa chỉ', 'name' => 'use_address', 'id' => 'use_address', 'require' => 1, 'errorMsg' => 'Bạn chưa nhập địa chỉ', 'value' => $this->f['use_address']))); $this->add($this->form->text(array('label' => 'Điện thoại', 'name' => 'use_phone', 'id' => 'use_phone', 'value' => $this->f['use_phone']))); $this->add($this->form->number(array('label' => 'Lương ca', 'name' => 'use_pay', 'id' => 'use_pay', 'addon' => 'vnđ', 'value' => $this->f['use_pay']))); $this->add($this->form->number(array('label' => 'Chiết khấu', 'name' => 'use_discount', 'id' => 'use_discount', 'addon' => '%', 'value' => $this->f['use_discount']))); $this->add($this->form->select(array('label' => 'Nhóm nhân viên', 'name' => 'use_group_id', 'id' => 'use_group_id', 'option' => $array_cat, 'selected' => $this->f['use_group_id'], 'require' => 1, 'errorMsg' => 'Bạn chưa chọn nhóm nhân viên'))); $this->add($this->form->text(array('label' => 'Mã nhân viên tự nhập', 'name' => 'use_code', 'id' => 'use_code', 'value' => $this->f['use_code']))); $this->add($this->form->textarea(array('label' => 'Ghi chú', 'name' => 'use_note', 'id' => 'use_note', 'value' => $this->f['use_note']))); $this->add($this->form->ajaxUploadFile(array('label' => 'Ảnh đại diện', 'name' => 'use_image', 'id' => 'use_image', 'browse_id' => 'browse_img', 'viewer_id' => 'viewer_img', 'value' => get_picture_path($this->f['use_image'])))); }
function _loadFormEditRecord() { parent::_loadFormEditRecord(); // TODO: Change the autogenerated stub $list_cat = category_type($this->cat_type); $array_cat = array('' => ' -- Chọn nhóm nhà cung cấp -- '); foreach ($list_cat as $cat) { $array_cat[$cat['cat_id']] = $cat['cat_name']; } $this->add($this->form->text(array('label' => 'Tên nhà cung cấp', 'name' => 'sup_name', 'id' => 'sup_name', 'require' => 1, 'errorMsg' => 'Bạn chưa nhập tên nhà cung cấp', 'value' => $this->f['sup_name']))); $this->add($this->form->text(array('label' => 'Địa chỉ', 'name' => 'sup_address', 'id' => 'sup_address', 'require' => 1, 'errorMsg' => 'Bạn chưa nhập địa chỉ nhà cung cấp', 'value' => $this->f['sup_address']))); $this->add($this->form->ajaxUploadFile(array('label' => 'Ảnh đại diện', 'name' => 'sup_image', 'id' => 'sup_image', 'browse_id' => 'browse_img', 'viewer_id' => 'viewer_img', 'value' => get_picture_path($this->f['sup_image'])))); $this->add($this->form->select(array('label' => 'Nhóm', 'name' => 'sup_cat_id', 'id' => 'sup_cat_id', 'option' => $array_cat, 'selected' => $this->f['sup_cat_id'], 'require' => 1, 'errorMsg' => 'Bạn chưa chọn nhóm nhà cung cấp'))); $this->add($this->form->text(array('label' => 'Điện thoại', 'name' => 'sup_phone', 'id' => 'sup_phone', 'value' => $this->f['sup_phone']))); $this->add($this->form->text(array('label' => 'Di động', 'name' => 'sup_mobile', 'id' => 'sup_mobile', 'value' => $this->f['sup_mobile']))); $this->add($this->form->text(array('label' => 'Fax', 'name' => 'sup_fax', 'id' => 'sup_fax', 'value' => $this->f['sup_fax']))); $this->add($this->form->text(array('label' => 'Email', 'name' => 'sup_email', 'id' => 'sup_email', 'value' => $this->f['sup_email']))); $this->add($this->form->text(array('label' => 'Website', 'name' => 'sup_website', 'id' => 'sup_website', 'value' => $this->f['sup_website']))); }
<input class="form-control datetime-local input_date fl" value="' . date('d/m/Y') . '" id="end_date" type="text"> <span class="fl pull_span">Kho hàng :</span> <label><select class="form-control list_store" id="store_id" > ' . $list_store . ' </select> </label> <button class="btn btn-success" onclick="fillMenus()"><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 $cat_type = "menus"; $bg_table = "menus"; $list_category = category_type($cat_type); $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_products" id="chk_all"> <b>Tất cả</b> </label> </li> <?php foreach ($list_category as $cat) { ?> <?php //nếu cat_parent_id = 0 thì là category cha if ($cat['cat_parent_id'] == 0) { ?>
</ul> <?php $left_column = ob_get_contents(); ob_clean(); //Khối bên phải, hiển thị list user tương ứng $right_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1); //thêm các control khác //control nhập hàng, yêu cầu quyền mới cho hiển thị if (getPermissionValue('NHAP_HANG')) { $right_control .= '<div class="pull-left"> <span class="control-btn" onclick="importProduct()"><i class="fa fa-download"></i> Nhập hàng</span> </div>'; } //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
switch ($action) { case 'pagingAjax': if ($ajax_container == '#mindow-listing-product') { echo $listing_product; echo '<script>ImportScript.generateProductList();</script>'; } break; case 'searchAjax': echo $listing_product; echo '<script>ImportScript.generateProductList();</script>'; break; } die; } //List kho hàng $list_store = category_type('stores'); $list_store_option = ''; foreach ($list_store as $store) { $selected = ''; if ($configuration['con_default_store'] == $store['cat_id']) { $selected = 'selected'; } $list_store_option .= '<option value="' . $store['cat_id'] . '" ' . $selected . '>' . $store['cat_name'] . '</option>'; } //List nhà cung cấp $list_suppliers = array(); $list_suppliers_option = ''; $db_sup = new db_query('SELECT * FROM suppliers'); while ($row = mysqli_fetch_assoc($db_sup->result)) { $list_suppliers_option .= '<option value="' . $row['sup_id'] . '">' . $row['sup_name'] . '</option>'; }
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); }