
How I Write Invoices in Vim - yakshaving_jgt
http://jezenthomas.com/how-i-write-invoices-in-vim/
======
dpcan
In a couple years, he will probably learn that maintaining this invoice system
to support the changes in his business will prove to be a frustrating waste of
time.

For a reasonable fee, I now use Freshbooks. I love paying a small fee to have
a company constantly improving and perfecting the invoice system I use, and
the system saves me A LOT of time each month.

13 years ago, I could just put numbers in an invoice in word, send it to a
customer, they paid by check. Then over the years, it got much more
complicated. In-house tools, mixed with other accounting software, was just
sucking time.

I know it's fun to write tools like this for business tasks, but I think you
also have to pick your battles, and when you can pay for an affordable tool
that will greatly simplify a business task, I choose this path.

EDIT: I recently started using Freshbooks' API to do little reporting tasks
they don't provide, and this fills the "make my own tools" void when it comes
to accounting.

~~~
tomphoolery
Freshbooks is great. At a consulting company I used to work at, we used
spreadsheets for time tracking. When Freshbooks came out, we immediately
jumped ship and started getting tasks, tracking hours and being able to
actually see when (all) projects go over budget.

------
JorgeGT
You can also have a nice LaTeX template ready and then programmatically
complete it with the required information, for instance the template is set to
read a \input{clientinfo.tex} somewhere that you create with a command like
echo Mike > clientinfo.tex etc. Then you issue the compile order and you have
a nice PDF that can then be emailed or archived or whatever. At least that's
how we make repetitive reports in our lab!

~~~
StavrosK
That is also how I generate contracts!

makecontract --ip=mine --fee=100 --duration=30 contract.pdf

------
ogig
I used a similar method until I realized my data wasn't very accessible
afterwards. When I needed an anual report I had to write a small script, then
for taxes, then for repeating customers, and so on. I also had to go and look
customer data to an old invoice and copy that when the customer repeats. All
this was error prone and not architected with care.

I moved to a simple invoicing app and most of my problems were gone. I miss
the command line a bit, that's all. Just my experience.

~~~
catern
Hmm, ledger[0] or hledger[1] is probably the best solution then. You could
instead write a script to generate invoices from the data in them.

