SELAM ARKADAŞLAR HATAYI NEREDE YAPIYORUM CARİLER YANLIŞ GELİYOR
SELECT MALZEME.NAME [MALZEME ADI]
, STRNS.AMOUNT [MİKTAR]
, STRNS.PRICE [BİRİM FİYAT]
,STRNS.TOTAL [TOPLAM TUTAR]
,STFIC.DATE_[TARİH]
,PA.PRICE[ALIŞ FİYAT]
,PS.PRICE[SATIŞ FİYAT]
,CARİ.DEFINITION_[CARİ HESAP]
FROM LG_007_01_STLINE STRNS WITH(NOLOCK)
LEFT OUTER JOIN LG_007_01_STFICHE STFIC ON (STRNS.STFICHEREF = STFIC.LOGICALREF)
LEFT OUTER JOIN LG_007_ITEMS MALZEME ON (STRNS.STOCKREF = MALZEME.LOGICALREF)
LEFT OUTER JOIN LG_007_PRCLIST PA ON PA.CARDREF = MALZEME.LOGICALREF AND PA.PTYPE=1
LEFT OUTER JOIN LG_007_PRCLIST PS ON PS.CARDREF = MALZEME.LOGICALREF AND PS.PTYPE=2
LEFT OUTER JOIN LG_007_CLCARD CARİ ON STFIC.LOGICALREF =CARİ.LOGICALREF
WHERE (STRNS.SOURCEINDEX IN (0,1)) AND ((STFIC.DATE_ >= CONVERT(dateTime, '1-1-2013', 101)) AND (STFIC.DATE_ <= CONVERT(dateTime, '01-17-2013', 101))) AND (STFIC.CANCELLED = 0)
AND STFIC.TRCODE IN (
ORDER BY MALZEME.NAME