zoukankan      html  css  js  c++  java
  • 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;    
        }
  • 相关阅读:
    啥是IOC ?啥是DI ?
    Spring是什么?
    Javaweb实训-宠物医院-社区宠物医院登陆页面
    Javaweb实训-宠物医院-社区宠物医院的页面样式
    Bootstrap基础学习(二)
    Bootstrap基础学习(一)
    常用的几种清除float浮动的方法
    jquery的each遍历方法
    正则总结RegExp
    OpenWrt编译到底脚本
  • 原文地址:https://www.cnblogs.com/wesky/p/5505560.html
Copyright © 2011-2022 走看看