load->library('session'); $this->load->_model('Model_taxshanghai','taxshanghai'); //$this->load->_model('Model_taxshanghaisk','taxshanghaisk'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'add')//添加 { $this->_add(); } else if($arg == 'edit')//修改 { $this->_edit($arg_array); } else if($arg == 'skadd')//添加 { $this->_skadd(); } else if($arg == 'skedit')//修改 { $this->_skedit($arg_array); } else if($arg == 'sk')//修改 { $this->_sk($arg_array); } else { $this->_index(); } } //管理 public function _index() { $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $continent = $this->input->post('continent',true); $express = $this->input->post('express',true); $ename = $this->input->post('ename',true); $zname = $this->input->post('zname',true); $where = "1=1 "; if($continent) { $where .= " and continent = '$continent'"; } if($express) { $where .= " and express = '$express'"; } if($ename) { $where .= " and ename = '$ename'"; } if($zname) { $where .= " and zname = '$zname'"; } //数据排序 $order_str = "id asc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->taxshanghai->find_all($where,'id,orderno',$order_str,$start,$perpage); $total = $this->taxshanghai->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('tax_shanghai',$this->data); } //添加 public function _add() { $post = $this->input->post(NULL, TRUE); if(isset($post['apptype'])) { if($this->taxshanghai->insert($post)) { echo json_encode(array('msg'=>'添加成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit; } } $this->_Template('tax_shanghai_add',$this->data); } //修改 public function _edit($arg_array) { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); if($this->taxshanghai->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0]; $taxshanghai = $this->taxshanghai->read($arg_array); $this->data['taxshanghai'] = $taxshanghai; $this->_Template('tax_shanghai_edit',$this->data); } public function _sk() { $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $continent = $this->input->post('continent',true); $express = $this->input->post('express',true); $ename = $this->input->post('ename',true); $zname = $this->input->post('zname',true); $where = "1=1 "; if($continent) { $where .= " and continent = '$continent'"; } if($express) { $where .= " and express = '$express'"; } if($ename) { $where .= " and ename = '$ename'"; } if($zname) { $where .= " and zname = '$zname'"; } //数据排序 $order_str = "id asc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->taxshanghaisk->find_all($where,'id,orderno,charge,accountingdate',$order_str,$start,$perpage); $total = $this->taxshanghaisk->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('tax_shanghai_sk',$this->data); } //添加 public function _skadd() { $post = $this->input->post(NULL, TRUE); if(isset($post['apptype'])) { if($this->taxshanghaisk->insert($post)) { echo json_encode(array('msg'=>'添加成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit; } } $this->_Template('tax_shanghai_sk_add',$this->data); } //修改 public function _skedit($arg_array) { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); if($this->taxshanghaisk->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0]; $taxshanghaisk = $this->taxshanghaisk->read($arg_array); $this->data['taxshanghaisk'] = $taxshanghaisk; $this->_Template('tax_shanghai_sk_edit',$this->data); } }