reports with graphs?

142 views
Skip to first unread message

Drazen D. Babic

unread,
Dec 15, 2021, 2:46:35 AM12/15/21
to Jam.py Users Mailing List
Hi, 

imagine trying to print a Dashboard graphs in the Reports. As at this stage it is very difficult to print out Dashboard, even with 50% scaling. it looks ugly.

How to do it? Might be good to include in Demo.

Thanks

D.

Drazen D. Babic

unread,
Dec 15, 2021, 3:37:53 AM12/15/21
to Jam.py Users Mailing List
To print for example Invoice with the Pie graph under the "THANK YOU FOR YOUR BUSINESS".
representing:
SUBTOTAL
TAX
FREIGHT

I got this as a print out (template is included, replace one in demo/reports folder). As seen, more items on Invoice will completely replace the labels. No idea how to do this...

Thx
invoice.ods
invoice_2021-12-15_16-29-09.287915.pdf

Drazen D. Babic

unread,
Dec 19, 2021, 9:26:14 PM12/19/21
to Jam.py Users Mailing List
Anyone?

Andrew Yushev

unread,
Dec 21, 2021, 4:38:30 PM12/21/21
to Drazen D. Babic, Jam.py Users Mailing List
Hi,

I am afraid you can not do it.
I think you you can print the chart generated by chart.js

Regards

пн, 20 дек. 2021 г. в 05:26, Drazen D. Babic <bab...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/fee6baa9-ad74-49f3-94be-6a46ab961abdn%40googlegroups.com.

Drazen D. Babic

unread,
Dec 21, 2021, 8:43:06 PM12/21/21
to Jam.py Users Mailing List
I am in the need of server side reports:

Since Jam Demo is passing subtotal, tax, and total for the Invoice template, I think it should be possible to utilise API?


Drazen D. Babic

unread,
Dec 22, 2021, 1:28:34 AM12/22/21
to Jam.py Users Mailing List
Hi Andrew, 

looks like you are inserting a single quite so Chart does not work (for SUBTOTAL I removed the quote)?Screenshot from 2021-12-22 14-22-16.png

Drazen D. Babic

unread,
Dec 22, 2021, 2:48:05 AM12/22/21
to Jam.py Users Mailing List
It is printing a Chart.

The trick is not to use  display_text but  value, as per below.
That will remove the single quote from numerical value.

HOWEVER, this example is only working for ONE SINGLE INVOCE ITEM ! Because the Data Range for a Chart is not constant, but growing, as there can be many items on the invoice.

The code is added for Reports/invoice.py
    subtotal1 = invoices.subtotal.value
    tax1 = invoices.tax.value
    total1 = invoices.total.value
    report.print_band('chart', locals())    

The code is adding same values for the small legend above the Chart. It is not needed, but makes it easier to test. And this is the problem, since Legend is moving as Items are added.
But for STATIC pages, with known Data Range, it should be possible to print exactly the same report every time, all the times. 

Cheers
D.

Screenshot from 2021-12-22 15-34-41.png


Drazen D. Babic

unread,
Dec 22, 2021, 2:59:21 AM12/22/21
to Jam.py Users Mailing List

Please visit:

Select customer Dan MIller, with one single item in the Invoice. It will print ok. here is the template which does that.

D.

invoice.ods

Drazen D. Babic

unread,
Jan 4, 2022, 2:47:43 AM1/4/22
to Jam.py Users Mailing List
Added Server side Chart on Reports/Dashboard

Need to figure out how to select only TOP 10 Customers.

Drazen D. Babic

unread,
Jan 5, 2022, 7:51:27 PM1/5/22
to Jam.py Users Mailing List
Looks like to have TOP 10 records is easy, thanks to Andrew only this tiny addition is needed:

 inv.open(fields=['customer', 'firstname', 'id', 'total'],
        funcs={'id': 'count', 'total': 'sum', 'firstname': 'max'},
        group_by=['customer'], order_by=['-total'], limit=10)

This is also very important piece of code. It actually demonstrates how to fetch data which would be SQL statement to limit the top 10 rows, with order_by=[-total ] and limit=10

Here is the resultScreenshot from 2022-01-06 08-40-11.png

Here is the template which does this:
dash.ods
Reply all
Reply to author
Forward
0 new messages