LOGO Tiger Alış – Satış Faturaları SQL kodları

SELECT SUM(dbo.LG_XXX_01_INVOICE.GROSSTOTAL) FROM dbo.LG_XXX_01_INVOICE LEFT JOIN
     dbo.LG_XXX_CLCARD ON dbo.LG_XXX_01_INVOICE.CLIENTREF = dbo.LG_XXX_CLCARD.LOGICALREF
     LEFT JOIN dbo.L_CAPIDEPT ON dbo.LG_XXX_01_INVOICE.DEPARTMENT = dbo.L_CAPIDEPT.NR
     AND dbo.L_CAPIDEPT.FIRMNR ='300'                            
 WHERE 
    DATE_ BETWEEN '2020-01-01 00:00:00.000'  AND '2020-06-30 23:59:59.999' AND
    LG_XXX_01_INVOICE.TRCODE IN ('2','3','7','8','9','10','14') AND 
    dbo.LG_XXX_01_INVOICE.CANCELLED='0' AND
    dbo.LG_XXX_01_INVOICE.SALESMANREF='2324' -- ÜRETİM SATIŞ(satış eleman kodu)
 UNION ALL
 SELECT SUM(dbo.LG_XXX_01_INVOICE.GROSSTOTAL) FROM dbo.LG_XXX_01_INVOICE LEFT JOIN
    dbo.LG_XXX_CLCARD ON dbo.LG_XXX_01_INVOICE.CLIENTREF = dbo.LG_XXX_CLCARD.LOGICALREF
    LEFT JOIN dbo.L_CAPIDEPT ON dbo.LG_XXX_01_INVOICE.DEPARTMENT = dbo.L_CAPIDEPT.NR 
    AND dbo.L_CAPIDEPT.FIRMNR ='300'
 WHERE 
     DATE_ BETWEEN '2020-01-01 00:00:00.000'  AND '2020-06-30 23:59:59.999' AND
     LG_XXX_01_INVOICE.TRCODE IN ('1','4','5','6','13','26') AND
     dbo.LG_XXX_01_INVOICE.CANCELLED='0' AND
     dbo.LG_XXX_01_INVOICE.SALESMANREF='2337' -- ÜRETİM ALIŞ(satış eleman kodu)

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir