Skip to content

Instantly share code, notes, and snippets.

@api-padawan
Forked from jerfowler/DQ-GL_Detail_Custom.sql
Created April 19, 2013 17:31
Show Gist options
  • Save api-padawan/5421852 to your computer and use it in GitHub Desktop.
Save api-padawan/5421852 to your computer and use it in GitHub Desktop.
GL_Detail_Custom Data source for Document Designer
INSERT INTO [CIS].[dbo].[DocumentQuery] ([Name] ,[SQL] ,[ActiveFlag])
VALUES
('GL_Detail_Custom'
,'SELECT GL.[Code]
,GL.[CodeDescription]
,GL.[DateAdded]
,GL.[DateDropped]
,GL.[Sales] as [Exposure]
,GL.[FlagDropped]
,GL.[FlagRackleyRated]
,GL.[Pr334] as [PremisesPremium]
,CASE GL.[PremiumBase]
WHEN ''e'' THEN ''Each''
WHEN ''a'' THEN ''Area''
WHEN ''p'' THEN ''Payroll''
WHEN ''u'' THEN ''Units''
WHEN ''s'' THEN ''Sales''
WHEN ''t'' THEN ''Total Cost''
ELSE GL.[PremiumBase] END as [PremiumBase]
,GL.[FinalMod334] as [PremisesRate]
,GL.[Pr336] as [ProductPremium]
,GL.[FinalMod336] as [ProductRate]
,GL.[RatePer]
,GL.[Premium] as [TotalPremium]
,RC.Description AS [RatingBasis]
,L.Description AS [LocDesc]
,L.Address
,L.City
,L.State
,L.Zip
FROM [CIS].[dbo].[taaGLRatingDetail] GL
INNER JOIN [CIS].[dbo].[Quote] QU (NOLOCK) ON GL.ReferenceKey_FK = QU.ReferenceID
INNER JOIN CIS.dbo.taaLocations L (NOLOCK) ON GL.LocationKey_FK=L.LocationKey_PK
LEFT OUTER JOIN CIS.dbo.taaRatingCodes RC ON GL.PremiumBase=RC.IDCode
WHERE QU.QuoteID = :Quote#QuoteID'
,'Y')
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment