Beispiel #1
0
 public function verify_saler_input_user()
 {
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'));
     $saler_input_user = $this->sale_order_model->fetch_saler_input_user($id);
     try {
         switch ($type) {
             case 'saler_id':
                 if ($this->sale_order_model->check_exists('user_saler_input_user_map', array('saler_id' => $value)) && $value != $saler_input_user->saler_id) {
                     echo $this->create_json(0, lang('saler_exists'), fetch_user_name_by_id($saler_input_user->saler_id));
                     return;
                 }
                 break;
         }
         $this->sale_order_model->update_saler_input_user($id, $type, $value);
         if ($type == 'in_operation') {
             $value = $value == 1 ? lang('yes') : lang('no');
         } else {
             $value = fetch_user_name_by_id($value);
         }
         echo $this->create_json(1, lang('ok'), $value);
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
Beispiel #2
0
 public function product_stock_count()
 {
     $this->load->library('excel');
     $result = $this->accounting_cost_model->fetch_all_products();
     $head = array('SKU', '中文名称', '商品分类', '市场型号', '货舱号', '货架号', '库存数量', '样品价', '采购员', '更新时间', '上次盘点时间');
     $data = array();
     foreach ($result as $row) {
         $data[] = array($row->sku, $row->p_name_cn, $row->c_name_cn, $row->market_model, $row->stock_code, $row->shelf_code, $row->stock_count, $row->price, $row->purchaser_id > 0 ? fetch_user_name_by_id($row->purchaser_id) : " ", $row->updated_date, $row->stock_check_date);
     }
     $this->excel->array_to_excel($data, $head, '_' . date('Y-m-d'));
 }
 public function verigy_exchange_power_management()
 {
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'), ',');
     $value = no_space($value);
     $currency_code = $this->order_model->fetch_power_management_by_id($id);
     if ($type == 'superintendent_id' && $this->order_model->check_exists('order_power_management_map', array('superintendent_id' => $value)) && $value != $currency_code->superintendent_id) {
         echo $this->create_json(0, lang('superintendent_id_exists'));
         return;
     }
     try {
         $this->order_model->update_exchange_power_management($id, $type, $value);
         if ($type == 'superintendent_id') {
             $value = fetch_user_name_by_id($value);
         }
         echo $this->create_json(1, lang('ok'), $value);
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
Beispiel #4
0
 public function work_rewards_error_edit($id = null)
 {
     if ($id) {
         $work_id_arr = $this->work_rewards_model->fetch_worker_by_id($id);
         $worker = array();
         foreach ($work_id_arr as $work_id) {
             $worker[] = fetch_user_name_by_id($work_id['worker_id']);
         }
         $worker_id = implode(',', $worker);
         $work_rewards_error = $this->work_rewards_model->fetch_work_rewards_by_id($id);
     } else {
         $worker_id = null;
         $work_rewards_error = null;
     }
     $parent_catalog = $this->document_catalog_model->fetch_all_department_catalog_for_make_tree();
     $parent_catalog = $this->_make_tree($parent_catalog);
     $data = array('department' => $parent_catalog, 'id' => $id, 'work_rewards_error' => $work_rewards_error, 'worker_id' => $worker_id);
     $this->template->write_view('content', 'myinfo/work_rewards_edit', $data);
     $this->template->render();
 }
    $options = block_button($config);
    $config = array('name' => 'reject_' . $apply_id, 'id' => 'reject_' . $apply_id, 'value' => lang('reject_it'), 'type' => 'button', 'style' => 'margin: 10px;', 'onclick' => "verify_apply_instock(this, '{$verify_url}', {$apply_id}, -1, {$last_index});");
    $options .= block_button($config);
    $user_name = fetch_user_name_by_id($product->user_id);
    $shelf_code_str = $product->shelf_code;
    $shelf_code_div_id = 'shelf_code_' . $apply_id;
    if (!empty($product->new_shelf_code)) {
        $shelf_code_str .= ' -> ' . block_div($shelf_code_div_id, $product->new_shelf_code);
        echo block_editor($shelf_code_div_id, 'name_form', $update_instock_url, "{id: {$apply_id}, type: 'shelf_code'}");
    } else {
        $shelf_code_str = block_div($shelf_code_div_id, $product->shelf_code);
        echo block_editor($shelf_code_div_id, 'name_form', $update_instock_url, "{id: {$apply_id}, type: 'old_shelf_code', sku: '{$product->sku}'}");
    }
    $item = array($this->block->generate_select_checkbox($apply_id), get_status_image($product->sku) . $product->sku, $shelf_code_str, $this->block->generate_image($product->image_url), $product->name_cn . '<br/>' . $product->name_en, $product->u_name, $product->stock_count);
    if (isset($product->order_sku_id)) {
        $apply_user = fetch_user_name_by_id($product->user_id);
        $item[] = $apply_user;
    } else {
        $item[] = '';
    }
    $change_count_div_id = 'change_count_' . $apply_id;
    $item[] = block_div($change_count_div_id, $product->change_count);
    echo block_editor($change_count_div_id, 'name_form', $update_instock_url, "{id: {$apply_id}, type: 'change_count'}");
    $item[] = $product->updated_time;
    $item[] = $options;
    $data[] = $item;
}
$options = array();
$options[''] = lang('all');
foreach ($purchase_users as $purchase_user) {
    $options[$purchase_user->u_id] = $purchase_user->u_name;
<?php

$head = array(array('text' => lang('resource_category'), 'sort_key' => 'seo_resource_category.name', 'id' => 'resource_integral'), array('text' => lang('resources'), 'sort_key' => 'url'), array('text' => lang('integral'), 'sort_key' => 'integral'), array('text' => lang('creator'), 'sort_key' => 'owner_id'), array('text' => lang('created_date'), 'sort_key' => 'update_date'), lang('options'));
$data = array();
$code_url = site_url('seo/resource_edit/verify_resource');
foreach ($resources as $resource) {
    $drop_button = $this->block->generate_drop_icon('seo/resource/drop_resource_review', "{id: {$resource->resource_id}}", TRUE);
    $edit_button = $this->block->generate_edit_link(site_url('seo/resource/add_edit', array($resource->resource_id)));
    $url = $drop_button . $edit_button;
    $data[] = array($resource->category_name, $resource->url, $resource->integral, fetch_user_name_by_id($resource->owner_id), $resource->update_date, $url);
}
$filters = array(array('type' => 'input', 'field' => 'seo_resource_category.name'), array('type' => 'input', 'field' => 'url'), array('type' => 'input', 'field' => 'integral'), NULL, array('type' => 'input', 'field' => 'update_date'));
$title = lang('resource_pending');
echo block_header($title);
echo form_open();
echo $this->block->generate_pagination('resource_integral');
$config = array('filters' => $filters);
echo $this->block->generate_reset_search($config);
echo $this->block->generate_table($head, $data, $filters, 'resource_integral');
echo $this->block->generate_pagination('resource_integral');
echo form_close();
?>

Beispiel #7
0
<?php

$url = site_url('seo/service_company/add');
$add_button = $this->block->generate_add_icon($url);
$head = array(lang('service_company'), lang('website'), lang('description'), lang('created_date'), lang('creator'), lang('options') . $add_button);
$data = array();
$code_url = site_url('seo/service_company/verify');
foreach ($service_companys as $service_company) {
    $drop_button = $this->block->generate_drop_icon('seo/service_company/drop', "{id: {$service_company->id}}", TRUE);
    $data[] = array($this->block->generate_div("name_{$service_company->id}", isset($service_company) ? $service_company->name : '[edit]'), $this->block->generate_div("website_{$service_company->id}", isset($service_company) ? $service_company->website : '[edit]'), $this->block->generate_div("description_{$service_company->id}", isset($service_company) ? $service_company->description : '[edit]'), $service_company->created_date, fetch_user_name_by_id($service_company->creator_id), $drop_button);
    echo $this->block->generate_editor("name_{$service_company->id}", 'service_company_form', $code_url, "{id: {$service_company->id}, type: 'name'}");
    echo $this->block->generate_editor("website_{$service_company->id}", 'service_company_form', $code_url, "{id: {$service_company->id}, type: 'website'}");
    echo $this->block->generate_editor("description_{$service_company->id}", 'service_company_form', $code_url, "{id: {$service_company->id}, type: 'description'}");
}
$title = lang('service_company_manage');
echo block_header($title);
echo form_open();
echo $this->block->generate_table($head, $data);
echo form_close();
    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;
    }
        }
        $total_price += $price;
        $data[] = array(fetch_user_name_by_id($group->u_id), $sku, $product['order'][$sku], $qty, $price);
        if (!isset($orders[$group->u_id])) {
            $orders[$group->u_id] = $product['order'][$sku];
        } else {
            $orders[$group->u_id] += $product['order'][$sku];
        }
        if (!isset($qties[$group->u_id])) {
            $qties[$group->u_id] = $qty;
        } else {
            $qties[$group->u_id] += $qty;
        }
        $index++;
    }
    $data[] = array(fetch_user_name_by_id($group->u_id) . '(' . lang('statistics') . ')', lang('develop_product_count') . ': ' . $index, lang('total_order_count') . ': ' . $orders[$group->u_id], lang('sale_total_product_count') . ': ' . $qties[$group->u_id], lang('total_sale_amount') . ': ' . $total_price);
}
if ($priority > 1 || $CI->is_super_user()) {
    if ('developer' == $role) {
        echo block_header(lang('develop_department_statistics'));
    } else {
        echo block_header(lang('purchase_department_statistics'));
    }
} else {
    echo block_header(lang('personal_development_statistical'));
}
echo '<br/>';
echo form_open(site_url('purchase/statistics/department_development_statistics', array('role' => $role)));
echo lang('develop_time') . ': ' . lang('from') . ' ' . block_time_picker('begin_time', $begin_time) . '&nbsp;&nbsp;';
echo lang('to') . ' ' . block_time_picker('end_time', $end_time) . '<br/><br/>';
echo lang('sale_time') . ': ' . lang('from') . ' ' . block_time_picker('sale_begin_time', $sale_begin_time) . '&nbsp;&nbsp;';
<?php

