|
|
(One intermediate revision by the same user not shown) |
Line 12: |
Line 12: |
| ;Numar comanda client | | ;Numar comanda client |
| ;Data comanda client | | ;Data comanda client |
− | ;Luna comanda furnizor | + | ;Data comenzii client |
− | ;An comanda furnizor | + | ;Luna comanda client |
| + | ;An comanda client |
| ;Client | | ;Client |
| ;Furnizor | | ;Furnizor |
Line 22: |
Line 23: |
| ;Data comanda de la furnizor | | ;Data comanda de la furnizor |
| ;Data comanda furnizor | | ;Data comanda furnizor |
− | ;Data incarcare
| |
| ;Agent | | ;Agent |
| ;Cantitate comanda client | | ;Cantitate comanda client |
− | ;Valoare comanda client
| + | ;Cantitate comanda furnizor] |
− | ;Valoare vanzare - Valuta
| + | ;Produs |
− | ;Cantitate comanda furnizor | + | ;Cod produs |
− | ;Cantitate receptionata furnizor
| |
− | ;Diferente cantitate flag
| |
− | ;Cantitate nereceptionata
| |
− | ;Valoare nereceptionata
| |
− | ;Valoarea achizitie nereceptionata - Valuta curs
| |
− | ;Produs | |
− | ;UM | |
| ;Cod produs furnizor | | ;Cod produs furnizor |
− | , COALESCE(ocp.DenProdusFurnizor,fp.DenumireProdusFurnizor,p.DenProdusFabricant) AS [Denumire produs furnizor]
| + | ;Denumire produs furnizor |
− | , sp.PretValuta AS [Pret vanzare]
| + | ;Pret vanzare |
− | , sp.PretValutaRedus AS [Pret vanzare redus]
| + | ;Pret vanzare redus |
− | , sp.ValutaID AS [Valuta vanzare]
| + | ;Valuta vanzare |
− | , sp.PretLista AS [Pret lista]
| + | ;Pret lista |
− | , pp.PretValuta AS [Pret comanda furnizor]
| + | ;Pret comanda furnizor |
− | , case when ip.PretIntrareValuta<>pp.PretValuta then 1 else 0 end as [Diferente pret flag]
| + | ;Valoare comanda furnizor |
− | , pp.PretValuta * pp.Cant AS [Valoare comanda furnizor]
| + | ;Valuta comanda furnizor |
− | , pp.PretValuta*pp.Cant --(pp.PretValuta + ISNULL(pp.CostTransport,0)) * pp.Cant
| + | ;Adresa livrare |
− | * CASE WHEN ISNULL(pc.ValutaId,@valutaDefaultId) <> ISNULL(@ValutaID,@valutaDefaultid)
| + | ;Termen livrare |
− | THEN ISNULL(dbo.GetCurs(pc.ValutaId,getdate()),1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,getdate()),0),1)
| + | ;Observatii comanda client |
− | ELSE 1
| + | ;Data DVI |
− | END
| + | ;Numar DVI |
− | + (ISNULL(pp.CostTransport,0)
| + | ;Numar factura |
− | * CASE WHEN ISNULL(pp.ValutaTransportId,@valutaDefaultId) <> ISNULL(pp.ValutaTransportId,@valutaDefaultid)
| + | ;Data factura |
− | THEN ISNULL(dbo.GetCurs(pp.ValutaTransportId,getdate()),1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,getdate()),0),1)
| + | ;Data receptie |
− | ELSE 1
| + | ;Cantitate intrata |
− | END) AS [Valoare achizitie - Valuta curs]--DA
| + | ;Serie intrare |
− | , pp.PretValuta * pp.Cant -- (pp.PretValuta + ISNULL(pp.CostTransport,0)) * pp.Cant
| + | ;Data expirare |
− | * CASE WHEN ISNULL(pc.ValutaId,@valutaDefaultId) <> ISNULL(@ValutaID,@valutaDefaultid)
| + | ;Lot intrare |
− | THEN ISNULL(dbo.GetCurs(pc.ValutaId,pc.PorderDate),1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,pc.PorderDate),0),1)
| + | ;Data fabricare |
− | ELSE 1
| + | ;Pret intrare valuta |
− | END
| + | ;Valuta intrare |
− | + (ISNULL(pp.CostTransport,0)
| + | ;Taxe vamale |
− | * CASE WHEN ISNULL(pp.ValutaTransportId,@valutaDefaultId) <> ISNULL(@ValutaID,@valutaDefaultid)
| + | ;Comision vamal |
− | THEN ISNULL(dbo.GetCurs(pp.ValutaTransportId,pc.PorderDate),1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,pc.PorderDate),0),1)
| + | ;Stare comanda furnizor |
− | ELSE 1
| + | ;Stare comanda client |
− | END) AS [Valoare achizitie - Valuta]
| + | ;De comandat |
− | , pp.Cant * isnull(sp.Pretvalutaredus,sp.pretvaluta)
| + | ;Furnizor comanda |
− | * CASE WHEN ISNULL(sp.ValutaId,@ValutaDefaultID) <> ISNULL(@ValutaId,@ValutaDefaultId)
| + | ;Observatii comanda furnizor |
− | THEN ISNULL(sp.CursValutar,1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,pc.PorderDate),0),1)
| + | ;Cost asigurare |
− | ELSE 1
| + | ;Valuta cost asigurare |
− | END - (pp.PretValuta + ISNULL(pp.CostTransport,0)) * pp.Cant
| + | ;Cost transport |
− | * CASE WHEN ISNULL(pc.ValutaId,@valutaDefaultId) <> ISNULL(@ValutaID,@valutaDefaultid)
| + | ;Valuta cost transport |
− | THEN ISNULL(dbo.GetCurs(pc.ValutaId,pc.PorderDate),1) / ISNULL(NULLIF(dbo.GetCurs(@ValutaId,pc.PorderDate),0),1)
| + | ;Cost impachetare |
− | ELSE 1
| + | ;Valuta cost impachetare |
− | END AS [Adaos]
| + | ;Numar tracking |
− | , pc.ValutaId AS [Valuta comanda furnizor]
| + | ;Transportator |
− | , ISNULL(cll.Adresa,'') + ISNULL('LC:' + sp.AdresaLivrare,'') + ISNULL('LF:' + pp.AdresaLivrare,'') AS [Adresa livrare]
| + | ;Cantitate livrata |
− | , isnull(pp.DataLivrare,pc.DataLivrare) AS [Termen livrare]
| + | ;Proiect client |
− | , ISNULL(sc.Observatii + ' ','') + ISNULL(sp.Observatii,'') AS [Observatii comanda client]
| + | ;Proiect furnizor |
− | , ic.DataDVI AS [Data DVI]
| + | ;Tip client |
− | , ic.NumarDVI AS [Numar DVI]
| + | ;Cod Client |
− | , ic.NumarFactIntr AS [Numar factura]
| + | ;Atribut1 Client |
− | , ic.DataFactIntr AS [Data factura]
| + | ;Tip livrare |
− | , ISNULL(ic.[DataReceptie], ic.DataIntr) AS [Data receptie]
| + | ;Termen plata |
− | , ip.CantIntrare AS [Cantitate intrata]
| + | ;Mod plata |
− | , ip.SerieIntrare AS [Serie intrare]
| + | ;Data livrare comanda client |
− | , ip.DataExpirare AS [Data expirare]
| + | ;Numar intern |
− | , ip.LotIntrare AS [Lot intrare]
| + | ;Data livrare comanda furnizor |
− | , ip.DataFabricare AS [Data fabricare]
| + | ;Data livrare 2 comanda client |
− | , ip.PretIntrareValuta AS [Pret intrare valuta]
| + | ;Saptamana |
− | , ip.ValutaId AS [Valuta intrare]
| + | ;Cod 4 |
− | , ip.TaxeVamale AS [Taxe vamale]
| + | ;Cod 5 |
− | , ip.ComisionVamal AS [Comision vamal]
| + | ;Greutate bruta comanda furnizor |
− | , scf.Stare AS [Stare comanda furnizor]
| + | ;Greutate neta comanda furnizor |
− | , scc.Stare AS [Stare comanda client]
| + | ;Tara origine comanda furnizor |
− | , CASE WHEN pp.POrderPozId IS NULL
| + | ;Incadrare vamala comanda furnizor |
− | THEN 1
| |
− | ELSE 0
| |
− | END AS [De comandat]
| |
− | , fr.DenumireUnitate AS [Furnizor comanda]
| |
− | , ISNULL(pp.Observatii+' ','') + ISNULL(pc.Observatii , '') AS [Observatii comanda furnizor]
| |
− | , pp.CostAsigurare AS [Cost asigurare]
| |
− | , pp.ValutaAsigurareId AS [Valuta cost asigurare]
| |
− | , pp.CostTransport AS [Cost transport]
| |
− | , pp.ValutaTransportId AS [Valuta cost transport]
| |
− | , pp.CostImpachetare AS [Cost impachetare]
| |
− | , pp.ValutaImpachetareId AS [Valuta cost impachetare]
| |
− | , pp.NrTracking AS [Numar tracking]
| |
− | , trsp.DenumireUnitate AS Transportator
| |
− | , ocp.DiscountOff
| |
− | , ocp.DiscountOff2
| |
− | , ocp.PretLista AS PretLista
| |
− | , sp.CantLivrata AS [Cantitate livrata]
| |
− | , p.Cod AS [Cod Produs]
| |
− | , isnull(pp.PretValuta,0)-isnull(ip.PretIntrareValutaRedus,0) as [Diferenta pret comanda factura]
| |
− | , pro1.DenumireProiect as [Proiect client]
| |
− | , pro2.DenumireProiect as [Proiect furnizor]
| |
− | , CLF.DenumireUnitate AS [Client comanda furnizor]
| |
− | , cpr.DenumireCategorieProdus AS [Categorie Produs]
| |
− | , spr.DenumireSubcategorieProdus AS [Subcategorie Produs]
| |
− | , tpr.DenumireTipProdus AS [Tip Produs]
| |
− | , gpr.DenumireGrupaV AS [Grupa Produs]
| |
− | , t.DenumireTara AS [Tara de origine]
| |
− | , pc.ObservatiiInterne AS [Observatii interne]
| |
− | , us.DenumireUnitate as [Persoana introducere]
| |
− | , g.DenumireGestiune AS [Gestiune]
| |
− | , tp.Denumire AS [Termen plata]
| |
− | , tp.NumarZile AS [Numar zile termen plata]
| |
− | , DATEADD(dd,tp.NumarZile,isnull(pp.DataLivrare,pc.DataLivrare)) AS [Data Scadenta]
| |
− | , @ValutaId AS [Valuta filtru]
| |
− | , ISNULL(cc.CentruCost + ' ','') + ISNULL(cc.DenCentruCost,'') as [Centru cost]
| |
− | , pp.ObservatiiInterne AS [Observatii interne comanda furnizor]
| |
− | , pro2.NrProiect AS [Numar proiect furnizor]
| |
− | , pp.Cant *(cast(isnull(p.bucatium,1) as decimal(22,8))) AS [Cantitate bucati um]
| |
− | , umb.um as [Um buc]
| |
− | , p.bucatium as [Bucati um]
| |
− | , ip.CantIntrare *(cast(isnull(p.bucatium,1) as decimal(22,8))) AS [Cantitate buc UM intrare ]
| |
− | , (pp.cant-isnull(pp.CantReceptionata,0)) *(cast(isnull(p.bucatium,1) as decimal(22,8))) as [Cantitate buc UM nereceptionata]
| |
− | , Isnull(pp.DataLivrare,pc.DataLivrare) as [Data Livrare]
| |
− | , ISNULL(cle.CodConditieLivrareExterna + ' - ', '') + cle.DenumireConditieLivrareExterna as [Conditii livrare externa]
| |
− | , ISNULL(mt.CodModalitateTransport + ' - ', '') + mt.DenumireModalitateTransport as [Modalitate transport]
| |
− | , g2.DenumireGestiune AS [Gestiune intrare]
| |
− | ,p.Cod4
| |
− | ,p.Cod5
| |
− | ,sc.Observatii2
| |
− | ,pp.Attr1
| |
− | ,pp.GreutateBruta as [Greutate bruta]
| |
− | ,pp.GreutateNeta as [Greutate neta]
| |
− | ,taraorig.DenumireTara as [Tara origine comanda]
| |
− | ;Incadrare vamala | |