There are a variety of ways users can view balances in the general ledger. Some of the most common options are:
1. Trial balance
2. Financial reports
3. Voucher transactions
4. Ledger reports
The same can be achieved by some jobs like this to calculate ledger balance by dimension set which is derived from the class DimensionserviceProvider.
static void CalculateBalanceByFocusSet(Args _args) { List dimensionValuesList; DimensionSetContract dimensionSet = new DimensionSetContract(); DimensionAttributeValueContract dimensionAttributeValueContract; DimensionAttributeValueContract dimensionAttributeValueContract2; DimensionAttributeValueContract dimensionAttributeValueContract3; RecId ledgerDimensionId; RecId ledgerId; DimensionAttributeValueCombination dimAttrValueCombo; LedgerBalanceDimAttrValueComboAmounts ledgerBalance; DimensionServiceProvider serviceProvider = new DimensionServiceProvider(); DimensionSetBalanceContract result = new DimensionSetBalanceContract(); DimensionSetCombinationContract dimensionSetCombinationContract; dimensionValuesList = new List(Types::Class); dimensionAttributeValueContract = new DimensionAttributeValueContract(); dimensionAttributeValueContract.parmName("Mainaccount"); dimensionAttributeValueContract.parmValue("111"); /* dimensionAttributeValueContract2 = new DimensionAttributeValueContract(); dimensionAttributeValueContract2.parmName("CostCenter"); dimensionAttributeValueContract2.parmValue("1111"); dimensionAttributeValueContract3 = new DimensionAttributeValueContract(); dimensionAttributeValueContract3.parmName("Activity"); dimensionAttributeValueContract3.parmValue("1111"); */ dimensionValuesList.addEnd(dimensionAttributeValueContract); //dimensionValuesList.addEnd(dimensionAttributeValueContract2); //dimensionValuesList.addEnd(dimensionAttributeValueContract3); dimensionSetCombinationContract = new DimensionSetCombinationContract(); dimensionSetCombinationContract.parmValues(dimensionValuesList); dimensionSetCombinationContract.parmDimensionSetName("MA"); // Based on the input dimensions we need to set the name, ex : MA+CC+AC dimensionSet.parmAccountingDateFrom(1\5\2019); dimensionSet.parmAccountingDateTo(30\4\2020); dimensionSet.parmCombination(dimensionSetCombinationContract); // Validate DimensionSetContract DimensionServiceProvider::validateDimensionSet(dimensionSet); // Setup LedgerBalanceDimAttrValueComboAmounts ledgerBalance = LedgerBalanceDimAttrValueComboAmounts::construct(); ledgerBalance.parmAccountingDateRange(dimensionSet.parmAccountingDateFrom(), dimensionSet.parmAccountingDateTo()); ledgerBalance.parmIncludeOpeningPeriod(true);//_dimensionSet.parmIncludeOpeningFiscalPeriod()); ledgerBalance.parmIncludeRegularPeriod(true);///_dimensionSet.parmIncludeOperatingFiscalPeriod()); if (dimensionSet.parmIsSystemGeneratedUltimo()) { ledgerBalance.parmIncludeClosingPeriodBySystem(dimensionSet.parmIsSystemGeneratedUltimo()); } else { ledgerBalance.parmIncludeClosingPeriod(dimensionSet.parmIncludeClosingFiscalPeriod()); } ledgerBalance.parmLedgerRecId(Ledger::current()); ledgerDimensionId = serviceProvider.buildDimStorageForDimSetCombo(dimensionSet.parmCombination()); Debug::assert(ledgerDimensionId); dimAttrValueCombo = DimensionAttributeValueCombination::find(ledgerDimensionId); ledgerBalance.calculateBalance(dimAttrValueCombo); info(strFmt("%1", ledgerBalance.getAccountingCurrencyBalance())); }