$head = array(array('text' => lang('type'), 'sort_key' => 'type', 'id' => 'seo_integral'), array('text' => lang('catalog'), 'sort_key' => 'content_id'), array('text' => lang('username'), 'sort_key' => 'user.id'), array('text' => lang('integral'), 'sort_key' => 'integral'), array('text' => lang('verifyer'), 'sort_key' => 'reviewer_id'), array('text' => lang('verify_date'), 'sort_key' => 'created_date'));
$data = array();
foreach ($integrals as $integral) {
    $category = $this->seo_model->fetch_content_info($integral->content_id, $integral->type, $integral->user_id);
    $data[] = array(lang($integral->type), isset($category->type_name) ? $category->type_name : '', $integral->u_name, $integral->integral, fetch_user_name_by_id($integral->reviewer_id), $integral->created_date);
}
$options = array('' => lang('all'), 'content' => lang('content'), 'resource' => lang('resource'), 'release' => lang('release'));
$users = $this->user_model->fetch_users_by_system_code('seo');
$priority = $this->user_model->fetch_user_priority_by_system_code('seo');
$user_options = array();
$user_options[''] = lang('all');
foreach ($users as $user) {
    $user_options[$user->u_id] = $user->u_name;
}
$filters = array(array('type' => 'dropdown', 'field' => 'type', 'options' => $options, 'method' => '='), NULl);
$CI =& get_instance();
if ($priority > 1 || $CI->is_super_user()) {
    $filters[] = array('type' => 'dropdown', 'field' => 'user.id', 'options' => $user_options, 'method' => '=');
} else {
    $filters[] = NULL;
}
$filters[] = array('type' => 'input', 'field' => 'integral');
$filters[] = NULL;
$filters[] = array('type' => 'date', 'field' => 'created_date', 'method' => 'from_to');
if ($CI->is_super_user() || $priority > 1) {
    $title = lang('integral');
} else {
    $user_id = get_current_user_id();
    $total_integral = fetch_user_all_integrals($user_id);
     if ('-2' == $resource->status) {
         $status = lang('closed');
     } else {
         if ('-1' == $resource->status) {
             $status = lang('validate_failure');
         } else {
             if ('0' == $resource->status) {
                 $status = lang('wait_to_validate');
             } else {
                 $status = lang('validate');
             }
         }
     }
 }
 $item = array(anchor(site_url('seo/content_edit/add_edit', array('id' => $resource->content_id)), $resource->title), anchor(site_url('seo/resource/add_edit', array('id' => $resource->resource_id)), $resource->url), $resource->con_type, $resource->res_category);
 $item[] = fetch_user_name_by_id($resource->owner_id);
 //    $item[] = $resource->validate_url;
 $edit_button = $this->block->generate_edit_link(site_url('seo/release/update_validate_url', array($resource->id)));
 $validate_limit = string_limiter($resource->validate_url, 0, 20);
 $item[] = "<a href='{$resource->validate_url}' title='{$resource->validate_url}' target='_blank'>" . $validate_limit . "</a>" . $edit_button;
 $item[] = $resource->created_date;
 $item[] = $resource->remark;
 $item[] = $status;
 if ($priority > 1 && ($resource->status == '-1' || $resource->status == '0') || $CI->is_super_user() && ($resource->status == '-1' || $resource->status == '0') || $priority > 1 && 'personal' == $tag && ($resource->status == '-1' || $resource->status == '0')) {
     $url_successful = site_url('seo/release/released_validate', array('successful'));
     $config_successful = array('name' => 'submit', 'value' => lang('handwork_validate_successful'), 'type' => 'button', 'style' => 'margin:10px', 'onclick' => "handwork_validate(this, '{$url_successful}', {$resource->id}, 0, false);");
     $url_failure = site_url('seo/release/released_validate', array('failure'));
     $config_failure = array('name' => 'submit', 'value' => lang('handwork_validate_failure'), 'type' => 'button', 'style' => 'margin:10px', 'onclick' => "handwork_validate(this, '{$url_failure}', {$resource->id}, 0, true);");
     //        echo '<h2>'.block_button($config).'</h2>';
     $item[] = block_button($config_successful) . br() . block_button($config_failure);
 } else {
 public function down_order_excel($id)
 {
     //$this->load->library('PHPExcel');
     //$this->load->library('PHPExcel/IOFactory');
     require_once APPPATH . 'libraries/PHPExcel' . EXT;
     require_once APPPATH . 'libraries/PHPExcel/IOFactory' . EXT;
     require_once APPPATH . 'libraries/PHPExcel/Worksheet/Drawing' . EXT;
     $CI =& get_instance();
     $order = $this->order_model->get_order($id);
     //var_dump($order);die();
     if ($order) {
         $print_date = date('Y.m.d');
         $user = fetch_user_name_by_id(fetch_user_id_by_login_name($order->input_user));
         $country_cn_name = get_country_name_cn($order->country);
         $objPHPExcel = new PHPExcel();
         $objPHPExcel->createSheet();
         //创建sheet
         $objPHPExcel->setActiveSheetIndex(0);
         $objActSheet = $objPHPExcel->getActiveSheet();
         $objPHPExcel->getProperties()->setCreator("mallerp")->setLastModifiedBy("mallerp")->setTitle("Ebay ShipOrder List")->setSubject("Ebay ShipOrder List")->setDescription("Mansea, Mallerp, zhaosenlin, 278203374, 7410992")->setKeywords("Mansea, Mallerp, zhaosenlin, 278203374, 7410992")->setCategory("mallerp");
         $objActSheet->getColumnDimension('E')->setWidth(20);
         $objActSheet->getColumnDimension('A')->setWidth(0);
         /*excel表头*/
         $objPHPExcel->getActiveSheet()->setCellValue('A1', '');
         $objPHPExcel->getActiveSheet()->setCellValue('A2', '');
         $objPHPExcel->getActiveSheet()->setCellValue('A3', '');
         $objPHPExcel->getActiveSheet()->setCellValue('A4', '');
         $objActSheet->getStyle('B1:B4')->getFont()->setSize(12);
         $objActSheet->getStyle('B1:B4')->getFont()->setBold(true);
         $objActSheet->getStyle('D1:D4')->getFont()->setBold(true);
         $objActSheet->getStyle('F1:F4')->getFont()->setBold(true);
         $objPHPExcel->getActiveSheet()->mergeCells('H1:M4');
         $objPHPExcel->getActiveSheet()->setCellValue('B1', '业务员');
         $objPHPExcel->getActiveSheet()->setCellValue('C1', $user);
         $objPHPExcel->getActiveSheet()->setCellValue('D1', 'ERP订单号');
         $objPHPExcel->getActiveSheet()->setCellValue('E1', $order->item_no);
         $objPHPExcel->getActiveSheet()->setCellValue('F1', '日期');
         $objPHPExcel->getActiveSheet()->setCellValue('G1', $print_date);
         $objPHPExcel->getActiveSheet()->setCellValue('H1', '备注:' . $order->note);
         $objPHPExcel->getActiveSheet()->setCellValue('B2', '客户名称');
         $objPHPExcel->getActiveSheet()->setCellValue('C2', $order->name);
         $objPHPExcel->getActiveSheet()->setCellValue('D2', '国家');
         $objPHPExcel->getActiveSheet()->setCellValue('E2', $country_cn_name);
         $objPHPExcel->getActiveSheet()->setCellValue('F2', '运输方式');
         $objPHPExcel->getActiveSheet()->setCellValue('G2', $order->is_register);
         $objPHPExcel->getActiveSheet()->setCellValue('B3', '订单总额$');
         $objPHPExcel->getActiveSheet()->setCellValue('C3', $order->gross);
         $objPHPExcel->getActiveSheet()->setCellValue('D3', '运费$');
         $objPHPExcel->getActiveSheet()->setCellValue('E3', $order->shippingamt);
         $objPHPExcel->getActiveSheet()->setCellValue('F3', '付款方式');
         $objPHPExcel->getActiveSheet()->setCellValue('G3', $order->payment_type);
         $objPHPExcel->getActiveSheet()->setCellValue('B4', '订单总额¥');
         $objPHPExcel->getActiveSheet()->setCellValue('C4', $order->gross * $order->ex_rate);
         $objPHPExcel->getActiveSheet()->setCellValue('D4', '运费¥');
         $objPHPExcel->getActiveSheet()->setCellValue('E4', $order->shippingamt * $order->ex_rate);
         $objPHPExcel->getActiveSheet()->setCellValue('F4', '实际运费');
         $objPHPExcel->getActiveSheet()->setCellValue('G4', '');
         $objPHPExcel->getActiveSheet()->setCellValue('H4', '交易号');
         $objPHPExcel->getActiveSheet()->setCellValue('I4', $order->transaction_id);
         //$objPHPExcel->getActiveSheet()->mergeCells("F5":"G5":"H5");
         $objActSheet->getStyle('B5:M5')->getFont()->setSize(12);
         $objActSheet->getStyle('B5:M5')->getFont()->setBold(true);
         $objPHPExcel->getActiveSheet()->mergeCells('F5:H5');
         $objPHPExcel->getActiveSheet()->setCellValue('B5', '货架号');
         $objPHPExcel->getActiveSheet()->setCellValue('C5', 'SKU');
         $objPHPExcel->getActiveSheet()->setCellValue('D5', '数量');
         $objPHPExcel->getActiveSheet()->setCellValue('E5', '图片');
         $objPHPExcel->getActiveSheet()->setCellValue('F5', '中文名称');
         $objPHPExcel->getActiveSheet()->setCellValue('I5', '单价$');
         $objPHPExcel->getActiveSheet()->setCellValue('J5', '单价¥');
         $objPHPExcel->getActiveSheet()->setCellValue('K5', '总价¥');
         $objPHPExcel->getActiveSheet()->setCellValue('L5', '成本¥');
         $objPHPExcel->getActiveSheet()->setCellValue('M5', '利润¥');
         $skus = explode(',', $order->sku_str);
         $qties = explode(',', $order->qty_str);
         $item_prices = explode(',', $order->item_price_str);
         $i = 5;
         foreach ($skus as $key => $sku) {
             $i++;
             $sql1 = 'name_cn,shelf_code,sale_price,image_url,price';
             $myproduct = $CI->product_model->fetch_product_by_sku($sku, $sql1);
             $image = "";
             if ($myproduct->image_url != '' && $myproduct->image_url != NULL && $myproduct->image_url != 'none') {
                 if (strpos($myproduct->image_url, 'http://') !== false) {
                     $image = "/var/www/html/mallerp/static/images/404-error.png";
                 } else {
                     $image = '/var/www/html/mallerp' . $myproduct->image_url;
                 }
             } else {
                 $image = "/var/www/html/mallerp/static/images/404-error.png";
             }
             //die($image);
             $objActSheet->getRowDimension($i)->setRowHeight(100);
             $objActSheet->getStyle('B' . $i . ':M' . $i)->getFont()->setSize(12);
             $objPHPExcel->getActiveSheet()->mergeCells('F' . $i . ':H' . $i);
             $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, $myproduct->shelf_code);
             $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, $sku);
             $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, $qties[$key]);
             $objDrawing = new PHPExcel_Worksheet_Drawing();
             $objDrawing->setName('avatar');
             $objDrawing->setDescription('avatar');
             $objDrawing->setPath($image);
             $objDrawing->setHeight(100);
             $objDrawing->setWidth(100);
             $objDrawing->setCoordinates('E' . $i);
             $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
             //$objPHPExcel->getActiveSheet()->setCellValue('E'.$i, '图片');
             $objPHPExcel->getActiveSheet()->setCellValue('F' . $i, $myproduct->name_cn);
             $objPHPExcel->getActiveSheet()->setCellValue('I' . $i, isset($item_prices[$key]) ? $item_prices[$key] : 0);
             $objPHPExcel->getActiveSheet()->setCellValue('J' . $i, isset($item_prices[$key]) ? $item_prices[$key] : 0 * $order->ex_rate);
             $objPHPExcel->getActiveSheet()->setCellValue('K' . $i, isset($item_prices[$key]) ? $item_prices[$key] : 0 * $order->ex_rate * $qties[$key]);
             $objPHPExcel->getActiveSheet()->setCellValue('L' . $i, '');
             $objPHPExcel->getActiveSheet()->setCellValue('M' . $i, '');
         }
     }
     $filename = date("Y-m-d_H_i_s") . '.xls';
     ob_end_clean();
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename=' . $filename);
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
 }
