Raporu biraz revize ettim fakat istediğim sonuca ulaşamadım,
Rapor, Fatura numarası, tarihi ve satırlarındaki bilgileri getirmesi için fatura no ve tarihi çektim fakat irsaliyedeki satırları getirdiği için doğru sonuca ulaşamadım.
Fatura satırlarını nasıl getirebiliriz?
SELECT
dbo.LG_012_CLCARD.CODE AS CariHesapKodu,
dbo.LG_012_CLCARD.DEFINITION_ AS CariHesapAciklamasi,
dbo.LG_012_CLCARD.SPECODE AS CariHesapOzelKodu,
dbo.LG_012_CLCARD.SPECODE2 as CariHesapOzelKodu2,
dbo.LG_012_ITEMS.CODE AS MalzemeKodu,
dbo.LG_012_ITEMS.NAME as MalzemeAciklamasi,
dbo.LG_012_ITEMS.SPECODE AS MalzemeOzelKodu,
dbo.LG_012_ITEMS.STGRPCODE AS MalzemeGrupKodu,
dbo.LG_012_01_INVOICE.FICHENO as FaturaNo,
dbo.LG_012_01_INVOICE.DATE_ as FaturaTarihi,
dbo.LG_012_01_STFICHE.SOURCEINDEX as Ambar,
dbo.LG_012_01_STLINE.AMOUNT AS Miktar,
dbo.LG_012_01_STLINE.PRICE AS BirimFiyat,
dbo.LG_012_01_STLINE.TOTAL AS Toplam,
dbo.LG_012_01_STLINE.VATMATRAH+ dbo.LG_012_01_STLINE.VATAMNT AS NetTutar,
dbo.LG_SLSMAN.DEFINITION_ AS SatisElemani,
dbo.LG_012_01_STFICHE.TRCODE as FaturaTuru
FROM
LG_012_01_STFICHE INNER JOIN
LG_012_01_STLINE ON LG_012_01_STLINE.STFICHEREF = LG_012_01_STFICHE.LOGICALREF INNER JOIN
LG_012_CLCARD ON LG_012_CLCARD.LOGICALREF=LG_012_01_STLINE.CLIENTREF INNER JOIN
LG_012_ITEMS ON LG_012_ITEMS.LOGICALREF=LG_012_01_STLINE.STOCKREF LEFT OUTER JOIN
LG_SLSMAN ON LG_SLSMAN.LOGICALREF=LG_012_01_STLINE.SALESMANREF
LEFT OUTER JOIN LG_012_01_INVOICE ON LG_012_01_INVOICE.LOGICALREF = LG_012_01_STFICHE.INVOICEREF
WHERE
dbo.LG_012_01_STLINE.LINETYPE=0 AND
LG_012_01_STFICHE.CANCELLED=0 AND
LG_012_01_STFICHE.TRCODE >= 7
ORDER BY dbo.LG_012_ITEMS.STGRPCODE