Skip to content

Jasu/Lokki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lokki

Command line billing.

Installation

Add the downloaded directory to your path.

Dependencies

  • SQLAclhemy: sudo pip install SQLAlchemy
  • prettytable: sudo pip install prettytable
  • Pystache sudo pip install pystache

Usage

Initializing database

lk init db_path.sqlite

Init command disregards the currently selected database as this could cause data loss.

Selecting database

The active database is selected by the environment variable LK_DB_PATH. It should contain a path to an SQLite database.

Lakki is able to start a shell session with the variable set:

lk shell db_path.sqlite

If a relative path is specified, it is converted to an absolute path before starting the shell.

Managing settings

lk config set setting-name value

lk config get \[setting-name\]

lk config list

Available settings

seller-name

Required. Seller name, displayed in invoices.

seller-address

Required. Seller street address, displayed in invoices.

seller-address-2

Second row of the street address.

seller-zip-code

Required. Seller ZIP code, displayed in invoices.

seller-city

Required. Seller city, displayed in invoices.

seller-iban

Required. Seller IBAN, displayed in invoices.

seller-bank

Required. Seller bank name, displayed in invoices.

seller-bic

Required. Seller bank BIC, displayed in invoices.

seller-company-number

Required. Seller local company number, displayed in invoices.

seller-vat-number

Seller VAT number, displayed in invoices.

seller-country

Seller country, displayed in invoices.

next-invoice-number

Number of the next invoice. Incremented every time an invoice is created.

default-due-days

Default number of days from the generation of the bill.

default-client

Handle of the default recipient of the bills.

default-vat

Percentage of default VAT to add.

invoice-template-path

Path to the template for the invoice

invoice-filename-template

Template of the bill filename. Available tokens:

{{d}}

Two-digit day of the month

{{m}}

Two-digit month

{{y}}

Four-digit year

{{n}}

Number of the invoice

{{invoice.x}}

Invoice parameters.

Managing clients

Adding client

lk client add handle 

Client may be added incomplete, but it may not be used until all required settings are set.

Setting client setting

lk client set handle setting-name setting-value

Getting client setting

lk client get handle setting-name

Removing client

lk client remove handle

Clients with billed invoices may not be removed.

Listing clients

lk client list

Displaying client info

lk client show \[--json\] client_number

Available client setting names

name

Required. Name of the client, displayed in invoices.

address

Required. Address of the client, displayed in invoices.

zip_code

Required. ZIP code of the client, displayed in invoices.

city

Required. City of the client, displayed in invoices.

country

Country of the client, displayed in invoices.

client_number

Number of the client. If not set, the id of the client in DB is used.

Managing invoices

All invoice commands target the latest non-billed invoice unless invoice number is specified.

Adding a new invoice

lk invoice add \[--invoice-number 1\] \[--date 1970-01-01\] \[--due-date 1970-01-14\]  \[--due-days 14\]

If invoice number is specified, the number of the next invoice is not incremented. This can be used to bring in invoices generated by other sources having their own distinct sequences.

Removing an invoice

lk invoice remove \[--invoice-number 1\]

Billed invoices cannot be removed.

Displaying

lk invoice show \[--json\] \[--invoice-number 1\]

Generating invoice HTML

lk invoice generate  \[--filename output.html\] \[--template template.html\] \[invoice-number\]

If filename is omitted, a filename is generated using the default template.

Marking an invoice as billed

lk invoice bill \[--invoice-number 1\]

Marking an invoice as unbilled

lk invoice unbill \[--invoice-number 1\]

Unbilling marks the bill as unbilled, but does not generate a new bill to void it.

Managing simple invoice rows

All row commands target the latest non-billed invoice unless invoice number is specified.

Invoices that are billed cannot be edited.

Adding a row

lk row add \[--invoice-number 1\] \[--vat 22%\] title price-per-unit \[units\] 

Default number for units is one.

Removing a row

lk row remove \[--invoice-number 1\] row-index

Setting row settings

lk row set \[--invoice-number 1\] row-index setting-name setting-value

Getting row settings

lk row get \[--invoice-number 1\] row-index setting-name

Managing composite invoice rows

All composite commands target the latest non-billed invoice unless invoice number is specified.

Invoices that are billed cannot be edited.

Adding a composite row

lk composite add \[--invoice-number 1\] \[--vat 22%\] title

Removing a composite row

lk composite remove \[--invoice-number 1\] row-index

Adding a composite subrow

lk composite sub \[--invoice-number 1\] \[--row-index\] title unit_price \[number_of_units\]

number_of_units is 1 by default.

Removing a composite subrow

lk composite subremove \[--invoice-number 1\] row-index

Setting composite row settings

lk composite set \[--invoice-number 1\] row-index setting-name setting-value

Getting composite row settings

lk composite get \[--invoice-number 1\] row-index setting-name

Moving subrow between composite rows

lk subrow mv \[--invoice-number 1\] src-row-index target-row-index subrow-index

Managing event handlers

Event handlers are shell commands that are executed when an event is triggered.

Available events

  • bill Triggered when an invoice is billed. Arguments:

  • unbill Triggered when an invoice is unbilled. Arguments:

  • generate Triggered when an invoice HTML has been generated.

Adding event handlers

lk event add event-name command

Removing event handlers

lk event remove [--id id] [--event event --index index]

Index is the number of the event handler displayed in lk event list.

Setting event handler values

lk event set [--id id] [--event event --index index] setting_name 
  setting_value

Index is the number of the event handler displayed in lk event list.

Getting event handler values

lk event get [--id id] [--event event --index index] setting_name 

Index is the number of the event handler displayed in lk event list.

Listing event handlers

lk event list \[event-name\]

TODO

  • Increment the invoice number only when setting as billed.

About

Command-line (Finnish) billing system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors