Report.php 5.7 KB

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