[0] [http://ledger-cli.org/](http://ledger-cli.org/) [1]
[http://hledger.org/](http://hledger.org/)

~~~
masida
Yeah, that's exactly the way I do it.

The invoice data from my hledger file and a HTML template together are
generated to a HTML invoice. The HTML invoice together with a CSS file are
processed to PDF using WeasyPrint [1].

[1] [http://weasyprint.org/](http://weasyprint.org/)

------
ckluis
Using a good tool for the wrong problem makes it the wrong tool.

~~~
privong
It seems to work fine for them. And with the apparently simple invoices, why
bother making things more complicated by using a more complicated tool? If the
invoices were complex, I'd agree that this method might be the wrong tool, but
for simple invoices, it seems like a lightweight and fairly straight forward
approach. So it can be considered a right tool for the job.

------
Havoc
Speaking as an accountant...please dont write invoices with Vim, Excel or
minesweeper. Just use a standardised package. The amount of botched homecooked
invoices I've encountered is frightening & worse the people producing them
seem entirely oblivious to the fact that they're wrong (sometimes wrong to the
point of constituting tax evasion).

It really one of those cases of "just because you can doesn't mean you should"

~~~
thaumasiotes
> (sometimes wrong to the point of constituting tax evasion)

Can you say more about this?

~~~
Havoc
That would be a country specific thing & is a bit of an outlier. As a
simplified example though - sometimes the sales tax / VAT is calculated as
10/110 instead of 10/100 (or vice versa depending on law). Or there is some
small piece of info missing that technically means the invoice isn't a legal
tax invoice which means whoever you issued it to claims tax on that illegally
(again country specific).

It's unfortunately a case of people dont know how much they don't know.

------
kvndebryne
Used [https://www.getharvest.com](https://www.getharvest.com) before but now
that I am working a retainer, I use
[https://www.recurvoice.com](https://www.recurvoice.com)

~~~
eik3_de
Harvest does have retainers and recurring invoices:
[https://www.getharvest.com/help/invoices-and-
estimates/invoi...](https://www.getharvest.com/help/invoices-and-
estimates/invoices-estimates-faqs/recurring-or-retainer)

(Disclosure: I work at Harvest)

------
geon
I have successfully used wkhtmltopdf to render PDFs from HTML. Better than
opening chrome and printing manually.

[http://wkhtmltopdf.org/](http://wkhtmltopdf.org/)

------
zacharycohn
I'm a huge fan of [https://invoiceatonce.com](https://invoiceatonce.com).
Keeps it simple, and it looks nice for the client.

------
joemi
This seems ok for really simple invoices, maybe with just one or two line
items. But anything more complex than that and it would seem foolish not to
use a spreadsheet, I think. I'd get annoyed having to do the math myself.

~~~
Amorymeltzer
Same here, it's what I do. Plus, in my experience, people receiving your
invoice or timesheet appreciate a spreadsheet.

------
yoshamano
LibreOffice is my go to office suite. When I decided to stop using hand
written invoices I decided to take a look through their template library and I
landed on this.

[http://templates.libreoffice.org/template-center/simple-
serv...](http://templates.libreoffice.org/template-center/simple-service-
invoice-1)

I've been using it now for over 2 years and its been great.

------
RBerenguel
I fill CSVs and wrote a small python tool to add the totals and add VAT if
needed, outputs a TeX file. Then a Bash file creates snippets for month/date
stuff and numbering. If I had to do it again I'd just use Go's text/template
system & CSV support.

Edit: oh sure, the bash script generates a numbered (filename prepared for tax
filing) PDF with PDFlatex

------
t0mk
This is great! I was using Google Doc Spreasheet and export to PDF but it
sucks, I hate the tables. I'm going the vim way from now on for sure! It's
simple and straightforward and that's what counts!

I'll keep my invoices in a simple text files in a private git repo.

Book-keeping and accounting is a simple concept. Just nowadays over-
complicated by accounting companies, historical software etc. Unfortunately
also by regulations. :(

------
e-xcavator
I am sure that all the programs mentioned here are useful and helpful.
However, the best open source accounting software by far is GnuCash (
www.gnucash.org ). I have been using it for years to do the books for online
retailers and hedge funds and still get amazed by the versatility of the
program.

If you have any question do not hesitate to drop me a line. seeit1st@gmail.com

------
radoslawc
Just my 2 cents: Despite comments like "wrong tool for..." this gives great
elasticity when it comes to data manipulation, you can grep it, put in RDBMS,
make csv/graph/one large flat file out of it, keep it in VCS etc. Sure you can
use one of billion apps to do that, but then what's the point of developing
your own solution to anything, just buy/use someone else app. Keeping your
financial data in cloud for me seems like so-so idea. Of course there's emacs
mode for it ;) ([http://orgmode.org/w/?p=org-
mode.git;a=blob_plain;f=contrib/...](http://orgmode.org/w/?p=org-
mode.git;a=blob_plain;f=contrib/lisp/org-invoice.el;hb=HEAD))

------
kirk21
I created an overview of invoicing systems for myself a while ago:
[http://goo.gl/forms/QAOLcuW6F2](http://goo.gl/forms/QAOLcuW6F2)

------
tambourine_man
I also write it in Vim, but a script turns a kind of markdown derivative of
mine into HTML, inserts it into a template, which in turn is converted to PDF
by Chrome.

I have most of the bugs sorted out, which fonts work fine and render
selectable text, how to deal with a single pixel white line in a full page
background image, etc. It works, but it's an ugly hack. I'm dreaming of
writing my own PostScript someday. From my initial research, it seems to be
not that hard really.

~~~
semi-extrinsic
For rendering markdown straight into PDF (and other formats), have a look at
pandoc, it's really powerful. If you can make your markdown flavour compatible
with (or a superset of) pandoc markdown it should be simple. See RMarkdown for
inspiration.

~~~
tambourine_man
Pandoc is great, but my layout is a bit complex, and last I checked,
templating in HTML first seemed easier.

------
tunesmith
I currently use (on a Mac) Intuit's "My Time" to track hours - what I like
about it is that it'll publish my hours straight to Quickbooks without me
having to do repetitive data entry. But I don't know if there are other
solutions that also have that easy communication with Quickbooks (Quickbooks
is a requirement for me). Since QB generates invoices, I don't need a separate
tool for that.

------
mpnordland
markdown + pandoc would be perfect for his system, yeah you need haskell, but
pandoc is so nice.

~~~
Retra
If I were to do a similar task, I would use pandoc, too. I'd probably set it
up so you just enter a line in a CSV or spreadsheet and run a script that
outputs an invoice for the new entries. Setting up vim to do it is about the
last thing I'd try...

------
pearjuice
Textbook HN hint: (Here's how I) don't do X in a traditional manner, but use
Y, an obscure, undocumented, poorly supported and inferior alternative because
f- you and your standards, that's why.

~~~
todd3834
This is a textbook example of using creativity and a free toolset to solve a
very common problem. As a member of this community, I love stuff like this. I
might never do it myself but I learned some new VIM commands that could
totally come in handy.

If this kind of post is annoying to you, you aren't going to enjoy this place.

~~~
vegabook
but (s)he's been a member for more than 2 years and has a very high karma for
the time. So I'm going to take this observation on HN's tendencies seriously.
Why should observations on the HN community's biases inevitably solicit
downvotes or finger wagging?

I personally love Vim and like to use it far outside its scope, but I
recognise that there is a case to be made for many posts on HN being a little
"originality for originality's sake".

~~~
Karunamon
Because meta is murder[1]. Nobody comes to read HN about the finer points of
posting on HN, they come to read the interesting stuff on the front page (and
IMO, someone hacking vim to do invoices is interesting) and the further
interestingness in the comments.

This entire comment chain is both not interesting and not contributing
anything to anyone. It's a complaint. It's a long form "I didn't like this"
that could have been avoided by not clicking on the link. Okay, they didn't
like it. So?

And on top of that, it comes across as a rather dickish snipe at the
community.

Both of these things deserves downvotes.

[1]: [https://blog.codinghorror.com/meta-is-
murder/](https://blog.codinghorror.com/meta-is-murder/)

~~~
vegabook
Yet meta is necessary, no? That's how the community improves in a feedback
loop to increase its value? StackOverflow even created an entire Meta site for
that reason, though they wisely segregated it from the main location. Such a
thing does not exist for HN so I guess the meta pollutes the main threads.
Anyway, I'll stop polluting now.

------
Amorymeltzer
For simple ones this is fine and all, but I'd sooner write the same thing in
markdown then convert it directly to pdf via mm2pdf or whatever. Saves the
trouble of vim options, browser, etc.

------
jqm
I love Vim and hate spreadsheets. But this just seems wrong. At the end of the
month I open my spreadsheet invoice templates and send my invoices. The right
tool for the job and all...

------
gexla
If I wanted my editor to do everything for me, I would switch to Emacs. On the
other hand, scratching my itches (some which others probably thought were
silly) is what got me here.

------
imakesnowflakes
>When you issue the :TOhtml command, Vim turns your text into html

7 years of using VIM and my mind is more than blown after I just tried it now.
It worked perfectly and It even showed a frigging progress bar!

------
x5n1
I use PayPal for my invoices. I have yet to regret my decision.

~~~
logn
I do like that you can accept credit/debit card there from a domain name
that's trusted. And if people pay by alternate means you can manually mark the
invoice as paid and optionally add a discount.

