gnucash mysql invoice query

From thelinuxwiki
Jump to: navigation, search

CLI queries for gnucash invoice data

get invoice guid

mysql> SELECT guid FROM gnucash_database.invoices WHERE id = "2013018";
+----------------------------------+
| guid                             |
+----------------------------------+
| f32b43b6da2b19e4e9e838d30ffc1edb |
+----------------------------------+
1 row in set (0.00 sec)

get all entries for select columns from the invoice identified above...

mysql> SELECT date,description,action,quantity_num,i_price_num,i_discount_num,i_disc_type,i_taxable FROM gnucash_database.entries WHERE invoice = "f32b43b6da2b19e4e9e838d30ffc1edb";
+---------------------+---------------------------------------------+---------+--------------+-------------+----------------+-------------+-----------+
| date                | description                                 | action  | quantity_num | i_price_num | i_discount_num | i_disc_type | i_taxable |
+---------------------+---------------------------------------------+---------+--------------+-------------+----------------+-------------+-----------+
| 2013-05-08 17:00:00 | update website                              | Hours   |       500000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-10 05:00:00 |  format and print financial chart           | Hours   |       750000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-14 17:00:00 | assist with Internet connectivity problem   | Hours   |       750000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-15 17:00:00 | internet access issue                       | Hours   |       250000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-17 17:00:00 | correct mail sending error                  | Hours   |       500000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-20 05:00:00 | assist with email virus                     | Hours   |      1000000 |   100000000 |       65000000 | PERCENT     |         1 |
| 2013-05-01 05:00:00 | april email and web hosting                 | Project |      1000000 |    19950000 |              0 | PERCENT     |         1 |
| 2013-05-01 05:00:00 | may email and web hosting                   | Project |      1000000 |    19950000 |              0 | PERCENT     |         1 |
+---------------------+---------------------------------------------+---------+--------------+-------------+----------------+-------------+-----------+
14 rows in set (0.00 sec)