0% found this document useful (0 votes)
46 views

Revenue Services 2ndversion

This stored procedure retrieves project data from various tables in a Synergy database and inserts it into a temporary table. It performs several updates to populate columns in the temporary table, including calculating totals for budgets, invoices, and costs by project. The stored procedure accepts multiple parameters to filter the results by attributes like division, date range, project status, and manager.

Uploaded by

aminakalifa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Revenue Services 2ndversion

This stored procedure retrieves project data from various tables in a Synergy database and inserts it into a temporary table. It performs several updates to populate columns in the temporary table, including calculating totals for budgets, invoices, and costs by project. The stored procedure accepts multiple parameters to filter the results by attributes like division, date range, project status, and manager.

Uploaded by

aminakalifa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 10

CREATE PROCEDURE [dbo].

[ZZ_SP_Revenue_Report_Services]
@Division Char(3) ,
@ReportingDate Date,
@ProjectStatus nvarchar(100),
@OnlyWIP bit ,
@IncludeExpenses bit ,
@CentralInvoicing bit,
@ProjectManager nvarchar(6),
@ReportingStartDate Date,
@Project Char(20)
As

Declare @SQLQuery nvarchar(2048)


Declare @resID int

Begin

SET NOCOUNT ON;

IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' And


TABLE_NAME = 'ZZ_TA_Revenue_Report_Services'))
Begin
DROP TABLE [dbo].ZZ_TA_Revenue_Report_Services
End

-- Insert statements for procedure here


SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

Select Distinct
p.Division as S_ProjectDivision

, p.ProjectNr as S_ProjectCode
, p.Description as S_ProjectDescription
, p.ParentProject as S_ParentProjectCode
, p.YesNoField3 as S_CentralInvoicing
, Cast(man.res_id as varchar)+' - '+man.fullname as S_ProjectManager
, Cast(p.InitialStartDate as date) as S_ProjectStartDate
, Cast(p.InitialEndDate as date) as S_ProjectEndDate
, ( Select Description From [010_Synergy]..DDTests Where Tablename='PRProject' And
FieldName='Status' And DisplayChar=p.Status) as S_ProjectStatus
, ( Select Description From [010_Synergy]..DDTests Where Tablename='PRProject' And
FieldName='Type' And DisplayChar=p.type) as S_ProjectType
, p.YesNoField5 as S_IsTravelExpense
, Ltrim(OrderAcount.cmp_code) as S_ProjectOrderedByCode

, OrderAcount.cmp_name as S_ProjectOrderedByName

, Ltrim(InvoiceAcount.cmp_code) as S_ProjectInvoiceToCode

, InvoiceAcount.cmp_name as S_ProjectInvoiceToName

, p.magcode+' -- '+ w.naam as S_ProjectWareHouse


, ia.Description as S_ProjectAssortment
, i.itemcode+' -- '+i.Description as S_ProjectItemOutput
, (Select Description From [010_Synergy]..DDTests Where Tablename='PRProject' And
FieldName='Labour' And DisplayChar=p.Labour) as S_ProjectWIPMethod
, p.BillingCurrency as S_ProjectBillingCurrency

, (Select sum(a.AmountFCActual) From [010_Synergy]..absences a Where


a.ProjectNumber = p.ProjectNr And a.type=104 and a.Status <> 2) as
S_TotalProjectTermsFC
, (Select sum(a.AmountActual) From [010_Synergy]..absences a Where
a.ProjectNumber = p.ProjectNr And a.type=104 and a.Status <> 2) as
S_TotalProjectTermsDC
, Cast (0 as Float) as S_InitialRevenueBudgetDC
, Cast (0 as Float) as S_RevenueBudgetDC
, Cast (0 as Float) as S_InitialCostBudgetDC
, Cast (0 as Float) as S_CostBudgetDC
, Isnull(p.NumberField1,0) as G_RevenueBudgetDC
, Isnull(p.NumberField3,0) as G_CostBudgetDC
, Isnull(p.NumberField2,0) as G_RevenueActualDC
, Isnull(p.NumberField4,0) as G_CostActualDC
, Isnull(p.NumberField5,0) as G_ProjectCompletion
, Cast (0 as Float) as G_TotalInvoicedDC
, Cast (0 as Float) as G_TotalInvoicedFC
, Cast (0 as Float) as G_TotalWIP
, Cast (0 as Float) as G_RevenueRecognizedInAccounting

, Cast (0 as Float) as G_TotalRevenueAllDatesDC


