GnuCash教程与概念指南

目录

关于作者

1. 概览

介绍

特点

易于使用

跟踪投资

国际化支持

企业功能支持

会计特性

关于本指南

获取帮助

上下文帮助

GnuCash网站

GnuCash维基

GnuCash常见问题

GnuCash在线帮助

主题搜索

安装

I. 基础知识

2. 基础

会计概念

五类基本科目

会计等式

借贷记账法

复式记账法

数据录入概念

文件

科目

交易

运行GnuCash

欢迎使用GnuCash对话框

新建层级科目

每日提示

科目树窗口

科目账簿窗口

工具栏按钮

标签栏

菜单项

菜单访问键和快捷键

存储财务数据

概述

存储压缩及有关建议

存储格式对比表

创建文件

保存数据

打开数据

复制科目层次结构

备份与恢复数据

备份文件（.gnucash）

日志文件（.log）

锁定文件（.LNK和.LCK）

文件管理

迁移GnuCash数据

迁移财务数据

迁移首选项数据

步步为营

科目

基本会计概念

GnuCash 科目

步步为营

交易

基本概念

科目账簿

简单交易还是分录交易？

对账

计划交易

步步为营

3. Importing Data into GnuCash

Importing Transactions from Files

File Import Formats

Import Matcher

Import QIF

Import OFX/QFX

Import CSV

Import MT940

Import MT942

Import DTAUS

4. Configuring GnuCash

Overview

Main Configuration Screens

Preferences: Accounting Period Tab

Preferences: Accounts Tab

Preferences: Online Banking

II. 常规使用

5. 活期账户与现金

创建科目

录入存款

录入取款

使用ATM机取出现金

科目对账

步步为营

期初余额

添加交易

期初余额

保存文件

报表

6. 费用

概念

创建科目

简单的费用科目结构

复杂的费用科目结构

录入费用交易

有关费用科目的其它注意事项

7. 信用卡

概念

创建科目

简易科目设置

完整科目设置

记录付款

记录还款

步步为营

打开GnuCash文件

购买

退款

收取利息

对账

还款

保存文件

报表

8. 贷款

基本概念

术语

创建科目

计算器

示例：每月还款

示例：贷款总期数

进阶：计算详细过程

怎样：记录房屋按揭贷款

怎样：记录汽车贷款

怎样：记录给朋友的私人借款

借款约定

借款科目

借出钱款

收到第一笔还款

收到第二笔还款

怎样：为贷款账单对账

怎样：出售房屋或汽车

简单交易

更复杂的交易

9. Investments

Basic Concepts

Terminology

Types of Investments

Setting Up Accounts

Using Predefined Investment Accounts

Creating Investment Accounts Manually

Custom Accounts Example

Interest Bearing Accounts

Account Setup

Example

Setup Investment Portfolio

Setup Accounts for Stocks and Mutual Funds

Example Stock Account

Buying Shares

Entering Preexisting Shares

Buying New Shares

Setting Share Price

Initial Price Database Setup

Setting Stock Price Manually

Configuring for Automatic Retrieval of Quotes

Displaying Share Value

The “Price Source” in Reports

Selling Shares

Selling Shares with Manual Calculation of Capital Gain or Loss

Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots

Dividends

Dividends in Cash

Dividends Re-Invested

Return of Capital

Splits and Mergers

Simple Stock Split

Moderately Complex Stock Merger

10. Reports

Overview

Saved Reports Configurations Concepts

Standard Reports Overview

Transaction Report

Assets & Liabilities Group

Budget Group

Business Group

Income and Expense Group

Sample & Custom Group

Other Reports

Using the Transaction Report

11. 资本利得

基本概念

估值

建立科目

示例

未实现损益

出售

缴税

12. Multiple Currencies

Basic Concepts

Manually Recording Currency Transaction

Account Setup

Recording and Updating Currency Exchange Rates

Recording Purchases in a Foreign Currency

Tracking Currency Investments

Reconciling Statements in a Foreign Currency

Automatically Recording Currency Transactions using Trading Accounts

Trading Account Concepts

Recording Foreign Currency Transactions with Trading Accounts

III. 高级功能

13. Business Features

Introduction to Business Features

Business Setup

Account Setup

Setting up Sales Tax Tables

Enter Company Information

Setting Business Preferences

Setting Billing Terms

Accounts Receivable

System Components

Customers

Invoices

Customer Jobs

Process Payment

Changing the Invoice Appearance

Accounts Payable

System Components

Vendors

Bills

Vendor Jobs

Process Payment

Payroll

Basic Concepts

Account Setup

Payroll Protocol Sample

Business Payroll Example

14. Budgets

Basic Concepts

Terminology

Creating a Budget

Choose Which Accounts To Budget For

Choosing a Budget Period

Getting Started

Entering Budget Values

Budget Reporting

Budgeted Income Statement

Budgeted Balance Sheet

15. Other Assets

General Concepts

Other Assets Described

Current Assets

Long-term (Fixed) Assets

Current Assets

Short-term Receivables

Reimbursable Expenses

Travel Advances

Prepaid Premiums or Prepaid Rent

Suspense or Wash Accounts

Short or Long-term Assets

Long-term (Fixed) Assets

Land

Buildings

Leasehold Improvements

Vehicles or Equipment

Intangibles

16. Depreciation

Basic Concepts

Personal Finances

Business

Estimating Valuation

Depreciation Schemes

Account Setup

Example

17. Python Bindings

18. Importing Business Data

Importing Bills and Invoices

General

The format of the import file

Import your data

Feedback and statistics

What could go wrong?

Not supported invoice functionality

Importing Customers and Vendors

General

The format of the import file

Import your data

Feedback and statistics

What could go wrong?

Not supported customer/vendor functionality

IV. 附录

GnuCash 术语表

A. Migration Guide

Using Accounts vs. Categories

Importing Data

Import of Financial Data by QIF Files

Import of Business Data by CSV Files

Converting XML GnuCash File

B. Auxiliary File Formats

Check Format Files (*.chk)

Overview

Example file

Field Descriptions

Creating Check Format Files

C. GNU Free Documentation License

0. PREAMBLE

1. APPLICABILITY AND DEFINITIONS

2. VERBATIM COPYING

3. COPYING IN QUANTITY

4. MODIFICATIONS

5. COMBINING DOCUMENTS

6. COLLECTIONS OF DOCUMENTS

7. AGGREGATION WITH INDEPENDENT WORKS

8. TRANSLATION

9. TERMINATION

10. FUTURE REVISIONS OF THIS LICENSE

Addendum

GnuCash教程与概念指南

教学文档

GnuCash文档团队

本指南包含5.5使用教程，并介绍了GnuCash背后的概念原理。

版权 © 2009-2023 GnuCash文档团队

版权 © 2010-2011 Yawar Amin

版权 © 2010 Tom Bullock

版权 © 2010-2011 Cristian Marchi

版权 © 2006 Chris Lyttle

版权 © 2003-2004 Jon Lapham

版权 © 2002 Chris Lyttle

版权 © 2001 Carol Champagne 和 Chris Lyttle

版权 © 2023-2024 Xinhang Xu

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (GFDL), Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You can find a copy of the GFDL at this link or in the file COPYING-DOCS distributed with this manual.

This manual is part of a collection of GNOME manuals distributed under the GFDL. If you want to distribute this manual separately from the collection, you can do so by adding a copy of the license to the manual, as described in section 6 of the license.

Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where those names appear in any GNOME documentation, and the members of the GNOME Documentation Project are made aware of those trademarks, then the names are in capital letters or initial capital letters.

DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED UNDER THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE WITH THE FURTHER UNDERSTANDING THAT:

1. DOCUMENT IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS FREE OF DEFECTS MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS WITH YOU. SHOULD ANY DOCUMENT OR MODIFIED VERSION PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL WRITER, AUTHOR OR ANY CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER; AND

2. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE AUTHOR, INITIAL WRITER, ANY CONTRIBUTOR, OR ANY DISTRIBUTOR OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER DAMAGES OR LOSSES ARISING OUT OF OR RELATING TO USE OF THE DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.

意见反馈

要报告有关程序或本文档的缺陷或提出相关建议，请按照GnuCash维基中Bugzilla页面所列指引使用GnuCash缺陷跟踪系统。建议首先在缺陷跟踪系统中通过浏览(browse)或搜索(search)寻找相关缺陷是否已被报告。程序相关的问题请选择产品GnuCash，本文档相关的任何问题请选择产品Documentation。

修订历史

修订 GnuCash Tutorial and Concepts Guide 5.5

17 December 2023

Multiple authors

GnuCash Documentation Team

修订 GnuCash Tutorial and Concepts Guide 5.4

24 September 2023

Multiple authors

GnuCash Documentation Team

关于作者

GnuCash文档团队由一群自告奋勇的GnuCash用户和开发者组成，他们自愿编写本文档，为更广泛的用户群体带去便利。我们欢迎有志于加入文档团队的用户在GnuCash邮件列表（<gnucash-users>和<gnucash-devel>）中表达自己的兴趣，并获得下一步的指引。

目前文档团队的贡献者有： Yawar Amin , J. Alex Aycinena , Tom Bullock , Carol Champagne , Frank H. Ellenberger , Mike Evans , Chris Good , Dave Herman , Geert Janssens , Jon Lapham , Chris Lyttle , Cristian Marchi , Brent McBride , John Ralls , Robert Ratliff , Christian Stimming , David T. , Bengt Thuree .

第 1 章 概览

介绍

GnuCash是为每个人设计的个人财务软件包。从简单的个人财务数据到复杂的企业财务管理，它都是跟踪财务信息的全能选手。它是为数不多的几款支持全球货币的财务软件之一，也是其中唯一的开源软件。不过，GnuCash最大的优点，还是易于学习使用。

所以，GnuCash可以帮你哪些忙呢？它可以跟踪你的个人财务数据，想要多么详细都可以。如果你刚开始使用，可以使用GnuCash跟踪你的日常花销。随后，你可能决定使用GnuCash跟踪现金收支和信用卡记录看看钱到底花哪儿了。在你开始投资理财后，可以使用GnuCash监控你的投资组合。买车或者买房子了？GnuCash会帮你安排投资计划，跟踪还款记录。如果你的财务记录跨越多个国家，GnuCash也提供你所需的多货币功能。

图 1.1. 包含多种货币和投资类型的科目表

此图展示了包含多种货币和投资类型的科目表。

尽管GnuCash十分适合个人财务管理，但对企业用户而言也是相当强大。从内置的应收账款与应付账款科目系统，到税务报表生成，GnuCash同样包含许多企业功能。你会发现GnuCash提供的许多企业功能强大而易用。

特点

易于使用

几分钟之内，你就可以录入你的个人财务数据并生成展示财务状况的美观图表。要是你会使用支票簿后面的账簿，那你就会使用GnuCash！直接向账簿输入内容，在不同列间跳转，还可以使用快速填充自动补全交易记录。上述操作方式也可以在软件内自行修改。

- 易⽤的菜单： GnuCash的菜单符合GNOME人机交互指南，也就是说，其菜单简单易用，并与其它GNOME软件外观相近。

- 文档： GnuCash内置帮助手册，以及内容更为丰富的用户指南。

- 数据导入方法： 除了手动输入，GnuCash还支持许多自动导入交易记录的方式。要是你可以在线访问银行账户，这一特性就特别实用，因为多数银行和信用卡公司都支持下述导入方式中的至少一种。如此一来，少一些时间录入数据，就可以多一些时间分析统计结果。

- Quicken导入文件（QIF）：Quicken QIF 风格的文件。这是一种在许多流行的个人财务商业软件间流行的文件格式。

- 开放式金融交换（OFX）：GnuCash是第一款支持开放式金融交换协议的自由软件。许多金融机构正在迁移至这一格式。

- 家庭银行业务计算机接口（HBCI）：GnuCash是第一款支持德国家庭银行业务计算机接口协议的自由软件。该协议可用于下载账单、发起银行转账，并使自动扣款成为可能。

- 报表：GnuCash预置超过30款报表，包括科目汇总表、收入表、费用表、交易汇总表、资产负债表、损益表、投资组合估值，以及许多其它报表。报表能够绘出数据图表，包括饼图、条形图和散点图。报表可以导出为HTML文件，也可以方便地自行修改。

- 计划交易：GnuCash现在支持自动创建并录入交易，或提醒你什么时候将要创建这些交易，并由你决定录入、推迟还是删除自动计划交易。

- 贷款还款助手：用于计算各式各样的贷款偿还计划交易。

- 轻松进行科目对账：GnuCash内置对账功能，将GnuCash科目同银行账单对账现在简单又高效。

- 多平台兼容：在多种平台和操作系统上都可以使用GnuCash。完全支持的操作系统和平台有：

GnuCash ≥ 3.0

Linux (x86, x86_64)、 FreeBSD (x86, x86_64)、 OpenBSD (x86, x86_64)、 macOS (64-bit Intel), 和 Windows (Windows 7 或更高版本).

GnuCash ≤ 2.6.21

macOS (32-bit Intel, PPC) 和 Windows (XP and Vista).

GnuCash ≤ 2.2.9

Windows (2000).

更早版本的GnuCash

目前已知可以在SGI IRIX (MIPS)、IBM AIX 4.1.5 (RS/6000)、Unixware 7 (Intel)、SCO OpenServer 5.0.4 (Intel) 和 Solaris (SPARC) 上使用，但各平台目前的情况不确定。

跟踪投资

GnuCash包含许多投资功能，可以帮助你跟踪每一笔投资。使用GnuCash，你可以独立地（一支股票对应一个科目），或是以科目组合的形式（可以一并显示的一组科目）跟踪股票。

GnuCash支持在线获取股票和基金报价。这样一来，就再也不必逐支股票地查询报价。此过程可以自动执行，这样你就可以看到最新的股价了。

国际化支持

GnuCash是一款可以为来自全世界用户提供帮助的软件。其中内置的许功能能够方便你在当下国际化的世界中游刃有余。

- 本地语言： GnuCash已被翻译为超过55种语言。被完整翻译的有，繁体中文、克罗地亚语、荷兰语、希伯来语、意大利语、葡萄牙语和乌克兰语。一些语言的翻译工作进展同样可喜，已有九成内容得到翻译，有，加泰罗尼亚语、简体中文、德语、印度尼西亚语、日语、葡萄牙语（巴西）和西班牙语。[1]

- 国际化格式处理：GnuCash能够识别和处理不同国家书写日期与数字的格式。你可以使用你习惯的日期与数字格式。

- 多货币兑换：GnuCash支持ISO 4217中列出的所有货币，既可以购汇也可以结汇（兑换）。如果“贸易科目”功能开启，科目间货币的兑换会完全保持平衡。

- 在线汇率：使用GnuCash，你再也不必一次次地查询货币汇率。此过程可自动执行，这样一来，GnuCash总是可以为你展示最新汇率下以你常用货币计算的科目余额。

企业功能支持

GnuCash中的许多功能满足企业会计需求。

- 应收账款与应付账款科目： GnuCash内置应收账款与应付账款科目系统。可在小型企业中用于跟踪客户、供应商、发票和账单缴付，并自定义不同的税费和计费期限。

- 折旧：GnuCash能够管理固定资产折旧。

- 报表：GnuCash能够随时生成各式各样、能够直接拿来使用的商业报表。

会计特性

了解会计工作的用户可能想要了解下列GnuCash会计特性。

- 复式记账： 每一项交易必须在一些科目中记借并在其它科目中以相同的金额记贷。这一规则确保了会计平衡——收入与费用间的差额与所有银行存款、股票和其它资产的总额确切相等。

- 分录交易：一项交易可被分拆为几部分，用于记录税费、服务费和其它分录的组合。

- 科目表：主科目可以下设子科目以构成层次结构。这一特性可以将现金、银行、股票等相似的科目类型编组为“资产”这样的主科目。

- 通用日记账：这是一种可以同时显示多个科目的账簿窗口。该功能使查出录入错误更加简单。它也可以一同显示由许多股票组成的投资组合下的所有交易，以便于浏览。

- 收入、花费科目类型：这几种科目类型将你的现金流归类，当合理使用复式记账特性时能够给出准确的损益表。

[1] 如果你想开展或完善当地语言的翻译工作，可见 https://wiki.gnucash.org/wiki/Translation.

关于本指南

本指南将尽快帮助你上手使用GnuCash。

每一章都以清晰明了的结构展开。每一章开始是对“概念”的讨论，介绍整章涉及的核心主题和术语。接着，是“怎么做”小节，介绍具体的操作过程。末尾，是“步步为营”小节，给出详尽具体的操作示例。

新用户会发现“概念”小节特别实用。这些小节会展示跟踪个人财务的优秀实践，也会简要介绍财务背景知识和术语。有经验的用户可以直接跳到“怎么做”小节快速浏览操作步骤。这两个小节简明扼要地列出了完成具体任务的步骤。“步步为营”小节以操作说明的形式给出了实际场景下的使用示例。在按第 2 章 基础所述创建文件之后，后一章都在前一章操作说明的基础上更进一步。

本手册主要分为三大部分：

- 第 I 部分 “基础知识”

- 第 II 部分 “常规使用”

- 第 III 部分 “高级功能”

第 I 部分 “基础知识” 提供开始使用GnuCash所需的最基本信息。这部分章节介绍使用GnuCash的核心概念。GnuCash的新用户应当熟悉这部分章节讲解的内容，以尽快上手并达到熟练使用GnuCash的水平。

- 第 1 章 概览 ——（也就是你在读的这一章）大致介绍了GnuCash的基本情况。

- 第 2 章 基础 —— 这一章简要地介绍了会计准则，并介绍了GnuCash如何组织其数据。另外也说明了GnuCash的基本界面构成。最后，此章解释了GnuCash如何存储与管理你的数据。

- “科目”一节 —— 更具体地介绍了科目的概念，以及组织科目的方法。

- “交易”一节 —— 介绍了交易的基本概念，以及录入交易的方法。

第 II 部分 “常规使用”更加详细地介绍了GnuCash的常见功能与应用。其中提供了更详尽的使用示例，这些示例都是根据日常场景中应用GnuCash时常常会遇到的问题给出的。下面是这一部分涉及的功能与应用：

- 第 5 章 活期账户与现金

- 第 7 章 信用卡

- 第 8 章 贷款

- 第 9 章 Investments

- 第 11 章 资本利得

- 第 12 章 Multiple Currencies

第 III 部分 “高级功能”讨论了在企业会计事务中使用GnuCash

- 第 13 章 Business Features

- 第 14 章 Budgets

- 第 15 章 Other Assets

- 第 16 章 Depreciation

- 第 17 章 Python Bindings

- 第 18 章 Importing Business Data

手册也包含几节附录，或许涉及你想要了解的其它信息。

- GnuCash 术语表 —— GnuCash中使用的术语列表

- 附录 A, Migration Guide —— 针对前 Quicken®、 MS Money 或其它 QIF用户的指南。

- 附录 B, Auxiliary File Formats

- 附录 C, GNU Free Documentation License

最后值得一提的是，术语表和索引有助于快速查找你想要了解的主题。

获取帮助

GnuCash提供多种形式的帮助指引，包括每日提示、上下文帮助、网站、维基、邮件列表和IRC聊天频道。

上下文帮助

上下文帮助为使用GnuCash中的菜单、窗口和按钮提供了详细的指引。要打开帮助，选择帮助 → 内容。

GnuCash帮助窗口也能用作简单的网络浏览器，因此你可以转到网站进一步查阅信息。点击打开 工具栏按钮并输入URL，就可以在此窗口中打开任何网站。你可以就像在标准的网络浏览器中一样使用后退、前进、刷新、停止和打印按钮。

GnuCash网站

GnuCash网站 包含有关程序及其软件更新的帮助信息。其中也包含其它在线资源的链接。

GnuCash维基

数目可观的不那么正式的文档，GnuCash本身及其维护开发工作有关的内容都可以在GnuCash维基上找到。

GnuCash常见问题

GnuCash常见问题（FAQ）页面也位于GnuCash维基上。每当你在使用GnuCash时遇到困难，都应当先查阅常见问题。现在它也被翻译为德语和简体中文。如果你想要访问翻译页面，请查看GnuCash常见问题页面顶部的标签页。

GnuCash在线帮助

邮件列表

最重要的用户支持就来自于 用户邮件列表。你如果更想使用论坛的形式，可以通过Nabble 使用。即使是使用Nabble，发表讨论也需要先订阅。

IRC

几位开发者持续关注irc.gimp.net上的 #gnucash 频道。 他们通常忙于其它事务，当然也不是时时刻刻坐在电脑前。请登录、询问你的问题、保持登录。过几个小时，你的问题就会被留意到并得到回应。

- 如果你失去连接，请检查IRC记录确认你没有遗漏相关消息。

- IRC维基页面 介绍了前提要求、发言准则和其它详细信息。

GnuCash网站详细介绍了这些频道。也能在上面找到指向GnuCash维基、软件缺陷跟踪系统等更多有用资源的链接。

主题搜索

在线手册也提供了搜索功能。要搜索特定的主题，点击帮助窗口底部的搜索标签页，并在输入框中输入要搜索的主题。点击搜索按钮执行搜索。搜索结果会出现在下方的列表中，点击其中一项搜索结果就会在右侧显示相应的帮助内容。

安装

GnuCash安装起来一般很简单。

GnuCash下载页为每一款支持的操作系统提供了详细的安装指引。

部分 I. 基础知识

第 2 章 基础

本章将介绍使用GnuCash时需要了解的基本概念。推荐你在上手使用GnuCash前通读本章。

会计概念

GnuCash简单易用，你不必完全理解会计准则就可以上手使用。然而，掌握一些基本的会计知识还是值得的，因为GnuCash正是基于这些准则设计的。强烈建议你在上手使用前理解指南的这一部分。

五类基本科目

基本会计规则将财务上的所有事物分为五类基本“科目”类型。也就是说，会计要处理的一切事物都属于这五类科目之一：

账户类型

资产

你自己拥有的东西

负债

你欠别人的东西

所有者权益

总净值

收入

科目中增加的价值

费用

科目中减少的价值

很明显，你可以将财务中一切事物分为五组。例如，你银行账户中的现金是资产，你的房贷是负债，你的工资是收入，昨天晚饭的开销是费用。

会计等式

现在有了五类基本科目，但它们之间的关系是什么？其中一类科目怎样影响其它科目？ 首先，定义一个包含资产和负债的等式：你的净值等于你的资产减去负债。

公式 2.1. 静态会计等式

资产 - 负债 = 所有者权益

另外，收入可以增加净值，费用可以减少净值。这当然有道理，当你得到工资你就变得“更富有”，当你为晚饭付钱你就变得“更贫穷”。这就以数学的方式表达了一个被人们称为会计等式的关系：

公式 2.2. 动态会计等式

资产 - 负债 = 所有者权益 + (收入 - 费用)

此等式应当永远成立，这意味着只有同时变动多个科目的金额时才能满足要求。例如，如果以收入的形式得到了一笔钱，则必须等额地增加资产科目的金额。又如，如果负债科目的金额增加，则应当同时增加资产科目的金额。

图 2.1. 基本科目关系

五类基本科目关系图。净值（所有者权益）随收入增加和费用减少而增加。箭头代表了金额的转移。

借贷记账法

初次接触会计工作的人常常不明白会计中“借”与“贷”的用法，及其对各类科目的作用。上文介绍的会计等式是理解哪类科目在什么情况下记借或记贷的关键。首先，展开并重新排列会计等式，使资产位于等号的左边，并将任何带有负号的科目移到另一侧，这样可以得到：

公式 2.3. 重新排列后的会计等式

资产 + 费用 = 负债 + 所有者权益 + 收入

此形式的会计等式中，等号左边的科目称为借方科目，记借的分录会增加这些科目的余额。相反，记贷的分录会减少这些科目的余额。

类似地，在等号右边的科目也被称为贷方科目，即这些科目的余额由记贷的分录增加。同样地，这些科目中记借的分录会减少科目的余额。

警告

借与贷是专用的会计术语，会计工作中这两个字的含义与日常生活中的用法可能并不一致。

表 2.1. 借与贷对五类科目类型余额的影响

科目类型

对科目余额的影响

借 (Dr)

贷 (Cr)

资产

增加

减少

费用

负债

减少

增加

所有者权益

收入

复式记账法

会计等式是复式记账会计制度的核心。当会计等式中一个科目的余额变动时，必须对等地变动另一个科目。这一概念也被称为平衡原则，它是理解GnuCash和其它复式记账会计制度的基础。当使用GnuCash时，为了保持会计等式的平衡，总要同时关注至少两个科目。

账户间的平衡变动（或资金转移）是通过借记一个账户同时贷记另一个账户来完成的。会计上的借与贷，并不意味着“减少”与“增加”。正如前一部分所述，借与贷都会在增加某些科目的余额的同时，减少其它科目的余额。在资产和费用科目中，借会增加余额，贷会减少余额。在负债、所有者权益和收入科目中，贷会增加余额，借会减少余额。

在传统的复式记账中，账簿左边的一列记借，右边的一列记贷。会计师会在记借的一侧（左侧）记录资产和费用科目的增加，在记贷的一侧（右侧）记录负债、收入和所有者权益的增加。GnuCash遵循这一使用账簿记账时的惯例。

注意

这些会计术语可能会令新用户感到困惑，因此GnuCash默认使用更常见的术语存入 和取出。如果你希望使用正规的会计术语，可以在首选项（更多有关设置首选项的信息请查阅GnuCash帮助手册）中的科目选项卡进行设置。

警告

在日常生活中，借与贷这两个字的用法和会计工作中的用法并不一致。在日常使用中，贷通常有增加的意思；在会计工作中，贷意味着影响某一科目分类账表的右列。这与资产和费用科目的减少相关，与收入、负债和所有者权益科目的增加相关。

详细信息可参阅https://zh.wikipedia.org/wiki/Debits_and_credits。

数据录入概念

在GnuCash中录入数据时，你应当了解GnuCash用于分隔数据的三级组织结构：文件、科目和交易。这几个层级按其复杂性排序列出，一个文件包含许多科目，一个科目包含许多交易。认识这种分隔方法是理解怎样使用GnuCash的基础。

文件

GnuCash以文件形式存储最高层级的信息。一个文件可以以单个XML文件（在所有版本的 GnuCash上）或SQL数据库（2.4或更高版本的GnuCash上）的形式存储在你的计算机上。

注意

SQL发音为“sequel”，所常写作和念作“SQL数据库”。

使用XML文件格式时，GnuCash会在单个XML文件中存储你的数据，文件通常使用压缩格式（此行为可以在GnuCash首选项下的通用选项卡中进行修改）。

使用SQL存储时，GnuCash会在你选择的数据库软件（SQLite3、MySQL或PostgreSQL）中把数据存储至 SQL数据库中。

你需要为你正在处理的一组科目准备主文件或数据库。要了解怎样创建和管理GnuCash文件，可参见 “存储财务数据”一节。

注意

你如果认为需要多于一组的科目，则应在处理账目前咨询专业会计师。大多数用户仅需一个数据文件。

备份文件和日志文件由GnuCash适时自动生成。备份文件和日志文件会在“备份与恢复数据”一节详细阐述。

科目

科目跟踪你拥有的、欠别人的、你花费的或你得到的东西。每个GnuCash文件可包含任意数量的科目，每个科目又可包含许多子科目，层数不限。正如下文所述，这个简单的特性使GnuCash能够管理你的财务的方方面面。

例如，科目可以包括：活期账户、储蓄账户、信用卡账户、房屋贷款和其它贷款。每个GnuCash科目跟踪对应的“真实”账户的活动，便于你了解其状态。

此外，科目也可以把你收到或花出的钱分类。例如，你可以创建费用科目来记录你为公共服务和食品杂货付的钱。就算这些科目并不对应于会收到账单的实际账户，也可以使你了解在各个方面花了多少钱。

本指南会在“科目”一节中更详细地介绍科目。

交易

交易代表金额在科目间的转移。任何在你花出或收到钱，或在账户间转账的时候，都会产生交易。

例如，交易可以是：支付手机话费、把钱从储蓄账户转到活期账户、买烧饼、取出现金和存入工资。“交易”一节会更深入地介绍怎样录入交易。

在复式记账中，交易总是至少涉及两个科目——一个付款科目，一个收款科目。根据这一规则，GnuCash会在交易中对每个受影响的科目各插入一行，并在每一行中记录涉及的金额。交易中记录涉及的科目与金额的行称为分录。每个交易可以包含任意数量的分录。

注意

交易分录会在“分录交易示例”一节详细介绍。

运行GnuCash

可以选择桌面主菜单中的相应菜单项运行GnuCash。

也可以在命令行中执行gnucash来运行。

在启动过程中，GnuCash会显示欢迎屏幕，列出一些有关程序（版本号、构建号等）和加载过程的信息。

欢迎使用GnuCash对话框

最初打开GnuCash你会看到欢迎使用GnuCash对话框，其中包含三个选项：

- 创建一组新的科目 —— 运行新建层次科目向导（参考“新建层级科目”一节）。如果你想在GnuCash的帮助下创建一组新科目，请选择此选项。

- 导入我的QIF文件 —— 运行导入QIF文件向导（参考“Import QIF”一节）。如果你已经拥有Quicken文件（.qif文件）并想要将其导入GnuCash，请选择此选项。

- 打开新用户教程 —— 打开GnuCash教程与概念指南。如果你刚开始接触GnuCash和会计概念，请选择此选项。

注意

在离开此对话框后，你仍然可以使用其中的每一项功能，但欢迎使用GnuCash不会再次显示。要创建一组新的科目，参见“新建层级科目”一节。要导入QIF文件，参见“Import QIF”一节。

新建层级科目

新建层级科目向导能够帮助你创建一组新的GnuCash科目。如果在欢迎使用GnuCash中选择创建一组新的科目，或选择 文件(F) → 新建(N) (Ctrl+N) 时，该向导会启动。你也可以从科目页面选择功能(A) → 新建层级科目…来使用该向导向现有账簿添加部分科目。

该向导会指引你创建会计科目表。此向导包含几个步骤，简要介绍如下：

1. 第一个页面简要介绍了此向导的功能。

2. 新建账簿选项只在创建新账簿时出现。你可以在此设置许多账簿属性。此页面包含四个选项卡：科目、预算、商业和计数器。 这几项内容在本指南的其它部分会展开介绍，可以随时使用 文件(F) → 属性(T) (Ctrl+Enter) 修改。

3. 选择货币设置根科目和新建科目的默认货币。此选项的默认值根据计算机的区域设置确定。请认真设置此选项，因为它不仅会成为新建科目的默认货币，也会成为整个账簿的主货币，还会是所有股票价格和外币汇率的默认货币。尽管可以通过功能菜单重新运行新建层级科目向导进行更改，但这样操作后你已经创建的交易可能会损坏。

4. 选择要创建的科目提供了多种可添加到账簿的会计模板。此处主要有两个面板：左侧是模板列表，每一项旁边有一个复选框；右侧显示将要由选中的模板添加到账簿的科目。

在模板列表上方，是两个下拉框，其中一个是语言代码，另一个是国家代码。初始选择同样基于你的计算机区域设置确定。你可以根据需要选择任何语言和国家的组合。

注意

新建层级科目向导中，不能一次选择多个区域，因此如果你需要从多个区域中选择多项（可能是由于你首选区域的模板需要使用来自其它国家的模板进行拓展），可以从功能菜单多次运行此向导。

5. 设置选择的科目会以树状形式列出在选择要创建的科目中所选模板的科目。根据你是否正在创建新的账簿，列表可能有四列或五列。

- 科目名称可编辑，只需在其内点击，或选中该行并按Enter。

- 类型不可编辑。此项显示了科目类型。

- 占位符科目（只能在其下建立子科目而自身不能添加交易的科目）。你可以勾选此项使科目成为占位符，或取消勾选使科目为常规科目。

- 期初余额可以为非所有者权益的非占位科目设置余额，因为一个已经存在的账户早就存在余额，占位符科目不能存储交易，且所有者权益不能设置期初余额。

注意

期初余额输入框只有点击后才可见。你必须点击别处将光标移出输入框或在点击前进按钮之前按Tab或Enter，否则输入的内容会丢失。

- 使用已有科目只会在从功能菜单启动新建层级科目向导时才会出现。它指示科目是否已经存在。此项不可编辑。

6. 完成科目设置 是最后一个页面，给你最后的机会取消此过程，回头更改一些设置，或点击应用确认你的选择。如果你正在新建账簿，GnuCash会弹出对话框，提示选择存储格式，可以输入文件名存储到你的计算机中，如果GnuCash内含存储至数据库的功能且已经安装了必要的软件依赖，也可以输入数据库服务器地址、数据库名和认证信息以创建MySQL或PostgreSQL数据库。

警告

如果你选择取消，你至此做出的任何选择都会丢失。

每日提示

GnuCash的每日提示屏幕会给出有助于使用GnuCash的提示。

图 2.2. 每日提示

此图展示了每日提示屏幕。

这些提示对初学者很有帮助。请单击前进继续浏览更多提示。如果不希望在启动时看到此屏幕，请取消选择旁边的启动时显示每日提示复选框。浏览完提示后，点击关闭以关闭每日提示屏幕。

科目树窗口

你现在应该看到了科目窗口，如下所示。具体显示的科目依赖于你在新建层级科目中选择了哪些默认科目。此处的示例展示了默认科目。

图 2.3. 基本科目关系

此图展示了科目窗口。

科目树窗口（也称为科目汇总表或科目表）汇总了当前文件中的数据，包含科目名称列表和当前余额。

在此窗口中，你可以双击科目名称、右击科目名称并从菜单中选择打开账户或使用工具栏上的打开按钮打开科目账簿。可以在GnuCash中打开任意数量的科目账簿。参见“科目账簿窗口”一节了解使用科目账簿的更多信息。

提示

如果科目下存在子科目，可以点击科目名称旁边的小三角显示其子科目。

窗口顶端是标题栏，显示此组账户的文件名。其下是菜单栏，可以点击菜单标题或使用快捷建（参见“菜单访问键和快捷键”一节）访问菜单条目。接下来是工具栏，包含调用常用功能的按钮。

科目树显示在工具栏下方。一旦你创建了科目，科目名称就会显示在科目树中。你可以通过科目树右上方的小箭头自定义显示哪些表头。

底部是状态栏，展示有关净资产和利润的信息。

科目账簿窗口

科目账簿窗口用于输入并编辑科目数据。恰如其名，科目账簿窗口看起来就像是支票簿。

图 2.4. 活期账户的账簿

此图展示了已经录入几笔交易后的活期账户的账簿。

“交易”一节将进一步介绍科目账簿窗口和向其中输入数据的方法。科目账簿窗口的各部分类似于科目树窗口的各部分。顶部的标题栏显示科目名。下方，菜单栏包含与科目账簿相关的菜单选项。使用工具栏按钮可以方便地使用各项输入数据的功能。窗口底部的状态栏显示了科目余额，会在“交易”一节详细介绍。科目账簿窗口底部显示有关当前光标位置的一些信息。

注意

在账簿窗口中，可以调整GnuCash显示的多个列的尺寸，但要注意“描述”和“余额”列和行为与其它列不同。

描述列设计成自动扩展以填充所有未使用的水平空间。因此应当在设置描述列的宽度之前设置所有其它列的宽度。

工具栏按钮

科目树窗口和科目账簿窗口均提供工具栏按钮。使用这些按钮可以快速执行例如科目树窗口中的保存、打开和科目账簿窗口中的保存、删除等常用功能。如果你不确定一个按钮会执行什么操作，可以将鼠标指针移动到按钮上，就会出现对此功能的描述。

下面总结了科目树窗口中各按钮的功能：

科目树窗口按钮

保存

将当前文件保存到磁盘。

关闭

关闭当前账簿页。

打开、 编辑、 新建、删除

这些是与科目相关的功能，将在“科目”一节讨论。

科目账簿相关的按钮将在“交易”一节介绍。

标签栏

GnuCash使用标签式的设计，允许同时打开多个科目账簿和报表。每个打开的窗口（包括科目账簿、报表和计划交易窗口）都对应标签栏中的一个标签页，可以点击标签页查看不同的窗口。标签栏可以在首选项中配置为沿GnuCash窗口的任意一边显示。

要查看标签的全名，可以将鼠标指针移动到标签之上。如果打开的标签比窗口能够显示的要多，部分标签可能不会显示。

提示

1. 可以点击标签栏两侧的箭头浏览全部标签页。

2. 也可以通过首选项窗口中窗口标签页下的标签页位置更改标签栏的对齐方式。

3. 标签页的完整列表可以右击标签栏查看，点击菜单项可切换至任一标签页。

菜单项

科目树窗口和科目账簿窗口在菜单栏处均包含数个菜单标题。点击菜单标题会弹出与之对应的菜单项。

你可以点击科目树菜单标题再将鼠标指针移动到菜单项上了解相应的功能。将鼠标指针移动到菜单项上时，菜单项的功能描述会出现在窗口的左下角（在状态栏内）。点击以选择一个菜单项。

你也可以在窗口中的任何地方右击鼠标，访问最常用的菜单项。在科目树窗口中，会弹出与科目相关的菜单项。在科目账簿窗口中，会弹出与交易相关的菜单项。

也可以通过快捷键访问菜单项，快捷键的用法将在下面详细介绍。

菜单访问键和快捷键

所有菜单项都拥有访问键，访问键是在菜单项名称中使用下划线标记出的字符。按下Alt键和菜单标题中标有下划线的字符，就会弹出相应菜单标题的菜单项。菜单项显示之后，在键盘上按下菜单项中标有下划线的字符来选择菜单项。例如，在主窗口中按下Alt+F弹出文件菜单，然后按下S会保存文件。访问键是固定的，用户无法修改。

一部分常用的菜单项也具有快捷键。使用快捷键，无需在菜单中层层寻找即可直接执行命令。快捷键一般配合使用Ctrl键，不过快捷键可以是任意按键的组合。菜单快捷键显示在每个菜单项的右端。

存储财务数据

概述

GnuCash提供了几种格式存储财务数据。默认的文件存储格式是XML，而SQL存储在SQLite、MySQL和PostgreSQL格式中可用。对于新文件，用户可以通过文件 → 保存对话框选择文件格式，对于存在的文件，可以通过文件 → 另存为…对话框选择文件格式。

XML存储格式是一种默认压缩存储的文本文件，是否压缩可以通过编辑 → 首选项+常规+压缩文件设置。也可以使用SQLite存储，会像XML格式一样，将你的数据存储为系统中的单个文件。然而，在程序内部，一个SQLite文件会作为数据库进行管理。MySQL和PostgreSQL存储选项需要连接到数据库服务器，并在你的计算机上安装额外的数据库驱动程序。

提示

用户可以随时使用文件 → 另存为…更改存储格式，并以选定的格式创建数据文件的副本。

存储压缩及有关建议

每种存储格式各有优缺点，用户需要结合自身的需求和能力进行考虑。可参见下文的存储格式对比了解详细信息。

XML格式是最为稳定成熟的，因此建议大多数用户选择此格式。SQL格式于2.4版添加，在用户中成为了越发受欢迎的选择。SQLite格式让用户无需花功夫安装并管理完整的DBMS就可以享受SQL存储的优点。MySQL和PostgreSQL选项分别要求安装MySQL和PostgreSQL DBMS，这些DBMS最好由经验丰富的数据库管理员维护。

注意

GnuCash对SQL存储后端的支持意味着GnuCash已经完全实现了DBMS特性，包括多用户和增量数据操作。然而，GnuCash当前并没有实现这些特性，不过这是开发组的长期目标。

存储格式对比表

表 2.2. 存储格式对比

XML

SQLite

MySQL

PostgreSQL

可用性

内置

依赖于软件包 [a]

文件拓展名

gnucash

N/A [b]

额外软件

无

MySQL

PostgreSQL

额外技能

无

数据库管理员

压缩

gzip

无

文件保存

在执行保存命令时

在提交时

多用户支持

不支持

不支持

不支持

不支持

[a] SQL后端依赖额外的软件包。这些软件包已内置于在 macOS 和 Microsoft Windows 下的安装包中，会随GnuCash的安装程序自动安装。Linux发行版用户可能需要使用包管理器专门安装所需的额外软件包。对于SQLite3、MySql和Postgresql分别查找包名类似libdbd-sqlite3、libdbd-mysql或libdbd-pgsql的软件包进行安装。

[b] MySQL 和 PostgreSQL 将数据存储在它们自己的存储系统中。

创建文件

要创建新的GnuCash文件，按如下步骤操作：

1. 从GnuCash菜单栏选择 文件 → 新建。新建层级科目向导将启动。

注意

如果是首次运行GnuCash，将显示欢迎使用GnuCash！屏幕。此屏幕会在GnuCash帮助手册详细介绍。

2. 在向导中设置各选项。使用前进、取消和后退按钮在各步骤间跳转。

保存数据

按照下面的步骤以你喜欢的名称保存文件：

1. 从菜单栏选择文件 → 另存为…或选择工具栏上的保存按钮。GnuCash会弹出保存窗口。

2. 从下拉列表中选择文件的数据格式。 默认选择的是 xml，如果你已经设置了数据库后端可以更改为相应的格式。

依据你选择的数据格式，窗口会按下文所述发生变化。

- 如果你选择了xml或 sqlite3，你会看到像这样的对话框：

图 2.5. 选择xml或sqlite3时的保存对话框

此图展示了选择数据格式为xml或sqlite3时的保存对话框。

在名称文本框中输入文件名，无需指定扩展名。GnuCash会自动向文件名添加拓展名.gnucash。

在下方区域中通过浏览目录选择文件保存路径。

提示

点击创建文件夹按钮在选择的路径下以指定的名称创建文件夹。

- 如果你选择了mysql或postgres文件格式你会看到像这样的对话框：

图 2.6. 选择mysql或postgres时的保存对话框

此图展示了选择数据格式为mysql或postgres时的保存对话框。

在此窗口中输入数据库连接信息：主机、数据库、用户名和密码。

警告

保存至mysql或postgres需要合适的数据库权限，即需要拥有使用给定的数据库名称创建新数据库的权限，或具有给定数据库名称的现有数据库的写入权限。

4. 点击另存为按钮保存文件。

你如果正在跟踪家庭财务状况，则只需要一个文件。但如果你同时还在管理企业财务，或出于某种原因希望将数据分离存储，则需要多于一个文件。

在结束每次GnuCash会话前，确保使用文件 → 保存或保存 工具栏按钮保存数据更改。

注意

经常保存数据以防止由于任何原因丢失是相当重要的，所以GnuCash可以每隔一段时间自动保存打开的文件。保存的间隔时间可以在编辑 → 首选项（macOS上的GnuCash → 首选项）中的通用选项卡下设置。注意此选项只有在你以XML格式保存时才有意义。如果你正在使用数据库，则做出的更改会立即保存，因此保存按钮和保存菜单项呈灰色。

打开数据

要打开存在的文件或数据库，从菜单中选择文件 → 打开。在弹出的窗口中，选择 数据格式。如果你选择了文件，则在下方的面板浏览文件夹选择你想打开的文件；否则，输入所需的数据库连接信息。

提示

GnuCash记录最近打开的文件列表。打开文件菜单，菜单内列出了最近打开过的文件名称。点击以载入你想打开的文件。

复制科目层次结构

某些情况下，将现有数据文件的结构复制到新文件可能很有用。例如，你可能会想在不破坏实际会计数据的情况下尝试新的会计技能，或是需要根据会计准则在年末终结当前账簿并以空白账簿开始新一年的会计工作。

GnuCash能够创建科目树的空白副本，只需选择：文件 → 导出 → 导出科目。选择此命令后，GnuCash会要求你提供新的空白文件的名称，随后GnuCash会创建一个新的数据文件，其中仅包含科目层次结构（即不含交易数据）。一旦保存，新文件就能像其它GnuCash数据文件一样以上文所述的方法打开。

备份与恢复数据

GnuCash会创建多种类型的文件，帮助你确保数据不会丢失。你如果查看保存的文件的所在文件夹，可能会看到由GnuCash生成的具有以下扩展名的其他文件：.gnucash、.log、.LCK、.LNK。每种文件的作用如下：

注意

下文仅当你以XML格式保存时才适用：

$ ls

myfile.gnucash

myfile.gnucash.20100414185747.gnucash

myfile.gnucash.20100414223248.log

myfile.gnucash.20100415114340.gnucash

myfile.gnucash.20100415154508.log

myfile.gnucash.20100415173322.gnucash

myfile.gnucash.20100415194251.log

myfile.gnucash.7f0982.12093.LNK

myfile.gnucash.LCK

备份文件（.gnucash）

每当你保存数据文件时，一个扩展名为.YYYYMMDDHHMMSS.gnucash的备份副本也会保存。此备份文件是先前数据文件的完整副本，文件命名格式涉及数据文件名称、年、月、日和备份时间。例如，文件名myfile.gnucash.20100414185747.gnucash表明这是在2010年4月14日下午6:57:47保存的文件myfile的备份副本。

要恢复旧的备份文件，只需打开具有所需的日期的.YYYYMMDDHHMMSS.gnucash文件，再以不同的文件名保存此文件。

日志文件（.log）

每次在GnuCash中打开并编辑文件，GnuCash就会创建日志文件，记录对数据文件做出的修改。日志文件使用与备份文件相似的命名格式：.YYYYMMDDHHMMSS.log。日志文件不是对数据文件的完整备份，而只是简单地记录在当前GnuCash会话中对数据文件作出的修改。

在你无意之中退出GnuCash的情况下，可能是由于断电或操作系统崩溃，你可以使用日志文件恢复自最后一次保存GnuCash文件之后的大部分修改。过程如下：

1. 打开最近一次保存的GnuCash文件。

2. 点击文件 → 导入 → 重放 GnuCash .log 文件 ，选择一个与你刚才打开的文件日期相同的.log 文件。确保你选择了正确的 .log文件，否则可能会对你的科目数据造成巨大的损坏。

日志重放会恢复自最近一次保存后输入的任何影响科目余额的交易，包括由计划交易和企业功能（如开具发票、订单管理等）创建的交易。

警告

不会恢复对计划交易、开具发票或订单管理功能自身的修改，并且由之创建的交易在恢复后可能不会恰当地与之关联，因此需要二次检查。特别是对于企业交易，你可能需要删除并重新创建部分交易。如果不这样做，尽管科目余额可能正确，但一些报表可能不会正确显示。

锁定文件（.LNK和.LCK）

你可能会偶然看到.LNK和.LCK文件出现。它们不存储任何数据，仅用于防止多个用户在同一时刻打开同一个文件。这些文件是在打开文件时自动创建的，当关闭GnuCash会话或打开另一个文件时，GnuCash会删除.LNK和.LCK文件以解锁前一个数据文件。

如果在你已经打开了数据文件时GnuCash崩溃了，.LCK和.LNK文件不会被删除。在下一次尝试打开GnuCash时，会弹出警告消息提示文件已被锁定。之所以弹出警告消息是由于.LNK和.LCK文件仍然存在于目录中。此时选择是打开文件是安全的，但你应该删除.LCK文件。一旦文件被删除，将不会弹出警告消息，除非GnuCash再次崩溃。

文件管理

所以到底应该保留哪个文件呢？当然是保留你的主数据文件。保留部分最近的.YYYYMMDDHHMMSS.gnucash备份文件也是妥当的做法，不过可以安全地删除.log文件，因为它们不是数据的完整副本。

你也应该在关闭GnuCash后删除任何.LCK和.LNK文件 。如果你决定手动将数据文件备份到另一个磁盘，只备份主数据文件就足够了，无需处理.YYYYMMDDHHMMSS.gnucash备份文件。

注意

一般情况下GnuCash会自动删除任何30天以前的.log和 .YYYYMMDDHHMMSS.gnucash备份文件。可以在编辑 → 首选项（macOS 上的GnuCash → 首选项）中的通用选项卡下更改此行为。

迁移GnuCash数据

有时，你可能需要将你的财务数据和GnuCash移动到另一台计算机。例如，当你购置了一台新的计算机的时候。

迁移财务数据

迁移GnuCash的财务数据很简单，如果你知道.gnucash文件的保存位置，只需要使用文件管理器把它复制过去。你如果不记得把它保存到哪里了，可以直接在GnuCash中打开它，在GnuCash中将它保存到你需要的路径下。

文件夹中其它所有文件是备份文件或日志文件。一同把它们复制过去不会有什么危害，但也没什么必要。

迁移首选项数据

首选项存储在三处不同的位置：一处用于GnuCash首选项，一处用于报告，一处用于网上银行设置。应用首选项由gsettings管理，报告由GnuCash自身管理，网上银行由aqbanking管理。如果你不使用网上银行功能，计算机中不会存在相应的文件夹。

GnuCash首选项的存储位置随操作系统的不同而不同（参见表 2.3 “应用首选项的位置”、表 2.4 “已保存报告的位置”和表 2.5 “网上银行设置的位置”）。要备份并移动你的整个安装，你必须同时复制这些首选项。

表 2.3. 应用首选项的位置

操作系统

文件夹

Unix

GnuCash首选项存储在dconf中。可以在旧计算机上执行命令dconf dump /org/gnucash/，然后在新计算机上执行命令dconf load /org/gnucash/以迁移首选项。

macOS

~/Library/Preferences/gnucash.plist

Windows

首选项存储在Windows注册表中的 HKEY_CURRENT_USER/software/GSettings

表 2.4. 已保存报告的位置

操作系统

文件夹

Unix

~/.local/share/gnucash/ [a]

macOS

~/Library/Application Support/gnucash

Windows

Documents and Settings/Username/.gnucash 或 Users/Username/.gnucash

[a] GnuCash 2.6.21 及之前的版本位于~/.gnucash/

表 2.5. 网上银行设置的位置

操作系统

文件夹

Unix

~/.aqbanking

macOS

~/.aqbanking

Windows

Documents and Settings/Username/.aqbanking

注意

在Unix和macOS上，这些文件夹通常不会显示在文件管理器中。为了看到这些文件夹，必须设置文件管理器以显示隐藏的文件和文件夹。

提示

在Unix和macOS上，~符号代表home文件夹。

步步为营

注意

这一部分开启了贯穿整部指南的教程。在每一章的结束，你都会看到步步为营一节，它会带领你通过实际操作形象地体会前文介绍的相关概念。每节步步为营都会在前一部分的基础上更进一步，所以请将你的文件保存到方便访问的地方。

现在开始！

1. 首先，创建一个文件，用于保存你的数据。打开GnuCash并从菜单栏选择文件 → 新建。这会启动新建层级科目向导，能够一次创建数个科目。

图 2.7. 新建层级科目：介绍

此图显示了新建层级科目向导的第一个页面。

向导的第一个页面描述了其功能。点击前进按钮进入到下一个页面。

2. 在第二个页面，通过不同的选项卡设置新账簿选项，然后点击前进按钮。你也可以稍后使用文件 → 属性修改这些选项。这些选项的详细介绍，可见GnuCash用户手册中“自定义GnuCash 账簿选项” 一章。

图 2.8. 新建层级科目：账簿选项

此图显示了新建层级科目向导的第二个页面，其中可设置账簿选项。

3. 在第三个页面，从下拉列表中选择要用于新科目的货币，然后点击前进按钮。

注意

在此处选择的货币会被指定为所有由此向导创建的科目所使用的货币。

图 2.9. 新建层级科目：货币选择

此图显示了新建层级科目向导的第三个页面，此处可选择货币。

4. 在第四个页面中，在模板面板中选择通用科目科目组。再点击前进按钮进入下一页面。

注意

若需要，可在此选择一个或多个预定义的科目模板。有关科目类型的更多信息可见“GnuCash 科目”一节。

图 2.10. 新建层级科目：科目选择

此图展示了新建层级科目向导的第四个页面，此处可选择多个科目。

5. 在第五个页面，可以设置每一科目的期初余额，并指定科目是否为占位符。这些功能将在下一章介绍，当前先不必更改这些选项。接下来点击前进按钮进入此向导的最后一个页面。

图 2.11. 新建层级科目：科目设置

此图展示了新建层级科目向导的第五个页面，此处可设置期初余额。

6. 在向导的最后一个页面中，点击应用创建所有科目并离开向导。

图 2.12. 新建层级科目：完成

此图展示了新建层级科目向导的最后一个页面。

7. 在之前的窗口点击应用按钮后，会弹出保存对话框。选择XML数据格式，文件名称为gcashdata_1，选择要保存文件的文件夹（请记下这里选择的保存位置，因为这份数据文件还会在本指南后续教程中继续使用），最后点击保存按钮。

现在，主窗口如下所示：

图 2.13. 教程：数据文件的初始科目窗口

科目

这一章会介绍一些用于组织科目的实用概念。自从GnuCash不再要求固定的科目结构之后，你可以通过任何希望的方式自由地设计科目结构。然而，在设计尽量实用的科目结构时，建议你遵循几个基本会计概念。

基本会计概念

正如前文所述，会计工作围绕五类基本科目类型展开：资产、负债、所有者权益、收入和费用。我们现在更深入地理解这些科目类型，并展示它们在GnuCash中的表现形式。不过首先，我们将它们分为两组：资产负债科目和损益科目。恰如其名，资产负债科目可以汇总在某一时间点处你的资产和负债金额，而损益科目汇总在损益表报告中，损益表报告显示了一段时间内的净值变动，例如一财年内的变动。

在深入理解科目类型之前，先简单回顾一下会计等式： 资产 - 负债 = 所有者权益 + (收入 - 费用)。

图 2.14. 基本科目间的关系

五类基本科目类型之间的关系图。净值经收入而增加，经费用而减少。箭头代表金额的移动。

资产负债科目

三个所谓的资产负债科目是资产、负债和所有者权益。资产负债科目用于跟踪你的资产或负债。

资产是一组你拥有的东西。你的资产可能包含汽车、现金、房产、股票，或其它任何具有兑换价值的东西。兑换价值是指理论上你可以卖出资产换取现金。

负债是一组你欠别人的东西。你的负债可能包括汽车贷款、学生贷款、房屋贷款、投资保证金帐户，或其它任何你必须在某一时刻偿还的东西。

所有者权益即“净值”，代表从资产中减去负债后所剩的东西。可以认为它是你完全拥有的、不含任何债务的一部分资产。

损益科目

两种损益科目用于增加或减少各科目的金额。所以，资产负债科目只是跟踪资产和负债的金额，而损益科目能够改变这些科目的的金额。

收入是你通过你的时间、你提供的服务或对资金的利用而得到的报酬。例如，当你收到工资时，工资就是你为雇主提供劳动而得到的报酬。收入也包含佣金、小费、来自股票的股息收入和来自银行账户的利息收入。收入总是会增加资产的价值。

费用是指涉及用于购买他人提供的商品或服务的花销。费用可以是餐馆里的一顿晚饭、房屋租金、杂货、汽油或演出票。费用会减少你的净值。如果你立刻支付费用，资产会减少，而如果你使用信用卡支付费用，负债会增加。

GnuCash 科目

本节将阐明GnuCash定义的科目如何对应于五类基本科目类型。

首先，给出GnuCash中科目的定义。一个GnuCash科目是包含其它子科目或交易的实体。由于科目可以包含其它科目，你经常可以在GnuCash中看到科目树，逻辑上相关的科目在一个共同的父科目下分为一组。

GnuCash中一个科目必须具有（由你指定的）唯一名称，以及预定义GnuCash“科目类型”的其中之一。GnuCash总共有12种科目类型。这12种科目均可归类于5类基本科目类型，之所以GnuCash科目类型多于基本科目类型是为了帮助GnuCash针对某些科目进行特殊的跟踪和处理。有6种资产科目（现金、银行、股票、共同基金、应收账款和资产）、3种负债科目（信用卡、应付账款和负债）、1种所有者权益科目（所有者权益）、1种收入科目（收入）、1种费用科目（费用）。

下面详细列出这些GnuCash科目类型。

资产负债科目

第一种详细介绍的资产负债科目是资产，正如你在前文了解到的那样，资产涉及你拥有的东西。

为了帮助你组织资产科目并便于录入交易，GnuCash支持以下几种资产科目类型：

1. 现金。使用此科目跟踪你在手头、钱包里、存钱罐中、床垫下，或任何你选择放在手边的现金。这是最具流动性的、最方便交易的资产类型。

2. 银行。此科目用于跟踪你在银行，信用合作社，储蓄、贷款或经纪公司等任何资产受保护的机构中的余额。这是第二最具流动性的科目类型，因为你可以方便地将之兑换为手头的现金。

3. 股票。使用此科目类型跟踪你单独持有的股票和债券。股票科目账簿提供附加列，用于输入份额数量和投资价格。除非你找到买家，否则你可能无法方便地将这种类型的资产转换为现金，而且你无法保证卖出时得到的金额与买入时花费的金额相同。

4. 共同基金。这一科目类型与股票科目类似，只不过是用于跟踪基金的。它的账簿也提供了相同的附加列用于输入份额和价格信息。基金代表多项投资的所有权份额，而且和股票一样不对现金价值提供任何保证。

GnuCash以相同的方式处理股票和共同基金这两种科目类型。

5. 应收账款。此科目一般仅用于企业。你应当将别人欠你的重要借款录入应收账款科目中。一般视应收账款为一种资产，因为你能够指望对方归还这些资金。

不应以任何方式添加、更改或删除涉及应收账款科目的交易，除非使用

- post/unpost bill/invoice/voucher 或

- process payment

6. 资产。GnuCash可以轻松地处理其它许多情况，不管这些情况有多么的变化多端。科目类型“资产”可以用于上文未列出的各种资产。

GnuCash以相同的方式处理现金、银行和资产科目类型。

科目是“信息仓库”，用以跟踪或记录与建立科目的目相关的活动。

对于企业，往往会把要跟踪和编制报表的活动细分得比这里考虑的更加细致。为了更深入地研究这一可能，请阅读本指南第 15 章 Other Assets中的相关描述。

对于个人财务管理，可以使用与企业相同的科目结构，也可以不同。因为用于企业的科目结构可能对个人正在跟踪的财务活动和个人管理金融资产需要的各类报表有一定作用。更多信息可查阅本指南的第 15 章 Other Assets。

第二种资产负债科目是负债，正如前文所述，它指你欠的东西或你借入的钱，而且应当在将来偿还。这些都代表着借款人从你这里获得回报的权利。跟踪负债余额可以让你知道在某一时间点你承担了多少负债。

GnuCash 提供三种负债科目类型：

1. 信用卡用于跟踪信用卡收据并根据信用卡账单对账。信用卡代表一种应当向信用卡公司偿还的短期贷款，这种科目也可用于其它短期贷款，例如从银行获得的信用贷款。

2. 应付账款 此科目一般用于企业，用于记录尚未支付的账单。

涉及应付账款的交易不应通过除使用

- post/unpost bill/invoice/voucher 或

- process payment

以外的方式添加、修改或删除。

3. 负债用于所有其它的负债，一般是数额更大的长期贷款，例如房屋贷款或汽车贷款。此科目有助于跟踪你当前的负债金额或已偿还金额。

GnuCash以相同的方式处理信用卡和负债这两种科目类型。

提示

负债的记账方法与资产相反：贷增加负债余额，借减少负债余额。

最后一种资产负债科目是所有者权益，也就是“净值”。它代表从资产中减去负债后的剩余，所以这是你的资产中不含任何负债的、完全由你拥有的部分。在GnuCash中此类科目用作期初余额的来源，因为这些余额代表你的初始净值。

通常科目表中只有一个GnuCash所有者权益科目，自然被叫做所有者权益。对于企业，你可以为每位合作伙伴创建其子科目。

提示

在所有者权益科目中，贷增加科目余额，借减少科目余额。

注意

关联资产负债科目的会计等式是 “资产 = 负债 + 所有者权益”，也可改写为 “负债 - 资产 = 所有者权益”。所以，通俗地讲，你拥有的东西减去你欠的东西等于净值。

损益科目

收入是你由于你的时间、你提供的服务或对钱的利用而获得的支付金额。在GnuCash中， 使用收入科目类型跟踪这些金额。

提示

贷增加收入科目余额，借减少收入科目余额。正如“会计概念”一节所述，贷代表金额从科目中移出。所以在收入科目中，当你将钱从收入科目移到另一个科目时（贷），收入科目的余额会增加。例如，当你存入工资并记录了一笔从收入科目至银行账户的交易时，这两个科目的余额都增加了。

费用指你用于购买他人提供的商品或服务的钱。 在GnuCash中，使用费用类型科目跟踪费用。

提示

借增加费用科目余额，贷减少费用科目余额。

注意

在一段时间内，从总收入减去总费用得到净收入。净收入随后作为留存收益添加到资产负债表的所有者权益科目。

下面展示了标准的收入和费用科目，在新建科目层级向导（功能 → 新建科目层级…）中选择通用科目后会创建。

图 2.15. 默认收入科目

此图展示了标准的收入科目。

图 2.16. 默认费用科目

此图展示了标准的费用科目。

其它科目类型

也有其它一些特殊的科目类型。

贸易。多货币交易需要录入与“贸易”科目关联的分录，以使交易在每种货币和整个账簿上均保持平衡。请阅读第 12 章 Multiple Currencies详细了解。

货币市场和信用额度仅用于OFX导入器，以完整符合规范。

步步为营

现在根据从此章学习到的内容，体会构建通用个人财务科目表的过程。科目表只不过是一个新的GnuCash文件，你可以在其中组织科目结构用以跟踪财务状况。要构建科目表，第一步是将你想要跟踪的财务事项划分到各个基本会计科目类型中去。这相当简单，不妨看看下面这个例子。

简单示例

假定你在银行中有一个活期账户和一个储蓄账户，你自己受雇佣因此会收到工资。你持有信用卡，按月支付房租、话费和电费。当然，你也需要购买食品杂货。现在，我们不会关心你在银行里存了多少钱，你的信用卡欠了多少钱，等等。这里只是简单地构建科目表的框架。

你的资产包含银行储蓄账户和活期账户。你的负债是信用卡欠款。你的所有者权益是银行账户和信用卡的初始金额（我们目前还没有这些金额数据，但这些金额是存在的）。你以薪资的形式获得收入，以食品杂货、房租、电费、话费和薪资税费（所得税、社保、医保等）的形式产生费用。

基本顶级科目

现在你必须决定你想要怎样组织这些科目。一般来说，你想让你的资产分为一组，负债分为一组，所有者权益分为一组，收入分为一组，费用分为一组。这是最常见的构建科目表的方式，同时强烈建议你总是以之作为组织科目的起点。

一开始，从菜单中选择文件 → 新建创建空白的GnuCash文件。新建层级科目向导会启动。点击取消关闭向导，因为我们不想使用任何一种预定义的科目结构。我们将依照自己的想法自行构建基本初始科目结构。在空白的GnuCash窗口中选择菜单查看 → 新科目页面，随后将打开科目标签页。再选择功能 → 新建科目…。

现在可以着手构建基本初始科目结构了。

1. 科目名称：资产 （科目类型：资产，父科目： 新建顶级科目）

图 2.17. 创建资产科目

此图显示了创建资产科目的对话框。

2. 科目名称：负债 （科目类型：负债，父科目：新建顶级科目）

3. 科目名称：所有者权益 （科目类型：所有者权益，父科目：新建顶级科目）

4. 科目名称：收入 （科目类型：收入，父科目：新建顶级科目）

5. 科目名称：费用 （科目类型：费用，父科目：新建顶级科目）

创建顶级科目后，GnuCash中的科目页应该如下图所示：

图 2.18. 基本顶级科目

此图展示了基本顶级科目。

创建子科目

现在可以向基本顶级科目树结构添加一些存储实际交易的子科目。注意各个税费科目置于名为税费的子科目之下。可以在子科目下再创建子科目。一般将一组相关的科目作为同一科目的子科目（如这个例子中的各个税费科目）。

提示

除了从菜单中选择功能 → 新建科目…，也可以右击科目名称并选择新建科目…菜单项创建相应科目的子科目。随后会打开与“基本顶级科目”一节所示相似的对话框，其中将新建的科目会自动设为相应科目的子科目。

1. 科目名称：现金 （科目类型：现金，父科目：资产）

2. 科目名称：活期 （科目类型：银行，父科目：资产）

3. 科目名称：储蓄 （科目类型：银行，父科目：资产）

4. 科目名称：信用卡 （科目类型：信用卡，父科目：负债)

5. 科目名称：薪资 （科目类型：收入，父科目：收入）

6. 科目名称：话费 （科目类型：费用，父科目：费用）

7. 科目名称：电费 （科目类型：费用，父科目：费用）

8. 科目名称：房租 （科目类型：费用，父科目：费用）

9. 科目名称：杂货 （科目类型：费用，父科目：费用）

10. 科目名称：税费 （科目类型：费用，父科目：费用）

11. 科目名称：所得税 （科目类型：费用，父科目：费用:税费）

12. 科目名称：社保 （科目类型：花费，父科目：费用:税费）

13. 科目名称：医保 （科目类型：花费，父科目：费用:税费）

14. 科目名称：期初余额 （科目类型：所有者权益，父科目：所有者权益）

在创建了这些子科目后，最终结果如下所示：

图 2.19. 基本科目表

此图展示了一个简单的科目表。

使用文件名gcashdata_3和gcashdata_3emptyAccts保存此科目表，我们将在后续各章中继续使用这些文件。

现在，你已经创建了一份简单的用于跟踪家庭财务状况的科目表。在准备好这一基本框架后，我们现在可以开始向科目中添加交易了。具体会在下一章详细介绍。

交易

本章会针对在GnuCash中理解和使用交易做出基本说明。科目是科目表的结构与框架，然而交易才是填充各个科目的数据。

基本概念

GnuCash这类复式记账系统中的交易是指至少两个科目间的转账。因此一条交易总是包含至少两部分：一个来源科目和一个目的科目。金额从来源科目转移到目的科目中。会计师将交易的这些组成部分称为账簿条目（Ledger Entries）。在GnuCash中称之为分录。

一条分录包含涉及的科目，以及从之转出或向之转入的金额，如有需要，分录也可以包含其它几项信息。GnuCash支持在一条交易中记录多条分录，各条分录可以向涉及的科目转入或从之转出任意的金额。

例如，你收到了工资并将之存入银行储蓄账户。发生的交易就是你的银行储蓄科目（属于资产科目）从收入科目中得到了钱。两个科目受到影响，此时所有者权益净值增加了。

在GnuCash中增删交易需要使用科目账簿。每个创建的科目都对应一份科目账簿。它很像用于跟踪支票簿的日志，所以可能你看着很眼熟。

科目账簿会在接下来的“科目账簿”一节详细介绍。

科目账簿

科目账簿是一类窗口，可以浏览或编辑已经存在的交易，或为某一科目添加新的交易。要从科目树打开某一科目的科目账簿，双击科目名称，或者右击科目名称并从菜单中选择打开科目，也可以使用工具栏上的打开按钮。GnuCash会显示科目账簿窗口。

科目账簿的功能

科目账簿和标题栏显示了科目名称。标题栏之下，菜单栏显示了能够在科目账簿中使用的菜单项，工具栏包含方便操作科目账簿的常用功能按钮。

在科目账簿窗口的左下方，GnuCash会随窗口中鼠标移动而显示有用的帮助消息。在右侧，可以看到当前科目余额和已结清分录的总计。

选择账簿风格

GnuCash提供了几种样式选项，便于浏览账簿。默认样式是基本账簿模式，仅将影响当前科目的分录显示在一起。这种样式看起来十分类似其它流行的个人财务软件。你可以从查看菜单选择不同的账簿风格。另有两个选项：

- 查看 → 自动分录账簿样式会自动展开当前的交易。当在账簿中选中新的交易时，交易会自动展开以展示其全部分录。

- 查看 → 交易日志样式会在账簿中显示所有交易的所有分录，此样式更像是会计日志。

这些样式均能够以单行或多行格式浏览数据。选择查看 → 双行，可以看到交易行扩展成了两行。双行模式也会显示交易说明列。

下面的屏幕截图展示了基本账簿和交易日志在外观上的不同。

例如，假设你花1000元购买了三条牛仔裤，且已经将这次购买录入为分录交易，其中每条牛仔裤各录入一条分录。

下面的屏幕截图展示了不同浏览模式下的差异。

首先，从活期科目查看牛仔裤交易：

图 2.20. 在资产:活期科目中查看购买三条牛仔裤的交易

此图展示了一条分录交易，其中包含三项牛仔裤购买分录。

现在，打开费用:服装科目，以基本模式查看。

图 2.21. 在费用:服装科目中以基本账簿模式查看购买三条牛仔裤的交易

此图展示了基本账簿模式下的费用:服装科目。

这里出现了三项，但活期科目中只有一项分录。仔细观察可以发现每一行的金额不同，分别为200元、300元和500元。这说明，此模式下账簿的每一行对应原始交易中的一条分录。

更改为交易日志模式则仅显示原始的分录交易。

图 2.22. 在费用:服装科目中以交易日志模式查看购买三条牛仔裤的交易

此图展示了交易日志模式下的费用:服装科目。

调整列宽

和电子表格一样，左键点击并拖动表头的分隔线能够调整账簿中各列的宽度。列头右侧的分隔线控制此列的宽度。在GnuCash中，描述和说明列会生动调整大小，使得账簿自适应地填满整个窗口，所以向左侧拖动这些列的分隔线会缩小列宽，但会在释放时移回原处。向右侧拖动分隔线会加宽显示区域并在窗口底部显示滚动条，但这一效果只会在账簿打开时保持。关闭并重新打开账簿或退出GnuCash后，账簿仍会丝毫不差地填满空间。

注意

很多用户在调整余额列时遇到了困难，特别是在增加其宽度的时候。只需将其右边界拖出窗口就可以增加此列的宽度。将鼠标从左侧移动到分隔线处，并在鼠标指针成为双向箭头<-|->时立刻按下鼠标。

重要

在分录模式下，账簿表头中存在不同的列标题，根据当前激活的行类型，分别对应分录行和交易行。为了调整分录行的列宽，必须首先选中分录行；为了调整交易行的列宽，必须选中交易行。

除描述列之外的列宽设置会保存在用户账簿的状态文件中，并在账簿关闭并重新打开时恢复先前调整的列宽。

使用数据录入快捷键

GnuCash提供了几组快捷键，可以使录入交易数据更加快捷。

- 日期输入框会根据当地日期格式解析输入的短日期（例如 2/15 或 15/2）。短日期代表当前年份内，或由首选项的日期时间标签页中选择的包含12个月的滑动窗口内的月份和日期。下述按键会调整当前输入的日期：

- + 或 = 后一天， - 或 _ 前一天。

- ] 或 } 上个月，[ 或 { 下个月。

- M 或 m 设为此月第一天。

- H 或 h 设为此月最后一天。

- Y 或 y 设为此年第一天。

- R 或 r 设为此年最后一天。

- T 或 t 设为今天。

提示

不仅可以在账簿中使用这些快捷键设置日期，在其他输入日期的地方也可以使用这些快捷键。

提示

输入日期时，也有另一种方式可以节约时间——输入部分日期。例如，如果只输入一个数字，GnuCash会解释为当前年份当前月份的日期。如果输入日期和月份，GnuCash会自动添加年份。默认情况下会从11个月前开始选取相应的日期。这说明，如果你输入1/5（1月5日），而当前日期是2015年12月，则日期会补全为 16/1/5。此默认行为可以通过编辑 → 首选项 → 日期与时间+日期补全更改。可以更改为总是在当前日历年内选择日期，或更改滑动窗口的起始位置。

- 在交易行的编号列，按下+会在先前输入的数字基础上增大交易编号。按下-会减小编号。

- 当在描述列中输入时，GnuCash会寻找先前具有以此开头的描述的交易，将其作为自动补全的提示内容。在显示补全文本时按下Tab，GnuCash会复制先前的交易，并将光标聚焦选中借或贷的数值，以便重新输入新的数值。

注意

此处复制的是整个交易，包括一些可能不显示的部分，如说明和价格。除非你确实想要精确地复制交易，否则请确保已经修改了所有应与之不同的内容。

提示

你可以使用这项功能一次添加多项交易，然后再回到描述列修改交易描述。

- 转账列支持科目名称的快速补全。可以先输入科目名，随后GnuCash会补全科目名称其余部分。任何时候输入分隔符会补全科目名称的当前层级，并将光标置于开始输入科目名称下一层级的位置。例如，输入资:活可能会补全为资产:活期科目。以这种方式依序输入名称会弹出列出了全部科目的列表，其中预测项会被选中。另外，也可以输入科目名称中的任何字符序列，会弹出科目列表，其中会筛选出包含当前输入字符序列的科目。不论哪种情况，都能使用上箭头或下箭头从弹出列表中选择科目。

- 可以在任何涉及数量的列中使用内置计算器。只需输入第一个值之后再接着输入+、-、*或/。然后输入第二个值。GnuCash会在按下Tab键时执行计算并将计算结果填入数量列中。

- 所有的菜单项都具有访问键，在按住Alt键时，访问键在菜单名称中使用下划线标出。按下Alt+下划线字符弹出菜单，然后按下相应的访问键选择对应的菜单项。例如，按下Alt+A弹出功能菜单，然后按下P选择分录交易功能。一些菜单项也分配了快捷键，能够立刻执行相应的功能（一般配合使用Ctrl键）。这些快捷键都在各自菜单项的右侧列出。

- 使用下面这些按键可以在账簿中快速移动：

- Tab移动到下一列，Shift+Tab移动到前一列。

- Home移动到第一列，End移动到最后一列。

- Enter或↓移动到下一个交易， ↑移动到上一个交易。

- Page Up向上移动一屏，Page Down向下移动一屏。

- Shift+Page Up移动到第一个交易，Shift+Page Down移动到最后一个交易。

在对账窗口中可以使用这些键盘快捷键：

- 使用Tab移动到下一个列表框，Shift+Tab移动到上一个列表框。

- 使用空格键在已对账和未对账状态间切换。

- 使用↑和↓在当前列表框中各项间移动。

简单交易还是分录交易？

GnuCash中每一个交易都至少有两项分录，但一项交易也可以拥有多于两项的分录。只有两项分录的交易称为简单交易，因为它只涉及当前科目和另一个科目。涉及三个或更多个科目的交易称为分录交易。

当账簿处于基本账簿模式时，你会看到影响当前科目的分录汇总。对于简单交易，转账列会显示同其转移金额的另一个科目。对于分录交易，转账列会显示-- 分录交易 --。选择某一分录交易后，可以点击工具栏上的分录按钮查看交易下的各分录。

对于分录交易，交易的第一行是交易行，包含日期、可选的编号，交易描述，影响当前科目的总额（此处的总计增加）和在此交易发生后新的科目余额。注意，当交易展开出多个分录行时，转账列头会隐藏，对应列中也不会显示科目名称。有关此交易的详细信息，需要查看组成该交易的各项分录。

注意

科目账簿只会显示那些包含关联到此科目的分录的交易。如果某交易有超过一项分录关联到此科目，那么在基本账簿和自动分录视图下，该交易中多项与此科目关联的分录都会显示一次。在交易日志账视图下，这样的交易只会显示一次。

交易行之下是分录行，分录行之间使用灰色线条分隔。选中分录行时，表头会变为与分录相关的各项。

图 2.23. 资产:活期科目中的薪水

此图展示了分录表头的变化。

每项分录都包含可选的动作，也就是分录类型，可以输入也可以从下拉列表中选择。分录也包含可选的用于描述此分录的备注。每一项分录影响一个科目，可以使用下拉列表在各科目中选择。R列指示分录是否已经对账。最后两列显示了转入或转出相应科目的金额。

正如“会计概念”一节介绍的那样，每项交易中借方总额（左列）必须等于贷方总额（右列）。在上面的例子中，借方总额等于贷方总额，所以此交易是平衡的。你可能已经留意到，交易行的借方金额与活期分录行的金额相同。为什么这一金额会出现两次呢？因为交易行只总结此交易对当前科目的影响。同一项交易，在不同的科目下显示的交易行也不尽相同，同一项交易在不同科目下显示的交易行代表对各自科目的影响。你可以选中另一分录行，再点击工具栏中的跳转按钮，来观察这一点。

在这个例子中，如果你跳转到收入:薪资科目，GnuCash会在收入:薪资科目账簿中显示同一项交易：

图 2.24. 收入:薪资科目中的薪水

此图展示了跳转到收入:薪资科目后的界面。

注意，交易行现在汇总的是此交易对收入:薪资科目，而非对活期科目的影响，这是因为你现在浏览的是收入:薪资科目账簿。此交易下的分录行是完全相同的，但现在交易行反映的是对收入:薪资科目的贷记。

简单交易的例子

在之前章节创建的gcashdata_3的科目表基础上，双击活期资产科目。我们现在向活期科目添加一项简单交易。当你第一次在GnuCash中创建科目时，往往会从期初余额开始录入交易数据。

在第一个交易行，输入日期（如2006年3月1日）、描述（如“期初余额”），点击转账弹出列表并选择所有者权益:期初余额，输入1000元的转入金额，并按下Enter键。科目账簿现在应当如下图所示：

图 2.25. 添加期初余额交易后的活期科目

此图展示了插入期初余额交易后的资产:活期账簿。

设置科目的期初余额是简单双科目交易的一个例子，此交易影响的是资产:活期和所有者权益:期初余额科目。

再举一个简单双科目交易的例子。再添加一项交易，记录购买了45.21元的杂货。在资产:活期科目中，设置转账为费用:杂货。科目账簿现在应该显示为：

图 2.26. 添加购买杂货交易后的活期科目

此图显示了添加了购买杂货交易后的资产:活期账簿。

分录交易示例

有时需要在一项交易中添加三项或更多项分录，此情况往往出现在需要将交易中的来源科目或目的科目分拆进多个科目的时候。一个典型例子是在收到工资时。你带回家的钱往往少于支付给你的工资，其中的差异是由税费、养老保险和其它事项导致的。因此，收到工资这一笔交易除了资产:活期和收入:薪资这两个科目外，还会涉及其它科目。

要从资产:活期科目账簿窗口添加工资分录交易，点击新交易行并点击分录。注意，如果你已经将账簿窗口视图设置为自动分录或交易日志，分录行会自动展开。在第一行输入对此交易的描述（例如“公司支付薪资”）。在其下的分录行中，逐一输入组成此交易的多项分录。要输入分录，先选择科目，再输入相应科目的变动金额。请记住，对于资产科目，在左列输入的金额会增加科目余额，在右列输入的金额会减少余额（详细了解请参考“交易”一节）。按下Tab键或点击下一个分录行，重复此过程。请注意，如果你使用键盘在不同交易间跳转，使用Tab可以在列之间跳转，使用Enter会确认此交易并在“不平衡的”科目中创建分录。

注意

在GnuCash中创建交易时，能够以任何顺序录入分录。然而，在交易被确认之后（可能是输入光标离开此交易或者按下Enter键），所有借方分录会移动到所有贷方分录之前。

在此示例中，选择存入工资的科目（资产:活期）并输入要存入的金额（例如670元）。随后，输入各项税费的金额：费用:税费:所得税科目，180元；费用:税费:医疗保险科目, 90元；以及费用:税费:社会保险，60元。最终，收入:薪资科目作为贷方，输入工资的总额。

最终的分录看起来应该像是图 2.27 “录入一笔分录交易”。记得在录入完毕后按下Enter键。不过要注意到在按下Enter之后，分录视图会“折叠”回简化的交易视图。分录仍然存在，你只需要点击分录来查看这些分录。参见“科目账簿的功能”一节了解详细信息。

图 2.27. 录入一笔分录交易

对账

一旦将交易录入进GnuCash，验证这些交易同金融机构的记录是否一致就十分关键了。这一验证过程被称为对账，这是确保你的记录准确无误的关键。最常见的情况是，你需要同银行账单对照核对交易，当然也可以通过这一过程核对交易是否正确录入。

GnuCash会一直跟踪每个交易的对账状态，交易的对账状态在账簿中使用对账R列指示：y表示交易已经对账，n表示还没有对账，c表示已结清但没有对账。标记为已结清的分录表示得到了金融机构已接受指令的确认信息（比如，你拿到了使用信用卡付款的餐厅收据）。你可以点击R列在n和c间切换对账状态，也可以根据“对账窗口”一节置为y。

在科目窗口底部，有两个实时更新的余额（分别是已结清和已对账余额），以及总计余额。前者代表银行认为你的账户中有多少钱，而后者包含了未结清的交易。

举个例子，当你支付某些费用时，你应该向GnuCash录入交易。交易的对账R列初始为n （新添加）。新录入的交易会更新到总计余额中。随后，如果你收到了有关支付已被接受的确认信息，你可以点击交易的R列，将之更改为c（已结清）。在进行此操作后，已结清余额会更新，将此金额包括进去。在收到银行账单后，你可以打开对账窗口，对比银行账单和已在GnuCash中录入的交易，随后，你能够将R列更改为y（已对账）。

注意

你不能直接在账簿窗口中点击R列来对账，必须使用对账窗口。一旦交易被标记为已对账，就不能再随意更改，除非在下一次对账中故意输入错误的期初余额。

警告

特别重要的是，要充分理解对账是针对某一给定的日期进行的。当你根据某一特定日期的账单为科目对账时，你是在对此日期之前的所有交易进行对账。因此，如果你添加或修改最后一次对账日期之前的交易，你的已对账余额会变回之前的数额。

对账窗口

对账窗口用于根据银行或其它机构发送给你的账单为某一GnuCash科目进行对账。对账是很有用的，不仅可以根据银行的记录再次核对账簿中的交易记录，也可以得知哪些交易还未结清，比如未付款的账单。

要，从科目树中选择一个科目并点击功能 → 对账打开对账窗口，如下所示，可以在此处输入对账信息。

图 2.28. 初始的对账窗口

在初始对账窗口中，需要输入一些对账信息。

账单日期

对账所依据的银行账单的日期。

提示

点击此输入框右侧的下拉箭头打开日历。

期初余额

此项不可编辑，显示前一次对账后的余额。此数字应当与银行账单的期初余额一致。

警告

有时，GnuCash显示的期初余额与你的银行账单并不一致。在第一次对账，或者先前已经对账的交易被删除或取消对账的时候可能会出现这一情况。

注意

首次对账时，期初余额会是0.00，所以此处显示的期初余额可能与该科目的“期初余额”交易不相同。在对科目对账时，“期初余额”交易也应当标记为已对账，这样做结果才会是相符的。

提示

如果先前的交易因失误被取消对账，你可以放心与当前银行账单记录的交易一起重新对账，结果应该的平衡的。

在因失误删除先前已经对账的交易时，事情有些棘手。如果你不确定删除了什么，也无法将之复原到账簿，那你可能需要创建一项虚拟交易，以完成对账。

小心

不过，只有在个人记账时，后一种情况才不成问题；如果你是社团或公司的会计师，你应当跟审计师好好解释。

期末余额

此输入框应当按照银行账单所示金额填写期末余额。

注意

GnuCash会自动将科目账簿下方显示的当前余额填入此输入框。

包含子科目

要把当前所选科目下的子科目的交易一同对账，请勾选此选项。注意，要使用此功能，子科目的商品应当与父科目相同。

输入利息付款

点击此按钮会打开新窗口，可以为要对账的科目输入利息交易。

提示

利息付款窗口可能会在为银行、信用卡、共同基金、资产、应收账款、应付账款和负债科目启动对账时自动打开。如果你想为所有先前的科目禁用此行为，前往GnuCash首选项的账簿标签页，取消勾选自动利息转账选项。另外，如果只是为选择的科目禁用此行为，可在利息付款窗口中点击此科目无需自动利息支付按钮。

然后，点击确定按钮，可以看到对账窗口中列出了各项交易：

图 2.29. 对账窗口

对账窗口中的交易列表。

窗口中的两列分别叫做转入和转出，列出了此科目下所有未对账交易，接下来就是要为这些交易进行对账。其中的R列表示交易是否已对账。

现在，检查银行账单中的每一条记录，并在对账窗口中寻找其匹配项。

如果你找不到某项交易，你或许是忘记录入这项交易或不知道这项交易已经发生。你可以使用工具栏上的新建按钮或交易 → 新建菜单项打开账簿窗口录入遗漏的交易。新创建的交易会当在账簿中录入交易后按下Enter键时在对账窗口中出现。

当在对账窗口中发现了相应的交易时，对比此交易的金额与银行账单上的金额。如果两者不一致，你可能在GnuCash中把交易输入错了。你可以使用工具栏中的编辑按钮或交易 → 编辑菜单项打开账簿窗口修正错误。

如果金额相符，点击对账窗口中的相应项，所选交易的R列处会打上对勾。GnuCash会自动更新右下方合计面板中的金额。

提示

可以使用上与下 方向键在不同条目间切换，使用空格键将条目标记为已对账，使用Tab键在不同面板间切换。

接下来，对银行账单上的每一条记录重复这一操作，验证银行账单中各条记录的金额符合GnuCash中相应交易的金额，然后将GnuCash中的相应交易标记为已对账。

提示

在任一面板中，点击其中一项交易，按下Ctrl-A，再按下空格，就可以勾选或取消勾选所有交易的对账状态。此操作将面板中所有交易的对账状态统一切换为勾选或取消勾选，可以重复此操作将面板中的交易切换为需要的状态。

对账窗口的底部有差额统计项，对账完成后应显示为0.00。如果此处显示了其它值，说明在GnuCash中要么遗漏了一些交易，要么一些交易的金额不正确。（也可能是银行出错了，不过基本上不可能。）

注意

某些情况下，找出科目为什么账目不符很困难甚至不可能。如果不能修正账簿与银行账单之间的差异，可以使用工具栏上的平衡按钮，自动用不平衡的金额创建交易来确保两者余额相符。

要使用此功能，尽量对账（将所有你能够辨识的交易标记为已对账）后，点击平衡按钮。GnuCash会使用特殊科目:孤立的-XXX科目（其中“XXX”代表你的货币）根据仍存在的差额创建余额平衡交易项。此时对账窗口会关闭。重新打开对账窗口后，可以检查新创建的余额平衡交易并结束对账过程。

在将所有与银行账单上的条目相对应的交易标记为已对账且差额为0.00时，点击工具栏上的完成按钮，或从菜单中选择对账 → 完成。对账窗口会关闭。在账簿窗口中，已对账交易的R列会变为y。

不过目前，我们尚未掌握所有信息，因此点击推迟按钮，这样就可以继续进行后面的操作了。值得注意的是R表明我们已经结清(c)了两项交易。我们还没有为这两项交易对账，但已经核对了它们，所以它们标记为已结清。你可以看到账簿窗口下方的状态栏已经汇总出了已对账金额和已结清金额（已结清: ￥954.79 已对账: ￥0.00）。

图 2.30. 推迟对账后的活期存款科目

计划交易

计划交易功能可以帮助创建重复的交易，像是报刊订阅费、保险或税费。使用计划交易，只需录入一次关心的交易，设置开始日期、频率和些许描述等参数，然后GnuCash就会告知到底什么时候准备创建计划好的交易，并到那时候创建交易。

在这一部分的指南中，我们拿每月28日交纳20元的互联网接入费为例子。

在GnuCash中，有两种创建计划交易的方式， 从账簿创建计划交易或是使用计划交易编辑器。

从账簿创建计划交易

在账簿中录入一系列计划交易中的第一次交易。在转账列中，输入费用:网费，如下图所示。

图 2.31. 从账簿创建计划交易的第1步

注意

由于我们还没有创建费用:网费科目，GnuCash会提示创建此科目。

然后，右击刚才创建的交易，选择计划… 。

图 2.32. 从账簿创建计划交易的第2步

会弹出如下窗口：

图 2.33. 从账簿创建计划交易的第3步

现在来填写这些参数，我们知道网费在每月28日缴纳，下一次交费就是在下个月了（我们已经手动录入了本月的交易）：

图 2.34. 填写计划交易的参数

点击确认按钮，计划交易就创建好了。GnuCash现已记下了此计划交易，到下个月28日会弹出窗口询问是否要创建新的交易（可见后文的屏幕截图）。

从编辑器创建计划交易

录入计划交易的另一种方式是通过计划交易编辑器，如果一次要创建几项计划交易，那这样做会快些。

选择科目窗口菜单栏中的功能 → 计划交易 → 计划交易编辑器。计划交易标签页会在当前GnuCash窗口中打开，如下图所示：

图 2.35. 空白的计划交易标签页

空白的计划交易标签页。

此标签页包含一份列表（现在是空的），其中会列出全部已创建的计划交易。先来创建新的计划交易，点击工具栏中的新建按钮，会弹出如下所示的新窗口：

图 2.36. 编辑计划交易窗口的概览标签页

编辑计划交易窗口，概览标签页。

首先，在窗口上部为新建的计划交易输入一个名字。

注意

这个名字仅用于在编辑计划交易窗口中区分不同的计划交易，从不会出现在账簿中。

概览标签页的选项面板提供了四个选项：

启用

设置计划交易的状态。

自动创建

若勾选，GnuCash会不经提前询问而插入此交易（详见下文）。如果需要，勾选在创建时通知我选项，来在创建交易时获得提示。

提前创建

设置交易要提前多少天创建。

提前提醒

设置要提前多少天提醒。例如，这个选项可以用于当你需要使用支票支付费用的时候，提前一周提醒有助于你在截止日期前送出支票。

执行面板中的选项可以告诉GnuCash计划交易不会永远持续下去。例如，如果你在偿还贷款，你可以输入还款结束日期或贷款剩余期数。

现在选择编辑计划交易窗口中的频率选项卡。此处可以设置与时间相关的选项。

图 2.37. 编辑计划交易窗口的频率标签页

编辑计划交易窗口，频率标签页。

频率

设置交易的基本频率，提供的选项有单次、 每天、每周、 每半月和每月。在此例中，我们设为每月。

注意

也可以更改每…选项，将交易的发生周期设为频率中所提供选项以外的值，详见下文。

起始日期

设置交易开始时间。在此例中设为下个月。

每…

此选项可以倍乘频率选项设置的交易周期。例如，要每3周执行交易，将频率设为每周再将每…周设为3。

在和排除周末

设置交易计划在月中的哪一天，并控制当那一天是周末时GnuCash怎样处理。

注意

我们知道网费在每月28号交，所以起始日期是11月1号（假设下个月是11月），频率是每月。在此例中，网费交易会自动添加，所以无需提前创建，也不用给出结束日期。

当此标签页中的选项填写完毕后，GnuCash会在下方的日历中标出将来的交易会在哪些日期执行。

最后选择交易模板@标签页，像在账簿中那样在下面录入交易，只是不填日期。别忘了点击确认图标以确认录入交易。

现在，你看到的窗口应该像这样：

图 2.38. 编辑计划交易窗口的交易模板标签页

编辑计划交易窗口，交易模板标签页。

现在点击确定，回到计划交易标签页，现在交易列表中会显示刚才添加的计划交易。

图 2.39. 最终录入的计划交易

提示

点击日历区域中的某天，一个跟随鼠标的小窗口会显示鼠标指向的这天有哪些计划的交易。再次点击鼠标来隐藏小窗口。

现在可以关闭计划交易标签页，并保存账簿。

注意

下文是解释性的描述，不代表当下就会录入GnuCash数据库。在每一次计划交易运行时，下面的对话框就会出现。

从现在开始，当GnuCash启动且计划好的交易需要录入时，会看到自从上次运行…窗口，其中汇总了计划好的交易操作（提醒、将要创建等等，GnuCash手册对每一选项进行了更详细的介绍）：

图 2.40. 计划交易弹出提醒

若需要，可以点击状态列更改计划交易状态。然后点击确定关闭自从上次运行…窗口并应用接下来的操作。点击取消跳过接下来录入账簿的操作。

如果状态列设为将要创建，浏览相应科目账簿，会发现交易已经被创建了。

提示

若勾选自从上次运行…窗口右下角检查创建的交易选项，点击确定后，GnuCash会自动打开每个被录入计划交易的科目。

注意

如果你在这一步录入了4月28号的交易，请恢复到最后保存的GnuCash文件，选择 文件 → 打开并选择之前保存的gcashdata_3 GnuCash 文件。

步步为营

本章前面的小节讨论了处理交易的概念和方法。这一部分会以前文构建的科目表为基础进行拓展，包括设置期初余额、添加交易和计划交易。

打开GnuCash文件

先是打开之前存储的数据文件gcashdata_3emptyAccts，并直接将之存储为gcashdata_4。主窗口应当如下图所示：

图 2.41. 步步为营的起点

此图展示了本小节操作的最初状态。

期初余额

正如前文“简单交易的例子”一节以资产:活期为例所述，科目的期初余额交易一般设所有者权益:期初余额为转账科目。要为科目表添加交易，就从为科目设置期初余额开始。假定储蓄科目中有1000元余额，信用卡有500元的欠款。

1. 打开资产:储蓄科目账簿。从菜单中选择查看确定处于基本账簿模式下。后文会以其它模式查看交易，但现在先使用默认的基本模式录入交易。

2. 在资产:储蓄科目账簿窗口中，录入一项基本双科目交易，将期初余额设为1000元，由所有者权益:期初余额转账。记住，基本交易是在单个来源科目和单个目的科目之间进行转账。然后确认交易（按Enter键或点击确认图标）。

3. 在资产:活期科目账簿窗口中，录入一项基本双科目交易，将期初余额设为1000元，由所有者权益:期初余额转账。

4. 在负债:信用卡科目账簿窗口中，录入基本双科目交易，将期初余额设为500元，由所有者权益:期初余额转账。此操作将500元录入为信用卡科目负债的增加（或者说是期初余额科目金额减少），因为这是你借入的一笔钱。然后确认交易（按Enter键或点击确认图标）。

你现在应该已经设置好了3个科目的期初余额，分别是资产:活期、资产:储蓄和负债:信用卡。

图 2.42. 设置期初余额后的科目表

此图展示了设置期初余额后的结果。

更多交易示例

接下来添加更多交易用以模拟一个月内的花销。在这个月里，电费花了78元，话费花了45元，房租花了350元，这些都是用银行活期账户支付的。我们还花了45.21元购置杂货，收到了670元的薪水，也支付了这个月的网费。最后，从储蓄账户向活期账户转账100元。

1. 打开费用:电费科目账簿，录入一项简单双科目交易，内容为本月末（如：2006年3月28日）支付78元电费。输入描述（如：国家电网）和交易编号（如：102）。转账科目应为资产:活期。

2. 打开资产:活期科目，录入一项基本双科目交易，在本月末（如：2006年3月28日）支付45元电话费。输入描述（如：中国移动）和交易编号（如：103）。转账科目应为费用:话费。注意，你既可以从借方（花费科目）录入这项支出交易，也可以从贷方（资产科目）录入。

3. 打开费用:房租科目，录入一项基本双科目交易，在本月末支付350元租金（如：2006年3月28日）。输入描述（如：四月房租）和交易编号（如：104）。转账科目应为资产:活期。

4. 使用工具栏上的创建副本按钮复制此交易。先点击当前的房租交易，再点击创建副本图标。输入的交易日期为从今往后推一个月（如：2006年4月28号）。注意GnuCash使用蓝色的线条分隔将来的交易与当前的交易。如此可以在交易实际发生之前就录入交易。

你也可以设置计划交易记录房租支出，因为在可预见的将来，房租金额大概是不变的。

- 先点击当前（4月28日）的房租交易，再点击计划图标。

- 更改为每月，如果需要也可以更改描述，点击确定。

5. 要把钱从储蓄账户转到活期账户，打开资产:储蓄科目账簿，添加一项新的交易，将其转账设为资产:活期，金额为100元（日期为2006年3月6日）。

6. 添加另一项交易，描述发生在3月5日价值45.21元的杂货购买，这是简单双科目交易的另一个例子。在资产:活期科目中，将转账设为费用:杂货。

7. 要从资产:活期科目账簿窗口添加薪资交易，点击新交易行，再点击分录。首先在第一行输入交易描述（如：“公司发放工资”）和日期（3月14日）。在下方的分录行中，输入向资产:活期存入的金额（如：670元）。随后录入多项税费缴纳分录：费用:税费:所得税（如：180元）、费用:税费:医保（如：90元）和费用:税费:社保（如：60元）。最后，录入自收入:薪资科目的取出转账，金额为薪资的原总额（如：1000元）。

8. 你也需要记录本月28号支出了20元网费。

图 2.43. 添加多项交易后的科目表

此图展示了按“交易”一节操作后的期末余额。

保存文件

在接下来介绍报表功能之前，先保存GnuCash数据文件（gcashdata_4）。

报表

不过，在电脑屏幕上展示这些枯燥的数据并不能令会计师满意，因此GnuCash提供了大量可高度自定义的报表。

注意

有关报表的更多信息可见第 10 章 Reports。

先来看看现金流量报表和交易汇总报表。

1. 首先来看三月份的现金流量报表。

由报表 → 收入与花费 → 现金流量表可以打开现金流量表。

图 2.44. 三月份的现金流量表

此图展示了按“交易”一节操作后得到的现金流量表。

要自定义报表，在报表中右击并选择报表选项，然后设置起止日期并指定想在报表中展示的科目。

2. 现在来看活期科目的交易汇总表。

从报表 → 交易汇总表打开交易汇总表。

图 2.45. 三月份期间活期科目的交易汇总表

此图展示了三月份期间活期科目的交易汇总表。

3. 现在更改交易汇总表，令其仅展示各个费用科目。

图 2.46. 三月份期间费用科目的交易汇总表

此图展示了三月份期间费用科目的交易汇总表。

第 3 章 Importing Data into GnuCash

This chapter will detail procedures for importing data into GnuCash.

Importing Transactions from Files

Outdated

This is an older version of “Common Transaction Operations” in the manual. Better continue there until this update anomaly is resolved.

Imported transactions will generally be to a specific account in your account tree. In the following this will be referred to as the import or base account. It may or may not be specified in the data being imported, depending on the import format. It is usually the first split of a transaction being imported.

All transactions will also must have a destination account for at least matching splits. This may or may not be supplied in the imported data. If it is not, an account can be assigned on the basis of the previous import history by matching to infomation in the imported data. The user may always over-ride this assignment.

Multi-split data previously exported from GnuCash may have both the import and destination accounts for transaction splits specified in the data file.

File Import Formats

Gnucash allows transactions to be imported in the following formats:

- QIF (.qif) Quicken Interchange format - import data from Quicken financial software;

- OFX/QFX (.ofx,.qfx) Open Financial eXchange format (QXF is an Intuit/Quicken proprietary version of OFX);

- CSV (.csv) Comma Separated Values;

- MT940 MT940

- MT942 MT942

- DTAUS DTAUS

These import methods can be accessed from File → Import ... .

Import Matcher

Several of the Import Assistants use an Import Matcher to implement a Bayesian approach to assign destination accounts, if such accounts are not specified in the imported data, to each imported transaction based on the previous import history of the import account. It also attempts to match the transactions being imported to any existing transactions based on the date and the description fields .

Transaction rows which match existing transactions already in the import account are flagged not to be imported. They will have a light green background and the A and U+R checkboxes will be unchecked and the R checkbox will be checked. To override and import the transaction, check the A checkbox. The U and R boxes will be unchecked automatically. The reliability of the match is indicated by a bar display in the Info column. If a destination account for the second split is assigned by the matcher if will be appended to the info column.

Transaction rows which do not match existing transactions in the import account, for which an assignment of a destination account cannot be made on the basis of the previous import history to the account, will be displayed with an orange-yellow background and the A box will be checked and U+R and R unchecked. A destination account must be specified for these transactions.

Assign a Destination Account to a Single Transaction

The currently selected row is selected by Left-clicking it. It is displayed with a mid dark green background.

Double click on a row. This will select it and open an Account Selection dialog. Select the desired destination account in the dialog and click OK. The row background will change to a light green and the assigned destination account will be displayed in the Info column.

or alternatively, Left-click on a row to select it followed by a Right-click to bring up a popup menu then select "Assign a transfer account" to display the Account Selection dialog, select the destination account and click the OK button.

Assign a Destination Account to Multiple Transactions

Sometimes you will have several transactions which will have the same destination account. Gnucash allows you to select multiple transactions and apply the same destination account to all transactions in the selection.

Rows in a selection are displayed with a mid dark green background.

Multiple rows may be selected to have the same destination account assigned to them.

To select rows either:

- Left click on first row and then Ctrl-Left click on other rows to add to the selection or

- Left-click on a first row and then Shift-Left-click on another row to select all rows between them.

then Right-click to display a popup menu and then select "Assign a transfer account" to open the Account Selection dialog. Select the desired destination account and click the OK button in the Account Selection dialog.

Completing the Import

Once you have assigned destination accounts for all the imported transactions using the above methods (all row backgrounds will be a light green colour), check that the assigned destination acounts are correct and then press the OK button at the bottom of the Generic Import Matcher window. The transactions selected for import will have their splits added to the selected source and destination accounts.

The choices made for the destination accounts and description/memo fields are remembered and stored and used for future imports to the same account to automatically assign a destination account for transaction records not containing destination account information.

Import QIF

To import data from Quicken®, MS Money, or other programs that use QIF(Quicken® Interchange Format), you must first export your data to a QIF file. One way to do this is to export each account as a separate QIF file. An easier way, available in Quicken® 98 and beyond, is to export all accounts at once into a single QIF file. Check your program's manual to determine if this option is available.

To import QIF files:

Load all of the QIF files containing data you wish to import

To do this, select File -> Import -> Import QIF... from the menu. When the QIF Import dialog box appears, click Next and follow the instructions to guide you through the process of loading your files.

This image shows the start of the QIF Import assistant.

You will be prompted for a filename to load. Use the Select button to select your QIF file and click Next to load it. Once the file is loaded, select Load another file if you have more files to load. When you have loaded all your QIF files, click Next to continue with the import process.

Review the GnuCash accounts to be created.

The importer then matches up your QIF accounts and categories with GnuCash accounts and gives you a brief description of the matching process. Clicking Next will bring you to a view comparing your QIF accounts with the corresponding GnuCash accounts created. To change an account name, select the row containing that account name and edit the name in the dialog box provided. Click Next when you have finished making changes, and proceed through a similar category matching process. QIF income and expense categories import as GnuCash income and expense accounts Make changes to these account names if necessary, and click Next to continue.

Note: If you are not sure what changes are needed, it is safe to accept the GnuCash account names. It is easy to edit the accounts later if you find you need to make a change.

From the drop-down list, select a standard currency to be used for the imported accounts and click Next to continue. If you have stocks, mutual funds, or other securities, you will be prompted for additional information. The importer dialog will ask for the exchange or listing (i.e. Nasdaq), the security's full name, and the ticker symbol. If you do not have this information handy, you can edit the account information later, once the import is complete. Click Next to continue.

Tell GnuCash to import the data.

The last step is the import. Once you have verified your account names and investment information, click Finish in the Update your GnuCash accounts page to complete the import process. Depending upon the size of your file, the import might take a few minutes to complete, so a progress bar displays the percentage finished. When the import process is complete, GnuCash will return you to the main window, which should now display the names of the accounts you imported.

Import OFX/QFX

This opens a file selection dialog. Navigate to the file you wish to import, select a file with the appropriate extension (.ofx or .qfx), then press the Import button.

Gnucash opens an Account Selection dialog to select an account in your CoA corresponding to data source. Select the appropriate account from the account tree and press the OK button. On subsequent import of files from the same source (identified by tags in the file), the source is remembered and the account selection dialog is not displayed.

The generic import transaction matcher dialog is opened next. See the Import Matcher section (common to both OFX/QFX and CSV import formats) following the Import CSV section to continue the import process.

Import CSV

Clicking on Import CSV in the Import menu will bring up the Import Assistant dialog. The first step brings up a file selection dialog. Navigate to the location where the file you wish to import is located and select the file to import then click the OK button.

The next window will allow you to set parameters for the importing of the file. All widgets have tooltips which explain what the setting affects and the options for the setting.

Load and Save Settings

If this import is a regular occurrence, once you have set the other import paramters, you can save these settings by typing in a setting name in the Load and Save Settings Entry combo box and pressing the Save button just to the right of the box. Previously defined settings can be retrieved by selecting the appropriate setting name from the dropdown list activated by the down arrow at the right end of the text box. The trash can button to the right of the Save button can be used to remove the settings selected from the drop down list for the box. The settings group "GnuCash Export Settings" define a setting group for the export and reimport of GnuCash transaction data - use this if importing data previously exported from GnuCash.

Account

This combo box allows you to select the base or import account into which the transactions will be imported. It may be left unset if the imported data contains a column listing the accounts associated with each split or the import data specifies the account for first split of the transaction.

File Format

This section allows you to define whether the file has:

- Fixed width columns Selecting this radio button will allow you to define column boundaries by double clicking at the appropriate positions in the sample records displayed in the panel below. Single clicking in a column will narrow, widen or merge the column.

- Separators Selecting this radio button will allow you to define characters which will be used to distinguish columns in the input file. The default is comma separated however spaces, tabs,colons or semicolons or any combination of them may be used to separate columns in the input file by selecting the appropriate check boxes. You may also define custom separators by typing the required characters into the text box and selecting the Custom checkbox. This may be used in combination with any of the predefined separators.

- Multi-split Selecting this check box allows the splits for a single transaction to be defined on consecutive lines within the file with each line defining a single split. If not selected each line is assumed to contain the information for a single transaction including one or two splits.

Miscellaneous

The miscellaneous settings allow you to set:

- EncodingThis is usually the UTF-8 variant for your locale;

- Date Format This does not default to the Locale setting so check it matches the data you are importing;

- Currency Format;

- Leading Lines to Skip Can be set to skip a number of non-transaction lines preceding the actual data. This can include a field name header or an introduction section in the import file;

- Trailing Lines to Skip Can be set to skip a number of non-transaction lines following the actual data. This can include a summary section;

- Skip alternate lines When set only every other line will be imported, starting from the first line not skipped with the "Leading Lines to Skip" option;

to match the settings for the file you are importing. Tooltips may also contain information on the setting and options.

Import Panel

The import panel shows the data being imported as it is interpreted using the settings chosen to define columns and formats. The dropdown lists in the headers for each column of the import allow you to associate a specific column in the imported data with a specific field in the display of a transaction in an account register. At a minimum to import data, columns in the imported data containing the following information must be specified:

- Date of transaction;

- Account into which transaction is to be imported (or alternatively set the base account as above);

- Description of the transaction;

- Deposit or Withdrawal column.

The Skip Errors check box will skip trying to import any rows with errors in matching the columns.

When you are happy with all the import settings, save them if you will use the same settings again, then press the Next button. This will bring up a window which allows you to map the accounts identified in the account column (Account Id) with accounts in the GnuCash account tree (Account name). Double click on a row to bring up a dialog to select the matching GnuCash account. When you have selected a match for all accounts, click on the Next button.

The Transaction Information panel allows review of data entry settings so far.

Clicking on Match Transactions will then bring up the main Import Matcher window described in the next section.

Import MT940

Use this option to import MT940 data.

Import MT942

Use this option to import MT942 data.

Import DTAUS

Use this option to import DTAUS data.

第 4 章 Configuring GnuCash

This chapter will detail preference settings for GnuCash.

Overview

Configuring is fun.

Main Configuration Screens

GnuCash stores settings in two main locations.

Preferences: Accounting Period Tab

Stuff about the Accounting Period tab

Preferences: Accounts Tab

Stuff about the Accounts tab. Need this stub for the link in The Basics. More later.

Preferences: Online Banking

Stuff about the Accounts tab. Need this stub for the link in The Basics. More later.

部分 II. 常规使用

第 5 章 活期账户与现金

这一章会给出使用GnuCash管理活期账户的具体信息。管理活期账簿是跟踪个人财务状况的第一步。使用GnuCash管理起来比传统的纸制账簿更加方便。

在正式开始之前，先来回想一下“交易”一节介绍的内容。借助GnuCash的自动补全功能，常见交易的数据录入工作实际很简单。GnuCash实时更新每个科目的余额，因此科目对账也相当方便。复式记账法要求为每项交易指定转出科目，有助于你理清各项开销，也方便查明在各个方面都花了多少钱。

在熟练使用GnuCash管理活期账户和其它银行账户之后，你可能想要再跟踪其它金融账户。第6章至第9章详细讨论了管理其它账户的方法。

创建科目

管理活期账户的第一步就是创建必要的科目。你既可以使用默认的GnuCash科目，也可以自行创建。有关创建新科目的具体步骤，请参考“基本顶级科目”一节。有关由其它软件导入科目结构的方法，请参考GnuCash帮助手册。

现在先来创建接下来要用到的的银行账户科目。你需要为每个想要跟踪的实际银行账户创建一个GnuCash银行类型科目。不论是自行创建科目还是使用GnuCash的默认科目，确保每个银行科目都拥有一项期初余额交易。最简单的方法就是直接使用最近一张银行账单的余额作为期初余额。你可以在新建科目层次结构向导的科目信息窗口中输入期初余额，也可以直接在科目中手动录入交易。手动录入的交易应设为从期初余额科目（科目类型为所有者权益）向银行科目的转账。

你要跟踪的银行科目一般有：

- 活期存款 - 任何提供支付能力的机构账户。

- 储蓄存款 - 付息的机构账户，通常用于期限比活期账户更长的存款。

影响这些银行科目的常见交易有付款和存款。付款指将钱从银行科目中转出，通常转至费用科目。存款指将钱转入银行科目，通常转自收入科目。你需要创建收入和费用科目跟踪钱从哪里来，又到了哪里去。请记得，平衡的交易中来源科目与目的科目的转账总额相等。所以，你如果向活期科目存款，也必须输入款项来自于哪个科目。你如果使用活期科目支付账单，也必须输入款项转去了哪个科目。

录入存款

存款交易大多录入为由收入科目向银行科目的转账。收入来源各式各样，最好为不同的收入来源创建各自的收入类型科目。例如，你的收入可能主要来自于工资，但你可能也会收到储蓄存款的利息。在这种情况下，你应该为工资建立一个收入科目，并为收到的利息建立另一个收入科目。

提示

记得检查纳税信息，并在建立应税收入科目时在收入纳税信息对话框（ 编辑 → 报税选项 ）中指定适合的纳税类型。一些收入类型，如礼品收入，可能不视为应税的，所以请查阅适合的税务法规确定某项收入是否应税。跟踪资本利得的方法请参考第 11 章 资本利得。

在着手录入工资存款时，请想清楚你想要记录得有多细。最基本的是录入你的净工资，就像你会在纸制账簿上记录的那样。这是最简单的记录方式，不过你如果录入包含扣除额的毛工资，则可以使用GnuCash分析出更多信息。录入扣除额是要花点工夫，但你在录入整年的预扣税信息后，可以随时在GnuCash中生成实用的税务状况报表。。这些报表能够帮助你确定你是否足额纳税，也可以帮助你预估税单。如果你不确定记录的细致程度，则可以先从录入净工资开始。你如果想要更详细的信息，总是可以回头编辑这些交易。

录入取款

不论你出于什么原因要从银行账户中取款时，你就在将钱从银行科目转至其它地方。在GnuCash中，这里所说的“其它地方”也是对应一个科目。你用于记录花销的科目建立得越细致，你就能将钱款的去向分析得越详尽。

取款有多种形式。ATM机取款是最常见的交易形式之一。填写支票是一种取款用以支付账单、采购商品或捐款的形式。根据银行账户的不同，你可能还要支付服务费，银行会从账户中扣除这笔钱。将款项转出至其它账户也是一种取款。下面将逐一介绍这几种取款的形式，并说明在GnuCash中如何记录各式取款。

使用ATM机取出现金

现金取款处理为从银行科目到现金科目的转账。GnuCash特地提供现金类型科目用于跟踪现金交易，所以你应当建立现金科目记录ATM机和其它现金取款。

在现金科目中，可以按不同的细致程度录入交易。最基本的细致程度是只是简单地录入从活期科目向现金科目的转账。这样做，你可以得知某天你从活期账户中取出了多少钱，但你无从得知这些现金花到哪里去了。再费点心思，你可以使用现金科目记录现金支出，这样一来，你就可以看到现金花到哪里去了。你应将这些支出录入为从现金科目到费用科目的转账。

一些人会记下每一笔现金支出，但这样会花很多精力。一种更简单的方式是只记录手头有相应收据的支出，之后再调整科目余额，使之与钱包现金总额相符。

最好至少为取款建立现金科目。你如果以后决定跟踪现金的去处，就可以为花出去的钱录入交易。你可以自由决定想要的记录细致程度。

科目对账

借助GnuCash，根据银行月账单为银行科目对账变得轻松许多。“对账”一节给出了根据银行月账单进行交易对账的步骤。这是每个月都要做的主要对账任务。

不过该怎么处理其它你创建的科目呢？这些科目也应当对账吗？如果你得到了某一科目对应的账单，那你就该考虑为这个科目对账了。常见的例子有，活期账户账单、储蓄账户账单和信用卡账单。信用卡账单和信用卡交易会在第 7 章 信用卡介绍，所以如果你想在GnuCash中跟踪信用卡，不妨看看那一章给出的操作指导。

收入和费用科目通常不对账，因为没有账单可用作对账依据。出于同样的原因，你也不必为现金科目对账。不过，你可能要不时调整现金科目的余额，以使你手头实际的现金总额与现金科目的余额相符。下面一节会介绍调整余额的方法。

步步为营

在“交易”一节，你已经向活期科目录入了一些交易。在本章中，我们会添加更多的交易，并为其对账。

期初余额

现在，先打开在上一章保存的GnuCash数据文件（gcashdata_4）。科目表应该如下图所示：

图 5.1. 科目表

此图展示了科目表。

添加交易

1. 现在从主窗口打开活期科目。在上一章中，你录入了工资存入活期银行账户的交易。现在录入另一种类型的存款交易——由储蓄账户到活期账户的转账。在空白行中，录入一项由储蓄存款转账500元到活期存款的交易。（在这里，最后一项交易的日期是3月28日，但这项转账交易发生在3月24日。）交易的转账科目应设为储蓄存款，因为你是在活期存款科目中。现在活期存款科目应当如下所示：

图 5.2. 活期科目账簿

此图展示了活期科目账簿。

2. 现在来在科目中记录一些支付活动。首先，向家门口杂货店总计支付75元（3月5日）。转账科目为食品杂货，因为这笔钱都用来买杂货了。接下来，向壹贰叁五金店支付100元（3月6日），并将此金额分录为两项费用：家居用品的50元和工具的50元。你需要为这两项支出各创建一个费用类型科目，然后再为其录入分录。现在活期存款科目应当如下所示：

图 5.3. 在填入更多支付记录后的活期科目账簿

此图展示了填入更多支付记录后的活期科目账簿。

3. 假设你现在需要取些钱出来。你现在还没有在科目表中创建现金科目，所以你需要创建一个。在资产顶级科目下创建一个子科目，名为现金，类型为资产。然后，在活期科目账簿中，录入一项ATM机取款交易，记为3月25日由活期到现金转账100元。

图 5.4. 录入了ATM机取款的活期科目账簿

此图展示了录入ATM机取款交易后的活期科目账簿。

期初余额

现在已经准备好为活期科目对账了，依据的是下面这份示例银行账单：

图 5.5. 一份示例银行账单

此图展示了一份示例银行账单。

1. 从菜单中选择 功能 → 对账 ，期末余额填写1451.79元。点击 确认开始为此科目对账。勾选出现在银行账单中的条目。在所有条目均勾选后，对账窗口将如下图所示：

图 5.6. 对账窗口

此图展示了对账窗口，其中有5元的差额。

注意到对账余额与期末余额相差5元。查看银行账单，会发现还有一项5元的服务费没有添加到活期科目中。

2. 所以，点击活期账簿，向活期科目添加5元的服务费。在活期账簿的空白行中，录入一项从活期转账5元到服务费科目的交易。（你需要创建类型为费用的服务费科目。）日期填写为此交易在银行账单上对应的日期。现在活期存款科目应当如下所示：

图 5.7. 补充服务费后的活期科目

此图展示了补充服务费后的活期科目。

3. 回到对账窗口，你应该会看到服务费现已在转出下列出。点击此项标记为已对账，可见下方的差额现在变成了0.00。点击工具栏上的完成按钮完成对账。在活期科目账簿中表示对账状态的R列下，刚才对账过的每笔交易现在都应该显示为y。同时，底部状态栏现在会显示已对账：CNY 1451.79。

图 5.8. 已对账的活期科目

此图展示了对账后的活期科目账簿。

保存文件

回到主窗口，使用新文件名gcashdata_5保存你的文件。你的科目表规模在逐步扩大，现在如下图所示：

图 5.9. 科目表

此图展示了科目表。

报表

就像在前文章节做的那样，现在来看看现金流量表和交易汇总表这两份报表。

1. 首先查看3月的现金流量表。

选择 报表 → 收入与费用 → 现金流量表 。

图 5.10. 3月的现金流量表

此图展示了按第 5 章 活期账户与现金所述操作后的现金流量表。

2. 接下来查看各个资产科目对应的交易汇总表。

选择 报表 → 交易汇总表 。

图 5.11. 3月份期间资产科目的交易汇总表

此图展示了3月份期间资产科目的交易汇总表。

3. 现在，将交易汇总表修改为只展示各个费用科目的情况。

图 5.12. Transaction Report For The Expenses During March

此图展示了3月份期间各费用科目的交易汇总表。

你可能已经注意到，目前还有一个在科目表中列出的科目没有使用，那就是信用卡科目。到这里，你知道了怎样在GnuCash中跟踪你的银行科目和现金科目。现在，你可能也想要开始跟踪信用卡的使用情况。GnuCash为信用卡提供了一种特殊的科目类型，相关内容会在后面的章节详细讨论。

第 6 章 费用

如果说管理活期账户是跟踪财务状况的第一步，那借助费用科目了解钱款去处就是紧随其后的第二步。这一章会帮助你理解在GnuCash中怎样借助费用科目跟踪各类交易。

概念

费用类型科目可帮助你跟踪在某项支出上花了多少钱。许多人第一次跟踪花销是在Quicken(tm)上，其中交易可以被指定到一个或多个分类。在GnuCash中，这些分类对应于各个相互独立的费用类型科目。这样的组织形式可以让GnuCash将复式记账规则同样用于管理费用。根据需要，费用科目的设立可详可略。一些用户只需几个科目就足以跟踪个人财务。还有一些用户借助GnuCash的费用科目事无巨细地管理他们的花销情况。你可以自由决定记录的细致程度。请记住，在GnuCash中，你可以更改交易所属的科目，因此如果你以后有不同的需求，将交易在不同科目间移动也是可以的。

创建科目

简单的费用科目结构

对于许多用户而言，创建费用科目最轻松的方法还是在新建科目层次结构中勾选常用科目。这样会创建多数用户最常用的费用科目。了解更多信息，请查看GnuCash帮助手册第3章中的“新建科目层次结构”一节。

复杂的费用科目结构

你如果有不同的费用记账需求，可参考“交易”一节或GnuCash帮助手册第5.4章，了解如何创建科目。

新建费用科目的理由一般有：要跟踪特定商业用途费用（如具体类型的物料支出），要跟踪特定税务用途费用（如必须向他人报告的税务费用）或者只是要跟踪在你看来有意义的支出（如向特定慈善组织支付的善款）。

录入费用交易

虽然可以直接将交易录入费用科目，但大家一般不这样做。对于大多数人，将一项交易录入其涉及的其它科目，这项交易也就添加到费用科目下了。换言之，你如果有一个用于记录慈善捐款的科目（如费用:慈善），则一般会在活期科目账簿中添加一项同慈善科目的交易，那也就将这项交易添加到了费用科目。

打开某个费用科目，你会看到与其它GnuCash科目相似的账簿。不过，使用非正式术语时，交易金额的列头稍有不同。左（借）列显示为支出总计，而右（贷）列显示为退款总计。

有关费用科目的其它注意事项

由于费用科目是完全根据你的需要建立的，所以没有账单用来对账。因此从技术上讲，费用科目没有对账的概念。当然，你也可以在费用科目上使用对账功能，这样会锁定交易阻止后续编辑。

还要考虑的一点是，通常这些科目中很少有减少其余额的贷记交易，因此，随着你持续使用GnuCash，科目余额会持续增长。这样当然没什么问题，但是一些用户可能希望定期将余额归零。可以录入归零交易，将余额转至所有者权益科目。GnuCash提供账簿结转功能，可以将费用科目归零。请注意，不是必须要这么做，如果你需要获得某一费用科目的信息，你可以使用各种报表提取相关数据，而不必将科目归零。

第 7 章 信用卡

本章将介绍怎样使用GnuCash管理信用卡。

概念

可能你每个月通过支票或网上支付向信用卡公司偿还账单，所以你可能以为你的信用卡账单是一种费用，但它实际上并不属于费用。为什么？信用卡其实是一种短期贷款，你用这个贷款账户购物消费，而且最后要偿还这些钱，常常还要支付利息（你的金融服务费）。你使用信用卡产生的购买才属于费用。

你有两种方法记录信用卡交易，选择符合你所需细致程度的那一种方法。最简单的方法是只记录每个月向信用卡公司的还款。你每个月录入一项由银行科目向信用卡费用科目的转账。这样会显示你每个月向信用卡公司的还款，但不会显示任何有关信用卡欠款或信用卡购买记录的信息。

还有一种更复杂的记录信用卡交易的方法，那就是将每次购买或付款记为独立的交易。你需要在信用卡账簿中录入一整个月的单据。在收到信用卡账单时，你能够根据账单为信用卡科目对账。这种方法会向你展现整个月期间的欠款信息，并在对账时指出不一致之处，但是需要你录入更多数据条目。

创建科目

要开始在GnuCash中管理信用卡，你应当建立一个负债顶级科目，并在此父科目之下为你使用的每张信用卡创建信用卡类型的科目。如果你只是跟踪向信用卡公司的还款记录，那么你只需要银行科目和信用卡科目就足够用来录入交易了。

信用卡产生的服务费属于费用，所以你需要在名为费用的顶级科目下建立这些科目。你如果决定更详细地记录消费情况，还需要为你产生的每种消费创建相应的费用科目。你由于以后也要根据信用卡账单检查科目余额并为科目对账，则也应该在每个信用卡科目中录入期初余额。录入期初余额最简单的方法是直接将上一份信用卡账单给出的欠款额作为期初余额。

简易科目设置

你如果不想跟踪信用卡的每笔支出，可以建立如下所示的简单科目层次结构：

-资产

-银行

-负债

-信用卡

-费用

-信用卡

在这个例子中，你要将每个月信用卡的还款总额录入为负债:信用卡与费用:信用卡间的交易。当还信用卡的时候，你要录入一项资产:银行和负债:信用卡间的交易。

简易信用卡记账方法一个显而易见的缺点就是你看不到钱花到哪里去了。所有信用卡消费都合并到了信用卡费用科目下。不过，这样做起来十分简单且易于维护。

完整科目设置

你如果想要更完整地跟踪花销情况，则应建立多个费用科目，分别命名为你产生的各种花销类型。信用卡的每笔付款应独立地录入为信用卡负债科目与具体费用科目间的交易。下面是相应的科目层次结构示例：

-资产

-银行

-负债

-信用卡

-费用

-食品

-汽车

-服装

-娱乐

-利息

-服务费

需要明确的是，设置的具体费用科目应当符合你的消费习惯。这种科目设置与简易科目设置相比，唯一的不同是费用细分为了几组。也要注意到其中包含一个“利息”费用科目，它是在信用卡为每月的未还款额收取利息时使用的。“服务费”费用科目用于记录信用卡收取的服务费，如可能会收取的年费。借助这样的科目设置，你将能够按照费用科目的分组看到每个月你的钱花到哪里去了。

本章其余部分将假定你在使用完整科目设置。

记录付款

记录信用卡的每笔付款能够为你给出更完整的消费习惯画像。信用卡付款记录为信用卡负债科目与适当的费用科目间的交易。

当你使用信用卡为商品或服务付款时，你就是在告诉信用卡公司替你向对方付费。这项交易会增加你在信用卡公司的欠款，即信用卡科目余额增加。这些交易的另一端大多是费用科目。例如，如果你使用信用卡在商店花50元买了一件衣服，则相当于将钱由信用卡科目转账到费用:服装。

将这些交易录入GnuCash有助于你随时掌握欠信用卡公司多少钱，也会提供全体科目更完整的画像。这样做还可以帮助你随时了解账户状态，确保避免诈骗。

向信用卡科目添加交易很像在其它科目中添加交易。你可以手动录入交易，或通过兼容的格式从信用卡公司导入交易。 import format.

有关如何录入交易，请查看GnuCash帮助手册第6章和“交易”一节。

记录还款

偿还信用卡账单大多录入为由银行科目（资产）到信用卡科目（负债）的转账。你在偿还月账单时，就是从银行科目取款以冲抵信用卡欠款。此交易同时减少银行科目余额和信用卡负债额。

当你退货时，你的信用卡会收到退款。这是另一种形式的还款，它会减少你的信用卡欠款。你如果将原先的购买交易录入为由信用卡科目到费用科目的转账，现在则简单地将那项交易反转过来：将钱从费用科目转回信用卡科目。此交易同时减少费用科目余额和信用卡科目余额。例如，如果你原先录入了一笔使用信用卡付款的服装购买，交易是从信用卡科目到服装费用科目的转账。你如果之后退掉衣服，收到退款，则简单地将钱从服装费用科目转回信用卡科目。

注意

一个常见的错误是将退款录入为收入。退款不是收入，而是一种“负费用”。这就是为什么必须在收到退款时将钱从费用科目转回信用卡科目。

为了说清楚这个规则，来看看一个例子。你使用VISA卡花74.99元买了一些牛仔裤，但之后某天你发现它们太大，想退回去。店家爽快地同意了，并将钱款退到了你的信用卡里。

1. 先打开之前保存的数据文件（gcashdata_5），将之另存为gcashdata_6。

2. 打开负债:Visa科目账簿，录入一项简单的双科目转账交易，表示买牛仔裤花了74.99元。转账科目应为费用:服装，使用Visa付款74.99元。

注意

由于之前没有创建费用:服装科目，GnuCash会提示我们创建科目。要记得将其创建为费用科目。

3. 按下列方法之一录入退款交易：

- 录入与当初购买时相同的交易，但在信用卡科目账簿的还款处，而非付款处输入金额。

- 选择想要退款的购买交易（这个例子中也就是购买牛仔裤的交易），并选择 交易 → 对冲交易 。按需修改日期。

在对冲交易后，你的信用卡科目应该如下所示：

图 7.1. 对冲购买交易后的信用卡科目

此图展示了对冲购买交易后的负债:信用卡科目账簿。

同时费用:服装科目账簿应该如下所示：

图 7.2. 对冲购买交易后的费用科目

此图展示了对冲购买交易后的费用:服装科目账簿。

4. 保存GnuCash数据文件。

步步为营

现在我们已经介绍了在跟踪信用卡账目所需创建的交易背后的基本思想。现在来研究一个例子。在这个例子中，我们将使用信用卡买东西，退还两样购买的商品，支付由未还款额产生的利息，为信用卡科目对账，最后偿还部分信用卡欠款。

打开GnuCash文件

首先打开先前保存的数据文件gcashdata_5，并将其直接保存为gcashdata_6主窗口应该如下所示：

图 7.3. 跟踪信用卡账目前的初始科目结构

在这个步步为营例子中跟踪信用卡账目前的初始科目结构。

购买

现在使用Visa卡买一些东西。先在苍蝇茶馆买了25元的食品，在不着调时装店购买100元的衣服，向加价不加量加油站支付25元的汽油钱，在不靠谱杂货店购买125元的食品杂货和家居用品（分录为85元的杂货和40元的家居），最后又在廉价市场买了60元的家居用品。

我们也会重复前面几章的操作，即在4月3日花74.99元购买一条牛仔裤，并在两天后退货。

信用卡负债账簿窗口应该如下所示：

图 7.4. 初始的信用卡购买

初始的信用卡购买。

退款

现在假定在4月15日，你退还了4月11日从不着调时装店购买的衣服，他们将退款退回了你的信用卡。录入一项总额100元的信用卡退款交易。别忘了所用的转账科目与原先购买时所用科目相同，并在还款列下输入金额。GnuCash会自动补全名称和转账科目，但仍会将100元自动填入付款列中。你需要重新在还款列中输入金额。交易显示如下：

图 7.5. 信用卡退款交易

将衣服退还给不靠谱时装店，退款退回信用卡。

收取利息

在几个月的消费后，你收到了寄来的信用卡账单或在网上看到了账单。很不幸，由于你上个月的部分欠款拖到了现在，你在4月的最后一天被收取了20元的利息。这笔利息要作为费用录入到信用卡科目。

图 7.6. 信用卡收取的利息

信用卡收取利息。

对账

在收到信用卡账单后，你应该根据账单为信用卡科目对账。使用GnuCash内置的对账功能就可以。选中信用卡科目并点击 功能 → 对账… 。对账的具体操作步骤在“对账”一节中有详细的描述，但在这里我们会再回顾一遍相关步骤。例如，假定信用卡账单截止到5月1日，最后的欠额是455元。将日期和金额输入到初始对账窗口中，如下图所示。

图 7.7. 信用卡初始对账窗口

在对账过程中，你需要勾选每一项确认同时出现在GnuCash科目和信用卡账单中的交易。在这个例子中，GnuCash科目与信用卡账单间存在300元的差额，如下图所示。

图 7.8. 存在差额的对账主窗口

提示300元差额的科目对账主窗口。

经过一番调查，你发现你忘了记录3月5日向信用卡公司300元的还款，你要录入这项由银行科目到信用卡科目的还款交易。现在信用卡账单和GnuCash科目账目相符，余额为455元。

还款

完成了信用卡科目的对账工作后，你需要向信用卡公司还款。在这个例子中，你欠了455元，但这个月还是只偿还部分欠款，共300元。相应地，录入一项300元的由银行科目到信用卡科目的交易，这样，信用卡科目余额应减少到155元。你的信用卡科目账簿现在应该如下所示：

图 7.9. 对账和还款后的信用卡科目

对账和还款后的科目账簿。

回到主窗口保存文件（gcashdata_6）。科目表在稳步扩充，现在应当如下所示：

图 7.10. 对账和还款后的科目表

保存文件

最后，保存GnuCash数据文件（gcashdata_6）。

报表

和前几章一样，我们来看看现金流量表和交易汇总表这两份报表。

1. 首先来看3月期间负债科目Visa的现金流量表。

选择 报表 → 收入与费用 → 现金流量表 打开现金流量表。

图 7.11. 3月份的现金流量表

此图展示了第 7 章 信用卡后得到的现金流量表。

2. 现在来看Visa科目相应的交易汇总表。

选择 报表 → 交易汇总表打开交易汇总表。

图 7.12. 3、4月间Visa科目的交易汇总表

此图展示了3、4月间Visa科目的交易汇总表。

3. 现在更改交易汇总表，使之只展示各费用科目的交易汇总。

图 7.13. 4月期间费用科目的交易汇总表

此图展示了4月期间各个费用科目的交易汇总表。

第 8 章 贷款

本章将介绍怎样使用GnuCash管理你的贷款。

基本概念

贷款定义为某人为借用其它人的钱而支付一定费用的金融交易。生活中常见的贷款形式有很多，如信用卡、汽车贷款、房屋贷款或商业贷款。

术语

在具体讨论如何使用GnuCash跟踪贷款之前，先列出相关术语是很有帮助的。下面列出的一些术语对应贷款领域中的基本概念。建议尽量熟悉这些术语，起码在后文遇不熟悉的词汇时记得回头查阅这份列表。

分期

确保最终偿清贷款的还款计划，一般设计为使每月的还款金额相等。还款金额通常划分为本金和利息两部分，随分期还款的推进，其中偿还本金的金额增加，支付利息的金额减少。

借款人

经贷款得到钱的个人或企业。

违约

借款人无法根据同贷款人达成的协议偿还贷款的时刻。

延期

临时推迟偿还贷款。

逾期

未能如期还款。

放款

支付给借款人的贷款金额。一些贷款包含多次放款，意味着借款人不会一次性收到贷款的全部金额。

利息

借款人因使用贷款资金而向贷款人缴纳的费用。一般以借入本金的年百分比表示，也就是常说的年利率。

贷款人

将钱借出给借款人的企业或个人。

贷款手续费

借款人收到贷款时从本金中扣除的贷款处理手续费。

本金

贷款的初始金额，或贷款中目前仍未偿还的金额。按月偿还贷款时，一部分还款金额用于偿还利息，一部分还款金额用于偿还本金。

借据

借款人与贷款人就贷款事宜达成的法律协议。

创建科目

借款人在获得贷款时，往往有意要购买一些值钱的东西。事实上，多数贷款往往要求借款人购买事先约定的资产，如房屋。这项资产也是对借款人贷款违约的保障。当然，也有一些贷款不一定关联到高价值资产，如教育贷款。

此处给出的科目结构假定贷款用于购买将被用作抵押物的资产。

贷款是一种负债，逐渐增长的贷款利息是一项持续存在的花费，可能要支付的管理费是另一项费用。使用贷来的钱购买的东西是资产。现在根据上述界定，可以给出基本的贷款科目结构如下：

基本贷款科目结构

-资产

-流动资产

-储蓄存款

-固定资产

-购入的资产

-负债

-贷款

-房屋按揭贷款

-费用

-利息

-房屋按揭贷款利息

-房屋按揭贷款管理费

GnuCash内置多种预定义的贷款科目层次结构，包括汽车贷款和住宅按揭贷款。要使用这些预定义的科目结构，点击 功能 → 新建科目层次结构...并选择你想使用的贷款类型。

计算器

确定分期贷款还款计划、每期还款金额、总还款额或利率可能并不容易。GnuCash内置的贷款还款计算器可以帮助你方便地进行这些计算。通过 工具 → 贷款还款计算器打开。

图 8.1. 贷款还款计算器

GnuCash贷款还款计算器。

贷款还款计算器能够计算的数值有还款期数、利率、现值, 每期还款金额和终值，只要给出其它四项数值就可以计算任一数值。另外还要指定复利方案和还款方案。

还款期数

要支付多少次还款。

利率

贷款的名义利率(NAR)，也就是常说的年利率。

现值

贷款当前的价值，也就是当前欠款金额。

每期还款额

每期要偿还的金额。

终值

贷款将来的价值，也就是全部还款期结束后剩余的欠款金额。

复利

有两种复利计算方法，离散复利和连续复利。选择离散复利时，要从下拉框中指定从每年到每天不等的复利频率。

还款

在下拉框中选择从每年到每天不等的还款频率。也可以选择是在期初还是期末时还款。如果选择期初还款，还款额会同当前欠款金额一起计算利息。

示例：每月还款

一份总计100,000元、时长30年、固定利率4%、复利计息的贷款，其月还款额是多少呢？

这一分期方案如下图所示。要执行计算，将还款期数设为360（12个月×30年），利率为4，现值为100000，每期还款金额留空，终值设为0（你不想在还款结束后仍欠款）。复利是每月，还款是每月，另假设期末还款、离散复利。现在点击计算按钮，可见结果为-477.42。

答案：每月需还款477.42元。

示例：贷款总期数

一份20,000元、10%固定利率、按月复利的贷款，每月还款500元，要多久才能偿清？

要执行计算，还款期数留空，设置利率为10、现值为20000、每期还款金额为-500、终值为0（你不想在还款结束后仍欠款）。复利为每月、还款为每月，假设期末还款、离散复利。现在点击计算按钮，可见还款期数处显示49。

答案：用4年零1个月内偿清贷款（49个月）。

进阶：计算详细过程

在讨论贷款还款计算器所使用的数学公式之前，先定义一些变量。

n   == 还款期数

%i  == 收取的名义利率

PV  == 现值

PMT == 每期还款金额

FV  == 终值

CF  == 每年计息频率

PF  == 每年还款频率

每年计息频率(CF)和每年还款频率(PF)一般为：

1  == 每年

2  == 每半年

3  == 每三分之一年

4  == 每季度

6  == 每两个月

12  == 每月

24  == 每半月

26  == 每两周

52  == 每周

360  == 每天

365  == 每天

名义利率与有效利率间的转换

要求解 n、PV、PMT或FV，先要将名义利率(i)转换为还款期时长的有效利率(ieff)。这一利率(ieff)随后用于计算需要求解的变量。需要求解i时，计算结果是有效利率(ieff)。因此，需要将i转换为ieff，也要将ieff转换为i。

将i转换为ieff，使用公式：

离散复利：ieff = (1 + i/CF)^(CF/PF) - 1

连续复利：ieff = e^(i/PF) - 1 = exp(i/PF) - 1

将ieff转换为i，使用公式：

离散复利：i = CF*[(1+ieff)^(PF/CF) - 1]

连续复利：i = ln[(1+ieff)^PF]

注意

在下文处理金融业务的公式中，所有利率均指有效利率“ieff”。出于简洁考虑，此符号缩写为“i”.

基本金融公式

一个方程可将所有这五个变量联系起来，这也就是常说的基本金融方程：

PV*(1 + i)^n + PMT*(1 + iX)*[(1+i)^n - 1]/i + FV = 0

其中:  X = 0 表示期末还款, and

X = 1 表示期初还款

由此方程可推导出计算各独立变量的函数表达式。有关方程推导的详细解释，参见GnuCash源代码文件 libgnucash/app-utils/calculation/fin.c 中的注释。首先定义A、B、C三个变量，以使后面给出的公式更易读。

A = (1 + i)^n - 1

B = (1 + iX)/i

C = PMT*B

n = ln[(C - FV)/(C + PV)]/ln((1 + i)

PV = -[FV + A*C]/(A + 1)

PMT = -[FV + PV*(A + 1)]/[A*B]

FV = -[PV + A*(PV + C)]

求解利率分为两种情况。

简单情况为 PMT == 0 时，相应解为：

i = [FV/PV]^(1/n) - 1

PMT != 0的情况相当复杂，这里不会列出。。当在PMT != 0的情况下求解利率时，无法给出准确的可解函数，相关计算需涉及迭代过程。详细说明请参见libgnucash/app-utils/calculation/fin.c源文件。

示例：每月还款

现在重新计算“示例：每月还款”一节，这次我们使用数学公式而非贷款还款计算器。对于一笔为期30年、固定利率4%、复利计息、总计100,000元的贷款，你每个月要还多少钱呢？

首先，定义变量 n = (30*12) = 360, PV = 100000, PMT = 未知, FV = 0, i = 4%=4/100=0.04, CF = PF = 12, X = 0 (所有还款期结束)

第二步，将名义利率(i)转换为有效利率(ieff)。由于利率是按月复利，而且是离散的，使用： ieff = (1 + i/CF)^(CF/PF) - 1 ， 其中 ieff = (1 + 0.04/12)^(12/12) - 1 ，因此 ieff = 1/300 = 0.0033333。

现在我们可以计算A和B了。 A = (1 + i)^n - 1 = (1 + 1/300)^360 - 1 = 2.313498。 B = (1 + iX)/i = (1 + (1/300)*0)/(1/300) = 300。

算出A和B，可以计算 PMT。 PMT = -[FV + PV*(A + 1)]/[A*B] = -[0 + 100000*(2.313498 + 1)] / [2.313498 * 300] = -331349.8 / 694.0494 = -477.415296 = -477.42。

答案：你每月须还款477.42元。

怎样：记录房屋按揭贷款

房屋按揭贷款可以使用“创建科目”一节中给出的科目结构。

举个例子，假定你在储蓄科目中有60,000元存款，你买了150,000元的房屋。按揭贷款收取6%的年利率和3%的管理费（如，过户费）。你决定先拿出50,000元的首付款，因此还需要借103,000元。 As an example, assume you have $60,000 in you Saving account, and you buy a $150,000 house. The mortgage is charging 6% APR, and has administrative fees (closing costs, etc) of 3%. You decide to put $50,000 down, and thus will need to borrow $103,000, which will give you $100 after the closing costs are paid (3% of $100,000).

借钱之前的科目：

图 8.2. 收到贷款前的科目

房屋购买记录为资产:固定资产:房屋科目下的分录交易，其中包含来自银行的50,000元（即你的首付款），以及来自按揭贷款的100,000元。你可以将3,000元的过户费记到同一分录中，我们会将房屋贷款增加到103,000元以将过户费纳入其中。

表 8.1. 购买房屋的分录交易

科目

增加

减少

资产:固定资产:房屋

￥150,000

资产:流动资产:银行

￥50,000

负债:贷款:房屋按揭贷款

￥103,000

费用:房屋按揭贷款管理费

￥3,000

资产:固定资产:房屋中的分录交易如下：

图 8.3. 房屋按揭贷款分录交易

相应的科目表如下所示：

图 8.4. 房屋按揭贷款科目

怎样：记录汽车贷款

汽车贷款，即通常所说的车贷，处理起来多多少少与房屋贷款相通。唯一的区别在于科目的不同和利率的差异。基本的汽车贷款科目结构如下：

-资产

-流动资产

-储蓄存款

-固定资产

-汽车

-负债

-贷款

-汽车贷款

-费用

-利息

-汽车贷款利息

-汽车贷款管理费

更多信息可参阅“怎样：记录房屋按揭贷款”一节。

怎样：记录给朋友的私人借款

你不总是从银行借钱，有时你找家人借钱，或是借钱给朋友。这一部分会介绍一种处理借给朋友的借款的方法。

我们以如下普遍适用的科目结构为基础介绍具体做法：

-资产

-银行

-银行账户

-欠你的钱

-个人

-收入

-利息收入

-个人

这个例子展示怎样跟踪借给朋友张三总计2,000元的个人借款。

借款约定

张三想从你这里借2,000元，并计划在接下来的18个月里每个月偿还一部分。因为他是你的朋友（不过也不太熟），所以你们一致认可5%的年利率。

现在将已知具体信息汇总在下面。张三的借款具体信息：

- 本金金额——￥2,000

- 借款期限——18个月，一年12次还款。

- 年利率——5%

- 每月还款金额——??

所以你要怎样计算每月还款金额呢？

你可以用很多工具进行计算，纸笔、Linux计算器、Apache OpenOffice/LibreOffice的电子表格组件，等等。但还是使用GnuCash的贷款还款计算器最为简单。可算得每月还款金额为￥115.56。

不过，你还得知道每月还款金额中的多少偿还的是利息、多少偿还的是本金，这样你才能将收到的还款恰当地记录到账簿中。为此，你需要更强大的工具，像是Apache OpenOffice/LibreOffice中的电子表格组件，特别是其中的PMT函数。

图 8.5. 计算私人借款的详细信息

有关向张三借款的详细信息。

借款科目

先从下述科目开始，其中各科目的货币相同，均为人民币。

例 8.1. 用于记录给张三借款的科目

- 资产:银行:人民币

- 资产:他人欠款:张三

- 收入:利息收入:张三

- 所有者权益:期初余额:人民币

借出钱款

当你把钱借给朋友的时候，你实际上就是将钱从资产科目（如银行、活期存款或其它类似的科目）转账到另一个资产科目他人欠款。要记录这笔出借的资金，在资产:他人欠款中录入如下交易。

表 8.2. 给张三的个人借款

科目

增加

减少

资产:他人欠款:张三

￥2,000

资产:银行:人民币

￥2,000

图 8.6. 借出钱款后的科目表

收到第一笔还款

收到第一笔还款（￥115.56）后，你需要确定其中多少属于借款本金，多少属于借款利息。

- 本期未偿还借款金额 = ￥2000

- 每月还款 = ￥115.56

- 还款金额分解

- ——利息： 5% ÷ 12 × ￥2,000 = ￥8.33

- ——本金： ￥115.56 - ￥8.33 = ￥107.23

此过程可录入为如下GnuCash交易。

图 8.7. 第一笔还款

第一笔还款的账簿细节。

张三的借款余额现在是 ￥2,000 - ￥107.23 = ￥1,892.77。

收到第二笔还款

收到第二笔还款（￥115.56）后，你同样需要确定其中多少是借款本金，多少是借款利息。

- 本期未偿还借款金额 = ￥1,892.77

- 每月还款 = ￥115.56

- 还款金额分解

- 5% ÷ 12 × ￥1,892.77 = ￥7.89 利息

- ￥115.56 - ￥7.89 = ￥107.67 本金

此过程可记为如下GnuCash交易。

图 8.8. 第二笔还款

第二笔还款的账簿细节。

张三的借款余额现在是 ￥1,892.77 - ￥107.67 = ￥1,785.10。

至此，科目表如下所示：

图 8.9. 第二笔还款后的科目表

显而易见，每个月的利息在变化，每个月的本金也不同。所以，你每收到一笔还款就要计算各交易分录的金额。

每笔还款中的利息金额会越来越少（因为利息一直是根据持续减少的借款本金计算出来的），直到最后一笔还款后本金几乎为零。请回顾 有关向张三借款的详细信息。 详细了解。

怎样：为贷款账单对账

根据贷款账单对账与根据银行账单或信用卡账单对账没有什么不同。

在此期间，你应该已经悉数记录了各种与贷款相关的交易，其中每一项交易都涉及负债:贷款:贷款类型科目。例如，偿还一部分贷款会减少银行科目和贷款科目的余额，同时会增加贷款利息，还可能会增加贷款管理费。

收到贷款账单后，打开相应贷款科目，启动对账向导，根据账单信息勾选所有先前记录的交易。完成后，对账差额应当为0。否则，你需要仔细核对科目账簿并同贷款账单对比找出差异。当差额为0时，贷款科目对账完成，此时你就可以结束对账向导了。

有关对账的更多信息，请参考“对账”一节。

怎样：出售房屋或汽车

当你要出售房屋时，你可以使用不同的记账方法在GnuCash中记录。这里，我们会详细研究其中两种记账方法。在其中一种方法中，你只需记录购买金额和当下的出售金额。在另一种方法中，你需要跟踪房地产市场的起落，并定期记录随时间变动的未实现损益。

简单交易

这种方法只需要恰当记录出售金额。

我们要记录两笔房屋出售，一笔盈利，另一笔亏损。如果你想出售汽车，只要把房屋科目换成汽车科目就可以了。

-资产

-固定资产

-房屋

-流动资产

-储蓄存款

-收入

-长期资本收益

-房屋

- 你之前花300,000元购买了房屋，现在又成功以600,000元出售。你要怎样记录这项交易呢？

要记录这项交易，你需要将储蓄存款科目增加600,000元，并将某些其它科目减少600,000元。房屋科目只有300,000元，正好为当初的购买金额，所以你将这些钱转账至储蓄存款科目。这样下来你还有300,000元的缺口。这笔钱你要从收入:长期资本收益:房屋科目中转账过来。录入储蓄存款科目（资产:流动资产:储蓄存款）的分录交易应当如下所示。

表 8.3. 获利出售资产（房屋）

科目

增加

减少

资产:流动资产:储蓄存款

￥600,000

资产:固定资产:房屋

￥300,000

收入:长期资本收益:房屋

￥300,000

- 你之前花300,000元购买了房屋，但由于附近新建了一座机场，现在只能以230,000元出售。你要怎样记录这项交易呢？

要记录这项交易，你需要将储蓄存款科目增加230,000元，同时将某些其它科目减少230,000元。房屋科目包含300,000元，多于出售金额。所以应将230,000元转至储蓄科目。其后，房屋科目中仍剩70,000元需要转出。你应将这些钱转至收入:长期资本收益:房屋科目，表示亏损。录入房屋科目（资产:固定资产:房屋）的分录交易如下所示。

表 8.4. 亏损出售资产（房屋）

科目

增加

减少

资产:固定资产:房屋

￥300,000

资产:流动资产:储蓄存款

￥230,000

收入:长期资本收益:房屋

￥70,000

更复杂的交易

在这个例子中，我们将浅显地接触些更复杂的会计准则。相关详细内容请参考第 11 章 资本利得。

这里只涉及已经准确估计房屋现值的情况。对于其它情况（高估和低估），请参考第 11 章 资本利得。

-资产

-固定资产

-房屋

-成本

-未实现损益

-流动资产

-储蓄存款

-收入

-已实现损益

-房屋

-未实现损益

-房屋

你先前花300,000元购买了房屋，同时这些年一直密切关注市场动态并将估计的现值更新到账簿中。你现在打算出售房屋，查明其当前市场价值为600,000元。

600,000元（估计市场价值）与300,000元（购买金额）之间的差额就是当前的未实现损益金额。因此，你在资产:固定资产:房屋:未实现损益科目中有300,000元。

你该怎样记录这笔出售交易呢？

要记录出售交易，你需要将储蓄存款科目增加600,000元，并将某些其它科目减少600,000元。你必须首先将收入科目中的未实现损益变换为已实现损益。你最后需要将全部金额从资产:固定资产:房屋的子科目中转出。

录入收入:已实现损益:房屋科目的交易应该如下所示。

表 8.5. 获利出售资产（房屋）之一

科目

增加

减少

收入:已实现损益:房屋

￥300,000

收入:未实现损益:房屋

￥300,000

录入资产:流动资产:储蓄存款科目的交易应该如下所示。

表 8.6. 获利出售资产（房屋）之二

科目

增加

减少

资产:流动资产:储蓄存款

￥600,000

资产:固定资产:房屋:成本

￥300,000

资产:固定资产:房屋:未实现损益

￥300,000

在录入这些交易后，可以看到资产:固定资产:房屋的余额为0，储蓄存款科目增加了600,000元，以及收入:已实现损益增加到了300,000元。

第 9 章 Investments

This chapter explains how to manage your investments with GnuCash. Most people have an investment plan, whether its just putting money into a certificate of deposit (CD for short) account, investing through a company sponsored plan at your workplace or buying and selling stocks and bonds through a brokerage. GnuCash gives you tools to help you manage these investments such as the Price Database which allows you to record changes in the prices of stocks you own.

Basic Concepts

An investment is something that you purchase in the hopes of generating income, or that you hope to sell in the future for more than you paid. Using this simple definition, many things could be considered investments: the house you live in, a valuable painting, stocks in publicly traded companies, your savings account at the bank, or a certificate of deposit. These many types of investments will be discussed in this chapter in terms of how to track them using GnuCash.

Terminology

Before discussing investments specifically, it will be helpful to present a glossary of investment terminology. The terms presented below represent some of the basic concepts of investing. It is a good idea to become familiar with these terms, or at least, refer back to this list if you encounter an unfamiliar word in the later sections.

Capital gains

The difference between the purchase and selling prices of an investment. If the selling price is lower than the purchase price, this is called a capital loss. Also known as realized gain/loss.

Commission

The fee you pay to a broker to buy or sell securities.

Common stock

A security that represents a certain fractional ownership of a company. This is what you buy when you “buy stock” in a company on the open market. This is also sometimes known as capital stock.

Compounding

The concept that the reinvested interest can later earn interest of its own (interest on interest). This is often referred to as compound interest.

Dividends

Dividends are cash payments a company makes to shareholders. The amount of this payment is usually determined as some amount of the profits of the company. Note that not all common stocks give dividends.

Equities

Equities are investments in which the investor becomes part (or whole) owner in something. This includes common stock in a company, or real estate.

Interest

What a borrower pays a lender for the use of their money. Normally, this is expressed in terms of a percentage of the principal per year. For example, a savings account with 1% interest (you are the lender, the bank is the borrower) will pay you $1 for every $100 you keep there per year.

Liquidity

A measure of how easily convertible an investment is to cash. Money in a savings account is very liquid, while money invested in a house has low liquidity because it takes time to sell a house.

Principal

The original amount of money invested or borrowed.

Realized vs Unrealized Gain/Loss

Unrealized gain or loss occurs when you’ve got a change in price of an asset. You realize the gain/loss when you actually sell the asset. See also Capital gains.

Return

The total income plus capital gains or losses of an investment. See also Yield.

Risk

The probability that the return on investment is different from what was expected. Investments are often grouped on a scale from low risk (savings account, government bonds) to high risk (common stock, junk bonds). As a general rule of thumb, the higher the risk the higher the possible return.

Shareholder

A shareholder is a person who holds common stock in a company.

Stock split

Occurs when a company offers to issue some additional multiple of shares for each existing stock. For example, a “2 for 1” stock split means that if you own 100 shares of a stock, you will receive an additional 100 at no cost to you. The unit price of the shares will be adjusted so there is no net change in the value, so in this example the price per share will be halved.

Valuation

The process of determining the market value or the price the investment would sell at in a “reasonable time frame”.

Yield

A measure of the amount of money you earn from an investment (That is how much income you receive from the investment). Typically this is reported as a percentage of the principal amount. Yield does not include capital gains or loses (see Return). For example, a stock sells for $100 and gives $2 in dividends per year has a yield of 2%.

Types of Investments

Below is presented some of the broad types of investments available, and examples of each type.

- Interest-bearing account or instrument

This type of investment usually allows you immediate access to your money, and will typically pay you interest every month based on the amount of money you have deposited. Examples are bank savings accounts (and some interest bearing checking accounts) and cash accounts at your brokerage. This is a very low risk investment, in the US these accounts are often insured against loss, to a specified limit.

Sometimes an interest bearing investment is time-locked. This type of investment requires you to commit your money to be invested for a given period of time for which you receive a set rate of return. Usually, the longer you commit the higher the interest rates. If you withdraw your money before the maturity date, you will usually have to pay an early withdrawal penalty. This is a relatively lower risk investment. Examples are certificates of deposit or some government bonds. Other types of Bonds may have higher yields based on the higher risks from the quality of the issuer’s “credit rating”.

- Stocks and Mutual Funds

This is an investment you make in a company, in which you effectively become a part owner. There is usually no time lock on publicly traded stock, however there may be changes in the tax rates you pay on capital gains depending on how long you hold the stock. Thus, stocks are typically quite liquid, you can access your money relatively quickly. This investment is a higher risk, as you have no guarantee on the future price of a stock.

A mutual fund is a group investment mechanism in which you can buy into many stocks simultaneously. For example, a “S&P 500 index fund” is a fund which purchases all 500 stocks listed in the Standard and Poor’s index. When you buy a share of this fund, you are really buying a small amount of each of the 500 stocks contained within the fund. Mutual funds are treated exactly like a single stock, both for tax purposes and in accounting.

- Fixed Assets

Assets that increase in value over time are another form of investment. Examples include a house, a plot of land, or a valuable painting. This type of investment is very difficult to determine the value of until you sell it. The tax implications of selling these items is varied, depending on the item. For example, you may have tax relief from selling a house if it is your primary residence, but may not receive this tax break on an expensive painting.

Fixed asset investments are discussed in 第 11 章 资本利得 and 第 16 章 Depreciation. Typically, there is not much to do in terms of accounting for fixed asset investments except recording the buying and selling transactions.

Setting Up Accounts

To setup investment accounts in GnuCash you can either use the predefined investment account hierarchy or create your own. The minimum you need to do to track investments is to setup an asset account for each type of investment you own. However, as we have seen in previous chapters, it is usually more logical to create a structured account hierarchy, grouping related investments together. For example, you may want to group all your publicly traded stocks under a parent account named after the brokerage firm you used to buy the stocks.

注意

Regardless of how you setup your account hierarchy, remember that you can always move accounts around later (without losing the work you’ve put into them), so your initial account hierarchy does not have to be perfect.

Using Predefined Investment Accounts

The Investment Accounts option of the New Account Hierarchy Setup assistant will automatically create a basic investment account hierarchy for you. To access the predefined investment accounts hierarchy, you must make sure your GnuCash file is open, switch to the Accounts tab, and choose Actions → New Account Hierarchy . This will run the New Account Hierarchy Setup assistant and allow you to select additional accounts to add to your account hierarchy. Choose the Investment Accounts option (along with any others you are interested in). Assuming only investment accounts were selected, this will create an account hierarchy as shown below.

提示

You can also run the New Account Hierarchy Setup assistant by creating a new GnuCash file.

图 9.1. A New File Containinng Only The Default Investment Accounts

This is a screen image of the Accounts tab after creating a new file and selecting only the default investment accounts.

You will probably at least want to add a Bank account to the Assets account and probably an Equity:Opening Balances account, as we have done in previous chapters. Don’t forget to save your new account file with a relevant name!

Creating Investment Accounts Manually

If you want to set up your own investment accounts hierarchy, you may of course do so. Investments usually have a number of associated accounts that need to be created: an asset account to track the investment itself; an income account to track dividend transactions; and expense accounts to track investment fees and commissions.

In a typical account structure, security accounts are sub accounts of an asset account representing an account at a brokerage firm. The brokerage account would be denominated in your local currency and it would include sub accounts for each security that you trade there.

Related purchases, sales, income and expense accounts should also be in the same currency as the brokerage account.

The security sub accounts would each be configured to contain units of a single security selected from the master (user defined) security list and they are expected to use the same currency as the brokerage account.

Security prices are kept in the Price Database of GnuCash (see “Setting Share Price”一节). This contains prices for individual securities (not security accounts). All prices for an individual security are in a single currency. If a security is traded in multiple currencies, then a separate security and separate accounts should be set up for each currency.

Custom Accounts Example

The following is a somewhat more complicated example of setting up GnuCash to track your investments, which has the advantage that it groups each different investment under the brokerage that deals with the investments. This way it is easier to compare the statements you get from your brokerage with the accounts you have in GnuCash and spot where GnuCash differs from the statement.

Assets

Investments

Brokerage Accounts

I*Trade

Stocks

ACME Corp

Money Market Funds

I*Trade Municipal Fund

Cash

My Stockbroker

Money Market Funds

Active Assets Fund

Government Securities

Treas Bond xxx

Treas Note yyy

Mutual Funds

Fund A

Fund B

Cash

Income

Investments

Brokerage Accounts

Capital Gains

I*Trade

My Stockbroker

Dividends

I*Trade

Taxable

Non-taxable

My Stockbroker

Taxable

Non-taxable

Interest Income

I*Trade

Taxable

Non-taxable

My Stockbroker

Taxable

Non-taxable

Expenses

Investment Expenses

Commissions

I*Trade

My Stockbroker

Management Fees

I*Trade

My Stockbroker

提示

There really is no standard way to set up your investment account hierarchy. Play around, try different layouts until you find something which divides your investment accounts into logical groups which make sense to you.

Interest Bearing Accounts

Investments which have a fixed or variable rate of interest are one of the simplest and most common form of investments available. Interest bearing investments include your bank account, a certificate of deposit, or any other kind of investment in which you receive interest from the principal. This section will describe how to handle these kinds of investments in GnuCash.

Account Setup

When you purchase the interest bearing investment, you must create an asset account to record the purchase of the investment, an income account to record earnings from interest, and an expense account to record bank charges. Below is an account layout example, in which you have an interest bearing savings account and a certificate of deposit at your bank.

Assets

Bank ABC

Certificate of Deposit

Savings

Expenses

Bank ABC

Charges

Income

Interest Income

Certificate of Deposit

Savings

As usual, this account hierarchy is simply presented as an example, you should create your accounts in a form which best matches your actual situation.

Example

Now let’s populate these accounts with real numbers. Let’s assume that you start with $10,000 in your bank account, which pays 1% interest and you buy a $5,000 certificate of deposit with a 6 month maturity date and a 2% yield. Clearly, it is much better to keep your money in the certificate of deposit than in the savings account. After the initial purchase, your accounts should look something like this:

图 9.2. The Chart Of Accounts After Investing In A Certificate Of Deposit

This is an image of the account register after creating and investing in a certificate of deposit investment.

Now, during the course of the next 6 months, you receive monthly bank statements which describe the activity of your account. In our fictional example, we do nothing with the money at this bank, so the only activity is income from interest and bank charges. The monthly bank charges are $2. After 6 months, the register window for the certificate of deposit and for the savings account should look like these:

图 9.3. The CD Account After 6 Months

This is an image of the register of the certificate of deposit account after 6 months.

图 9.4. The Savings Account After 6 Months

This is an image of the register of the Savings account after 6 months.

And this is the main GnuCash account window:

图 9.5. The Chart Of Accounts After 6 months

This a screen capture of the accounts after 6 months.

From the above image of the main GnuCash account window you see a nice summary of what happened to these investments over the 6 months. While the yield on the certificate of deposit is double that of the savings account, the return on the certificate of deposit was $50.21 versus $13.03 for the savings account, or almost 4 times more. Why? Because of the pesky $2 bank charges that hit the savings account (which counted for $12 over 6 months).

After this 6 month period, the certificate of deposit has reached maturity which means you may sell it with no early withdrawal penalty. To do so, simply transfer the $5,050.21 from the certificate of deposit account into the savings account.

Setup Investment Portfolio

Now that you have built an account hierarchy in the previous section, this section will show you how to create and populate the accounts with your investment portfolio. After this initial setup of your portfolio, you may have shares of stock purchased from before you started using GnuCash. For these stocks, follow the instructions in the Entering Preexisting Shares section. If you have just purchased your stocks, then use the Buying New Shares section.

Setup Accounts for Stocks and Mutual Funds

This section will show you how to add stocks and mutual fund accounts to GnuCash. In this section, we will assume you are using the basic account setup introduced in the previous section, but the principles can be applied to any account hierarchy.

You should have within the top level Asset account, a few levels down, an account entitled Stock. Open the account tree to this level by clicking on the “right facing triangle marker” signs next to the account names until the tree is opened to the depth of the new account. You will need to create a sub-account (of type stock) under the Stock account for every stock you own. Every stock is a separate account. The naming of these stock accounts is usually done using the stock ticker abbreviation, though account names may be anything that is clear to you and other users. So, for example, you could name your accounts AMZN, IBM and NST for your Amazon, IBM and NSTAR stocks respectively. Below is a schematic model of the layout (only showing the Assets sub-accounts).

Assets

Investments

Brokerage Accounts

Bond

Mutual Funds

Market Index

Stock

AMZN

IBM

NST

注意

If you want to track income (dividends/interest/capital gains) on a per-stock or fund basis, you will need to create an Income:Dividends:STOCKSYMBOL, Income:Cap Gain (Long):STOCKSYMBOL, Income:Cap Gain (Short):STOCKSYMBOL and Income:Interest:STOCKSYMBOL account for each stock you own that pays dividends or interest.

Example Stock Account

As an example, let’s assume that you currently own 100 shares of Amazon stock. First, create the stock account AMZN by selecting the Stock account and click on the menu Actions+New Account... . The New Account dialog will appear, follow the steps, in the sequence below to setup your new stock account.

图 9.6. The “New Account” Window For AMZN

1. Account Name - Usually, use the stock ticker abbreviation, like “AMZN”.

2. Account Code - Optional field, use CUSIP, the newspaper listing symbol, mutual fund family ID or code of your own choosing.

3. Description - Optional field for detailed description of the commodity/stock. Note this field by default is displayed in the Account tab tree.

4. Account Type - Select the type of account you are creating from the lower left-hand list.

5. Parent Account - Select the parent account for the new account from the right hand listing. Expand list of accounts if necessary.

6. Create the New Security - To use a new stock, you must create the stock as a new commodity.

注意

Be sure to first select Account Type Stock or Mutual Fund so that the Select... button brings up the list of securities rather than currencies.

- Select Security/Currency - Click on the Select... button next to the Security/currency line. We must change the security from the default (your default currency) to this specific stock. This will bring up the Select Security dialog.

- Type - Select the exchange where the security/commodity is traded (in this example NASDAQ).

Select the New button to open the New Security window.

图 9.7. The “Select Security” Window

- Create the Security - Click on the New... button and enter the appropriate information for this stock on the new form New Security.

- The Full name: is Amazon.com.

- The Symbol/abbreviation: is AMZN. The symbol is the stock ticker used in your quote source several lines down on the form.

注意

Different symbols will be used on different price sources for the same stock, an example is Ericsson on the Stockholm Exchange is ERIC-B while on Yahoo it is ERRICB.ST.

- The Type: should already be NASDAQ, because this is what was selected in the security selector, but you can change it here, including adding more categories. More information about this can be found in the GnuCash Manual in section 8.7, “Security Editor”.

- The ISIN, CUSIP or other code is where you can enter some other coding number or text (leave it blank in this example).

- The Fraction traded should be adjusted to the smallest fraction of this security which can be traded, usually 1/100 or 1/10000.

- The checkbox “Get Online Quotes”, the quote source and the timezone should be selected to define the sources for updating prices on-line. See also “Configuring for Automatic Retrieval of Quotes”一节.

注意

If the Get Online Quotes button is not highlighted, and it is not tickable, then the Finance::Quote package is not installed. See the chapter Setting Up the Quote Retrieval in the manual.

Below is what this window should look like when finished:

图 9.8. The “New Security” Window

- Save Security - Click on the OK button to save this new security, this will close the New Security window and return to the New Account window.

7. Select the Security - you should now see the newly created security available in the pull down menu for Security/Currency. Select it (it is probably already selected) and click on OK.

8. Smallest Fraction - Specify the smallest fraction of the security/commodity that is traded.

9. Notes - Enter any notes or messages related to this security/commodity.

10. Tax Related - Go to Edit → Tax Report Options to check this box if this account’s transactions will relate to Income Taxes.

11. Placeholder - Check box if this account is a “Placeholder”, that is it will contain no transactions.

12. Finished - You should now have been automatically returned to the New Account dialog, with the symbol/abbreviation: line set to “AMZN (Amazon.com)”. Click on OK to save this new stock account.

You have now created the Amazon stock account, your main account should look something like this (notice that there are a few extra accounts here, a bank account, and an equity account):

图 9.9. The Chart of Accounts After The Creation Of The First Stock Account

This image is after the creation of the first stock account (AMZN).

Open the account register window for this AMZN stock account (double click on it). Here you see the Commodity view. This gives you an overview of the transactions in this commodity including the number of units (shares for a stock or mutual fund) bought or sold, the net price per unit, and the total amount. Obviously, we have not bought or sold any shares of AMZN yet, so the register should not contain any transactions.

Buying Shares

Entering Preexisting Shares

The examples in this section use Transaction Journal view.

To register the initial 100 shares of this stock that you purchased previously, on the first (transaction) line, enter the date of the purchase (for example, Jan. 1 2005) and Description (for example, Opening Balance). On the first split line, enter 100 in Shares, delete the (unit) Price (it will be calculated when you Tab out of the split) and enter 2000 in the Buy column.

注意

It is also possible to use GnuCash to calculate Shares or Buy from the other 2 columns. But to avoid rounding errors, it is better to automatically calculate Price.

Tab to the second split line, enter transfer from account Equity:Opening Balances. For simplicity, this example assumed there were no commissions on this transaction. Your AMZN Commodity view should now appear like this:

图 9.10. The Transaction Register Of The AMZN Account After The First Purchase

This image is the transaction register of the AMZN account after the first stock “purchase”.

Notice that the Balance (last column) is in the units of the commodity (AMZN shares) not in currency units. Thus, the balance is 100 (AMZN units) rather than $2,000. This is how it should be.

Buying New Shares

The main difference between setting up a new stock purchase versus the setup for preexisting stocks as described in the previous section is that instead of transferring the money used to purchase the stock from the Equity:Opening Balances account, you transfer from your Assets:Bank ABC or Assets:Brokerage Account account.

Handling Commissions and Fees

For conciseness, this document will refer to the money you pay to a broker for buying and selling securities as Commissions. Government fees may also be payable. Unless otherwise stated, fees are handled in a similar way.

In GnuCash 2 alternate ways can be used to handle commissions (for simplicity this document section will refer to these ways as net pricing and gross pricing).

Gross Pricing

You enter the price not adjusted by commissions and enter the commissions expense on a separate split in the transaction. This enables the tracking of commissions but is not compatible with using “Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots”一节. Scrubbing doesn't know to deduct commissions and fees from the gains, so capital gains or losses must be manually calculated (see “Selling Shares with Manual Calculation of Capital Gain or Loss”一节).

Net Pricing

You enter a net price (adjusted by commissions) when buying and selling securities. You do not also record commissions in a specific commissions account in order to later claim it as an expense, as this would be claiming commissions twice. This way is compatible with using “Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots”一节. This results in a slightly misleading price being added to the price database (the effective price you paid) but is not usually of any concern.

Please get professional advice if you are unsure which of these ways are applicable to your jurisdiction.

Example: Buying Shares with Gross Pricing

In this example you will purchase 100 shares at $50 per share of IBM stock with a commission of $100. First step will be to create the stock account for IBM. The existing Expenses:Commission account will be used.

Now for the transaction, on the first (transaction) line, enter the Date of the purchase (for example, Jan. 3, 2005) and Description (for example, Initial IBM Purchase). On the first split line, enter 50 in Shares, delete Price (leave it empty so it will be calculated), and enter 5000 in Buy. You do not need to fill in the Price column, as it will be calculated for you when you Tab to the next split. The next line in the split transaction will be Expenses:Commissions and fill 100 in Buy. The third split line will be to transfer $5,100 from Assets:Bank ABC account to balance the transaction. Your IBM Commodity view should now appear like this:

图 9.11. The Transaction Register Of The IBM Account After The First Stock Purchase

This image is of the transaction register of the IBM account after the first stock “purchase” with a commission.

Example: Buying Shares with Net Pricing

Repeating the previous example using Net Pricing instead of Gross Pricing, in Transaction Journal view.

Purchase $5,000 of IBM stock being 50 Shares for $100.00 each, plus a commission of $100.

Now for the transaction, on the first (transaction) line, enter the Date of the purchase (for example, Jan. 3, 2005) and Description (for example, Initial IBM Purchase). On the first split line, optionally enter more details in Memo , then 50 in Shares, delete anything in Price (so it will be calculated by dividing Buy by Shares when you Tab out of the split), 800px0 in Buy (50 * $100.00 + $100). Alternatively use GnuCash to calculate Buy by entering the formula 5000 + 100 or (50 * 100) + 100 in Buy ( Buy will be calculated when you Tab out of the column.) Use the Tab key as many times as needed to proceed to the next split.

Do not enter a separate split for Commission as it has already been included in the Buy value. The second split line will be to transfer $5,100 from Assets:Bank ABC account to balance the transaction. After the splits are all correct, use the Enter key to save the transaction. Your IBM Commodity view should now appear like this:

图 9.12. The IBM Account After The First Stock Purchase With A Commission

This image is of the transaction register of the IBM account after the first stock “purchase” with a commission.

Setting Share Price

The value of a commodity, such as a stock, must be explicitly set. The stock accounts track the quantity of stocks you own, but the value of the stock is stored in the Price Database. The values set in the Price Database can be updated manually or automatically.

Initial Price Database Setup

To use the Price Database to track a stock value, you must initially insert the stock. To do so, open the Price Database ( Tools → Price Database ) and click on Add button. The first time a Commodity/Stock is entered this window will be blank except for the control buttons on the bottom. Select the appropriate Commodity you want to insert into the Price Database. At this point, you can input the price of the commodity manually. There are 6 fields in the New Commodity window:

Namespace

The exchange market where the security/commodity is traded (in this example NASDAQ.)

Security

The name of the commodity, must be chosen from the Select... list.

Currency

The currency in which the Price is expressed.

Date

Date that the price is valid.

Type

One of: Bid (the market buying price), Ask (the market selling price), Last (the last transaction price), Net Asset Value (mutual fund price per share, NAV for short), or Unknown. Stocks and currencies will usually give their quotes as one of bid, ask or last. Mutual funds are often given as net asset value. For other commodities, simply choose Unknown. This option is for informational purposes only, it is not used by GnuCash.

Price

The price of one unit of this commodity.

As an example of adding the AMZN commodity to the price database, with an initial value of $40.50 per share.

图 9.13. Entering A Price Into The Database

Adding the AMZN commodity to the price database, with an initial value of $40.50 per share.

Click OK when finished. Once you have performed this initial placement of the commodity into the Price Database, you will not have to do it again, even if you use the same commodity in another account.

注意

If you have online retrieval of quotes activated (see “Configuring for Automatic Retrieval of Quotes”一节), you can initialize a commodity without manually making an entry. When you initially add the security in the Security Editor, check Get Online Quotes and save the security. Then, in the Price Database, click Get Quotes, and the new security will be inserted into the price list with the retrieved price.

Setting Stock Price Manually

If the value of the commodity (stock) changes, you can adjust the value by entering the Price Database, selecting the commodity, clicking on Edit and entering the new price.

图 9.14. The Price Database With The List Of All Known Commodities

The main price database window, showing the list of all known commodities.

Configuring for Automatic Retrieval of Quotes

If you have more than a couple of commodities, you will tire of having to update their prices constantly. GnuCash has the ability to automatically download the most recent price for your commodities using the Internet. This is accomplished through the Perl module Finance::Quote, which must be installed in order to activate this feature.

See the chapter Setting Up the Quote Retrieval in the manual.

Configuring Securities for Online Quotes

With Finance::Quote installed and functioning correctly, you must configure your GnuCash securities to use this feature to obtain updated price information automatically. Whether creating new securities or modifying securities that have already been setup, use the Tools → Security Editor , to edit the security and check the Get Online Quotes box. You will now be able to modify the radio buttons for Type of quote source, the pull-down menus to specify the specific source(s) and The timezone for these quotes. When finished editing, Close the Security Editor to return to the Price Database and click on the Get Quotes button to update your stock prices on the Internet.

Configuring for Getting Online Quotes Periodically

After you have verified the proper fetching of Online Quotes for your commodities, you can tell your operating system to fetch the quotes periodically. See the section Updating Prices Automatically with gnucash-cli in the manual.

Displaying Share Value

The main account window, by default, only shows the quantity of each commodity that you own, under the column heading Total. In the case of stocks, this commodity is the number of shares. Often, however, you will want to see the value of your stocks expressed in terms of some monetary unit. This is easily accomplished by entering the main window, selecting the Accounts tab, by clicking on the Titlebar Options button (the small down pointing arrow on the right side of the main account window titles bar), and selecting the option to display the account total field “Total (USD)”. You will see a new column in the main window entitled Total (USD) that will express the value of all commodities in the report currency.

图 9.15. Displaying Stock Values in the Chart of Accounts

Viewing the value of a stock commodity in the main window using the Total in Report Currency option.

The “Price Source” in Reports

Most GnuCash reports have options to set/modify a number of parameters for the report. The Options dialog box is displayed by selecting the report tab, then ether clicking on the Options icon in the Menubar or selecting Edit → Report Options . Price Source determines how accounts denominated in commodities different from the report currency are converted to the report currency. Depending on the report the selector may appear in either the General, the Commodities, or the Display tab of the Report Options dialog box.

注意

In the example the report can be customized using the Reports → Assets & Liabilities → Average Balance menu.

图 9.16. Determining The Source Of The Stock Price/Currency Exchange Rate in Reports

Determining the value of a stock commodity or a currency other than the report currency in a report by setting the Price Source option.

Weighted Average

Calculates the price by summing the absolute value of the amount and the absolute value of every split in every account denominated in the commodity, excluding those splits with a zero amount, and dividing the sum of values by the sum of amounts to obtain a price. For example, if you had a buy transaction for 200 shares of XYZ for a total of 2000 and a sell of 100 for 1300 the weighted average would be 3300/300 or 11/share.

注意

Gain/Loss splits have an amount of 0 and are not included in this calculation.

Average Cost

Calculates the price by summing the amounts and values of every split in every account denominated in the commodity, including the zero amount splits. In the example above, with an additional split (either part of the sale transaction or in a separate transaction) booking the gain at 0 shares and a 300 gain, the average cost is 1000/100 (2000 original cost − 1300 proceeds from the sale + 300 gain)/(200 − 100) shares or 10/share.

注意

- Gain/Loss splits are included in this calculation.

- This is the only Price Source that will balance the Trial Balance Report and in order for it to balance you must correctly book your gains and losses.

Most Recent

Uses the latest price from the price database.

Nearest in time

Uses the price nearest in time to the report date—the datum date for time series reports like Assets Over Time—from the price database.

注意

The nearest date isn’t necessarily before the date in question.

图 9.17. An Asset Barchart Report Based On The “Nearest In Time” Price Source

Tracking what value your stocks would’ve had on the stock exchanges.

Selling Shares

Entering an investment sale transaction is done in a similar way to entering a buy transaction (see “Buying New Shares”一节) except the amount entered in the Shares column is negative and the proceeds of the transaction is entered in the Sell column. The net proceeds from the sale should be transferred from the shares account to your bank or brokerage account.

For information on handling commissions and the use of Net Pricing or Gross Pricing, please see “Handling Commissions and Fees”一节. If you will be recording a capital gain or loss on the sale, please see 第 11 章 资本利得 and 第 16 章 Depreciation for more information on this topic. To use the GnuCash Automatic Calculation of Capital Gain or Loss Using Lots feature, please see “Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots”一节 otherwise continue to the next section.

Selling Shares with Manual Calculation of Capital Gain or Loss

注意

In order for GnuCash to commit the zero-share, zero-price split for account Assets:Stock:SYMBOL to the transaction in the following schemes, you must Tab out of that split. If you use the Enter key, GnuCash will convert the split into shares of the commodity.

In the schemes of transaction splits presented below, the following symbols are used:

NUM_SHARES

the number of shares you are selling

COMMISSION

brokerage commissions or fees

GROSS_SELL_PRICE

unit price for which you sold the shares, not reduced by COMMISSION

NET_SELL_PRICE

unit price for which you sold the shares, reduced by COMMISSION

GROSS_BUY_PRICE

unit price for which you bought the shares, not increased by COMMISSION

NET_BUY_PRICE

unit price for which you bought the shares, increased by COMMISSION

GROSS_BUY

total price for which you bought shares, excluding COMMISSION, equal to NUM_SHARES * GROSS_BUY_PRICE

NET_BUY

amount of money for which you bought shares including COMMISSION, equal to GROSS_BUY + COMMISSION

GROSS_SALE

total price for which you sold shares, equal to NUM_SHARES * GROSS_SELL_PRICE

NET_SALE

amount of money received from the sale, equal to GROSS_SALE − COMMISSION

GROSS_PROFIT

amount of money you made on the sale, not reduced by COMMISSION

NET_PROFIT

amount of money you made on the sale, reduced by COMMISSION

There are 2 ways of manually recording the capital gain or loss. The capital gain/loss can be combined with the sale in one transaction or it can be entered in a separate transaction.

Combine the Sale and Capital Gain/Loss in One Transaction

This has the advantage that all parts of the sale event are kept together. This is not compatible with using scrubbing (see “Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots”一节). If you may in future use scrubbing on a specific security, save some work later by entering the capital gain/loss splits in a separate transaction now.

When the capital gain/loss splits are combined with the sale splits in one transaction, there are 2 splits for the security account in the same transaction, so the transaction must be entered with the security register in Auto-Split Ledger or Transaction Journal view. One of the splits for the security account is for the sale and the other is for the capital gain or loss. The security account split for the capital gain or loss must be entered with 0 number of shares and 0 price per share to stop the automatic recalculation of these fields.

Account for the profit or loss as coming from an Income:Capital Gains or Expenses:Capital Loss account.

Combined, Gross Pricing

表 9.1. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Combined, Gross Pricing

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Bank ABC

NET_SALE

Assets:Stock:SYMBOL

0

0

GROSS_PROFIT

(Loss)

Expenses:Commission

COMMISSION

Assets:Stock:SYMBOL

−NUM_SHARES

GROSS_SELL_PRICE

GROSS_SALE

Income:Capital Gains

(Loss)

GROSS_PROFIT

例 9.1. Sale of Shares with Profit, Manual Profit/Loss Calculation, Sale & Profit Combined, Gross Pricing

In this example, we will use the AMZN account created in “Example Stock Account”一节.

You bought 100 shares of AMZN for $20 per share, then later sell them all for $36 per share with a commission of $75. The split transaction scheme is as follows:

- GROSS_BUY_PRICE is $20 (the original buying price),

- NUM_SHARES is 100,

- GROSS_BUY is $2,000 (the original buying cost),

- GROSS_SALE is $3,600,

- and finally GROSS_PROFIT is $1,600 (GROSS_SALE − GROSS_BUY).

表 9.2. Selling Shares Split Scheme, Sale & Gain Combined, Gross Pricing

Account

Shares

Price

Buy

Sell

Assets:Bank ABC

3525.00

Assets:Brokerage Account:Stock:AMZN

0

0

1600.00

Expenses:Commission

75.00

Assets:Brokerage Account:Stock:AMZN

−100

36.00

3600.00

Income:Capital Gain (Long Term):AMZN

1600.00

图 9.18. Selling Shares, Gain Combined, Gross Pricing

注意

In the above screenshot, it appears there are 2 transactions for Mar. 21, 2006. This is because the register is in Auto-Split Ledger view and there are 2 splits for the register account in the 1 transaction. Transaction Journal view may be clearer. Refer to “简单交易还是分录交易？”一节. As there are 2 splits for the register account in the sale transaction, this transaction must be entered in Auto-Split Ledger or Transaction Journal view. It cannot be entered in Basic Ledger view.

图 9.19. The Account Tree after the Example of Selling Shares for a Gain

Combined, Net Pricing

表 9.3. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Combined, Net Pricing

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Bank ABC

NET_SALE

Assets:Stock:SYMBOL

0

0

NET_PROFIT

(Loss)

Assets:Stock:SYMBOL

−NUM_SHARES

NET_SELL_PRICE

NET_SALE

Income:Capital Gains

(Loss)

NET_PROFIT

例 9.2. Sale of Shares with Profit, Manual Profit/Loss Calculation, Sale & Profit Combined, Net Pricing

In this example, we will use the AMZN account created in “Example Stock Account”一节.

You bought 100 shares of AMZN for $20 per share (including commissions), then later sell them all for $36 per share with a commission of $75. The split transaction scheme is as follows:

- NUM_SHARES is 100,

- NET_BUY_PRICE is $20 (the original buying price),

- NET_BUY is $2,000 (the original buying cost),

- NET_SELL_PRICE is $35.25 (($3600 − $75) / 100)),

- GROSS_SALE is $3,600, NET_SALE is $3,525,

- and finally NET_PROFIT is $1,525 (NET_SALE − NET_BUY).

表 9.4. Selling Shares Split Scheme, Sale & Gain Combined, Net Pricing

Account

Shares

Price

Buy

Sell

Assets:Bank ABC

3525.00

Assets:Brokerage Account:Stock:AMZN

0

0

1525.00

Assets:Brokerage Account:Stock:AMZN

−100

35.25

3525.00

Income:Capital Gain (Long Term):AMZN

1525.00

图 9.20. Selling Shares for Gain using Net Pricing in Transaction Journal View

Separate the Capital Gain/Loss Transaction from the Sale Transaction

This is required if using scrubbing to calculate and create capital gain/loss transactions automatically. Otherwise scrubbing will not detect them and will create an incorrectly valued capital gain/loss transaction.

Separated, Gross Pricing

表 9.5. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Separate Transactions, Sale Transaction

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Bank ABC

NET_SALE

Expenses:Commission

COMMISSION

Assets:Stock:SYMBOL

−NUM_SHARES

GROSS_SELL_PRICE

GROSS_SALE

表 9.6. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Separate Transactions, Capital Gain/Loss Transaction

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Stock:SYMBOL

0

0

GROSS_PROFIT

(Loss)

Income:Capital Gains

(Loss)

GROSS_PROFIT

例 9.3. Sale of Shares with Profit, Manual Profit/Loss Calculation, Sale & Profit Separated, Gross Pricing

In this example, we will use the AMZN account created in “Example Stock Account”一节.

You bought 100 shares of AMZN for $20 per share and commissions $20, then later sell them all for $36 per share with a commission of $75. The split transaction scheme is as follows:

- GROSS_BUY_PRICE is $20 (the original buying price),

- NUM_SHARES is 100,

- GROSS_BUY is $2,000 (the original buying cost),

- GROSS_SALE is $3,600,

- finally GROSS_PROFIT is $1,600 (GROSS_SALE − GROSS_BUY).

表 9.7. Selling Shares Split Scheme, Sale Transaction, Gross Pricing

Account

Shares

Price

Buy

Sell

Assets:Bank ABC

3525.00

Expenses:Commission

75.00

Assets:Brokerage Account:Stock:AMZN

−100

36.00

3600.00

表 9.8. Selling Shares Split Scheme, Gain Transaction, Gross Pricing

Account

Shares

Price

Buy

Sell

Assets:Brokerage Account:Stock:AMZN

0

0

1600.00

Income:Capital Gain (Long Term):AMZN

1600.00

图 9.21. Selling Shares for Gain Where the Sale and Gain are Recorded in Separate Transactions, in Transaction Journal View

Separated, Net Pricing

表 9.9. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Separate Transactions, Sale Transaction

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Bank ABC

NET_SALE

Assets:Stock:SYMBOL

−NUM_SHARES

NET_SELL_PRICE

NET_SALE

表 9.10. Selling Shares Split Scheme, Sale and Capital Gain/Loss Are Separate Transactions, Capital Gain/Loss Transaction

Account

Number of Shares

Share Price

Total Buy

Total Sell

Assets:Stock:SYMBOL

0

0

NET_PROFIT

(Loss)

Income:Capital Gains

(Loss)

NET_PROFIT

例 9.4. Sale of Shares with Profit, Manual Profit/Loss Calculation, Sale & Profit Separated, Net Pricing

In this example, we will use the AMZN account created in “Example Stock Account”一节.

You bought 100 shares of AMZN for $20 per share (including commissions), then later sell them all for $36 per share with a commission of $75. In the split transaction scheme is as follows:

- NUM_SHARES is 100,

- NET_BUY_PRICE is $20 (the original buying price),

- NET_BUY is $2,000 (the original buying cost),

- NET_SELL_PRICE is $35.25 (($3600 − $75) / 100)),

- GROSS_SALE is $3,600, NET_SALE is $3,525,

- and finally NET_PROFIT is $1,525 (NET_SALE − NET_BUY).

表 9.11. Selling Shares Split Scheme, Sale Transaction, Net Pricing

Account

Shares

Price

Buy

Sell

Assets:Bank ABC

3525.00

Assets:Brokerage Account:Stock:AMZN

−100

35.25

3525.00

表 9.12. Selling Shares Split Scheme, Gain Transaction, Net Pricing

Account

Shares

Price

Buy

Sell

Assets:Brokerage Account:Stock:AMZN

0

0

1525.00

Income:Capital Gain (Long Term):AMZN

1525.00

图 9.22. Selling Shares for Gain Where the Sale and Gain are Recorded in Separate Transactions, in Transaction Journal View

Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots

Introduction

Wikipedia includes the following definition of a lot:

a set of goods for sale together in an auction; or a quantity of a financial instrument

GnuCash has a built-in lot management facility that can be used to keep track of capital gains or losses resulting from security sales. Buy and sell transactions are put into lots for the purpose of calculating the cost of the sale. More specifically, a lot is used to link particular buy and sell transaction splits. Lots can be automatically or manually created and linked. Capital gain or loss can be automatically calculated and transaction(s) created for the difference between the sale value and the cost of the securities sold. GnuCash refers to this process as scrubbing.

The term scrub is used because security accounts need to be cleaned after sales to ensure the difference between the cost paid for securities, and value received from selling them, is accounted for as capital gain or loss. If the capital gain/loss is not correct, the Trial Balance bottom line total debits will not balance to total credits. To see the Trial Balance, select Reports → Income & Expense → Trial Balance .

注意

If you make an error, you can delete the lot(s) and capital gain/loss transaction(s) and retry. Ensure you delete the lot, or at least unlink sale transactions from the lot, before you delete a capital gain/loss transaction. Otherwise, the Lots in Account screen will recreate the capital gain/loss transaction when you select the lot.

If you are not familiar with FIFO, LIFO or Average costing, please see Wikipedia FIFO and LIFO accounting and Average cost method.

If you are not familiar with the difference between GnuCash transactions and splits, please see “简单交易还是分录交易？”一节.

The GnuCash lot management facility can be a useful feature, reducing manual calculation, especially if dividends have been reinvested over years and there are many different costs involved. It can automatically link buy transactions to sell transactions using FIFO cost method and one can manually link specific buy transactions to sell transactions in order to use LIFO. Advanced Portfolio Report basis costs and gains/losses will agree with the costs and gain/loss transactions created by scrubbing if either the FIFO or LIFO cost methods are used.

Lots in Account Window

The Lots in Account SSSS window, where SSSS is a security account, is used to manually or automatically link security transaction splits to lots and create capital gain/loss transactions to account for the difference between the costs of buying a security and the value received by selling it.

To open the Lots in Account window, open the security account register, then select Actions → View Lots .

图 9.23. Selling Shares - Capital Gains - Lots in Account window

An image of the Lots in Account window.

Refer to the Help Manual, Chapter 8 Tools & Assistants, Lots in Account for details of the Lots in Account screen elements.

Procedure Summary

Using the lot management facility for the automatic calculation of capital gain or loss typically follows these steps:

1. Record the sale transaction using Net Pricing (but stop short of entering the Capital Gain transaction as it will be created by scrubbing). See 例 9.4 “Sale of Shares with Profit, Manual Profit/Loss Calculation, Sale & Profit Separated, Net Pricing”.

2. “Manual Lot Creation and Linking”一节 (Optional depending on cost method)

3. “Automatic Creation of Capital Gain Or Loss Transactions”一节

4. “Change Orphaned Gains-CCC to Gain/Loss Account”一节

5. “Run a Trial Balance”一节 report to ensure total debits balance to total credits.

Manual Lot Creation and Linking

Before using this feature, ensure you have read “Considerations”一节.

This functionality allows the manual linking of specific buy and sell transactions. It may be used in the case where a user wishes to use a different cost method than the automatic linking method (FIFO). Effectively, if one wishes the cost basis and capital gains in the Advanced Portfolio Report to be consistent with the capital gains transactions created by scrubbing, manual lot creation only needs to be used when using LIFO or “sale of designated lots” (the same thing for securities as far as US personal tax law is concerned). This is because the scrub function can automatically do FIFO linking so there is no need to do it manually and scrubbing cannot be used for average costing. See 例 9.5 “Manual Lot Creation and Linking”.

Automatic Creation of Capital Gain Or Loss Transactions

注意

Do not do this unless you are using FIFO or LIFO to cost sales. See “Considerations”一节.

GnuCash can automatically calculate and create security sale capital gain/loss transactions. Lots are used to link buy transaction splits with sell transaction splits so the correct cost of the securities sold can be determined. GnuCash will use any existing lots, and create new lots for any buy transaction splits not already linked to a lot. Buy and sell transaction splits are linked to lots using FIFO method.

See:

- 例 9.6 “Automatic Creation of Capital Gain Or Loss Transactions”,

- 例 9.7 “Automatic Creation of Capital Gain Or Loss Transactions, 2 Sales at Once”,

- 例 9.8 “Automatic Creation of Capital Gain Or Loss Transactions - After a Simple Stock Split”.

Change Orphaned Gains-CCC to Gain/Loss Account

The capital gain/loss transaction(s) created by scrubbing uses an automatically created generic Orphaned Gains-CCC account (where CCC is the security currency) because GnuCash doesn't know which capital gain or loss account should be used. After scrubbing, the user should edit the Orphaned Gains-CCC transaction split to re-assign the income account to a more meaningful income (or expense) gain or loss account (for example, Income:Capital Gain (Long Term):IBM).

See 例 9.9 “Changing the Orphaned Gains-CCC to Gain/Loss Account”.

Run a Trial Balance

Running a Trial Balance report ( Reports → Income & Expense → Trial Balance ) after creating capital gain/loss transactions, is a basic check that capital gains/losses are correctly accounting for the difference between the cost paid for securities, and value received from selling them. At the end of the report, total debits should equal total credits.

提示

A Trial Balance may not balance due to some other problem. To determine if the cause of an imbalance is from incorrectly accounting for capital gain/loss:

1. If necessary, temporarily change the date of the sell transaction and the capital gain/loss transaction, so they are the only transactions for a particular date, then run the Trial Balance as at the day before. If the Trial Balance is still out by the same amount, it is not the capital gain/loss that is causing the problem.

2. If you find a prior out of balance Trial Balance, keep running the Trial Balance report with different dates until you find the date it starts being out of balance. Temporarily change the transaction dates for each transaction on the problem date to the following day, then change the dates back to the correct date 1 at a time, running the Trial Balance each time, until you identify the problem transaction. When you change the date of a security sell transaction, you also need to change the date of the corresponding capital gain transaction as it is only the sum of these that will balance in the Trial Balance.

Considerations

There are some points that should be considered before using the lot management facility.

1. GnuCash implements only the First In/ First Out (FIFO) cost method when automatically linking buy transactions to sell transactions. That means the oldest securities are always sold first. The Last In First Out (LIFO) cost method may be used by manually linking the most recent buy security splits to the sell split before scrubbing.

2. The Advanced Portfolio Report does not use lot information when calculating costs, just the security transaction splits. It calculates the cost basis and gains or losses using the selected Basis calculation method report option (Average, FIFO or LIFO). If one wishes the Advanced Portfolio Report costs and gains/losses to be consistent with the capital gain/loss transactions created by scrubbing, the same cost model must be used in both places.

3. Scrubbing does not recognize commissions or fees so makes no allowance for them in the calculation of gain or loss. Therefore you must use Net Pricing rather than Gross Pricing if you wish to use scrubbing. See “Handling Commissions and Fees”一节.

4. Scrubbing does not recognize capital gain/loss transaction splits if they have been manually entered as part of the sale transaction. Therefore ensure previous sales are recorded as 2 transactions:

表 9.13. Transaction 1 dealing with value received and the reduction of the number of shares

Account

Tot Shares

(Unit) Price

Buy (Debit)

Sell (Credit)

Brokerage or Bank

Debit

Security

−NumSold

SaleUnitPrice

SaleValue

表 9.14. Transaction 2 capital gain/loss (loss in this example)

Account

Tot Shares

(Unit) Price

Buy (Debit)

Sell (Credit)

Capital Loss

Debit

Security

0

0

Credit

5. The automatic capital gains calculations can handle straightforward buy, sell, and return of capital transactions but any transaction that affect the number of shares, even simple splits, will cause it to produce wrong answers so those cases must be handled manually.

Examples

例 9.5. Manual Lot Creation and Linking

Here is an example of selling part of a security holding using the LIFO method. In this example, the most recent buy transaction (dated Jul. 1, 2016, a reinvested dividend), is linked to a lot, along with the sell transaction, and the GnuCash scrub function is used to calculate capital gain or loss and create the capital gain/loss transaction.

1. Open the security account's register.

图 9.24. Selling Shares - Capital Gains - Security register before scrubbing a single lot

An image of the Security Account register in transaction journal view, before lot scrubbing.

2. Ensure all previous capital gain/loss transactions are separate transactions to the sell transactions which record the reduction in the number of shares and the value received.

3. Select Actions → View Lots to open the Lots in Account SSSS window where SSSS is the security account.

图 9.25. Selling Shares - Capital Gains - Lots before scrubbing a single lot

An image of the Lots in Account window before lot scrubbing.

4. Create a new lot using the New Lot button. Initially this lot is not linked to any buy or sell split.

5. Highlight the new lot in the Lots in This Account panel.

6. Highlight the buy split (dated Jul. 1, 2016) of the security to be sold in the Splits free panel.

7. Click the >> button to link the buy split with the highlighted lot. The split moves from the Splits free panel to the Splits in Lot panel.

8. Repeat the previous 2 steps for any other buy splits that should be included in the lot (in this example, there is only 1 buy split in the sale).

9. Highlight the sell split in the Splits free panel.

10. Click the >> button to link the sell split with the highlighted lot.

11. Check the lot Balance is as expected. In this example the lot balance should be zero as the number of securities sold in the lot, is matched with the same number of security buys.

图 9.26. Selling Shares - Capital Gains - Lots before scrubbing a single lot, after manual linking

An image of the Lots in Account window before scrubbing a single lot.

12. Click the Scrub button (not the Scrub Account button.)

The Lots in Account window has not changed after using the Scrub button so no example screen image is supplied.

13. Close the Lots in Account SSSS window and return to the security account register.

图 9.27. Selling Shares - Capital Gains - Register after manual linking and scrubbing a single lot

An image of the Register after scrubbing a single lot.

14. Continue to “Change Orphaned Gains-CCC to Gain/Loss Account”一节.

例 9.6. Automatic Creation of Capital Gain Or Loss Transactions

Create the capital gains transaction by following these steps:

1. Open the security account's register.

2. Ensure any previous manually entered capital gain/loss transaction splits have been entered in separate transactions to the the sell transactions.

3. Select Actions → View Lots to open the Lots in Account SSSS window where SSSS is the security account.

4. If using LIFO, use the above procedure “Manual Lot Creation and Linking”一节 to create a lot for each sell transaction, link the lot with the sell transaction and each of the buy transactions that make up the sale.

5. Click the Scrub Account button which:

- Creates lots for any buy transactions that are not already linked to a lot and links them to sell transactions splits using the FIFO method. As a transaction split can only be linked to 1 lot, if a sell transaction needs to be linked to multiple lots, the sell transaction split is itself split into multiple subsplits. In the case of multiple subsplits, it is possible to have different splits from the same transaction in both the Splits free and Splits in lot panels.

- Creates a separate transaction per lot for capital gain/loss.

6. Continue to “Change Orphaned Gains-CCC to Gain/Loss Account”一节.

例 9.7. Automatic Creation of Capital Gain Or Loss Transactions, 2 Sales at Once

Here is an example of FIFO scrubbing without manual lot creation. In this example, the transactions for 2 sales are scrubbed at once but usually scrubbing would be performed after each sale. One reason for scrubbing 2 sales at once, could be because there were multiple sales on the same day.

图 9.28. Selling Shares - Capital Gains - Register before Scrub Account

An image of the Security Account register in transaction journal view, before Scrub Account is used.

1. Select Actions → View Lots to open the Lots in Account SSSS window where SSSS is the security account.

图 9.29. Selling Shares - Capital Gains - Lots before Scrub Account

An image of the Lots in Account window before Scrub Account is used.

2. Click the Scrub Account button.

图 9.30. Selling Shares - Capital Gains - Lots after Scrub Account

An image of the Lots in Account window after using Scrub Account.

注意

After using the Scrub Account button only the last lot is shown, so the above image is after the Lots in Account window has been closed and reopened so all the lots show.

3. Close the Lots in Account SSSS window and return to the security account register.

图 9.31. Selling Shares - Capital Gains - Register after Scrub Account

An image of the security register after using Scrub Account.

注意

The security splits in the sell transactions have been split into subsplits, one subsplit per lot, and a capital gain transaction has been created for each security subsplit of each sell transaction.

4. Continue to “Change Orphaned Gains-CCC to Gain/Loss Account”一节.

例 9.8. Automatic Creation of Capital Gain Or Loss Transactions - After a Simple Stock Split

Here is an example of FIFO scrubbing without manual lot creation/linking, where the Stock Split Assistant has been used for a simple stock split. In this example, 100 shares of security XYZ were bought for $10.00 each, there was a simple 2 for 1 stock split for zero cost (so the holding was then 200 shares @ $5.00 each), then all 200 shares were sold for $6.00 each.

图 9.32. Selling Shares - Capital Gains - Register after Scrub Account

An image of the Security Account register in transaction journal view, after Scrub Account is used.

图 9.33. Selling Shares - Capital Gains - Lot 0 after Scrub Account

An image of the Security Account register in transaction journal view, after Scrub Account is used.

图 9.34. Selling Shares - Capital Gains - Lot 1 after Scrub Account

An image of the Security Account register in transaction journal view, after Scrub Account is used.

The above screenshots show that scrubbing created:

- 2 lots. A separate lot for each buy (it essentially treats the stock split as a buy of 100 for no cost.)

- 2 capital gain transactions (one for each lot) on the date of the sale:

- Lot 0: Jul. 1, 2009 loss $400 (sale $600 − cost $1,000.)

- Lot 1: Jul. 1, 2009 gain $600 (sale $600 − cost $0.)

Total gain $200 is correct. Whether the gain is a single long-term one or one each of long-term and short-term or whether there's even a distinction depends on the user's tax jurisdiction and the way the split is structured. If the user needs help figuring it out they should consult a professional.

例 9.9. Changing the Orphaned Gains-CCC to Gain/Loss Account

1. Close the Lots in Account SSSS window if open and return to the security account register.

图 9.35. Selling Shares - Capital Gains - Register after scrubbing a single lot

An image of the security register after scrubbing a single lot.

2. Find each new Realized Gain/Loss transaction in the security account register (they will have the same date as the sell transactions).

3. Edit the Orphaned Gains-CCC transaction split to re-assign the income account to a more meaningful income (or expense) gain or loss account (for example, Income:Capital Gain (Long Term):IBM).

提示

You may like to split the capital gain/loss into taxable and non taxable parts if that is in accord with your tax laws.

Dividends

Some companies or mutual funds pay periodic dividends to shareholders. Dividends are typically given in one of two ways, either they are automatically reinvested into the commodity or they are given as cash. Mutual funds are often setup to automatically reinvest the dividend, while common stock dividends usually pay cash.

Dividends in Cash

If the dividend is presented as cash, you should record the transaction in the asset account that received the money, as income from Income:Dividends. Additionally if you want to tie the cash dividend to a particular stock holding then add a dummy transaction split to the stock account with quantity 0 price 1 value 0.

As an example consider the following; the dividends deposited as cash into the Broker Account with a tie to the stock account.

图 9.36. Example Of Cash Dividend Transactions

An image of the Brokerage Account register after a series of cash dividends.

注意

If you want to track dividends on a per-stock basis, you would need to create an Income:Dividends:STOCKSYMBOL account for each stock you own that pays dividends.

Dividends Re-Invested

If you receive the dividend in the form of an automatic reinvestment, the transaction for this should be handled within the stock or mutual fund account as income from Income:Dividends for the appropriate number of reinvested shares. This type of reinvest account is often referred to as a DRIP (Dividend Re-Investment Program).

As an example consider the following purchase of NSTAR (NST) stock with the dividends reinvested into a DRIP Account. Mutual fund re-investments would be the same.

Starting with the purchase of 100 shares on Jan. 3, 2005, all dividends will be reinvested and an account is created to track the dividend to the specific stock. GnuCash simplifies the entry by allowing calculations within the cells of the transaction. If the first dividend is $0.29/share, enter 53.28 (purchase price + dividend) in the share Price cell and 100*0.29 in the Buy cell. GnuCash will calculate for you the corresponding number of Shares.

图 9.37. Example Of Dividend Reinvestment Transactions

An image of the NST Stock Account register after a dividend reinvestment.

Return of Capital

This refers to a transaction where an investment returns capital to the investor and doesn't have any accounting implications other than reducing the cost basis. The number of shares held is not changed.

A Return of Capital transaction can be entered in the stock register by entering the stock split with:

Shares

0

Price

0

Sell

Return of Capital value

The other side of the double entry would usually be a debit to the brokerage bank account.

图 9.38. Example Of Return Of Capital Transactions

An image of the Stock Account register after a return of capital.

注意

It is not possible to use the Stock Split Assistant to do this type of transaction.

提示

If you accidentally entered a non-zero price in the stock split, GnuCash may have created an unwanted price database entry which could cause reports to be wrong. Check for and remove such an unwanted entry from the price database using Tools → Price Database .

Splits and Mergers

Companies may split their stock for many reasons but the most common is that the price has risen higher than management thinks is a reasonable price for many investors. Some of these splits are simple exchanges (for example, 2 for 1 or 3 for 2) and some are complex exchanges with cash distributions. Splits may also result in fewer shares if the exchange rate is a reverse split (1 for 3 or 0.75 for 1).

Simple Stock Split

As an example, our holding of NST stock declared a 2 for 1 stock split effective June 6, 2005. The process for entering this transaction is; select Actions → Stock Split to start the assistant.

图 9.39. Activation Of The “Stock Split” Assistant

An image of the selection of the stock split assistant.

The first screen is an Introduction, select Forward to display the selection of the account and stock for the split. You will need to create an entry for each Account:Stock combination you hold.

图 9.40. Selection Of A Stock Account In The “Stock Split” Assistant

An image of the stock split assistant at step 2 - Selection of Account/Stock.

Select the Assets:Investments:DRIPs:NST and click on Forward.

The next screen presents 5 fields in the Stock Splits Details window:

Date

Enter the date of the split.

Shares

The number of shares increased (or decreased) in the transaction. In this example, it is a 2 for 1 split so the number of additional shares is the number of shares currently in the register.

Description

The Description should give a brief explanation of the transaction.

New Price

If desired the new price of the stock, after the split, may be entered.

Currency

The currency of the transaction is required. This should be the same as the stock purchase currency.

Click on the Forward button.

图 9.41. Split Details In The “Stock Split” Assistant

An image of the stock split assistant at step 3 - Split Details.

The next screen will be skipped in this example as there was no “Cash in Lieu”.

图 9.42. “Cash In Lieu” In The “Stock Split” Assistant

An image of the stock split assistant at step 4 - Cash in Lieu.

A final Finish screen will give a last option to; Cancel, Back to modify any data entered or Apply to complete the stock split with the data entered.

图 9.43. The NST Account After A Simple Stock Split

An image of the Assets:Investments:DRIPs:NST register after a simple stock split transaction.

Moderately Complex Stock Merger

As an example, assume you held AT&T stock during the Nov. 18, 2005 merger of SBC with AT&T. For this example you will have purchased AT&T on April 1, 2005, any dividends will have been paid in cash, therefore not entered into the AT&T stock register.

The conditions of the merger were 0.77942 share of SBC stock were exchanged for each share of AT&T stock. The merged company continued to use the symbol “T” from AT&T.

AT&T paid a “dividend” of $1.20/share on the transaction date, however this will not appear in the stock account as it was a cash distribution.

The process for entering this transaction is identical to the simple split until the “Details” screen. You will need to create an split entry in each Investment Account:Stock account combination that has shares splitting.

图 9.44. Selection Of A Stock Account In The “Stock Split” Assistant—Moderate

An image of the stock split assistant at step 2 - Selection of Account/Stock (Investment Account:T).

Select the Assets:Investments:Brokerage Account:Stock:T and click on Forward.

The next screen presents 5 fields in the Stock Splits Details window:

Date

Enter the date of the split. Here we’ll enter November 18, 2005.

Shares

The number of shares increased (or decreased) in the transaction. In this example it is a 0.77942 for 1 split so the number of shares will decrease from the number of shares currently in the register. You may use GnuCash’s ability to perform calculations on an entry form by entering data directly ( 0.77942*100 − 100) to calculate the decrease in shares from the split.

Description

The Description should give a brief explanation of the transaction.

New Price

If desired the new price of the stock, after the split, may be entered.

Currency

The currency of the transaction is required. This should be the same as the stock purchase currency.

Click on the Forward button.

图 9.45. Split Details In The “Stock Split” Assistant—Moderate

An image of the stock split assistant at step 3 - Split Details.

The next screen will be skipped in this example as there was no “Cash in Lieu”.

A final “Finish” screen will give a last option to Back to modify any data entered or Apply to complete the stock split with the data entered.

图 9.46. The T Account After A Moderate Stock Split

An image of the Investment Account:T register after a stock split transaction that decreases the shares.

第 10 章 Reports

GnuCash is a powerful double entry accounting software package that allows users to enter and track their money in a reliable manner. However, putting this information into GnuCash is only a part of the process. To be truly helpful, you need to be able to extract this information in meaningful ways. GnuCash's reporting features allow you to just that.

GnuCash's reporting features allow you to display nearly any group of transactions in a wide variety of formats. This makes it easy to answer questions about your finances, such as “How much did I spend on groceries last month?” or “How much did I earn in the previous six months?”

GnuCash includes a number of common report types, which can be modified to meet your specific needs. If these common reports are insufficient, it is possible to modify or even write your own custom reports (although this is not recommended for beginners).

Overview

There are many standard reports pre-built in GnuCash, all available from the Reports pulldown menu in the main account window.

When you select a report from the list of reports, that report is first run with its default settings. Once you have opened the report, you can modify its parameters by clicking on the Options button on the toolbar. Under Options, you will see the different settings that you can change for each report. Note that for different reports, the options will be different.

Saved Reports Configurations Concepts

Once you have modified a report to meet your needs, you may wish to save that report for reuse at a later point. GnuCash allows custom reports to be saved, using the Save Report Configuration command.

过程 10.1. Save a report configuration

1. Go to the Reports Menu and choose the desired report.

2. Change the settings on the report until it includes what is needed.

3. Go to the General tab of the report's options and change the Report Name to something meaningful (Do not confuse this with the Report Title.)

4. Apply the changes and close the dialog.

5. Click the Save Report Configuration or Save Report Configuration As... button.

This will store the report options in a file in your home directory.

The first time you save a report with a name that has not already been saved, you can use either the Save Report Configuration or the Save Report Configuration As... button. You can modify the report name before saving it.

Once a report has been saved with the current name, the Save Report Configuration button will immediately update the saved report configuration. Use the Save Report Configuration As... button to save the current report configuration with a new name.

Saved report configurations are available for use under the Reports → Saved Report Configurations entry. They will also be available for use on multicolumn reports.

Saved report configurations can be deleted in the Saved Report Configurations dialog by clicking the trashcan icon.

To edit saved report configurations, open the report via Reports → Saved Report Configurations , edit and apply the new options, and click Save Report Configuration.

Standard Reports Overview

The standard reports that are included in GnuCash are presented in this section. For each report, a short description is given, which explains what the report is intended to show and its primary purpose. We begin with a description of the Transaction Report, which is an all-purpose report with many features and settings that allow sophisticated examination of the data in a file.

Transaction Report

The Transaction Report is a fundamental report that allows users to retrieve a wide variety of useful information from the financial records. The report includes many features that allow powerful and flexible reporting from the single basic report.

- Debit and Credit subtotals can be displayed, and within a grouping section, if debit totals > credit totals, the group subtotal will be displayed in the debit column.

- Multiple data columns enable display of transaction amounts in report currency and original currency in separate columns.

- Additional sortkeys e.g. sort by reconcile status (unreconciled -> cleared -> reconciled), sort by weeks, allow additional views into the financial records.

- Full text filter enabled for description, notes and memo, and for account full names. This allows easier selection of source account names and tailored reporting. Filters can optionally use full POSIX regular expressions.

- Indenting of columns will indent the report columns for easier understanding of grouping and sorting. (This is now enabled by default for GnuCash 3.0 onwards)

- Subtotal table is useful to understand the relationship in the data. This feature compiles the primary and secondary subtotals into a table view, allowing additional insight into financial records, e.g. account subtotals in different time series.

For further ideas on how to use the Transaction Report to produce common reports, see Using the Transaction Report.

Assets & Liabilities Group

Reports in this group provide general information about assets and liabilities.

Advanced Portfolio

The Advanced Portfolio produces a report on commodity accounts (stock and mutual fund type accounts) using price information stored in the GnuCash price database and within the GnuCash transaction data. If you do not have stock price information in your file, the report will indicate an error. This report includes extended information about commodity holdings, including information about the basis, gain, and return of individual commodities.

Advanced Portfolio Capital Gains

The Advanced Portfolio report doesn’t use the capital gain splits to calculate capital gains. It calculates the gains from the various buy and sell transactions in the account without regard to whether the gains and losses are recorded or not. Any realized gain splits are ignored. Realized gain splits are recognized as two splits, one in the stock’s account with a zero number of shares and a non-zero value, the other in an income or expense account with a value that is the negative of the split in the stock account. These two splits can be in a separate transaction (as created by scrubbing) or in the same transaction as the sale (this will cause incorrect future scrubbing). The income or expense split can be split into multiple splits, say for taxable/non-taxable or short/long term gains, without affecting this report.

Asset Barchart

The Asset Barchart presents the value of assets on a monthly basis in barchart form. By default, the report displays the eight largest accounts that have specific asset types assigned to them, and it displays bars for the current financial period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Bars" option will display more bars in the chart, allowing information for more accounts to display. Additionally, the "Show table" option enables the display of chart information in tabular form below the chart.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Asset Piechart

The Asset Piechart presents the value of assets on a monthly basis in piechart form. By default, the report shows the seven largest accounts, that have specific asset types assigned to them, arranged in descending order by value as of the end of the current accounting period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Slices" option will display more slices in the chart, allowing information for more accounts to display.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Average Balance

The Average Balance report displays monthly averages for the current accounting period.

Balance Sheet

The Balance Sheet lists Asset, Liability, and Equity account balances for all such accounts, and provides totals as of a given date. Balance sheets are commonly run for the last day of each fiscal year to give an overall sense of the financial condition of the entity.

General Journal

The General Journal produces a register of all transactions (beginning to end) in order by date, showing the accounts and the amounts involved, and totals the Net Change by all currencies and assets.

This report is not customizable by date or account, though you can include more or fewer details about the individual transactions, and whether to include running balances and totals for the credits and debits. If you need a report restricted to particular accounts, consider the Transaction Report or open a particular account and choose the Account Transaction Report.

General Ledger

The General Ledger produces information about all transactions for a selected set of accounts. When first run, this report loads no data, and the report options must be changed to retrieve information from the file.

Investment Lots

图 10.1. The Investment Lots Report

The Investment Lots report shows details about lots in a selected set of accounts of type Stock or Mutual Fund (see “Selling Shares with Automatic Calculation of Capital Gain or Loss Using Lots”一节). It includes an optional capital gains summary chart and a table with columns for dates, purchases, sales, end balances, capital gains (realized and unrealized, short term and long term), and return on investment (ROI). It also performs optional lot validation checks.

The report can help answer questions such as:

- Which lots are best candidates for tax loss/gain harvesting?

- What capital gains have been realized for a particular time period (i.e. this year, last year, etc)? Are they long term or short term gains?

- Which lots held longer than 1+ years have the largest unrealized gains, and would therefore be most advantageous (tax-wise) if donated to charity?

- Are the lots (and related accounts and splits) well-formed?

For more details, see the Investment Lots report documentation in the Manual.

Investment Portfolio

The Investment Portfolio produces a report of commodity accounts (that is, accounts with type "Stock" or "Mutual Fund"), giving holdings, price and value information about commodities in the file.

Liability Barchart

The Liability Barchart presents the value of liabilities on a monthly basis in barchart form. By default, the report displays the eight largest accounts that have specific asset types assigned to them, and it displays bars for the current financial period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Bars" option will display more bars in the chart, allowing information for more accounts to display. Additionally, the "Show table" option enables the display of chart information in tabular form below the chart.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Liability Piechart

The Liability Piechart presents the value of liabilities on a monthly basis in piechart form. By default, the report shows the seven largest accounts, that have specific asset types assigned to them, arranged in descending order by value as of the end of the current accounting period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Slices" option will display more slices in the chart, allowing information for more accounts to display.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Net Worth Barchart

The Net Worth Barchart summarizes Asset accounts, Liability accounts, and overall Net Worth as bars on a graph on a monthly basis for the current financial period. This report provides a graphic overview of the file over time.

Net Worth Linechart

The Net Worth Linechart summarizes Asset accounts, Liability accounts, and overall Net Worth as a line graph on a monthly basis for the current financial period. This report provides a graphic overview of the file over time.

Price Scatterplot

The Price Scatterplot displays the value of one commodity relative to another commodity, for example the value of a stock relative to a currency. When first run, this report loads no data, and the report options must be changed to retrieve information from the file. Specifically, the "Price of Commodity" setting on the Price options tab must be changed to a specific commodity.

Budget Group

Budget reports in GnuCash allow you to gather summary information related to budgets you may have created. In order for these reports to work, you must first create a budget. The reports in this group are specifically based on budget information. To use these reports, you need to have a budget saved in your file.

Budget Balance Sheet

Budget Barchart

Budget Flow

Budget Income Statement

Budget Profit & Loss

Budget Report

Business Group

Reports in this group provide general information about activities related to a business.

Customer Report

Customer Summary

Customer Summary is a customer profit report that can help with job analysis by comparing the income and expenses for a specific customer.

All invoices have an Owner in GnuCash, so invoices that are made will show a customer and show in the report. When creating a Bill, the Default Chargeback Customer is blank. To use the profit report, this field needs an entry, since this is the tag that decides the line to which to attach the expense. Left blank, the bill will be assigned to "No Customer." Similarly, when income is entered directly in a register rather than creating an invoice, it will also be assigned to "No Customer."

Thus, if this report includes an entry for "No Customer", this means that the report may be inaccurate, as the results are not all properly labeled.

Possible use scenarios include:

- Tracking retail sales from different cities

- Tracking rental properties

- Tracking types of business

- Tracking commission sales

Each of these scenarios assumes that the account structure includes breakdowns for individual tracked categories. Changing settings on the Income and Expense tabs under Options can hone the information displayed. By default all income and expense accounts are included; however, since GnuCash can't really predict the names and classification of income and expense accounts, it must group them all into the "No Customer" entry.

Note that inventory-based businesses won't benefit from this report because of its nature.

Useful options:

- The Expense Accounts tab allows the selection of one or more expense accounts.

- The Income Accounts tab allows the selection of one or more income accounts.

- The Display tab allows sorting by name, profit percentage, or amount of profit.

Easy Invoice

Employee Report

Fancy Invoice

Payable Aging

Printable Invoice

Receivable Aging

This report provides a listing of all customers, their current balance, and how much they have outstanding from invoices over different time periods&mdash;how much they owe from 0-30 days, from 31-60 days, from 61-90 days, and over 90 days. The report also contains links to each customer and to their current customer report.

Vendor Report

Income and Expense Group

Reports in this group provide information about Income and Expense

Cash Flow

This report shows the change in value for a set of accounts (the flow of cash) over a given period of time. By default, this report is based on accounts in Assets and Special Accounts, and covers the current financial period. The report enumerates all money coming in to and going out of the base accounts, broken down by the other account.

Equity Statement

This report can be seen as extension of the Balance Sheet report. The Balance Sheet states the balance of Assets, Liabilities and Equity at a specific point of time. The Equity Statement focuses on the Equity Accounts by showing the cash flow to and from them for a given period of time.

By balancing this cash flow with income, the report shows the available capital at the beginning and end of the selected time period.

Expense Barchart

The Expense Barchart presents the value of expenses on a monthly basis in barchart form. By default, the report displays the eight largest accounts that have specific expense types assigned to them, and it displays bars for the current financial period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Bars" option will display more bars in the chart, allowing information for more accounts to display. Additionally, the "Show table" option enables the display of chart information in tabular form below the chart.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Expense Piechart

The Expense Piechart presents the value of expenses on a monthly basis in piechart form. By default, the report shows the seven largest accounts, that have specific expense types assigned to them, arranged in descending order by value as of the end of the current accounting period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Slices" option will display more slices in the chart, allowing information for more accounts to display.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Expenses vs. Day of Week

Expenses vs. Day of Week presents a pie chart showing the totals for selected expense accounts totaled by the day of the week of the transaction. The report options enable you to make some adjustments (such as accounts, display options, and the date range) but the account selector only allows expense accounts to be chosen. The report aggregates expense transactions by day of week, not by any other period or category. Due to these limitations, the report may be considered a demonstration or an example to someone wanting to examine the source code for composing a useful custom report.

Income Barchart

The Income Barchart presents the value of income on a monthly basis in barchart form. By default, the report displays the eight largest accounts that have specific income types assigned to them, and it displays bars for the current financial period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Bars" option will display more bars in the chart, allowing information for more accounts to display. Additionally, the "Show table" option enables the display of chart information in tabular form below the chart.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Income & Expense Chart

Income Piechart

The Income Piechart presents the value of income on a monthly basis in piechart form. By default, the report shows the seven largest accounts, that have specific income types assigned to them, arranged in descending order by value as of the end of the current accounting period.

Several settings on this report can greatly affect the information included.

- On the Accounts tab, the "Show Accounts until level" option changes how the report aggregates account totals. Change this value to see information at deeper levels of the account structure.

- On the Display tab, the "Maximum Slices" option will display more slices in the chart, allowing information for more accounts to display.

- On the General tab, the "Price Source" option can significantly affect the reported value of various commodities included in the report.

Income Statement

This report lists Income and Expense account totals for a set period. By default, it shows all Expense and Income accounts down to 3 levels of sub-accounts for the current financial period.

An Income Statement is also called a "Profit and Loss" report or "Revenue Statement."

In earlier versions of GnuCash, this report was called "Profit & Loss," but with version 2, the report was renamed "Income Statement" to use more common accounting terminology.

The Income Statement helps show where money is coming from and where it is going for a given time period.

Income vs. Day of Week

Income vs. Day of Week presents a piechart showing the totals for selected income accounts totaled by the day of the week of the transaction. The report options enable you to make some adjustments (such as accounts, display options, and the date range) but the account selector only allows income accounts to be chosen. The report aggregates income transactions by day of week, not by any other period or category. Due to these limitations, the report may be considered a demonstration or an example to someone wanting to examine the source code for composing a useful custom report.

Trial Balance

Trial Balance lists the ending balances in all accounts as of a particular date. It is typically run at the end of an accounting period and is primarily used to ensure that the total of all debits equals the total of all credits.

Income and GST Statement

The Income and GST Statement is a specialised Transaction Report designed to print Business-related Sales and Receipts, as well as their GST or VAT components. This report is designed for use in Australia, but is also usable in any jurisdictions implementing value-added taxes (or goods and services taxes) during regular business sales and receipts; and the business owner is expected to submit periodic reports of total sales, purchases, and taxes collected on sales from clients or paid to a supplier.

This report makes some assumptions upon the accounts used for sales, purchases, and taxes collected on sales, and paid on purchases.

- Net Sales must be an Income-type account

- Net Purchases must be an Expense-type account

- GST/VAT on Sales must be a Liability-type account

- GST/VAT on Purchases must be an Asset-type account

- There may be multiple GST accounts, e.g. reduced GST, standard GST etc. The GST accounts can be printed individually, or summarised for sales and purchases.

- There may be multiple sales and expenses accounts, e.g. Income:Sales, Income:Grants, Expenses:Suppliers, Expenses:Marketing, Expenses:Insurance. These amounts may be reported individually, or summarised for sales and purchases.

- The transactions may be entered manually as a multi-split transaction, or they may be entered via the Business Invoices and Bills tools.

As an example, consider a business has the following transactions: It incurs sales of $1,000 plus 5% GST, receiving $1,050. It also incurs GST-exempt sales of $600. It purchases goods/services worth $400 plus 5% = $420. The following transactions will record the business activities:

表 10.1. Sample Chart of Accounts for Income and GST Statement

Date

Description

Account

Debit

Credit

01/01/2018

Sales $1,000 + 5% GST

Income:Sales

$1,000

GST on Sales [Liability]

$50

Asset:Bank

$1,050

02/01/2018

GST-Free Sales $600

Income:Sales

$600

Asset:Bank

$600

03/01/2018

Purchase $400 + 5% GST

Expenses:Purchases

$400

Asset:Bank

$420

GST on Purchases [Asset]

$20

For the Income and GST Statement, the Accounts selected will be the Income and Expense Accounts, and the Tax accounts are used to select the GST accounts. The GST period is selected via the General tab. The resulting report is shown as follows:

表 10.2. Income and GST Statement

Date

Description

Total Sales

Net Sales

Tax on Sales

Total Purchases

Net Purchases

Tax on Purchases

01/01/2018

Sales $1,000 + 5%

$1,050

$1,000

$50

02/01/2018

GST-Free Sales $600

$600

$600

03/01/2018

Purchase $400 + 5% GST

$420

$400

$20

Totals

$1,650

$1,600

$50

$420

$400

$20

This report would indicate that there was a total of $50 GST collected, and $20 GST on purchases, therefore a $30 GST liability is payable to the authorities.

Sample & Custom Group

The reports in this group offer examples on how reports can be customized or modified to suit personal need.

Custom Multicolumn Report

This report provides a base that allows several standard and custom reports to be combined into one view. Note that this report opens with an empty window; you must open the options and designate which reports to include for display. Once the reports have been selected, the settings for individual reports in the multicolumn display can be edited.

Sample Report with Examples

This is a sample report that users can examine to learn how to write their own reports.

Welcome Sample Report

This report demonstrates how the Multicolumn Report can be use to create custom dashboard-type reports.

Other Reports

Several reports are included on the main Reports menu. These are described below.

Account Summary

This lists the balances of all accounts and subaccounts as of a particular date. By default, this report shows accounts and totals down to third-level subaccounts.

This report gives effectively the same information as the Chart of Accounts. You can use this report to export and print the Chart of Accounts.

注意

To generate a report of account totals over a particular time period (especially if you do not close your books at regular intervals), you might consider using the Income Statement, or Cash Flow reports.

Balance Forecast

This creates a balance chart which aims to track asset (or any other account type) balances, including amounts from future scheduled transactions. The balances will include all regular booked amounts and future amounts from numeric scheduled transaction templates.

This report can also add additional data charts to forecast future minimum balances. Reserve line can be displayed to confirm if future minimum will dip below the reserve amount. A target line may also be displayed above the reserve line for financial planning.

Future Scheduled Transactions Summary

Tax Report & TXF Export

Generates a report and a downloadable .txf file of taxable income and deductible expenses for a particular accounting period. To download the report data, choose the Export button on the toolbar and choose between html and .txf downloadable versions.

To use this report, you must use Edit --> Tax Options to identify which form the taxing authority uses for each income or expense account. Note that you can see but not modify the "Tax related" checkbox in Edit --> Edit Account.

Saved Report Configurations

Selecting this will open a dialog with a list of available Saved Report Configurations. "Saved Report Configurations" means sets of customized settings for standard reports.

These sets must be saved by the user before they appear here. See Report Concepts above for instructions on how to save report configurations.

Account Report

The Account Report menu entry only appears when an account register is the active tab. This report produces a list of all transactions in the open register.

Note that if you conduct a search that retrieves several transactions, the results are displayed in a new search register, which can then be used to create a report for just those transactions.

Account Transaction Report

This report also only appears when an account register is the active tab. However, this report only lists transactions that have been selected (e.g. by mouse click) in the current register. If no transactions are selected, an empty report will be generated.

Using the Transaction Report

The Transaction Report can be heavily customised to produce most reports appropriate for personal finance and business bookkeeping purposes. It aims to retrieve and filter information from the database, and present transactions and totals, useful for the user and the accountant.

The following guide to the Transaction Report will assume the user has set up the chart of accounts according to conventional bookkeeping practice. For example, the following describes a typical household book with skeleton accounts. Further accounts will undoubtedly be necessary.

表 10.3. Sample Chart of Accounts for the Transaction Report

Account Name

Account Type

Asset

ASSET (placeholder)

Asset:Bank

BANK

Asset:Property

ASSET

Liability

LIABILITY (placeholder)

Liability:Credit Card

CREDIT CARD

Liability:Home Loan

LIABILITY

Income

INCOME (placeholder)

Income:Salary

INCOME

Income:Interest

INCOME

Expense

EXPENSE (placeholder)

Expense:Groceries

EXPENSE

Expense:Auto

EXPENSE

Expense:Medical

EXPENSE

Equity

EQUITY (placeholder)

Equity:Opening Balances

EQUITY

Conventionally, the oldest transaction would be equity transfers from Equity:Opening Balances to Asset and Liability Accounts. Most subsequent transactions would be transfers from Income/Expense accounts to Assets/Liability accounts (representing day-to-day activity e.g. receiving salary, paying utility bill), or transfers between assets and liability accounts (representing movements between loans and assets, e.g. paying credit card bill, receiving a loan).

The following use cases will be illustrated, and the options to be selected explained:

Using the Transaction Report to show previous year expenses

The Transaction Report can show how much was spent on expense accounts last year. This will usually be the most useful basic transaction report format. To create this report:

1. Open the report options, from the Accounts tab, click the Expense placeholder account and Select Children.

2. From the General tab, Choose relative dates “Start of Previous Year” and “End of Previous Year”.

3. From the Sorting tab, set Primary Key to Accounts, and enable Primary Key Subtotal.

4. Set the Secondary Key to Date, and set the Secondary Key Subtotal to None.

Secondary level grouping

The following will modify the above Transaction Report to use a secondary grouping strategy. The first grouping (i.e. Primary Key = Accounts, Subtotal = enabled) will group transactions from the same accounts, whereas the secondary grouping (i.e. Secondary Key = Date, Subtotal = Monthly) will also calculate monthly sums within each account.

1. Select options as above

2. From the Sorting tab, set Secondary Key Subtotal to Monthly

Using secondary grouping for periodic comparison

The Display / Subtotal Table adds a subtotal summary table, which will ease comparison of accounts across date periods. This displays the same subtotal calculations as the main table, presented in a grid structure.

In addition, if there are multiple primary-key groups (e.g. Date grouping with monthly subtotals, across multiple months) the subtotal table will also compute and display the primary-key grouping Average. The average is computed as the total amount per row, divided by the number of columns. This may cause confusion when computing monthly spend averages, for instance, if a month has no transactions and is not displayed in the table, it will not create a corresponding column in the table, therefore the average amount will not reflect a true monthly average.

1. Select options as above

2. From the Display tab, enable the Subtotal Table.

Use filtering to limit accounts and transactions

Accounts and transactions can be filtered for reporting according to account full name (e.g. ":Business:" will select account structure Income:Business:Sales, Income:Business:Grants, Expenses:Business:Rent, Expenses:Business:Utilities) or transaction description/notes/memo (select transactions tagged #gift). The filtering text may be either a standard string, or a POSIX regular expression.

1. From the Filter tab, complete the Account Name Filter, or Transaction Filter. Optionally toggle the regular expression check boxes to toggle full POSIX regex matching. Regular expressions will allow more complex queries e.g. the transaction filter can be set to (#gift|#travel) which will filter transactions with either #gift or #travel. They can be complicated and are best learned from external guides.

Using the Transaction Report to generate a reconciliation statement.

This sortkey 'reconcile status' will separate reconciled, cleared and unreconciled transactions. This report may be useful in producing a printable reconciliation report.

Alternatively, the Reconciliation Report will preset these defaults and requires only the Accounts selection.

1. From the Accounts tab, select the relevant bank or credit card account

2. From the General tab, choose an appropriate date range e.g. past 3 months

3. From the Sorting tab, set the Primary Key to Reconcile Status, Primary Key Subtotal to enabled, and set the Secondary Key to Date. The Secondary Date Subtotal is left to None

第 11 章 资本利得

本章会介绍一些方法，以跟踪未实现损益和已实现损益，也即众所周知的资本利得。

基本概念

像是股票、债券、房屋或汽车这样的可再次出售的资产可能会随时间发生价值的变动。一些资产的价值可能会增加，而另一些资产的价值可能会减少。能够跟踪这些随时间变化的资产价值是十分重要的，本章会介绍具体做法。

你拥有的一切东西都可能会随时间发生价值的增减。所以问题在于到底要跟踪哪些资产的价值变化。一个简单的回答是你只需跟踪那些将来可能出售以换取现金，或涉及缴税的资产。

显然，消耗品或一次性用品（如食品、汽油或打印纸）无需跟踪其价值变化。因此，尽管你刚买的新衣服确实会折旧，你也不应该跟踪衣服的折旧，因为你不会想着重新出售这件衣服，以后也不会为这件衣服缴税。所以，对这个例子而言，买新衣服应该记录为纯粹的费用——你花出去了一些钱，于是一切就结束了。

资产增值指资产价值随时间增加。当你持有的资产价值增加时，初始购买价格与当前价值间的差额就是所说的未实现损益。当你出售资产时，你赚取的利润就是所谓的已实现损益或资本利得。有很多可以产生未实现损益并最终实现资本利得的资产，例如上市公司的股票。

估值

正如前文简介提到的那样，资本利得是由出售资产得到的利润。下面这一节会介绍怎样在GnuCash中记录资本利得。

处理资产增值会计方法与折旧稍有不同，因为一般你只关心卖出资产并实现资本利得的时刻。资本利得是税务领域中的重要主题，因为政府往往对使用各种方法就资本利得收税特别感兴趣。

注意

事情总会有例外情况。如果你持有到期一次性结息的债券，税务部门常常会要求将每年的利息划分清楚，并拒绝将之视为资本利得。研究清楚适合的税务代码，以便为每种你拥有并可能涉及资本利得税的资产确定最合适的应对方法。

评估资产的价值增加通常并不简单，因为直到售出那一刻之前都难以知晓资产的确切价值。

在股票交易所等公开市场每日交易的证券或许是最容易预估其价值的一类资产，以市场价出售这类资产可能简单到只需要给经纪人打电话下单。另一方面，估计房屋的价值更加困难。房屋的出售量常常比股票少，出售时往往还要花很多时间和精力进行协商，这意味着对价值的估计不会很准确。类似地，出售二手汽车也涉及协商的过程，同样会使价格不易预测。

估计珠宝、艺术品、棒球卡等收藏品的价值更是难上加难。收藏品市场比证券市场封闭得多，与房屋市场相比也更不透明。更糟糕的是那些独一无二的资产。常常工厂里会有为生产特定产品而花几十、几百万元定制的挤压设备或模具，这类设备可能离开某个特定的场景就毫无价值了。这种情况下，资产可能会被评估出几个相互冲突的估值，其中没有哪个是清晰准确的。

估计未实现损益的一般性经验法则是你只应该为股票这样买卖方便、估值准确的资产重新估值。对于所有其它资产，最好等到出售的时候再具体确定资本利得。当然，这方面也没什么硬性准则，实际上不同会计师的处理习惯也不尽相同。

建立科目

重要

下面会创建未实现损益科目，为了便于理解未实现损益的概念，会在这个科目中录入估计的未实现损益。然而，如果不是在实际会计事务中采用国际财务报告准则的大企业，那么记录未实现损益不是必要的。使用GnuCash的小型企业用户不应该记录未实现损益，只要在确定已实现损益之后再记录就足够了。

与多数会计实操一样，建立资本利得科目也有很多不同的方式。这里只会介绍常用的方法，但多数情况下也足够灵活了。需要的第一个科目是名为成本的资产类科目（GnuCash科目类型为资产），这个科目简单地用来记录最初的资产购入。资产购入通常记录为从银行科目转出资金的交易。

跟踪资产增值还需要另外三个科目。第一个科目是未实现损益资产类科目，用于累计增值金额。未实现损益资产科目借助未实现损益收入科目平衡账目，用于定期记录所有资产增值收入。最后还有一个收入科目是必需的，称为已实现损益，用于记录出售资产时实际的资本利得。

下面是一个用于跟踪物品甲和物品乙两项资产的通用科目结构。资产:固定资产:物品甲:成本科目借助资产:流动资产:储蓄存款科目实现平衡；资产:固定资产:物品甲:未实现损益科目借助收入:未实现损益科目实现平衡。物品乙与之同理。

-资产

-流动资产

-储蓄存款

-固定资产

-物品甲

-成本

-未实现损益

-物品乙

-成本

-未实现损益

-收入

-已实现损益

-未实现损益

示例

假定你购入了一项资产，比如德加的画作，希望它能够增值，同时想跟踪其价值变化。（保险公司很关心这个事情，即使其它人都不会在意。）

首先仿照“建立科目”一节建立科目结构，只不过将物品甲换成德加并删去物品乙科目。假定德加的画作初始价值为十万元。一开始你的银行账户中有100,000元，然后将这笔钱从银行账户转到资产:固定资产:德加:成本科目（资产购入交易）。现在主科目窗口应该如下所示：

图 11.1. 购入资产后的主窗口

主窗口的初始显示。

未实现损益

过了一个月，你有理由认为画作的价值增长了10,000元（未实现损益）。为了记录增值，从收入:未实现损益科目转出10,000元到资产:固定资产:德加:未实现损益科目。主窗口现在如下所示：

图 11.2. 记入资产增值后的主窗口

添加未实现损益后的科目表。

出售

假定又过了一个月，德加的画作价格又涨了一些，你估计这次增值有20,000元。你将这20,000元及时记录为未实现损益收入，就像上面那样，并随后决定出售这份画作。

现在有三种可能的情况。你估计的未实现损益可能是估计准确的，可能被高估，也可能被低估了。

1. 未实现损益估计准确。

你对画作的乐观估值是正确的。首先你需要将盈利记录为已实现损益，而非未实现损益。具体操作是将收入由收入:未实现损益转至收入:已实现损益。

其后，你需要按画作的出售价格贷记银行科目。这些钱刚好来自于资产:固定资产:德加的子科目。将资产:固定资产:德加:成本的全部金额转到资产:流动资产:储蓄存款，再将资产:固定资产:德加:未实现损益的全部金额转到资产:流动资产:储蓄存款。

这些交易现在应该如下所示：

表 11.1. 将未实现损益调整为已实现损益——估计准确的情况

科目

转账至

交易金额

科目余额

收入:未实现损益

收入:已实现损益

￥30,000

￥0

资产:固定资产:德加:成本

资产:流动资产:储蓄存款

￥100,000

￥0

资产:固定资产:德加:未实现损益

资产:流动资产:储蓄存款

￥30,000

￥0

现在，资产:流动资产:储蓄存款科目总计130,000元，收入:已实现损益科目总计30,000元。

图 11.3. 出售资产后的主窗口

录入已实现损益后的科目表。

2. 未实现损益被高估。

你对画作的价值过于乐观了。你认为画作值130,000元，而得到的报价只有120,000元。但你还是决定出售，因为在你看来这120,000元比画作更值钱。估值稍有变化，但差距也不算夸张。

交易现在应该如下所示（注意最后一项交易平衡了未实现损益科目）：

表 11.2. 将未实现损益调整为已实现损益——高估的情况

科目

转账至

交易金额

科目余额

收入:未实现损益

收入:已实现损益

￥20,000

￥10,000

资产:固定资产:德加:成本

资产:流动资产:储蓄存款

￥100,000

￥0

资产:固定资产:德加:未实现损益

资产:流动资产:储蓄存款

￥20,000

￥10,000

资产:固定资产:德加:未实现损益

收入:未实现损益

￥10,000

￥0

现在，资产:流动资产:储蓄存款科目总额120,000元，同时收入:已实现损益总额20,000元。

3. 未实现损益被低估。

你成功地把画作卖了一个你做梦都想不到的价格，150,000元。额外的价值同样记录为收益，也就是收入。

交易现在应该如下所示（注意最后一项交易平衡了未实现损益科目）：

表 11.3. 将未实现损益调整为已实现损益——低估的情况

科目

转账至

交易金额

科目余额

收入:未实现损益

收入:已实现损益

￥50,000

￥-20,000

资产:固定资产:德加:成本

资产:流动资产:储蓄存款

￥100,000

￥0

资产:固定资产:德加:未实现损益

资产:流动资产:储蓄存款

￥50,000

￥-20,000

收入:未实现损益

资产:固定资产:德加:未实现损益

￥20,000

￥0

现在，资产:流动资产:储蓄存款科目总额150,000元，同时收入:已实现损益总额50,000元。

缴税

不同国家间的税收政策差别迥异，所以介绍全世界通用的相关知识几乎是不可能的。然而共同的一点是，资本利得收入在资产被实际卖出之前不涉及缴税，不过也有例外。北美住宅拥有者通常会发现，当他们出售个人住所的时候，资本利得免于征税。其它一些国家对住宅出售的处理似乎有所不同，会对这样的收益收税。例如，德国政府会在持有房产少于十年的情况下会对这些收益征税。

克里斯·布朗分享了这样一个故事，在他职业报税日的时候，有一家人想要出售农场，本以为会收到金额巨大的税单，但由于在1971年之前就拥有了这块地产，结果缴税额几乎为零。同时，由于是一家奶牛场，还获得了一些奇奇怪怪的金额扣除。故事的关键在于尽管相关事实十分简单，但税务机制经常会把事情搞得复杂得可怕……

第 12 章 Multiple Currencies

This chapter will show how to set up GnuCash accounts to use multiple currencies.

Basic Concepts

GnuCash supports over a hundred currencies, from the Andorran Franc to the Zimbabwe Dollar. For example, you can have a bank account set up in Euros, and another using Hong Kong Dollars.

Some of the issues which arise when using multiple currencies are as follows:

- How do you transfer funds between accounts with different currencies?

- How do you calculate the overall value when you have mixed currency accounts?

- How do reports deal with mixed currencies?

You can either deal with multiple currencies using manually entered transactions to record currency gains and losses as described in “Manually Recording Currency Transaction”一节 or you can utilize currency trading accounts introduced with GnuCash version 2.3.14 to automatically record the gains and losses on transactions between currencies as described in the subsequent section. Trading accounts are not enabled by default in GnuCash and must be explicitly enabled as described in “Automatically Recording Currency Transactions using Trading Accounts”一节.

Manually Recording Currency Transaction

Account Setup

Your default account currency is set in the Account tab under Edit → Preferences ( GnuCash → Preferences on macOS).

Similarly, GnuCash offers an option to set your preferred currency for displaying reports (like the balance sheet and income statement). The option is called Default Report Currency, and is in the Reports tab of the GnuCash Preferences screen. You’ll want to set both options when you start using GnuCash because if (for example) your accounts are all in Canadian Dollars but the generated reports are all in US Dollars, the reports will just say that there are “no data/transactions (or only zeroes) for the selected time period”.

When you create a new account, you have the option to define the commodity in which that account is denominated. For accounts denominated in a currency, you can specify any of the currencies supported by GnuCash by simply selecting it from the currency commodity list. You will notice that the default currency is the currency that is defined for the parent account of the new account.

As an example, let’s set up a bank account scenario where you mostly work in US Dollars, but do also have a European bank account using the Euro currency, as well as one bank account in Hong Kong using Hong Kong Dollars. So, set up 3 bank accounts, one denominated in US Dollars, one using Euros, and the third in Hong Kong Dollars. One possible account structure for this would be:

-Assets (USD)

-Current Assets (USD)

-US Bank (USD)

-European Bank (EUR)

-HK Bank (HKD)

-Equity (USD)

-Opening Balances (USD)

-USD (USD)

-EUR (EUR)

-HKD (HKD)

注意

The currency of each account is shown in parenthesis.

Since in this example you mostly work in USD, all of the parent accounts are set to USD. Of course, if you mostly work in Euros, you could change the currency of these parent accounts to EUR. The totals shown in the account tree window will always be converted to the currency of each particular account. Notice, we also set up 3 Opening Balances equity accounts, used to initially populate the 3 banks.

注意

You could also set up just a single Opening Balance account and use a currency transfer to populate the “different currency” accounts. However, this is more advanced option, which is explained in a later section (“Purchase of an Asset with Foreign Currency”一节).

Below you see the result of this example, in which you start with 10,000 USD, 10,000 EUR as well as 10,000 HKD in the three bank accounts. Notice that the total of the parent accounts only shows the value of the currency of sub-accounts with matching currencies. In other words, the Total Assets and Total Equity values only reflect USD amounts, because GnuCash has no way of evaluating the value of EUR or HKD yet. Once you set up exchange rates between the currencies, the parent accounts will calculate the converted value of all sub-accounts. See the later section (“Recording and Updating Currency Exchange Rates”一节) on ways to do this.

图 12.1. Initial multi currency Account Bank Setup

Initial setup of 3 bank accounts with different currencies.

Notice that the Total (Report) column is being displayed. This is configured in the column header row, select Arrow down and select Total(USD).

User-Defined Currencies

Usually when we talk about currencies, we mean government-backed currencies (or more precisely, currencies defined in ISO 4217). GnuCash does not allow you to create your own currencies. If you want to track non-ISO currencies, you can use either of two workarounds, depending on which fits your needs better.

User-Defined Currencies Workarounds

Let’s say for example that you want to track loyalty points you’ve earned by buying from a certain group of businesses. The account which tracks your loyalty points will be Assets:Other:LoyaltyPoints.

1. Treat these as if they were a security—that is, like a stock or mutual fund.

In this workaround, you define a new security, of type FUND, called LoyalityPoints. This is pretty straightforward—when you create the new LoyaltyPoints account, just set the account type to Stock or Mutual Fund, click the Select... button next to the Security/currency: box, and click New to define a new security of type FUND.

This is not really what the stock and mutual fund account types are meant for, but GnuCash will allow it. The downside is that you’ll have to enter a “price” for every transaction involving this account, because GnuCash needs the prices to figure out the monetary value of the points and treat them as one of your assets.

2. Use one of the “dummy” currencies for them.

In this workaround, you use one of the dummy currencies to track the loyalty points. These currencies are “XTS (Code for testing purposes)” and “XXX (No currency)”. If you use one of these for your LoyaltyPoints account, you can enter transactions into the account without having to enter share prices for every transaction. And, you can keep using the same two dummy currencies to track all sorts of amounts—vacation dollars earned and used so far this year, vacation hours earned and used, health insurance benefits allowance used and remaining, and so on.

The drawback with this workaround is that you cannot define exchange rates for the dummy currencies to convert them to ISO currencies. If you want to do that, you really should use the first workaround.

Recording and Updating Currency Exchange Rates

GnuCash allows you to update the Currency Exchange Rates both manually and automatically. This process is essentially the same as setting share prices for investments (see “Setting Share Price”一节). In the following two sections we will work through both methods.

Before we start, let’s have a quick look at the Chart of Accounts.

图 12.2. Initial multi currency Account Bank Setup

Initial set up of 3 bank accounts with different currencies.

As you see, the overall balances do not yet reflect any value for EUR or HKD holdings. Adding currency exchange rates will fix this.

Manually Updating Exchange Rates

Open the Price Database by going to Tools → Price Database.

图 12.3. The Price Database Window—Still Empty

Click on the Add button to add a new currency exchange rate. A window will appear in which you can set up a new exchange rate. This window should appear like this:

图 12.4. Setup Of Euro Exchange Rate

Add Price Database Window

Set the Namespace to CURRENCY and the Security to EUR (Euro). Then set the exchange rate between the selected security and the selected currency. The Price box defines how many units of currency are required to purchase one unit of the security. In this case, how many dollars it will take to purchase on 1 Euro. In this example, you will set the exchange rate to 1 EUR for 1 USD.

图 12.5. The Price Database window after setting the exchange rate between Euros and US Dollars

图 12.6. Chart of Accounts After Setting The Exchange Rate Between Euro And US Dollar

Observe that since you have no exchange rate for HKD, GnuCash doesn’t convert the HKD accounts to USD. This will be added in the next section.

Automatic Updating Exchange Rates (How-To)

In the previous section you saw how to manually define a new currency exchange rate, but GnuCash includes an automatic price update feature, which will now be described.

Open the Price Database by going to Tools → Price Database.

图 12.7. Price Database Before Obtaining Online Quotes

Click on the Get Quotes button to automatically load the various exchange rates you need.

注意

If the Get Quotes button is disabled, that means that the Perl module Finance::Quote is not installed. For information on how to install it, please see “Configuring for Automatic Retrieval of Quotes”一节.

图 12.8. The Price Database After Obtaining Online Quotes

GnuCash downloads exchange rates for all currencies that are in use in your various accounts. This will happen every time you click on Get Quotes or request GnuCash to download quotes as per “Configuring for Automatic Retrieval of Quotes”一节.

Now when you check the main Chart of Accounts you will see that GnuCash has automatically converted the HKD amount to USD amount on the parent accounts that are in USD, as well as on the Total (USD) column. Also the Euro accounts have been been updated with the latest exchange rate.

图 12.9. The Chart of Accounts After Obtaining Online Quotes

Disabling Exchange Rate Retrieval

Whenever you create an account that uses a non-default currency, exchange rate retrieval will be automatically enabled for that currency. However, if you later delete that account, GnuCash will not automatically disable exchange rate retrieval for that currency.

If you have deleted the last account for a particular currency, and you do not wish to retrieve exchange rates for that currency anymore, do the following:

1. Open the Securities window by selecting Tools → Security Editor.

2. Make sure the Show National Currencies box is selected.

3. Expand the CURRENCY row.

4. Double click on the currency for which you want to disable exchange rate retrieval.

5. Deselect the Get Online Quotes box and click OK.

Recording Purchases in a Foreign Currency

Purchases in a foreign currency can be managed in two different options.

1. Use GnuCash's built-in currency exchange functions when you do your transactions. This is mainly used for one-time transactions, and nothing which happens regularly.

2. Use separate accounts to track transactions, where all involved accounts use the same currency. This is the recommended method, since it allows much better tracking and follow up. In this way, you do one currency exchange transaction, and after that you do normal transactions in the native currency.

The rest of this section will explain more based upon option “B”.

Purchase of an Asset with Foreign Currency

You are using USD as your default currency. But, you decide to purchase a boat in Jamaica. To do this, you opened a bank account in Jamaica, moved some money from the US, and then purchased your boat.

To record this in GnuCash we use the following basic account structure:

-Assets (USD)

-Current Assets (USD)

-US Bank (USD)

-Jamaican Bank (JMD)

-Fixed Assets (USD)

-Boat (JMD)

-Equity (USD)

-Opening Balances (USD)

-USD (USD)

注意

The currency of each account is shown in parenthesis.

First you need to transfer 10,000 USD to Jamaica, and you use your US bank account (with a balance of 100,000 USD) for that. The bank gives you an exchange rate of 1 USD = 64 JMD, but charges you 150 USD to transfer the money.

图 12.10. Transaction “Currency Transfer To Jamaica”

Select the Jamaica transaction line (9,850.00 USD), right click and select Edit Exchange Rate

图 12.11. Edit Exchange Rate

In this dialog the exchange rate of a currency transaction is specified.

As Exchange Rate, you enter 1 USD = 64 JMD, since this is the rate your bank gave. Press ok in the Transfer Funds (Edit Exchange Rate) window, and then save this split transaction. Below is how it now looks in the main Chart of Accounts.

图 12.12. Chart of Accounts before purchasing the boat

You choose to buy a boat for 509,000 JMD. To record this transaction in GnuCash, you will need to enter a simple transaction in Assets:Current Assets:Jamaican Bank withdrawing 509,000 JMD and transferring it to Assets:Fixed Assets:Boat.

图 12.13. The Chart Of Accounts After Purchasing The Boat

The Chart of Accounts now reflects that your bank account has been reduced by 509,000 JMD, and that your Fixed Assets boat account has been increased by the same amount. If you also have turned on the Chart of Accounts (Column Choice) Total (USD) you will see the corresponding value in USD. The USD value will always reflect the latest currency exchange rate you have either automatically or manually retrieved.

Purchasing Foreign Stocks

This example will show how to purchase stocks that are priced in a currency other than your primary currency.

Assume that you live in New York and therefore you have set the default currency to USD. You decide to purchase a stock traded in Hong Kong that is priced in HKD. You would also like to be able to track the various income and expense amounts per stock and broker.

You decide to purchase stock in the Beijing Airport (Hong Kong). The ticker for this stock is 0694.HK on Yahoo! Since you wanted to track all various income and expense amounts, here is the necessary account structure:

- Assets:Investments:Brokerage Accounts:Boom:0694.HK (0694.HK)

- Assets:Investments:Brokerage Accounts:Boom:Bank (HKD)

- Equity:Opening Balances:HKD (HKD)

- Expenses:Commissions:Boom:0694.HK (HKD)

- Income:Investments:Dividend:Boom:0694.HK (HKD)

The Chart of Accounts looks like this after creating all the needed accounts:

图 12.14. The Chart of Accounts For International Stocks

The stock definition can be seen in the Security Editor ( Tools → Security Editor.)

图 12.15. International Securities

If you have not moved money (50,000 HKD) into the brokerage cash account (Assets:Investments:Brokerage Accounts:Boom:Bank), do so now, either using the Equity (HKD) account, or an existing bank account (Currency Transfer).

There are two ways to enter the actual purchase transaction: you can enter it from the cash account (shown below), or you can enter it from the stock account.

注意

If entered from the stock account, the stock is assumed to be priced in the currency of the parent account.

Let’s assume that the stock price is 3 HKD per share. To record the purchase, open the brokerage’s HKD cash account (Assets:Investments:Brokerage Accounts:Boom:Bank), and enter the following:

Assets:Investments:Brokerage Accounts:Boom:Bank

Withdrawal

50,000

Expenses:Commissions:Boom:0694.HK

Deposit

500

Assets:Investments:Brokerage Accounts:Boom:0694.HK

Deposit

49,500 (16,500 shares)

If the exchange rate dialog box does not appear automatically, right-click on the stock row, and select Edit Exchange Rate. Enter the number of shares (16,500) as the To Amount.

图 12.16. Transfer Funds

Setting the number of shares in the Transfer Funds dialog

When you return to the Chart of Accounts, you will see the purchased shares reflected in the stock account’s total.

图 12.17. The Purchased international stocks

Chart of Accounts is now containing the international stocks

However, as you can see, the USD totals may be zero if GnuCash doesn’t have an exchange rate between USD and HKD. To fix this, go to Tools → Price Database and click the Get Quotes button to automatically retrieve the exchange rates you need.

注意

To reiterate, this example shows how stock can be purchased in any currency by entering the transaction in the register of the cash account used to make payment. It is also possible to enter the purchase in the stock account’s register, but be aware that the stock is assumed to be priced in the currency of the stock account’s parent.

In this example, the stock account’s parent (Assets:Investments:Brokerage Account:Boom) is denominated in HKD. Since this is same currency as the stock price, the purchase can be safely entered in the stock account’s register.

Tracking Currency Investments

Currency investment is when you decide to invest in a different country's currency, and hope that it will rise in value relative your own currency.

When you enter these transactions into GnuCash, you will have to decide on how much detail you would like to have.

If you are not interested in detail at all, a very simple account structure would suffice:

- Assets:Investments:Currency:Bank (USD)

- Assets:Investments:Currency:XXX (XXX)

You would simply enter transfers between the two accounts, noting exchange rates as you went.

But, if you do want to be able to track capital gains or losses, as well as any fees, you do need a more complex account structure, such as:

- Assets:Investments:Currency:Bank (USD)

- Assets:Investments:Currency:Currency Bank:XXX (XXX)

- Expenses:Investments:Currency:Bank (USD)

- Income:Investments:Currency:Currency Bank:Capital Gains:XXX (XXX)

Purchasing Currency

When purchasing an another currency, you will buy a certain number of units of foreign currency with your own currency, at a particular rate. For example, you might buy 10,000 USD worth of Andorran Francs, 1 USD = 5 ADF, with a transaction fee of 150 USD.

Assets:Investments:Currency:Bank (USD)

Withdrawal

10,000

Expenses:Investments:Currency:Bank (USD)

Expense

150

Assets:Investments:Currency:Currency Bank:ADF (ADF)

Deposit

49,250

The Exchange Rate window should pop up when you leave the last row in the split above (Currency Transaction). If this window does not pop up, right click on the row or select Actions, and select Edit Exchange Rate. In the Exchange Rate window you specify the exchange rate you got from the bank.

Selling a currency investment

Entering a currency sale is done in the same way as a currency buy except that you are now transferring money from the Currency account to your native currency’s Bank account (very similar to “Selling Shares”一节).

The proper recording of the currency sale must account for realized gains or losses. This can be done using a split transaction. In the split transaction, you must account for the profit (or loss) as coming from an Income:Investments:Currency:Currency Bank:Capital Gains:XXX account (or Expense:Investments:Currency:Currency Bank:Capital Loss:XXX). To balance this income, you will need to enter the Currency asset twice in the split—once to record the actual sale (using the correct amount and correct exchange rate), and once to balance the income profit (setting the amount to 0).

In short, a selling Currency transaction should look something like below, seen again from the Assets:Investments:Currency:Currency Bank:XXX.

表 12.1. Selling a currency with a Split Transaction Scheme

Account

Deposit/Expense

Withdrawal/Income

Assets:Investments:Currency:Bank (USD)

Sold Amount - Exchange Fee

Expenses:Investments:Currency:Bank (USD)

Exchange Fee

Assets:Investments:Currency:Currency Bank:XXX (XXX)

Sold Amount (= Purchased Balance + PROFIT)

Income:Investments:Currency:Currency Bank:Capital Gains:XXX (XXX)

[LOSS]

PROFIT

Assets:Investments:Currency:Currency Bank:XXX (XXX)

PROFIT (with To Amount = 0)

[LOSS (with To Amount = 0) ]

Reconciling Statements in a Foreign Currency

Reconciling foreign statement are done in the same manner as when you reconcile your local bank statement. If you have created a Chart of Accounts structure which allows you to have the same currency per account as your statement, it is actually exactly the same as reconciling your local bank statement.

If you have different currencies you might have to manually convert the amounts from one currency to another while you reconcile the accounts.

Automatically Recording Currency Transactions using Trading Accounts

Trading accounts were introduced as a feature from GnuCash version 2.3.14. The conceptual basis for trading accounts is described in Tutorial on multiple currency accounting by Peter Selinger. A second tutorial Multiple currency accounting in GnuCash describes the manual creation and use of trading accounts in GnuCash prior to version 2.3.14.

Trading accounts are not enabled by default in GnuCash. To enable them go to File → Properties+Accounts tab and check the Use Trading Accounts checkbox.

Trading Account Concepts

In accounting terms, trading accounts are specialized equity accounts to record changes in income which result from transactions between two or more currencies. In GnuCash they are implemented as a top level account type of Trading. When trading accounts are enabled the required sub accounts of Trading are automatically created if they do not already exist when a transaction between one or more currencies is created.

In the extended Accounting Equation, Trading accounts would appear as follows:

公式 12.1.

Assets = Liabilities + Equity (+ Income -Expenses) + Trading

小心

The user is prevented from manually making entries directly to the registers for any of the accounts in the Trading top level account group. All entries to these accounts are automatically generated when transactions between currencies are created in other account registers within the GnuCash account hierarchy.

The Trading account group is structured below the top level account Trading with a sub-account CURRENCY which in turn has a sub-account for each currency between which transactions have been made. For the example previously used in “Manually Recording Currency Transaction”一节, the additional accounts which will be created automatically when transactions are created between different currencies with trading accounts enabled are:

Trading

CURRENCY

EUR

HKD

USD

小心

The names of these accounts are again assigned automatically and cannot be changed by a user without disrupting the functionality of the trading accounts in GnuCash.

Recording Foreign Currency Transactions with Trading Accounts

Setup of Accounts for Trading Accounts

The same account structure used in the manual recording of currency transactions in the previous section is required. The initial account configuration for Assets and Equity accounts are as follows:

图 12.18. The Initial Multicurrency Bank Accounts Setup

Initial setup of bank accounts in multiple currencies.

The following prices were entered in the Price Database ( Tools → Price Database ) as at Jan. 1, 2020 to convert the account balances for the foreign currency accounts to USD:

图 12.19. The Initial Price Database Entries

Price Database window after setting initial exchange rates between USD, HKD and EUR.

With the currency prices set as shown, the Accounts tab will now display the values of the foreign accounts in USD in the Total(USD) column:

图 12.20. The Initial Multicurrency Setup After Entering Exchange Rates Between USD, HKD and EUR

Accounts tab after setting exchange rates to USD.

Transfer of Funds to a Foreign Currency

Let us assume we wish to purchase at item in Hong Kong using the Hong Kong bank account for 20,000 HKD on Feb. 1, 2020. The current funds in the Hong Kong account are insufficient and we will need to transfer another 10,200 HKD from the US bank account. The exchange rate at the time of the transfer is 1 USD = 7.7884 HKD and we will have to transfer 1,309.64 USD for which the bank charges a 40 USD transfer fee. The transaction to effect this is created with the Transfer Funds dialog as shown below:

图 12.21. The Transfer Dialog To Create Transaction For Transfer From USD To HKD

Transfer of 10,200 HKD from US Bank account to Hong Kong bank account.

The Debit Amount has been specified in HKD and the transaction Amount being transferred in USD. There is no provision to enter the transfer fee in the dialog. On closing the dialog the following transaction as viewed in the US Bank Account register has been created:

注意

Amount entered in the Transfer Funds are transferred from the selected Credit Account to the selected Debit Account. And if Debit Amount radio button is selected and the foreign currency amounts are entered, the transaction is recorded on the correct debit amounts. Whereas if Exchange Rate is selected and entered, the exact value is not often recorded due to the rounding errors.

图 12.22. The Transaction After Transfer Displayed in The US Bank Account Register

Transaction to transfer from US bank account to Hong Kong Bank account after closing transfer dialog.

The transaction can be opened in the US Bank Account register and may then be edited to add splits for the transfer fee as follows:

图 12.23. The Transaction After Adding The Splits For The Transfer Fee

Transaction to transfer from US bank account to Hong Kong Bank account after adding the splits for the transaction fee.

Returning to the Accounts tab we can see the result of the transfer transaction on the accounts:

图 12.24. The Account Tab Balances After Completion Of USD To HKD Transfer

Account balances in the Accounts tab after the transfer of funds from the US Bank account to the Hong Kong bank account.

The balances of the Asset and Equity accounts are presented with values set by the exchange rate entered in the transaction to transfer funds on Feb. 1, 2020.

The trading accounts have been automatically created and the amounts of the transfer have been entered into the accounts. There are no entries associated with the pre-existing opening balances of the accounts prior to the transfer. This reflects that the trading accounts only reflect gains and losses since the book was opened.

At this point there have been no trading gains or losses. The balances of the USD and HKD trading accounts are the same when converted to USD. The HKD trading account has a debit (negative balance) and the USD trading account has a credit balance (positive balance). The net balance of the CURRENCY sub account of Trading, and Trading itself, is 0 indicating that at this point no gains or losses have been recorded in the trading of currencies.

The hypothetical purchase in Hong Kong fails to take place and a month later on Mar. 1, 2020 the funds are required in the US account for another purpose. A transfer of 10,200.00 HKD is made from the Hong Kong bank account back to the US bank account. The exchange rate at the time of the transfer is 1 USD = 7.7933 HKD and a fee of 20.00 USD is charged for the transfer. The transaction to effect the transfer is as follows:

图 12.25. The Transaction To Transfer Funds From Hong Kong To US Bank Account

The transaction transfers 10,200.00 HKD from the Hong Kong Bank account to the US Bank account.

After transferring the funds back to the US Bank account, the prices database entries are as follows:

图 12.26. The Price database after transfer of funds back to US account

The price database showing prices for the transfer of funds to HKD and back to USD.

The Accounts tab balances after transferring the funds back are as follows:

图 12.27. The Accounts tab after transfer back

State of the accounts after the funds have been transferred back.

The Assets and Equity balances now reflect the the values of the accounts at the exchange rate for the transfer of funds back to the US Bank account. The Trading and CURRENCY placeholder accounts now indicate a modest realized loss of 0.82 USD on the currency transactions. The associated transfer fees appear in the Expenses total. Not a profitable exercise but still illustrative.

注意

The gains or losses reported using trading accounts are realized gains and losses.

Finally we have the balance sheet after the above sequence of transactions reporting the Trading Loss incurred:

图 12.28. The Balance Sheet After Above Transactions

Balance Sheet after these transactions reflecting the trading loss incurred.

部分 III. 高级功能

第 13 章 Business Features

Introduction to Business Features

The accounting needs of a business are quite different from that of a person. Businesses have customers that owe money, vendors which are owed money, employee payroll, more complex tax laws, etc. GnuCash offers business oriented features to facilitate these needs.

Accounts Receivable (A/R) are used by businesses to record sales for which they are not immediately paid. This is represented on the balance sheet as an asset, because the expectation is that you will receive payment soon.

Accounts Payable (A/P) record bills that businesses have received, but may not pay until later. This is represented on the balance sheet as a liability because you will have to pay for them.

A/R and A/P accounts are used primarily when you have a lot of bills and receipts flowing in and out, and do not want to lose track of them just because you do not pay or get paid right away. For most home users, A/R and A/P are too complicated to be worthwhile.

Business Setup

To set up GnuCash to handle accounts receivable or accounts payable for a company, these preliminary steps must be done.

- Build an appropriate Account Hierarchy.

- Set up Sales Tax Tables.

- Enter the company information in GnuCash.

- Set Business Preferences.

- Set up Billing Terms.

Account Setup

There are many different ways to set up a business account hierarchy. You can start with the Business Accounts setup which is available from the New Account Hierarchy assistant, or you could build one manually. To access the prebuilt Business Accounts, start GnuCash and click on File → New File and proceed until you see the list of available accounts, select Business Accounts.

The prebuilt Business Account hierarchy will not meet your needs exactly. You will need make adjustments to the hierarchy so that it will meet your particular needs. It should be close enough, however, that it is recommended you begin with it.

To use GnuCash’s integrated accounts receivable system, you must first set up a special account (usually a sub-account under Assets) to hold transactions for receivables. This account must be defined with account type A/Receivable. GnuCash will use this account to place transactions related to the integrated accounts receivable system.

To use GnuCash’s integrated accounts payable system, you must first set up an account (usually a sub-account under Liabilities) to hold transactions for payables. This account must be defined with account type A/Payable. GnuCash will use this account to place transactions related to the integrated accounts payable system.

Basic A/R and A/P Account Hierarchy:

-Assets

-Accounts Receivable

-Checking

-Expenses

...(as required)

-Income

-Sales

-Liabilities

-Accounts Payable

-Tax

-Tax on Purchases

-Tax on Sales

You need to add additional accounts to this hierarchy for it to be useful.

注意

You do not need to create an individual A/R account for each customer. GnuCash keeps track of customers internally and provides per-customer reports based on the internal tracking. The same applies to A/P and vendors.

注意

If you deal with customers in more than one currency you will need a separate Accounts Receivable account for each currency.

If you deal with vendors in more than one currency you will need a separate Accounts Payable account for each currency.

注意

Transactions involving an Accounts Receivable or Accounts Payable account should not be added, changed or deleted in any way other than by using Post/Unpost Bill/Invoice/Voucher or Process Payment!

Setting up Sales Tax Tables

Sales Tax Tables can used to determine the tax for customer invoices (or vendor bills).

A tax table entry can be assigned to an invoice line or bill line.

Set up distinct tax tables for customers and vendors.

The default invoice tax table entry can be assigned to each customer and the default bill tax table entry can be assigned to each vendor.

The default tax table entry for new customers or new vendors can be specified in the Book Options window which can be accessed by File → Properties → Business tab.

Sales Tax Tables are maintained using the Sales Tax Table editor which is accessed via menu Business → Sales Tax Table .

图 13.1. Sales Tax Tables Editor

图 13.2. New Sales Tax Table Entry

- Name This is the tax table name.

- Type Either Percent % or Value $.

- Value This is the percentage or value depending on Type.

- Account This is the account to which tax will be posted. For tax collected from customers, this should probably be a Liability account as it must be payed to the government. For tax paid to vendors, if tax laws allow tax paid to vendors to offset tax collected from customers, this should probably also be a Liability account (even though it will usually have a debit balance) so that the net tax owed to the government can be easily observed.

If you set up Tax on Purchases and Tax on Sales as subaccounts of Liabilities:Tax then the net tax will be rolled up and can be seen in the GnuCash Accounts tab.

If unsure about tax law requirements, get professional advice.

The following charts illustrate sample tax tables and may be used as starting points to determine the setup appropriate for a particular jurisdiction.

表 13.1. Sample Tax Table Entries for EU country (e.g. 21% / 6% / 0% Belgium, 20% / 5% / 0% UK etc.) (2017)

Tax Table

Tax Table Entries [Asset/Liability]

Percentage or Amount

Standard VAT Sales

VAT:Sales:Standard [L]

21%

Reduced VAT Sales

VAT:Sales:Reduced [L]

6%

Zero-Rated VAT Sales

VAT:Sales:Zero [L]

0%

EC Sales

VAT:Sales:EC [L]

21%

VAT:Sales:Reverse EC [L]

-21%

Standard VAT Purchases

VAT:Purchases:Standard [A]

21%

Reduced VAT Purchases

VAT:Purchases:Reduced [A]

6%

Zero-Rated VAT Purchases

VAT:Purchases:Zero [A]

0%

表 13.2. Sample Tax Table Entries for Australia (2017)

Tax Table

Tax Table Entries [Asset/Liability]

Percentage or Amount

Standard GST Sales

GST:Sales:Standard [L]

10%

GST-free Sales

GST:Sales:Zero [L]

0%

Standard GST Purchases

GST:Purchases:Standard [A]

10%

GST-free Purchases

GST:Purchases:Zero [A]

0%

表 13.3. Sample Tax Table Entries for Cook County, Illinois (2017)

Tax Table

Tax Table Entries [Asset/Liability]

Percentage or Amount

Chicago Sales Taxes

Taxes:Sales:State [L]

6.25%

Taxes:Sales:City [L]

1.25%

Taxes:Sales:County [L]

1.75%

Taxes:Sales:Region [L]

1%

Enter Company Information

After you have built the account structure and defined your tax tables, designate your company in the GnuCash file. To do this, select the Business tab in the Book Options window, which can be accessed from File → Properties .

图 13.3. Entering Company Information

Here you can:

- Enter the name of your company along with contact information such as your phone number, fax number, e-mail address and website URL.

- Enter your company’s tax payer id number in the Company ID field.

- Select default tax tables applicable to your most common customers and vendors.

Setting Business Preferences

Set options on the Business tab of the GnuCash preferences, which is accessed via Edit → Preferences ( GnuCash → Preferences on macOS). See GnuCash Manual chapter 10.3.3 Business Book Options Tab.

Setting Billing Terms

Billing Terms can be used to determine the payment due date and be a guide for determining discount for early payment of invoices (or vendor bills).

注意

As of GnuCash 2.6.7, Billing Terms are only partially supported. Date due is calculated using the Billing Terms but discount amount is not.

Discount for early invoice payment is not implemented. There are 2 ways this may be done, although neither is recommended, and professional advice should be used to confirm that regulations are being complied with:

- After creating and posting a payment which pays the invoice in full, manually edit the payment transaction (usually strongly discouraged) and split the payment to reduce it by the amount of the discount and create a compensating split in an income (discount) account.

- Alternatively, after creating and posting a payment for the discounted amount, create a credit note for the discount using a specific negative sales income (discount) account for the transfer account.

You can specify the billing terms on each invoice/bill. Invoice billing terms will default from the customer billing terms. Bill billing terms will default from the vendor billing terms.

Billing Terms are maintained using the Billing Terms Editor which is accessed via menu Business → Billing Terms Editor .

图 13.4. Billing Terms Editor

图 13.5. New Billing Term

- Name The internal name of the billing term. For some examples of billing term names and descriptions see https://wiki.gnucash.org/wiki/Payment_Terms.

- Description The description of the billing term, printed on invoices

- There are 2 types of billing terms, with different information to be entered

- Type Days

- Due Days The invoice or bill is due to be paid within this number of days after the post date

- Discount Days The number of days after the post date during which a discount will be applied for early payment

- Discount % The percentage discount applied for early payment

- Type Proximo

- Due Day The day of the month bills are due

- Discount Day The last day of the month for the early payment discount

- Discount % The discount percentage applied if paid early

- Cutoff Day The cutoff day for applying bills to the next month. After the cutoff, bills are applied to the following month. Negative values count backwards from the end of the month.

Accounts Receivable

Accounts Receivable (or A/R) refers to products or services provided by your company for which payment has not yet been received.

System Components

Transactions generated by the A/R system are recorded within the Accounts Receivable account. You should not work directly with this account. Instead, you will work with the four integrated GnuCash A/R application components available through the Business → Customer sub-menu. These four components are:

- Customers are people or companies to whom you sell products or services on credit.

- Invoices represent the physical invoice you send to a customer to request payment. This invoice contains an itemized list of things you sold.

In addition, GnuCash also has support for Credit Notes which represent the inverse of Invoices. A credit note is usually handed to a customer to correct items that were incorrectly invoiced or returned.

Both document types will be set up using the same menu items. Credit notes were introduced starting with GnuCash stable release 2.6.0.

- Jobs (optional) is where you register Customer Jobs. Jobs are a mechanism by which you can group multiple invoices to a particular customer.

- Process Payments is used to register payments you received from a customer.

Customers

Customers are people or companies to whom you sell goods or services. They must be registered within the A/R system.

New

To register a new customer, enter the menu Business → Customer → New Customer . Fill in customer information, such as Company Name, Address, Phone, Fax, etc.

图 13.6. New Customer Registration Window

Find and Edit

To search for an existing customer, use the Business → Customer → Find Customer window. You select a customer to View/Edit from the results of the search. This window is also used to look up customers when creating invoices and processing payments.

图 13.7. Find Customer Window

If many customers match the search criteria you provide, the search can be refined by running an additional search within the current results. The current result set is searched when the Refine Current Search radio button is selected. In fact, GnuCash selects this option for you after you run the initial search.

If the customer you are searching for does not match the supplied search criteria, change the search criteria, click the New Search radio button and then the Find button. The relevant step is the New Search selection. If the customer is not in the result of the original search, and you only search within this set, the customer cannot be found, regardless of new search criteria.

注意

To return a list of all registered active customers, set the search criterion to matches regex, and place a single dot "." in the text field area. Make sure Search only active data is checked, then click Find. The regular expression "." means to match anything.

Invoices

An invoice is the paperwork you send to a customer to request payment for products or services rendered. GnuCash can generate and track invoices.

A credit note is the paperwork you send to a customer to correct products or services rendered that were incorrectly invoiced. GnuCash can generate and track credit notes via the same menu entries as invoices.

注意

This section applies to both invoices and credit notes. In order to avoid repeating everything twice and to keep the text easier to read it will refer only to invoices. You can apply it equally to credit notes. Only where the behavior of credit notes differs from invoices this will be explicitly mentioned.

New

To send an invoice to a customer you must first create the new document. To create an invoice use Business → Customer → New Invoice . The New Invoice window must be filled in appropriately.

图 13.8. Creating a New Invoice

When you click the OK button, the Edit Invoice window opens.

Edit

From the Edit Invoice window you can enter an itemized list of goods and services you sold on this invoice in a manner similar to how the account register works. For credit notes you enter an itemized list of goods and services you refunded instead.

图 13.9. Edit Invoice Window

When you have finished entering all the items, you can Post and print the invoice.

Post

When you finish editing an invoice and are ready to print, you must Post the invoice. The invoice does not have to be posted immediately. In fact, you should only post an invoice when you are ready to print it. Posting an invoice places the transactions in an accounts receivable account.

图 13.10. Post Invoice Window

Find

To find an existing invoice, use the Business → Customer → Find Invoice menu item. From the results of the search, you can select an invoice to edit or view.

注意

Before you can edit a posted invoice, you will need to Unpost it.

One of the design goals in GnuCash’s Account Receivable system was to allow different processes to get to the same state, so you can reach an invoice from different directions based on the way you think about the problem:

- You can search for the customer first, then list their invoices.

- You can search for invoices by number or by company name.

- You can list invoices associated with a customer job.

Print

After you post an invoice, you should print it and send it to your customer. To print an invoice use File → Print Invoice menu item.

图 13.11. Invoice Print Output

注意

You can modify the appearance of the invoice, IE: add a company logo, etc. To do so, see the “Changing the Invoice Appearance”一节.

Invoices can also be printed from the main window by selecting Reports → Business Reports → Printable Invoice from the main menu. The resulting report window states that no valid invoice is selected. To select the invoice to print:

1. Use the Options Toolbar button or select Edit → Report Options from the main menu.

2. Select the General tab of the report options dialog.

3. Click the Select button next to the Invoice Number field.

4. Search for the invoice as usual.

You can also print invoices from within the Process Payment dialog. See the “Process Payment”一节 for instructions on how to do so.

Assign Starting Invoice Number

By default, GnuCash starts with invoice number 1 and increments from there. You can manually type an invoice number into the text box each time you create an invoice, but this gets tiring and sooner or later leads to duplicate numbers.

You can change the starting invoice number if it is important you. Use File → Properties , access the Counters tab, change the Invoice number value to be one less than your desired starting invoice number and click the OK button or the Apply button.

Customer Jobs

Customer Jobs are used to group multiple invoices and credit notes to the same customer. Use of the Customer Jobs feature is optional. The feature is useful when you have multiple jobs for the same customer, and would like to view all the invoices and credit notes related to a single job.

图 13.12. New Customer Job

To use customer jobs, you must create them using the Business → Customer → New Job menu item. You will see the New Job window.

To edit an existing customer job, use the Business → Customer → Find Job menu item. Select the desired job in the search results, and click the View/Edit Job button.

To select from the invoices and credit notes associated with a given job, use Business → Customer → Find Job menu item. Select the desired job in the search results and click the View Invoices button. A window listing invoices and credit notes associated with this job appears. Select an invoice or credit note and click the View Invoice button to open an invoice editor in the main application window.

Process Payment

Eventually, you will receive payment from your customers for outstanding invoices. To register these payments, use the Process Payment application found in Business → Customer → Process Payment .

图 13.13. Process Payment From Customer

Changing the Invoice Appearance

The default Invoice style, as shown in “Print”一节, is fairly barren. The default invoice style leaves the top part of the form blank, so you can print on company letterhead paper. There are some things you can do to change invoice appearance.

Use File → Properties to enter your Company information in the Business tab of the Book Options window. Some of the entered information is printed on the right side of invoices.

To add a customized background, heading banner or logo to invoices, modify the invoice style sheets. To do this, go to Edit → Style Sheets and select the New button in the Select HTML Style Sheet window that will appear. You will then see a window like this:

图 13.14. New Style Sheet Window

Give a Name to the new style sheet (e.g. Custom Invoice) and select the Fancy Template. When you click the OK button, the HTML Style Sheet Properties window is displayed. This window presents you five sections listed in the left pane: Colors, Fonts, General, Images, and Tables. The Colors section allows you to change the colors of various items of the invoice. The Fonts section lets you set fonts type and dimensions. The General section allows you to set the Preparer and Prepared for information, and to Enable Links. The Images section allows you to import graphics into the style sheet. The Tables section allows you to adjust the spacing around the tables which make up the invoice.

To include a company logo, banner heading and background image, use your favorite graphics application such as The Gimp or Apache OpenOffice/LibreOffice Draw to save the images in either GIF or PNG format. Then import them into the style sheet using the Images section described above.

Below is an example that imports all three types of images.

图 13.15. HTML Style Sheet Example Window

The HTML Style Sheets window with an example Background Tile, Heading Banner, and Logo.

注意

The images are placed in the invoice as follows. The Background Tile is tiled to become the background image, the Heading Banner goes to above the invoice text, and the Logo is placed in the upper left corner of the invoice to the left of the Heading Banner. You will probably have to try a few different sized images until you get the invoices to print nicely. Some sizing suggestions are that the Logo should be 1 square cm (~0.5 inch), and the Heading Banner should be 15 cm (~6 inches) wide and 1 cm (~0.5 inch) tall.

With the style sheet configured, when you print the invoice, you select the style sheet to use from the Options menu. Below is the resultant invoice after applying the style sheet demonstrated above.

图 13.16. HTML Style Sheets Example Output

The hideous invoice which results from the graphics selected in the style sheet.

Accounts Payable

Accounts Payable (or A/P) refers to the accounting of products or services which a company has bought and needs to pay for.

System Components

GnuCash has an integrated accounts payable system. The transactions generated by the A/P system are placed within the Accounts Payable account, as a record of what occurs. Generally you do not directly work with this account but use the four integrated GnuCash A/P application components. The A/P components are available from the Business → Vendor sub-menu. These A/P components are:

- Vendors are people or companies from which you buy products or services on credit.

- Bills represent the physical bills vendors send to request payment from you. A bill contains an itemized list of things you purchased.

In addition, GnuCash also has support for Credit Notes which represent the inverse of Bills. A credit note is usually received from a vendor to correct items that were erroneously billed or returned.

Both document types will be set up using the same menu items.

- Jobs (optional) is where you register Vendor Jobs. Jobs are mechanism by which you can group multiple bills from a particular vendor.

- Process Payments is where you register payments to a vendor to whom you owe money.

The following sections introduce the individual Accounts Payable application components.

Vendors

A vendor is a company or person from whom you purchase goods or services. Vendors must be registered within the A/P system.

New

To register a new vendor, select the Business → Vendor → New Vendor menu item. Fill in general information about the vendor, such as Company Name, Address, Phone, Fax, etc. Below is a list of the other options:

This is what the New Vendor registration window looks like:

图 13.17. New Vendor Registration Window

Find and Edit

To search for an existing vendor, use the Business → Vendor → Find Vendor window. You select a vendor to View/Edit from the results of the search. This window is also used to look up a vendor when entering bills and processing payments.

图 13.18. Find Vendor Window

If many vendors match the search criteria you provide, the search can be refined by running an additional search within the current results. The current result set is searched when the Refine Current Search radio button is selected. In fact, GnuCash selects this option for you after you run the initial search.

If the vendor you are searching for does not match the supplied search criteria, change the search criteria, click the New Search radio button and then the Find button. The relevant step is the New Search selection. If the vendor is not in the result of the original search, and you only search within this set, the vendor cannot be found, regardless of new search criteria.

注意

To return a list of all registered active vendors, set the search criterion to matches regex, and place a single dot “.” in the text field area. Make sure Search only active data is checked, then click Find. The regular expression “.” means to match anything.

Bills

A bill is a request for payment you receive from a vendor. GnuCash can track bills.

A credit note is the document you receive from a vendor to correct products or services rendered that you were incorrectly charged for on a bill. GnuCash can generate and track credit notes via the same menu entries as bills.

注意

This section applies to both bills and credit notes. In order to avoid repeating everything twice and to keep the text easier to read it will refer only to bills. You can apply it equally to credit notes. Only where the behaviour of credit notes differs from bills this will be explicitly mentioned.

New

When you receive a bill from a vendor and want to enter it into GnuCash, you must create a new bill. To create a new bill use the Business → Vendor → New Bill menu item, and fill in the resulting window appropriately.

图 13.19. New Bill Registration Window

When you click the OK button the Edit Bill window opens.

Edit

From the Edit Bill window you can enter an itemized list of goods and services you purchased, in a manner similar to how the account register works. For credit notes you enter an itemized list of goods and services the vendor refunded instead.

图 13.20. Edit Bill Window

When you have finished entering all the items, Post the bill.

Post

When you finish editing a bill, you should Post the bill. You do not have to post the bill, you can close it and return to it later. You have to post the bill eventually. Posting a bill places its transactions into an accounts payable account. The Post Bill window appears and asks you to enter information:

图 13.21. Post Bill Window

Find

To find an existing bill, use the Business → Vendor → Find Bill menu item. From the results of the search, you can select a bill to edit, or view.

注意

Before you can edit a posted bill, you will need to Unpost it.

注意

There are other ways to access an existing bill. These are similar to accessing invoices for your customers. See “Find”一节 for more information.

Vendor Jobs

Vendor Jobs are used to group multiple bills and credit notes from a single vendor. Use of the vendor jobs feature is optional. The feature is useful when you have multiple jobs for the same vendor, and would like to view all the bills and credit notes for a single job.

To use vendor jobs, you must create them using the Business → Vendor → New Job menu item. You will see the New Job window.

图 13.22. New Vendor Job

To edit an existing vendor job, use the Business → Vendor → Find Job menu item. Select the desired job in the search results, and click the View/Edit Job button.

To select from the bills associated with a given job, use Business → Vendor → Find Job menu item. Select the desired job in the search results and click the View Invoices button. A window listing bills and credit notes associated with this job appears. Select a bill or credit note and click the View Invoice button to open a bill editor in the main application window.

Process Payment

Eventually, you need to pay your bills. To do so, use the Process Payment application found in Business → Vendor → Process Payment .

Below is the GnuCash Accounts Payable payment window.

图 13.23. Process Payment To Vendor

Payroll

Payroll is a financial record of wages, net pay, paid vacations, and deductions for an employee. This section demonstrates how to track payroll using GnuCash.

Basic Concepts

Payroll is a financial record of wages, net pay, paid vacations, and deductions for an employee. Basically, anything that relates to giving money or benefits to an employee. Payroll is one of the more complex tasks in accounting, because there are many different accounts, people, and agencies involved in paying salaries.

Payroll is typically accounted for as an expense. Sometimes accountants “store” some payroll expenses in a short term liability account. This is useful for things such as payroll taxes, which may be paid at a different time than the employee. The employee might get paid biweekly, while taxes are paid quarterly. This chapter presents a methodology which expenses payroll immediately for salaries, but stores taxes in liability accounts.

注意

GnuCash does not have an integrated payroll system. While you can track payroll expenses in GnuCash, the calculation of taxes and deductions has to be done outside of GnuCash.

Account Setup

Local tax law must be considered when setting up accounts. Because there are many different ways payroll taxes are handled throughout the world, this section presents a very simple structure. From this, you should be able to adapt your particular payroll deductions setup.

Assume that you must pay 2 taxes, Tax1 and Tax2, and that each has an employee contribution and an employer contribution.

The employee’s salary and these two taxes are expense accounts. The tax components are liability accounts. The tax liability accounts are where you accumulate the taxes withheld for all of your employees. The taxes are later paid to the appropriate government agency.

Simple Payroll Account Layout:

-Assets

--Checking

-Liabilities

--Tax1  (short term “storage” account)

--Tax2  (short term “storage” account)

-Expenses

--Salaries

--Tax1

--Tax2

注意

Resist the temptation to create per-employee sub-accounts to track individual salaries. Creating a sub-account for each employee leads to unmanageably large lists of accounts. Imagine the account structure after a few years of employees coming and going. It is much simpler to keep all of your employees’ payroll records within a single account (Expenses:Salaries for example) and use reports to view per-employee information.

The Transaction report can be used to sort and total by description or memo (but not by part of them).

To report salary transactions for a specific employee where the employee name or code is entered in the transaction description or memo, use the Find Transaction assistant ( Edit → Find ) to select the transactions, and then report on them using Reports → Account Report . Further formatting or analysis may be done by copying and pasting the report into a spreadsheet. See Find Transaction in the GnuCash Manual.

Payroll Protocol Sample

GnuCash does not have an integrated payroll system. GnuCash can track your payroll expenses, but you need to develop a payroll protocol and perform the calculations outside of GnuCash, in a spreadsheet for example. In this section, one such protocol is presented. You can use the sample protocol as a model.

Step 1: Deductions list

The first step to the payroll protocol is to create a list of all the possible taxes and deductions for each employee. Each entry should include definitions and formulas for calculating each value. Once the protocol is established it needs to be changed only when payroll laws or tax rates change.

In the proposed scenario, such a list would look like this:

- E_GROSS_SALARY - Employee gross salary

- E_TAX1 - Employee contribution to tax1 (X% of E_GROSS_SALARY)

- E_TAX2 - Employee contribution to tax2 (X% of E_GROSS_SALARY)

- C_TAX1 - Company contribution to tax1 (X% of E_GROSS_SALARY)

- C_TAX2 - Company contribution to tax2 (X% of E_GROSS_SALARY)

注意

The employee’s net salary (E_NET_SALARY) is defined as E_GROSS_SALARY - E_TAX1 - E_TAX2 and need not be placed in this list since it is composed of items that already exist.

Place the actual formulas for calculating each deduction in this list. Sometimes these formulas are quite complex, and sometimes they simply say "look it up in table XYZ of the tax codes".

Notice that you can calculate some interesting values using the above definitions. One such value is the total cost to the company: E_GROSS_SALARY + C_TAX1 + C_TAX2.

Step 2: Create the Transaction Map

When you record payroll in GnuCash, do so with a single split transaction. This split transaction populates the appropriate expense and liability accounts. If you need to look the payroll details at a later time, open the split transaction.

With the deductions list from above, an employee split transaction map can be generated. Each of the items in the list is mapped to a GnuCash account.

表 13.4. Payroll Transaction Map

Account

Increase

Decrease

Assets:Checking

E_NET_SALARY

Expenses:Salaries

E_GROSS_SALARY

Liabilities:Tax1

E_TAX1

Liabilities:Tax2

E_TAX2

Expenses:Tax1

C_TAX1

Liabilities:Tax1

C_TAX1

Expenses:Tax2

C_TAX2

Liabilities:Tax2

C_TAX2

Note that the C_TAX1 and C_TAX2 components have entries in the both the liability and expense accounts. The company component of each tax is expensed at the time of payroll, but remains a liability until taxes are due.

Step 3: Pay the Employee

Go to the account from which the employee will be paid, for example your Assets:Checking account. Open a split transaction and enter the real values using the Transaction Map above as a guide. Repeat this for all employees.

提示

This manual process is tedious, especially if you have a large number of employees.

One GnuCash tool you certainly want use when entering employee payroll is duplicate transaction (use the Duplicate Toolbar button). This saves you from having to enter all the transaction splits for each employee. You still need to change the amounts of money to match each employee’s real payroll values, but you will not have to build the split for each employee.

If payroll transactions do not change significantly every pay period, you can also use the duplicate transaction feature to duplicate each employee’s most recent payroll transaction for the current pay period. If you find you are doing so all the time, read about the Schedule Transactions feature and save even more time!

Step 4: Pay the Government

The final thing to do is to pay the taxes to the government. The liability accounts have been collecting the taxes for various government agencies, and periodically you need to send a check to the government to pay this charge. To do so, you simply enter a 2 account transaction in (for example) your checking account to pay off the tax liability. The transaction is between the checking account and the liability account, no expense account is involved. The expense accounts are charged at the time the tax liability is recorded.

Business Payroll Example

Using the account setup seen previously, let’s go through an example. Assume that there are 2 employees (E1 and E2) who each earn $1000 per month gross salary. The employee contribution to Tax1 and Tax2 are 10% and 5% respectively. The company contribution to Tax1 and Tax2 are 15% and 10% each on top of the employee’s gross salary.

Starting with $50k in the bank, and before doing any payroll, the account hierarchy looks like this:

图 13.24. Payroll Example: Initial Setup

The deductions list for employee 1 are:

- E_GROSS_SALARY - Employee gross salary - $1000

- E_TAX1 - Employee contribution to tax1 - $100 (10% of E_GROSS_SALARY)

- E_TAX2 - Employee contribution to tax2 - $50 (5% of E_GROSS_SALARY)

- C_TAX1 - Company contribution to tax1 - $150 (15% of E_GROSS_SALARY)

- C_TAX2 - Company contribution to tax2 - $100 (10% of E_GROSS_SALARY)

表 13.5. Payroll Transaction Map for Employee 1

Account

Increase

Decrease

Assets:Checking

$850 (E_NET_SALARY)

Expenses:Salaries

$1000 (E_GROSS_SALARY)

Liabilities:Tax1

$100 (E_TAX1)

Liabilities:Tax2

$50 (E_TAX2)

Expenses:Tax1

$150 (C_TAX1)

Liabilities:Tax1

$150 (C_TAX1)

Expenses:Tax2

$100 (C_TAX2)

Liabilities:Tax2

$100 (C_TAX2)

From the checking account, enter the split transaction for employee 1. It should look like this:

图 13.25. Payroll Example: Employee Split Transaction

The Split Transaction for Employee 1

提示

When paying employees, enter only the employee name in the Description area. If you decide to use GnuCash’s check printing capabilities, the check is automatically made out to the correct employee. If you want to record other information in the transaction besides the employee name, use the Notes area, available when viewing the Register in double-line mode.

Repeat this for the second employee, which leaves the account hierarchy looking like this:

图 13.26. Payroll Example: Accounts After Salaries Paid

Now, you will enter the company contributions. The Liabilities:Tax1 and Liabilities:Tax2 accounts track how much you must pay to the government for each tax type. When it is time to pay these agencies, you will make a transaction from the checking account to these liability accounts. No expense accounts are involved. The main account will then appear like this:

图 13.27. Payroll Example: Accounts After Paying Government

第 14 章 Budgets

This chapter explains how to create and use budgets with GnuCash.

Basic Concepts

A budget is a tool for estimating expected income and expenses. You can use it to help you plan how you intend for your finances to change over a period of time, and to examine how your actual financial transactions for the period compare to your planned transactions.

The budgeting concept is quite general, so GnuCash offers a budgeting tool that is both simple and flexible. You, the user, have to decide how complex or simple you want to make your budget. This guide will help you make some of those decisions.

Terminology

There are a few helpful terms listed below that will be used to discuss budgeting.

- Budget - A financial plan describing the expected revenues and/or disbursements for a particular time period

- Cash Budget - A budget planning for expected cash receipts and cash disbursements. This type of budget tracks cash flow -- where your money comes from, where it goes, and, of course, how much.

- Expense Budget - A budget chiefly for planning what you spend your money on. This type of budget tracks your expenses. It is typically not concerned with things like appreciation or repayment of liabilities. However, it would account for interest charges. For example, if you buy $100 worth of groceries with your credit card, you incur an $100 expense for groceries, and a $100 liability to your credit card company. When you pay the credit card bill for $110, you are incurring an additional interest expense of $10. An expense budget plans for the transaction of buying the groceries and paying the interest, but not the transaction of repaying the credit card company.

- Capital Budget - A budget that describes a plan for paying for a large future expense, often through a combination of saving and borrowing money. Note: Capital budgets can sometimes get quite complex because they can try to answer the question "Can we afford to do such-and-such?" by exploring various hypothetical scenarios that can involve hypothetical accounts.

- Budget Period - The period of time during which the plan is expected to take place. The most common budget periods are annual and monthly. Sometimes, you may budget for several consecutive periods at once, for convenience or for finer-grained planning. For example, an annual budget may include 12 monthly budget periods.

Creating a Budget

Even before you begin to make a budget, it’s important to have given some thought to your account hierarchy. For example, if you want to budget a certain amount for your electric bill and a certain amount for your water bill, you can’t have only an Expenses:Utilities account. Your accounts must be at least as specific as your budget.

Choose Which Accounts To Budget For

The first step in creating a budget is to decide what it is you want to plan for. This decision will affect which accounts you include in your budget. For example, if you are only interested in tracking your expenses, you may create an expense budget by only entering amounts for expense accounts. On the other hand, if you want to track all of your cash flow, you may create a cash flow budget by entering amounts for asset, liability, income and expense accounts.

Before you begin to create your budget, you need to make two decisions: What accounts do I want to budget for? and When do I want my budget to be for? You can always change your mind later, after you’ve created a budget, but you need to start with something.

提示

As a rule of thumb, if you mostly care about what you spend your money on, you may want to make an expense report. If you’re also concerned about having enough money in the right places at the right times, you may want to use a cash-flow budget.

Choosing a Budget Period

Before creating a budget you must also decide what period of time you want to plan for. The most common budget periods are monthly and annual. If you want your budget to plan for changes in financial patterns over time, then you should include multiple budget periods in your budget. For example, if you want to plan on having higher utility expenses in the winter than in the summer, then you might break your annual budget into 4 quarters or even 12 months, and budget a higher value for the winter periods than for the summer periods.

Getting Started

To create your first budget click on Actions → Budget → New Budget . You will immediately see a new budget with the default settings and no entries. Then click on the Options button. The most important options are the budget period and the number of periods. For the budget period, choose the beginning date and the smallest period of time that you want to plan for. Then, for the number of periods, choose how many periods you want to plan for.

The budget page now shows a list of accounts with a column for each budget period. The date shown in the title of each column is the beginning of that budget period.

Entering Budget Values

Now, you must enter the budget values - the amounts that you expect the account balances to change during the budget period. There are two ways to enter budget values. The first way is to simply click on the cell and enter an amount.

If you have past transactions recorded in GnuCash, the second way is to let GnuCash estimate the budget values by looking at those transactions. First, select the accounts you want GnuCash to estimate. Then click on the Estimate Toolbar button. In the Estimate Budget Values dialog, select the date past which GnuCash should look for past transactions. GnuCash will start at that date and look forward for the duration of your budget. For example, if you are making an annual budget, and you select Jan. 1, 2005, GnuCash will look at all the transactions in that account from Jan. 1, 2005 through Dec. 31, 2005.

Budget Reporting

You’ve already done the hardest part - creating your budget. But now you want to know how your actual financial transactions compare to your plan. You need to run the Budget Report.

Click on Reports → Budget → Budget Report . For each account, the Budget Report will show the budgeted and the actual amounts in two adjacent columns for each period in the budget. If you have created multiple budgets, you can use the Budget Report Options to select which budget to use in the report.

Two other types of budget reports are commonly used in the small business setting. They are the Budgeted Income Statement and the Budgeted Balance Sheet.

Budgeted Income Statement

The budgeted income statement is similar to the income statement. Both show the revenues and expenses for a given period as well as the profit, which is the difference revenue - expenses. The income statement is based on historical data, but the budgeted income statement is based on the predictions made in the budget.

Budgeted Balance Sheet

The budgeted balance sheet is similar to the balance sheet. Both show the assets, liabilities, and equity. The difference is that the balance sheet is based on historical data, and the budgeted balance sheet is based on the predictions made in the budget.

第 15 章 Other Assets

General Concepts

This chapter presents many additional accounting treatments for frequently encountered business and less-frequently found personal activities that need recording in accounting books. The explanations below cover both the description and purpose of the activity, and they include also the usual accounting treatments (bookings or recordings) for these transactions.

These concepts have evolved over centuries of experience by those keeping accounting records and will help you maximize your record keeping’s utility and meaningfulness.

This section introduces categorization of assets in the balance sheet based on time or the asset’s useful life (current and long-term). Sometimes assets are also considered from the standpoint of their liquidity , which is regarded as how close or distant the asset is from being turned into cash. Near-cash assets are relatively quickly converted to cash (e.g., accounts receivable), while assets requiring rather a long time to convert to cash are considered to be relatively fixed in their non-cash state (e.g., heavy equipment, buildings, land). (Fixed does not mean they were repaired!)

You should find that current assets parallel those with more liquidity, while long-term and fixed assets are those with much less liquidity. Finally, below you will find a few assets that could be either current or long-term based on the nature of the facts constituting them.

Other Assets Described

Current Assets

Current Assets are those activities whose normal expected life would be one year or less. Such activities could be tracking reimbursable expenses, travel advances, short-term loans to a friend or family member, prepaid expenses, annual insurance premium amortization, and so on. The individual entity could have many other kinds of short term activities that reflect what it is doing. (These asset types are explained individually below.)

Long-term (Fixed) Assets

Long-term (Fixed) Assets are those activities whose normal expected life exceeds one or more years. This grouping covers both tangible and intangible assets. Examples of tangible assets are land, buildings, and vehicles (cars, trucks, construction equipment, factory presses, etc.) Intangible assets include such things as patents, copy rights, goodwill, etc. Because the lives of some of these assets show wear and tear and deterioration in value over time, businesses and individuals can allow for that diminution in value by calculating depreciation on such assets. For example, land normally does not depreciate, but buildings do, as do equipment and vehicles. (These asset types are explained individually below.)

Current Assets

This section explains short-term receivables, reimbursable expenses, travel advances, prepaid premiums, prepaid rent, suspense or wash accounts.

Short-term Receivables

This kind of account is useful to reflect an agreement made with someone you trust. Suppose you lent someone $500 and he agreed to repay you $50 a month. If he paid on time, the loan you made would be paid off within a year, which is why it is classified as a short-term receivable. So you could record that loan initially in this account tree: OtherAssets:Current Assets:LoanToJoe. At the time you give him the money: your entry is debit (increase) LoanToJoe $500 and credit (decrease) Bank $500. Each time you receive Joe’s payment you record $50 debit (increase) to Bank and credit (decrease) LoanToJoe.

提示

Don’t become confused by the use of the word “Loan”. “Loan-To” is the tipoff that you really have a receivable, that is, you will receive from Joe, the money you previously loaned. Until he actually pays the money owed you, you reflect his debt in your books by an account describing your expectation–you will receive the money owed you, hence the word “receivable”.

Reimbursable Expenses

This kind of activity is one in which you spend your own money on behalf of someone else (your employer, perhaps) and later you receive repayment of what you spent. The case might be a business trip. The employer has a policy of covering (paying for) all authorized expenses. After the trip is over, the employee submits a report listing dates and amounts spent with receipts for all the expenditures. The employer reviews the report and pays for all items that it considers as having a valid business reason. (Normally, employees know in advance what the employer will reimburse, so only those items are recorded as a reimbursable expense on the employee’s books.)

Because a business trip can involve different kinds of expenditures (air travel, lodging, transportation at the destination, etc.), different kinds of expenditures would be recorded in the one account as long as the expenditures all related to the same trip. In other words, if a second trip is made before the first is fully settled, a second account for a different event could be set up. It would make sense to do this, if it would help to keep separate all the details of one trip from those of another. It is up to the person making the trip to decide how much trouble it would be to put separate trips in separate accounts or to put them all in the same account. The trip taker should remember that the account must be reconciled in order to know with certainty that all expenses have been reimbursed.

Recording the expenditures on the trip would be much the same. That is, if you paid trip expenses by cash you would debit (increase) the reimburseable expense account for the money paid in cash, because it is a receivable to you until it has been reimbursed to you. The credit offsetting your expenditure would decrease the account that shows the cash in your pocket or the account from which you drew the cash for the payment made. If you paid by credit card, the debit side would be the same as just described, but the credit would be an increase to the credit card company account on your books.

When you received your reimbursement, then the journal entry (or transaction) to record receipt of the funds from the employer would be: debit (increase) Bank for the check amount and credit (decrease) the reimbursable expense account for the check amount.

If it turns out that the reimbursable expense account is not zero balance after processing the employer’s payment, then it means that there is a difference between you and the employer in handling the expense, which needs to be investigated. If the balance is a debit (a positive balance), your account has some money that was not reimbursed. If the balance is a credit (a negative balance), you were paid for more than what you recorded as due you. In both of those situations you should reconcile the difference between what you recorded and what was paid. That effort should disclose exactly what is causing the discrepancy. You will need to contact the employer’s bookkeeper to know what was paid, if the reimbursement check was not accompanied by a detailed list of the items being paid you.

In the event the employer refused to reimburse you for an expenditure, that effectively makes it your expense. In that case, you would make this entry: debit (increase) your own Expense (appropriately named) and credit (decrease) the Reimbursable Expense account. That entry should result in a zero balance in the Reimbursable Expense account. If not, reconcile until you identify the difference.

提示

Sometimes there are small differences that don’t match an individual entry. In those cases divide the amount by 2 or by 9. If the unresolved amount is divisible by two, it suggests that both you and the employer entered the item in the same manner: both as debits or both as credits. If it is divisible by 9, then likely one of you transposed adjoining numbers; e.g., one entered 69 and the other entered 96. If the difference is divisible neither by 2 or by 9, then it could be that more than one error is present.

Travel Advances

These are very similar to Reimbursable Expenses. The difference is that someone gives you money first; you spend it, and then you give a report accounting for what you spent it on. The report is supported by invoices establishing who, what, where, when, and how much for each expenditure. In the Reimbursable Expense case, you spent your money first and later recovered it.

In the Travel Advance case when you receive the advance, you record on your books this entry: debit (increase) Bank for the travel advance amount received (say, $500); credit (increase) the short-term liability Travel Advance ($500). This is a liability, because you are not gifted with the money, but only loaned it for the purpose of having funds to spend when doing the employer’s business.

Frequently, the way these monetary arrangements work is that at the beginning of for example a salesperson’s employment, he or she receives the advance and monthly (or more frequently) turns in a report about who, what, where, when, and how much he spent. The money in the report is reimbursed if approved.

During the period after receiving the advance and before filing a request for reimbursement report, the salesperson can record his or her expenditures into the advance liability account. In that case, the balance in the account will show how much of the advance has not yet been spent (assuming the Travel Advance balance is a credit). If no mistakes have been made and all expenses are approved, then the sum of the unspent account balance and the reimbursing check amount will equal the original travel advance amount.

It makes sense for the salesperson to record the travel expenses to this advance account (and not to his or her own expense accounts), because the money is being spent on behalf of the employer, for the employer’s authorized expenses. It is not the employee’s own money, and therefore not his or her own expense.

When the salesperson receives the report reimbursement (say, $350), he or she debits (increases) Bank, and credits (increases) again the Travel Advance liability account, assuming that previously he or she had been recording expenditures to the travel advance account. Tracking activity in this manner causes the account to always show the amount that is owed the employer.

See “Reimbursable Expenses”一节 above for what to do if the employer does not accept an item the employee put on the travel advance reimbursement request report. The difference resolution effort is essentially the same for both types of accounts.

Prepaid Premiums or Prepaid Rent

Some types of expenses are usually billed as semi-annual or annual amounts. For example, the insurance industry will bill home insurance annually, while car insurance premiums can be annual or semi-annual. For those that pay an amount that covers several months or a full year, the proper accounting treatment is to reflect in each accounting period the amount that expresses the benefit applying to that period.

In the case of someone who pays a full-year’s insurance premium at the beginning of the insurance period, the entry to record this is debit (increase) Prepaid Insurance Premium for say, $1,200, and credit (decrease) Bank for $1,200.

Then a monthly recurring journal entry (scheduled transaction) is created that debits (increases) Insurance Expense $100 and credits (decreases) Prepaid Insurance Premium $100. This technique spreads the cost over the periods that receive the insurance coverage benefit. Businesses following generally accepted accounting practices would normally use this technique, especially if they had to present financial statements to banks or other lenders. Whether individuals do depends on the person and how concerned they are to match cost with benefit across time periods. Another factor influencing use of this technique would be the number of such situations the person encounters. It is relatively easy to remember one or two, but more difficult if having to manage 10 to 20. You would set up as many or as few as proved useful and important to you.

Suspense or Wash Accounts

The purpose of these accounts is to provide a device to track “change of mind” situations. The objective of these accounts is to provide a temporary location to record charges and credits that are not to be included permanently in your books of record. When the transactions reflected in these accounts have been fully completed, Wash/Suspense accounts will normally carry a zero balance.

For example, say in the grocery store you see canned vegetables on sale, so you buy 6 cans at $1 per can. Say that the total purchases were $50. When you come home and are putting things in the cupboard you discover you already had 12 cans. You decide to return the 6 you just bought. Some persons in this situation would charge (increase) the whole bill to Grocery Expense; and when they returned the cans, they would credit (decrease) Grocery Expense. That is one way of handling that. The effect of this method is to leave recorded on your books the cost of items that you really did not purchase from a permanent standpoint. It is only when the items have actually been returned and the vendor’s return receipt has also been recorded that the distortion this method generates will then be removed.

Actually, there are several treatments, depending on when and how the original transaction was booked/recorded and when you decided to return the items purchased. Basically, did you change your mind before you recorded the transaction or after doing so?

If you decided to return the items after recording the purchase transaction, you may originally have charged Grocery Expense for the full amount ($50) of all items. In that scenario, what you kept and the amount of the items to be returned were grouped into one account. You could edit the original transaction and restate the amount charged to the Grocery Expense account to be the difference ($44) between the total paid ($50) for groceries and the value of the items to be returned. That leaves the returned-item value as the amount ($6) you should record to the Suspense account.

Obviously, if you decided to return items before you recorded your purchase, then you would book the original entry as a charge to Grocery Expense for the amount kept ($44) and as a charge to Suspense for the amount returned ($6). The off-setting credit ($50) to cash or credit card is not affected by these treatments.

When there are several persons shopping and at different vendors, there can be a case where there are several returns happening at once and in overlapping time frames. In that case the Wash Account is charged (increased) at time of changing the mind, and either Bank or Credit Card is credited. When the return occurs, the reverse happens: Bank or Credit Card is debited for the cash value of the returned items and the Wash/Suspense Account is credited in the same amount.

If the wash account has a non-zero balance, scanning the debit and credit entries in the account will show the non-matched items. That is, debits not matched by offsetting credits indicate items intended to be returned but not actually returned yet. The reverse (credits not matched by offsetting debits) indicates that returns were made but the original charge was not recorded in the Wash Account.

These differences can be cleared up by returning unreturned items or recording charges (debits) for items already returned. The mechanics of doing that likely will be finding the original expense account the item was charged to and making an entry like: debit Wash Account, credit original expense. It also could be as described above where the original recording is adjusted by adding a charge to Wash/Suspense account and decreasing the amount charged to the original account.

Short or Long-term Assets

This section explains why some types of assets may be short or long-term and presents an example.

An example is deposits (e.g., utility, rental, security). If the deposit agreement contains a provision to recover the deposit at the end of a year, the treatment could be that of a short-term asset. However, when the agreement is that the deposit holder returns the funds only upon successful inspection at the end of the relationship, then at the start of the relationship or agreement, the person paying the deposit has to decide whether to write it off as a current expense or to track it for eventual recovery at the end of the agreement (not infrequently, moving to a new location).

Whichever decision is made, the accounting treatment is to debit (increase) expense (assuming the write-off decision) or debit (increase) Deposits Receivable (assuming the intent is to recover the deposit in the future) and credit (decrease) Bank for the amount of the deposit (if paid by cash) or credit (increase) credit card if paid using that payment method.

Long-term (Fixed) Assets

This section illustrates long-term assets (those whose useful lives exceed a year) and discusses these types: land, buildings, leasehold improvements, intangibles, vehicles and other equipment.

Land

Land is not a wasting asset. That is, it does not get used up over time and rarely suffers damage such that it loses value. For that reason, it usually is recorded at cost at the time of purchase. Appreciation in its value over decades is not recorded and is not recognized in any way on the books of the owner. It is only after land has been sold that sale price and purchase cost are compared to calculate gain or loss on sale.

Land is frequently sold/purchased in combination with structures upon it. That means that the cost has to become separated from the cost of structures on it. Land valuation is usually part of the transfer of ownership process and its value is shown on the purchase documents separately from that of any structures it supports.

Land values shown on purchase documents frequently arise from the process of value determination managed by assessors whose job it is to assign values to land for tax purposes. Local and regional areas of a state or province use the values determined by assessors in their tax formulas, which provide revenues for local and regional governing authorities to finance their required community services.

Should land be acquired in a situation not subject to a history of land valuation by a formal valuation system, then the purchaser can appeal to real estate agents and an examination of recent sale transactions for information that would allow calculating a reasonable amount to express the value of the land.

Buildings

Buildings are the man-made “caves” in which much of life’s human interaction occurs. These structures are wasting assets, because in their use they or their components gradually wear. Over time they begin to lose some of their function and they can suffer damage due to planetary elements or human action.

Accepted accounting practice is to record the cost of the building determined at time of ownership transfer (purchase) or at conclusion of all costs of construction. Because buildings are frequently used for decades, and due to the need to be able to calculate gain or loss on sale, accounting practice preserves the original cost by not recording declines in value in the account containing the original purchase or construction cost.

Instead, the depreciation technique is used to show (in the balance sheet) the structure’s net book value (original cost reduced by accumulated depreciation). Depreciation is a separate topic treated elsewhere in this Guide.

Leasehold Improvements

When a business does not own the building where it operates, and instead has a long-term lease, it is not uncommon for the business tenant to make improvements to the premises so that the structure obtains both function and appearance that enhances conducting its business activities.

In these cases, the expenditures that the business incurs are recorded in a Leasehold Improvements account: increase (debit) Leasehold Improvements, decrease (credit) Bank or increase (credit) a suitable liability account (which could be a liability to a contractor or a bank or a credit card, etc.).

Vehicles or Equipment

Vehicles or Equipment of all kinds usually last for several years, but their useful lives are much shorter than that of assets that have little movement in their functioning. Because they do wear out over time, common accounting practice in business is to record depreciation using life spans and depreciation methods appropriate to the nature and use of the asset. Frequently, the life and depreciation methods chosen are influenced by what is permitted per national tax regulations for the kind of asset being depreciated.

Usually, businesses depreciate their assets. Individuals can do so as well to the degree that taxing authorities permit. Very wealthy persons employ accountants and attorneys to track and manage their investments and assets holdings to take advantage of all tax benefits permitted by law.

Intangibles

The mechanics of accounting (debiting and crediting appropriate accounts) for these assets are relatively simple, much the same as for any of the above assets. Where the difficulty lies is in their valuation, which is an advanced topic and not something that individual persons and small businesses would likely encounter. For that reason further discussion of items such as patents, copyrights, goodwill, etc. are left out of this Guide.

第 16 章 Depreciation

This chapter will introduce the concept of depreciation in accounting and give some real life examples for using it.

Basic Concepts

Depreciation is the accounting method for expensing capital purchases over time. There are two reasons that you may want to record depreciation; you are doing bookkeeping for your own personal finances and would like to keep track of your net worth, or you are doing bookkeeping for a small busines and need to produce a financial statement from which you will prepare your tax return.

The method of recording depreciation is the same in either case. but the end goal is different. This section will discuss the differences between the two. But first, some terminology.

- Accumulated depreciation - the accumulated total of book depreciation taken over the life of the asset. This is accumulated in the depreciation account in the asset section.

- Book depreciation - this is the amount of depreciation that you record in your financial statements per accounting period.

- Fair market value - the amount for which an asset could be sold at a given time.

- Net book value - this is the difference between the original cost and the depreciation taken to date.

- Original cost - this is the amount that the asset cost you to purchase. It includes any cost to get the asset into a condition in which you can use it. For example - shipping, installation costs, special training.

- Salvage value - this is the value that you estimate the asset can be sold for at the end of it’s useful life (to you).

- Tax depreciation - this is the amount of depreciation that you take for income tax purposes.

Personal Finances

Depreciation is used in personal finances to periodically lower an asset’s value to give you an accurate estimation of your current net worth. For example, if you owned a car you could keep track of its current value by recording depreciation every year. To accomplish this, you record the original purchase as an asset, and then record a depreciation expense each year (See “Example”一节 for an example). This would result in the net book value being approximately equal to the fair market value of the asset at the end of the year.

Depreciation for personal finance has no tax implications, it is simply used to help you estimate your net worth. Because of this, there are no rules for how you estimate depreciation, use your best judgement.

For which assets should you estimate depreciation? Since the idea of depreciation for personal finances is to give you an estimate of your personal net worth, you need only track depreciation on assets of notable worth that you could potentially sell, such as a car or boat.

Business

As opposed to personal finance where the goal is tracking personal worth, business is concerned with matching the expense of purchasing capital assets with the revenue generated by them. This is done through book depreciation. Businesses must also be concerned with local tax laws covering depreciation of assets. This is known as tax depreciation. The business is free to choose whatever scheme it wants to record book depreciation, but the scheme used for tax depreciation is fixed. More often than not this results in differences between book and tax depreciation, but steps can be taken to reduce these differences.

Now, what purchases should be capitalized? If you expect something that you purchase to help you earn income for more than just the current year, then it should be capitalized. This includes things like land, buildings, equipment, automobiles, and computers - as long as they are used for business purposes. It does not include items that would be considered inventory. So if you made a purchase with the intent to resell the item, it should not be capitalized.

In addition to the purchase of the asset itself, any costs associated with getting the asset into a condition so that you can use it should be capitalized. For example, if you buy a piece of equipment and it needs to be shipped from out of town, and then some electrical work needs to be done so you can plug the machine in, and some specialized training is needed so you know how to use the machine, all these costs would be included in the cost of the equipment.

You also need to know the estimated salvage value of the asset. Generally, this is assumed to be zero. The idea behind knowing the salvage value is that the asset will be depreciated until the net book value (cost less depreciation) equals the salvage value. Then, when the asset is written off, you will not have a gain or loss resulting from the disposal of the asset.

The last step is to determine the method of depreciation that you want to use. This will be discussed on the next few pages.

警告

Be aware that different countries can have substantially different tax policies for depreciation; all that this document can really provide is some of the underlying ideas to help you apply your “favorite” tax/depreciation policies.

Estimating Valuation

A central issue with depreciation is to determine how you will estimate the future value of the asset. Compared to the often uncertain estimates one has to do where appreciation of assets is concerned, we are on somewhat firmer ground here. Using sources listed below should make it fairly straight forward to estimate the future value of your depreciating assets.

- Tax Codes: For businesses that want to use depreciation for tax purposes, governments tend to set up precise rules as to how you are required to calculate depreciation. Consult your local tax codes, which should explicitly state how to estimate depreciation.

- Car Blue Book: For automobiles, it is easy to look up in references such as “Blue Books” estimates of what an automobile should be worth after some period of time in the future. From this you will be able to develop a model of the depreciation.

Depreciation Schemes

A depreciation scheme is a mathematical model of how an asset will be expensed over time. For every asset which undergoes depreciation, you will need to decide on a depreciation scheme. An important point to keep in mind is that, for tax purposes, you will need to depreciate your assets at a certain rate. This is called tax depreciation. For financial statement purposes you are free to choose whatever method you want. This is book depreciation. Most small businesses use the same rate for tax and book depreciation. This way there is less of a difference between your net income on the financial statements and your taxable income.

This section will present 3 of the more popular depreciation schemes: linear, geometric, and sum of digits. To simplify the examples, we will assume the salvage value of the asset being depreciated is zero. If you choose to use a salvage value, you would stop depreciating the asset once the net book value equals the salvage value.

1. Linear depreciation diminishes the value of an asset by a fixed amount each period until the net value is zero. This is the simplest calculation, as you estimate a useful lifetime, and simply divide the cost equally across that lifetime.

Example: You have bought a computer for $1500 and wish to depreciate it over a period of 5 years. Each year the amount of depreciation is $300, leading to the following calculations:

表 16.1. Linear Depreciation Scheme Example

Year

Depreciation

Remaining Value

0

-

1500

1

300

1200

2

300

900

3

300

600

4

300

300

5

300

0

2. Geometric depreciation is depreciated by a fixed percentage of the asset value in the previous period. This is a front-weighted depreciation scheme, more depreciation being applied early in the period. In this scheme the value of an asset decreases exponentially leaving a value at the end that is larger than zero (i.e.: a resale value).

Example: We take the same example as above, with an annual depreciation of 30%.

表 16.2. Geometric Depreciation Scheme Example

Year

Depreciation

Remaining Value

0

-

1500

1

450

1050

2

315

735

3

220.50

514.50

4

154.35

360.15

5

108.05

252.10

注意

Beware: Tax authorities may require (or allow) a larger percentage in the first period. On the other hand, in Canada, this is reversed, as they permit only a half share of “Capital Cost Allowance” in the first year. The result of this approach is that asset value decreases more rapidly at the beginning than at the end which is probably more realistic for most assets than a linear scheme. This is certainly true for automobiles.

3. Sum of digits is a front-weighted depreciation scheme similar to the geometric depreciation, except that the value of the asset reaches zero at the end of the period. This is a front-weighted depreciation scheme, more depreciation being applied early in the period. This method is most often employed in Anglo/Saxon countries. Here is an illustration:

Example: First you divide the asset value by the sum of the years of use, e.g. for our example from above with an asset worth $1500 that is used over a period of five years you get 1500/(1+2+3+4+5)=100. Depreciation and asset value are then calculated as follows:

表 16.3. Sum of Digits Depreciation Scheme Example

Year

Depreciation

Remaining Value

0

-

1500

1

100*5=500

1000

2

100*4=400

600

3

100*3=300

300

4

100*2=200

100

5

100*1=100

0

Account Setup

As with most accounting practices, there are a number of different ways to setup depreciation accounts. We will present here a general method which should be flexible enough to handle most situations. The first account you will need is an Asset Cost account (GnuCash account type Asset), which is simply a place where you record the original purchase of the asset. Usually this purchase is accomplished by a transaction from your bank account.

In order to keep track of the depreciation of the asset, you will need two depreciation accounts. The first is an Accumulated Depreciation account in which to collect the sum of all of the depreciation amounts, and will contain negative values. In GnuCash, this is an account type asset. The Accumulated Depreciation account is balanced by a Depreciation Expense account, in which all periodic depreciation expenses are recorded. In GnuCash, this is an account type expense.

Below is a generic account hierarchy for tracking the depreciation of 2 assets, ITEM1 and ITEM2. The Asset Cost accounts are balanced by the Bank account, the Accumulated Depreciation account is balanced by the Expenses:Depreciation account.

-Assets

-Fixed Assets

-ITEM1

-Cost                (Asset Cost account)

-Depreciation     (Accumulated Depreciation account)

-ITEM2

-Cost                (Asset Cost account)

-Depreciation     (Accumulated Depreciation account)

-Current Assets

-Bank

-Expense

-Depreciation        (Depreciation Expense account)

One of the features of the account hierarchy shown above is that you can readily see some important summary values about your depreciating asset. The Assets:Fixed Assets:ITEM1 account total shows you the current estimated value for item1, the Assets:Fixed Assets:ITEM1:Cost shows you what you originally paid for item1, Assets:Fixed Assets:ITEM1:Depreciation shows you your accrued depreciation for item1, and finally, Expenses:Depreciation demonstrates the total accrued depreciation of all your assets.

It is certainly possible to use a different account hierarchy. One popular account setup is to combine the Asset Cost and Accrued Depreciation asset accounts. This has the advantage of having fewer accounts cluttering your account hierarchy, but with the disadvantage that to determine some of the summary details mentioned in the paragraph above you will have to open the account register windows. As with most things, there are many ways to do it, find a way that works best for you.

The actual input of the depreciation amounts is done by hand every accounting period. There is no way in GnuCash (as of yet) to perform the depreciation scheme calculations automatically, or to input the values automatically into the appropriate accounts. However, since an accounting period is typically one year, this really is not much work to do by hand.

Example

Let’s go ahead and step through an example. Imagine you are a photographer and you use a car and an expensive camera for your personal business. You will want to track the depreciation on these items, because you can probably deduct the depreciation from your business taxes.

The first step is to build the account hierarchy (as shown in the previous section, replace ITEM1 and ITEM2 with “car” and “camera”). Now, record the purchase of your assets by transferring the money from your bank account to the appropriate Asset Cost accounts for each item (eg: the Assets:Fixed Assets:Car:Cost account for the car). In this example, you start with $30k in the bank, the car cost $20k and the camera cost $10k and were both purchased on January 1, 2000.

图 16.1. Asset Accounts Before Depreciation

The asset accounts still only have the investments stored.

Looking at the tax codes, we realize that we must report depreciation on these items using the “sum of digits” scheme, over a 5 year period. So, the yearly depreciation amounts for the car come to $6667, $5333, $4000, $2667, $1333 for years 1 to 5 respectively, rounded to the nearest dollar. The yearly depreciation amounts for the camera are $3333, $2667, $2000, $1333, $667. Consult the previous section on Depreciation Schemes for the formula for calculating these values.

For each accounting period (IE: fiscal year) you record the depreciation as an expense in the appropriate Accrued Depreciation account (eg: the Assets:Fixed Assets:Car:Depreciation account for the car). The two windows below show your car’s accrued depreciation account and the main window after the third year (IE: three periods) of depreciation using this sum of digits scheme.

图 16.2. Asset Depreciation In The Register

This account shows a list of depreciation transactions.

图 16.3. Accounts Tab After Asset Depreciation

The asset accounts got decreased by the depreciation.

注意

A Word of Caution: Since depreciation and tax issues are closely related, you may not always be free in choosing your preferred method. Fixing wrong calculations will cost a whole lot more time and trouble than getting the calculations right the first time, so if you plan to depreciate assets, it is wise to make sure of the schemes you will be permitted or required to use.

第 17 章 Python Bindings

GnuCash historically has always been a traditional application in the sense that you open it, use it to manipulate your financial data via the windows it presents, save your data and close the windows again. This has the inherent limitation that you can only do whatever the windows, menus and toolbars allow you to do.

Sometimes you might need a little more flexibility. For example, you need a report with just a little different information than what the built-in reports provide, or you want to automate a frequently recurring action. Such custom manipulations are ideal candidates to write in one or the other scripting language.

Starting with GnuCash version 2.4 you can write Python scripts to manipulate your financial data.

重要

The Python extensions are an optional feature which creates additional dependencies. To be able to use Python scripts, GnuCash must have been built with the cmake -DWITH_PYTHON=ON … option enabled, otherwise all what follows won’t work. At present this option is not enabled by default, so if you need this, you may have to compile GnuCash from source yourself. But some distributions offer it also as a separate package with a name like python[version]-GnuCash

The Python extensions come with a couple of ready to use scripts. This chapter will show you how to use some of them.

提示

This chapter is not about how to write your own Python scripts. Refer to the developer documentation for that instead.

第 18 章 Importing Business Data

Importing Bills and Invoices

General

This functionality creates invoices or bills from a csv import file containing rows of invoice entry data. The import file may contain rows for new and/or existing invoices. If an invoice already exists, GnuCash adds the imported entries to the invoice (unless the invoice is already posted). If the import file contains posting data for an invoice, then GnuCash will also attempt to post the invoice. If any row of an invoice contains an error, GnuCash will ignore all rows of the same invoice.

The field separator in the csv file must be either a comma or a semicolon; field values may be enclosed in double quotes.

For the sake of readability, in this chapter the term “invoice” by itself is used to refer to both customer invoices and vendor bills.

The format of the import file

The import file should contain rows of invoice entry data. Any row contains both header and entry fields, but GnuCash takes the invoice header data from the first row of an invoice ID. For informational purposes, the header data may be repeated for each subsequent row of the same invoice.

There is no information in the file to indicate whether it concerns customer invoice or vendor bill data. Instead, a user option in the import dialog makes that distinction.

Each row should contain the fields listed below, in the same sequence, separated by a comma or a semicolon. The fields are listed here by their technical name, which GnuCash uses in the preview of the import data.

- id - The invoice ID. If the invoice ID is blank, GnuCash replaces it with the invoice ID from the previous row. If the invoice ID already exists, GnuCash will add the entries to the existing invoice (unless it is already posted).

- date_opened - Use the same date format as defined in Preferences. Defaulted to today's date if left blank, or if the date provided is not valid.

- owner_id - Customer or vendor number. Mandatory in the first data row of an invoice. If not provided, all rows of the same invoice will be ignored.

- billingid - Billing ID. Optional

- notes - Invoice notes. Optional.

- date - The date of the entry. Defaulted to date opened if left blank, or if the date provided is not valid.

- desc - Description. Optional

- action - Action. Optional

- account - Account for the entry. Mandatory in each row. If not provided or invalid, all rows of the same invoice will be ignored.

- quantity - Quantity. Defaulted to 1 if left blank.

- price - Price. Mandatory for each row. If not provided, all rows of the same invoice will be ignored.

- disc_type - Type of discount. Optional. Only relevant for invoices, not for bills. Use “%” or blank for percentage value, anything else for monetary value.

- disc_how - Discount how. Optional. Only relevant for invoices, not for bills. Use “>” for discount applied after tax, “=” for discount and tax applied before tax, and “<”, blank or anything else for discount applied before tax.

- discount - Amount or percentage of discount. Optional. Only relevant for invoices, not for bills

- taxable - Is this entry taxable? Optional. Use “Y” or “X” for yes, “N” or blank for no.

- taxincluded - Is tax included in the item price? Optional. Use “Y” or “X” for yes, “N” or blank for no.

- tax_table - Tax table. Optional. If the tax table provided does not exist, it will be blank in the invoice.

- date_posted - Date posted. Optional. Use the same date format as defined in Preferences. If you provide a date posted for the first row of an invoice, GnuCash will attempt to also post the invoice (as opposed to only saving or updating it).

- due_date - Due date. Optional. Use the same date format as defined in Preferences. Defaulted to date posted, if left blank. Only relevant in the first row of an invoice, if the invoice is posted.

- account_posted - Post to account, for vendor or customer posting. Only mandatory in the first row of an invoice, if the invoice is posted.

- memo_posted - Memo. Optional. Only relevant in the first row of an invoice, if the invoice is posted.

- accu_splits - Accumulate splits? Optional. Use “Y” or “X” for yes, “N” or blank for no. Only relevant in the first row of an invoice, if the invoice is posted. If you use a spreadsheet program to create the import file, it is advised not to use blank for no, because a final column with only blanks may not be recognized as relevant data when the spreadsheet program creates the csv file.

Note on double quotes

If you use the field separator character within a field, the field value should be enclosed in double quotes. Only for the fields description (desc) and notes, can you also include a double quote within a quoted field value, by doubling the double quote. E.g. "This field value uses the separator, and a ""quoted"" word", would be imported as This field value uses the separator, and a "quoted" word.

Example content for two bills; one of 2 entries, and one of 3 entries. The first is saved and posted, the second only saved. Using comma field separator, decimal point and dd/mm/yyyy date format.

1204;15/12/2018;2001;PO 210220;Special delivery;16/12/2018;Pride and Prejudice;pc;Expenses:Books;1;30.00;;;;X;;A1;17/12/2018;17/1/2019;Liabilities:Accounts Payable;;X

1204;15/12/2018;2001;PO 210220;Special delivery;16/12/2018;Electronic principles;pc;Expenses:Books;1;50.00;;;;X;;A1;17/12/2018;17/1/2019;Liabilities:Accounts Payable;;X

1205;15/12/2018;2044;PO 21099;;16/12/2018;Ultimate Guide;pc;Expenses:Books;1;10.01;;;;;;;;;;;

1205;15/12/2018;2044;PO 21099;;16/12/2018;Dinner & drinks;pc;Expenses:Dining;1;10.01;;;;;;;;;;;

1205;15/12/2018;2044;PO 21099;;16/12/2018;UG course;pc;Expenses:Education;1;10.01;;;;;;;;;;;

Example content for one customer invoice, with one entry, including tax and discount. Using comma field separator, decimal point and dd/mm/yyyy date format. The the value of the description field contains the separator character.

20221;16/12/2018;1001;Order 3378;Discount as agreed;4/12/2018;"Accounting part 1, 2";ea;Income:Other Income;1;769.95;%;=;10;X;N;A1;16/12/2018;16/01/2019;Assets:Accounts Receivable;Posted by import;X

Import your data

To import your invoice data, navigate to File → Import → Import Bills & Invoices… to open a new import dialog, and provide the necessary information.

- 1. Choose the file to import - Select your import file, or manually type the path and file name.

- 2. Select import type - Select the import type, either Bill or Invoice.

- 3. Select import options - Select your csv format. Use the with quotes options if your file contains fields enclosed in double quotes. These options also match fields not enclosed in quotes; except for the fields for description and notes, fields should not contain the quote character itself. See Note on double quotes above. Use one of the other options if your file does not have fields enclosed in quotes; any quote characters in the file will be imported as is.

- 4. Preview - Once you have selected your import file and csv format, GnuCash shows you a preview of the data. You can verify if your data is listed in the correct columns. If you do not see any rows in the preview, then GnuCash was not able to match your import data rows to the selected csv format. See “What could go wrong?”一节 below.

- 5. Afterwards - You can choose if GnuCash should open tabs for the invoices after the import. Either for all invoices, or for the invoices that are saved but not posted, or for none of the invoices. Opening tabs slows down the import process considerably.

- Start the import - If you are satisfied with your selections, hit the OK button to start the import.

If your data file contains invoice IDs that already exist, then GnuCash will ask you (once per import session) to confirm that you want to update existing invoices. If not confirmed, all rows for existing invoices will be ignored.

注意

Internally, GnuCash uses so called regular expressions to match the import rows to the data fields. The import option Custom regular expression offers the option to use your own regular expression for this matching process. Obviously, this option requires that you are well versed in regular expressions. When you choose the option Custom regular expression, GnuCash opens a window in which you can edit the GnuCash regular expression, or replace it with your own. Your regular expression should contain a named subpattern for each of the fields of the csv file (using the technical names). A custom regular expression could be useful if the rows of your source data file contain all required fields, but in a different order or format. E.g. if the format of your source data file starts with customer number, followed by invoice ID, followed by the due date, and uses | as separator, your regular expression would start with something like this:

^(?<owner_id>[^|]*)\|(?<id>[^|]*)\|(?<due_date>[^|]*)

With a custom regular expression, GnuCash could import your source data files, without the need to convert them to the GnuCash import format.

Feedback and statistics

GnuCash executes the import process in three steps:

- Import - Imports the data file and attempts to match each row to the data fields.

- Validation and adjustment - Validates the data fields and replaces data with defaults if applicable.

- Processing - Handles the currency related validations, and creates, updates and posts the invoices.

After all steps have finished, GnuCash issues information about the result of the process. The initial dialog shows the informational or error messages from the validation and processing steps. The second dialog shows the statistics of the process:

- Import - rows ignored: the number of rows that could not be matched to the data fields.

- Import - rows imported: the number of rows that were successfully matched to the data fields.

- Processing and validation - rows fixed: the number of rows for which a default value was used for a field.

- Processing and validation - rows ignored: the number of rows for that were not processed because of a validation error.

- Processing and validation - invoices created: the number of invoices created.

- Processing and validation - invoices updated: the number of invoices that were updated.

If there were unmatched rows in the import step, a final dialog shows the actual rows that could not be matched.

What could go wrong?

Errors in the import step

If the statistics show unmatched rows under “Import - rows ignored”, then there is some issue with the format of your import file. Verify that you use and select the correct separator. Verify that your data rows have exactly 21 separator characters (1 for each field, except for the last). Verify whether you use the separator character within a data field; if so, enclose the field in double quotes.

If you use one of the with quotes import options, verify if you use the double quote character in any of the data field values; if within the description or notes fields, make sure that the field value is quoted, and precede each double quote within the field with an extra double quote; if within any other field, remove the double quote character.

Errors in the validation step

The following errors can occur in the validation step. Any error in a data row will cause all rows of the same invoice to be ignored.

注意

In versions 3.4 and earlier, an error in a data row would cause just that row to be ignored, as opposed all rows of the same invoice.

- The field ID is blank. GnuCash replaces a blank invoice ID with the invoice ID from the previous row. But the first row of the import file should always have an invoice ID.

- The field owner_id is blank. Every first row of an invoice should have an owner_id.

- The customer or vendor number in field owner_id does not exist. The owner_id in the first row of an invoice should be an existing customer (for invoices) or vendor (for bills).

- The date in field date_posted is not a valid date. If you provide a value for date_posted in the first row of an invoice, it should be a valid date. Did you use the date format as set in Preferences?

- The account in the field account_posted does not exist. If you provide a value for the field date_posted in the first row of an invoice, the field account_posted should be an existing account.

- The account in the field account_posted is not of type Accounts Receivable (for invoices) or Accounts Payable (for bills). If you provide a value for the field date_posted in the first row of an invoice, the field account_posted should be an account of the correct type.

- The field price is blank. Every row should have a value for the field price.

- The account in the field account does not exist. Every row should have an existing account in the field account.

Any error in the validation step is listed after the overall import process completes. Correct your data file accordingly.

Errors in the processing step

The following errors can occur in the processing step.

- The invoice cannot be updated because it is already posted. All rows of the same invoice will be ignored. If you want to update the existing invoice, unpost it first in GnuCash.

- The currency of the invoice differs from the currency of the account posted (“Invoice x NOT posted because currencies don't match”). GnuCash determines the currency of the invoice either from the customer or vendor master data (for a new invoice) or from the invoice itself (for an existing invoice). The currency of the invoice must agree with the currency of the post to account in the field account_posted. GnuCash creates the invoice but cannot post it. Manually correct the invoice in GnuCash.

- The invoice requires currency conversion. (“Invoice x NOT posted because it requires currency conversion”). The invoice contains entries on accounts with different currencies, or the currency of the entries differs from the currency of the post to account. For such an invoice, GnuCash needs exchange rates to translate the currency amounts. GnuCash creates the invoice but cannot post it. Post the invoice manually in GnuCash, and provide the requested exchange rates.

Not supported invoice functionality

Currently the invoice import function does not support (at least) the following:

- Import of billing terms and job.

- Import of customer and job in default chargeback project for bills.

- Application of billing terms from customer or vendor master data.

- Automatic numbering of invoices.

- Credit notes.

Importing Customers and Vendors

General

This functionality creates and updates customers and vendors from a csv import file containing rows of vendor/customer master data. The import file may contain rows for new and/or existing customers/vendors. If a customer/vendor already exists, GnuCash updates the existing customer/vendor.

The format of the import file

The import file should contain rows of customer/vendor data, one row for each customer/vendor. The customer/vendor is identified by the customer/vendor number in the field id of the data rows. If the field is blank, GnuCash will use the next number from the relevant counter (set in the Counters tab under File → Properties ).

There is no data in the file to indicate whether it concerns customer or vendor master data. Instead, a user option in the import dialog makes that distinction.

Each row should contain the fields listed below, in the same sequence, separated by a comma or a semicolon. The fields are listed here by their technical name, which GnuCash uses in the preview of the import data.

- id - The customer/vendor number. If it is for an existing customer/vendor, GnuCash will update the customer/vendor. Note that in GnuCash e.g. '000010' is a different customer number than '10'. If the id field is empty, GnuCash will use the next number from the relevant counter.

- company - The company name. If it is left blank, it is defaulted to the value of field name. If that is also blank, then the row is ignored.

- name - Billing address - Name. Optional.

- addr1 - Billing address - Address line 1. At least one of the four address lines of the billing address must be filled. If not, then the row is ignored.

- addr2 - Billing address - Address line 2.

- addr3 - Billing address - Address line 3.

- addr4 - Billing address - Address line 4.

- phone - Billing address - Phone. Optional

- fax - Billing address - Fax. Optional

- email - Billing address - Email. Optional

- notes - Notes. Optional

- shipname - Shipping information - Name. Optional. Not relevant for vendors.

- shipaddr1 - Shipping information - Address line 1. Optional. Not relevant for vendors.

- shipaddr2 - Shipping information - Address line 2. Optional. Not relevant for vendors.

- shipaddr3 - Shipping information - Address line 3. Optional. Not relevant for vendors.

- shipaddr4 - Shipping information - Address line 4. Optional. Not relevant for vendors.

- shipphone - Shipping information - Phone. Optional. Not relevant for vendors.

- shipfax - Shipping information - Fax. Optional. Not relevant for vendors.

- shipmail - Shipping information - Email. Optional. Not relevant for vendors.

Example content for a customer with a separate shipping address. Using a semicolon for separator.

2201;All Star Company;All Star Company;Union Avenue 776;San Juan;CA;;0482938838;;contact@allstar.com;Last contacted on 4/4/2018.;All Star Company; John Alderman, Office 456;Union Avenue 777;San Juan;CA;78998766;;alderman@allstar.com

Example content for a vendor; no ID given, so GnuCash will take the next number from the counter. Using a comma for separator.

,Johnson Supplies,Johnson Supplies,Electric Park 56,Plains,VA,,0482986538,,jack@johnson.com,Discount negotiated,,,,,,,,

All fields by technical name in the required sequence.

id, company, name, addr1, addr2, addr3, addr4, phone, fax, email, notes, shipname, shipaddr1, shipaddr2, shipaddr3, shipaddr4, shiphone, shipfax, shipmail

Import your data

To import your customer or vendor data, navigate to File → Import → Import Customes & Vendors… to open a new import dialog, and provide the necessary information.

- 1. Choose the file to import - Select your import file, or manually type the path and file name.

- 2. Select import type - Select the import type, either Customer or Vendor.

- 3. Select import options - Select your csv format. Use the with quotes options if your file contains fields enclosed in double quotes. These options also match fields not enclosed in double quotes, but fields should not contain the double quote character itself. Use one of the other options if your file does not have fields enclosed in quotes; any double quote characters in the file will then be imported as is.

- 4. Preview - Once you have selected your import file and csv format, GnuCash shows you a preview of the data. You can verify if your data is listed in the correct columns. If you do not see any rows in the preview, then GnuCash was not able to match your import data rows to the selected csv format. See “What could go wrong?”一节 below.

- Start the import - If you are satisfied with your selections, hit the OK button to start the import.

注意

Internally, GnuCash uses so called regular expressions to match the import rows to the data fields. The import option Custom regular expression offers the option to use your own regular expression for this matching process. Obviously, this option requires that you are well versed in regular expressions. When you choose the option Custom regular expression, GnuCash opens a window in which you can edit the GnuCash regular expression, or replace it with your own. Your regular expression should contain a named subpattern for each of the fields of the csv file (using the technical names). A custom regular expression could be useful if the rows of your source data file contain all necessary fields, but in a different order or format. E.g. if the format of your source data file starts with customer number, followed by company name, name, and one address field, and that is all you want to import, then your custom regular expression would be something like this (using comma as a separator):

^(?<company>[^,]*),(?<id>[^,]*),(?<name>[^,]*),(?<addr1>[^,]*),(?<addr2>[^,]*),(?<addr3>[^,]*)$

With a custom regular expression, GnuCash could import your source data files, without the need to convert them to the GnuCash import format.

Feedback and statistics

GnuCash executes the import process in three steps:

- Import - Imports the data file and attempts to match each row to the data fields.

- Validation and adjustment - Validates the data fields and replaces data with defaults if applicable.

- Processing - Creates or updates the vendor or customer master data.

After all steps have finished, GnuCash issues information about the result of the process. The initial dialog shows the statistics of the process:

- Import results - lines ignored: the number of rows that could not be matched to the data fields.

- Import results - lines imported: the number of rows that were successfully matched to the data fields.

- Import results - customers/vendors fixed: the number of rows for which a default value was used for a field.

- Import results - customers/vendors ignored: the number of rows for that were not processed because of a validation error.

- Import results - customers/vendors created: the number of customers/vendors created.

- Import results - customers/vendors updated: the number of customers/vendors that were updated.

If there were unmatched rows in the import step, a final dialog shows the actual rows that could not be matched.

What could go wrong?

Errors in the import step

If the statistics show unmatched rows under “Import results - lines ignored”, then there is some issue with the format of your import file. Verify that you use and select the correct separator. Verify that your data rows have exactly 18 separator characters (1 for each field, except for the last). Verify whether you use the separator character within a data field; if so, enclose the field in double quotes.

If you use one of the with quotes import options, verify if you use the double quote character in any of the data field values. If so, remove them; importing double quotes as is, is not supported when using the with quotes import options.

Errors in the validation step

If the statistics show rows under “Import results - customers/vendors ignored”, then data rows were ignored because of one of the errors below:

- The field company and the field name are both blank. The field company is mandatory; if it is blank, then it is defaulted to the value of the field name, but if both are blank, then the data row cannot be processed.

- The fields addr1, addr2, addr3 and addr4 are all blank. At least one of these fields must have a value, otherwise the data row cannot be processed.

Not supported customer/vendor functionality

Currently the customer/vendor import function does not support (at least) the following:

- Import of any of the fields in the customer tab for billing information: currency, terms, discount, credit limit, tax included and tax table.

- Import of any of the fields in the vendor tab for payment information: currency, terms, tax included and tax table.

部分 IV. 附录

GnuCash 术语表

下面列出了 GnuCash中出现的常见术语。其中一些条目引自维基百科。

科目

科目用于跟踪你的资产、负债、花费和收入。

会计期间

会计期间指编制一个实体的会计账簿所参照的期间。常见的会计期间有月度、季度和年度期间。

AqBanking

一个实现德国家庭银行计算机接口（HBCI）和电子银行互联网通信标准（EBICS）、OFX Direct Connect和Paypal的库。它是openHBCI的继承者。

资产

资产是你拥有的某些东西。 任何有形的或无形的，可以拥有或控制以产生积极的经济价值的东西都可被视为资产。

资产负债表

资产负债表是个人或组织财务余额的汇总。它总结了一家公司在特定时间点的资产、负债和所有者权益。

账簿

账簿是对个人或组织所有交易的记录。在 GnuCash中，每个文件包含一个账簿。

资本利得 / 资本损失

指在出售投资品时，投资品的买入价和卖出价之间的差额。又称 实现获利 / 实现损失。在投资吕出售之前，现价与买入价间的差额称为 未实现收益 / 未实现损失。

参见Realized Gain/Loss, Unrealized Gain/Loss.

股本

见Stock.

科目汇总表

数据文件中所有可用科目的列表。科目汇总表包括资产负债表科目（资产、负债、股东权益）和损益表科目（收入、费用、收益、损失）。

佣金

支付给经纪人买卖证券的费用。

商品

商品是易于交易或出售的有价值的东西，比如货币、股票、债券、粮食、铜、石油都是商品。

普通股

见Stock.

复利

利息重新投入后可以产生它自己的利息（利息产生的利息）。

成本基准？

Cost basis is the original cost of property, adjusted for various factors. Its primary use is for tax purposes. Factors that affect the cost basis include: stock splits, dividends, depreciation and return of capital distributions. Cost basis is used to determine the capital gain.

CSV

Stands for Comma Separated Values. CSV files are used to store data in plain text. Each line of the file is a record and each record can be comprised of multiple fields separated by commas. CSV is one import format that GnuCash supports.

股息

Dividends are cash payments a company makes to shareholders. The amount of this payment is usually determined as some amount of the profits of the company. Not all common stocks give dividends. 股息是一家公司向持股人支付的现金。股息金额通常取决于公司利润。不是所有普通股都会支付股息。

Equities

Equities are investments in which the investor becomes part (or whole) owner in something.

Financial Transaction Services (FinTS)

A banking protocol used by German banks. Developed by the German Central Banking Committee ZKA (Zentraler Kredit-Ausschuss). The standard is used only by German banks. Prior 2002, it was called Home Banking Computer Interface (HBCI). FinTS is one import format that GnuCash supports.

参见Home Computer Banking Interface (HBCI).

GSettings

Since version 2.5 the tool that stores user configuration data. It uses the native data store of the operating system:

Linux

DConf since Gnome 3.0 dropped GConf

macOS

Defaults. Use the command-line defaults(1) to modify prefs when GnuCash isn't running.

Windows

Registry.

Home Computer Banking Interface (HBCI)

A bank-independent online banking protocol used by German banks. Home Banking Computer Interface (HBCI) was developed by the German Central Banking Committee ZKA (Zentraler Kredit-Ausschuss). Since 2002, it has been called Financial Transaction Services (FinTS). HBCI is one import format that GnuCash supports.

参见Financial Transaction Services (FinTS).

利息

借款人为使用贷款人的钱而支付的费用。通常表示为每年本金的百分比。例如，一个利率为1%的储蓄账户，每年每存入100美元，就会付给你1美元。

负债

负债是个人或组织所欠的债务。

LibOFX

An open source library for OFX. It was created by one of the GnuCash developers, originally to be the OFX interface for GnuCash.

参见OFX.

流动性

衡量一项投资转换为现金的难易程度。储蓄账户里的钱流动性很强，而投资在房子里的钱流动性很低，因为卖房子需要时间。

Lot

A lot is a means of grouping a commodity so that you later identify that the item bought in one transaction is the same as one sold in a different transaction. Lots are often implemented with stocks, where capital gain can depend on which item is being sold at a given time.

MT940

A financial information standard defined by SWIFT and used by several European banks. It is also used internally in HBCI. Unfortunately, you can't download the MT940 standard, but some banks publish it on their websites. MT940 is one import format that GnuCash supports.

OFX

The Open Financial eXchange format. This is a financial information exchange standard used by many institutions. OFX is one import format that GnuCash supports.

Price Database

The price database contains a store of price quotes for stocks, mutual funds, and currencies.

Principal

The original amount of money invested or borrowed.

QFX

The Quicken Financial eXchange format is a proprietary financial information exchange standard promoted by Quicken and used by many institutions. QFX is one import format that GnuCash supports.

QIF

The Quicken Interchange Format (QIF) is an open specification for reading and writing financial data to files. This is an older format that is still used by many institutions. QIF is one import format that GnuCash supports.

Realized Gain/Loss

The difference between the purchase and selling prices of an investment at the time the investment is sold. Also known as Capital Gain/Loss. Before an investment is sold, the difference in value is referred to as Unrealized Gain/Loss.

参见资本利得 / 资本损失, Unrealized Gain/Loss.

Reconciliation

Reconciliation is a verification process in which the user compares their records with those of the financial institution to ensure that the records in each system agree at some particular point in time. During reconciliation, the user checks individual transactions in their file against the institution's statement; upon completion, the reported balances of the institution and the reconciled account will match at that point in the register.

Return

The total income plus capital gains or losses of an investment.

参见收益率.

Reversing Transaction

In formal accounting, a transaction is never deleted. Therefore, when a mistake is made, the original transaction remains in the ledger, and a transaction is added to the ledger that reverses the original. This reversing transaction duplicates the original transaction, but with debit and credit amounts reversed. This removes the effect of the erroneous transaction from the books. After entering the reversing transaction, a corrected transaction can then be entered. Reversing transactions are not commonly used in personal accounting.

风险

投资回报与预期不同的可能性。投资通常可以从低风险（例如储蓄帐户或政府债券）到高风险（例如普通股或垃圾债券）分类。一般来说，风险越高，可能的回报也就越高。

计划交易

计划交易提供了一个框架，用于记住有关设置为将来发生一次或定期发生的交易的信息。

参见收益率.

Scheme

Scheme is a functional programming language based on a dialect of LISP. Reports in GnuCash use the Scheme programming language; thus, users wishing to customize reports must write Scheme.

Shareholder

A shareholder is a person who holds common stock in a company.

Split

A split, or Ledger Entry, is the fundamental accounting unit. Each split consists of an amount, the value of that amount expressed in a (possibly) different currency, a Memo, a pointer to the parent Transaction, a pointer to the debited Account, a reconciled flag and timestamp, an action field, and a key-value frame which can store arbitrary data.

Stock

A security that represents a certain fractional ownership of a company. This is what you buy when you “buy stock” in a company on the open market. This is also sometimes known as capital stock, or common stock.

Stock split

Occurs when a company offers to issue some additional multiple of shares for each existing stock. For example, a “2 for 1” stock split means that if you own 100 shares of a stock, you will receive an additional 100 shares at no cost to you. The unit price of the shares will usually be adjusted so there is no net change in the value, so in this example the price per share will be halved. Note that such transactions affect the cost basis per share owned.

Transaction

A transaction consists of a date, a description, an ID number, a list of two or more splits, and a key-value frame. Transactions embody the notion of "double entry" accounting.

Unrealized Gain/Loss

Unrealized gain or loss is the difference in value between a purchase price and the current value of a given asset. These gains remain unrealized until the asset is sold, at which point they become Realized gains or losses.

参见资本利得 / 资本损失, Realized Gain/Loss.

Valuation

The process of determining the market value or the price the investment would sell at in a “reasonable time frame”.

XML

可扩展标记语言是一种国际通用的标记标准。 GnuCash 默认使用XML存储数据。

收益率

A measure of the amount of money you earn from an investment (i.e., how much income you receive from the investment). Typically, this is reported as a percentage of the principal amount. Yield does not include capital gains or losses (see Return). For example, a stock that sells for $100 and gives $2 in dividends per year has a yield of 2%. 对投资盈利的金额的度量，也就是从投资中得到了多少收入。收益率一般记为本金的百分比。收益率不含资本收益或损失。 例如，某股票售价100美元且每年分红2美无，其收益率为2%。

附录 A. Migration Guide

This appendix is to help current users of other financial software packages in their migration to GnuCash. We address the conceptual differences between the layout of GnuCash accounts versus other software packages.

Using Accounts vs. Categories

If you are familiar with other personal finance programs, you are already accustomed to tracking your income and expenses as categories. Since GnuCash is a double-entry system (see “会计概念”一节), income and expenses are tracked in accounts. The basic concept is the same, but the account structure allows more consistency with accepted business practices. So, if you are a business user as well as a home user, GnuCash makes it easy to keep track of your business as well as your personal accounts.

Income and expense accounts give you the same information you would get with categories, but they also give you more flexibility in entering your transactions. In GnuCash, you have the option to enter transactions directly into income and expense accounts through their account registers. Other programs that use categories do not offer this option, because there is no “account register” for a category.

You also have the option in GnuCash to treat income and expense accounts exactly as you would treat categories, if you are more comfortable with that method. In Quicken® and similar programs, transactions require an account and a category. Substitute an income or expense account name in GnuCash where you would normally enter a category name in the other programs, and the result should be the same. We will discuss transaction entry in “交易”一节 in greater detail.

Importing Data

If you want to import data from your previous application, you should distinguish between financial data and other data. Probably the best way to import financial data is the “Quicken Interchange Format” QIF . It is a specific format for financial data, which most financial applications for the private sector know and can use for export.

For other data we suggest the use of the “Comma Separated Value” CSV format.

Import of Financial Data by QIF Files

See https://en.wikipedia.org/wiki/Quicken_Interchange_Format for it's details.

Some GnuCash users collected their knowledge about the best use in our https://wiki.gnucash.org/wiki/Quicken_Migration.

For other formats and more details see 第 3 章 Importing Data into GnuCash.

Import of Business Data by CSV Files

If you want to import customers and vendors or bills and invoices see 第 18 章 Importing Business Data.

Converting XML GnuCash File

The GnuCash XML data file can be transformed to almost any other data format (e.g., QIF, CSV...) quite easily if one is familiar with the “Extensible Stylesheet Language Transformations” XSLT. The GnuCash data file is well-formed XML, and it can therefore be run through an XSLT parser with an associated stylesheet. This allows one to transform the file to just about any format that can be designed, given a properly written stylesheet.

A few steps need to be followed. The writing of a stylesheet is a task for a different time, but if you can get one written, here’s what you need to do:

1. Copy the GnuCash XML data file to a working file.

重要

If the file was last modified by a version of GnuCash older than 2.0, then before you continue to the next step you will need to modify the working file’s <gnc-v2> tag to read something like this:

<gnc-v2 xmlns:cd="http://www.gnucash.org/XML/cd"

xmlns:book="http://www.gnucash.org/XML/book"

xmlns:gnc="http://www.gnucash.org/XML/gnc"

xmlns:cmdty="http://www.gnucash.org/XML/cmdty"

xmlns:trn="http://www.gnucash.org/XML/trn"

xmlns:split="http://www.gnucash.org/XML/split"

xmlns:act="http://www.gnucash.org/XML/act"

xmlns:price="http://www.gnucash.org/XML/price"

xmlns:ts="http://www.gnucash.org/XML/ts"

xmlns:slot="http://www.gnucash.org/XML/kvpslot"

xmlns:cust="http://www.gnucash.org/XML/cust"

xmlns:entry="http://www.gnucash.org/XML/entry"

xmlns:lot="http://www.gnucash.org/XML/lot"

xmlns:invoice="http://www.gnucash.org/XML/invoice"

xmlns:owner="http://www.gnucash.org/XML/owner"

xmlns:job="http://www.gnucash.org/XML/job"

xmlns:billterm="http://www.gnucash.org/XML/billterm"

xmlns:bt-days="http://www.gnucash.org/XML/bt-days"

xmlns:sx="http://www.gnucash.org/XML/sx"

xmlns:fs="http://www.gnucash.org/XML/fs"

xmlns:addr="http://www.gnucash.org/XML/custaddr">

注意

You can put pretty much anything you want behind the equal signs, but a unique URL is what is typically used.

2. Create an XSLT stylesheet containing the transformation your desire, or obtain one that’s already written.

User Contributed XSLT Stylesheets

- in our repository: https://github.com/Gnucash/gnucash/tree/stable/contrib/xslt

- in our wiki: https://wiki.gnucash.org/wiki/De/export_to_excel_xls_transform

3. Install an XSLT processor such as Saxon (https://en.wikipedia.org/wiki/Saxon_XSLT) or Xalan (https://en.wikipedia.org/wiki/Apache_Xalan). Any conforming processor will do, really...

4. Run the work file and the stylesheet through the processor according to the processor’s instructions.

5. You will now have a file in the desired output format. An enterprising individual could go so far as to write a stylesheet to transform the GnuCash data file to an Apache OpenOffice/LibreOffice Calc (or vice-versa, for that matter). Such things as QIF ought to be a little less work.

Benefits are that you don’t need to write a Scheme module or a new C routine to do this transformation. Anyone who knows or can learn XML and XSLT can perform this task. Not much harder, really, than writing a Web page....

Anyhow, I just wanted this tidbit to be captured somewhere permanently. The process works on 5.5 datafiles, and ought to work on earlier versions, too.

附录 B. Auxiliary File Formats

These are the formats of some auxiliary files used by GnuCash.

Check Format Files (*.chk)

Overview

The check format file is used to tell GnuCash how to print a check or checks onto a page of paper. This file first describes the overall layout of a page (number of checks, orientation, etc) and then describes the layout of the specific items on a single check. The file is organized as a typical Key/Value file used by many Linux applications. Keys/values pairs are grouped into sections that begin with the group name enclosed in square brackets.

GnuCash looks for check format files in two different locations when you bring up the check printing dialog. The first location is typically /usr/share/gnucash/checks, where check files distributed with the application can be found. The second location is the user private ~/.local/share/gnucash/checks [2] directory. Users may add check formats at any time (even while GnuCash is running) simply by dropping a new *.chk file in this directory. The next time the check printing dialog is opened the new check format will appear in the list of available check formats.

注意

Printing functions differently depending on the version of GTK that is installed on your system. When GnuCash is using a version of GTK prior to 2.10 all offsets are measured from the lower left corner of the page or check. When using GTK 2.10 or later, all offsets are measured from the upper left corner of the page or check.

Example file

A typical GnuCash check file is presented below. The contents of this file will be described in the next sections.

[Top]

Guid = 67b144d1-96a5-48d5-9337-0e1083bbf229

Title = Quicken/QuickBooks (tm) US-Letter

Rotation = 0.0

Translation = 0.0;4.0

Show_Grid = false

Show_Boxes = false

[Check Positions]

Height = 252.0

Names = Top;Middle;Bottom

[Check Items]

Type_1 = PAYEE

Coords_1 = 90.0;102.0;400.0;20.0

Type_2 = AMOUNT_WORDS

Coords_2 = 90.0;132.0

Type_3 = AMOUNT_NUMBER

Blocking_Chars_3 = true

Coords_3 = 500.0;102.0

Type_4 = DATE

Coords_4 = 500.0;67.0

Type_5 = NOTES

Coords_5 = 50.0;212.0

Field Descriptions

Top Group

This section of the check file describes the overall layout of a page of checks (or check) that goes into the printer.

表 B.1. Overall Page Description Fields

Name

Type

Required

Description

Guid

string

mandatory

The guid is used to uniquely identify a check format to GnuCash. It must be unique across the entire set of application supplied and user supplied check formats. If you copy an application check file as the basis of your own check format, you must change this value. The uuidgen program may be used to generate these identifiers.

Title

string

mandatory

The title is used to uniquely identify a check format to the user. This value is presented verbatim in the check format list of the check printing dialog. If you copy an application check file as the basis of your own check format, you should change this value. The title may be any utf-8 string.

Font

string

optional

If supplied, this is the default font used to print all text items on this check. This field can contain any string that is acceptable by gtk as a font specifier. If this field is omitted, the default font is the font specified in the GnuCash preferences dialog. A typical string would be “sans 12”.

Blocking_Chars

boolean

optional

If supplied, this is the default used when printing all TEXT items on this check. When set to true, will print *** before and after each text field on the check. Blocking characters are printed to protect check fields from alteration. For example, the amount field may be printed as ***100.00***

DateFormat

boolean

optional

If supplied, this is the default used when printing all DATE items on this check. When set to true, will print the format of the DATE in 8 point type, centered and below the actual DATE. For example DDMMYYYY.

Rotation

double

optional

This value specified the rotation of the entire page (in degrees) around the origin point. For gtk versions prior to 2.10, the origin point is in the lower left corner of the page and rotation values increase in the counter-clockwise direction. For gtk version 2.10 and later, the origin point is in the upper left corner of the page and rotation values increase in the clockwise direction. Rotation of the page is applied before translation.

Translation

list of 2 doubles

optional

These values specify the x and y translation of the entire page (in points) relative to the origin point. For gtk versions prior to 2.10, the origin point is in the lower left corner of the page and translation values increase moving up and to the right. For gtk version 2.10 and later, the origin point is in the upper left corner of the page and translation values increase moving down and to the right. Rotation of the page is applied before translation.

Show_Grid

boolean

optional

If this value is set to true then GnuCash will draw a grid on the page, starting at the origin with the lines spaced every 50 points. This can be helpful when creating a check format file.

Show_Boxes

boolean

optional

If this value is set to true then for each item where the width and height have been specified, GnuCash will draw a box showing location and maximum size of that item . This can be helpful when creating a check format file.

注意

The Blocking_Chars and DateFormat options are defined for all check formats in Edit->Preferences->Printing. It is recommened that these global options be set to false (the default), and that the options be set for individual Check Items as described below.

Check Positions Group

This group of items specifies how multiple checks are laid out on the same sheet of paper, and gives names to each of these check locations so that a user can specify which check location that GnuCash should print. This entire group of key/value pairs is optional, and should be omitted if the format file only specifies a single check per page of paper.

表 B.2. Multiple Checks Per Page Fields

Name

Type

Required

Description

Height

double

mandatory

This field specifies the height of a single check on the page. If there are multiple checks per page then this item is mandatory. If there is only a single check per page, this entire section should be omitted.

Names

list of strings

mandatory

This field specifies the names of the check locations that can be printed on each page. These names represent the check positions starting from the top of the page and moving downward. The names are presented verbatim in the check position list of the check printing dialog. A typical value for this field is "Top;Middle;Bottom", but it could also be "First;Second;Third" or any other set of strings that clearly identify the check locations. If there are multiple checks per page then this item is mandatory. If there is only a single check per page, this entire section should be omitted.

Check Items Group

This section specifies the individual items that are printed on the check. There is no limit to the number of items that may be present in this section, and any given type of item can be repeated multiple times. This allows for the printing of checks that have a side stub, or for the one-per-page business checks that have both the check and multiple check stubs on the same page. For example, to print the payee name on a business check and on both stubs, simply specify three payee items with differing print coordinates.

Each key names in this section explicitly includes the item number to which it applies. E.G. The key named Type_1 applies to the first item to be printed, and the key Coords_3 applies to the third item to be printed. Item numbers start at one and increase sequentially. Any gap in the numbering sequence is interpreted by GnuCash as the end of the item list. Items are printed in the order of their item numbers, not in the order in which they appear in the file.

Each item specified must include a type declaration. The rest of the parameters for that item depend upon the particular type of that item. See 表 B.4 “Individual Check Item Types” for a list of valid item types and their required parameters.

表 B.3. Individual Check Item Fields

Name

Type

Required

Description

Type_n

string

mandatory

This field specifies the type of a single item to be printed on a check. See 表 B.4 “Individual Check Item Types” for a list of valid item types.

Coords_n

list of 2 or 4 doubles

mandatory

This field specifies the coordinates where the item should be placed on a check, and optionally also specifies the width and height of the item. The numbers in order are the X and Y offset of the lower left corner of the item, and optionally the width and height of the item. If the width is supplied then the height must also be supplied, so this field will always contain two or four numbers. For gtk versions prior to 2.10, the origin point is in the lower left corner of the page and translation values increase moving up and to the right. For gtk version 2.10 and later, the origin point is in the upper left corner of the page and translation values increase moving down and to the right.

注意

Regardless of whether the origin is at the top or the bottom of the page, the coordinates always specify the lower left point of the item.

Font_n

string

optional

If supplied, this is the font used to print this specific text item. This field can contain any string that is acceptable by gtk as a font specifier. If this field is omitted, the default font is the font specified in the Top section of the check description file, or if that was omitted the font specified in the GnuCash preferences dialog. This field is only recognized when using gtk version 2.10 or later.

Align_n

string

optional

If supplied, this is the alignment used to print this specific text item. This field must contain one of the strings “left”, “center” or “right”. If this field is omitted, the text will be left aligned. This field is only recognized when using gtk version 2.10 or later.

Text_n

string

optional

This field is only used when the item type is TEXT. It specifies the utf-8 text that should be printed on the check.

Filename_n

string

optional

This field is only used when the item type is PICTURE. It specifies the filename of the image that should be printed on the check. The string may specify either an absolute path name or as a relative path name. If a relative path name is specified, GnuCash first looks in in the application check format folder (typically /usr/share/gnucash/checks ) for the image file, and if it is not found there then it looks in the user private ~/.local/share/gnucash/checks[2] directory for the image. This field is only recognized when using gtk version 2.10 or later.

Blocking_Chars_n

boolean

optional

If supplied, this will set the print Blocking_Chars option for this item.

DateFormat_n

boolean

optional

If supplied, this will set the print DateFormat option for this item.

These are the individual items that can be printed on a check. All items require the coordinates on the page where the item should be printed. The majority of these items result in text being printed on the page, and these items may have individual font and alignments specified. For example, the numerical amount of a check could be printed right justified while everything else is printed left justified. Other types may have unique parameters.

表 B.4. Individual Check Item Types

Name

Required Fields

Optional Fields

Description

PAYEE

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the check payee name at the specified coordinates.

DATE

Coords

Font

Align

Blocking_Chars

DateFormat

This type value tells GnuCash to print the check date at the specified coordinates.

NOTES

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the transaction notes field at the specified coordinates.

CHECK_NUMBER

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the check number at the specified coordinates. The check number reflects the book option selection under File → Properties for number source (transaction number or anchor-split action - see Use Split Action Field for Number in the Book Options section of the GnuCash Manual).

MEMO

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the split memo field at the specified coordinates.

ACTION

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the split action field at the specified coordinates. However, the printed field reflects the book option selection under File → Properties for number source (transaction number or anchor-split action - see Use Split Action Field for Number in the Book Options section of the GnuCash Manual). If number source for the book is specified as anchor-split action, this field will instead print the transaction number field.

AMOUNT_WORDS

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the check amount in words at the specified coordinates. The amount will appear similar to the string "One thousand, two hundred thirty four and 56/100".

AMOUNT_NUMBER

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the check amount in numbers at the specified coordinates. The amount will appear similar to the number "$1,234.56".

ADDRESS

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the address at the specified coordinates.

SPLITS_ACCOUNT

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the account names for each split entry stating at the specified coordinates. See the note on splits printing.

SPLITS_AMOUNT

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the amount for each split entry stating at the specified coordinates. Amounts are printed with currency symbols. See the note on splits printing.

SPLITS_MEMO

Coords

Font

Align

Blocking_Chars

This type value tells GnuCash to print the memo text for each split entry stating at the specified coordinates. See the note on splits printing.

TEXT

Coords, Text

Font

Align

Blocking_Chars

This type value tells GnuCash to print an arbitrary string at the specified coordinates. The string to be printed is specified with the Text_n key.

PICTURE

Coords, Filename

(none)

This type value tells GnuCash to print an image at the specified coordinates. The image to be printed is specified with the Filename_n key. This type is only recognized when using gtk version 2.10 or later.

注意

SPLIT items include all split entries for the transaction except for the split that applies to the current account register (referred to as the anchor-split). This is usually the last split listed when splits are displayed in the register. The coordinate location defines the lower left location for the split information.

Creating Check Format Files

Creating your own check format file is a fairly simple task. The easiest way to start is to copy an existing check format file from the application directory (typically /usr/share/gnucash/checks) to the directory ~/.local/share/gnucash/checks[2]. Make sure to change the guid so the new file will be accepted by gnucash, and change the title to something descriptive. Then change or add individual item fields as necessary. You can also create a new check file by clicking the Save Format button on the Custom format page of the check printing dialog.

注意

Key names are case sensitive. If you are having problems with a check format file, ensure that all key names have capital letters as documented above.

[2] Up to GnuCash 2.6.21 it was ~/.gnucash/checks

附录 C. GNU Free Documentation License

Version 1.1, March 2000

版权 © 2000 Free Software Foundation, Inc.

Free Software Foundation, Inc. 59 Temple Place,

Suite 330, Boston, MA

02111-1307  USA

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other written document “free” in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”.

A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.

The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.

A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not “Transparent” is called “Opaque”.

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.

The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies of the Document numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

- A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

- B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).

- C. State on the Title Page the name of the publisher of the Modified Version, as the publisher.

- D. Preserve all the copyright notices of the Document.

- E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

- F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

- G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice.

- H. Include an unaltered copy of this License.

- I. Preserve the section entitled “History”, and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

- J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

- K. In any section entitled “Acknowledgements” or “Dedications”, preserve the section’s title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

- L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

- M. Delete any section entitled “Endorsements”. Such a section may not be included in the Modified Version.

- N. Do not retitle any existing section as “Endorsements” or to conflict in title with any Invariant Section.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.

You may add a section entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version .

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections entitled “History” in the various original documents, forming one section entitled “History”; likewise combine any sections entitled “Acknowledgements”, and any sections entitled “Dedications”. You must delete all sections entitled “Endorsements.”

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and dispbibute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an “aggregate”, and this License does not apply to the other self-contained works thus compiled with the Document , on account of their being thus compiled, if they are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document’s Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

Addendum

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

Copyright YEAR YOUR NAME.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in the section entitled “GNU Free Documentation License”.

If you have no Invariant Sections, write “with no Invariant Sections” instead of saying which ones are invariant. If you have no Front-Cover Texts, write “no Front-Cover Texts” instead of “Front-Cover Texts being LIST”; likewise for Back-Cover Texts.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.