Report View Error
Database
2
Posts
2
Posters
0
Views
1
Watching
-
-- Add the parameters for the stored procedure here
@GroupId int,
@StartDate DATETIME = NULL,
@EndDate DATETIME = NULL,
@RegionCode varchar(30) = NULL
AS
BEGINDECLARE @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.OfficeNameEND
-
-- Add the parameters for the stored procedure here
@GroupId int,
@StartDate DATETIME = NULL,
@EndDate DATETIME = NULL,
@RegionCode varchar(30) = NULL
AS
BEGINDECLARE @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.OfficeNameEND