$filename = ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['guest_statistics']);
header("Content-type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename.xls");
/* 生成会员购买率 */
$data = $_LANG['percent_buy_member'] . "
";
$data .= $_LANG['member_count'] . " " . $_LANG['order_member_count'] . " " .
$_LANG['member_order_count'] . " " . $_LANG['percent_buy_member'] . "
";
$data .= $user_num . " " . $have_order_usernum . " " .
$user_all_order['order_num'] . " " . sprintf("%0.2f", ($user_num > 0 ? $have_order_usernum / $user_num : 0) * 100) . "
";
/* 每会员平均订单数及购物额 */
$data .= $_LANG['order_turnover_peruser'] . "
";
$data .= $_LANG['member_sum'] . " " . $_LANG['average_member_order'] . " " .
$_LANG['member_order_sum'] . "
";
$ave_user_ordernum = $user_num > 0 ? sprintf("%0.2f", $user_all_order['order_num'] / $user_num) : 0;
$ave_user_turnover = $user_num > 0 ? price_format($user_all_order['turnover'] / $user_num) : 0;
$data .= price_format($user_all_order['turnover']) . " " . $ave_user_ordernum . " " . $ave_user_turnover . "
";
/* 每会员平均订单数及购物额 */
$data .= $_LANG['order_turnover_percus'] . "
";
$data .= $_LANG['guest_member_orderamount'] . " " . $_LANG['guest_member_ordercount'] . " " .
$_LANG['guest_order_sum'] . "
";
$order_num = $guest_all_order['order_num'] > 0 ? price_format($guest_all_order['turnover'] / $guest_all_order['order_num']) : 0;
$data .= price_format($guest_all_order['turnover']) . " " . $guest_all_order['order_num'] . " " .
$order_num;
echo ecs_iconv(EC_CHARSET, 'GB2312', $data) . " ";
exit;