<?php

$url = site_url('admin/crontab/crontab_add_row');
$add_button = $this->block->generate_add_icon($url);
$head = array(lang('on'), lang('job'), lang('description'), lang('creator'), lang('created_date'), lang('options') . $add_button);
$data = array();
$crontab_url = site_url('admin/crontab/verify_crontab');
foreach ($crontabresult as $show_result) {
    $drop_button = $this->block->generate_drop_icon('admin/crontab/crontab_delete', "{id: {$show_result->id}}", TRUE);
    $data[] = array($this->block->generate_div("on_{$show_result->id}", empty($show_result->on) ? '[edit]' : $show_result->on), $this->block->generate_div("job_{$show_result->id}", empty($show_result->job) ? '[edit]' : $show_result->job), $this->block->generate_div("description_{$show_result->id}", empty($show_result->description) ? '[edit]' : $show_result->description), fetch_user_name_by_id($show_result->creator), $show_result->created_date, $drop_button);
    echo $this->block->generate_editor("on_{$show_result->id}", 'crontab_view_form', $crontab_url, "{id: {$show_result->id} ,type: 'on'}");
    echo $this->block->generate_editor("job_{$show_result->id}", 'crontab_view_form', $crontab_url, "{id: {$show_result->id} ,type: 'job'}");
    echo block_editor("description_{$show_result->id}", 'crontab_view_form', $crontab_url, "{id: {$show_result->id} ,type: 'description'}");
}
$title = lang('admin_crontab');
echo block_header($title);
echo $this->block->generate_table($head, $data);
$activate_crontab_url = site_url('admin/crontab/activate_crontab');
$view_crontab_url = site_url('admin/crontab/view_crontab_list');
$config = array('name' => 'activate_crontab', 'id' => 'activate_crontab', 'value' => lang('activate_crontab_again'), 'type' => 'button', 'onclick' => "helper.ajax('{$activate_crontab_url}', {}, 1);");
$activate_crontab = '<div style="float: right; ">';
echo br();
$activate_crontab .= block_button($config);
$attributes = "onclick=\"helper.update_content('{$view_crontab_url}', {}, 'crontab_list_div'); return false;\"";
$activate_crontab .= ' ' . anchor(current_url(), lang('view_crontab_list'), $attributes);
$activate_crontab .= '</div>';
echo $activate_crontab;
echo '<div style="clear:both;"></div>';
echo '<div id="crontab_list_div" style="display:none;"></div>';
<?php

