dever 3 년 전
부모
커밋
9cc7e22bf3

+ 72 - 0
app/mshop/lib/Buy.php

@@ -703,6 +703,13 @@ class Buy
                 'name' => '打印货单',
             );
 
+            $button[] = array
+            (
+                'type' => 'link',
+                'link' => Dever::url('lib/buy.excel_one?type='.$info['type'].'&type_id='.$info['type_id'].'&id='.$info['id'], 'mshop'),
+                'name' => '导出货单',
+            );
+
             if ($info['status'] == 3 && $info['type'] == 1) {
                 $button[] = array
                 (
@@ -1685,4 +1692,69 @@ class Buy
 
         $pdf->out('订货单');
     }
+
+    # 导出单个订单
+    public function excel_one_api()
+    {
+        $this->type = Dever::input('type');
+        $id = Dever::input('id');
+        $type_id = Dever::input('type_id');
+        $data = $this->getView($type_id, $id);
+        $this->excel(array($data));
+    }
+
+    # 导出订单
+    public function excel($data)
+    {
+        if (!$data) {
+            Dever::alert('无导出数据');
+        }
+        $file = '入库订单';
+        $type = Dever::input('search_option_type', $this->type);
+
+        $header = array('所属仓库', '订单号', '商品来源', '发货日期', '商品名称', '商品规格属性', '商品采购价格', '商品数量', '采购总价格', '报损退款状态', '订单状态');
+
+        $table = 'store/info';
+        if ($type == 1) {
+            $header[0] = '所属门店';
+            $header[6] = '商品销售价格';
+            $header[8] = '销售总价格';
+            $table = 'shop/info';
+        }
+
+        $body = array();
+        foreach ($data as $k => $v) {
+            if (!is_array($v)) {
+                continue;
+            }
+            foreach ($v['goods'] as $k1 => $v1) {
+
+                $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
+                if (isset($goods_info['sku'])) {
+                    $sku = $goods_info['sku']['string'];
+                } else {
+                    $sku = '';
+                }
+
+                $d = array
+                (
+                    $v['type_info']['name'],
+                    $v['order_num'],
+                    $v['source_info']['name'],
+                    $v['cdate'],
+                    $goods_info['name'],
+                    $sku,
+                    $v1['price'],
+                    $v1['num'],
+                    $v1['price']*$v1['num'],
+                    $v1['status_name'],
+                    $v['status_name'],
+                );
+
+                $body[] = $d;
+            }
+        }
+
+        Dever::excelExport($body, $header, $file);
+    }
 }

+ 92 - 4
app/mshop/lib/Out.php

@@ -234,7 +234,11 @@ class Out
 
         $config_type = $config['config_type'];
         $config_type = $config_type();
-        $out_type = $config_type[$info['out_type']]['name'];
+        if (isset($config_type[$info['out_type']])) {
+            $out_type = $config_type[$info['out_type']]['name'];
+        } else {
+            $out_type = '其他';
+        }
 
         $cdate = date('Y-m-d H:i', $info['cdate']);
         
@@ -292,6 +296,13 @@ class Out
                 'name' => '打印出库单',
             );
 
+            $button[] = array
+            (
+                'type' => 'link',
+                'link' => Dever::url('lib/out.excel_one?type='.$info['type'].'&id='.$info['id'], 'mshop'),
+                'name' => '导出',
+            );
+
             $button[] = array
             (
                 'type' => 'alert',
@@ -307,6 +318,13 @@ class Out
                 'link' => Dever::url('lib/out.yes?id='.$info['type_id'].'&order_id='.$info['id'], 'mshop'),
                 'name' => '审核',
             );
+
+            $button[] = array
+            (
+                'type' => 'link',
+                'link' => Dever::url('lib/out.excel_one?type='.$info['type'].'&id='.$info['id'], 'mshop'),
+                'name' => '导出',
+            );
         }
 
         $body = array();
@@ -390,7 +408,12 @@ class Out
 
         $config_type = $config['config_type'];
         $config_type = $config_type();
-        $out_type = $config_type[$info['out_type']]['name'];
+        if (isset($config_type[$info['out_type']])) {
+            $out_type = $config_type[$info['out_type']]['name'];
+        } else {
+            $out_type = '其他';
+        }
+        
 
         $cdate = date('Y-m-d H:i', $info['cdate']);
 
@@ -480,13 +503,78 @@ class Out
         $pdf->out('库存清单');
     }
 
