Taxshanghai.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Taxshanghai extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_taxshanghai','taxshanghai');
  7. //$this->load->_model('Model_taxshanghaisk','taxshanghaisk');
  8. }
  9. //定义方法的调用规则 获取URI第二段值
  10. public function _remap($arg,$arg_array)
  11. {
  12. if($arg == 'add')//添加
  13. {
  14. $this->_add();
  15. }
  16. else if($arg == 'edit')//修改
  17. {
  18. $this->_edit($arg_array);
  19. }
  20. else if($arg == 'skadd')//添加
  21. {
  22. $this->_skadd();
  23. }
  24. else if($arg == 'skedit')//修改
  25. {
  26. $this->_skedit($arg_array);
  27. }
  28. else if($arg == 'sk')//修改
  29. {
  30. $this->_sk($arg_array);
  31. }
  32. else
  33. {
  34. $this->_index();
  35. }
  36. }
  37. //管理
  38. public function _index()
  39. {
  40. $post = $this->input->post(NULL, TRUE);
  41. if(isset($post['page']))
  42. {
  43. $page = $this->input->post('page',true);
  44. $perpage = $this->input->post('perpage',true);
  45. $continent = $this->input->post('continent',true);
  46. $express = $this->input->post('express',true);
  47. $ename = $this->input->post('ename',true);
  48. $zname = $this->input->post('zname',true);
  49. $where = "1=1 ";
  50. if($continent)
  51. {
  52. $where .= " and continent = '$continent'";
  53. }
  54. if($express)
  55. {
  56. $where .= " and express = '$express'";
  57. }
  58. if($ename)
  59. {
  60. $where .= " and ename = '$ename'";
  61. }
  62. if($zname)
  63. {
  64. $where .= " and zname = '$zname'";
  65. }
  66. //数据排序
  67. $order_str = "id asc";
  68. if(empty($page))
  69. {
  70. $start = 0;
  71. $perpage = 1;
  72. }
  73. else
  74. {
  75. $start = ($page - 1)*$perpage;
  76. }
  77. //取得信息列表
  78. $info_list = $this->taxshanghai->find_all($where,'id,orderno',$order_str,$start,$perpage);
  79. $total = $this->taxshanghai->find_count($where);
  80. $pagenum = ceil($total/$perpage);
  81. $over = $total-($start+$perpage);
  82. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  83. echo json_encode($rows);exit;
  84. }
  85. $this->_Template('tax_shanghai',$this->data);
  86. }
  87. //添加
  88. public function _add()
  89. {
  90. $post = $this->input->post(NULL, TRUE);
  91. if(isset($post['apptype']))
  92. {
  93. if($this->taxshanghai->insert($post))
  94. {
  95. echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
  96. }
  97. else
  98. {
  99. echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
  100. }
  101. }
  102. $this->_Template('tax_shanghai_add',$this->data);
  103. }
  104. //修改
  105. public function _edit($arg_array)
  106. {
  107. $post = $this->input->post(NULL, TRUE);
  108. if(isset($post['id']))
  109. {
  110. $id = $this->input->post('id',true);
  111. if($this->taxshanghai->save($post,$id))
  112. {
  113. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  114. }
  115. else
  116. {
  117. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  118. }
  119. }
  120. $arg_array = $arg_array[0];
  121. $taxshanghai = $this->taxshanghai->read($arg_array);
  122. $this->data['taxshanghai'] = $taxshanghai;
  123. $this->_Template('tax_shanghai_edit',$this->data);
  124. }
  125. public function _sk()
  126. {
  127. $post = $this->input->post(NULL, TRUE);
  128. if(isset($post['page']))
  129. {
  130. $page = $this->input->post('page',true);
  131. $perpage = $this->input->post('perpage',true);
  132. $continent = $this->input->post('continent',true);
  133. $express = $this->input->post('express',true);
  134. $ename = $this->input->post('ename',true);
  135. $zname = $this->input->post('zname',true);
  136. $where = "1=1 ";
  137. if($continent)
  138. {
  139. $where .= " and continent = '$continent'";
  140. }
  141. if($express)
  142. {
  143. $where .= " and express = '$express'";
  144. }
  145. if($ename)
  146. {
  147. $where .= " and ename = '$ename'";
  148. }
  149. if($zname)
  150. {
  151. $where .= " and zname = '$zname'";
  152. }
  153. //数据排序
  154. $order_str = "id asc";
  155. if(empty($page))
  156. {
  157. $start = 0;
  158. $perpage = 1;
  159. }
  160. else
  161. {
  162. $start = ($page - 1)*$perpage;
  163. }
  164. //取得信息列表
  165. $info_list = $this->taxshanghaisk->find_all($where,'id,orderno,charge,accountingdate',$order_str,$start,$perpage);
  166. $total = $this->taxshanghaisk->find_count($where);
  167. $pagenum = ceil($total/$perpage);
  168. $over = $total-($start+$perpage);
  169. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  170. echo json_encode($rows);exit;
  171. }
  172. $this->_Template('tax_shanghai_sk',$this->data);
  173. }
  174. //添加
  175. public function _skadd()
  176. {
  177. $post = $this->input->post(NULL, TRUE);
  178. if(isset($post['apptype']))
  179. {
  180. if($this->taxshanghaisk->insert($post))
  181. {
  182. echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
  183. }
  184. else
  185. {
  186. echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
  187. }
  188. }
  189. $this->_Template('tax_shanghai_sk_add',$this->data);
  190. }
  191. //修改
  192. public function _skedit($arg_array)
  193. {
  194. $post = $this->input->post(NULL, TRUE);
  195. if(isset($post['id']))
  196. {
  197. $id = $this->input->post('id',true);
  198. if($this->taxshanghaisk->save($post,$id))
  199. {
  200. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  201. }
  202. else
  203. {
  204. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  205. }
  206. }
  207. $arg_array = $arg_array[0];
  208. $taxshanghaisk = $this->taxshanghaisk->read($arg_array);
  209. $this->data['taxshanghaisk'] = $taxshanghaisk;
  210. $this->_Template('tax_shanghai_sk_edit',$this->data);
  211. }
  212. }