How to get the related ledger transaction of a CD line/charge

Discussions related to custom development with Select.
Post Reply
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

How to get the related ledger transaction of a CD line/charge

Post by ckootg »

I'm creating the CD line/charge like this, which creates a pending check in the register. How do I get the pending check transaction?

Code: Select all

var cdfs = ((dynamic)order).CDFs;
var sectionHLine = ((dynamic)cdfs[0]).NextAvailableLine(CDFSectionType.OtherCosts);
sectionHLineNumber = sectionHLine.Number.ToString();

var charge = ((IEnumerable<IOrderItem>)((dynamic)sectionHLine).Charges).First();
charge["SellerPaidAtClosing"] = amount;
I've tried searching for the transaction using the tags -- based on this post (viewtopic.php?f=6&t=806&p=3441), but it doesn't look like the transaction is tagged with the CDFSection and/or CDFLine.

Code: Select all

ILedgersManager lm = selectServer.GetService<ILedgersManager>();
ITransactionsManager tm = selectServer.GetService<ITransactionsManager>();

// Get ledger
ILedgerInfo ledger = lm.Ledgers.Where(l => l.Name == orderNumber).First();

var transactionInfos = tm.Transactions.Where(t => t.Ledger.ID == srcLedger.ID).ToList();
var transactionInfo = transactionInfos
                        .Where(t =>
                            t.Tags.Where(x => x.Name == "CDFSection" && x.Value == ((int)CDFSectionType.OtherCosts).ToString()).Any() &&
                            t.Tags.Where(x => x.Name == "CDFLine" && x.Value == sectionHLineNumber).Any())
                        .FirstOrDefault();
Ken.Byrd
Posts: 2
Joined: Thu Aug 20, 2015 3:20 pm

Re: How to get the related ledger transaction of a CD line/charge

Post by Ken.Byrd »

The CDF line and section are kept in the Sources on the ITransaction. For instance, assuming you have a transaction that is an ITransaction (and has a settlement type of CDF), you can do something like the following:

Code: Select all

            foreach (TransactionSource src in transaction.Sources)
            {
                if (st == SettlementType.CDF)
                {
                    int cdfLine = src.Tags.GetValue<int>(Constants.CDFLineProperty);
                    int cdfSection = src.Tags.GetValue<int>(Constants.CDFSectionProperty);
                }
                else
                {
                    int hudLine = src.Tags.GetValue<int>(Constants.HUDLineProperty);
                }
            }
Also, you can get the ITransaction from the TransactionManager by providing it an ITransactionInfo.
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: How to get the related ledger transaction of a CD line/charge

Post by ckootg »

That works. Thanks!
Post Reply