Hacker News new | past | comments | ask | show | jobs | submit login
How I Write Invoices in Vim (jezenthomas.com)
109 points by yakshaving_jgt on Sept 5, 2015 | hide | past | favorite | 51 comments



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.


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.


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!


That is also how I generate contracts!

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


I've a slightly modified version of invoice.sty that I use to do exactly this. Most of an invoice is boilerplate, so there's no point reproducing a pile of work when you can script it.


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.


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/ [1] http://hledger.org/


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/


ledger-cli is great, but I'd strongly encourage using an older 2.6 release. The 3.x releases don't forecast accurately for me and the 3.x code is (a complex and disturbingly unreadable) complete rewrite of 2.x.


Which app did you switch to?


It is Odoo's invoicing + customers modules.


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


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.


https://en.wikipedia.org/wiki/Law_of_the_instrument

Next up: how I write invoices using duct tape.


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"


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

Can you say more about this?


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.


Used https://www.getharvest.com before but now that I am working a retainer, I use https://www.recurvoice.com


Harvest does have retainers and recurring invoices: https://www.getharvest.com/help/invoices-and-estimates/invoi...

(Disclosure: I work at Harvest)


I use Harvest to send several automated quarterly retainer invoices. It works great.


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

http://wkhtmltopdf.org/


I'm a huge fan of https://invoiceatonce.com. Keeps it simple, and it looks nice for the client.


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.


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


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...

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


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


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. :(


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


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/...)


I created an overview of invoicing systems for myself a while ago: http://goo.gl/forms/QAOLcuW6F2


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.


Postscript is actually really easy. The language itself is RPN based (like the older HP calculators) and really fun to work with. Grab a copy of the "Blue Book" (do a google search for Postscript Blue Book and it should be one of the first links) -- it has a lot of good examples and exercises in it. Should take about a good weekend to get the feel for it, then just keep a copy of the function reference from the end of the book printed out.


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.


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


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.


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


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...


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.


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.


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".


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/


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.


The title is "how I write", not "how you should write." What in this blog post deserves such bile?


Because it's a fundamentally wrong way to do business accounting. It's more difficult to check, more difficult to look for year/year patterns, more difficult to integrate into other tools, etc. A pile of invoices created by vim are a lot more difficult for your accountant to enter in to their systems for year-end taxes than a more common format, like a spreadsheet or a database.


Maybe he does what I do: gives his accountant a categorized list of income & expenses rather than the raw data. My accountant cares that I did $xxxxx in total sales, not that I sold $aa to AA Inc and $bbb to BB Co., etc.


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.


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...


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.


>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!


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


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: