dever 3 years ago
parent
commit
1fb4095547
2 changed files with 11 additions and 8 deletions
  1. 10 7
      app/cash/lib/Cron.php
  2. 1 1
      app/mshop/src/Out.php

+ 10 - 7
app/cash/lib/Cron.php

@@ -51,18 +51,19 @@ class Cron
     {
         $num = Dever::input('num', 1);
 
-        $where['status'] = 2;
+        $where['status'] = $w['status'] = 2;
        
         $store = Dever::db('store/info')->select();
 
         foreach ($store as $k => $v) {
+            $where['status'] = 2;
             $where['type'] = 2;
             $where['type_id'] = $v['id'];
-            $this->up($where, $v, 'store', $num);
+            $this->up($where, $v, 'store', $num, 1);
 
-            //$where['source_type'] = 2;
-            //$where['source_id'] = $v['id'];
-            //$this->up($where, $v, 'store', $num);
+            $w['source_type'] = 2;
+            $w['source_id'] = $v['id'];
+            $this->up($w, $v, 'store', $num, 2);
         }
     }
 
@@ -82,7 +83,7 @@ class Cron
         }
     }
 
-    private function up($where, $info, $type, $num)
+    private function up($where, $info, $type, $num, $k = 1)
     {
         $state = $this->check($info);
         if (!$state) {
@@ -105,8 +106,8 @@ class Cron
         $data[$type . '_id'] = $info['id'];
         $data['type'] = $info['stat_type'];
         $data['day'] = $start;
+        $data['t'] = $k;
         $find = Dever::db('cash/' . $type)->find($data);
-
         if ($type == 'factory') {
             $msg_type = 4;
             $cash = Dever::db('cash/order')->getPCash($where);
@@ -124,6 +125,8 @@ class Cron
         if (!$find) {
             $id = Dever::db('cash/' . $type)->insert($data);
         } else {
+            $data['cash'] += $find['cash'];
+            $data['num'] += $find['num'];
             $id = $data['where_id'] = $find['id'];
             Dever::db('cash/' . $type)->update($data);
         }

+ 1 - 1
app/mshop/src/Out.php

@@ -138,7 +138,7 @@ class Out extends Core
         $out_type = $config['config_type'][$data['out_type']];
 
         $print->hr('-', $main_config['name'])->br();
-        $print->text('单号:' . $order['order_num'], 'CB')->br();
+        $print->text('单号:' . $data['order_num'], 'CB')->br();
         $print->text('门店名称:' . $this->shop['name']);
         $print->text('制 单 人:'.$this->user['name']);
         $print->text('制单时间:'.date('Y-m-d H:i:s'));