<?php $base_url = base_url(); $head = array(array('text' => lang('delay_times'), 'sort_key' => 'delay_times', 'id' => 'order_list'), array('text' => lang('item_information'), 'sort_key' => 'item_no'), array('text' => lang('product_information'), 'sort_key' => 'sku_str'), array('text' => lang('customer_information'), 'sort_key' => 'name'), array('text' => lang('input_date'), 'sort_key' => 'input_date'), array('text' => lang('stocker'), 'sort_key' => 'stock_user_id'), $head[] = lang('options')); if (!isset($all_stock_user_ids)) { $all_stock_user_ids = array(); $stock_user_id = -1; } $data = array(); $force_change_url = site_url('shipping/deliver_management/force_change'); $product_names = array(); foreach ($orders as $order) { $row = array(); $readable_time = secs_to_readable($order->delay_times); $row[] = $readable_time['days'] . lang('day') . $readable_time['hours'] . lang('hour'); $item_info = <<<ITEM <div style='padding: 10px;'> {$order->item_no}<br/> </div> ITEM; $row[] = $item_info; $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $count = count($skus); $item_sku_html = ''; for ($i = 0; $i < $count; $i++) { if (isset($product_names[$skus[$i]])) { $product_name = $product_names[$skus[$i]]; } else { $product_name = get_product_name($skus[$i]); $product_names[$skus[$i]] = $product_name;
foreach ($sale_orders as $sale_order) { $item_html = '<div style="margin: 5px;">'; $item_html .= lang('order_id') . ' : ' . $sale_order->item_no . '<br>'; $item_html .= lang('item_id') . ' : ' . $sale_order->item_id_str . '<br>'; $skus = explode(',', $sale_order->sku_str); $qtys = explode(',', $sale_order->qty_str); $skus_count = count($skus); for ($i = 0; $i < $skus_count; $i++) { $item_html .= 'SKU : ' . $skus[$i] . ' ' . 'Qty: ' . $qtys[$i] . '<br>'; } $item_html .= lang('address_line_1') . ' : ' . $sale_order->address_line_1 . '<br>'; $item_html .= lang('address_line_2') . ' : ' . $sale_order->address_line_2 . '<br>'; $item_html .= lang('weight') . ' : ' . $sale_order->ship_weight . '<br>'; $item_html .= lang('track_number') . ' : ' . $sale_order->track_number . '<br>'; $item_html .= '</div>'; $delay_time = secs_to_readable($sale_order->delay_times); $data[] = array(isset($sale_order) ? $sale_order->submit_date : '', $delay_time['days'] . lang('day') . $delay_time['hours'] . lang('hour'), $item_html, $sale_order->gross, $sale_order->submit_remark, $sale_order->answer_remark, $this->block->generate_div("state_{$sale_order->id}", empty($sale_order->state) ? lang('select') : lang($sale_order->state))); echo $this->block->generate_editor("state_{$sale_order->id}", 'sale_orders_form', $sale_order_url, "{id: {$sale_order->id}, type: 'state'}", "{$collection}"); } $options[''] = lang('all'); $options['have_to_wait_for_the_result'] = lang('have_to_wait_for_the_result'); $options['determined_through_a'] = lang('determined_through_a'); $options['sure_is_lost'] = lang('sure_is_lost'); $options['obtain_compensation'] = lang('obtain_compensation'); $options['not_handled'] = lang('not_handled'); $options['closed'] = lang('closed'); $title = lang('order_check_manage'); $filters = array(array('type' => 'input', 'field' => 'submit_date'), NULL, array('type' => 'input', 'field' => 'item_no|track_number'), array('type' => 'input', 'field' => 'gross'), array('type' => 'input', 'field' => 'submit_remark'), array('type' => 'input', 'field' => 'answer_remark'), array('type' => 'dropdown', 'field' => 'state', 'options' => $options, 'method' => '=')); echo block_header($title); echo form_open(); echo $this->block->generate_pagination('sale_orders_check');
function fetch_wait_for_holded_orders() { $CI =& get_instance(); $CI->load->model('order_model'); $user = get_current_login_name(); $type = array('holded'); $orders = $CI->order_model->fetch_default_orders($user, $type); $url = site_url('order/regular_order/confirm_order'); $head = array(lang('delay_times'), lang('order_number'), lang('name_en'), lang('town_city_en'), lang('state_province_en'), lang('country_en'), lang('postal_code_en'), lang('address_en'), lang('product_information') . anchor($url, lang('add_more'), array('style' => 'float:right;'))); $data = array(); foreach ($orders as $order) { $row = array(); $readable_time = secs_to_readable($order->delay_times); $row[] = $readable_time['days'] . lang('day') . '<br/>' . $readable_time['hours'] . lang('hour'); $row[] = $order->item_no; $buyer_id = empty($order->buyer_id) ? '' : "({$order->buyer_id})"; $row[] = $order->name . '<br/>' . $buyer_id; $row[] = $order->address_line_1 . '<br/>' . $order->address_line_2; $row[] = $order->town_city; $row[] = $order->state_province; $row[] = $order->country; $row[] = $order->zip_code; $row[] = $order->item_title_str; $data[] = $row; } return array($head, $data); }
{$lang_town_city} :{$order->town_city}<br/> {$lang_state_province} : {$order->state_province}<br/> {$lang_countries} :{$order->country}<br/> {$lang_zip_code} : {$order->zip_code}<br/> {$phone} </div> ITEM; $readable_time = 0; if ($order_status == 9) { $readable_time = secs_to_readable($order->delay_times); } else { if ($order_status == 6) { $readable_time = secs_to_readable($order->purchase_delay_times); } else { if ($order_status == 2) { $readable_time = secs_to_readable($order->wait_confirmation_delay_times); } } } $row[] = $readable_time['days'] . lang('day') . '<br/>' . $readable_time['hours'] . lang('hour'); $row[] = $item_info; $item_ids = explode(',', $order->item_id_str); $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $count = count($skus); $item_sku_html = ''; $product_name = ''; $item_sku_html .= "<div id='item_div_{$order->id}'>"; for ($i = 0; $i < $count; $i++) { $item_id = element($i, $item_ids); if (strlen($item_id) == 12) {
public function fetch_statistics($begin_time = NULL, $end_time = NULL, $priority = 1, $purchaser_id = NULL) { $sql = <<<SQL (UNIX_TIMESTAMP(ship_confirm_date) - UNIX_TIMESTAMP(check_date)) as delay_times, sku_str, qty_str, item_no, sys_remark, purchaser_id_str SQL; $this->db->select($sql); $this->db->from('order_list_completed'); $this->db->where('ship_confirm_date >=', $begin_time); $this->db->where('ship_confirm_date <=', $end_time); $this->db->where('check_date !=', ''); $query = $this->db->get(); $result = $query->result(); $this->db->select($sql); $this->db->from('order_list'); $this->db->where('ship_confirm_date >=', $begin_time); $this->db->where('ship_confirm_date <=', $end_time); $this->db->where('check_date !=', ''); $query = $this->db->get(); $result = array_merge($result, $query->result()); $current_user_id = get_current_user_id(); $statistics = array(); $purchaser_skus = array(); $item_nos = array(); $user_name_map = array(); foreach ($result as $row) { $skus = explode(',', $row->sku_str); $qties = explode(',', $row->qty_str); $purchaser_ids = explode(',', $row->purchaser_id_str); $i = 0; $not_put = array(); foreach ($skus as $sku) { if (empty($purchaser_ids[$i])) { continue; } $tmp_purchaser_id = $purchaser_ids[$i]; if ($priority > 1) { if ($purchaser_id > 0 && $tmp_purchaser_id != $purchaser_id) { continue; } } else { if ($current_user_id != $tmp_purchaser_id) { continue; } } if (!isset($statistics[$tmp_purchaser_id])) { $statistics[$tmp_purchaser_id] = array(); } $readable = secs_to_readable($row->delay_times); $days = $readable['days']; // count once even if there are more products for one purchaser if (!isset($not_put[$tmp_purchaser_id])) { if ($days > 15) { $days = 15; } if (!isset($statistics[$tmp_purchaser_id]['delay_times'])) { $statistics[$tmp_purchaser_id]['delay_times'] = array(); } if (!isset($statistics[$tmp_purchaser_id]['delay_times'][$days])) { $statistics[$tmp_purchaser_id]['delay_times'][$days] = 0; } $statistics[$tmp_purchaser_id]['delay_times'][$days]++; $not_put[$tmp_purchaser_id] = TRUE; if ($days > 2) { if (isset($user_name_map[$tmp_purchaser_id])) { $user_name = $user_name_map[$tmp_purchaser_id]; } else { $user_name = fetch_user_name_by_id($tmp_purchaser_id); $user_name_map[$tmp_purchaser_id] = $user_name; } $item_nos[] = array($user_name, $days, $row->item_no, $row->sku_str, $row->sys_remark); } } if (!isset($statistics[$tmp_purchaser_id]['skus'])) { $statistics[$tmp_purchaser_id]['skus'] = $qties[$i]; } else { $statistics[$tmp_purchaser_id]['skus'] += $qties[$i]; } $i++; } } $key = 'purchase_statistics_item_nos'; if ($purchaser_id) { $key = 'purchase_statistics_item_nos_' . $purchaser_id; } else { if ($priority == 1) { $key = 'purchase_statistics_item_nos_' . $current_user_id; } } $this->cache->file->save($key, $item_nos, 60 * 60 * 24 * 30); // 30 days return $statistics; }
$skus_count = count($skus); for ($i = 0; $i < $skus_count; $i++) { $item_html .= 'SKU : ' . $skus[$i] . ' ' . ' * ' . $qtys[$i] . ' (' . get_product_name($skus[$i]) . ')' . '<br>'; } $item_html .= lang('address_line_1') . ' : ' . $shipping_order->address_line_1 . '<br>'; $item_html .= lang('address_line_2') . ' : ' . $shipping_order->address_line_2 . '<br>'; $item_html .= lang('weight') . ' : ' . $shipping_order->ship_weight . '<br>'; $item_html .= lang('track_number') . ' : ' . $shipping_order->track_number . '<br>'; $item_html .= '</div>'; $detal_html = '<div style="margin: 5px;">'; $detal_html .= lang('customer_name') . ' : ' . $shipping_order->name . '<br>'; $detal_html .= lang('zip_code') . ' : ' . $shipping_order->zip_code . '<br>'; $detal_html .= lang('telephone') . ' : ' . $shipping_order->contact_phone_number . '<br>'; $detal_html .= lang('shipping_time') . ' : ' . $shipping_order->ship_confirm_date . '<br>'; $detal_html .= '</div>'; $delay_time = secs_to_readable($shipping_order->delay_times); $which_table = $this->order_check_model->check_exists('order_list', array('id' => $shipping_order->id, 'transaction_id' => $shipping_order->transaction_id)); // $table_order_id = ($which_table > 0) ? 'o_l_' . $shipping_order->id : 'o_l_c_' . $shipping_order->id; $data[] = array($this->block->generate_select_checkbox($shipping_order->id), isset($shipping_order) ? $shipping_order->submit_date : '', $delay_time['days'] . lang('day') . $delay_time['hours'] . lang('hour'), $item_html, $shipping_order->gross, $detal_html, $this->block->generate_div("state_{$shipping_order->id}", empty($shipping_order->state) ? lang('select') : lang($shipping_order->state)), $shipping_order->submit_remark, $this->block->generate_div("answer_remark_{$shipping_order->id}", empty($shipping_order->answer_remark) ? '[edit]' : $shipping_order->answer_remark)); echo $this->block->generate_editor("answer_remark_{$shipping_order->id}", 'shipping_orders_form', $shipping_order_url, "{id: {$shipping_order->id}, type: 'answer_remark'}"); echo $this->block->generate_editor("state_{$shipping_order->id}", 'shipping_orders_form', $shipping_order_url, "{id: {$shipping_order->id}, type: 'state'}", "{$collection}"); } $title = lang('order_check_manage'); $options[''] = lang('all'); $options['have_to_wait_for_the_result'] = lang('have_to_wait_for_the_result'); $options['determined_through_a'] = lang('determined_through_a'); $options['sure_is_lost'] = lang('sure_is_lost'); $options['obtain_compensation'] = lang('obtain_compensation'); $options['not_handled'] = lang('not_handled'); $options['closed'] = lang('closed'); $filters = array(NULL, array('type' => 'input', 'field' => 'submit_date'), NULL, array('type' => 'input', 'field' => 'item_no|track_number'), array('type' => 'input', 'field' => 'gross'), array('type' => 'input', 'field' => 'name|zip_code|contact_phone_number|transaction_id'), array('type' => 'dropdown', 'field' => 'state', 'options' => $options, 'method' => '='), array('type' => 'input', 'field' => 'order_check_list.submit_remark'), array('type' => 'input', 'field' => 'order_check_list.answer_remark'));
if ($action == 'edit') { $edit_button = $this->block->generate_edit_link(site_url('myinfo/myaccount/expire_day_edit', array($user->id))); $url = $edit_button; } else { $url = $this->block->generate_view_link(site_url('myinfo/myacount/expire_day_view', array($user->id))); } $birthday_cur = substr($user->birthday, 5); $birthday_cur_time = date("Y") . "-" . $birthday_cur; $birthday_com_time = strtotime($birthday_cur_time) - mktime(); $contract_com_time = strtotime($user->contrct_time) - mktime(); $trial_com_time = strtotime($user->trial_end_time) - mktime(); $contract_times = secs_to_readable($contract_com_time); $contract_day = $contract_times['days']; $probation_times = secs_to_readable($trial_com_time); $probation_day = $probation_times['days']; $birthday_times = secs_to_readable($birthday_com_time); $birthday_day = $birthday_times['days']; if ($contract_day < $contract_time && $contract_day > 0 || $probation_day < $probation_time && $probation_day > 0 || $birthday_day < $birthday && $birthday_day > 0) { $data[] = array($user->name, $contract_day . lang('day'), $probation_day . lang('day'), $birthday_day . lang('day')); } } $title = lang('coming_day_info_manage'); echo block_header($title); $filters = array(array('type' => 'input', 'field' => 'name'), array('type' => 'input', 'field' => 'contrct_time'), array('type' => 'input', 'field' => 'trial_end_time'), array('type' => 'input', 'field' => 'QQ')); echo $this->block->generate_pagination('user'); $config = array('filters' => $filters); echo form_open(); echo $this->block->generate_reset_search($config); echo $this->block->generate_table($head, $data, $filters, 'user'); echo $this->block->generate_pagination('user'); echo form_close();