Giter VIP home page Giter VIP logo

invoicer's Introduction

Invoicer

Invoicer helps you generate invoice documents.

Getting Started

Installation

Install WeasyPrint:

$ virtualenv .venv
$ source .env
$ pip install weasyprint

Install required gems:

$ bundler install

Install default bower components:

$ bower install

Copy and edit sample configuration files:

$ cp data/document.yml.sample data/document.yml
$ cp data/me.yml.sample data/me.yml

Usage

Start the server:

$ middleman server

Generate an invoice PDF:

$ bin/invoicer generate

This generates a PDF at the root directory of Invoicer.

Preview

Before generating an invoice PDF, you can have a preview of the document in a web browser.

Open a web browser and go to http://localhost:4567/. That's it!

Data

The data/ folder is where you define the content of your invoice. By default, it contains two files that are used by the default view template.

Me

The data/me.yml file contains all the informations relative to your activity such as: logo url, mail, title, website, payment methods and credits. Attributes are quite explicit.

See data/me.yml.sample to have an overview of all possible attributes.

Document

The data/document.yml file contains all the informations relative to a particular invoice such as: date, reference, client informations, available payment methods, products, total amount, global comments and note. Most of attributes are quite explicit.

See data/document.yml.sample to have an overview of all possible attributes.

Mandatory reserved attributes

Your document.yml must at least include the following attributes:

  • base.locale: Language (eg. 'en').
  • base.reference: Document reference (eg. 'No. 1337')
  • base.template_url: Middleman template url (eg. 'http://localhost:4567/special.html').
  • base.type: 'invoice' or 'estimation'.
  • client.title Company name, freelancer name, etc.

Add a custom data file

Create a new file in data/ folder, let's name it terms.yml and edit it:

---
payment:
  delay_in_days: '10'

If you add in your view the following content:

span = data.terms.payment.delay_in_days

Then, the generated view will contain:

<span>10</span>

View

Invoicer is shipped with a default view template: source/index.html.slim. All its required asset components are defined in bower.json configuration file.

You can directly edit and customize this file or create a custom template.

Create a custom template

Create a new file in source/ folder:

$ echo "Special invoice" > source/special.html

Then just edit data/document.yml file and point template_url to your freshly created template:

---
base:
  template_url: 'http://localhost:4567/special.html'

Open a web browser and go to http://localhost:4567/special.html.

I18n

To localize your document, edit data/document.yml file and set locale:

---
base:
  locale: 'fr'

Then t translation helper will automatically use the configured locale.

Locales are defined in locales/ folder, one file per language.

Add a translation

If you add in your view the following content:

p
  = t('document.payment.online.title')

Then, for English language, edit locales/en.yml:

---
en:
  document:
    payment:
      online:
        title: 'Online payment'

Then, the generated view will contain:

<p>
  Online payment
<p>

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Invoicer is released under the GPL License.

invoicer's People

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.