Browse Source

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

wugg 2 years ago
parent
commit
47fa8cf5e0
2 changed files with 54 additions and 3 deletions
  1. 2 2
      app/admin/controller/Reorder.php
  2. 52 1
      app/command/NowReportHandle.php

+ 2 - 2
app/admin/controller/Reorder.php

@@ -113,8 +113,8 @@ class Reorder extends Base
                             Db::rollback();
                             return error_show(1005,"地址信息未找到");
                         }
-                        $send =Db::name('order_out')->where([["addrid","=",$val['id']],["status",">=",2]])->find();
-                        if($send!=false){
+                        $send =Db::name('order_out')->where([["addrid","=",$val['id']]])->find();
+                        if($send['status']>=2){
                             Db::rollback();
                             return error_show(1005,"地址已发货");
                         }

+ 52 - 1
app/command/NowReportHandle.php

@@ -55,7 +55,9 @@ class NowReportHandle extends Command
                     case 'D':
                         $res = $this->D($info['start'], $info['end']);
                         break;
-
+                    case 'E':
+                        $res = $this->E($info['start'], $info['end']);
+                        break;
                     default:
                         throw new Exception('暂不支持这个报表');
                 }
@@ -325,4 +327,53 @@ class NowReportHandle extends Command
             return $data;
         }
 
+    public function E($start,$end){
+        $list =Db::name("purchease_in")->alias('wpi')->leftJoin("purchease_order wpo","wpo.cgdNo=wpi.cgdNo")
+            ->leftJoin("purchease wp","wpo.bkcode=wp.bk_code")
+            ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode")
+            ->leftJoin("warehouse_info wwi","wwi.wsm_code = wpo.wsm_code")
+            ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
+            ->where('wpi.status',"in", [4,6])
+            ->whereBetween('wpi.addtime', [$start, $end])
+            ->field(" wpo.companyNo '业务公司',
+    bkcode '备库单号',
+    wpi.cgdNo '采购单号',
+       wpo.skuCode '商品编号',
+       '' as '一级分类',
+       '' as '二级分类',
+        cat_id as '三级分类',
+        cat_id as '财务核算编号',
+       wpo.good_name as '商品名称',
+    wpi.send_num '入库数量',
+       round(wpi.send_num* good_price,2) '入库金额',
+       wpo.updatetime '本次入库时间',
+    wgb.tax/100 '采购税率',
+    '' as '不含税入库金额',
+    ''  as '税额',
+       wp.apply_id as '业务部门',
+       wp.apply_name as '业务员',
+      wpo.cgder as '采购员',
+       nake_fee '成本裸价',
+       wsm_type '仓库类型',
+       ws.name '供应商名称',
+       wwi.name '仓库名称'
+             ")->cursor();
+        $data=[];
+        foreach($list as $value){
+            $value['业务公司'] = Db::name("business")->where(["companyNo"=>$value['业务公司']])->value('company','');
+            $value['业务部门'] = Db::name("depart_user")->alias("a")->leftJoin("company_item ci","a.itemid=ci.id")
+                ->where(["a.uid"=>$value['业务部门'],"a.status"=>1,"a.is_del"=>0])->value('ci.name','');
+            $cat =made($value['三级分类']);
+            $value['财务核算编码'] =Db::name("cat")->where(["id"=>$value['三级分类']])->value("fund_code",'');
+            $value['一级分类']=isset($cat[0]['name'])?$cat[0]['name']:"";
+            $value['二级分类']=isset($cat[1]['name'])?$cat[1]['name']:"";
+            $value['三级分类']=isset($cat[2]['name'])?$cat[2]['name']:"";
+            $value['不含税入库金额']= round($value['入库金额']/(1+$value['采购税率']),2);
+            $value['税额']= round(($value['入库金额']/(1+$value['采购税率'])) *$value['采购税率'],2);
+            $value['仓库类型'] = Db::name("warehouse_type")->where(["id"=>$value['仓库类型']])->value("name",'');
+            yield $data[] = $value;
+        }
+        return $data;
+    }
+
 }