Report.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\controller;
  4. use app\admin\BaseController;
  5. use think\Request;
  6. use think\facade\Db;
  7. class Report extends BaseController
  8. {
  9. /**
  10. * 显示资源列表
  11. *
  12. * @return \think\Response
  13. */
  14. public function index()
  15. {
  16. $page= isset($this->post['page'])&&$this->post['page']!='' ? intval($this->post['page']) :1;
  17. $size= isset($this->post['size'])&&$this->post['size']!='' ? intval($this->post['size']) :15;
  18. $qrdNo =isset($this->post['qrdNo'])&& $this->post['qrdNo']!=''? trim($this->post['qrdNo']):"";
  19. $cgdNo =isset($this->post['cgdNo'])&& $this->post['cgdNo']!=''? trim($this->post['cgdNo']):"";
  20. $companyNo =isset($this->post['companyNo'])&& $this->post['companyNo']!=''? trim($this->post['companyNo']):"";
  21. $supplierNo =isset($this->post['supplierNo'])&& $this->post['supplierNo']!=''? trim($this->post['supplierNo']):"";
  22. $customerNo =isset($this->post['customerNo'])&& $this->post['customerNo']!=''? trim($this->post['customerNo']):"";
  23. $payNo =isset($this->post['payNo'])&& $this->post['payNo']!=''? trim($this->post['payNo']):"";
  24. $dzNo =isset($this->post['dzNo'])&& $this->post['dzNo']!=''? trim($this->post['dzNo']):"";
  25. $hpNo =isset($this->post['hpNo'])&& $this->post['hpNo']!=''? trim($this->post['hpNo']):"";
  26. $invNo =isset($this->post['invNo'])&& $this->post['invNo']!=''? trim($this->post['invNo']):"";
  27. $tradNo =isset($this->post['tradNo'])&& $this->post['tradNo']!=''? trim($this->post['tradNo']):"";
  28. $logNo =isset($this->post['logNo'])&& $this->post['logNo']!=''? trim($this->post['logNo']):"";
  29. $returnInv =isset($this->post['returnInv'])&& $this->post['returnInv']!=''? trim($this->post['returnInv']):"";
  30. $returnTrad =isset($this->post['returnTrad'])&& $this->post['returnTrad']!=''? trim($this->post['returnTrad']):"";
  31. $seller_id =isset($this->post['seller_id'])&& $this->post['seller_id']!=''? intval($this->post['seller_id']):"";
  32. $cgder_id =isset($this->post['cgder_id'])&& $this->post['cgder_id']!=''? intval($this->post['cgder_id']):"";
  33. $cgder =isset($this->post['cgder'])&& $this->post['cgder']!=''? trim($this->post['cgder']):"";
  34. $seller =isset($this->post['seller'])&& $this->post['seller']!=''? trim($this->post['seller']):"";
  35. $where=[];
  36. if($qrdNo!='') $where[]=["qrdNo","like","%$qrdNo%"];
  37. if($cgdNo!='') $where[]=["cgdNo","like","%$cgdNo%"];
  38. if($companyNo!='') $where[]=["companyNo","like","%$companyNo%"];
  39. if($supplierNo!='') $where[]=["supplierNo","like","%$supplierNo%"];
  40. if($customerNo!='') $where[]=["customerNo","like","%$customerNo%"];
  41. if($payNo!='') $where[]=["payNo","like","%$payNo%"];
  42. if($dzNo!='') $where[]=["DzNo","like","%$dzNo%"];
  43. if($hpNo!='') $where[]=["hpNo","like","%$hpNo%"];
  44. if($invNo!='') $where[]=["invNo","like","%$invNo%"];
  45. if($tradNo!='') $where[]=["tradNo","like","%$tradNo%"];
  46. if($logNo!='') $where[]=["logNo","like","%$logNo%"];
  47. if($returnInv!='') $where[]=["returnInv","like","%$returnInv%"];
  48. if($returnTrad!='') $where[]=["returnTrad","like","%$returnTrad%"];
  49. if($seller_id!='') $where[]=["seller_id","=",$seller_id];
  50. if($cgder_id!='') $where[]=["cgder_id","=",$cgder_id];
  51. if($cgder!='') $where[]=["cgder","like","%$cgder%"];
  52. if($seller!='') $where[]=["seller","like","%$seller%"];
  53. $count =Db::name("report_code")->where($where)->count();
  54. $total = ceil($count/$size);
  55. $page =$page>=$total ? intval($total) : $page;
  56. $list =Db::name("report_code")->where($where)->page($page,$size)->order("id desc")->select();
  57. return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
  58. }
  59. /**
  60. * 显示创建资源表单页.
  61. *
  62. * @return \think\Response
  63. */
  64. public function info()
  65. {
  66. $id = isset($this->post['id'])&&$this->post['id']!=""?intval($this->post['id']) :"";
  67. if($id==''){
  68. return error_show(1004,"参数 id 不能为空");
  69. }
  70. $report =Db::name("report_code")->where(["id"=>$id])->find();
  71. if($report==false){
  72. return error_show(1004,"未找到报表数据");
  73. }
  74. $report['DzNo'] =$report['DzNo']==""?[]:explode(",",$report['DzNo']);
  75. $report['hpNo'] =$report['hpNo']==""?[]:explode(",",$report['hpNo']);
  76. $report['invNo'] =$report['invNo']==""?[]:explode(",",$report['invNo']);
  77. $report['tradNo'] =$report['tradNo']==""?[]:explode(",",$report['tradNo']);
  78. $report['logNo'] =$report['logNo']==""?[]:explode(",",$report['logNo']);
  79. $report['returnInv'] =$report['returnInv']==""?[]:explode(",",$report['returnInv']);
  80. $report['returnTrad'] =$report['returnTrad']==""?[]:explode(",",$report['returnTrad']);
  81. return app_show(0,"获取成功",$report);
  82. }
  83. /**
  84. * 保存新建的资源
  85. *
  86. * @param \think\Request $request
  87. * @return \think\Response
  88. */
  89. public function save(Request $request)
  90. {
  91. //
  92. }
  93. /**
  94. * 显示指定的资源
  95. *
  96. * @param int $id
  97. * @return \think\Response
  98. */
  99. public function read($id)
  100. {
  101. //
  102. }
  103. /**
  104. * 显示编辑资源表单页.
  105. *
  106. * @param int $id
  107. * @return \think\Response
  108. */
  109. public function edit($id)
  110. {
  111. //
  112. }
  113. /**
  114. * 保存更新的资源
  115. *
  116. * @param \think\Request $request
  117. * @param int $id
  118. * @return \think\Response
  119. */
  120. public function update(Request $request, $id)
  121. {
  122. //
  123. }
  124. /**
  125. * 删除指定资源
  126. *
  127. * @param int $id
  128. * @return \think\Response
  129. */
  130. public function delete($id)
  131. {
  132. //
  133. }
  134. }