public function proccess_update_password() { $old_password = $this->input->post('old_password'); $is_old_password_correct = $this->user_model->verify_user(get_current_login_name(), $old_password); if (!$is_old_password_correct) { echo $this->create_json(0, lang('old_password_incorrect')); return; } $rules = array(array('field' => 'password', 'label' => lang('password'), 'rules' => 'trim|required|matches[confirm_password]|min_length[8]'), array('field' => 'confirm_password', 'label' => lang('confirm_password'), 'rules' => 'trim|required')); $this->form_validation->set_rules($rules); if ($this->form_validation->run() == FALSE) { $error = validation_errors(); echo $this->create_json(0, $error); return; } $password = md5(trim($this->input->post('password'))); $user_id = get_current_user_id(); try { $this->user_model->update_user($user_id, 'password', $password); } catch (Exception $exc) { echo lang('error_msg'); $this->ajax_failed(); } echo $this->create_json(1, lang('ok')); }
public function instant_save_recommend_order() { $id = $this->input->post('id'); $type = $this->input->post('type'); $value = trim($this->input->post('value')); try { $user_name = get_current_login_name(); $this->quality_testing_model->instant_save_order($id, $type, $value, $user_name); if ($type == 'status' || $type == 'cause' || $type == 'finish_status') { $value = lang($value); } echo $this->create_json(1, lang('ok'), $value); } catch (Exception $e) { $this->ajax_failed(); echo lang('error_msg'); } }
public function fetch_all_view_orders_count($order_table, $all_order, $paypal_emails, $is_register = FALSE) { $this->db->from($order_table); if (!$all_order) { if (count($paypal_emails)) { $this->db->where_in('(to_email', $paypal_emails); $this->db->or_where('input_user = "******")'); } else { $this->db->where(array('input_user' => get_current_login_name())); } } if ($is_register) { if (!is_array($is_register)) { $type = array($is_register); } $this->db->where_in('is_register', $is_register); } $this->set_where('order'); return $this->db->count_all_results(); }
function approved_resending_orders() { $CI =& get_instance(); $CI->load->model('order_model'); $login_name = get_current_login_name(); $type = array('not_received_approved_resending', 'received_approved_resending'); $orders = $CI->order_model->fetch_default_orders($login_name, $type); $url = site_url('order/regular_order/view_order'); $head = array(lang('item_information'), lang('product_information'), lang('gathering_transaction_remark'), lang('shipping_info'), lang('order_status'), lang('import_date') . anchor($url, lang('add_more'), array('style' => 'float:right;'))); $data = array(); $ebay_url = 'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item='; $statuses = fetch_statuses('order_status'); $purchasers = array(); foreach ($orders as $order) { $row = array(); $gross = empty($order->gross) ? $order->net : $order->gross; $rmb = price($CI->order_model->calc_currency($order->currency, $gross)); $lang_name = lang('name_en'); $lang_address = lang('address_en'); $lang_town_city = lang('town_city_en'); $lang_state_province = lang('state_province_en'); $lang_countries = lang('country_en'); $lang_zip_code = lang('postal_code_en'); $name = $order->name . (empty($order->buyer_id) ? '' : "({$order->buyer_id})"); $phone = ''; if (!empty($order->contact_phone_number)) { $phone = lang('phone') . ':'; $phone .= $order->contact_phone_number; } $item_info = <<<ITEM <div style='padding: 10px;'> {$order->item_no}<br/> {$lang_name} : {$name} <br/> {$lang_address} : {$order->address_line_1} {$order->address_line_2}<br/> {$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; $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) { $link = '<a target="_blank" href="' . $ebay_url . $item_id . '">' . $item_id . '</a>'; } else { $link = $item_id; } $item_sku_html .= '<div style="margin-top: 5px;">'; if ($item_id) { $item_sku_html .= "Item ID: {$link}<br/>"; } $purchaser_name = ''; if (isset($purchasers[$skus[$i]])) { $purchaser_name = $purchasers[$skus[$i]]; } else { $purchaser_name = get_purchaser_name_by_sku($skus[$i]); $purchasers[$skus[$i]] = $purchaser_name; } $item_sku_html .= ' SKU: ' . (isset($skus[$i]) ? $skus[$i] . ' * ' . element($i, $qties) . ' (' . get_product_name($skus[$i]) . ')' : '') . ' ' . $purchaser_name . '<br/>'; $item_sku_html .= '</div>'; } $item_sku_html .= '</div>'; $shipping_type = lang('shipping_way') . ': '; $shipping_type .= $order->is_register; $item_title_str = str_replace(',', '<br/>', $order->item_title_str); $product_info = <<<PRODUCT <div style='padding: 10px;'> {$item_title_str}<br/> {$item_sku_html} </div> PRODUCT; $status_name = $CI->order_model->fetch_status_name('order_status', $order->order_status); $order_status_arr = array('not_received_apply_for_partial_refund', 'not_received_apply_for_full_refund', 'received_apply_for_partial_refund', 'received_apply_for_full_refund', 'not_received_apply_for_resending', 'received_apply_for_resending'); if (isset($power) && $power >= 2 && in_array($status_name, $order_status_arr)) { $anchor = anchor(site_url('order/special_order/view_return_order', array($order->item_no, 'auditing')), lang('pending') . '>>'); } $make_pi_html = ''; if (true) { $anchor = anchor(site_url('order/special_order/view_return_order', array($order->item_no)), lang('make_pi') . '>>'); $make_pi_html = form_label($anchor); $make_pi_html .= '<br/>'; } $status_nrar = $CI->order_model->fetch_status_id('order_status', 'not_received_approved_resending'); $status_rar = $CI->order_model->fetch_status_id('order_status', 'received_approved_resending'); if ($order->order_status == $status_nrar || $order->order_status == $status_rar) { $anchor = anchor(site_url('order/special_order/again', array($order->item_no)), lang('again') . '>>'); } $row[] = $product_info; $lang_remark = lang('remark'); $other_info = <<<OTHER {$order->currency}: {$gross}, RMB : {$rmb}<br/><br/> {$order->transaction_id} <br/><br/> {$order->track_number} OTHER; $row[] = $other_info; $lang_confirm_date = lang('ship_confirm_date'); $lang_weight = lang('weight') . '(g)'; $lang_confirm_user = lang('ship_confirm_user'); $lang_ship_remark = lang('ship_remark'); $lang_receive_date = lang('receive_date'); $lang_sys_remark = lang('sys_remark'); $ship_info = <<<SHIP {$lang_confirm_date} : {$order->ship_confirm_date} <br/> {$lang_weight} : {$order->ship_weight} <br/> {$lang_confirm_user} : {$order->ship_confirm_user} <br/> {$lang_ship_remark} : {$order->ship_remark} <br/> | {$order->descript} <br/> {$lang_receive_date} : {$order->order_receive_date} <br/> <abbr title="{$order->sys_remark}">{$lang_sys_remark}</abbr> SHIP; $row[] = $ship_info; $row[] = lang(element($order->order_status, $statuses)) . '<br/><br/>'; $row[] = $order->input_date; $data[] = $row; } // echo 'hello'; die(); return array($head, $data); }
public function seccuss_or_failure() { $rules = array(array('field' => 'case_id', 'label' => lang('case_id'), 'rules' => 'trim|required'), array('field' => 'case_no', 'label' => lang('case_no'), 'rules' => 'trim|required|is_natural'), array('field' => 'declared_name[]', 'label' => lang('declared_name'), 'rules' => 'trim|required'), array('field' => 'declared_price[]', 'label' => lang('declared_price'), 'rules' => 'trim|required')); $this->form_validation->set_rules($rules); if ($this->form_validation->run() == FALSE) { $error = validation_errors(); echo $this->create_json(0, $error); return; } $sku_arr = $this->input->post('sku'); $qty_arr = $this->input->post('qty'); $declared_name_arr = $this->input->post('declared_name'); $declared_price_arr = $this->input->post('declared_price'); if (count($sku_arr) == count($qty_arr) && count($qty_arr) == count($declared_name_arr) && count($declared_name_arr) == count($declared_price_arr)) { foreach ($sku_arr as $sku) { if (!$this->abroad_stock_model->check_exists('product_basic', array('sku' => $sku))) { echo $this->create_json(0, lang('product_sku_nonentity')); return; } } foreach ($qty_arr as $qty) { if (!is_positive($qty)) { echo $this->create_json(0, lang('qty_not_natural')); return; } } $case_no = trim($this->input->post('case_no')); $case_id = trim($this->input->post('case_id')); // $order_sign = $this->abroad_stock_model->get_order_sign_by_case_id($case_id); $sku_count = count($sku_arr); $this->abroad_stock_model->delete('cky_in_store_product', array('case_id' => $case_id)); for ($i = 0; $i < $sku_count; $i++) { $data_to_database = array('case_id' => $case_id, 'case_no' => $case_no, 'title' => $sku_arr[$i], 'quantity' => $qty_arr[$i], 'declared_name' => $declared_name_arr[$i], 'declared_price' => $declared_price_arr[$i], 'creator' => get_current_login_name()); try { $this->abroad_stock_model->save_in_store_product($data_to_database); } catch (Exception $e) { echo lang('error_msg'); $this->ajax_failed(); } } } else { echo $this->create_json(0, lang('product_info_not_matching')); return; } $list_id = trim($this->input->post('list_id')); list($list_info, $boxes_info, $products_info) = $this->in_store_list_all_detail($list_id); $data_for_view = array('list_id' => $list_id, 'case_id' => $case_id, 'case_no' => $case_no, 'list_info' => $list_info, 'boxes_info' => $boxes_info, 'products_info' => $products_info); $this->load->view('stock/abroad_stock/seccuss_or_failure_page', $data_for_view); return; }
public function instant_save_recommend_order() { $id = $this->input->post('id'); $type = $this->input->post('type'); $value = trim($this->input->post('value')); try { $user_name = get_current_login_name(); $status = $this->quality_testing_model->get_one('order_recommend_list', 'status', array('id' => $id)); if ($status === 'warehousing' && $type === 'status') { echo $this->create_json(0, lang('warehousing_not_again')); return; } if ($type === 'recommend_no') { $recommend_no = $this->quality_testing_model->get_one('order_recommend_list', 'recommend_no', array('id' => $id)); if ($value != $recommend_no && $this->quality_testing_model->check_exists('order_recommend_list', array('recommend_no' => $value))) { echo $this->create_json(0, lang('recommend_no_exists')); return; } } $this->quality_testing_model->instant_save_order($id, $type, $value, $user_name); if ($value === 'warehousing') { $sku_str = $this->quality_testing_model->get_one('order_recommend_list', 'sku_str', array('id' => $id)); $qty_str = $this->quality_testing_model->get_one('order_recommend_list', 'qty_str', array('id' => $id)); $skus_arr = explode(',', $sku_str); $qtys_arr = explode(',', $qty_str); $count = count($skus_arr); for ($i = 0; $i < $count; $i++) { $p_id = $this->quality_testing_model->get_one('product_basic', 'id', array('sku' => $skus_arr[$i])); $report_id = $this->product_model->apply_product_instock($p_id, element($i, $qtys_arr)); } } if ($type == 'status' || $type == 'cause') { $value = lang($value); } echo $this->create_json(1, lang('ok'), $value); } catch (Exception $e) { $this->ajax_failed(); echo lang('error_msg'); } }
public function give_order_back_to_shipping() { $order_id = $this->input->post('order_id'); $is_register = $this->input->post('is_register'); $shipping_remark = $this->input->post('shipping_remark'); $track_number = $this->input->post('track_number'); $weight = $this->input->post('weight'); $item = $this->order_model->get_order_item($order_id); $new_item_no = change_item_register($item->item_no, $item->is_register, $is_register); $sys_remark = $item->sys_remark . ',' . sprintf(lang('feedback_to_shipping_remark'), get_current_time(), get_current_login_name()); $data = array('is_register' => $is_register, 'item_no' => $new_item_no, 'ship_weight' => '', 'track_number' => strtoupper($track_number), 'order_status' => $this->order_statuses['wait_for_shipping_confirmation'], 'descript' => $shipping_remark, 'sys_remark' => $sys_remark); try { $user_name = get_current_login_name(); $type_extra = $user_name . '/' . date('Y-m-d H:i:s'); $this->product_model->update_product_stock_count_by_order_id($order_id, 'label_instock', $type_extra, FALSE); $this->order_model->update_order_information($order_id, $data); } catch (Exception $e) { echo lang('error_msg'); $this->ajax_failed(); } }
public function proccess_instock_by_label() { $order_id = $this->input->post('order_id'); if (empty($order_id)) { echo $this->create_json(0, lang('error_notice')); return ''; } $status_name = $this->order_model->fetch_order_status_name($order_id); if ($status_name != 'wait_for_shipping_confirmation') { echo $this->create_json(0, lang('error_notice')); return ''; } $user_name = get_current_login_name(); $type_extra = $user_name . '/' . date('Y-m-d H:i:s'); $this->product_model->update_product_stock_count_by_order_id($order_id, 'label_instock', $type_extra, FALSE); $remark = $this->order_model->get_sys_remark($order_id); $remark .= sprintf(lang('instock_by_label_remark'), date('Y-m-d H:i:s'), get_current_user_name()); $data = array('order_status' => $this->order_statuses['wait_for_purchase'], 'sys_remark' => $remark); $this->order_model->update_order_information($order_id, $data); }
echo form_open(current_url()); echo lang('from') . ' ' . block_time_picker('begin_time', $begin_time) . ' '; echo lang('to') . ' ' . block_time_picker('end_time', $end_time) . ' '; $time_lines = array(); $time_lines[0] = lang('all'); $time_lines[1] = lang('today'); $time_lines[2] = lang('yesterday'); $time_lines[3] = lang('this_week'); $time_lines[4] = lang('last_week'); $time_lines[5] = lang('this_month'); $time_lines[6] = lang('last_month'); echo form_dropdown('time_line', $time_lines, isset($time_line) ? $time_line : '0'); $time_lines = array(); $time_lines[0] = lang('all'); $time_lines[1] = lang('normal_mode'); $time_lines[2] = lang('closed'); echo form_dropdown('statistics_type', $time_lines, isset($statistics_type) ? $statistics_type : '0'); $input_users = array(); $input_users[] = lang('all'); foreach ($all_input_user as $user) { if (!$CI->is_super_user() && $user->input_user != get_current_login_name()) { continue; } $input_users[$user->input_user] = $user->input_user; } echo form_dropdown('input_user', $input_users, isset($input_user) ? $input_user : ''); $config = array('name' => 'submit', 'value' => lang('submit'), 'type' => 'submit'); echo block_button($config); echo form_close(); echo block_js_sortable_table($head, $data, $sortable, "width: 100%;border-collapse: collapse;"); echo "<img src='{$imgurl}' width='800' height='350' alt='' />";