Although there is no direct link between the GL7TRANSACTIONS and AP7INVOICES tables, you can join to the AP7PAYMENTS and BBDISTRIBUTIONS tables to get the Vendor information. An example of such a join between the SQL tables is shown below.

select ven.VENDORNAME, inv.INVOICENUMBER, convert(varchar, gt.postdate, 101) as 'POST DATE', 
gt.TRANSACTIONNUMBER, gt.REFERENCE, gt.SOURCENUMBER, gt.SOURCETYPE, *

from AP7PAYMENTS ap
left outer join BBDISTRIBUTIONS bd on ap.CHECKS7ID = bd.PARENTID
left outer join GL7TRANSACTIONS gt on bd.GL7TRANSACTIONSID = gt.GL7TRANSACTIONSID
left outer join AP7INVOICES inv on ap.AP7INVOICESID = inv.AP7INVOICESID
left outer join AP7VENDORS ven on inv.AP7VENDORSID = ven.AP7VENDORSID

where YEAR(gt.POSTDATE)= '2013' -- Post Date year = 2013
and gt.TRANSACTIONTYPE = 1 -- Transaction type = Debit

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Our Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.