select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and balance_impact = '贷记' and account_name = 'aublzhao18@126.com' and type in ('eBay竞拍付款', '移动支付', '普通付款') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--2、临时冻结 '冻结余额以调查争议'
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('冻结余额以调查争议') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--付款撤销
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('付款撤销') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--退单
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('退单') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--退单撤销
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('退单撤销') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--3、争议补偿
select currency,sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('取消冻结以解决争议') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--4、已发放退款
select currency,sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('付款退款') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--5、在线发送的付款
-- 已付款项
select currency,sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('普通付款') and record_time>= '2019-08-01' and record_time<'2019-09-01' and gross<0 and balance_impact = '借记'
group by currency
;
--第三方偿付
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('第三方偿付') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
-- 集中付款 分正数和负数,如果是正数则是其他帐号转进来的,如果是负数则是本帐号转出的
select currency,sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('集中付款') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--快速结账付款
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('快速结账付款') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--费用
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('费用') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--6、转账和提现
-- 币种兑换
select currency,sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('普通币种兑换') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('用户发起的币种兑换') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
--提现
select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and account_name = 'aublzhao18@126.com' and type in ('普通提现') and record_time>= '2019-08-01' and record_time<'2019-09-01'
group by currency
;
*/
varsql="";
// 1、预收款 'eBay竞拍付款','移动支付','普通付款'
sql=$@"select currency, sum(gross) gross from dc_base_income_ebay_paypal where company_id = 1 and `status`= '已完成' and balance_impact = '贷记' and account_name = '{account}' and type in ('eBay竞拍付款', '移动支付', '普通付款') and record_time>= '{start.ToString("yyyy-MM-dd HH:MM:ss")}' and record_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}'