Difference between revisions of "Oportunități:Pivot:Oportunități"

From docs
Jump to: navigation, search
(Campuri)
Line 30: Line 30:
 
;Descriere:descriere proiect
 
;Descriere:descriere proiect
 
;Stare:stare proiect
 
;Stare:stare proiect
;Data introducere], year(p.DataIntroducere) as [An introducere], month(p.DataIntroducere) as [Luna introducere], datepart(week,p.DataIntroducere) as [Saptamana introducere]
+
;Data introducere
, p.DataInceput as [Data inceput], p.DataSfarsit as [Data sfarsit],
+
;An introducere
p.Termen, year(p.Termen) as [An termen], month(p.Termen) as [Luna termen], datepart(week,p.Termen) as [Saptamana termen]
+
;Luna introducere
, p.TermenCerut as [Termen cerut],
+
;Saptamana introducere
COALESCE(clu.denumireunitate, ld.denumire) as Client,
+
;Data inceput
p.Probabilitate, p.ValoareValuta as [Valoare valuta], p.ValutaId as [Valuta], p.ValoareValuta*isnull(p.probabilitate,100)/100 as [Valoare valuta ajustata]
+
;Data sfarsit  
, case when p.UserAnulareId is not null THEN 1 else 0 end as Anulat
+
;An termen
, case when isnull(ps.Final,0)=0 then 0 else 1 end as Final
+
;Luna termen
, tp.TipProiect as [Tip],
+
;Saptamana termen
dbo.GetCurs(p.ValutaId,@SYS_DATE)*p.ValoareValuta as [Valoare],
+
;Termen cerut
dbo.GetCurs(p.ValutaId,@SYS_DATE)*p.ValoareValuta*isnull(p.probabilitate,100)/100 as [Valoare ajustata]
+
;Valoare valuta
  ,  (select Portofoliu from (
+
;Valuta  
SELECT    Por.DenumirePortofoliu Portofoliu ,zp.DenumireZonaPortofoliu Zona, row_number()
+
;Valoare valuta ajustata
  over ( partition by ClientId  order by isnull(Implicit,0) desc, DataStart desc ) as iRow
+
;Tip
+
;Valoare
  FROM        tblLeadPortofolii L
+
;Valoare ajustata
INNER JOIN        tblPortofolii Por  ON Por.PortofoliuId = L.PortofoliuId
+
;Portofoliu
LEFT JOIN tblZonePortofolii zp on por.ZonaPortofoliuId=zp.ZonaPortofoliuId
 
WHERE      l.leadid =p.LeadId
 
and (@tipportofoliuid is null or por.tipportofoliuid=@tipPortofoliuId)
 
and @SYS_DATE between l.datastart and isnull(l.DataEnd,@SYS_DATE+1)
 
--and l.DataStart<=a.DataContract
 
--and isnull(l.DataEnd,@mydate+365)>=a.DataContract
 
 
 
) a where iRow=1
 
            ) as [Portofoliu], resp.DenumireUnitate as Responsabil
 

Revision as of 17:08, 2 June 2015

Pivotul arata lista proiectelor de oportunitate

Lista

600px

Filtre

@sys_unitid int,
@sys_divid int,
@sys_date datetime,
@sys_userid int,
@anulate bit,
@Finalizate bit,
@tipPortofoliuId int=null,
@D_StartType char(1)=null,
@D_StartValue int=null,
@D_EndType char(1)=null,
@D_EndValue int=null,
@DataIntroducereDeLa DATEtime=null,
@DataIntroducerePanaLa DATEtime=null
filtreaza oportunitatile dupa data introducerii

Campuri

Categorie
Oportunitate
Descriere
descriere proiect
Stare
stare proiect
Data introducere
An introducere
Luna introducere
Saptamana introducere
Data inceput
Data sfarsit
An termen
Luna termen
Saptamana termen
Termen cerut
Valoare valuta
Valuta
Valoare valuta ajustata
Tip
Valoare
Valoare ajustata
Portofoliu