Kişi bilgileri gizlidir. Logo çalışanları görebilir.

Satışlar Tablosu Sorgusu

  Tiger/Logo Objects

Merhabalar,

Satışlar Tablosu raporunun sql sorgusuna ihtiyacım var. Yardımlarınızı rica ederim.




Kişi bilgileri gizlidir. Logo çalışanları görebilir.
Onaylanmış Cevap

SELECT MONTH(xx.DATE_) AY,YEAR(xx.DATE_) YIL, round(SUM(xx.TOTAL),2) TOPLAM_TUTAR,round(SUM(xx.DISTDISC),2) İNDİRİMLER,round(SUM(xx.TOTAL)-SUM(xx.DISTDISC),2) TUTAR ,round(SUM(xx.VATAMNT),2) KDV

from

(

SELECT

INVFC.TRCURR, INVFC.DEPARTMENT, INVFC.BRANCH, INVFC.FACTORYNR, INVFC.TRADINGGRP, INVFC.DATE_, INVFC.STATUS, INVFC.SPECODE, INVFC.CYPHCODE, INVFC.LOGICALREF, INVFC.FICHENO, INVFC.TRCODE, INVFC.EXIMFCTYPE, INVFC.GRPFIRMTRANS,

STRNS.SOURCEINDEX, STRNS.DECPRDIFF, STRNS.VATAMNT, STRNS.VAT, STRNS.TOTAL, STRNS.LINETYPE, STRNS.LINENET, STRNS.REPORTRATE, STRNS.TRRATE, STRNS.TRCURR CURR, STRNS.VATINC, STRNS.INVOICEREF,

STRNS.PARENTLNREF, STRNS.GLOBTRANS, STRNS.ABVATSTATUS, STRNS.DISTDISC, STRNS.DISTEXP, CLNTC.CODE AS CLNTCCODE, CLNTC.SPECODE AS GROUPS, CLNTC.CYPHCODE AS CYPHCODES , CLNTC.SPECODE2, CLNTC.SPECODE3, CLNTC.SPECODE4,

CLNTC.SPECODE5, CLNTC.LOGICALREF CLNTCLOG, SLSMC.CODE SLSMCCODE,

SLSMC.DEFINITION_, SLSMC.POSITION_, SLSMC.ACTIVE, SLSMC.LOGICALREF SLSMCLOGICALREF, ITMSC.CODE, ITMSC.SPECODE ITMSCSPECODE , PROJECT.CODE PROJECTCODE, PROJECT.NAME, PROJECT.LOGICALREF PROJECTLOGICALREF

FROM

LG_056_01_INVOICE INVFC WITH(NOLOCK)

LEFT OUTER JOIN LG_056_01_STLINE STRNS WITH(NOLOCK) ON (INVFC.LOGICALREF = STRNS.INVOICEREF)

LEFT OUTER JOIN LG_056_CLCARD CLNTC WITH(NOLOCK) ON (INVFC.CLIENTREF = CLNTC.LOGICALREF)

LEFT OUTER JOIN LG_SLSMAN SLSMC WITH(NOLOCK) ON (STRNS.SALESMANREF = SLSMC.LOGICALREF)

LEFT OUTER JOIN LG_056_ITEMS ITMSC WITH(NOLOCK) ON (STRNS.STOCKREF = ITMSC.LOGICALREF)

LEFT OUTER JOIN LG_056_PROJECT PROJECT WITH(NOLOCK) ON (STRNS.PROJECTREF = PROJECT.LOGICALREF)

WHERE

(INVFC.DEPARTMENT IN (0)) AND (INVFC.BRANCH IN (0,1)) AND (INVFC.FACTORYNR IN (0)) AND

((INVFC.DATE_ >= CONVERT(dateTime, '1-1-2021', 101)) AND (INVFC.DATE_ <= CONVERT(dateTime, '12-31-2021', 101))) AND (INVFC.STATUS IN (0,1)) AND

(NOT(INVFC.TRCODE IN(5, 10)) ) AND (INVFC.CANCELLED = 0 ) AND (INVFC.GRPCODE = 2) AND (INVFC.DEVIR IN (0)) AND (STRNS.LINETYPE <> 2 ) AND (STRNS.LINETYPE <> 3 )

)xx group by MONTH(xx.DATE_),YEAR(xx.DATE_)


18/11/21 15:23

Cevap vermek için giriş yapmanız gerekmektedir.