• ecshop 导出exl表格


    // 导出订单
        if(isset($_POST['export'])){
            
            // 统计金额
            $sl = "SELECT SUM(goods_amount) as total from".$ecs->table('depot_order')." where order_id in($order_id)";
            $total = $db->getRow($sl);
            //print_r($total);exit;
            
            // 商品关联订单
            $sql = "SELECT o.order_sn,g.goods_name,g.goods_price,g.goods_number,(g.goods_number*g.goods_price) as goods_total FROM ".$ecs->table('depot_order')." AS o,".$ecs->table('depot_goods')." AS g where g.order_id = o.order_id and o.order_id in($order_id)";
            $result = $db->getAll($sql);
            
            
            //表格格式
            $file_name = '微仓订单';
            header("Content-type: application/vnd.ms-excel; charset=utf-8");
            header("Content-Disposition: attachment; filename=$file_name.xls");
    
            /* 文件标题 */
           // echo ecs_iconv(EC_CHARSET, 'GB2312', $_REQUEST['start_date']. $_LANG['to'] .$_REQUEST['end_date']. $_LANG['sales_list']) . "	
    ";
    
            /* 商品名称,订单号,商品数量,销售价格,销售日期 */
            echo ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['goods_name']) . "	";
            echo ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['order_sn']) . "	";
            echo ecs_iconv(EC_CHARSET, 'GB2312', '数量') . "	";
            echo ecs_iconv(EC_CHARSET, 'GB2312', '商品单价') . "	";
            echo ecs_iconv(EC_CHARSET, 'GB2312', '商品总价') . "	";
            echo "
    ";
    
    
            foreach ($result AS $key => $value)
            {
                echo ecs_iconv(EC_CHARSET, 'GB2312', $value['goods_name']) . "	";
                echo ecs_iconv(EC_CHARSET, 'GB2312', $value['order_sn'] ) . "	";
                echo ecs_iconv(EC_CHARSET, 'GB2312', $value['goods_number']) . "	";
                echo ecs_iconv(EC_CHARSET, 'GB2312', $value['goods_price']) . "	";
                echo ecs_iconv(EC_CHARSET, 'GB2312', $value['goods_total']) . "	";
                echo "
    ";
            }
            
            
                
            echo "
    ";
            echo ecs_iconv(EC_CHARSET, 'GB2312', '统计') . "	";
            echo ecs_iconv(EC_CHARSET, 'GB2312', $total['total']) . "	";
            
            exit;    
        }
  • 相关阅读:
    Ubuntu 开机启动是出现 grub rescue 解决办法
    OpenvSwitch Port Mirror in OpenStack Neutron
    Protobuf 在Ubuntu 14上的编译与使用
    Linux screen 常用命令
    OpenStack/devstack with Neutron on Ubuntu 14 (1)
    osprofiler在openstack Cinder里的使用
    基于SSH协议的端口转发
    HA 技术简介
    Socket Receive数据一次性接收不全的问题
    【转】本文对C#虚函数virtual进行详解。
  • 原文地址:https://www.cnblogs.com/wesky/p/5505560.html
Copyright © 2020-2023  润新知