123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Taxshanghai extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->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);
- }
- }
|