﻿SELECT
	B.PERIOD_NUM AS 期数,
	B.CALCULATED_AT AS 结算时间,
	B.LAST_USER_NAME AS 会员编号,
	B.LAST_REAL_NAME AS 会员姓名,
	L.LEVEL_NAME AS 会员级别,
	E.LEVEL_NAME AS 会员荣衔,
	B.LAST_MOBILE AS 手机号码,
	U.PERIOD_AT AS 加入期数,
	U.PARTITION_DATE AS 加入时间,
	B.LAST_REC_USER_NAME AS 开拓者编号,
	B.LAST_REC_REAL_NAME AS 开拓者姓名,
	B.LAST_CON_USER_NAME AS 上级编号,
	B.LAST_CON_REAL_NAME AS 上级姓名,
	B.BONUS_BD AS 服务奖,
	B.ORI_BONUS_BD AS 服务奖原金额,
	B.BONUS_TG AS 推广奖,
	B.ORI_BONUS_TG AS 推广奖原金额,
	B.BONUS_XF AS 消费奖,
	B.ORI_BONUS_XF AS 消费奖原金额,
	B.BONUS_YJ AS 业绩奖,
	B.ORI_BONUS_YJ AS 业绩奖原金额,
	B.BONUS_GX AS 共享奖,
	B.ORI_BONUS_GX AS 共享奖原金额,
	B.BONUS_GL AS 管理奖,
	B.ORI_BONUS_GL AS 管理奖原金额,
	B.BONUS_QY AS 团队奖,
	B.ORI_BONUS_QY AS 团队奖原金额,
	B.ORI_BONUS_QY_BD AS 报单团队奖原金额,
	B.BONUS_YC AS 荣衔奖,
	B.ORI_BONUS_YC AS 荣衔奖原金额,
	B.BONUS_VIP AS VIP奖,
	B.ORI_BONUS_VIP AS VIP奖原金额,
	B.BONUS_TOTAL AS 总奖金,
	B.MANAGE_TAX AS 管理费,
	B.RECONSUME_POINTS AS 复销积分,
	B.BONUS_INCOME AS 总收入,
	B.CALC_MONTH AS 结算月
FROM
	AR_CALC_BONUS B
	LEFT JOIN AR_USER U ON U.ID = B.USER_ID
	LEFT JOIN AR_DECLARATION_LEVEL L ON L.ID = B.LAST_DEC_LV
	LEFT JOIN AR_EMPLOY_LEVEL E ON E.ID = B.LAST_EMP_LV
	LEFT JOIN AR_USER_NETWORK_NEW N ON N.USER_ID = B.USER_ID
	WHERE
	B.PERIOD_NUM = 156 