[dbo].[vClaimsSummaryAmounts]
create view [dbo].[vClaimsSummaryAmounts]
as
select ClaimId = c.ClaimID,
SummarySettlementAmount = (
select sum(cssa.PostedAmount)
from dbo.ClaimSummarySettlementAmounts(c.ClaimID) cssa),
SummaryVendorChargebackAmount = (
select sum(csva.PostedAmount)
from dbo.ClaimSummaryVendorAmounts(c.ClaimID) csva),
SummaryBranchChargebackAmount = (
select sum(csba.PostedAmount)
from dbo.ClaimSummaryBranchChargebackAmounts(c.ClaimID) csba),
SummaryReveivableAmount = (
select sum(csra.PostedAmount)
from dbo.ClaimSummaryReceivableAmounts(c.ClaimID) csra),
SummaryHandlingRevenueAmount = (
select sum(cshra.PostedAmount)
from dbo.ClaimSummaryHandlingRevenueAmounts(c.ClaimID) cshra),
SummaryHandlingExpensesAmount = (
select sum(cshea.PostedAmount)
from dbo.ClaimSummaryHandlingExpensesAmounts(c.ClaimID) cshea)
from Claim c
GO
GRANT SELECT ON [dbo].[vClaimsSummaryAmounts] TO [MssExec]
GRANT INSERT ON [dbo].[vClaimsSummaryAmounts] TO [MssExec]
GRANT DELETE ON [dbo].[vClaimsSummaryAmounts] TO [MssExec]
GRANT UPDATE ON [dbo].[vClaimsSummaryAmounts] TO [MssExec]
GO