dever 3 年之前
父節點
當前提交
233ea288f8
共有 5 個文件被更改,包括 47 次插入17 次删除
  1. 21 2
      app/cash/database/order.php
  2. 5 6
      app/cash/lib/Cron.php
  3. 11 4
      app/cash/lib/Set.php
  4. 9 4
      app/mshop/lib/Buy.php
  5. 1 1
      app/shop/database/out_order.php

+ 21 - 2
app/cash/database/order.php

@@ -423,8 +423,27 @@ return array
                 'type_id' => 'yes',
                 'source_type' => 'yes',
                 'source_id' => 'yes',
-                'source_type_or' => array('yes-source_type', 'or'),
-                'source_id_or' => array('yes-source_id', 'or'),
+                //'source_type_or' => array('yes-source_type', 'or'),
+                //'source_id_or' => array('yes-source_id', 'or'),
+                'status' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getAllByStore' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'type' => array('yes-type', '=', 'and (( '),
+                'type_id' => array('yes-type_id', '=', 'and )'),
+                'source_type' => array('yes-source_type', '=', 'or ( '),
+                'source_id' => array('yes-source_id', '=', 'and )) '),
                 'status' => array('yes', 'in'),
                 'state' => 1,
             ),

+ 5 - 6
app/cash/lib/Cron.php

@@ -59,10 +59,6 @@ class Cron
             $where['type'] = 2;
             $where['type_id'] = $v['id'];
             $this->up($where, $v, 'store', $num, 1);
-
-            $w['source_type'] = 2;
-            $w['source_id'] = $v['id'];
-            $this->up($w, $v, 'store', $num, 2);
         }
     }
 
@@ -129,13 +125,16 @@ class Cron
         }
 
         if ($id > 0 && $type == 'store') {
-
+            $where['source_type'] = $where['type'];
+            $where['source_id'] = $where['type_id'];
+            unset($where['type']);
+            unset($where['type_id']);
             $cash = Dever::db('cash/order')->getCash($where);
             $up['cash'] = $cash['total'] ? $cash['total'] : 0;
 
             $num = Dever::db('cash/order')->getNum($where);
             $up['num'] = $num['total'] ? $num['total'] : 0;
-            $data = array();
+
             $data['cash'] += $up['cash'];
             $data['num'] += $up['num'];
             $data['where_id'] = $id;

+ 11 - 4
app/cash/lib/Set.php

@@ -103,10 +103,13 @@ class Set
 
         $type = Dever::input('type', 'shop');
         if ($type == 'shop') {
+            $search_option_type = 1;
             $name = '门店';
         } elseif ($type == 'store') {
+            $search_option_type = 3;
             $name = '仓库';
         } elseif ($type == 'factory') {
+            $search_option_type = 2;
             $name = '工厂';
         }
 
@@ -220,19 +223,23 @@ class Set
         if ($type == 'shop') {
             $where['type'] = 1;
             $where['type_id'] = $id;
+            $m = 'getAll';
         } elseif ($type == 'factory') {
             $where['source_type'] = 3;
             $where['source_id'] = $id;
+            $m = 'getAll';
         } else {
             $where['type'] = 2;
             $where['type_id'] = $id;
-            //$where['source_type_or'] = 2;
-            //$where['source_id_or'] = $id;
+            $where['source_type'] = 2;
+            $where['source_id'] = $id;
+            $m = 'getAllByStore';
         }
         $where['status'] = 2;
         $where['start'] = $info['start'];
         $where['end'] = $info['end'];
-        $data = Dever::db('cash/order')->getAll($where);
+        $data = Dever::db('cash/order')->$m($where);
+
         if ($data) {
             
             $body = array();
@@ -250,7 +257,7 @@ class Set
                 }
 
                 if ($show == 1) {
-                    $url = Dever::url('project/database/list?project=shop&table=buy_order_goods&order_id='.$v['source_order_id'].'&page_type=1', 'manage');
+                    $url = Dever::url('project/database/list?project=shop&table=buy_order_goods&order_id='.$v['source_order_id'].'&page_type=1&type=' . $search_option_type, 'manage');
                     $v['source_order_num'] = '<a href="'.$url.'" style="color:blue">'.$v['source_order_num'].'</a>';
 
                     $head = array('结算单号', '订货单号', '结算类型', '下单日期', '完成日期', '结算日期', '对账金额', '结算状态');

+ 9 - 4
app/mshop/lib/Buy.php

@@ -987,8 +987,8 @@ class Buy
             );
         }
 
-        if ($cash_type == 1) {
-            $search_option_type = Dever::input('search_option_type', 1);
+        $search_option_type = Dever::input('search_option_type');
+        if ($cash_type == 1 && $search_option_type) {
             if ($search_option_type == 1) {
                 # 门店结算单
                 $cash_order = Dever::db('cash/order')->select(array('type' => $info['type'], 'type_id' => $info['type_id'], 'source_order_id' => $info['id']));
@@ -1000,6 +1000,11 @@ class Buy
                 $cash_order = Dever::db('cash/order')->select(array('source_type' => $info['source_type'], 'source_id' => $info['source_id'], 'source_order_id' => $info['id']));
 
                 $col = 'p_cash';
+            } elseif ($search_option_type == 3) {
+                # 仓库结算单
+                $cash_order = Dever::db('cash/order')->select(array('type' => $info['source_type'], 'type_id' => $info['source_id'], 'source_order_id' => $info['id']));
+
+                $col = 'num';
             }
         }
         
@@ -1007,7 +1012,7 @@ class Buy
         if (isset($cash_order) && $cash_order) {
             $head = array('序号', '结算单号', '数量', '金额', '结算类型', '入账状态', '审核状态', '结算时间', '审核未通过原因', '管理');
 
-            if ($type == 3) {
+            if ($search_option_type == 3) {
                 unset($head[3]);
             }
 
@@ -1042,7 +1047,7 @@ class Buy
                     $m,
                 );
 
-                if ($type == 3) {
+                if ($search_option_type == 3) {
                     unset($d[3]);
                 }
                 $body[] = $d;

+ 1 - 1
app/shop/database/out_order.php

@@ -45,7 +45,7 @@ if ($search == 1) {
     $search_name = '所属门店';
     $search_option = $shop;
     $search_url = 'shop/lib/manage.search';
-} elseif ($search == 2) {
+} elseif ($search != 1) {
     $search_name = '所属仓库';
     $search_option = $store;
     $search_url = 'store/lib/manage.search';