Set up

Set up automatic account decisions

Created: Updated: Estimated time: 30 min

On the Finance tab you set up how each expense claim line gets its account and tax class. "Create the finance set" builds five apps with starter data in your kintone. An account is decided in three steps: your rules, an AI proposal, then the approver confirms. The AI only proposes; a person decides. AI proposals are not tax advice. The data stays in your kintone, not on PRING's servers.

Steps

The AI only proposes an account. A person (the approver) decides. The screen also says "AI proposals are not tax advice. The approver is responsible for the confirmed account." It does not replace tax or accounting judgement.

  1. 1. Create the finance set on the Finance tab

    Open the PRING settings of the expense claim app (kintone app settings, then Plugins, then Settings on the PRING row) and press the Finance tab (財務). Under "1. Create the finance set", press "Create the finance set". Five apps are created in this kintone: 勘定科目マスタ (chart of accounts), 科目の質問 (questions), 科目判定ルール (rules), 科目判定の履歴 (history) and 仕訳 (journal). It takes 1 to 2 minutes. When it finishes you see something like "Created 5, already existed 0" and the line changes to "5 of 5 apps exist". You need permission to create apps. If it stops halfway, press the button again: finished parts are skipped and it continues from there.

  2. 2. Check the starter data and adjust it

    Open 勘定科目マスタ, 科目の質問 and 科目判定ルール from the kintone app list. Created on a Japanese screen, they contain 72 accounts, 4 example questions and 10 example rules. Change 有効 (active) to 無効 (inactive) for accounts you do not use. Make the 費目 (expense category) of the questions and rules exactly the same text as the choices of the category field in the claim lines. How to write them is explained below, under "How to write a question" and "How to write a rule".

  3. 3. Add the result fields to the claim line table

    In the form of the expense claim app, add these fields to the line table (subtable). Single-line text: proposed account (勘定科目 (提案)), proposed tax class (税区分 (提案)), confirmed account (確定科目) and confirmed tax class (確定税区分). Number: confidence of the proposal (提案の確からしさ). Multi-line text: reason for the proposal (提案の理由) and answers to the questions (質問への答え). Accounts are stored as codes (for example 6260), so make the confirmed and proposed account fields single-line text. Press Update app after you change the form.

  4. 4. Map the fields under "2. Map the expense claim fields"

    On the Finance tab, choose the claim line table in "Line table". A list of items appears below. Assign one field of the table to each item. The items marked * (費目, 金額 (税込), 勘定科目 (提案) and 確定科目) are required. Leave the others on "Do not assign" if you do not use them. One field cannot be assigned to two items.

  5. 5. Choose the whole-claim fields

    Under "Whole-claim fields", choose the "Claim number field" (single-line text or record number), the "Payment method field" (single-line text, drop-down or radio button), the "Name of the approved status" and the "Action names to stop when the confirmed account is empty". Choosing the claim number field is recommended, because the journal export for one claim and the replacement when approval is repeated both work by claim number. The initial approved status name is 承認済. Use the same name as the last status of the expense claim's process management. For a business app set created in English or Thai, that is the name in that language (for example Approved). "Action names to stop when the confirmed account is empty" holds the names of the actions to stop when a confirmed account is empty. If you leave it empty the default rule applies (see "When approval is stopped" below).

  6. 6. Decide how entries are made under "3. Journal"

    "How tax is entered" is "One line, tax included" or "Two lines: net and tax". "Tax rounding" is Round down (initial), Round or Round up. It is used when the claim line has no tax amount and the tax is calculated from the rate in the tax class name (the 10 in 課税仕入 10%). The "Credit account" fields (cash, paid by employee, advance) take the names of the accounts (initially 現金, 未払金 and 仮払金).

  7. 7. Decide whether to use the AI

    Tick "Allow asking the AI when rules cannot decide" to show "Ask AI" on each line. The AI runs on your own Gemini API key, which you register on the AI settings tab (the same key as AI mapping). If you clear the box, or no key is registered, only rules decide. The AI only proposes; a person decides. AI proposals are not tax advice.

  8. 8. Save and update the app

    Press "Save". When you see "Saved. Update the app to apply.", press Update app in kintone. If you see "Cannot save", the reasons are listed: fix those items and press "Save" again.

  9. 9. Check permissions and try one claim

    Check that the people who use expense claims can view the finance apps (see "Permissions" below). Open a new expense claim record: "Decide accounts" (勘定科目を判定) appears at the top of the screen. Enter one line and press it.

