Skip to content

InvoiceFox/InvoiceFox-client-bash

Repository files navigation

InvoiceFox bash client
======================

What
----

Scripts for using InvoiceFox (http://www.invoicefox.com) from bash.


Why
---

So you can automate things with cron, make scripts to streamline common tasks for you, export data, etc..



State
-----

This is all in Alpha state. We are building it up, adding more and more InvoiceFox methods and improving the client to be *ix-wise as possible. The goal is that you will be able to do everything and more that you can do thru the InvoiceFox web interface.


Files
-----

invf-* : files are the beginings of InvoiceFox commandline interface. Use -h on them for usage info.

invf : proxy for invf-* commands

.invfpwd : put your api access code in here (now a code of a testing account is there)

gen/ : used to generate the invf-* scripts


Examples of use
--------------

$ ./invf inv create -h

usage: ./invf-inv-create options

Creates an invoice head.

options:
-n Docnum (required)
-c Contact ID (required)
-d Date sent (required)
-p Payment deadline (required)
-s Payment deadline (required)
-f Response format: json, csv, html, xml (optional)


 - One or more of required params are missing.



$ ./invf inv create -n 111-222 -c 10 -d 2011-10-10 -p 2011-20-10 -s 2011-10-11 -f csv
id
157



$ ./invf inv list -f csv
id;title;date_sent;date_to_pay;date_served;id_partner;vat_level;date_payed;disabled;pub_notes;id_preinvoice;tags;reverse_vat;pub_notes2;payment;payment_act
148;R1/2011-0020;2011-09-05;2011-09-13;2011-09-05;15;0.0;0;0;dgdgsdgfdfsg;0;;0;;proforma;1
146;R1/2011-0019;2011-09-05;2011-09-05;2011-09-05;15;0.0;0;0;asdas as dasdasasd asdas dsa;0;;0;;;0
145;R1/2011-0018;2011-09-05;2011-09-05;2011-09-05;15;0.0;0;0;;0;;0;;;0
144;123as11-0017;2011-09-05;2011-09-13;2011-09-05;15;0.0;0;0;;0;;0;;;0
143;11-0016;2011-06-02;2011-06-02;2011-06-02;14;0.0;2011-06-02;0;;10;;0;;;0
...



$ ./invf inv next-doc -h

usage: ./invf-inv-next-doc options

Get the document number of next invoice.

options:
-f Response format: json, csv, html, xml (optional)



$ ./invf inv next-doc
[{'max_title':'111-223'}]



$ ./invf inv next-doc -f csv
max_title
111-223

Planned uses
------------

$ invf contact find "Alb" -f tab -nohead
10     Albatross computers   	...
12     Alba corp 	     	...


$ invf contact find "Alba co" -justid -1 | \ #-1 = -nohead -oneline
      xargs -0 -I contact_id \
      invf inv create -n auto -c contact_id -d auto -p auto
14


$ invf contact find "Alba co" -justid -1 | \
      xargs -0 -I contact_id \
      invf inv create -c contact_id 
15

# adding body of invoice using pipes should also work

$ invf contact find "Alba co" -justid -1 | \
      xargs -I contact_id \
      invf inv create -c contact_id | \
      xargs -I inv_id \
      invf inv-b add inv_id -d "Programming by contract" -u hour -q 30 -p 40 -t 20
104

# find partner, create invoice for it, add 3 bodies, download pdf and email odt

$ mkfifo _P1 _P2 _P3 _P4
$ invf contact find "Alba co" -justid -1 | \
      xargs -I contact_id \
      invf inv create -c contact_id | \
      tee _P1 | tee _P2 | tee _P3 | tee _P4 | \
      xargs -I inv_id \
      invf inv-b add inv_id -d "Programming" -u hour -q 30 -p 40 -t 20 & \
      invf inv-b add `cat <_P1` -d "Support" -u hour -q 10 -p 35 -t 20 & \
      invf inv-b add `cat <_P2` -d "Cleanup" -u hour -q 5 -p 45 -t 20 & \
      wait & \
      invf inv download `cat <_P3` -f pdf -o ~/invoices/. & \
      invf inv send `cat <_P4` -f odt -e accountant@email.com
$ rm _P1 _P2 _P3 _P4




#########################################################################




## echo 123 | tee _FID1 | tee _FID2 | xargs -I ID1 echo A-ID1-A | xargs -I ID2 echo B- `cat < _FID1` `cat < _FID2` --ID2-B

About

A bash client for InvoiceFox

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published