{ "info": { "author": "Oleg Lupats", "author_email": "oleglupats@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5" ], "description": "# xls_report\nDatabase report generation in xls-format according to the xml description\n\nExample:\n\n```python\n#!/usr/bin/python3\n\nimport sqlite3\nfrom xls_report import XLSReport\n\nconnect = sqlite3.connect(\"chinook.sqlite\")\ncursor = connect.cursor()\nreport = XLSReport({\n 'cursor': cursor,\n 'xml': 'test_xls.xml',\n 'callback_url': 'http://localhost',\n 'callback_token': '12345',\n 'callback_frequency': 20,\n 'parameters': {\n 'title0': 'Invoices',\n 'customer': '',\n 'title1': 'Albums',\n 'title2': 'Money',\n 'title3': 'Sales',\n 'title4': 'Customers',\n 'artist': ''}\n})\nreport.to_file('test.xls')\ncursor.close()\nconnect.close()\n```\ntest.xls:\n```xml\n\n\n \n {{title0}}\n \n font: bold True; alignment: horiz centre;\n borders: left 1, top 1, bottom 1, right 1;\n \n \n font: bold True;\n \n borders: left 1, top 1, bottom 1, right 1;\n font: bold True; alignment: horiz centre;\n Last name\n First name\n Amount\n Discount\n Total\n \n \n SELECT b.LastName, b.FirstName, round(sum(a.Total), 2), round(sum(a.Total)/50, 2)\n FROM Invoice AS a JOIN Customer AS b ON (b.CustomerId = a.CustomerId)\n WHERE b.LastName LIKE '%{{customer}}%'\n GROUP BY b.LastName, b.FirstName\n ORDER BY b.LastName, b.FirstName;\n \n \n \n \n \n \n \n \n C{{cs}}-D{{cs}}\n \n \n \n Total:\n \n SUM(E2:E{{ds}})\n \n \n \n \n {{title1}}\n Artist\n Album\n \n \n SELECT b.name as Artist, a.Title as Album\n FROM Album a JOIN Artist b ON(b.ArtistId = a.ArtistId)\n WHERE Artist LIKE '%{{artist}}%' ORDER BY Artist, Title;\n \n \n \n \n \n \n \n \n {{title2}}\n Report by some genres\n Media\n Genre\n Amount\n Discount\n Charged\n \n \n SELECT d.Name AS Media, round(sum(a.Quantity * a.UnitPrice), 2) AS Money,\n round(sum(a.Quantity * a.UnitPrice/50), 2) AS Discount\n FROM InvoiceLine AS a JOIN Track AS b ON(b.TrackId = a.TrackId) JOIN\n Genre AS c ON (c.GenreId = b.GenreId) JOIN MediaType as d ON (d.MediaTypeId = b.MediaTypeId)\n WHERE c.Name = 'Latin'\n GROUP BY d.Name, c.Name\n ORDER BY d.Name, c.Name\n \n \n \n \n \n Latin\n C{{cs}}-D{{cs}}\n \n \n \n \n SELECT round(sum(a.Quantity * a.UnitPrice), 2) AS Money,\n round(sum(a.Quantity * a.UnitPrice/50), 2) AS Discount\n FROM InvoiceLine AS a JOIN Track AS b ON(b.TrackId = a.TrackId) JOIN\n Genre AS c ON (c.GenreId = b.GenreId) JOIN MediaType as d ON (d.MediaTypeId = b.MediaTypeId)\n WHERE c.Name = 'World'\n GROUP BY d.Name, c.Name\n ORDER BY d.Name, c.Name\n \n \n \n \n World\n C{{cs}}-D{{cs}}\n \n \n \n \n Subtotal:\n \n INDIRECT(\"E\" & ({{ss}}+3)) + INDIRECT(\"E\" & ({{ss}}+4))\n \n \n \n \n Total:\n \n INDIRECT(\"E\" & ({{cs}}-5)) + INDIRECT(\"E\" & ({{cs}}-1))\n \n \n \n \n {{title3}}\n Media\n Genre\n Amount\n Discount\n Charged\n \n \n SELECT d.Name AS Media, c.Name as Genre, round(sum(a.Quantity * a.UnitPrice), 2) AS Money,\n round(sum(a.Quantity * a.UnitPrice/50), 2) AS Discount,\n round(sum(a.Quantity * a.UnitPrice), 2) - round(sum(a.Quantity * a.UnitPrice/50), 2) AS Charged\n FROM InvoiceLine AS a JOIN Track AS b ON(b.TrackId = a.TrackId) JOIN\n Genre AS c ON (c.GenreId = b.GenreId) JOIN MediaType as d ON (d.MediaTypeId = b.MediaTypeId)\n GROUP BY d.Name, c.Name\n ORDER BY d.Name, c.Name\n \n \n \n \n \n \n \n \n \n \n \n {{title4}}\n Customer\n Media\n Genre\n Amount\n Discount\n Charged\n \n \n SELECT f.LastName || ' ' || f.FirstName AS Customer, d.Name AS Media, c.Name as Genre,\n round(sum(a.Quantity * a.UnitPrice), 2) AS Money,\n round(sum(a.Quantity * a.UnitPrice/50), 2) AS Discount,\n round(sum(a.Quantity * a.UnitPrice), 2) - round(sum(a.Quantity * a.UnitPrice/50), 2) AS Charged\n FROM InvoiceLine AS a JOIN Track AS b ON(b.TrackId = a.TrackId) JOIN\n Genre AS c ON (c.GenreId = b.GenreId) JOIN MediaType as d ON (d.MediaTypeId = b.MediaTypeId) JOIN\n Invoice as e ON (e.InvoiceId = a.InvoiceId) JOIN Customer as f ON (f.CustomerId = e.CustomerId)\n WHERE f.LastName LIKE '%%'\n GROUP BY Customer, d.Name, c.Name\n ORDER BY Customer, d.Name, c.Name\n \n \n \n \n \n \n \n \n \n \n \n \n Playlist\n Playlist\n Album\n Track\n Milliseconds\n Bytes\n Price\n \n \n SELECT DISTINCT b.Name AS Playlist, d.Title AS Album, c.Name AS Track,\n c.Milliseconds, c.Bytes, c.UnitPrice AS Price\n FROM PlaylistTrack as a JOIN Playlist as b ON (b.PlaylistId=a.PlaylistId) JOIN\n Track as c ON (c.TrackId=a.TrackId) JOIN Album as d ON (d.AlbumId=c.AlbumId)\n ORDER BY b.Name, d.Title, c.Name\n \n \n \n \n \n \n \n \n \n \n \n\n```\nSee directory test. TODO: normal documentation.\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oleglpts/xls_report", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "xls-report", "package_url": "https://pypi.org/project/xls-report/", "platform": "any", "project_url": "https://pypi.org/project/xls-report/", "project_urls": { "Homepage": "https://github.com/oleglpts/xls_report" }, "release_url": "https://pypi.org/project/xls-report/0.0.5/", "requires_dist": [ "lxml (>=4.3.4)", "xlwt (>=1.3.0)", "pycurl (>=7.43.0.3)" ], "requires_python": ">=3", "summary": "Database report generation in .xls format according to the xml description", "version": "0.0.5" }, "last_serial": 5595377, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "35e3d65c4647e2bb78cb2225bff2ec6d", "sha256": "0242a1fc1e55c2d5194ecd0b8a6c4127ae85a260d0ca4df8ecf084360daef7f9" }, "downloads": -1, "filename": "xls_report-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "35e3d65c4647e2bb78cb2225bff2ec6d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 7947, "upload_time": "2019-07-28T10:43:52", "url": "https://files.pythonhosted.org/packages/0b/98/31cb2bdec71c1181a0e37704a782ca10a190dfaec3e7f7e1da7820d1bc91/xls_report-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32b30f5f0e26901ac3d92bba3224cbfc", "sha256": "d3d56291dcc54020445f10986a7b68506f73974353c493f3af2f9fe89b91faf8" }, "downloads": -1, "filename": "xls_report-0.0.5.tar.gz", "has_sig": false, "md5_digest": "32b30f5f0e26901ac3d92bba3224cbfc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 8531, "upload_time": "2019-07-28T10:43:54", "url": "https://files.pythonhosted.org/packages/11/65/8cf609fe3318171055769cf2007a483deabf4cb6fc1cd34b26578e0475ff/xls_report-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "35e3d65c4647e2bb78cb2225bff2ec6d", "sha256": "0242a1fc1e55c2d5194ecd0b8a6c4127ae85a260d0ca4df8ecf084360daef7f9" }, "downloads": -1, "filename": "xls_report-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "35e3d65c4647e2bb78cb2225bff2ec6d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 7947, "upload_time": "2019-07-28T10:43:52", "url": "https://files.pythonhosted.org/packages/0b/98/31cb2bdec71c1181a0e37704a782ca10a190dfaec3e7f7e1da7820d1bc91/xls_report-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32b30f5f0e26901ac3d92bba3224cbfc", "sha256": "d3d56291dcc54020445f10986a7b68506f73974353c493f3af2f9fe89b91faf8" }, "downloads": -1, "filename": "xls_report-0.0.5.tar.gz", "has_sig": false, "md5_digest": "32b30f5f0e26901ac3d92bba3224cbfc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 8531, "upload_time": "2019-07-28T10:43:54", "url": "https://files.pythonhosted.org/packages/11/65/8cf609fe3318171055769cf2007a483deabf4cb6fc1cd34b26578e0475ff/xls_report-0.0.5.tar.gz" } ] }