+    # 导出单个订单
+    public function excel_one_api()
+    {
+        $this->type = Dever::input('type');
+        $id = Dever::input('id');
+        $data = Dever::db('shop/out_order')->select($id);
+        $this->excel($data);
+    }
+
     # 导出订单
     public function excel($data)
     {
-        print_r($data);die;
+        if (!$data) {
+            Dever::alert('无导出数据');
+        }
         $file = '出库订单';
+        $type = Dever::input('search_option_type', $this->type);
+
+        $header = array('所属仓库', '出库单号', '商品名称', '商品规格属性', '商品采购价格', '商品出库数量', '采购总价格', '出库类型', '出库状态', '出库时间');
+
+        $table = 'store/info';
+        if ($type == 1) {
+            $header[0] = '所属门店';
+            $header[4] = '商品销售价格';
+            $header[6] = '销售总价格';
+            $table = 'shop/info';
+        }
+
+        $body = array();
+        $out_type = Dever::db('shop/out_type')->getAll();
+        $status = Dever::db('shop/out_order')->config['config_status'];
+        foreach ($data as $k => $v) {
+            if (!is_array($v)) {
+                continue;
+            }
+            $type_info = Dever::db($table)->find($v['type_id']);
+            $goods = Dever::db('shop/out_order_goods')->select(array('order_id' => $v['id']));
+            if (isset($out_type[$v['out_type']]) && $out_type[$v['out_type']]) {
+                $out_type_name = $out_type[$v['out_type']]['name'];
+            } else {
+                $out_type_name = '其他';
+            }
+            $status_name = $status[$v['status']];
+
+            $cdate = strstr($v['cdate'], '-') ? $v['cdate'] : date('Y-m-d H:i', $v['cdate']);
+            
+            foreach ($goods as $k1 => $v1) {
+
+                $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
+                if (isset($goods_info['sku'])) {
+                    $sku = $goods_info['sku']['string'];
+                } else {
+                    $sku = '';
+                }
 
-        $header = array();
+                $d = array
+                (
+                    $type_info['name'],
+                    $v['order_num'],
+                    $goods_info['name'],
+                    $sku,
+                    $v1['price'],
+                    $v1['num'],
+                    $v1['price']*$v1['num'],
+                    $out_type_name,
+                    $status_name,
+                    $cdate,
+                );
+
+                $body[] = $d;
+            }
+        }
 
         Dever::excelExport($body, $header, $file);
     }

+ 13 - 2
app/shop/database/out_order.php

@@ -139,7 +139,7 @@ return array
             'desc'      => '价格',
             'match'     => 'option',
             'update'    => 'text',
-            'list_name'      => $search == 1 ? '销售价' : '采购价',
+            'list_name'      => $search == 1 ? '总价' : '采购总价',
             'list'      => true,
         ),
 
@@ -176,7 +176,7 @@ return array
 
         'out_type'        => array
         (
-            'type'      => 'tinyint-1',
+            'type'      => 'int-11',
             'name'      => '类型',
             'default'   => '1',
             'desc'      => '类型',
@@ -221,6 +221,15 @@ return array
         ),
     ),
 
+    'alter' => array
+    (
+        2 => array
+        (
+            array('update', 'out_type', 'out_type', 'int-11 1 出库类型'),
+        ),
+        'version' => 2,
+    ),
+
     'manage' => array
     (
         'delete' => false,
@@ -240,6 +249,8 @@ return array
             'list' => array('查看详情', '"out_order_goods&project=shop&order_id={id}&page_type=1"'),
 
             'oper'  => array('审核', '"mshop/lib/out.yes?id={type_id}&order_id={id}"', '{status} == 1 && {type} == 2'),
+
+            'location' => array('导出', Dever::url('mshop/lib/out.excel_one?type='.$search)),
         ),
     ),
 

+ 9 - 0
app/store/admin/Factory_order.php

@@ -11,7 +11,13 @@ class Factory_order extends Core
         $data = Dever::load('mshop/lib/buy')->set(2, 1)->getList($this->id);
 
         $html = '';
+        $excel = Dever::input('excel', 1);
         if ($data && $data['order']) {
+            if ($excel == 2) {
+                Dever::load('mshop/lib/buy')->set(2, 1)->excel($data['order']);
+                die;
+                return;
+            }
         	foreach ($data['order'] as $k => $v) {
         		if ($v['ps_info']) {
         			$ps_date = $v['ps_info']['cdate'];
@@ -37,6 +43,9 @@ class Factory_order extends Core
                     $v['status_name'] .= '[缺货报损中]';
                 }
 
+                $url = Dever::url('lib/buy.excel_one?type='.$v['type'].'&type_id='.$v['type_id'].'&id='.$v['id'], 'mshop');
+                $button .= '&nbsp;&nbsp;<a href="'.$url.'"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">导出</button></a>';
+
         		$html .= '<tr><td>'.$v['order_num'].'</td><td>'.$ps_date.'</td><td>'.$v['source_info']['name'].'</td><td>'.$ydate.'</td><td>'.$v['price'].'</td><td>'.$v['num'].'</td><td>'.$v['status_name'].'</td><td>'.$button.'</td></tr>';
         	}
         }

+ 9 - 0
app/store/admin/Out.php

@@ -11,7 +11,13 @@ class Out extends Core
         $data = Dever::load('mshop/lib/out')->set(2, 1)->getList($this->id);
 
         $html = '';
+        $excel = Dever::input('excel', 1);
         if ($data && $data['order']) {
+            if ($excel == 2) {
+                Dever::load('mshop/lib/out')->set(2, 1)->excel($data['order']);
+                die;
+                return;
+            }
             foreach ($data['order'] as $k => $v) {
                 $view = Dever::url('out_view?order_id=' . $v['id'] . '&type=2', 'store');
 
@@ -22,6 +28,9 @@ class Out extends Core
                     $button .= '&nbsp;&nbsp;<a href="javascript:;" onclick="load(\''.$url.'\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">取消</button></a>';
                 }
 
+                $url = Dever::url('lib/out.excel_one?type='.$v['type'].'&id='.$v['id'], 'mshop');
+                $button .= '&nbsp;&nbsp;<a href="'.$url.'"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">导出</button></a>';
+
                 $html .= '<tr><td>'.$v['order_num'].'</td><td>'.$v['cdate'].'</td><td>'.$v['type_name'].'</td><td>'.$v['price'].'</td><td>'.$v['num'].'</td><td>'.$v['status_name'].'</td><td>'.$button.'</td></tr>';
             }
         }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
app/store/assets/pc/html/factory_order.html


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
app/store/assets/pc/html/out.html


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.