The five apps of the finance set

“Create the finance set” creates these five apps. App names and field names are Japanese in every display language. The English meaning is in parentheses.

App One record Main fields
勘定科目マスタ (chart of accounts) One account コード (code; required, unique), 勘定科目名 (account name; required), 区分 (type: 資産 assets / 負債 liabilities / 純資産 equity / 収益 revenue / 費用 expenses), 既定の税区分 (default tax class), 有効 (active: 有効 / 無効), 判定のヒント (hint given to the AI)
科目の質問 (questions) One question 費目 (expense category), 質問 ID (question ID), 質問文 (question text), 答えの型 (answer type), 選択肢 (choices), 並び順 (order), 必須 (required)
科目判定ルール (rules) One “condition → account” row 費目, ルール名 (rule name), 優先度 (priority), 条件の組み合わせ (how conditions combine), 条件 (conditions table), 勘定科目 (account; chosen from the chart of accounts), 税区分 (tax class), メモ (memo)
科目判定の履歴 (history) One line confirmed at approval 確定した日 (date confirmed), 費目, 取引先 (counterparty), 摘要 (memo), 金額 (amount), 質問への答え (answers), AI の提案 (proposal), 確定した科目 (confirmed account), 提案と違った (differed from the proposal), 申請番号 (claim number)
仕訳 (journal) The journal entry of one claim line 日付 (date), 摘要, 借方 (debit) account, tax class and amount, 貸方 (credit) account, tax class and amount, 税額 (tax), 申請番号, 明細の行 (line number)
  • A mark such as [PRING finance:coa] is added to each app’s description. PRING finds the apps of the set by this mark. Do not delete it.
  • One set is enough for one kintone. The settings screen of another expense claim app finds the apps with the mark and uses the same set.
  • PRING does not set permissions on the created apps. They keep kintone’s initial permissions.

Starter data

Starter data goes only into empty apps. Pressing the button again does not add it a second time. The language of the accounts follows the language of the settings screen (the kintone login user’s language; the language chosen with “Display language” at the top right takes priority).

Settings screen language Accounts Questions Rules
Japanese 72 (assets 18, liabilities 10, equity 2, revenue 4, expenses 38) 4 10
English 29 none none
Thai 26 none none

The Japanese accounts are those small and medium-sized companies in Japan commonly use. The English and Thai lists are short examples: add the accounts your company uses.

Created on a Japanese screen, example questions and rules are also added. They are based on Japanese custom and are not tax judgements. Decide them with your tax accountant and edit them. Here are the example rules (the “condition” column shows question ID, condition and value):

Category Priority Rule name (English meaning) Condition Account
会議費、交際費 10 Dining with outsiders, over 5,000 yen per person → entertainment outside である あり, and per_person > 5000 接待交際費
会議費、交際費 20 Dining with outsiders, 5,000 yen or less per person → meetings outside である あり, and per_person ≦ 5000 会議費
会議費、交際費 30 Internal dining → welfare outside である なし 福利厚生費
交通費 10 Business trip → travel trip である はい 旅費交通費
交通費 20 Transport that is not a business trip → commuting allowance (check) trip である いいえ 通勤手当
宿泊費 10 Lodging → travel none 旅費交通費
通信費 10 Communication → communication none 通信費
消耗品費 10 Books and magazines → books and newspapers usage である 書籍・雑誌 新聞図書費
消耗品費 20 Equipment of 100,000 yen or more → equipment (fixed asset) $amount ≧ 100000 工具器具備品
消耗品費 90 Everything else → supplies none 消耗品費

