CREATE VIEW dbo.v_col998
AS
SELECT dbo.genRegional.regionalid, dbo.genRegional.regional, dbo.genRegional.zoneid, dbo.genRegional.zonename,
dbo.prfUser.BranchId, dbo.cshTxn.TxnDate,
(SELECT minCicildate
FROM v_rptFinancore_totNotPaid
WHERE norek = corPayment.norek AND nopin = corPayment.nopin) AS CicilDate, dbo.cshTxn.ValueDate, dbo.cshTxn.NoRek, dbo.cshTxn.NoPin,
dbo.corPayment.CshBranchId, dbo.genBranch.BranchName, dbo.cshFuncCode.InOut, dbo.corPayment.KuitansiNo,
dbo.cshTxn.FuncType, dbo.corPayment.Amount, dbo.cshTxn.TxnType, dbo.cshFuncCode.FuncCode, dbo.corPayment.CollectFee,
(SELECT sum(isnull(angsuran, 0))
FROM tmppjt_khusus
WHERE branchid = dbo.prfUser.BranchId AND norek = dbo.corPayment.norek AND nopin = dbo.corPayment.nopin) AS angsuran
FROM dbo.corPayment WITH (nolock) INNER JOIN
dbo.corAccount WITH (NOLOCK) ON dbo.corPayment.NoRek = dbo.corAccount.NoRek AND
dbo.corPayment.NoPin = dbo.corAccount.NoPin LEFT OUTER JOIN
dbo.prfUser WITH (NOLOCK) LEFT OUTER JOIN
dbo.cshTxn WITH (NOLOCK) ON dbo.prfUser.UserId = dbo.cshTxn.AuthorId LEFT OUTER JOIN
dbo.cshFuncCode WITH (NOLOCK) ON dbo.cshTxn.FuncCode = dbo.cshFuncCode.FuncCode ON
dbo.corPayment.TxnId = dbo.cshTxn.TxnId LEFT OUTER JOIN
dbo.genBranch WITH (NOLOCK) ON dbo.prfUser.BranchId = dbo.genBranch.BranchId INNER JOIN
dbo.genRegional ON dbo.genRegional.branchid = dbo.prfUser.BranchId
WHERE (dbo.cshTxn.NoRek IS NOT NULL)

0 Comments:

Post a Comment