Skip to main content

Infoicer is a simple invoice items handler.

Project description

infoicer

Infoicer is a simple invoice items handler. It can group items by type and tax rate which helps in building the invoice for a customer.

Features

  • All price handling is utilized with Decimal type to avoid float rounding problems
  • Easy to group invoice items by type and tax rate
  • Implemented object serialization
  • No external dependencies

Installation

From PyPi:

$ pip install infoicer

or clone repository:

$ git clone git@github.com:edkirin/infoicer.git

Basic usage

from infoicer import Invoice, InvoiceItem
from decimal import Decimal

invoice = Invoice()

invoice.add(InvoiceItem(
    name="Ham",
    item_type='food',
    price=Decimal(10),
    qty=1,
    tax_rate=Decimal(5),
))

invoice.add(InvoiceItem(
    name="Spam",
    item_type='food',
    price=Decimal(15),
    qty=3,
    tax_rate=Decimal(5),
))

print(invoice.serialize(json_output=True))

output:

{
   "items":[
      {
         "item_type":"food",
         "qty":1,
         "name":"Ham",
         "price":10.0,
         "net_price":9.52,
         "tax_rate":5.0,
         "sum":10.0,
         "net_sum":9.52,
         "tax_sum":0.48
      },
      {
         "item_type":"food",
         "qty":3,
         "name":"Spam",
         "price":15.0,
         "net_price":14.29,
         "tax_rate":5.0,
         "sum":45.0,
         "net_sum":42.87,
         "tax_sum":2.13
      }
   ],
   "total":{
      "price":55.0,
      "net":52.39,
      "tax":2.61
   }
}

Full demo

Check included demo.py for some more uses and features.

Licence

The code is available under MIT Licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infoicer-0.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infoicer-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file infoicer-0.0.1.tar.gz.

File metadata

  • Download URL: infoicer-0.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for infoicer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ef5f1d1d53ed15f30408ad525f8c815f8825f9f7e29e04d5840ab7ed5e498c69
MD5 c16d29542d5c33d017b771c0dbca97fc
BLAKE2b-256 b62f5cb84dc829d224615b7fe02f606839c018ca1700cc1dd991dd9e4f5dcf78

See more details on using hashes here.

File details

Details for the file infoicer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: infoicer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for infoicer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6412dee018de8a15bc63ed5262d80ef09a59ac1858e02be331eb168145911e4d
MD5 b5cb839d6c7a568c1acbbab9d96ebc39
BLAKE2b-256 178d6288e79d4ec4f3e721654d0043456d526bfb8524955a60affd08eb75a004

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page