VUES SQL WAVESOFT POUR EDITION DES DOCUMENTS

  • Auteur/autrice de la publication :
  • Post category:SQL / Wavesoft
  • Commentaires de la publication :0 commentaire

VEXT_TOTALREMISESLIGNES

Permet de savoir si il existe une différence entre la somme des PU brut et net

CREATE OR REPLACE VIEW VEXT_TOTALREMISESLIGNES AS
SELECT PCVID, SUM(PLVPUNET – PLVPUBRUT) AS TotalRemisesLignes
FROM dbo.PIECEVENTELIGNES
WHERE (PLVIDNOMCPERE = 0)
GROUP BY PCVID

VEXT_TOTALHTBRUTDOC

Permet de calculer le total HT BRUT avant remise en pied

CREATE OR REPLACE VIEW VEXT_TOTALHTBRUTDOC AS
SELECT PCVID, SUM(PLVMNTNETHT) AS TOTALHTBRUT
FROM dbo.PIECEVENTELIGNES
WHERE (PLVTYPE = ‘L’)
GROUP BY PCVID

VEXT_TRACABILITE_LIGNE

Permet d’avoir des informations sur l’origine d’une ligne

CREATE OR REPLACE VIEW VEXT_TRACABILITE_LIGNE AS
SELECT TOP (100) PERCENT LPORI.PCVID AS PCVID_ORI, LPORI.PLVID AS PLVID_ORI, LPDES.PCVID AS PCVID_DES, LPORI.PLVQTE AS PLVQTE_ORI,
LPDES.PLVQTE AS PLVQTE_DES, EPORI.PCVNUM AS PCVNUM_ORI, EPDES.PCVNUM AS PCVNUM_DES, EPDES.PCVDATEEFFET, LPDES.PLVNUMSERIE
FROM dbo.PIECEVENTES AS EPORI INNER JOIN
dbo.PIECEVENTELIGNES AS LPORI ON EPORI.PCVID = LPORI.PCVID LEFT OUTER JOIN
dbo.PIECEVENTES AS EPDES INNER JOIN
dbo.PIECEVENTELIGNES AS LPDES ON EPDES.PCVID = LPDES.PCVID ON LPORI.PLVID = LPDES.PLVIDORG
ORDER BY PLVID_ORI, PCVID_DES

 

Laisser un commentaire