{ "info": { "author": "Roman Bertle", "author_email": "bertle@smoerz.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: End Users/Desktop", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Office/Business :: Financial :: Accounting" ], "description": "gcinvoice\n=========\n\nAbout\n-----\n\n**gcinvoice** generates invoices from Gnucash XML files using templates.\n\ngcinvoice (https://bitbucket.org/smoerz/gcinvoice) is a tool to parse Gnucash XML data\nfiles, and create invoices from this data using templates. It is similar to\ng2latex (http://stefans.datenbruch.de/gnucash/gc2latex.shtml) by Stefan\nTomanek, but the latter was not powerful enough for my needs, and did somehow\nnot work for me.\n\nFeatures of gcinvoice:\n\n* works with data files from Gnucash starting with version 2.0, tested up\n to Gnucash 3.1.\n\n* does *not* need the gnucash python bindings, but reads the Gnucash\n XML-file directly from python.\n\n* powerful templating; not only latex, but arbitrary templates can be used.\n\n* full support for discount and taxes, but **warning**:\n\n In my opinion, POSTTAX discounts in Gnucash are not very useful, see\n bug https://bugs.gnucash.org/show_bug.cgi?id=520547 in the Gnucash bug\n database. As long there is not an option in gnucash to calculate\n tax included discounts a better way, gcinvoice abuses POSTTAX to calculate\n the taxes the way I think it should be, and thus gives a different result\n for invoices with such discounts. If such discounts occure in a invoice\n generated by gcinvoice, a warning is generated.\n\n* needs only a working Python version 2.7 or 3.x installation (tested with 2.7\n and 3.4). There are no external requirements, apart from the future module if\n running with python 2.7.\n\n* can be run standalone, or easily integrated into python applications.\n\n* gcinvoice is free software.\n\nLicense and Credits\n-------------------\n\ngcinvoice was written by Roman Bertle 2007-2008. It\ncontains an adapted version of YAPTU, a templating utility written by Alex\nMartelli (ActiveState python Cookbook recipe 52305). gcinvoice has been\nrefactored and ported to python3 by Fabian K\u00f6ster 2017, and rewritten by\nRoman Bertle in 2018.\n\ngcinvoice is published under the MIT Licence.\n\nInstallation\n------------\n\nThe only prerequisite of gcinvoice is a working installation of Python.\nFor python 2.7, package 'future' has to be installed. For python 3.x, no\nadditional packages are needed.\n\nInstallation using pip\n~~~~~~~~~~~~~~~~~~~~~~\n\ngcinvoice can be installed using pip from https://pypi.org/::\n\n python -m pip install gcinvoice\n\nSee the python installation documentation for options\n(https://packaging.python.org/tutorials/installing-packages). For exampe, to\ninstall into the user install directory::\n\n python -m pip install --user gcinvoice\n\nBuilding from source\n~~~~~~~~~~~~~~~~~~~~\n\nFor building from source, download the sdist using pip from https://pypi.org/::\n\n python -m pip download --no-binary gcinvoice\n\nInstall the build dependencies, if not already installed::\n\n python -m pip install setuptools wheel\n\nUntar the file and enter the directory::\n\n tar xvfz gcinvoice-X.Y.Z.tar.gz\n cd gcinvoice-X.Y.Z\n\nBuild a wheel::\n\n python setup.py bdist_wheel\n\nInstall the wheel using pip::\n\n python -m pip install dist/gcinvoice-*.whl\n\n\nTesting\n-------\n\nFrom the unpacked source directory, various tests can be run after\ngcinvoice have been installed. To this end change into the 'tests'\ndirectory and run e.g.::\n\n python test.py\n\nThere might be a warning about a missing locale 'de_DE.UTF'; this special\nlocale is used to test formatting of currency and quantity values. If it is\nnot available, these tests are not performed, but this does not indicate any\nfurther problems. One test (testScriptrun) might also fail if you have\nalready installed a global /etc/gcinvoicerc or a $HOME/.gcinvoicerc, or have\na changed gcinvoicerc in the directory you run the test from, because it\nassumes the default settings of gcinvoice.\n\nIf package 'pytest' is installed, the tests are nicer run by::\n\n python -m pytest test.py\n\nIf tox is installed, testing for multiple python versions can be done\nquickly::\n\n tox -e py27,py36,py37\n\nUsage\n-----\n\nThere are two ways to use gcinvoice. First, it can be run as a\nstand-alone script by simply executing it. Installing gcinvoice provides\na script 'create_gcinvoice'. The help message can be got typing::\n\n create_gcinvoice --help\n\nAn example for running gcinvoice as a script::\n\n create_gcinvoice -t mytemplate.tex -o out.tex 13\n\nThis uses the invoice with id '13' to fill out the template 'mytemplate.tex'\nand put the result into 'out.tex'. The gnucash data file is inferred in this\nexample from the configuration files, as described in the next section.\n\nAnother way is to import gcinvoice from your python session::\n\n import gcinvoice\n\nSee the docstring of gcinvoice.Gcinvoice for further information.\n\nConfiguration\n-------------\n\ngcinvoice reads configuration files from the following places:\n\n* /etc/gcinvoicerc\n\n* $HOME/.gcinvoicerc\n\n* ./gcinvoicerc\n\nand all files given to gcinvoice as a configuration option. The format of\nthe configuration files is defined by the python standard library module\n'ConfigParser'; the file 'gcinvoicerc' in folder 'tests' of the source\ndistribution of gcinvoice is a well documented sample configuration file\nwhich can be adapted for your needs.\n\nTemplates\n---------\n\ngcinvoice uses a template file to generate invoices from the parsed\nGnucash data. The templating engine 'YAPTU' is built into gcinvoice, for\ndetailed information see\nhttp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52305.\nIn short, the template file can contain python statements, and python\nexpressions identified by (configurable) regular expressions. There is\nno restriction on the used python code, hence be careful, a malicious\ntemplate could execute any code.\n\nThe source distribution of gcinvoice contains an example template file\n'tests/invoice_template.tex'.\n\nBy default, python expressions are written as @{}, where the expression\nis inside the curly brackets. Below are the defined variables extracted\nfrom the Gnucash data file, with there type indicated. These variables\ncan also be None if not found in the Gnucash data file. The type\n'formatted' is special: For each of such a variable 'x', there is a\nvariable `x_`, which is a decimal.Decimal instance. The variable 'x' is\nthe value formatted as a string according to the configurated settings.\n\n::\n\n guid -- The guid of the invoice (string).\n id -- The id of the invoice (int if possible, else string).\n billing_id -- The billing_id of the invoice (string).\n owner -- The owner (customer or vendor) of the invoice (dict).\n job -- The job of the invoice (dict).\n date_opened -- The open date of the invoice (Date).\n date_posted -- The post date of the invoice (Date).\n terms -- The terms of the invoice (dict).\n notes -- The notes of the invoice (string).\n currency -- The currency of the invoice (string).\n entries -- The entries of the invoice (list).\n amount_net -- The total net amount of the invoice (formatted).\n amount_gross -- The total gross amount of the invoice (formatted).\n amount_taxes -- The total amount of taxes of the invoice (formatted).\n\nIn addition these useful functions and classes are provided::\n\n _currencyformatting -- A function to format monetary values.\n _quantityformatting -- A function to format other quantities.\n cformat -- The function to format monetary values as used by gcinvoice.\n qformat -- The function to format other quantities as used by gcinvoice.\n Decimal -- The decimal.Decimal class.\n\nThe dict 'owner' contains data of the customer or vendor::\n\n guid -- The guid of the owner (string).\n id -- The id of the owner (int if possible, else string).\n name -- The name of the owner (string).\n address -- The address of the owner (list of strings).\n email -- The email of the (string).\n full_name -- The full name of the (string).\n\nThe dict 'job' containes::\n\n guid -- The guid of the job (string).\n id -- The id of the job (int if possible, else string).\n name -- The name of the job (string).\n reference -- The reference of the job (string).\n owner -- The owner (customer or vendor) of the job (dict).\n The owner of the invoice is also accessible directly\n in variable 'owner', see above.\n\nThe dict 'terms' contains::\n\n guid -- The guid of the terms (string).\n name -- The name of the terms (string).\n desc -- The description of the terms (string).\n due-days -- The due days of the terms (string).\n disc-days -- The discount days of the terms (string).\n discount -- The discount of the terms (Decimal number).\n\n'entries' is a list of dicts, where amount_net, amount_gross and\namount_taxes are amounts after applying the discount::\n\n guid -- The guid of the entry (string).\n date -- The date of the entry (Date).\n entered -- The datetime of entering of the entry (DateTime).\n description -- The description of the entry (string).\n action -- The action of the entry (action).\n qty -- The quantity of the entry (formatted).\n price -- The price of the entry (formatted).\n amount_raw -- The amount of the entry as entered into Gnucash,\n i.e. qty x price (formatted).\n amount_net -- The amount of the entry without taxes (formatted).\n amount_gross -- The amount of the entry including taxes (formatted).\n amount_taxes -- The amount of the taxes for the entry (formatted).\n amount_discount -- The amount of the discount for the entry (formatted).\n for POSTTAX, this is the gross discount, else its the net discount.\n discount -- The discount of the entry (Decimal number).\n discount_type -- The type of the discount (DISCOUNT/VALUE) (string).\n discount_how -- Taxing of the discount (PRETAX/SAMETIME/POSTTAX) (string).\n taxable -- Flag if the entry is taxable (int).\n taxincluded -- Flag if the tax is included in amount_raw (int).\n taxtable -- Tax table for the entry (dict).\n\nThe dict 'taxtable' contains::\n\n guid -- The guid of the taxtable (string).\n name -- The name of the taxtable (string).\n percent_sum -- Sum of percent entries of the taxtable (Decimal number).\n value_sum -- Sum of value entries of the taxtable (Decimal number).\n\nPython statements are identified by default by lines in the template\nstarting either with '%+', '%-' or '%='. The first one is for start\nstatements like 'for e in entries' or 'if ...', the second one marks\nusually empty lines ending a python 'if' or 'for' construct, and the last\none is for continuations like e.g. 'else'.\n\nBe aware that a template file must be encoded either as ascii or UTF-8.\n\nIssues\n------\n\n* Because templates can contain arbitrary python expression, malicious\n templates could execute code with the permissions of the user.\n\n* I think that the calculation on POSTAX discounts is not useful in Gnucash\n (see bug report https://bugs.gnucash.org/show_bug.cgi?id=520547). gcinvoice\n calculates such discounts in invoices in a way which is more useful, but\n unfortunately still missing in Gnucash. Hence the result differs for\n invoices with such discounts from the Gnucash result.\n\nPossible Improvements\n---------------------\n\n* After porting to python3, one test does not work any more and is skipped\n for now.\n\n* rewrite gcinvoice using a functional instead of an object oriented style.\n\n* Implement accessing not only XML-files, but also the database backends of\n Gnucash.\n\n* After python2.7 is obsolete, remove python 2 compatibility.\n\n* Testing on windows\n\n* Alternative templating engines like jinja2.\n\n\nCHANGELOG\n---------\n\n0.2.1 (2018-06-30)\n~~~~~~~~~~~~~~~~~~\n\n* Testing with tox\n\n0.2.0 (2018-06-29)\n~~~~~~~~~~~~~~~~~~\n\n* python 3 support\n\n* gcinvoice converted to a package\n\n0.1.5 (2010-07-09)\n~~~~~~~~~~~~~~~~~~\n\n* Support for vendors and jobs\n\n* string ids support\n\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/smoerz/gcinvoice", "keywords": "Gnucash reporting", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "gcinvoice", "package_url": "https://pypi.org/project/gcinvoice/", "platform": "", "project_url": "https://pypi.org/project/gcinvoice/", "project_urls": { "Homepage": "https://bitbucket.org/smoerz/gcinvoice" }, "release_url": "https://pypi.org/project/gcinvoice/0.2.2/", "requires_dist": [ "future ; python_version < \"3.0\"" ], "requires_python": "", "summary": "Parse Gnucash data and create invoices", "version": "0.2.2" }, "last_serial": 5620966, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "f5292353960e2a71deec5880e1f488cb", "sha256": "6f2b10d3170a5d9c84cb4bcde394f37df52482521eb66237298fcfbe336bb2e7" }, "downloads": -1, "filename": "gcinvoice-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f5292353960e2a71deec5880e1f488cb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17810, "upload_time": "2018-06-30T14:43:41", "url": "https://files.pythonhosted.org/packages/fb/1f/de1cefe405ab789762bd33ffbca5ad7ce1af4d0ff396e1b2a2c19db99aac/gcinvoice-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "41c9fdeacb20013125e2e7d56e6807ad", "sha256": "728f2fc4b281943982b00f18c5ee292bcad657487ac48e613af90fa6a2986183" }, "downloads": -1, "filename": "gcinvoice-0.2.0.tar.gz", "has_sig": false, "md5_digest": "41c9fdeacb20013125e2e7d56e6807ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36786, "upload_time": "2018-06-30T14:43:43", "url": "https://files.pythonhosted.org/packages/dc/3f/da9dcf85d90096ede8595de07dd3d05bf044f4668c6a128f7bcaf7a3bbc4/gcinvoice-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6b4d0ac5e0f0188affca17954451b67c", "sha256": "a558b549f2f79ada5f6e7348975efd2fef28d6bf394e4e41b6eaa4c5d63971a5" }, "downloads": -1, "filename": "gcinvoice-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6b4d0ac5e0f0188affca17954451b67c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17874, "upload_time": "2018-06-30T16:03:15", "url": "https://files.pythonhosted.org/packages/b8/80/5547d4ce33c80133b70f6d88bf8b83578c9c950045347fdeddde6b74d14c/gcinvoice-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0f68e7f52d21ef07cca94786bcde42b2", "sha256": "2472428964dae0388444f10d25659a32661f62c81cbce5e50d784f7c65bd2d54" }, "downloads": -1, "filename": "gcinvoice-0.2.1.tar.gz", "has_sig": false, "md5_digest": "0f68e7f52d21ef07cca94786bcde42b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36920, "upload_time": "2018-06-30T16:03:17", "url": "https://files.pythonhosted.org/packages/2e/fd/0c3842acc1a9607fa6a4a34a79a618e1c0eec204749efa1b112c7e80ecb1/gcinvoice-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "92c8531184ae834e4fdc6bdf8ac770b6", "sha256": "47e1c9fa208adeb982eca1de6a615772b871b51d47cc73a20b51e0719fe967f9" }, "downloads": -1, "filename": "gcinvoice-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "92c8531184ae834e4fdc6bdf8ac770b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18056, "upload_time": "2019-08-01T21:39:31", "url": "https://files.pythonhosted.org/packages/b3/d4/8f1e387e61457e8decaf67caca07104cc45e4242c014457733f4d6e9573d/gcinvoice-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "313493fb7d9c91d5fa1fe31f47fa46f3", "sha256": "8247b2ae09f5066da420a2907b23a7710da9bdbf1bdc3b95f11d2c7c07f689cf" }, "downloads": -1, "filename": "gcinvoice-0.2.2.tar.gz", "has_sig": false, "md5_digest": "313493fb7d9c91d5fa1fe31f47fa46f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37320, "upload_time": "2019-08-01T21:39:33", "url": "https://files.pythonhosted.org/packages/71/42/c2966d49fcd2b5113eba2628b38d0c119ca7d5871b30925e7577ae1eb6a6/gcinvoice-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "92c8531184ae834e4fdc6bdf8ac770b6", "sha256": "47e1c9fa208adeb982eca1de6a615772b871b51d47cc73a20b51e0719fe967f9" }, "downloads": -1, "filename": "gcinvoice-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "92c8531184ae834e4fdc6bdf8ac770b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18056, "upload_time": "2019-08-01T21:39:31", "url": "https://files.pythonhosted.org/packages/b3/d4/8f1e387e61457e8decaf67caca07104cc45e4242c014457733f4d6e9573d/gcinvoice-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "313493fb7d9c91d5fa1fe31f47fa46f3", "sha256": "8247b2ae09f5066da420a2907b23a7710da9bdbf1bdc3b95f11d2c7c07f689cf" }, "downloads": -1, "filename": "gcinvoice-0.2.2.tar.gz", "has_sig": false, "md5_digest": "313493fb7d9c91d5fa1fe31f47fa46f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37320, "upload_time": "2019-08-01T21:39:33", "url": "https://files.pythonhosted.org/packages/71/42/c2966d49fcd2b5113eba2628b38d0c119ca7d5871b30925e7577ae1eb6a6/gcinvoice-0.2.2.tar.gz" } ] }