|
@@ -31,4 +31,53 @@ class retailControl extends SystemControl
|
|
|
$retail_mod->dispose_commit($cond);
|
|
|
showMessage('操作成功','index.php?act=retail&op=index');
|
|
|
}
|
|
|
+
|
|
|
+ public function retail_exportOp()
|
|
|
+ {
|
|
|
+ $retail_mod = Model('retail');
|
|
|
+ $cond['state'] = retailModel::state_init;
|
|
|
+ $retail_list = $retail_mod->getList($cond, 1000, '*', 'create_time asc');
|
|
|
+ $this->createExcel($retail_list);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function createExcel($data)
|
|
|
+ {
|
|
|
+ Language::read('export');
|
|
|
+ import('libraries.excel');
|
|
|
+ $excel_obj = new Excel();
|
|
|
+ $excel_data = array();
|
|
|
+ //设置样式
|
|
|
+ $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
|
|
|
+ //header
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '序号');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '单号');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '渠道');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '省份');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '城市');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '区域');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '详细地址');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '联系人');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '联系电话');
|
|
|
+ $excel_data[0][] = array('styleid' => 's_title', 'data' => '身份证号码');
|
|
|
+
|
|
|
+ //data
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $tmp = array();
|
|
|
+ $tmp[] = array('data' => $k+1);
|
|
|
+ $tmp[] = array('data' => $v['retail_sn']);
|
|
|
+ $tmp[] = array('data' => $v['channel_code']);
|
|
|
+ $tmp[] = array('data' => $v['province']);
|
|
|
+ $tmp[] = array('data' => $v['city']);
|
|
|
+ $tmp[] = array('data' => $v['area']);
|
|
|
+ $tmp[] = array('data' => $v['address']);
|
|
|
+ $tmp[] = array('data' => $v['applicant_name']);
|
|
|
+ $tmp[] = array('data' => $v['contact_phone']);
|
|
|
+ $tmp[] = array('data' => $v['id_card']);
|
|
|
+ $excel_data[] = $tmp;
|
|
|
+ }
|
|
|
+ $excel_data = $excel_obj->charset($excel_data, CHARSET);
|
|
|
+ $excel_obj->addArray($excel_data);
|
|
|
+ $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
|
|
|
+ $excel_obj->generateXML('retail');
|
|
|
+ }
|
|
|
}
|