In QODBC v8.00.00.228 (and higher) we added a ton of new indexes on all tables on the optimizer backend (only). AppliedToTxnTxnID is now a optimized index: ReceivePaymentLine_FQSPECIAL06.
So queries on AppliedToTxnTxnID now work well when structured correctly.
In the InvoiceLinkedTxn table, The TxnID is the same TxnID as the Invoice. The LinkedTxnTxnType tells you what the line is linked to which can be any one of:
Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, LiabilityAdjustment, Paycheck, PayrollLiabilityCheck, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, Transfer, VendorCredit, YTDAdjustment, or ARRefundCreditCard
and the LinkedTxnTxnID is the TxnID of the record it is linked to. The InvoiceLinkedTxn table is a read-only table. So you have to do things like insert a ReceivePaymentLine record that points to the Invoice.TxnID and then display the InvoiceLinkedTxn table and you will see the record inserted as a line with a LinkedTxnTxnType of ReceivePayment and the TxnID of the ReceivePayment.
For example, here you can see two payments against the one invoice:
SELECT TxnID, LinkedTxnTxnType, LinkedTxnTxnID, LinkedTxnTxnDate as Date, LinkedTxnRefNumber as Number, LinkedTxnAmount as Amount, BalanceRemaining as Balance from InvoiceLinkedTxn
This query will extract infromation from the Invoice and InvoiceLinkedTxn tables using the QODBC optimizer (by use of the NOSYNC tag) for maximum speed:
SELECT Invoice.CustomerRefFullName, Invoice.RefNumber, InvoiceLinkedTxn.TxnID, InvoiceLinkedTxn.LinkedTxnTxnType, InvoiceLinkedTxn.LinkedTxnTxnID, InvoiceLinkedTxn.LinkedTxnTxnDate as Date, InvoiceLinkedTxn.LinkedTxnRefNumber as Number, InvoiceLinkedTxn.LinkedTxnAmount as Amount, InvoiceLinkedTxn.BalanceRemaining as Balance from Invoice NOSYNC, InvoiceLinkedTxn NOSYNC where Invoice.TxnID=InvoiceLinkedTxn.TxnID and Invoice.TxnDate >= {d'2007-01-01'} order by Invoice.CustomerRefFullName
If you don't see recent information, you can resync the optimized tables by running:
sp_optimizeupdatesync Invoice
sp_optimizeupdatesync InvoiceLinkedTxn |