$head = array(lang('purchaser'), lang('sale_amount'), lang('stock_summation_count'), lang('ito_monthly'));
$data = array();
foreach ($statistics as $row) {
    $ito = empty($row->stock_amount) ? price($row->sale_amount / 1, 4) : price($row->sale_amount / $row->stock_amount, 4);
    $ito = $ito * 100 . '%';
    $data[] = array(fetch_user_name_by_id($row->purchaser_id), $row->sale_amount, $row->stock_amount, $ito);
}
echo block_header(lang('department_month_ito_statistics'));
$start_year = 2004;
$end_year = date('Y');
$years = array();
for ($i = $start_year; $i <= $end_year; $i++) {
    $years[$i] = $i;
}
$months = array();
for ($i = 1; $i <= 12; $i++) {
    $months[$i] = $i;
}
echo form_open(current_url());
echo br();
echo form_label(lang('year')) . ': ' . form_dropdown('year', $years, $year);
echo repeater('&nbsp;', 3);
echo form_label(lang('month')) . ': ' . form_dropdown('month', $months, $month);
echo repeater('&nbsp;', 3);
$config = array('name' => 'submit', 'value' => lang('submit'), 'type' => 'submit');
echo block_button($config);
echo form_close();
$sortable = array('default', 'integer', 'integer', 'float');
echo block_js_sortable_table($head, $data, $sortable);
Beispiel #15
0
    $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;
    if ($priority > 1 || $CI->is_super_user()) {
        $row[] = fetch_user_name_by_id($order->saler_id);
    }
    $data[] = $row;
}
$users = $this->user_model->fetch_users_by_system_code('sale');
$user_options = array();
$user_options[''] = lang('all');
foreach ($users as $user) {
    $user_options[$user->u_id] = $user->u_name;
}
echo block_header(lang('view_order'));
$filters = array(null, array('type' => 'input', 'field' => 'item_no|name|shipping_address|buyer_id'), array('type' => 'input', 'field' => 'item_title_str|item_id_str|sku_str|is_register'), array('type' => 'input', 'field' => 'gross|transaction_id|descript|track_number'), array('type' => 'input', 'field' => 'ship_confirm_date|ship_weight|ship_confirm_user'), $this->block->generate_search_dropdown('order_status', 'order_status'), array('type' => 'date', 'field' => 'input_date', 'method' => 'from_to'));
if ($priority > 1 || $CI->is_super_user()) {
    $filters[] = array('type' => 'dropdown', 'field' => 'user_saler_input_user_map.saler_id', 'options' => $user_options, 'method' => '=');
}
$config = array('filters' => $filters);
<?php

