Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Report View Error

Report View Error

Scheduled Pinned Locked Moved Database
databasehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 12138525
    wrote on last edited by
    #1

    -- Add the parameters for the stored procedure here
    @GroupId int,
    @StartDate DATETIME = NULL,
    @EndDate DATETIME = NULL,
    @RegionCode varchar(30) = NULL
    AS
    BEGIN

    DECLARE @AgencyTable TABLE (GpoId int, OfcId int,  Total\_Bills BIGINT, Bill\_Value BIGINT, Commission BIGINT, Total\_Amount BIGINT) 
    
    SET @EndDate = convert(datetime, convert(Varchar(12), @EndDate, 106) + ' 23:59:59PM')
    
    
    --1. Billing Summary By GPO Name
    INSERT @AgencyTable (GpoId, OfcId, Total\_Bills, Bill\_Value, Commission, Total\_Amount) 
    SELECT bil.GroupId,  Bil.SubOfficeId , isnull(COUNT(Bil.ConsumerNumber),0) --AS Total\_Bills, 
       ,ISNULL(SUM(Bil.C\_Amount),0) --AS Bill\_Value, 
       ,ISNULL(SUM(Bil.Commission),0) --AS Commission, 
       ,ISNULL(SUM(Bil.C\_Amount),0) - ISNULL(SUM(Bil.Commission),0) --AS Total\_Amount
    FROM BillTxnSO as Bil inner join pp\_offices ofc On bil.GroupId = ofc.Group\_Id and bil.SubOfficeId = ofc.OfficeCode  
    Where bil.GroupId = @GroupId AND TransDate  BETWEEN @StartDate AND @EndDate
    Group by bil.GroupId, Bil.SubOfficeId 
    
    --select \* from @AgencyTable
     
     SELECT   ofc.OfficeName as SubOffice\_Name  , isnull(gpo.Total\_Bills,0)as Total\_Bills , isnull(gpo.Bill\_Value,0)as Bill\_Value , isnull(gpo.Commission,0) as Commission, isnull(gpo.Total\_Amount,0) as Total\_Amount   
      FROM @AgencyTable gpo 
    

    INNER JOIN pp_offices ofc On ofc.Group_Id = gpo.GpoId and gpo.OfcId = ofc.OfficeCode
    ORDER BY ofc.OfficeName

    END

    L 1 Reply Last reply
    0
    • M Member 12138525

      -- Add the parameters for the stored procedure here
      @GroupId int,
      @StartDate DATETIME = NULL,
      @EndDate DATETIME = NULL,
      @RegionCode varchar(30) = NULL
      AS
      BEGIN

      DECLARE @AgencyTable TABLE (GpoId int, OfcId int,  Total\_Bills BIGINT, Bill\_Value BIGINT, Commission BIGINT, Total\_Amount BIGINT) 
      
      SET @EndDate = convert(datetime, convert(Varchar(12), @EndDate, 106) + ' 23:59:59PM')
      
      
      --1. Billing Summary By GPO Name
      INSERT @AgencyTable (GpoId, OfcId, Total\_Bills, Bill\_Value, Commission, Total\_Amount) 
      SELECT bil.GroupId,  Bil.SubOfficeId , isnull(COUNT(Bil.ConsumerNumber),0) --AS Total\_Bills, 
         ,ISNULL(SUM(Bil.C\_Amount),0) --AS Bill\_Value, 
         ,ISNULL(SUM(Bil.Commission),0) --AS Commission, 
         ,ISNULL(SUM(Bil.C\_Amount),0) - ISNULL(SUM(Bil.Commission),0) --AS Total\_Amount
      FROM BillTxnSO as Bil inner join pp\_offices ofc On bil.GroupId = ofc.Group\_Id and bil.SubOfficeId = ofc.OfficeCode  
      Where bil.GroupId = @GroupId AND TransDate  BETWEEN @StartDate AND @EndDate
      Group by bil.GroupId, Bil.SubOfficeId 
      
      --select \* from @AgencyTable
       
       SELECT   ofc.OfficeName as SubOffice\_Name  , isnull(gpo.Total\_Bills,0)as Total\_Bills , isnull(gpo.Bill\_Value,0)as Bill\_Value , isnull(gpo.Commission,0) as Commission, isnull(gpo.Total\_Amount,0) as Total\_Amount   
        FROM @AgencyTable gpo 
      

      INNER JOIN pp_offices ofc On ofc.Group_Id = gpo.GpoId and gpo.OfcId = ofc.OfficeCode
      ORDER BY ofc.OfficeName

      END

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is your question?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups