}
if (!empty($_SESSION['cb']['start_date'])) {
    $where[] = 'new_cust_inventory.created_date >= ' . "'" . $_SESSION['cb']['start_date'] . "'";
}
if (!empty($_SESSION['cb']['end_date'])) {
    $where[] = 'new_cust_inventory.created_date <= ' . "'" . $_SESSION['cb']['end_date'] . "'";
}
$where[] = 'status <> 0';
$sql .= ' where ' . implode(' and ', $where);
$sql .= ' group by `bill_id` order by `bill_id` DESC ';
// ***** Pagination Work Start ******
$pageSql = $sql;
$pageResult = mysqli_query($con, $pageSql);
$count = $pageResult->num_rows;
if ($pageResult && $count > 0) {
    $paginationCount = DhsHelper::getPagination($count);
}
// ***** Pagination Work End ******
if (isset($_GET['page_id']) && !empty($_GET['page_id'])) {
    $page_id = $_GET['page_id'];
} else {
    $page_id = '0';
}
$pageLimit = PAGE_PER_NO * $page_id;
$sql .= " limit {$pageLimit}," . PAGE_PER_NO;
$result = mysqli_query($con, $sql);
$n = 0;
$total = 0;
while ($record = mysqli_fetch_array($result)) {
    $n++;
    $total += $record['total'];