$head = array(array('text' => lang('content_catalog'), 'sort_key' => 'seo_content_catalog.name', 'id' => 'content_integral'), array('text' => lang('title'), 'sort_key' => 'title'), array('text' => lang('integral'), 'sort_key' => 'integral'), array('text' => lang('creator'), 'sort_key' => 'owner_id'), array('text' => lang('created_date'), 'sort_key' => 'update_date'), lang('options'));
$data = array();
$code_url = site_url('seo/content_edit/verify_content');
foreach ($contents as $content) {
    $drop_button = $this->block->generate_drop_icon('seo/content_edit/drop_content_review', "{id: {$content->content_id}}", TRUE);
    $edit_button = $this->block->generate_edit_link(site_url('seo/content_edit/add_edit', array($content->content_id)));
    $url = $drop_button . $edit_button;
    $data[] = array($content->catalog_name, $content->title, $content->integral, fetch_user_name_by_id($content->owner_id), $content->update_date, $url);
}
$filters = array(array('type' => 'input', 'field' => 'seo_content_catalog.name'), array('type' => 'input', 'field' => 'title'), array('type' => 'input', 'field' => 'integral'), NULL, array('type' => 'input', 'field' => 'update_date'));
$title = lang('content_pending');
echo block_header($title);
echo form_open();
echo $this->block->generate_pagination('content_integral');
$config = array('filters' => $filters);
echo $this->block->generate_reset_search($config);
echo $this->block->generate_table($head, $data, $filters, 'content_integral');
echo $this->block->generate_pagination('content_integral');
echo form_close();
$data = array();
$saler_url = site_url('sale/sale_order/verify_saler_input_user');
foreach ($salers as $saler) {
    $drop_button = $this->block->generate_drop_icon('sale/sale_order/drop_saler_input_user', "{id: {$saler->saler_id}}", TRUE);
    $more_button = block_more_icon('sale/sale_order/saler_add_input_user', "{saler_id: {$saler->saler_id}}");
    $input_user_url = site_url('sale/sale_order/verify_input_user');
    $input_users = $this->sale_order_model->saler_fetch_input_users($saler->saler_id);
    $input_users_str = '';
    foreach ($input_users as $inputuser) {
        if ('void' == $inputuser->paypal_email) {
            $input_user = '******';
        } else {
            $input_user = $inputuser->paypal_email;
        }
        $input_users_str .= $this->block->generate_div("input_user_{$inputuser->id}", $input_user) . '<br>';
        echo $this->block->generate_editor("input_user_{$inputuser->id}", 'sale_order_form', $input_user_url, "{id: {$inputuser->id}, type: 'paypal_email'}", "{$input_user_collection}");
    }
    $input_users_str .= $more_button;
    $data[] = array($this->block->generate_div("saler_{$saler->saler_id}", isset($saler) && $saler->saler_id != '0' ? fetch_user_name_by_id($saler->saler_id) : '[edit]'), $input_users_str, block_div("saler_in_operation_{$saler->saler_id}", $saler->in_operation == 1 ? $yes : $no), $drop_button);
    echo $this->block->generate_editor("saler_{$saler->saler_id}", 'sale_order_form', $saler_url, "{id: {$saler->saler_id}, type: 'saler_id'}", "{$collection}");
    echo $this->block->generate_editor("saler_in_operation_{$saler->saler_id}", 'sale_order_form', $saler_url, "{id: {$saler->saler_id}, type: 'in_operation'}", $in_operation_collection);
}
$title = lang('sale_setting');
echo block_header($title);
echo form_open();
echo $this->block->generate_table($head, $data);
echo form_close();
echo block_notice_div(lang('note') . ": " . lang('sale_input_user_notice'));
?>

