Oportunități:Pivot:Oportunități

From docs
Revision as of 16:26, 2 June 2015 by Alberto Nistor (talk | contribs) (Created page with "*Vanzari si servicii **Oportunități ***Rapoarte ****Oportunitați ;Pivotul arata lista proiectelor de oport...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Pivotul arata lista proiectelor de oportunitate

Lista

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], year(p.DataIntroducere) as [An introducere], month(p.DataIntroducere) as [Luna introducere], datepart(week,p.DataIntroducere) as [Saptamana introducere]

, p.DataInceput as [Data inceput], p.DataSfarsit as [Data sfarsit], p.Termen, year(p.Termen) as [An termen], month(p.Termen) as [Luna termen], datepart(week,p.Termen) as [Saptamana termen] , p.TermenCerut as [Termen cerut], COALESCE(clu.denumireunitate, ld.denumire) as Client, p.Probabilitate, p.ValoareValuta as [Valoare valuta], p.ValutaId as [Valuta], p.ValoareValuta*isnull(p.probabilitate,100)/100 as [Valoare valuta ajustata] , case when p.UserAnulareId is not null THEN 1 else 0 end as Anulat , case when isnull(ps.Final,0)=0 then 0 else 1 end as Final , tp.TipProiect as [Tip], dbo.GetCurs(p.ValutaId,@SYS_DATE)*p.ValoareValuta as [Valoare], dbo.GetCurs(p.ValutaId,@SYS_DATE)*p.ValoareValuta*isnull(p.probabilitate,100)/100 as [Valoare ajustata] , (select Portofoliu from ( SELECT Por.DenumirePortofoliu Portofoliu ,zp.DenumireZonaPortofoliu Zona, row_number() over ( partition by ClientId order by isnull(Implicit,0) desc, DataStart desc ) as iRow

FROM tblLeadPortofolii L INNER JOIN tblPortofolii Por ON Por.PortofoliuId = L.PortofoliuId 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