sean1832 / Invoice-CLI

A C++ tool for creating, managing, and emailing invoices in Excel and PDF formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invoice CLI

Invoice-CLI is a versatile C++ CLI application that leverages OpenXLSX and Boost libraries to generate, manage, and email invoices, allowing seamless batch writing to Excel files, exporting to PDFs, and provides a user-friendly command-line interface to meet all invoicing needs efficiently.

Note: This project is for my personal use and is not intended for public use. However, if you find it useful, feel free to use it.

Please note that this project is my first C++ project, so the code may not be the best. I am still learning C++ and will continue to improve the code quality.

Installation

Download the latest release from the releases.

Usage

./invoice --help

The invoice CLI requires a command and a set of options to run. The following commands are available:

Primary commands

  • write - write invoice to file
  • export - export invoice to pdf
  • send - send invoice via email

Chain commands

  • write-export - write and export invoice in one command
  • write-export-send - write, export and send invoice in one command

Options

  • -i or --id - customer id
  • d or --date - invoice date
  • H or --hour - number of hours
  • r or --rate - hourly rate
  • --append - append line to existing invoice

Misc

  • -h or --help - show help message
  • --show - show all profiles data
  • --open [arg] - open configuration file in specified editor
    • --open profile - open profile configuration file
    • --open credentials - open credentials configuration file
    • --open config - open program config configuration file

Examples

./invoice write -c 1 -d "23/09/2023"

Configuration

The invoice CLI requires a configuration file to run. There are three configuration files:

  • config.json - program configuration file:
    • This file contains core program configuration data, including program behaviour, file paths, and other miscellaneous data.
  • credentials.json - email credentials configuration file
    • This file contains email credentials data, including email address and password. Note that you must use an app password if you are using Gmail. You can generate an app password here.
  • profile.json - profile configuration file
    • This file contains profile data, including customer information and invoice information. You can add as many profiles as you want, but you have to comply with the following format:
{
    "customers":[
        {
            "id": 1,
            "name": "customer name",
            "phone": "customer phone",
            "address": "customer address",
            "default_param": {
                "hours": 65.0,
                "rate": 477.0,
                "description": "description",
                "gst_code": "code"
            },
            "recipient_detail": {
                "recipient_email": "eamil@gmail.com",
                "subject" : "subject",
                "body" : "body..."
            }
        },
        ...
    ],
    "provider" : {
        "name": "provider name",
        "email": "email@gmail.com",
        "phone": "provider phone",
        "address": "provider address",
        "abn": "port abn",
        "payment_methods": "payment methods",
        "bsb": "provider bsb",
        "account_name": "provider account name",
        "account_number": "provider account number"
    }
}

Note: The default_param field is optional. If you do not specify a default parameter, the program will use the default value in the program configuration file.

Note: The id field must be unique. If you have multiple profiles, you must ensure that each profile has a unique id.

Prerequisites (development)

OpenXLSX

Detail installation guide on openxlsx see here.

Also see README.md in openxlsx github repo for more information.

nlohmann-json

vcpkg install nlohmann-json

boost-program-options

vcpkg install boost-program-options

curl

vcpkg install curl

About

A C++ tool for creating, managing, and emailing invoices in Excel and PDF formats.

License:MIT License


Languages

Language:C++ 84.7%Language:C# 12.4%Language:Python 1.8%Language:C 1.1%