$CI =& get_instance();
$head = array(array('text' => lang('content'), 'sort_key' => 'content_item', 'id' => 'work_rewards'), array('text' => lang('department'), 'sort_key' => 'department'), array('text' => lang('processing_result'), 'sort_key' => 'result'), array('text' => lang('work_rewards_error_person'), 'sort_key' => 'worker_id'), array('text' => lang('order_number'), 'sort_key' => 'order_no'), array('text' => lang('author'), 'sort_key' => 'author'), array('text' => lang('document_catalog'), 'sort_key' => 'type'), array('text' => lang('processing_status'), 'sort_key' => 'status'), array('text' => lang('custom_date'), 'sort_key' => 'created_time'), lang('options'));
$data = array();
$priority = $this->user_model->fetch_user_priority_by_system_code('executive');
$dept = array();
$dept[''] = lang('all');
foreach ($department_arr as $department) {
    $dept[$department->department] = str_replace('制度', '', $this->work_rewards_model->get_dept_name_by_id($department->department));
}
foreach ($work_rewards_errors as $work_rewards_error) {
    $drop_button = $this->block->generate_drop_icon('myinfo/myaccount/drop_work_rewards_error', "{id: {$work_rewards_error->id}}", TRUE);
    $id = $work_rewards_error->id;
    $work_id_arr = $this->work_rewards_model->fetch_worker_by_id($id);
    $worker = array();
    foreach ($work_id_arr as $work_id) {
        $worker[] = fetch_user_name_by_id($work_id['worker_id']);
    }
    $worker_id = implode(',', $worker);
    $edit_button = $this->block->generate_edit_link(site_url('myinfo/myaccount/work_rewards_error_edit', array($work_rewards_error->id)), FALSE);
    $department = $this->document_catalog_model->fetch_name_by_dept_id($work_rewards_error->department);
    if ($CI->is_super_user() or $priority > 1) {
        $drop_button .= $edit_button;
    } else {
        $drop_button = $edit_button;
    }
    $data[] = array(trim_right(substr($work_rewards_error->content_item, 0, 100)), $department, $work_rewards_error->result, $worker_id, $work_rewards_error->order_no, $work_rewards_error->author, lang($work_rewards_error->type), lang($work_rewards_error->status), $work_rewards_error->created_time, $drop_button);
}
$filters = array(array('type' => 'input', 'field' => 'content_item'), array('type' => 'dropdown', 'field' => 'department', 'options' => $dept), array('type' => 'input', 'field' => 'result'), array('type' => 'input', 'field' => 'name'), array('type' => 'input', 'field' => 'order_no'), array('type' => 'input', 'field' => 'author'));
$type = array('' => lang('please_select'), 'reward' => lang('reward'), 'pulish' => lang('pulish'));
$filters[] = array('type' => 'dropdown', 'field' => 'type', 'options' => $type, 'method' => '=');
$status = array('' => lang('please_select'), 'wait_for_proccess' => lang('wait_for_proccess'), 'completed' => lang('completed'));
<?php

