123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\controller;
- use think\Request;
- use think\facade\Db;
- class Report extends Base
- {
- /**
- * 显示资源列表
- *
- * @return \think\Response
- */
- public function index()
- {
- $page= isset($this->post['page'])&&$this->post['page']!='' ? intval($this->post['page']) :1;
- $size= isset($this->post['size'])&&$this->post['size']!='' ? intval($this->post['size']) :15;
- $qrdNo =isset($this->post['qrdNo'])&& $this->post['qrdNo']!=''? trim($this->post['qrdNo']):"";
- $cgdNo =isset($this->post['cgdNo'])&& $this->post['cgdNo']!=''? trim($this->post['cgdNo']):"";
- $companyNo =isset($this->post['companyNo'])&& $this->post['companyNo']!=''? trim($this->post['companyNo']):"";
- $supplierNo =isset($this->post['supplierNo'])&& $this->post['supplierNo']!=''? trim($this->post['supplierNo']):"";
- $customerNo =isset($this->post['customerNo'])&& $this->post['customerNo']!=''? trim($this->post['customerNo']):"";
- $payNo =isset($this->post['payNo'])&& $this->post['payNo']!=''? trim($this->post['payNo']):"";
- $dzNo =isset($this->post['dzNo'])&& $this->post['dzNo']!=''? trim($this->post['dzNo']):"";
- $hpNo =isset($this->post['hpNo'])&& $this->post['hpNo']!=''? trim($this->post['hpNo']):"";
- $invNo =isset($this->post['invNo'])&& $this->post['invNo']!=''? trim($this->post['invNo']):"";
- $tradNo =isset($this->post['tradNo'])&& $this->post['tradNo']!=''? trim($this->post['tradNo']):"";
- $logNo =isset($this->post['logNo'])&& $this->post['logNo']!=''? trim($this->post['logNo']):"";
- $returnInv =isset($this->post['returnInv'])&& $this->post['returnInv']!=''? trim($this->post['returnInv']):"";
- $returnTrad =isset($this->post['returnTrad'])&& $this->post['returnTrad']!=''? trim($this->post['returnTrad']):"";
- $seller_id =isset($this->post['seller_id'])&& $this->post['seller_id']!=''? intval($this->post['seller_id']):"";
- $cgder_id =isset($this->post['cgder_id'])&& $this->post['cgder_id']!=''? intval($this->post['cgder_id']):"";
- $cgder =isset($this->post['cgder'])&& $this->post['cgder']!=''? trim($this->post['cgder']):"";
- $seller =isset($this->post['seller'])&& $this->post['seller']!=''? trim($this->post['seller']):"";
- $where=[];
- if($qrdNo!='') $where[]=["qrdNo","like","%$qrdNo%"];
- if($cgdNo!='') $where[]=["cgdNo","like","%$cgdNo%"];
- if($companyNo!='') $where[]=["companyNo","like","%$companyNo%"];
- if($supplierNo!='') $where[]=["supplierNo","like","%$supplierNo%"];
- if($customerNo!='') $where[]=["customerNo","like","%$customerNo%"];
- if($payNo!='') $where[]=["payNo","like","%$payNo%"];
- if($dzNo!='') $where[]=["DzNo","like","%$dzNo%"];
- if($hpNo!='') $where[]=["hpNo","like","%$hpNo%"];
- if($invNo!='') $where[]=["invNo","like","%$invNo%"];
- if($tradNo!='') $where[]=["tradNo","like","%$tradNo%"];
- if($logNo!='') $where[]=["logNo","like","%$logNo%"];
- if($returnInv!='') $where[]=["returnInv","like","%$returnInv%"];
- if($returnTrad!='') $where[]=["returnTrad","like","%$returnTrad%"];
- if($seller_id!='') $where[]=["seller_id","=",$seller_id];
- if($cgder_id!='') $where[]=["cgder_id","=",$cgder_id];
- if($cgder!='') $where[]=["cgder","like","%$cgder%"];
- if($seller!='') $where[]=["seller","like","%$seller%"];
- $count =Db::name("report_code")->where($where)->count();
- $total = ceil($count/$size);
- $page =$page>=$total ? intval($total) : $page;
- $list =Db::name("report_code")->where($where)->page($page,$size)->order("id desc")->select();
- return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
- }
- /**
- * 显示创建资源表单页.
- *
- * @return \think\Response
- */
- public function info()
- {
- $id = isset($this->post['id'])&&$this->post['id']!=""?intval($this->post['id']) :"";
- if($id==''){
- return error_show(1004,"参数 id 不能为空");
- }
- $report =Db::name("report_code")->where(["id"=>$id])->find();
- if($report==false){
- return error_show(1004,"未找到报表数据");
- }
- $report['DzNo'] =$report['DzNo']==""?[]:explode(",",$report['DzNo']);
- $report['hpNo'] =$report['hpNo']==""?[]:explode(",",$report['hpNo']);
- $report['invNo'] =$report['invNo']==""?[]:explode(",",$report['invNo']);
- $report['tradNo'] =$report['tradNo']==""?[]:explode(",",$report['tradNo']);
- $report['logNo'] =$report['logNo']==""?[]:explode(",",$report['logNo']);
- $report['returnInv'] =$report['returnInv']==""?[]:explode(",",$report['returnInv']);
- $report['returnTrad'] =$report['returnTrad']==""?[]:explode(",",$report['returnTrad']);
- return app_show(0,"获取成功",$report);
- }
- /**
- * 保存新建的资源
- *
- * @param \think\Request $request
- * @return \think\Response
- */
- public function save(Request $request)
- {
- //
- }
- /**
- * 显示指定的资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function read($id)
- {
- //
- }
- /**
- * 显示编辑资源表单页.
- *
- * @param int $id
- * @return \think\Response
- */
- public function edit($id)
- {
- //
- }
- /**
- * 保存更新的资源
- *
- * @param \think\Request $request
- * @param int $id
- * @return \think\Response
- */
- public function update(Request $request, $id)
- {
- //
- }
- /**
- * 删除指定资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function delete($id)
- {
- //
- }
- }
|