/** * list các bản ghi trong thùng rác */ function listRecordTrash() { $html = ''; //lấy ra danh sách các bản ghi trong thùng rác của bảng financial $control = getValue('control', 'str', 'POST', ''); $control = $control == 'in' ? 'in' : 'out'; $control_text = $control == 'in' ? 'thu' : 'chi'; $class_context_menu = 'menu-trash'; //Bắt đầu modal $this->openModalNoForm(); $this->add('<div class="h5 help-block">Danh sách phiếu ' . $control_text . ' trong thùng rác</div>'); $this->list->add('', 'Ngày ' . $control_text); $this->list->add('', 'Số phiếu'); $this->list->add('', 'Người nhận'); $this->list->add('', 'Diễn giải'); $this->list->add('', 'Số tiền'); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $this->bg_table . '" AND tra_option_filter = "money_' . $control . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($this->bg_table, 10, 0, 'AND tra_option_filter = "money_' . $control . '"'); $this->list->limit($total); $total_row = count($array_row); $html .= $this->list->showHeader($total_row); $i = 0; //Lấy ra list lý do thu chi $db_query = new db_query('SELECT * FROM ' . $this->cat_table . ' WHERE cat_type = "money_' . $control . '"'); $list_cat = array(); while ($row = mysqli_fetch_assoc($db_query->result)) { $list_cat[$row['cat_id']] = $row['cat_name']; } foreach ($array_row as $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] . '"'); //Ngày tạo $html .= '<td class="center">' . date('d/m/Y H:i', $row['fin_date']) . '</td>'; //Số phiếu - ID phiếu $html .= '<td class="center">' . format_codenumber($row[$this->id_field], 6) . '</td>'; //Người nộp $html .= '<td>' . $row['fin_username'] . '</td>'; //Mô tả $html .= '<td>' . $list_cat[$row['fin_cat_id']] . '</td>'; //số tiền $html .= '<td class="text-right">' . format_number($row['fin_money']) . '</td>'; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $this->add($html); $this->closeModalNoForm(); }
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); }
<?php require_once 'inc_security.php'; // lấy ra danh sách các phiếu kiểm kê trong thùng rác $tra_record_id = getValue('tra_record_id', 'int', 'GET', 0); if ($tra_record_id) { $sql_option = 'AND tra_record_id = ' . $tra_record_id . ''; } else { $sql_option = ''; } $array_row = trash_list('inventory', 100, 0, $sql_option); $total_row = count($array_row); //Lấy ra list cửa hàng $list_users = array(); $db_query_users = new db_query("SELECT * FROM users"); $list_users = array(); while ($row = mysqli_fetch_assoc($db_query_users->result)) { $list_users[$row['use_id']] = $row['use_name']; } unset($db_query_users); //Lấy ra list admin $list_admin = array(); $db_query_admin = new db_query("SELECT * FROM admin_users"); $list_admin = array(); while ($row = mysqli_fetch_assoc($db_query_admin->result)) { $list_admin[$row['adm_id']] = $row['adm_name']; } unset($db_query_admin); //Lấy ra list kho hàng $list_store = array(); $db_query_store = new db_query("SELECT * FROM categories_multi WHERE cat_type = 'stores'");
$list->add('', 'Tổng tiền'); $list->add('', 'Ghi chú'); // tổng số hóa đơn trong thùng rác $count_bill_trash = new db_count('SELECT count(*) as count FROM trash WHERE 1 ' . $list->sqlSearch() . ' AND tra_table = "' . $table . '" '); $total = $count_bill_trash->total; unset($count_bill_trash); $db_list_bill_trash = new db_query('SELECT * FROM trash WHERE tra_table = "' . $table . '" ' . $list->limit($total)); $total = mysqli_num_rows($db_list_bill_trash->result); unset($db_list_bill_trash); // lọc ra thông tin hóa đơn trong thùng rác $array_bill = trash_list($table, $total, 0); $i = 0; $content_column .= '<div class="section-content">'; $content_column .= $list->showHeader($total, '', 'id="list_trash"'); foreach ($array_bill as $row) { $i++; if ($row[$id_object] == 0) { $name = $name_obj; } else { $db_list_bill = new db_query('SELECT ' . $name_object . ' FROM ' . $table_object . ' WHERE ' . $id . ' = ' . $row[$id_object]); $data_list_bill = mysqli_fetch_assoc($db_list_bill->result); unset($db_list_bill); $name = $data_list_bill[$name_object]; } $content_column .= $list->start_tr($i, $row[$bill_id], 'class="menu-normal record-item" onclick="active_record(' . $row[$bill_id] . ')" data-table="' . $table . '" ondblclick="show_bill_detai()" data-record_id="' . $row[$bill_id] . '"'); $content_column .= '<td>' . format_codenumber($row[$bill_id], 6, PREFIX_BILL_CODE) . '</td>';
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; }
$right_column .= $list->showHeader($total_row); $i = 0; while ($row = mysqli_fetch_assoc($db_listing->result)) { $i++; $right_column .= $list->start_tr($i, $row[$id_field], 'class="context-menu-user" onclick="selectRow(' . $row[$id_field] . ')" data-user-id="' . $row[$id_field] . '"'); $right_column .= '<td>' . $row['adm_loginname'] . '</td>'; $right_column .= '<td>' . $row['adm_name'] . '</td>'; $right_column .= '<td>' . $row['adm_note'] . '</td>'; $right_column .= $list->end_tr(); } $right_column .= $list->showFooter(); echo $right_column; break; case 'trash': //list user ở trong thùng rác $array_row = trash_list('admin_users'); #Bắt đầu với datagrid $list = new dataGrid($id_field, 10); $list->add('', 'Tài khoản'); $list->add('', 'Tên hiển thị'); $list->add('', 'Ghi chú'); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "admin_users"'); $total = $db_count->total; unset($db_count); $list->limit($total); $total_row = count($array_row); $right_column .= $list->showHeader($total_row); $i = 0; foreach ($array_row as $row) {
<?php require_once 'inc_security.php'; // lấy ra danh sách các phiếu kiểm kê trong thùng rác $tra_record_id = getValue('tra_record_id', 'int', 'GET', 0); if ($tra_record_id) { $sql_option = 'AND tra_record_id = ' . $tra_record_id . ''; } else { $sql_option = ''; } $array_row = trash_list('stock_transfer', 100, 0, $sql_option); $total_row = count($array_row); //Lấy ra list cửa hàng $list_users = array(); $db_query_users = new db_query("SELECT * FROM users"); $list_users = array(); while ($row = mysqli_fetch_assoc($db_query_users->result)) { $list_users[$row['use_id']] = $row['use_name']; } unset($db_query_users); //Lấy ra list admin $list_admin = array(); $db_query_admin = new db_query("SELECT * FROM admin_users"); $list_admin = array(); while ($row = mysqli_fetch_assoc($db_query_admin->result)) { $list_admin[$row['adm_id']] = $row['adm_name']; } unset($db_query_admin); //Lấy ra list kho hàng $list_store = array(); $db_query_store = new db_query("SELECT * FROM categories_multi WHERE cat_type = 'stores'");
function getListDesk() { global $configuration; $sec_id = getValue('sec_id', 'str', 'POST', ''); switch ($sec_id) { case 'all': $db_query = new db_query('SELECT sec_id,sec_name FROM sections LEFT JOIN service_desks ON sed_id = sec_service_desk WHERE sed_agency_id = ' . $configuration['con_default_agency']); while ($row = mysqli_fetch_assoc($db_query->result)) { ?> <div class="section-name bold"><?php echo $row['sec_name']; ?> </div> <?php $db_desk = new db_query('SELECT * FROM desks WHERE des_sec_id = ' . $row['sec_id']); while ($row_desk = mysqli_fetch_assoc($db_desk->result)) { ?> <div class="col-sm-2 desk-item menu-normal" id="record_<?php echo $row_desk['des_id']; ?> " onclick="active_desk(this)" data-record_id="<?php echo $row_desk['des_id']; ?> "> <?php echo $row_desk['des_name']; ?> (ID:<?php echo $row_desk['des_id']; ?> ) </div> <?php } ?> <div class="clearfix"></div> <?php } break; case 'trash': $list_desk = trash_list('desks'); echo '<div class="section-name bold">Thùng rác</div>'; foreach ($list_desk as $row_desk) { ?> <div class="col-sm-2 desk-item menu-trash" id="record_<?php echo $row_desk['des_id']; ?> " onclick="active_desk(this)" data-record_id="<?php echo $row_desk['des_id']; ?> "> <?php echo $row_desk['des_name']; ?> (ID:<?php echo $row_desk['des_id']; ?> ) </div> <?php } break; default: $sec_id = getValue('sec_id', 'int', 'POST', 0); ?> <div class="section-name bold">Danh sách:</div> <?php $db_desk = new db_query('SELECT * FROM desks WHERE des_sec_id = ' . $sec_id); while ($row_desk = mysqli_fetch_assoc($db_desk->result)) { ?> <div class="col-sm-2 desk-item menu-normal" id="record_<?php echo $row_desk['des_id']; ?> " onclick="active_desk(this)" data-record_id="<?php echo $row_desk['des_id']; ?> "> <?php echo $row_desk['des_name']; ?> (ID:<?php echo $row_desk['des_id']; ?> ) </div> <?php } break; } }
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); }
$class_context_menu = 'menu-trash'; $list = new dataGrid('pms_id', 100, '#mindow-listing-promotions'); $list->add('', 'Cửa hàng'); $list->add('', 'Tên chiến dịch'); $list->add('', 'Ngày bắt đầu'); $list->add('', 'Ngày kết thúc'); $list->add('', 'Giảm'); $list->add('', 'Kiểu KM'); $list->add('', 'Điều kiện HĐ'); $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, 30, 0); $list->limit($total); $total_row = count($array_row); $content_column .= $list->showHeader($total_row, '', 'id="table-trash"'); $i = 0; //Lấy ra list cửa hàng $list_agencies = array(); $db_query_agencies = new db_query("SELECT * FROM agencies"); $list_agencies = array(); while ($row = mysqli_fetch_assoc($db_query_agencies->result)) { $list_agencies[$row['age_id']] = $row['age_name']; } unset($db_query_agencies); // select các bản ghi trong thung rác foreach ($array_row as $row) { $i++;