finance-reconcile
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFinance Audit
财务审计
Overview
概述
Comprehensive financial audit tool that validates balance sheets and income statements. Performs four core audits: balance sheet equilibrium, income statement verification, account change tracking, and cross-statement relationship validation.
一款验证资产负债表和利润表的综合性财务审计工具,可执行四项核心审计:资产负债表平衡验证、利润表项目核对、科目变动追踪以及报表间勾稽关系验证。
Quick Start
快速开始
Basic Balance Sheet Audit
基础资产负债表审计
Verify balance sheet with account changes:
bash
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--output audit_report.xlsx结合科目变动验证资产负债表:
bash
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--output audit_report.xlsxComplete Financial Audit (Balance Sheet + Income Statement)
完整财务审计(资产负债表+利润表)
Full audit including profit statement:
bash
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--income-statement income_statement.xlsx \
--income-details income_details.xlsx \
--transactions transactions.xlsx \
--output complete_audit.xlsx \
--period "2024年1月"包含利润表的完整审计:
bash
scripts/reconcile.py \
--balance-sheet balance_sheet.xlsx \
--account-changes account_changes.xlsx \
--income-statement income_statement.xlsx \
--income-details income_details.xlsx \
--transactions transactions.xlsx \
--output complete_audit.xlsx \
--period "2024年1月"Using Custom Column Names
使用自定义列名
Use JSON config file for custom column names:
bash
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--config my_config.json使用JSON配置文件自定义列名:
bash
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--config my_config.jsonCommand Parameters
命令参数
| Parameter | Short | Required | Description |
|---|---|---|---|
| | Yes | Balance sheet file path |
| | Yes | Account change details file path |
| | No | Income statement file path |
| | No | Income statement details file path |
| | No | Transaction details file path |
| | No | Output Excel audit report path |
| | No | Audit period (default: 本期) |
| - | No | Tolerance for acceptable difference (default: 0.01) |
| | No | JSON config file for column names |
| - | No | Balance sheet sheet name or index |
| - | No | Account changes sheet name or index |
| - | No | Income statement sheet name or index |
| - | No | Income details sheet name or index |
| - | No | Transaction details sheet name or index |
| Parameter | Short | Required | Description |
|---|---|---|---|
| | Yes | 资产负债表文件路径 |
| | Yes | 科目变动明细文件路径 |
| | No | 利润表文件路径 |
| | No | 利润明细表文件路径 |
| | No | 交易明细表文件路径 |
| | No | 输出Excel审计报告路径 |
| | No | 审计期间(默认:本期) |
| - | No | 可接受差异的容差(默认:0.01) |
| | No | 用于自定义列名的JSON配置文件 |
| - | No | 资产负债表工作表名称或索引 |
| - | No | 科目变动表工作表名称或索引 |
| - | No | 利润表工作表名称或索引 |
| - | No | 利润明细表工作表名称或索引 |
| - | No | 交易明细表工作表名称或索引 |
Required File Formats
所需文件格式
1. Balance Sheet (资产负债表) - Required
1. 资产负债表 - 必填
| Column | Description |
|---|---|
| 科目 | Account name |
| 期初余额 | Opening balance |
| 期末余额 | Closing balance |
| 类型 | Account type (资产/负债/所有者权益) |
| 金额 | Amount for totals |
| Column | Description |
|---|---|
| 科目 | 科目名称 |
| 期初余额 | 期初余额 |
| 期末余额 | 期末余额 |
| 类型 | 科目类型(资产/负债/所有者权益) |
| 金额 | 合计金额 |
2. Account Changes (科目变动明细表) - Required
2. 科目变动明细表 - 必填
| Column | Description |
|---|---|
| 科目 | Account name |
| 借方 | Debit amount |
| 贷方 | Credit amount |
| Column | Description |
|---|---|
| 科目 | 科目名称 |
| 借方 | 借方金额 |
| 贷方 | 贷方金额 |
3. Income Statement (利润表) - Optional
3. 利润表 - 可选
| Column | Description |
|---|---|
| 项目 | Income statement item |
| 金额 | Amount |
| Column | Description |
|---|---|
| 项目 | 利润表项目 |
| 金额 | 金额 |
4. Income Details (利润明细表) - Optional
4. 利润明细表 - 可选
| Column | Description |
|---|---|
| 项目 | Item name (must match income statement) |
| 金额 | Detail amount |
| Column | Description |
|---|---|
| 项目 | 项目名称(需与利润表一致) |
| 金额 | 明细金额 |
5. Transactions (交易明细表) - Optional
5. 交易明细表 - 可选
| Column | Description |
|---|---|
| 科目 | Affected account |
| 借方 | Debit amount |
| 贷方 | Credit amount |
| 日期 (optional) | Transaction date |
| 凭证号 (optional) | Voucher number |
See for detailed format specifications and custom column configuration.
references/file_formats.md| Column | Description |
|---|---|
| 科目 | 受影响科目 |
| 借方 | 借方金额 |
| 贷方 | 贷方金额 |
| 日期 (optional) | 交易日期 |
| 凭证号 (optional) | 凭证号 |
详细格式规范和自定义列配置请查看。
references/file_formats.mdAudit Objectives
审计目标
The script performs four core audit objectives:
本脚本实现四项核心审计目标:
1. Balance Sheet Equilibrium Verification
1. 资产负债表平衡验证
Formula: 资产总计 = 负债总计 + 所有者权益总计
Verifies that the balance sheet is balanced overall.
公式:资产总计 = 负债总计 + 所有者权益总计
验证资产负债表整体是否平衡。
2. Income Statement Verification
2. 利润表验证
Logic: Income statement items = Corresponding detail summary
Validates each income statement item (revenue, expenses, etc.) against detail records.
逻辑:利润表项目金额 = 对应明细汇总金额
核对利润表中每个项目(收入、费用等)与明细记录是否一致。
3. Account Change Tracking
3. 科目变动追踪
Logic: Opening Balance + Changes = Closing Balance
For each account:
- Asset accounts: Closing = Opening + Debit - Credit
- Liability/Equity accounts: Closing = Opening + Credit - Debit
逻辑:期初余额 + 变动金额 = 期末余额
针对每个科目:
- 资产类科目:期末余额 = 期初余额 + 借方发生额 - 贷方发生额
- 负债/所有者权益类科目:期末余额 = 期初余额 + 贷方发生额 - 借方发生额
4. Cross-Statement Relationship Validation
4. 报表间勾稽关系验证
Logic: Retained earnings change ≈ Net profit
Validates relationships between balance sheet and income statement.
See for detailed audit logic and troubleshooting.
references/verification_rules.md逻辑:未分配利润变动额 ≈ 净利润
验证资产负债表与利润表之间的勾稽关系。
详细审计逻辑和故障排查请查看。
references/verification_rules.mdAudit Outputs
审计输出
Console Report
控制台报告
================================================================================
财务审计报告 - 本期
================================================================================
一、审计概述
--------------------------------------------------------------------------------
审计结果: 通过 ✓
二、资产负债表审计
--------------------------------------------------------------------------------
资产总计: ¥1,000,000.00
负债总计: ¥600,000.00
所有者权益总计: ¥400,000.00
资产负债平衡: 是 ✓
三、利润表审计
--------------------------------------------------------------------------------
利润项目匹配: 5/5
四、报表勾稽关系
--------------------------------------------------------------------------------
净利润: ¥100,000.00
未分配利润变动: ¥100,000.00
勾稽关系验证: 通过 ✓
五、不平衡项目清单
--------------------------------------------------------------------------------
无不平衡项目================================================================================
财务审计报告 - 本期
================================================================================
一、审计概述
--------------------------------------------------------------------------------
审计结果: 通过 ✓
二、资产负债表审计
--------------------------------------------------------------------------------
资产总计: ¥1,000,000.00
负债总计: ¥600,000.00
所有者权益总计: ¥400,000.00
资产负债平衡: 是 ✓
三、利润表审计
--------------------------------------------------------------------------------
利润项目匹配: 5/5
四、报表勾稽关系
--------------------------------------------------------------------------------
净利润: ¥100,000.00
未分配利润变动: ¥100,000.00
勾稽关系验证: 通过 ✓
五、不平衡项目清单
--------------------------------------------------------------------------------
无不平衡项目Excel Audit Report
Excel审计报告
When is specified, generates an Excel file with these sheets:
--output| Sheet | Content |
|---|---|
| 审计报告 | Full audit report text |
| 科目变动分析 | Account analysis with opening/closing balances |
| 交易影响追踪 | Transaction impact tracking |
| 利润表核对 | Income statement verification results |
| 不平衡项 | List of unbalanced items |
指定参数时,将生成包含以下工作表的Excel文件:
--output| Sheet | Content |
|---|---|
| 审计报告 | 完整审计报告文本 |
| 科目变动分析 | 包含期初/期末余额的科目分析 |
| 交易影响追踪 | 交易影响追踪 |
| 利润表核对 | 利润表核对结果 |
| 不平衡项 | 不平衡项目清单 |
Account Change Analysis Table
科目变动分析表
| 科目 | 科目类型 | 期初余额 | 借方变动 | 贷方变动 | 净变动 | 期末余额 | 是否平衡 | 差异 |
|---|---|---|---|---|---|---|---|---|
| 货币资金 | 资产 | 100000 | 20000 | 0 | 20000 | 120000 | 是 | 0 |
| 科目 | 科目类型 | 期初余额 | 借方变动 | 贷方变动 | 净变动 | 期末余额 | 是否平衡 | 差异 |
|---|---|---|---|---|---|---|---|---|
| 货币资金 | 资产 | 100000 | 20000 | 0 | 20000 | 120000 | 是 | 0 |
Using the Script as a Module
将脚本作为模块使用
python
from scripts.reconcile import (
audit_financial_statements,
generate_audit_report,
export_audit_report
)
result, accounts = audit_financial_statements(
balance_sheet_file='balance_sheet.xlsx',
account_changes_file='account_changes.xlsx',
income_statement_file='income_statement.xlsx',
income_details_file='income_details.xlsx',
transactions_file='transactions.xlsx',
tolerance=0.01,
period='2024年1月'
)python
from scripts.reconcile import (
audit_financial_statements,
generate_audit_report,
export_audit_report
)
result, accounts = audit_financial_statements(
balance_sheet_file='balance_sheet.xlsx',
account_changes_file='account_changes.xlsx',
income_statement_file='income_statement.xlsx',
income_details_file='income_details.xlsx',
transactions_file='transactions.xlsx',
tolerance=0.01,
period='2024年1月'
)Print console report
Print console report
print(generate_audit_report(result, period='2024年1月'))
print(generate_audit_report(result, period='2024年1月'))
Export Excel report
Export Excel report
export_audit_report(result, 'audit_report.xlsx', accounts, period='2024年1月')
export_audit_report(result, 'audit_report.xlsx', accounts, period='2024年1月')
Check audit result
Check audit result
if result.is_passed:
print("Audit passed!")
else:
print(f"Found {len(result.unbalanced_items)} unbalanced items")
undefinedif result.is_passed:
print("Audit passed!")
else:
print(f"Found {len(result.unbalanced_items)} unbalanced items")
undefinedTolerance Setting
容差设置
Default tolerance is ±0.01 yuan. Adjust with :
--tolerancebash
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--tolerance 1.0Consider these factors when setting tolerance:
- Exchange rate fluctuations (for foreign currency)
- System precision differences
- Rounding errors
默认容差为±0.01元,可通过参数调整:
--tolerancebash
scripts/reconcile.py \
--balance-sheet bs.xlsx \
--account-changes ac.xlsx \
--tolerance 1.0设置容差时需考虑以下因素:
- 汇率波动(外币业务)
- 系统精度差异
- 四舍五入误差
Troubleshooting
故障排查
Balance Sheet Not Balanced
资产负债表不平衡
Possible causes:
- Incorrect balance entries
- Incorrect totals calculation
- Opening/closing mismatch
Solutions:
- Check balance sheet total rows
- Verify account balances
- Check account type classification
可能原因:
- 余额录入错误
- 合计计算错误
- 期初/期末余额不匹配
解决方法:
- 检查资产负债表合计行
- 验证科目余额
- 检查科目类型分类
Account Changes Unbalanced
科目变动不平衡
Possible causes:
- Missing change records
- Incorrect debit/credit direction
- Account name mismatch
Solutions:
- Ensure account names match exactly
- Verify debit/credit records
- Check for missing change records
可能原因:
- 缺失变动记录
- 借贷方向错误
- 科目名称不匹配
解决方法:
- 确保科目名称完全一致
- 验证借贷记录
- 检查是否有缺失的变动记录
Income Statement Not Matching
利润表核对不一致
Possible causes:
- Missing detail items
- Inconsistent item names
- Incorrect summary calculation
Solutions:
- Ensure detail table includes all items
- Check item name consistency
- Verify summary calculations
可能原因:
- 缺失明细项目
- 项目名称不一致
- 汇总计算错误
解决方法:
- 确保明细表包含所有项目
- 检查项目名称一致性
- 验证汇总计算
Cross-Statement Relationship Failed
报表勾稽关系验证失败
Possible causes:
- Profit distribution (dividends, retained earnings)
- Mismatched accounting periods
- Incorrect net profit calculation
Solutions:
- Consider profit distribution events
- Verify income statement net profit
- Confirm period consistency
可能原因:
- 利润分配(分红、留存收益)
- 会计期间不匹配
- 净利润计算错误
解决方法:
- 考虑利润分配事项
- 验证利润表净利润
- 确认期间一致性
Resources
资源
scripts/reconcile.py
scripts/reconcile.py
Core audit script supporting:
- Balance sheet equilibrium verification
- Income statement validation
- Account change tracking
- Cross-statement relationship validation
- Transaction impact tracing
- Comprehensive audit report generation
核心审计脚本,支持:
- 资产负债表平衡验证
- 利润表验证
- 科目变动追踪
- 报表间勾稽关系验证
- 交易影响追溯
- 生成综合性审计报告
references/file_formats.md
references/file_formats.md
Detailed file format specifications, column name mapping, and configuration options.
详细的文件格式规范、列名映射和配置选项。
references/verification_rules.md
references/verification_rules.md
Comprehensive audit rules, validation logic, output examples, and troubleshooting guide.
全面的审计规则、验证逻辑、输出示例和故障排查指南。