|
|
发表于 2009/11/10 16:17:22
|
显示全部楼层
SELECT
CONVERT(CHAR(4),b.AccountingYear) + '-' + Replace(STR(b.AccountingPeriod,2),' ','0') AS Period
,a.TransactionDate --操作时间 (yyyy-MM-dd HH:mm:ss)
,a.TransactionUserID AS UID --操作人员
,a.BatchNumber AS BNO
,a.TransactionSequenceNumber AS SeqNo
,a.BatchSourceCode AS FCODE
,a.TransactionAccount
,a.IsTransactionDebitOrCredit AS [D/C]
,CASE a.IsTransactionDebitOrCredit WHEN 'D' THEN a.TransactionAmount ELSE 0 END AS DebitAmount
,CASE a.IsTransactionDebitOrCredit WHEN 'C' THEN a.TransactionAmount ELSE 0 END AS CreditAmount
,RTRIM(Substring(a.TransactionReference1,1,6)) AS Vendor
,a.TransactionReference2 AS PONO
,a.TransactionReference3 AS LNO
,a.TransactionReference4 AS LineType
,a.TransactionReference5 AS OrderedQty
,a.TransactionReference6 AS ReceQty
,a.TransactionReference7 AS ItemNumber
,a.TransactionReference8 AS ReceType
FROM FS_GLBatchDetail a, FS_GLBatchHeader b
WHERE a.GLBatchHeaderKey=b.GLBatchHeaderKey
AND b.AccountingYear=2009 AND b.BatchSourceCode='PORV'
其它操作类似,变换一下BatchSourceCode,对应的TransactionReferencex作相应命名 |
|