Преглед на файлове

Merge branch 'master' of http://git.dever.cc/dever-product/churen

Your Name преди 2 години
родител
ревизия
bd2616314d
променени са 4 файла, в които са добавени 26 реда и са изтрити 11 реда
  1. 3 1
      app/cash/lib/Set.php
  2. 3 4
      app/shop/lib/Sell.php
  3. 17 3
      app/shop/src/Excel.php
  4. 3 3
      service/bill/database/order_stat.php

+ 3 - 1
app/cash/lib/Set.php

@@ -39,7 +39,9 @@ class Set
 
         $info = is_array($info) ? $info : Dever::db($table)->one($info);
         $other = Dever::db($type . '/info')->find($info[$type . '_id']);
-
+        if (!$other) {
+            return '';
+        }
         if ($type == 'store') {
             return $this->statDate($info['type'], $info['day']) . '与'.$other['name'].'对账单数量是否正确<br />对账数量' . $info['num'] . '个';
         }

+ 3 - 4
app/shop/lib/Sell.php

@@ -630,13 +630,12 @@ class Sell
                                 $price = $data['price'];
                             }
 
-                            if ($card_cash >= $price) {
+                            if ($card_cash > $price) {
                                 $data['card']['cash'] = $price;
-                                $data['price'] = 0;
                             } else {
                                 $data['card']['cash'] = $card_cash;
-                                $data['price'] -= $data['card']['cash'];
                             }
+                            $data['price'] -= $data['card']['cash'];
 
                             if ($xian && ($price <= 0 || ($card_code['info']['min'] > 0 && $price < $card_code['info']['min']))) {
                                 # 不满足限额
@@ -1420,7 +1419,7 @@ class Sell
             $opertime = '';
         }
 
-        if ($info['fdate']) {
+        if ($info['fdate'] && $info['fdate'] > 0) {
             $fdate = date('Y-m-d H:i', $info['fdate']);
         } else {
             $fdate = '';

+ 17 - 3
app/shop/src/Excel.php

@@ -160,7 +160,7 @@ class Excel
         }
         $file = Dever::input('excel_name');
 
-        $header = array('订单号', '收件人', '收件人手机', '收件人地址', '商品编码', '商品名称', '规格型号', '商品单价', '购买数量', '商品合计金额', '下单时间', '付款时间', '发货时间', '收货时间' , '订单总数量', '订单总金额', '订单实付金额', '订单状态', '退款状态', '退款金额');
+        $header = array('订单号', '收件人', '收件人手机', '收件人地址', '商品编码', '商品名称', '规格型号', '商品单价', '购买数量', '商品合计金额', '商品支付金额', '下单时间', '付款时间', '发货时间', '收货时间' , '订单总数量', '订单总金额', '订单实付金额', '订单状态', '退款状态', '退款金额');
 
         $table = 'shop/info';
 
@@ -184,12 +184,17 @@ class Excel
             $cdate = strstr($v['cdate'], '-') ? $v['cdate'] : date('Y-m-d H:i', $v['cdate']);
             $paydate = isset($v['paydate']) && $v['paydate'] ? date('Y-m-d H:i', $v['paydate']) : '-';
             $operdate = ($ps && $ps['cdate']) ? date('Y-m-d H:i', $ps['cdate']) : '-';
-            $fdate = strstr($v['fdate'], '-') ? $v['fdate'] : date('Y-m-d H:i', $v['fdate']);
+            if ($v['fdate']) {
+                $fdate = strstr($v['fdate'], '-') ? $v['fdate'] : date('Y-m-d H:i', $v['fdate']);
+            } else {
+                $fdate = '-';
+            }
             
             $refund_status = Dever::load("shop/lib/manage.buyInfoRefundStatus", $v['id'], 'sell_order');
             $total_cash = Dever::load("shop/lib/manage.getTotalCash", $v['id']);
             $v['refund_cash'] = $v['refund_cash'] ? $v['refund_cash'] : 0;
             $address = Dever::load('passport/address')->getOne($v['uid'], $v['address_id']);
+
             foreach ($goods as $k1 => $v1) {
 
                 $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
@@ -209,6 +214,12 @@ class Excel
                     $refund_status = '未退款';
                 }
 
+                if ($k1 == 0) {
+                    $goods_price = $v['price'];
+                } else {
+                    $goods_price = 0;
+                }
+
                 $d = array
                 (
                     $v['order_num'],
@@ -223,6 +234,7 @@ class Excel
                     $v1['price'],
                     $v1['num'],
                     $v1['price']*$v1['num'],
+                    $goods_price,
 
                     $cdate,
                     $paydate,
@@ -241,7 +253,7 @@ class Excel
 
                 if ($goods_info['price_type'] > 2 && isset($goods_info['goods']) && is_array($goods_info['goods'])) {
                     
-                    foreach ($goods_info['goods'] as $v2) {
+                    foreach ($goods_info['goods'] as $k2 => $v2) {
                         if ($v2['code']) {
                             //$v2['code'] = '-' . $v2['code'];
                         }
@@ -249,6 +261,7 @@ class Excel
                         if (is_numeric($v2['num']) && is_numeric($v2['price'])) {
                             $p = $v2['price']*$v2['num'];
                         }
+                        $goods_price1 = 0;
                         $d = array
                         (
                             $v['order_num'],
@@ -263,6 +276,7 @@ class Excel
                             $v2['price'],
                             $v2['num'],
                             $p,
+                            $goods_price1,
 
                             $cdate,
                             $paydate,

+ 3 - 3
service/bill/database/order_stat.php

@@ -36,7 +36,7 @@ $config = array
             'search'    => 'day',
             'search_button' => array
             (
-                'sum' => 'num,yes_num,cash,daili_num',
+                'sum' => 'num,yes_num,cash,daili_num,agent_cash,no_num,no_cash',
                 'option' => array(
                     'day' => '按天',
                     'week' => '按周',
@@ -174,7 +174,7 @@ $config = array
             'order' => array('time' => 'desc', 'cdate' => 'desc'),
             'page' => array(20, 'list'),
             'group' => 'day',//num,yes_num,cash,daili_num
-            'col' => '*,min(day) as time, sum(yes_num) as yes_num, sum(num) as num, sum(cash) as cash, sum(daili_num) as daili_num',
+            'col' => '*,min(day) as time, sum(yes_num) as yes_num, sum(num) as num, sum(cash) as cash, sum(daili_num) as daili_num, sum(agent_cash) as agent_cash, sum(no_cash) as no_cash, sum(no_num) as no_num',
         ),
 
         'all' => array
@@ -189,7 +189,7 @@ $config = array
             'type' => 'all',
             'order' => array('time' => 'desc', 'cdate' => 'desc'),
             'group' => 'day',//num,yes_num,cash,daili_num
-            'col' => '*,min(day) as time, sum(yes_num) as yes_num, sum(num) as num, sum(cash) as cash, sum(daili_num) as daili_num',
+            'col' => '*,min(day) as time, sum(yes_num) as yes_num, sum(num) as num, sum(cash) as cash, sum(daili_num) as daili_num, sum(agent_cash) as agent_cash, sum(no_cash) as no_cash, sum(no_num) as no_num',
         ),
     ),
 );