Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT [id]
- ,CASE WHEN [type] = 1 THEN 'Debit' ELSE 'Credit' END as [TrType]
- ,[date]
- ,[ref]
- ,[refId]
- ,[particular]
- ,[debit]
- ,[debit] as [Dr]
- ,NULL as [vDr]
- ,[credit]
- ,[credit] as [Cr]
- ,NULL as [vCr]
- ,[balance]
- ,[balance] as [RealBalance]
- ,NULL as [vBalance]
- ,NULL as [TotalPayment]
- ,(SELECT [transactionCat].[catName] FROM transactionCat WHERE [transactionCat].[catId] = [trCat] ) AS [TrCat]
- ,[remarks]
- ,(SELECT [clients].clientName FROM clients WHERE clientId = [client]) AS[Client]
- , [client] as [ClientId]
- ,(SELECT [users].[userName] FROM [users] WHERE users.userId = [addedBy]) AS[Creator]
- ,[modifiedBy]
- ,[timeAdded]
- ,[timeModified]
- ,NULL as [Virtual]
- , NULL as [PaymentDate]
- , NULL as [interestRate]
- ,[status]
- FROM [raipur_auto].[dbo].[debitCredit]
- UNION
- select [id]
- ,CASE WHEN [type] = 1 THEN 'Debit' ELSE 'Credit' END as [TrType]
- ,[date]
- ,[ref]
- ,[refId]
- ,[particular]
- ,[debit]
- ,NULL as [Dr]
- ,[debit] as [vDr]
- ,[credit]
- ,NULL as [Cr]
- ,[credit] as [vCr]
- ,[balance]
- ,NULL as [RealBalance]
- ,[balance] as [vBalance]
- , ( SELECT
- SUM(Transcations.TrAmount)
- from
- Transcations
- WHERE
- RefId = id
- ) AS [TotalPayment]
- ,(SELECT [transactionCat].[catName] FROM transactionCat WHERE [transactionCat].[catId] = [trCat] ) AS [TrCat]
- ,[remarks]
- ,(SELECT [clients].clientName FROM clients WHERE clientId = [client]) AS[Client]
- , [client] as [ClientId]
- ,(SELECT [users].[userName] FROM [users] WHERE users.userId = [addedBy]) AS[Creator]
- ,[modifiedBy]
- ,[timeAdded]
- ,[timeModified]
- ,[vDc] as [Virtual]
- ,[lastPaymentDate] as [PaymentDate],
- [interestRate] as [interestRate]
- ,[status] from VirtualDebitCredit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement