SELECT JournalEntryId,
JournalEntryNo,
CapitalChain,
DataSource,
EntrySummary,
AccountSubject,
CASE AccountSubject
WHEN '应付账款' THEN '卡门网供应商'
WHEN '应收账款' THEN '卡门网客户'
WHEN '预收账款' THEN ( CASE
WHEN JournalEntryNo LIKE 'API%' THEN 'API预收客户款'
WHEN JournalEntryNo = 'CSC004' THEN 'CSC预收客户款'
WHEN JournalEntryNo = 'CSC005' THEN '卡门网预收客户款'
WHEN JournalEntryNo LIKE 'KYS%' THEN '卡吧零预收客户款'
WHEN JournalEntryNo LIKE 'ZH%' THEN '卡门网预收客户款'
WHEN JournalEntryNo LIKE 'ZJC%' THEN '卡门网预收客户款'
END )
ELSE ''
END AS AccountSubjectDetail,
DebitAmount*-1 AS DebitAmount,
CreditAmount*-1 AS CreditAmount,
OffsetCategory,
CustomerSiteType,
BusinessTypeId,
JournalEntryTime,
InputTime
FROM dbo.JournalEntry
WHERE JournalEntryTime >= '2015-08-23 00:00:00.000'
AND JournalEntryTime <= '2015-08-23 23:59:59.999'
AND AccountSubject IN ('应收账款', '应付账款', '预收账款')
AND CustomerSiteType = '外部站点'