</p> </div> <div class="fl half clearfix"> <p class='p-infoformat fl'> <label class='label-infoformat fl'>Order Date: </label>  <?php echo $bt->bsd_timestamp; ?> </p> </div> <?php } ?> <div class="fl half clearfix"> <p class='p-infoformat fl'> <label class='label-infoformat fl'>Order Status: </label>   <?php echo apputils::orderStatus($bt->bsd_status); ?> <?php if ($bt->bsd_status == -1 || $bt->bsd_status == -4) { echo ": " . $bt->bsd_reason; } ?> </p> </div> </div> </div> <div class='right-inner clearfix'>
function lists() { $data['feat_categories'] = $this->categories->listings(0); //main categories if ($this->session->userdata('is_login') == TRUE) { $action = $this->input->post('action'); $user_type = $this->session->userdata('type'); //get user type; if ($action != '') { if ($action == 'request') { if ($user_type == 2) { $supplierId = $this->session->userdata('id'); $page = (int) $this->input->get('page'); $page = $page > 0 ? $page : 1; $sort_by = $this->input->post('sort_by'); $sort_direction = $this->input->post('sort_direction'); $sort_direction = $sort_direction != '' ? $sort_direction : 'desc'; $sort_by = $sort_by != '' ? $sort_by : 'bt_time'; /*$data['statuses'] = array( '' => 'All', '0' => 'Pending/Buyer Approved Shipping Fee', '-2' => "Pending buyer's consent for new shipping fees", '-1' => 'Cancelled Order', '-4' => 'Return Order', '-3' => 'Refund Order', '1' => 'Shipped', '2' => 'Completed' );*/ $data['statuses'] = array_merge(array('' => 'All'), apputils::orderStatus()); //filters $name = $this->input->post('name'); $sku = $this->input->post('sku'); $start = $this->input->post('start'); $end = $this->input->post('end'); $stat = $this->input->post('stat'); $invoice_id = $this->input->post('invoice_id'); $rowsCount = count($this->suppliers->shipping_list_grouped($supplierId, '', $name, $invoice_id, $start, $end, $stat, '', 25, $sort_by, $sort_direction)); $items = $this->suppliers->shipping_list_grouped($supplierId, '', $name, $invoice_id, $start, $end, $stat, $page, 25, $sort_by, $sort_direction); foreach ($items as $k => $item) { $item->bsd_status = apputils::orderStatus($item->bsd_status); if ($sku != '') { $btd = $this->suppliers->transaction_detail($supplierId, $item->bsd_id); $sku_list = array(); foreach ($btd as $btd_item) { $sku_list[] = $btd_item->SKU; } $item->sku = implode(',', $sku_list); if (preg_match('/^.*' . $sku . '.*$/', $item->sku) == 0) { unset($items[$k]); } } $item->bt_total_sum = number_format($item->bt_total_sum, 2); } $filters_data['filters'] = array('name' => array('title' => "Buyer's Name", 'value' => $name), 'invoice_id' => array('title' => "Invoice Id", 'value' => $invoice_id), 'sku' => array('title' => "Ordered SKU", 'value' => $sku), 'start' => array('title' => 'From', 'value' => $start, 'type' => 'datepicker'), 'end' => array('title' => 'To', 'value' => $end, 'type' => 'datepicker'), 'stat' => array('title' => 'Status', 'value' => $stat, 'type' => 'select', 'opts' => $data['statuses'])); $data['items'] = $items; $data['columns'] = array('bt_time' => array('title' => 'Date', 'sortable' => true), 'bt_invoice' => array('title' => 'Invoice ID', 'sortable' => true), 'u_username' => array('title' => 'Username', 'sortable' => true), 'c_code' => array('title' => 'Country', 'sortable' => true), 'bsd_total_item' => array('title' => 'Total Items', 'sortable' => true), 'bt_total_sum' => array('title' => 'Sum', 'sortable' => true), 'bsd_status' => array('title' => 'Status', 'sortable' => true), 'actions' => array('title' => 'Action', 'sortable' => false, 'items' => array('view' => array('link' => '/supplier/order/', 'text' => 'Order Detail', 'confirm' => false, 'pk' => 'bsd_id')))); $data['sorter']['by'] = $sort_by; $data['sorter']['dir'] = $sort_direction; $config['base_url'] = '/shipping/lists?'; $config['total_rows'] = $rowsCount; $config['per_page'] = 25; $config['cur_page'] = $page; $config['use_page_numbers'] = true; $config['first_link'] = '<<'; $config['last_link'] = '>>'; $config['num_links'] = 3; $config['page_query_string'] = true; $config['query_string_segment'] = 'page'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li><a href="javascript:void(0);" style="color: #000;">'; $config['cur_tag_close'] = '</a></li>'; $this->pagination->initialize($config); $pages = array(); $pages['links'] = $this->pagination->create_links(); $pages['totals'] = ceil($rowsCount / 25); $pages['cur_page'] = $page; $this->load->view('tools/filters', $filters_data); $this->load->view('tools/table', $data); $this->load->view('tools/pagination', $pages); } if ($user_type == 3) { $buyerId = $this->session->userdata('id'); // $sort_by = $this->input->post('sort_by'); /* $data['statuses'] = array( '' => 'All', '0' => 'Pending/Buyer Approved Shipping Fee', '-2' => "Pending buyer's consent for new shipping fees", '-1' => 'Cancelled Order', '-4' => 'Return Order', '-3' => 'Refund Order', '1' => 'Shipped', '2' => 'Completed' );*/ $data['statuses'] = array_merge(array('' => 'All'), apputils::orderStatus()); $page = (int) $this->input->get('page'); $page = $page > 0 ? $page : 1; $sort_by = $this->input->post('sort_by'); $sort_direction = $this->input->post('sort_direction'); $sort_direction = $sort_direction != '' ? $sort_direction : 'desc'; $sort_by = $sort_by != '' ? $sort_by : 'bt_time'; //filters $name = $this->input->post('name'); $start = $this->input->post('start'); $end = $this->input->post('end'); $stat = $this->input->post('stat'); $rowsCount = count($this->buyers->shipping_list_grouped($buyerId, '', $name, $start, $end, $stat, '', 10, $sort_by, $sort_direction)); $items = $this->buyers->shipping_list_grouped($buyerId, '', $name, $start, $end, $stat, $page, 10, $sort_by, $sort_direction); foreach ($items as $item) { $item->bsd_status = apputils::orderStatus($item->bsd_status); $item->bt_total_sum = number_format($item->bt_total_sum, 2); } //$html = $this->load->view('supplier/supplier-search-shipping-result',$data,true); //echo $html; $filters_data['filters'] = array('name' => array('title' => "Company/Supplier's Name", 'value' => $name), 'start' => array('title' => 'From', 'value' => $start, 'type' => 'datepicker'), 'end' => array('title' => 'To', 'value' => $end, 'type' => 'datepicker'), 'stat' => array('title' => 'Status', 'value' => $stat, 'type' => 'select', 'opts' => $data['statuses'])); $data['items'] = $items; $data['columns'] = array('bt_time' => array('title' => 'Date', 'sortable' => true), 'bt_invoice' => array('title' => 'Invoice ID', 'sortable' => true), 'u_company' => array('title' => 'Company Name', 'sortable' => true), 'c_code' => array('title' => 'Country', 'sortable' => true), 'bsd_total_item' => array('title' => 'Total Items', 'sortable' => true), 'total_sum' => array('title' => 'Sum', 'sortable' => true, 'format' => "\$%01.2f"), 'bsd_status' => array('title' => 'Status', 'sortable' => true), 'actions' => array('title' => 'Action', 'sortable' => false, 'items' => array('view' => array('link' => '/buyer/order/', 'text' => 'Order Detail', 'confirm' => false, 'pk' => 'bsd_id')))); $data['sorter']['by'] = $sort_by; $data['sorter']['dir'] = $sort_direction; $config['base_url'] = '/shipping/lists?'; $config['total_rows'] = $rowsCount; $config['per_page'] = 10; $config['cur_page'] = $page; $config['use_page_numbers'] = true; $config['first_link'] = '<<'; $config['last_link'] = '>>'; $config['num_links'] = 3; $config['page_query_string'] = true; $config['query_string_segment'] = 'page'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li><a href="javascript:void(0);" style="color: #000;">'; $config['cur_tag_close'] = '</a></li>'; $this->pagination->initialize($config); $pages = array(); $pages['links'] = $this->pagination->create_links(); $pages['totals'] = ceil($rowsCount / 10); $pages['cur_page'] = $page; $this->load->view('tools/filters', $filters_data); $this->load->view('tools/table', $data); $this->load->view('tools/pagination', $pages); } } } else { if ($user_type == 2) { $this->load->view('supplier/supplier-shipping-list', $data); } elseif ($user_type == 3) { $this->load->view('buyer/buyer-transactions-request', $data); } } } }