dever il y a 3 ans
Parent
commit
029e5eafa3
2 fichiers modifiés avec 16 ajouts et 6 suppressions
  1. 15 3
      app/cash/lib/Cron.php
  2. 1 3
      app/mshop/src/Out.php

+ 15 - 3
app/cash/lib/Cron.php

@@ -56,7 +56,6 @@ class Cron
         $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, 1);
@@ -125,12 +124,24 @@ 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);
         }
 
+        if ($id > 0 && $type == 'store') {
+
+            $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;
+            Dever::db('cash/' . $type)->update($data);
+        }
+
         if (($type == 'factory' || $type == 'store') && Dever::project('message') && $id) {
             $msg_param['type'] = 2;//消息头类型2是对账单消息
             $msg_param['id'] = $id;
@@ -138,5 +149,6 @@ class Cron
             $msg = '您的'.Dever::load('cash/lib/set')->statDate($data['type'], $data['day']).'对账单已经生成,请您及时确认,确认之后方可结算';
             Dever::load('message/lib/data')->push(-1, $info['id'], '对账通知', $msg, 6, $msg_type, false, $msg_param);
         }
+        return $id;
     }
 }

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

@@ -129,8 +129,6 @@ class Out extends Core
 
         $print = Dever::load('mshop/lib/feieyun');
 
-        $cdate = date('Y-m-d H:i', $data['cdate']);
-
         $config = Dever::db('shop/out_order')->config;
 
         $status = $config['config_status'][$data['status']];
@@ -142,7 +140,7 @@ class Out extends Core
         $print->text('门店名称:' . $this->shop['name']);
         $print->text('制 单 人:'.$this->user['name']);
         $print->text('制单时间:'.date('Y-m-d H:i'));
-        $print->text('出库时间:'.$cdate);
+        $print->text('出库时间:'.$data['cdate']);
         
         if ($data && $data['goods']) {