, Cast (0 as Float) as G_TotalHoursInGlobe
, Cast (0 as Float) as G_TotalHoursCostInGlobe
, Cast (0 as Float) as G_TotalOutsourcingCostInGlobe
, Cast (0 as Float) as G_TotalExchangeRateDifference
, Cast (0 as Float) as G_TotalCostInGlobe
, Cast (0 as Float) as G_TotalCostAllDatesDC
, Cast (0 as Float) as G_TotalFAE
, Cast (0 as Float) as G_TotalPCA
, Cast (0 as Float) as ID106025 -- Gaëlle GUEHENNEUX

, Cast (0 as Float) as ID110078 -- Gustavo SHIOGA

, Cast (0 as Float) as ID110079 -- Jens SCHLEHAHN

, Cast (0 as Float) as ID110187 -- Jovan BRKUSANIN ALIAS


INFOBIS
, Cast (0 as Float) as ID110927 -- Juliane WISSUWA

, Cast (0 as Float) as ID110076 -- Zhihua FANG

, Cast (0 as Float) as ID110450 -- Lara BRICHET

, Cast (0 as Float) as ID110519 -- Marion RIPERT

, Cast (0 as Float) as ID106014 -- Mathieu FONTAINE

, Cast (0 as Float) as ID106010 -- Mathis THEILLET

, Cast (0 as Float) as ID110916 -- Mohamed LARABI

, Cast (0 as Float) as ID106000 -- Nathalie MANTRAND-FOUSSADIER

, Cast (0 as Float) as ID110074 -- Oumaima BENABBOU

, Cast (0 as Float) as ID106023 -- Alexandre MAIA

, Cast (0 as Float) as ID110077 -- Barbara MARET

, Cast (0 as Float) as ID106002 -- Benoit CHEVALIER


, Cast (0 as Float) as ID106024 -- Cathia JACOB

, Cast (0 as Float) as ID103237 -- Corinne BORGET

, Cast (0 as Float) as ID106005 -- Cyril MAVRÉ

, Cast (0 as Float) as ID110790 -- Patricia HAYE TOVOKELY

, Cast (0 as Float) as ID110005 -- Philippe CAILLOL

, Cast (0 as Float) as ID106017 -- Samuel DA COSTA

, Cast (0 as Float) as ID106020 -- Samuel DUBIN

Into [SPECIFIC]..ZZ_TA_Revenue_Report_Services

From [010_Synergy]..PRProject p with (nolock)


Inner join [010_Synergy]..humres man with (nolock) on man.res_id
= p.Responsible
Left join [010_Synergy]..cicmpy OrderAcount with (nolock) on
OrderAcount.cmp_wwn = p.IDOrderAccount
Left join [010_Synergy]..cicmpy InvoiceAcount with (nolock) on
InvoiceAcount.cmp_wwn = p.IDInvoiceAccount
Left join [010_Synergy]..ItemAssortment ia with (nolock) on ia.Assortment
= p.Assortment
Left join [010_Synergy]..Items i with (nolock) on i.itemCode
= p.ItemCode Left join [010_Synergy]..magaz w with (nolock)
on p.magcode = w.magcode
Where p.Division = @Division
And (p.status in (@ProjectStatus) or @ProjectStatus='' )
And p.type in ('H','F')
And ( (p.Labour <> 'N' and @OnlyWIP = 1) or @OnlyWIP = 0 )
And ( (p.YesNoField5 = 0 and @IncludeExpenses = 0 ) or @IncludeExpenses = 1 )

And ( p.Responsible = @ProjectManager or @ProjectManager = 1 )


And ( p.ProjectNr = @Project or @Project = '' )
And ( p.YesNoField3 = @CentralInvoicing)

-- Update S_InitialRevenueBudgetDC
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set S_InitialRevenueBudgetDC = (Select SUM( Isnull(AmountActual,0) )
From [010_Synergy].dbo.[Absences] a with (nolock)

Where [dbo].[ZZ_TA_Revenue_Report_Services].S_ProjectCode
= a.ProjectNumber and a.type = 103)

-- Update S_RevenueBudgetDC
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set S_RevenueBudgetDC = (Select SUM( Isnull(Amount,0) )
From [010_Synergy].dbo.[ProjectBudgetLines] with
(nolock)
Where [dbo].
[ZZ_TA_Revenue_Report_Services].S_ProjectCode=[010_Synergy].dbo.
[ProjectBudgetLines].ProjectNumber)

