【管理会计】入门1-账户余额与期初余额

管理会计入门:账户余额与期初余额的SQL查询方法与数据结构解析,帮助BI分析师理解财务数据建模。

2025-06-20 2025-06-22 修正插图,OpeningBalance 中删除 Period_id 2025-06-24 补充第一部分 会计账户设置图片和说明 2025-07-25 增加插图

在企业财务管理中,账户余额和期初余额是核心概念,直接影响财务记录和报表的准确性。本文以“vizwise”公司为例,从账户基本信息、期初余额和会计科目设置入手,逐步介绍相关知识,并通过数据表结构展示其实际应用。

一、账户基本信息与期初余额

用数据方式理解业务概念。

1、会计账户设置

每个会计账户都有很多的属性设置,比如名称、币种(如有)、类型等等。 基于 ERP 的前端页面和后端数据表对照,我们可以快速的业务到数据的反映过程。

A screenshot of the Monitor ERP software interface displaying account settings and configuration details, including fields for account identification, type, VAT specifications, and budget categories, with a focus on facilitating financial analysis.

在会计中,每个账户对应一个或多个会计科目,用于分类和管理财务信息。比如上面的100208科目,就归于“资产”类型(对应数据库中 account.type =1 )

会计科目是财务报表的基石,通常分为资产、负债、权益、收入和费用五大类。银行账户通常归类为“资产”类科目,如“银行存款”或“其他货币资金”。根据账户功能,科目设置需明确账户的性质和用途,确保财务记录清晰。

当然,上面图中有一个隐秘的细节——科目的名称等信息,其实是一个科目在不同年度分开设置的。这就涉及到“会计期间”概念。

2. 会计期间 AccountingYear

会计期间(Accounting Period)是财务记录和报表编制的时间范围,通常以年或月为单位。最常见的是“财年”(Fiscal Year),通常为一个自然年(如2025年1月1日至12月31日)。财年可以进一步细分为12个“会计期间”,通常按月划分(如2025年1月、2025年2月等),以便更精细地跟踪财务活动。

在会计系统中,会计期间通过专门的数据表管理,确保期初余额、交易记录和报表与时间段明确关联。

在 Monitor ERP 中,产品区分了两个概念“会计年度”(AccountingYear) 和“会计年度期间”(AcountingYearPeriod)两个概念。前者当然是年度,后者则是年月。区分这个概念,是理解后续期初余额、余额变化等的基础。

一张白板上写有关于账户类型、期初余额和借贷的手写笔记,包含蓝色和黑色字体的突出内容。

3. 期初余额 OpeningBalance

期初余额(Opening Balance)是某一会计期间开始时账户的余额。

它为本期间的财务记录提供起点。对于新成立的公司,期初余额通常基于初始注资或账户实际资金;对于已有公司,期初余额继承自上一期的期末余额。

4. 账户余额 Balance

账户余额(Account Balance)是指某一账户在特定时点的资金总额。在会计中,每个账户(如银行账户、现金账户等)都会记录其当前的余额,用于反映企业的资产、负债或权益状况。对于银行账户,余额通常是账户中的可用资金。

数据是业务的反映,反映在数据表上,就会有一个 Balance 的数据表。

二、案例:vizwise公司的账户设置

为了简化问题,这里先围绕账户、期间和期初余额展开介绍。

假设“vizwise”公司刚成立,设立了以下三个银行账户,分别对应不同的功能和会计科目:

为管理这些账户及期初余额,我们设计以下两个表:

用于存储账户基本信息,包括对应的会计科目。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据:

📊 account_id | account_name | account_type | currency | subject_code | subject_name

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

科目设置说明:

用于存储会计年度信息,每年一行。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据:

📊 year_id | fiscal_year | start_date | end_date

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

用于存储每个会计年度的月度会计期间。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据(以2025年为例):

📊 period_id | year_id | period_number | start_date | end_date

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

用于存储每个账户在特定会计期间的期初余额,与会计年度和期间关联。

提醒:期初余额不是仅仅有一个,而是不同的“会计期间”分别有一个。最典型的“会计期间”就是各个公司的财年。所以,OpeningBalance 数据表必须有一个标识期间的字段。刚开始可以理解为月初(每个月为一个期间)

修改:期初金额都是“会计年度”为粒度的,因此这里不需要 period_id,删除。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据(假设2025年1月为首个会计期间):

📊 balance_id | account_id | year_id | opening_balance

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
一张展示数据库表结构设计变更的草图,包含账户、会计年度、会计期间和期初余额等相关信息的连接和修改建议。

表结构说明

外键约束确保数据完整性,期初余额与账户、年度和期间一一对应。

图示展示了包含多个会计相关表结构的数据库设计,包括账户信息、会计年度、会计期间和期初余额的字段及其相互关联。

三、在余额中引入借贷概念:会计的精华之所在

在会计中,借贷是最基本的概念,储蓄卡的期初和信用卡的期初是不同的,因此还需要有效地分辨它们的不同。

在会计中,账户余额的借方或贷方属性由其会计科目和余额方向决定:

对于银行卡而言,公户和储蓄卡通常不需要区分,因为余额几乎总是借方。若无透支或特殊情况,单一余额值(如正值)即可。但是信用卡建议区分,因为余额可能为贷方(欠款)或借方(预付),明确方向有助于准确反映负债。

根据之前的案例,vizwise公司的三个银行账户对应不同的会计科目,我们逐一分析是否需要区分借方和贷方余额:

为了让数据表能兼容不同的情形,就需要对上述数据表做必要的升级改造。

四、数据表结构调整建议

为支持借方和贷方余额的记录,建议修改OpeningBalance表,添加余额方向或分开记录借方和贷方金额。

以下是两种方案:

这个方法看似易于理解,但是并非最佳实践。易于理解,但计算机处理跨行运算会非常困难,严重降低性能。

在OpeningBalance表中添加balance_direction字段,表示余额是借方还是贷方。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据:

📊 balance_id | account_id | year_id | opening_balance | balance_direction

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

优点:简单明了,适合大多数场景,余额方向明确。

缺点:需要额外逻辑确保余额方向与科目性质一致。

在OpeningBalance表中添加debit_balance和credit_balance字段,分别记录借方和贷方金额(通常只有一个字段有值)。

📊 字段名 | 数据类型 | 描述

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

示例数据:

📊 balance_id | account_id | debit_balance | credit_balance

PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"
PortableText [components.type] is missing "block"

优点:符合传统会计科目余额表的格式,便于与总账对账。

缺点:数据冗余(通常只有一个字段有值),需要额外验证借方和贷方余额的互斥性。

实践案例

如下图,展示了Monitor ERP 中 Openingbalance 的数据表结构和示例。为了跨国企业的多币种场景,这里甚至为借贷增加了货币标识,当然还有更复杂的 CodingEntryId(这里暂时跳过)。

一个包含账户 id、会计期间、借方、贷方余额的 期初明细表,才是一个标准的“账户期初金额明细表”

展示了一个关于OpeningBalance表的数据结构,包括账户、会计年度、借方余额和贷方余额的信息,显示其与财务管理的关系。

五、总结与后续计划

通过以上介绍,我们了解了账户余额、期初余额、会计科目设置和会计期间的基本概念,并通过vizwise公司的案例展示了数据表结构的设计。AccountingYear和AccountingYearPeriod表为财务记录提供了时间维度,确保期初余额的准确性和可追溯性。

后续将在第二节介绍:

这些内容将进一步展示如何通过交易记录和余额分析掌握企业财务动态。

No comments yet