Exemplo n.º 1
0
    <select class="form-control">
        <option value="5">5 lần thanh toán gần đây</option>
        <option value="10">10 lần thanh toán gần đây</option>
        <option value="15">15 lần thanh toán gần đây</option>
    </select>
</div>';
$list = new dataGrid('fin_id', $limit_financies);
$list->add('fin_id', 'Số phiếu', 'string', 1);
$list->add('fin_updated_time', 'Ngày thanh toán');
$list->add('fin_money', 'Số tiền');
$list->add('fin_pay_type', 'Trả bằng');
$list->add('fin_note', 'Ghi chú');
// lấy ra tổng số hóa đơn nhap đã được trả
$cout_financies_bill_out = new db_query('SELECT *
                                        FROM ' . $financies . $join_table . '
                                        WHERE 1 ' . $list->sqlSearch() . ' AND fin_cat_id = 32' . $And_id);
$total = mysqli_num_rows($cout_financies_bill_out->result);
unset($cout_financies_bill_out);
// kiểm tra có tồn tại request ajax biến limit
if ($isAjaxRequest && $limit != 0) {
    $total = $limit;
}
// list danh sách hóa đơn
$db_financies_bill_out = new db_query('SELECT *
                                        FROM ' . $financies . $join_table . '
                                        WHERE 1 ' . $list->sqlSearch() . ' AND fin_cat_id = 32' . $And_id . '
                                        ORDER BY ' . $list->sqlSort() . ' fin_id
                                        ASC ' . $list->limit($total));
if ($isAjaxRequest && isset($_GET['fin_id']) && isset($_GET['sup_name'])) {
    $fin_id = getValue('fin_id', 'int', 'GET', 0);
    $sup_name = getValue('sup_name', 'str', 'GET', '');
Exemplo n.º 2
0
    if ($id_brand) {
        $and_bio_sup_id .= ' AND bio_supplier_id = ' . intval($id_brand);
    }
    // loc theo id nha cung cap
    if ($time_start) {
        $and_bio_sup_id .= $type_bill_fillter . ' >= ' . $time_start;
    }
    if ($time_end) {
        $and_bio_sup_id .= $type_bill_fillter . ' <= ' . $time_end;
    }
} else {
    $and_bio_sup_id = $type_bill_fillter . ' >= ' . (convertDateTime($today, '0:0:0') - 2592000) . $type_bill_fillter . ' <= ' . convertDateTime($today, '23:59:59');
}
$db_count = new db_count('SELECT count(*) as count
                            FROM ' . $bg_table_o . '
                            WHERE 1 ' . $list_right->sqlSearch() . $and_bio_sup_id . '
                            ');
$total_ = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table_o . '
                            WHERE 1 ' . $list_right->sqlSearch() . $and_bio_sup_id . '
                            ORDER BY ' . $list_right->sqlSort() . ' ' . $id_field_o . ' ASC
                            ' . $list_right->limit($total_));
$total_row = mysqli_num_rows($db_listing->result);
$right_column .= '<div id="table_bill_out">';
$table_right_column = '';
$table_right_column .= $list_right->showHeader($total_row, '', 'id="table-listing-right"');
$i = 0;
$totalAll_ = 0;
while ($row = mysqli_fetch_assoc($db_listing->result)) {
Exemplo n.º 3
0
$content_column = '';
$content_column .= '
<div id="mindow-listing-inventory">';
//Danh sách phiếu kiểm kê
$listing_menu = '';
$list = new dataGrid('tra_id', 100, '#mindow-listing-product');
$list->add('tra_record_id', 'Số phiếu', 'string', 1, 0, 'Số phiếu');
$list->add('', 'Nhân viên kiểm kê');
$list->add('', 'Ngày kiểm kê');
$list->add('', 'Kho kiểm kê');
$list->add('', 'Người tạo');
$search_sql = ' AND tra_table = "inventory"';
// đếm số lượng phiếu kiểm kê trong thùng rác
$db_count = new db_count('SELECT count(*) as count
                                  FROM trash
                                  WHERE 1' . $list->sqlSearch() . $search_sql . '');
$total = $db_count->total;
unset($db_count);
// lấy ra số lượng các phiếu kiểm kê trong thùng rác
$db_listing = new db_query('SELECT *
                            FROM trash
                            WHERE 1 ' . $list->sqlSearch() . $search_sql . '
                            ORDER BY ' . $list->sqlSort() . ' tra_id DESC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$i = 0;
$listing_menu .= $list->showHeader($total_row);
foreach ($array_row as $row) {
    $i++;
    if (!$row['inv_staff_id']) {
        $staff_name = '';
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
    </ul>
<?php 
$left_column = ob_get_contents();
ob_clean();
//Khối bên phải, hiển thị list customer tương ứng
$right_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1);
#Bắt đầu với datagrid
$list = new dataGrid($id_field, 30);
$list->add('cus_id', 'Mã hệ thống');
$list->add('cus_code', 'Mã có sẵn');
$list->add('cus_name', 'Tên khách hàng', 'string', 1, 1);
$list->add('cus_address', 'Địa chỉ');
$list->add('cus_phone', 'Điện thoại');
$db_count = new db_count('SELECT count(*) as count
                            FROM ' . $bg_table . '
                            WHERE 1 ' . $list->sqlSearch() . '
                            ');
$total = $db_count->total;
unset($db_count);
// request ajax load categories customer name
$cat_id = getValue('cat_id', 'int', 'POST', 0);
if ($cat_id && $isAjaxRequest) {
    $db_extra = 'AND ' . $bg_table . '.' . $cat_field . ' = ' . $cat_id . ' ';
} else {
    $db_extra = '';
}
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            LEFT JOIN customer_cat ON customers.cus_cat_id = customer_cat.cus_cat_id
                            WHERE 1 ' . $list->sqlSearch() . $db_extra . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC
Exemplo n.º 6
0
$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);
//Hiển thị danh sách lý do thu chi
$list = new dataGrid('cat_id', 30);
$list->add('', 'Mô tả');
$db_count = new db_count('SELECT count(*) as count
                          FROM ' . $bg_table . '
                          WHERE cat_type = "' . $cat_type . '"');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            WHERE 1 AND cat_type = "' . $cat_type . '"' . $list->sqlSearch() . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$left_column .= $list->showHeader($total_row);
$i = 0;
while ($row = mysqli_fetch_assoc($db_listing->result)) {
    $i++;
    $left_column .= $list->start_tr($i, $row['cat_id'], 'class="menu-normal record-item" onclick="active_record(' . $row['cat_id'] . ')" data-record_id="' . $row['cat_id'] . '"');
    $left_column .= '<td>' . $row['cat_name'] . '</td>';
}
$left_column .= $list->showFooter();
$rainTpl = new RainTPL();
$rainTpl->assign('load_header', $load_header);
$rainTpl->assign('module_name', $module_name);
$rainTpl->assign('error_msg', print_error_msg($bg_errorMsg));
Exemplo n.º 7
0
}
//
if (trim($position) == 'right' || trim($position) == 'bill_out') {
    $title_detail_left = 'Danh sách mặt hàng nhập vào hóa đơn';
    $list = new dataGrid('bid_pro_id', 10);
    $list->add('bid_pro_id', 'Mã hàng');
    $list->add('pro_name', 'Tên sản phẩm');
    $list->add('uni_name', 'ĐVT');
    $list->add('bid_pro_number', 'SL');
    $list->add('bid_pro_price', 'Đơn giá');
    $list->add('', 'Thành tiền');
    // xem chi tiet hoa don nhap tu trang index
    if (trim($position) == 'right') {
        $db_count = new db_count('SELECT count(*) as count
                                    FROM bill_out_detail
                                    WHERE 1 ' . $list->sqlSearch() . ' AND bid_bill_id = ' . $data_record_id . '
                                    ');
        $total = $db_count->total;
        unset($db_count);
        // danh sach san pham nhap trong hoa don
        $menu_listing = new db_query('SELECT * FROM bill_out_detail 
                                            LEFT JOIN products ON bid_pro_id = pro_id
                                            LEFT JOIN units ON pro_unit_id = uni_id
                                            WHERE bid_bill_id = ' . $data_record_id . ' ' . $list->limit($total));
    }
    //  xem chi tiet hoa don nhâp từ trong thung rac
    if (trim($position) == 'bill_out') {
        $db_count_bill_in_trash = new db_count('SELECT count(*) as count
                                                FROM trash
                                                WHERE 1 ' . $list->sqlSearch() . ' 
                                                AND tra_record_id = ' . $data_record_id . '
Exemplo n.º 8
0
//Thêm nút cài đặt và thùng rác bên phải của danh sách
$right_control .= '<div class="control-table-listing top_right_control pull-right">
    <span class="control-btn"><i class="fa fa-cog"></i> Cài đặt</span>
    <span class="control-btn control-list-trash" onclick="list_trash(\'out\')"><i class="fa fa-recycle"></i> Thùng rác</span>
</div>';
#Bắt đầu với datagrid
$list = new dataGrid($id_field, 3000);
$list->add('', 'Ngày chi');
$list->add('', 'Số phiếu');
$list->add('', 'Người nhận');
$list->add('', 'Diễn giải');
$list->add('', 'Số tiền');
$db_count = new db_count('SELECT count(*) as count
                          FROM ' . $bg_table . '
                          LEFT JOIN categories_multi ON cat_id = fin_cat_id
                          WHERE 1 ' . $list->sqlSearch() . $sql_phieuchi . $sql_date_out . '
                          ');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            LEFT JOIN categories_multi ON cat_id = fin_cat_id
                            WHERE 1 ' . $list->sqlSearch() . $sql_phieuchi . $sql_date_out . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' DESC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
//Vì đây là module cần 2 table listing nên khai báo thêm table_extra id=table-listing-right
$right_column .= $list->showHeader($total_row, '', 'id="table-listing-right"');
$i = 0;
while ($row = mysqli_fetch_assoc($db_listing->result)) {
    $i++;
Exemplo n.º 9
0
    if ($customer_report >= 0) {
        $And .= ' AND bii_customer_id = ' . $customer_report;
    }
    if ($user_report >= 0) {
        $And .= ' AND bii_staff_id = ' . $user_report;
    }
    if ($adm_user_report >= 0) {
        $And .= ' AND bii_admin_id = ' . $adm_user_report;
    }
} else {
    $time_order_field = 'bii_start_time';
    $And = 'AND ' . $time_order_field . ' >= ' . ($today - 2592000) . ' AND ' . $time_order_field . ' <= ' . $today;
}
$db_count = new db_count('SELECT count(*) as count
                                    FROM ' . $bg_table_i . ' 
                                    WHERE 1 ' . $list->sqlSearch() . $And . '
                                    ');
$total = $db_count->total;
unset($db_count);
$db_bill_in = new db_query("SELECT * FROM " . $bg_table_i . "\n                                    WHERE 1 " . $And . "\n                                    ORDER BY " . $time_order_field . " ASC\n                                    " . $list->limit($total) . " \n                                    ");
$total_bill_in = mysqli_num_rows($db_bill_in->result);
$right_column = $list->showHeader($total_bill_in);
$i = 0;
$total_fund = 0;
$date_money = array();
$aray = array();
$data = array();
while ($data_bill_in = mysqli_fetch_assoc($db_bill_in->result)) {
    $aray['id'] = $data_bill_in['bii_id'];
    $aray['date'] = $data_bill_in['bii_start_time'];
    $aray['money'] = $data_bill_in['bii_true_money'];
Exemplo n.º 10
0
         $right_column .= $list->end_tr();
     }
     $right_column .= $list->showFooter();
     echo $right_column;
     break;
 default:
     $group = (int) $group;
     if ($group) {
         #Bắt đầu với datagrid
         $list = new dataGrid($id_field, 30);
         $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 admin_users
                 WHERE adm_group_id = ' . $group . ' ' . $list->sqlSearch() . '
                 ');
         $total = $db_count->total;
         unset($db_count);
         $db_listing = new db_query('SELECT *
                 FROM admin_users
                 WHERE adm_group_id = ' . $group . '  ' . $list->sqlSearch() . '
                 ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' DESC
                 ' . $list->limit($total));
         $total_row = mysqli_num_rows($db_listing->result);
         $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>';
Exemplo n.º 11
0
 function fillerStockTransfer()
 {
     $right_column = '';
     //Hiển thị danh sách phiếu thu bên trái
     #Bắt đầu với datagird
     $list = new dataGrid('sto_id', 30);
     $list->add('', 'Số phiếu');
     $list->add('', 'Nhân viên chuyển');
     $list->add('', 'Ngày chuyển');
     $list->add('', 'Từ kho');
     $list->add('', 'Đến kho');
     // lấy biên từ form tìm kiếm theo ngày và nhân viên
     $start_date_in = getValue('start_date_in', 'str', 'POST', 0);
     $date_from = convertDateTime($start_date_in, '0:0:0');
     $end_date_in = getValue('end_date_in', 'str', 'POST', 0);
     $date_to = convertDateTime($end_date_in, '0:0:0');
     $staff_id = getValue('list_staff_id', 'int', 'POST', 0);
     if ($start_date_in && $end_date_in && $staff_id) {
         $search_sql = ' AND sto_time >=' . $date_from . ' AND sto_time <=' . $date_to . ' AND sto_staff_id = ' . $staff_id . ' ';
     } elseif ($staff_id) {
         $search_sql = ' AND sto_staff_id = ' . $staff_id . '';
     } elseif ($start_date_in && $end_date_in) {
         $search_sql = ' AND sto_time >=' . $date_from . ' AND sto_time <=' . $date_to . '';
     } else {
         $search_sql = '';
     }
     // slect list danh sách phiếu kiểm kê
     $db_count = new db_count('SELECT count(*) as count
                         FROM stock_transfer
                         WHERE 1 ' . $list->sqlSearch() . $search_sql . '
                         ');
     $total = $db_count->total;
     unset($db_count);
     $sql_query = 'SELECT *
                         FROM stock_transfer
                         WHERE 1 ' . $list->sqlSearch() . $search_sql . '
                         ORDER BY ' . $list->sqlSort() . ' sto_id DESC
                         ' . $list->limit($total);
     $db_listing = new db_query($sql_query);
     $total_row = mysqli_num_rows($db_listing->result);
     // tạo mảng để hiện thị tên nhân viên
     $staff_array = array();
     $db_staff = new db_query('SELECT * FROM users');
     while ($row_user = mysqli_fetch_assoc($db_staff->result)) {
         $staff_array[$row_user['use_id']] = $row_user['use_name'];
     }
     // tạo mảng để hiện thị kho hàng
     $store_array = array();
     $db_store = new db_query('SELECT * FROM categories_multi WHERE cat_type = "stores" ');
     while ($row_store = mysqli_fetch_assoc($db_store->result)) {
         $store_array[$row_store['cat_id']] = $row_store['cat_name'];
     }
     //Vì đây là module cần 2 table listing nên khai báo thêm table_extra id=table-listing-left
     $right_column .= $list->showHeader($total_row, '', 'id="table-listing-right"');
     $i = 0;
     while ($row = mysqli_fetch_assoc($db_listing->result)) {
         $i++;
         $right_column .= $list->start_tr($i, $row['sto_id'], 'class="menu-normal record-item" ondblclick="detail_stock_transfer(' . $row['sto_id'] . ')" dblclick="detail_record(' . $row['sto_id'] . ')" onclick="active_record(' . $row['sto_id'] . ')" data-record_id="' . $row['sto_id'] . '"');
         /* code something */
         //Số phiếu - ID phiếu
         $right_column .= '<td class="center" width="">' . format_codenumber($row['sto_id'], 6) . '</td>';
         //Người trả
         $right_column .= '<td width="120" class="center">' . $staff_array[$row['sto_staff_id']] . '</td>';
         //Mô tả
         $right_column .= '<td class="center">' . date('d/m/Y H:i', $row['sto_time']) . '</td>';
         //số tiền
         $right_column .= '<td width="120" class="text-left">' . $store_array[$row['sto_from_storeid']] . '</td>';
         $right_column .= '<td width="120" class="text-left">' . $store_array[$row['sto_to_storeid']] . '</td>';
         $right_column .= $list->end_tr();
     }
     $right_column .= $list->showFooter();
     $this->add($right_column);
 }
Exemplo n.º 12
0
$right_control = list_admin_control_button(1, 1, 1, 1);
#Bắt đầu với datagrid
$list = new dataGrid($id_field, 30);
$list->add('', 'Tài khoản');
$list->add('', 'Tên hiển thị');
$list->add('', 'Ghi chú');
//Biến group user
$group_user = getValue('group', 'int', 'POST', 0);
if ($group_user && $isAjaxRequest) {
    $sql_extra = ' AND adm_group_id = ' . $group_user . ' ';
} else {
    $sql_extra = '';
}
$db_count = new db_count('SELECT count(*) as count
                            FROM admin_users
                            WHERE 1 ' . $list->sqlSearch() . $sql_extra . '
                            ');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM admin_users
                            WHERE 1 ' . $list->sqlSearch() . $sql_extra . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$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>';
Exemplo n.º 13
0
$list->add('', 'Danh mục hỏi đáp');
$list->add('', 'Đối tượng');
$list->add('', 'Độ tuổi');
$list->add('', 'Theo mùa');
$list->add('', 'Truyền nhiễm');
$list->add('', 'Thường gặp');
$list->add('', 'Edit', 'edit');
$list->add('', 'Delete', 'delete');
$extra_search = '';
$cdi_parent_id = getValue('cdi_parent_id', 'int', 'GET', 0);
if ($cdi_parent_id) {
    $extra_search .= ' AND cdi_parent_id = ' . $cdi_parent_id;
}
$db_count = new db_count('SELECT count(*) as count
                            FROM ' . $bg_table . '
                            WHERE 1 ' . $list->sqlSearch() . $extra_search . '
                            ');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            WHERE 1 ' . $list->sqlSearch() . $extra_search . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$table_header = $list->showHeader($total_row);
$rainTpl->assign('table_header', $table_header);
$table_footer = $list->showFooter();
$rainTpl->assign('table_footer', $table_footer);
$table_listing = array();
$i = 0;
Exemplo n.º 14
0
 function reportProducts()
 {
     $array_return = array();
     //lấy các giá trị bắn ajax về để xuất báo cáo
     $array_product = getValue('products', 'arr', 'POST', '');
     if (!$array_product) {
         $array_return['content'] = 'Chưa chọn sản phẩm';
         die(json_encode($array_return));
     }
     $store_id = getValue('store_id', 'int', 'POST', 0);
     if (!$store_id) {
         $array_return['content'] = 'Chưa chọn kho hàng';
         die(json_encode($array_return));
     }
     $start_date = convertDateTime(getValue('start_date', 'str', 'POST', ''), '0:0:0');
     $end_date = convertDateTime(getValue('end_date', 'str', 'POST', ''), '0:0:0');
     // select ra báo cáo với các thông tin trên
     //lấy số lượng nhập hàng
     $arr_pro = array();
     foreach ($array_product as $product) {
         $arr_pro[] = $product;
     }
     $arr_pro = implode(',', $arr_pro);
     $left_column = '';
     //Hiển thị danh sách phiếu thu bên trái
     #Bắt đầu với datagird
     $list = new dataGrid('pro_id', 100);
     $list->add('', 'Tên mặt hàng');
     $list->add('', 'ĐVT');
     $list->add('', 'SL nhập');
     $list->add('', 'Tổng tiền tồn');
     // tảo mảng bill_id lọc theo thời gian và theo kho hàng
     $array_bill = array();
     $db_bill_out = new db_query('SELECT bio_id FROM bill_out WHERE bio_start_time >= ' . $start_date . '
                                  AND bio_start_time <=' . $end_date . ' AND bio_store_id = ' . $store_id . '');
     while ($row_bill_out = mysqli_fetch_assoc($db_bill_out->result)) {
         $array_bill[] = $row_bill_out['bio_id'];
     }
     unset($db_bill_out);
     $array_bill = implode(',', $array_bill);
     if ($array_bill == null) {
         $sql_search = ' AND bid_bill_id IN(0)';
     } else {
         $sql_search = ' AND bid_pro_id IN(' . $arr_pro . ') AND bid_bill_id IN(' . $array_bill . ')';
     }
     // select list danh
     $db_count = new db_count('SELECT count(*) as count
                         FROM bill_out_detail
                         WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                         GROUP BY bid_pro_id
                         ');
     $total = $db_count->total;
     unset($db_count);
     $sql_query = 'SELECT * FROM bill_out_detail
                         WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                         GROUP BY bid_pro_id
                         ORDER BY ' . $list->sqlSort() . ' bid_pro_id ASC
                         ' . $list->limit($total);
     $db_listing = new db_query($sql_query);
     $total_row = mysqli_num_rows($db_listing->result);
     //tao mang hien thi ten product
     $array_pro_name = array();
     $db_product = new db_query('SELECT pro_id,pro_name FROM products');
     while ($row_pro = mysqli_fetch_assoc($db_product->result)) {
         $array_pro_name[$row_pro['pro_id']] = $row_pro['pro_name'];
     }
     //Vì đây là module cần 2 table listing nên khai báo thêm table_extra id=table-listing-left
     $left_column .= $list->showHeader($total_row, '', 'id="table-listing-right"');
     $i = 0;
     $total_all = 0;
     while ($row = mysqli_fetch_assoc($db_listing->result)) {
         $i++;
         // lấy ra pro_unit_id để
         $db_query_unit = new db_query('SELECT pro_unit_id FROM products WHERE pro_id = ' . $row['bid_pro_id'] . ' ');
         $row_pro_unit = mysqli_fetch_assoc($db_query_unit->result);
         // lấy ra đơn vị tính của sản phẩm
         $db_unit_name = new db_query('SELECT uni_name FROM units WHERE uni_id = ' . $row_pro_unit['pro_unit_id'] . '');
         $row_unit = mysqli_fetch_assoc($db_unit_name->result);
         //tính tổng số lượng và giá tiền theo mặt hàng
         $db_price_ave = new db_query('SELECT SUM(bid_pro_price) AS total_price,
                                         SUM(bid_pro_number) AS total_number
                                         FROM bill_out_detail
                                         WHERE bid_pro_id = ' . $row['bid_pro_id'] . '');
         $row_total = mysqli_fetch_assoc($db_price_ave->result);
         $left_column .= $list->start_tr($i, $row['bid_pro_id'], 'class="menu-normal record-item" data-record_id="' . $row['bid_pro_id'] . '"');
         /* code something */
         $left_column .= '<td class="text-left">' . $array_pro_name[$row['bid_pro_id']] . '</td>';
         $left_column .= '<td width="100" class="center">' . $row_unit['uni_name'] . '</td>';
         $left_column .= '<td width="120" class="text-right">' . $row_total['total_number'] . '</td>';
         $left_column .= '<td width="120"  class="text-right">' . number_format($row_total['total_price']) . '</td>';
         // tổng tiền tất cả mặt hàng đã chọn
         $total_all += $row_total['total_number'] * $row_total['total_price'];
         $left_column .= $list->end_tr();
     }
     unset($db_count_price);
     unset($db_price_ave);
     unset($db_listing);
     unset($db_unit_name);
     unset($db_query_unit);
     $left_column .= $list->showFooter();
     $array_return['content'] = $left_column;
     $array_return['total'] = number_format($total_all);
     die(json_encode($array_return));
 }
Exemplo n.º 15
0
    }
    if ($end_date) {
        $sql_search .= ' AND bii_start_time <= ' . $end_date;
    }
    if ($store_id != 0) {
        $sql_search .= ' AND bii_store_id = ' . $store_id;
    }
    if ($admin_id != 0) {
        $sql_search .= ' AND bii_admin_id = ' . $admin_id;
    }
} else {
    $sql_search = ' AND bii_start_time >= ' . $start_today . ' AND bii_start_time <= ' . $end_today . '';
}
$db_count = new db_count('SELECT count(*) as count
                            FROM ' . $bg_table . '
                            WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                            ');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            WHERE 1 ' . $list->sqlSearch() . $sql_search . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' DESC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$content_column .= $list->showHeader($total_row);
/* Các biến tổng trong hóa đơn*/
$all_money_menus = 0;
$all_money_default = 0;
$all_money_real = 0;
$all_money_discount = 0;
Exemplo n.º 16
0
        $from_date = convertDateTime($from_date, '0:0:0');
        $And .= ' AND ' . $time_order_field . ' >= ' . $from_date;
    }
    if ($to_date != '') {
        $to_date = convertDateTime($to_date, '0:0:0') + 86400 - 1;
        $And .= ' AND ' . $time_order_field . ' <= ' . $to_date;
    }
    if ($adm_user_report > 0) {
        $And .= ' AND fin_admin_id = ' . $adm_user_report;
    }
} else {
    $And = 'AND ' . $time_order_field . ' >= ' . ($today - 2592000) . ' AND ' . $time_order_field . ' <= ' . $today;
}
$db_count = new db_count('SELECT count(*) as count
                                    FROM ' . $bg_financial . ' 
                                    WHERE 1 ' . $list->sqlSearch() . $And . ' 
                                    AND fin_cat_id IN (' . FINANCIAL_CAT_NHAP_HANG . ', ' . FINANCIAL_CAT_CONG_NO_NHAP_HANG . ')');
$total = $db_count->total;
unset($db_count);
$db_financial_bill_out = new db_query("SELECT * FROM " . $bg_financial . "\n                                            WHERE 1 " . $list->sqlSearch() . $And . " \n                                            AND fin_cat_id IN(" . FINANCIAL_CAT_NHAP_HANG . ", " . FINANCIAL_CAT_CONG_NO_NHAP_HANG . ")\n                                            ORDER BY " . $time_order_field . " ASC\n                                            " . $list->limit($total) . " \n                                            ");
$total_financial_bill_out = mysqli_num_rows($db_financial_bill_out->result);
$right_column = $list->showHeader($total_financial_bill_out);
$i = 0;
$total_fund = 0;
$data_financial_bill_out = array();
$compare_dates = array();
$arrDate = array();
while ($data_financial = mysqli_fetch_assoc($db_financial_bill_out->result)) {
    $arrDate['cash'] = 0;
    $arrDate['card'] = 0;
    $date = gmdate("d/m/Y", $data_financial['fin_updated_time']);
Exemplo n.º 17
0
$rainTpl->assign('load_header', $load_header);
$rainTpl->assign('module_name', $module_name);
#Bắt đầu với datagrid
$list = new dataGrid($id_field, 30);
#something config for list dataGrid
/**
 * $list->add('')...etc
 *
 */
$list->add('dic_key', 'Nội dung', 'string', 1, 0);
$list->add('dic_translate_en', 'Bản dịch', 'string');
$list->add('', 'Edit', 'edit');
$list->add('', 'Delete', 'delete');
$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 . ' DESC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$table_header = $list->showHeader($total_row);
$rainTpl->assign('table_header', $table_header);
$table_footer = $list->showFooter();
$rainTpl->assign('table_footer', $table_footer);
$table_listing = array();
$i = 0;
Exemplo n.º 18
0
$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);
//Hiển thị danh sách lý do thu chi
$list = new dataGrid('cat_id', 30);
$list->add('', 'Mô tả');
$db_count = new db_count('SELECT count(*) as count
                          FROM ' . $bg_table . '
                          WHERE cat_type = "' . $cat_type_in . '" OR cat_type = "' . $cat_type_out . '"');
$total = $db_count->total;
unset($db_count);
$db_listing = new db_query('SELECT *
                            FROM ' . $bg_table . '
                            WHERE 1 AND cat_type = "' . $cat_type_in . '" OR cat_type = "' . $cat_type_out . '" ' . $list->sqlSearch() . '
                            ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC
                            ' . $list->limit($total));
$total_row = mysqli_num_rows($db_listing->result);
$left_column .= $list->showHeader($total_row);
$i = 0;
while ($row = mysqli_fetch_assoc($db_listing->result)) {
    $i++;
    $left_column .= $list->start_tr($i, $row['cat_id'], 'class="menu-normal record-item" onclick="active_record(' . $row['cat_id'] . ')" data-record_id="' . $row['cat_id'] . '"');
    $left_column .= '<td>' . $row['cat_name'] . '</td>';
}
$left_column .= $list->showFooter();
$rainTpl = new RainTPL();
$rainTpl->assign('load_header', $load_header);
$rainTpl->assign('module_name', $module_name);
$rainTpl->assign('error_msg', print_error_msg($bg_errorMsg));