Переглянути джерело

Merge branch 'wugg-dev' of wugg/phpstock into version1.5

wugg 2 роки тому
батько
коміт
ffdb6c175b
2 змінених файлів з 9 додано та 5 видалено
  1. 4 2
      app/admin/controller/Purch.php
  2. 5 3
      app/admin/controller/Purchin.php

+ 4 - 2
app/admin/controller/Purch.php

@@ -111,8 +111,10 @@ class Purch extends Base
         $role=$this->checkRole();
         $whereor=[];
         if(!empty($role['write'])){
-            $whereor[]=["po.cgder_id","in",$role['write']];
-            $whereor[]=["sip.personid","=",$this->uid];
+//            $whereor[]=["po.cgder_id","in",$role['write']];
+//            $whereor[]=["sip.personid","=",$this->uid];
+            $whereor[]=["sip.personid","in",$role['write']];
+            $whereor[]=["po.cgder_id","=",$this->uid];
         }
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["po.cgder_id", 'in', get_company_item_user_by_name($company_name)];

+ 5 - 3
app/admin/controller/Purchin.php

@@ -83,14 +83,15 @@ class Purchin extends Base
         $role=$this->checkRole();
         $condition="";
         if(!empty($role['write'])&& $this->uid!=''){
-//            $condition.=["apply_id","in",$role['write']];
-            $condition.="a.apply_id in (".implode(",",$role['write']).") or c.contactor = {$this->uid}";
+            $condition.="a.apply_id ={$this->uid} or c.contactor = {$this->uid} or sip.personid in (".implode(",",$role ['write']).")";
         }
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["a.apply_id", 'in', get_company_item_user_by_name($company_name)];
 
 
-        $count = Db::name('purchease_in')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
+        $count = Db::name('purchease_in')->alias('a')
+            ->join("purchease_order b","b.cgdNo=a.cgdNo","left")
+            ->leftJoin('supplier sip', 'sip.code=b.supplierNo')
             ->leftJoin("warehouse_info c","a.wsm_code=c.wsm_code")
             ->where($where)->where($condition)->count();
         $total = ceil($count/$size);
@@ -98,6 +99,7 @@ class Purchin extends Base
         $list = Db::name('purchease_in')
             ->alias('a')
             ->join("purchease_order b","b.cgdNo=a.cgdNo","left")
+            ->leftJoin('supplier sip', 'sip.code=b.supplierNo')
             ->leftJoin("warehouse_info c","a.wsm_code=c.wsm_code")
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
             ->where($where)