The four example questions are these:

Category Question ID Question (English meaning) Answer type Required
会議費、交際費 outside Did anyone from outside the company join? はい・いいえ (あり / なし) 必須
会議費、交際費 people Total number of people (including you) 数値 (number) 必須
交通費、宿泊費 trip Is this a business trip (not a normal commute)? はい・いいえ (はい / いいえ) 必須
消耗品費 usage Purpose 選択 (choice: office supplies / books and magazines / equipment / other) 任意

The categories of the example rules match the expense categories of the expense claim in the business app set (交通費 / 宿泊費 / 会議費 / 交際費 / 消耗品費 / 通信費 / その他). If you use other category names, change the 費目 of the questions and rules to exactly the same text as your categories. A category matches only when the text is identical.

How to write a question

Write one question per record in the 科目の質問 app. When the applicant opens “Decide accounts”, the questions that match the category of the line appear.

Field How to write it
費目 The categories the question appears for. Empty means every category. Separate several with “、” (for example 会議費、交際費)
質問 ID (required) The name the rule conditions use to refer to this question. Use exactly the same text in the rule’s condition
質問文 (required) The text shown to the applicant
答えの型 選択 (choice) / 数値 (number) / はい・いいえ (yes/no) / 文章 (text)
選択肢 One per line. For choice and yes/no, writing choices gives a drop-down. Without choices it is an input box
並び順 Shown in ascending order
必須 必須 / 任意 (optional; the initial value is optional). Until a required question is answered, neither “Decide by rules” nor “Ask AI” proceeds

If the question with ID people (total number of people) is answered, the amount divided by the number of people (decimals dropped) can be used in rule conditions as per_person.

How to write a rule

Write one rule per record in the 科目判定ルール app. For a claim line, PRING checks the rules that match its category in ascending order of priority, and the first one that applies becomes the proposal. For equal priority, the order in the app applies.

Field How to write it
費目 The categories the rule is checked for. Empty means every category. Separate several with “、”
ルール名 (required) Shown as the reason: “Matched rule: (rule name)”
優先度 (required) Checked in ascending order (initial value 50)
条件の組み合わせ すべて (all conditions apply) / どれか (any condition applies)
条件 (table) One row per condition: 質問 ID, 条件 and 値
勘定科目 (required) Chosen from the chart of accounts
税区分 If empty, the account’s default tax class
メモ A memo for administration

The choices for “条件” are these:

Condition Meaning Mostly used with
= / ≠ / > / ≧ / < / ≦ Number comparison Numbers (amount, people)
である / でない Is / is not Choice, yes/no
のどれか Equals one of the candidates written in the value, separated by “、”, “,” or line breaks Choice
を含む The answer text contains the value Text
  • Instead of a question ID you can use these names: $amount is the amount of the line (tax included), $tax is the tax of the line and per_person is the amount per person.
  • A condition that uses a question that is not answered yet does not apply (this includes でない).
  • A rule with no condition row always applies. Give it a large priority number and use it as “everything else”.

Fields to assign in the claim lines

On the Finance tab, under “2. Map the expense claim fields”, assign fields of the line table. Items marked “(required)” must be assigned or you cannot save. The labels of these items are Japanese in every display language.

