wugg пре 2 година
родитељ
комит
145fe0923f
2 измењених фајлова са 158 додато и 0 уклоњено
  1. 129 0
      app/admin/controller/Report.php
  2. 29 0
      app/admin/model/ReportCode.php

+ 129 - 0
app/admin/controller/Report.php

@@ -0,0 +1,129 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\admin\BaseController;
+use think\Request;
+use think\facade\Db;
+
+class Report extends BaseController
+{
+    /**
+     * 显示资源列表
+     *
+     * @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 create()
+    {
+        //
+    }
+
+    /**
+     * 保存新建的资源
+     *
+     * @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)
+    {
+        //
+    }
+}

+ 29 - 0
app/admin/model/ReportCode.php

@@ -0,0 +1,29 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class ReportCode extends Model
+{
+
+    public  function setField($filed,$vale){
+        $arr= explode(",",$this->$filed);
+       if(!in_array($vale,$arr)) $this->$filed == '' ? $this->$filed =$vale : $this->$filed .=",".$vale;
+    }
+    public function rmField($filed,$vale){
+          $arr= explode(",",$this->$filed);
+          if(in_array($vale,$arr)){
+            $key = array_search($vale,$arr);
+            unset($arr[$key]);
+          }
+         $this->$filed=implode(",",$arr);
+    }
+    public function __destruct(){
+      $this->save();
+    }
+}