update [dbo].[ZZ_TA_Revenue_Report_Services] Set S_RevenueBudgetDC = 0 Where


S_RevenueBudgetDC is null

-- Update S_InitialCostBudgetDC
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set S_InitialCostBudgetDC = (Select SUM( Isnull(Amount,0) )
From [010_Synergy].dbo.[Absences] a with (nolock)

Where [dbo].[ZZ_TA_Revenue_Report_Services].S_ProjectCode
= a.ProjectNumber and a.type = 103)

--Update S_CostBudgetDC
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set S_CostBudgetDC = (Select SUM( Isnull(CostAmount,0) )
From [010_Synergy].dbo.[ProjectBudgetLines] with
(nolock)
Where [dbo].
[ZZ_TA_Revenue_Report_Services].S_ProjectCode=[010_Synergy].dbo.
[ProjectBudgetLines].ProjectNumber)

update [dbo].[ZZ_TA_Revenue_Report_Services] Set S_CostBudgetDC = 0 Where


S_CostBudgetDC is null

-- Update TotalInvoiced DC
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalInvoicedDC = ( Select round(SUM(-
Isnull(bdr_hfl,0)),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With
(nolock) on gbkmut.reknr= grtbk.reknr
Where
gbkmut.project=ZZ_TA_Revenue_Report_Services.S_ProjectCode
And gbkmut.dagbknr like ''70%''

And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


And grtbk.omzrek = ''J'') '
Execute sp_executesql @SQLQuery

Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalInvoicedDC = 0 where


G_TotalInvoicedDC is null

-- Update TotalInvoiced FC
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalInvoicedFC = ( Select round(SUM(-
Isnull(bdr_val,0)),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With
(nolock) on gbkmut.reknr= grtbk.reknr
Where
gbkmut.project=ZZ_TA_Revenue_Report_Services.S_ProjectCode
And gbkmut.dagbknr like ''70%''

And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''


And gbkmut.docdate >='''+Cast(@ReportingStartDate as varchar)+
'''
And gbkmut.transtype = ''N''
And grtbk.omzrek = ''J'') '
Execute sp_executesql @SQLQuery

Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalInvoicedFC = 0 where


G_TotalInvoicedFC is null

-- Update TotalWIP
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalWIP = ( Select round(SUM(Isnull(-
bdr_hfl,0)),2)
From ['+@Division+']..gbkmut
with (nolock)
Inner join ['+@Division+']..grtbk With (nolock) on gbkmut.reknr =
grtbk.reknr
Inner join ['+@Division+']..Settings With (nolock) on
Settings.SettingGroup = ''eproject'' and Settings.SettingName like ''%WIP_Balance
%''
Where gbkmut.project=ZZ_TA_Revenue_Report_Services.S_ProjectCode

And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


) '
Execute sp_executesql @SQLQuery

Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_RevenueRecognizedInAccounting


= Isnull(G_TotalInvoiceddc,0) + Isnull(G_TotalWIP,0)

-- Update TotalRevenueAllDatesDC
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalRevenueAllDatesDC = ( Select round(SUM(-
Isnull(bdr_hfl,0)),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With
(nolock) on gbkmut.reknr= grtbk.reknr
Where
gbkmut.project=ZZ_TA_Revenue_Report_Services.S_ProjectCode
And gbkmut.transtype = ''N''
And grtbk.omzrek = ''J'') '
Execute sp_executesql @SQLQuery

Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalRevenueAllDatesDC = 0 where


G_TotalRevenueAllDatesDC is null

-- TotalHoursInGlobe
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalHoursInGlobe = ( Select
sum( Isnull(aantal,0) )
From
['+@Division+']..gbkmut with (nolock)
inner join ['+@Division+']..items i with (nolock) on i.itemcode =
gbkmut.artcode
Where gbkmut.project = ZZ_TA_Revenue_Report_Services.S_ProjectCode

And i.type = ''L''


And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


And gbkmut.dagbknr = 929 ) '
Execute sp_executesql @SQLQuery

-- Update TotalHoursCostInGlobe
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalHoursCostInGlobe = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From ['+@Division+']..gbkmut with (nolock)
inner join
['+@Division+']..items i with (nolock) on i.itemcode = gbkmut.artcode
Where gbkmut.project = ZZ_TA_Revenue_Report_Services.S_ProjectCode

And i.type = ''L''


And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


And gbkmut.dagbknr = 929 ) '
Execute sp_executesql @SQLQuery
Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalHoursCostInGlobe = 0 where
G_TotalHoursCostInGlobe is null

-- Update TotalHoursCostInGlobe by consultant


DECLARE resID CURSOR FOR (select Value from
[SPECIFIC].dbo.SplitString('110450,110519,106014,106010,110916,106000,110074,106023
,110077,106002,106024,103237,106005,110790,110005,106017,106020,106025,110078,11007
9,110187,110927,110076',','))
OPEN resID
FETCH NEXT FROM resID INTO @resID
WHILE @@FETCH_STATUS = 0
BEGIN
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.ID' + cast(@resID as nvarchar(max)) + ' =
( Select round(SUM( Isnull(bdr_hfl,0) ),2)
From ['+@Division+']..gbkmut with (nolock)
inner join
['+@Division+']..items i with (nolock) on i.itemcode = gbkmut.artcode
Where gbkmut.project = ZZ_TA_Revenue_Report_Services.S_ProjectCode

And gbkmut.res_id = ' + cast(@resID as nvarchar(max)) + ' And


i.type = ''L''
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


And gbkmut.dagbknr = 929 ) '

EXEC SP_EXECUTESQL @SQLQuery


FETCH NEXT FROM resID INTO @resID
END
CLOSE resID
DEALLOCATE resID

-- Update TotalOutsourcingCostInGlobe
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalOutsourcingCostInGlobe = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With (nolock) on
gbkmut.reknr= grtbk.reknr
Where gbkmut.project =
ZZ_TA_Revenue_Report_Services.S_ProjectCode
And grtbk.omzrek = ''K''
And Ltrim(gbkmut.reknr) not like ''999%''
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)
+ '''
And gbkmut.transtype = ''N''
And gbkmut.dagbknr is not null ) '
Execute sp_executesql @SQLQuery
Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalOutsourcingCostInGlobe = 0
where G_TotalOutsourcingCostInGlobe is null
-- Update TotalPCA
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalPCA = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From
['+@Division+']..gbkmut with (nolock)
Where gbkmut.project =
ZZ_TA_Revenue_Report_Services.S_ProjectCode
And Ltrim(gbkmut.reknr) like ''487100%''
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)
+ '''
And gbkmut.docdate >='''+Cast(@ReportingStartDate as
varchar)+ '''
And gbkmut.transtype = ''N''
And gbkmut.dagbknr is not null ) '
Execute sp_executesql @SQLQuery

-- Update TotalFAE
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalFAE = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From ['+@Division+']..gbkmut
with (nolock)
Where gbkmut.project =
ZZ_TA_Revenue_Report_Services.S_ProjectCode
And Ltrim(gbkmut.reknr) like ''418110%''
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)
+ '''
And gbkmut.docdate >='''+Cast(@ReportingStartDate as
varchar)+ '''
And gbkmut.transtype = ''N''
And gbkmut.dagbknr is not null ) '
Execute sp_executesql @SQLQuery
-- Update TotalExchangeRateDifference
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalExchangeRateDifference = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With (nolock) on gbkmut.reknr =
grtbk.reknr
Where gbkmut.project =
ZZ_TA_Revenue_Report_Services.S_ProjectCode
And grtbk.omzrek in (''N'')
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.docdate >='''+Cast(@ReportingStartDate as varchar)+


'''
And gbkmut.transtype = ''N''
And gbkmut.oms25 = ''Exchange rate difference''
And gbkmut.dagbknr is not null ) '
Execute sp_executesql @SQLQuery

-- Update TotalCostInGlobe
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalCostInGlobe = ( Select
round(SUM( Isnull(bdr_hfl,0) ),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With (nolock) on gbkmut.reknr =
grtbk.reknr
Where gbkmut.project =
ZZ_TA_Revenue_Report_Services.S_ProjectCode
And grtbk.omzrek = ''K''
And gbkmut.docdate <='''+Cast(@ReportingDate as varchar)+ '''

And gbkmut.transtype = ''N''


And gbkmut.dagbknr is not null ) '
Execute sp_executesql @SQLQuery
Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalCostInGlobe = 0 where
G_TotalCostInGlobe is null

-- Update TotalCostAllDatesDC
Set @SQLQuery = N'
Update [dbo].[ZZ_TA_Revenue_Report_Services]
Set ZZ_TA_Revenue_Report_Services.G_TotalCostAllDatesDC = ( Select
round(SUM(Isnull(bdr_hfl,0)),2)
From
['+@Division+']..gbkmut with (nolock)
Inner join ['+@Division+']..grtbk With
(nolock) on gbkmut.reknr= grtbk.reknr
Where
gbkmut.project=ZZ_TA_Revenue_Report_Services.S_ProjectCode
And gbkmut.transtype = ''N''
And grtbk.omzrek = ''K'') '
Execute sp_executesql @SQLQuery

Update [dbo].[ZZ_TA_Revenue_Report_Services] Set G_TotalCostAllDatesDC = 0 where


G_TotalCostAllDatesDC is null
-- Get report Data

Select Distinct
S_ProjectDivision

, S_ProjectCode
, S_ProjectDescription
, S_ParentProjectCode
, S_ProjectManager
, S_ProjectStartDate
, S_ProjectEndDate
, S_ProjectStatus
, S_CentralInvoicing
, S_ProjectType
, S_IsTravelExpense
, S_ProjectOrderedByCode
, S_ProjectOrderedByName
, S_ProjectInvoiceToCode
, S_ProjectInvoiceToName
, S_ProjectWareHouse
, S_ProjectAssortment
, S_ProjectItemOutput
, S_ProjectWIPMethod
, S_ProjectBillingCurrency
, S_TotalProjectTermsFC
, S_TotalProjectTermsDC
, S_InitialRevenueBudgetDC
, S_RevenueBudgetDC
, S_InitialCostBudgetDC
, S_CostBudgetDC
, G_RevenueBudgetDC
, G_CostBudgetDC
, G_RevenueActualDC
, G_CostActualDC
, G_ProjectCompletion
, G_TotalInvoicedDC
, G_TotalInvoicedFC
, G_TotalWIP
, G_RevenueRecognizedInAccounting
, G_TotalRevenueAllDatesDC
, G_TotalHoursInGlobe
, G_TotalHoursCostInGlobe
, G_TotalOutsourcingCostInGlobe
, G_TotalExchangeRateDifference
, G_TotalCostInGlobe
, G_TotalCostAllDatesDC
, G_TotalFAE
, G_TotalPCA
, (case when abs(S_RevenueBudgetDC - G_RevenueBudgetDC) <= 0.05 then 1 else 0 end)
as S_G_CheckSalesBudget
, (case when abs(S_CostBudgetDC - G_CostBudgetDC) <= 0.05 then 1 else 0 end) as
S_G_CheckCostBudget
, (case when abs(G_RevenueActualDC - G_TotalRevenueAllDatesDC) <= 0.05 then 1 else
0 end) as S_G_CheckSalesActual
, (case when abs(G_CostActualDC - G_TotalCostAllDatesDC) <= 0.05 then 1 else 0 end)
as S_G_CheckCostActual
, G_RevenueActualDC - G_CostActualDC as G_ProfitDC
, (case when G_CostActualDC <> 0 then (G_RevenueActualDC - G_CostActualDC) /
G_CostActualDC * 100 else 0 end) as G_MarkupPercDC
, (case when G_RevenueActualDC <> 0 then (G_RevenueActualDC - G_CostActualDC) /
G_RevenueActualDC * 100 else 0 end) as G_MarginPercDC
, ID106025 -- Gaëlle GUEHENNEUX

, ID110078 -- Gustavo SHIOGA

, ID110079 -- Jens SCHLEHAHN

, ID110187 -- Jovan BRKUSANIN ALIAS INFOBIS

, ID110927 -- Juliane WISSUWA

, ID110076 -- Zhihua FANG


, ID110450 -- Lara BRICHET

, ID110519 -- Marion RIPERT

, ID106014 -- Mathieu FONTAINE

, ID106010 -- Mathis THEILLET

, ID110916 -- Mohamed LARABI

, ID106000 -- Nathalie MANTRAND-FOUSSADIER

, ID110074 -- Oumaima BENABBOU

, ID106023 -- Alexandre MAIA

, ID110077 -- Barbara MARET

, ID106002 -- Benoit CHEVALIER

, ID106024 -- Cathia JACOB

, ID103237 -- Corinne BORGET

, ID106005 -- Cyril MAVRÉ

, ID110790 -- Patricia HAYE TOVOKELY

, ID110005 -- Philippe CAILLOL

, ID106017 -- Samuel DA COSTA

, ID106020 -- Samuel DUBIN


From [dbo].[ZZ_TA_Revenue_Report_Services]
Order By S_ProjectCode

End

You might also like