You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于Acumatica中GL Account汇总信息计算对象的技术问询

Solution for GL Account Summary Export in Acumatica

Hey there! I’ve worked with Acumatica’s GL APIs quite a bit, so let me walk you through the best way to calculate those period summary values (beginning balance, net change, ending balance) and build your export tool.

The Key Acumatica Object You Need

Acumatica has a dedicated business logic graph called GLHistoryEnq that’s designed exactly for this kind of GL account period summary calculation. It handles all the heavy lifting—like aggregating transactions, accounting for beginning balances, and respecting financial period boundaries—so you don’t have to reinvent the wheel.

Step-by-Step Implementation

Here’s how to use it in your custom code:

  1. Initialize the GL History Inquiry Graph
    Start by creating an instance of the GLHistoryEnq graph, which lives in the PX.Objects.GL namespace.

  2. Configure Your Filters
    Set the necessary parameters to target your specific financial period, branch, and any account filters you need:

    • BranchID: The company branch you’re querying
    • FinPeriodID: The target financial period ID (e.g., "2024-03")
    • Optional filters: Account masks, subaccount masks, or ledger type if you need to narrow results
  3. Retrieve the Summary Data
    Use the FillTable() method to populate the graph’s History view with calculated summary values. Each row in this view is a GLHistoryResult DAC, which includes all the fields you need out of the box.

Example Code Snippet

using PX.Data;
using PX.Objects.GL;

// Create instance of the GL History Inquiry graph
GLHistoryEnq glHistoryGraph = PXGraph.CreateInstance<GLHistoryEnq>();

// Set up filter parameters
glHistoryGraph.Filter.Current.BranchID = 1; // Replace with your Branch ID
glHistoryGraph.Filter.Current.FinPeriodID = "2024-Q2"; // Replace with your target period
// Add optional filters if needed, e.g., account mask:
// glHistoryGraph.Filter.Current.AccountMask = "100000-";

// Populate the summary data
glHistoryGraph.FillTable();

// Iterate through results and prepare for export
foreach (GLHistoryResult summary in glHistoryGraph.History.Select())
{
    string accountCode = summary.AccountCD;
    decimal beginningBalance = summary.BeginningBalance;
    decimal netChange = summary.PeriodDebit - summary.PeriodCredit;
    decimal endingBalance = summary.EndingBalance; // Already calculated for you!

    // Write these values to your text file here
    // Example: $"{accountCode},{beginningBalance},{netChange},{endingBalance}"
}

Additional Notes

  • GLHistoryResult DAC Fields: This class includes pre-calculated values like BeginningBalance, PeriodDebit, PeriodCredit, and EndingBalance—so you don’t have to manually compute ending balance unless you have custom logic.
  • Permissions: Make sure the user account running your custom program has the appropriate GL inquiry permissions in Acumatica (e.g., the "GL Inquiry" role) to access this data.
  • Alternative for Custom Logic: If you need more control (like including unposted transactions or custom calculations), you can query the GLTran table directly and join with FinPeriod to aggregate totals—but GLHistoryEnq is the recommended approach since it encapsulates Acumatica’s native financial logic.

内容的提问来源于stack exchange,提问作者David Eichner

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:27:05