Item Field types allowed Use
費目 (category; required) Single-line text, drop-down, radio button, LOOKUP Matched against the 費目 of questions and rules, as identical text
利用日 (date of use) Date Date of the journal entry. If empty, the approval date
金額 (税込) (amount, tax included; required) Number, calculated Amount of the entry, and $amount in rules
消費税 (tax) Number, calculated If it has a value, it is the tax of the entry. If empty, it is calculated from the rate of the tax class
取引先・内容 (counterparty and details) Single-line or multi-line text Given to the AI. Becomes the counterparty in the history
登録番号 (registration number) Single-line or multi-line text Given to the AI
摘要 (memo) Single-line or multi-line text Memo of the journal entry and history. If empty, the counterparty and details
理由 (reason) Single-line or multi-line text The applicant’s reason. Given to the AI
質問への答え (answers) Single-line or multi-line text The answers are written automatically
勘定科目 (提案) (proposed account; required) Single-line or multi-line text The code of the proposed account is entered
税区分 (提案) (proposed tax class) Single-line or multi-line text The proposed tax class is entered
提案の確からしさ (confidence) Number A decimal from 0 to 1 (for example 0.82)
提案の理由 (reason for the proposal) Single-line or multi-line text The reason from the rule or the AI
確定科目 (confirmed account; required) Single-line text, drop-down, radio button, LOOKUP The code of the confirmed account is entered
確定税区分 (confirmed tax class) Single-line text, drop-down, radio button, LOOKUP The confirmed tax class is entered

The expense claim in the business app set has 利用日, 費目, 内容・訪問先 and 金額 in its lines. They can be assigned to date of use, category, counterparty and details, and amount (tax included).

Journal settings

When a claim is approved, each claim line becomes a journal entry by these rules.

  • The debit is the name of the confirmed account. The tax class is the confirmed tax class (the account’s default if empty).
  • The credit is decided by the value of the “Payment method field”. A value containing 仮払 or equal to あり gives the advance account (仮払金). A value containing 現金 or 会社 gives cash (現金). Anything else (なし or empty) is treated as paid by the employee and gives 未払金. The account names are those in the “Credit account” settings.
  • The tax is the value of the claim line’s 消費税 if there is one. If it is empty, the gross amount is split using the rate in the tax class name (the 10 in 課税仕入 10%) and rounded by the “Tax rounding” setting. A tax class with no rate (such as non-taxable) gives tax 0.
  • With “One line, tax included”, one claim line becomes one journal entry. With “Two lines: net and tax”, a line with tax becomes two entries: the net amount, and a tax entry whose debit account is 仮払消費税.

Permissions

PRING does not set permissions on the apps of the finance set. They keep kintone’s initial permissions. Check these:

Who Permission needed If missing
The person who creates the finance set Create apps “Could not create them. Check that you can create apps, then press again (finished parts are skipped).”
People who use expense claims View 勘定科目マスタ, 科目の質問, 科目判定ルール and 科目判定の履歴 “Could not load the accounting data. Check that you can view the finance apps.”
People who approve (to fill in the confirmed account) Edit the expense claim record The detail screen is read-only, so the confirmed account cannot be filled in
People who approve Add and delete records in 科目判定の履歴 and 仕訳 (to replace the entries of the same claim) Approval goes through, but history and journal entries are not created
People who export the journal View 仕訳 “Could not export. Check that you can view the journal app.”

When approval is stopped

If even one line has no confirmed account, the approval action is stopped. The message is, for example, “2 line(s) have no confirmed account. Check the proposals and fill in the confirmed account before approving.” The person who submits can submit the claim even if the confirmed accounts are empty. The approver confirms: in edit mode the approver fills in the confirmed accounts, then presses the approval action.

Which actions are stopped is decided by “Action names to stop when the confirmed account is empty” under “Whole-claim fields” on the Finance tab. The label on the screen is “Action names to stop when the confirmed account is empty (empty = names containing Approve; separate with commas)”. The real rule is more detailed than that label, so follow the table below.

“Action names to stop when the confirmed account is empty” Actions that are stopped
Empty (default) Actions whose names contain 承認, 決裁, Approve or อนุมัติ (Latin letters are not case-sensitive, so Approval also counts), and in addition any action that moves the record to the status named in “Name of the approved status”
Names written Actions whose name is exactly the same as a name you wrote (not “contains”), instead of the default rule of names containing 承認 or 決裁. Separate several with “、” or “,” (for example 確認、最終確認). Spaces around a name are ignored. An action that moves the record to the approved status is still stopped even if its name is not in the list

