muni-corn / silverfox

The double-entry plain-text accounting tool designed with budgeting in mind
GNU General Public License v3.0
6 stars 0 forks source link

Register command #14

Closed muni-corn closed 3 years ago

muni-corn commented 4 years ago

(details below)

muni-corn commented 4 years ago

I think the Ledger will handle creating the output for each entry. Each output line (each entry has one) contains a left, middle, and right segment.

The left contains the date: <date> <status> <description> <payee?>

The center contains: <from_accounts> -> <to_accounts>, showing the flow of currency.

The right contains the amount earned or spent from the account passed into the register command, or asset accounts by default, if they exist.

To the right of each line is a running total of the account passed into the register command, or all assets by default.

Columns

The register output is made up of columns:

Entries will return a struct made up of all possible strings that could appear in their register output.

pub struct EntryRegisterData {
    date: String,
    status: char,
    description: String,
    payee: String,
    accounts: (String, String)       // from, to
    short_accounts: (String, String) // from, to
    non_focused_account: String      // not account-in-question
    amounts: AmountPool
}
 2020/06/24 * Groceries              assets:checking -> expenses:groceries      -10        -10

 2020/06/24 * Electricity bill       assets:checking -> expenses:electricity    -30        -40

 2020/06/24 * Salary                   income:salary -> assets:checking       +1000        960

 2020/06/24 * Bought Bitcoin         assets:checking -> assets:crypto          -500        460
                                                                                 +0.3 BTC    0.3 BTC

 2020/06/24 * Bought Ethereum        assets:checking -> assets:crypto          -200        260
                                                                                 +1.0 ETH    1.0 ETH
=====================================================================================================
                                                                                           260
                                                                                             0.3 BTC
                                                                                             1.0 ETH

Notice:

The register eliminates details when space is limited, starting with the starts of account names:

 2020/06/24 * Groceries              checking -> groceries        -10        -10

 2020/06/24 * Electricity bill       checking -> electricity      -30        -40

 2020/06/24 * Salary                   salary -> checking       +1000        960

 2020/06/24 * Bought Bitcoin         checking -> crypto          -500        460
                                                                   +0.3 BTC    0.3 BTC

 2020/06/24 * Bought Ethereum        checking -> crypto          -200        260
                                                                   +1.0 ETH    1.0 ETH
=======================================================================================
                                                                             260
                                                                               0.3 BTC
                                                                               1.0 ETH

Then, with statuses, asset accounts (or other account in question), and running totals:

 2020/06/24 Groceries            groceries    -10

 2020/06/24 Electricity bill   electricity    -30

 2020/06/24 Salary                  salary  +1000

 2020/06/24 Bought Bitcoin    (conversion)   -500
                                               +0.3 BTC

 2020/06/24 Bought Ethereum   (conversion)   -200
                                               +1.0 ETH
========================================================
                                              260
                                                0.3 BTC
                                                1.0 ETH

Then, if all else fails, dates, all accounts, the one-space padding on the left and right, and the ends of descriptions:

Grocerie...   -10

Electric...   -30

Salary      +1000

Bought B...  -500
               +0.3 BTC

Bought E...  -200
               +1.0 ETH
=======================
              260
                0.3 BTC
                1.0 ETH

As the available space gets shorter and shorter, these specific actions are taken in order: