piotrturski / invoice-hackathon

Haskell, phantom, angular, bash hackathon: simple pdf invoice generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invoice hackathon

Quick and dirty, simple pdf invoice generator in haskell, phantomjs, angular, bash.

Build instructions:

cabal configure
cabal build

Usage:

In main directory place invoice-data.json with structure:

{
"issueDate" : "2014-01-31",
"paymentTime" : 22,
"rows":[
  {"amount": 9, "name": "cooking", "unit": "hour", "netPricePerUnit": 8, "vatRate": 23},
  {"amount": 1, "name": "apples", "unit": "kg", "netPricePerUnit": 90, "vatRate": 23}
       ]
}

and run ./generate-invoice.sh

A pdf file will be created in current directory. Rows with "amount": 0 will be ignored.

Design:

---------------------------------
| input: per invoice json file; |
|       in .gitignore           |
---------------------------------    
                 |
                 V
         ----------------------    
         | haskell calculator |
         ----------------------
                    |   
                    | json with computed invoice data
                    |
                    V                
                   -------  one-page angular's app    -------------
                   | sed | -------------------------> | phantomjs | -> output pdf
                   -------                            -------------
                    ^
                    |
              -------------------------------------------
              | html template created with LibreOffice; |
              | with manually added angular bindings;   |
              |               stored in repo            |
              -------------------------------------------                       

Tested with:

  • ghc 7.4.1
  • phantomJS 1.9.2

About

Haskell, phantom, angular, bash hackathon: simple pdf invoice generator


Languages

Language:HTML 70.7%Language:Haskell 26.3%Language:Shell 1.5%Language:JavaScript 1.5%