These are never stopped: actions whose names contain 差し戻し, 差戻し, 却下, 取り下げ, 取下げ, Reject, Return, Withdraw, Deny, Send back, ส่งกลับ or ปฏิเสธ. Even if you write one of them in “Action names to stop when the confirmed account is empty”, it is not stopped. Submitting (申請) is not stopped by default. It is stopped only when you write its name in “Action names to stop when the confirmed account is empty”, or when a conditional route makes the submission move the record straight to the approved status.

If you clear “Show Decide accounts on the expense claim screens”, the button and the stop both disappear. How users work is described in Decide accounts on expense claims.

Frequently asked questions

Can I use this without the AI?

Yes. Clear "Allow asking the AI when rules cannot decide" and "Ask AI" is not shown; only rules decide. For lines the rules cannot decide, a person chooses the confirmed account.

What happens if no Gemini key is registered?

Rules still decide as before. Pressing "Ask AI" shows "The AI key is not registered. Register a Gemini key under AI settings to get proposals for lines the rules cannot decide." and no proposal is entered. A person can still choose the confirmed account and carry on.

Is an AI proposal tax or accounting advice?

No. The AI only proposes candidate accounts. It does not replace tax or accounting judgement, and a proposal is not guaranteed to be correct. The screen also says "AI proposals are not tax advice. The approver is responsible for the confirmed account." The example questions and rules in the starter data follow Japanese custom and are not tax judgements. Decide them with your tax accountant and edit them.

Is the data sent to PRING's servers?

Accounts, questions, rules, history and journal entries are all stored in apps in your kintone, not on PRING's servers. "Decide by rules" runs inside the kintone screen and sends nothing to PRING. Only when you press "Ask AI" are the contents of that one line (category, date, amount, tax, counterparty, registration number, memo, reason and the answers to the questions), the list of active accounts and up to 20 earlier confirmed examples sent through PRING's server to the AI, using your Gemini key. The server uses them in memory and discards them. What it logs is limited to information unrelated to the content: a request ID, the model name, token counts and whether it succeeded or failed. Accounts, amounts and counterparties are not logged.

What happens if I press "Create the finance set" again?

You can. PRING finds the apps of the set by the mark in the app description, such as [PRING finance:coa], and creates only the missing ones. The button label becomes "Fill in missing apps and starter data". Starter data goes only into empty apps. An app whose mark you deleted cannot be found, so it is created again. Do not delete the marks.

May I edit or delete the starter data?

Yes. Accounts, questions and rules are ordinary kintone records. Setting an account to 無効 (inactive) removes it from the choices for the confirmed account and from the list given to the AI. The AI can be given up to 400 active accounts, and the content sent in one request is limited to 20 KB. If you delete every record and press the button again, the starter data goes in again.

What differs if I create the set on an English or Thai screen?

The starter accounts are that language's list (29 for English, 26 for Thai). The example questions and rules go in only when you create the set on a Japanese screen. App names and field names are Japanese in every language.

Approving says "... line(s) have no confirmed account" and will not go on.

If even one line has no confirmed account, the approval action is stopped. Open the claim in edit mode, open "Decide accounts" and fill in the confirmed account on every line (use "Accept proposal" if the proposal is right). Submitting, sending back, rejecting and withdrawing are not stopped. To change which action names are stopped, write them in "Action names to stop when the confirmed account is empty" on the Finance tab. If you do not want to use the feature on that app, clear "Show Decide accounts on the expense claim screens" on the Finance tab: the button and the stop both disappear.

I approved, but no history or journal entries were created.

They are created when the expense claim moves to the status named in "Name of the approved status" on the Finance tab. If that name differs from the last status of the process management, nothing is created. If the person who approved has no permission to add and delete records in 科目判定の履歴 and 仕訳, approval still goes through but the history and journal entries are not created.

What if I do not choose the claim number field?

When approval is repeated, the history and journal entries of the same claim are not replaced; they pile up. Also "Export journal (CSV)" on the detail screen exports every journal entry, not just that claim's. Choose the claim number field.

Written and maintained by: TechJapan LLC (PRING team) (Developer and operator) · Contact