Home SuiteQL: GL Impact
Post
Cancel

SuiteQL: GL Impact

Introduction

In the post SuiteQL: Transactions we discussed the Transaction and the TransactionLine tables.

A third table called the TransactionAccountingLIne table contains the GL impact of the transaction. This table contains the data you will see when viewing the GL impact tab of a transaction.

Getting the GL impact using SuiteQL allows you to see the item associated with a particular GL impact line. This can be very useful for debugging. In this example we will look at a work order close transaction of an account that uses standard costing. Netsuite also has a table TransactionAccountingLIneCostComponent that has a more detailed breakdown of the underlying costs but this post will just discuss getting the GL impact as shown on the GL impact tab.

TransactionAccountingLIne

This table is where the data resides. It has a 1:N relationship with the TransactionLine table i.e. one line item on the transaction can have multiple GL lines.

Since the primary key of the TransactionLine table is the columns TransactionLine.id and TransactionLine.transaction we must join to the TransactionAccountingLIne using both columns:

1
2
3
FROM Transaction INNER JOIN TransactionLine on TransactionLine.transaction = transaction.id
INNER JOIN TransactionAccountingLIne on TransactionAccountingLIne.transactionline = TransactionLine.id
AND TransactionAccountingLIne.transaction = transactionLine.transaction

Here are some important columns of the TransactionAccountingLIne table:

ColumnDescription
creditCredit amount if the line is a credit
debitDebit amount if the line is a debit
netamountNet amount of line whether it’s a debit or a credit
accountAccount internal id of the GL entry
postingWhether it posted to the GL or not

The item is not stored on the TransactionAccountingLIne table, but we can use the column TransactionLine.item to get the item.

Example WOC GL impact Explained

The GL impact of a Work Order Close of an account that uses Standard costing might look something like this:

AccountAmount (Debit)Amount (Credit)
Wip Inventory 100
Wip Inventory 500
Wip Inventory 1000
COGS: Overhead Variance100 
COGS: Usage Variance 200
Finished Good Inventory Asset1700 

For each inventory item there is a credit from the WIP inventory account, in this example simply named “WIP inventory”. For the assembly item there is a debit to the inventory asset account in this case “Finished Good Inventory Asset”.

Because the amounts being debited and credited from those accounts are always simply the standard cost of the items times the quantity, they won’t always match up.

  1. If the quantity used in the work order was less or then what is usually required to build this assembly. In this case there will be a credit/debit to the “Production Quantity Variance” account. In this example the account is named “COGS: Usage Variance”.
  2. Even if we used the appropriate quantities as listed on the BOM, the costs still don’t match up. In this case there will be a credit/debit to the “Production Price Variance” account. In this example the account is named “COGS: Overhead Variance”.

There may be more lines if there are Manufacturing Routing costs associated with the assembly item. For more information about the variances on a Work Order close please refer to SuiteAnswers #28082.

The Query

Given a transaction internal id of 1234:

1
2
3
4
5
6
7
8
9
10
11
SELECT
Transaction.tranid as document_number,
BUILTIN.DF(TransactionLine.item) as item,
BUILTIN.DF(TransactionAccountingLIne.account) as account,
TransactionAccountingLIne.debit,
TransactionAccountingLIne.credit,
TransactionAccountingLIne.posting
FROM Transaction INNER JOIN TransactionLine on TransactionLine.transaction = transaction.id
INNER JOIN TransactionAccountingLIne on TransactionAccountingLIne.transactionline = TransactionLine.id
AND TransactionAccountingLIne.transaction = transactionLine.transaction
WHERE transaction.id = 1234

This query will return the following data:

Document_NumberItemAccountDebitCreditPosting
WOC1234Inventory Item 1Wip Inventory 100T
WOC1234Inventory Item 2Wip Inventory 500T
WOC1234Inventory Item 3Wip Inventory 1000T
WOC1234Assembly Item 1COGS: Overhead Variance100 T
WOC1234Assembly Item 1COGS: Usage Variance 200T
WOC1234Assembly Item 1Finished Good Inventory Asset1700 T

NetSuite Boolean values are stored as T or F.

An important detail to note is that that the variance will always be associated with the main item line. For a more detailed breakdown of the variance you would have to query the items standard cost and calculate it yourself.

Conclusion

Until NetSuite provides the ability for saved searches to search GL impact of transactions, NetSuite’s SuiteQL module can be invaluable for generating insights into the GL impact of a transaction and how each item line affects the GL

In the next post we will discuss the Item table and some fields you might use to get information about an item.

This post is licensed under CC BY 4.0 by the author.

SuiteQL: Inventory Detail

SuiteQL: Items