$CI =& get_instance();
$head = array(lang('purchaser'), lang('sku'), lang('market_model'), lang('sale_product_count'), lang('sale_amount'));
$data = array();
$current_user_id = get_current_user_id();
if (isset($statistics[$current_user_id])) {
    $sale_statistics = $statistics[$current_user_id];
} else {
    $sale_statistics = array();
}
foreach ($statistics as $purchaser_id => $sale_statistics) {
    $sku_count = 0;
    $total_qty = 0;
    $total_price = 0;
    $purchaser_name = fetch_user_name_by_id($purchaser_id);
    foreach ($sale_statistics as $sku => $qty) {
        if (isset($sku_prices[$sku])) {
            $price = $sku_prices[$sku] * $qty;
        } else {
            $price = $CI->product_model->fetch_cost_by_sku($sku) * $qty;
        }
        $total_price += $price;
        $market_model = get_product_market_model($sku);
        $data[] = array($purchaser_name, $sku, $market_model, $qty, $price);
        $sku_count++;
        $total_qty += $qty;
    }
    $data[] = array($purchaser_name . '(' . lang('statistics') . ')', lang('sku_count') . ': ' . $sku_count, NULL, lang('sale_product_count') . ': ' . $total_qty, lang('total_sale_amount') . ': ' . $total_price);
}
echo block_header(lang('department_purchase_sale_statistics'));
    public function fetch_purchase_list($purchaser_filter = -1, $qt = FALSE)
    {
        $user_id = get_current_user_id();
        if ($qt) {
            $show_purchaser_filter = TRUE;
            //$where = "((stock_count + on_way_count) < dueout_count + min_stock_number) AND (min_stock_number > 0 OR (dueout_count > 0))";
            $where = "((stock_count) <  min_stock_number) AND (min_stock_number > 0 )";
        } else {
            $show_purchaser_filter = $this->show_purchaser_filter();
            //$where = "((stock_count) < dueout_count + min_stock_number) AND (min_stock_number > 0 OR (dueout_count > 0)) OR ((uk_stock_count) < uk_dueout_count + uk_min_stock_number) AND (uk_min_stock_number > 0 OR (uk_dueout_count > 0)) OR ((de_stock_count) < de_dueout_count + de_min_stock_number) AND (de_min_stock_number > 0 OR (de_dueout_count > 0)) OR ((au_stock_count) < au_dueout_count + au_min_stock_number) AND (au_min_stock_number > 0 OR (au_dueout_count > 0))";
            $where = "((stock_count) < min_stock_number) AND (min_stock_number > 0) OR ((uk_stock_count) < uk_min_stock_number) AND (uk_min_stock_number > 0 ) OR ((de_stock_count) < de_min_stock_number) AND (de_min_stock_number > 0 ) OR ((au_stock_count) < au_min_stock_number) AND (au_min_stock_number > 0 ) OR ((yb_stock_count) < yb_min_stock_number) AND (yb_min_stock_number > 0 )";
        }
        $sql = <<<SQL
SELECT
    id,
    market_model, 
    stock_count,
    min_stock_number,
    image_url,
    dueout_count,
    stock_count,
    min_stock_number,
    on_way_count,
\tau_on_way_count,
    de_on_way_count,
    uk_on_way_count,
\tyb_on_way_count,
    (min_stock_number -(stock_count + on_way_count)) as purchase_suggestion,
    (uk_min_stock_number -(uk_stock_count + uk_on_way_count)) as uk_purchase_suggestion,
    (de_min_stock_number -(de_stock_count + de_on_way_count)) as de_purchase_suggestion,
    (au_min_stock_number -(au_stock_count + au_on_way_count)) as au_purchase_suggestion,
\t(yb_min_stock_number -(yb_stock_count + yb_on_way_count)) as yb_purchase_suggestion,
    purchaser_id,
    
    au_dueout_count,
    de_dueout_count,
    uk_dueout_count,
\tyb_dueout_count,
    au_stock_count,
    de_stock_count,
    uk_stock_count,
\tyb_stock_count,
    au_min_stock_number,
    de_min_stock_number,
\tyb_min_stock_number,
    uk_min_stock_number
FROM 
    product_basic
WHERE
    {$where}
SQL;
        $query = $this->db->query($sql);
        $result = $query->result_array();
        if (!isset($this->CI->product_model)) {
            $this->CI->load->model('product_model');
        }
        if (!isset($this->CI->product_catalog_model)) {
            $this->CI->load->model('product_catalog_model');
        }
        if (!isset($this->CI->stock_model)) {
            $this->CI->load->model('stock_model');
        }
        $colors = array('black', 'blue', 'green');
        foreach ($result as $key => $row) {
            $purchaser_id = 0;
            $basic = $this->CI->product_model->fetch_product_basic($row['id']);
            if (isset($row['purchaser_id'])) {
                $purchaser_id = $row['purchaser_id'];
            }
            if ($purchaser_id <= 0) {
                $purchaser_id = $this->CI->product_catalog_model->fetch_purchaser_id($basic->catalog_id);
            }
            if ($purchaser_filter == -1) {
                if (!$show_purchaser_filter) {
                    if ($purchaser_id != $user_id) {
                        unset($result[$key]);
                        continue;
                    }
                }
            } else {
                if (!$show_purchaser_filter) {
                    unset($result[$key]);
                    continue;
                }
                if ($purchaser_filter != $purchaser_id) {
                    unset($result[$key]);
                    continue;
                }
            }
            $result[$key]['purchaser'] = fetch_user_name_by_id($purchaser_id);
            $result[$key]['sku'] = $basic->sku;
            $result[$key]['name_cn'] = $basic->name_cn;
            $providers = $this->product_model->fetch_product_providers($row['id'], 3);
            $provider_str = '';
            $i = 0;
            foreach ($providers as $provider) {
                $price_url = site_url('purchase/provider/provider_sku_manage', array($provider->m_provider_id));
                $provider_url = site_url('purchase/provider/edit', array($provider->m_provider_id));
                $object = $this->fetch_provider($provider->m_provider_id);
                $name = isset($object->name) ? $object->name : '';
                $contact_person = isset($object->contact_person) ? $object->contact_person : '';
                $phone = isset($object->phone) ? $object->phone : '';
                $mobile = isset($object->mobile) ? $object->mobile : '';
                $provider_str .= <<<STR
    <a href='{$price_url}' target='_blank'>
        <span style='color: {$colors[$i]};'>
            {$provider->m_price1to9}|{$provider->m_price10to99}|{$provider->m_price100to999}
        </span>
    </a>
    /
    <a href='{$provider_url}' target='_blank'>
        <span style='color: {$colors[$i]};'>
            {$name} {$contact_person} {$phone} {$mobile}
        </span>
    </a>
<br/>
STR;
                $i++;
            }
            $provider_str = trim($provider_str, '<br/>');
            $result[$key]['providers'] = $provider_str;
            $result[$key]['7_days_sale_amount'] = $basic->sale_in_7_days;
            $result[$key]['30_days_sale_amount'] = $basic->sale_in_30_days;
            $result[$key]['60_days_sale_amount'] = $basic->sale_in_60_days;
        }
        uasort($result, array($this, 'sort_by_purchaser'));
        return $result;
    }