Initial order of items from template on screen invoice

When creating/editing a template, one can move items up and down within the template.  Hence there is an implication that the order is useful.

Here is a template:

 

Here is this template used in an invoice - screen shot taken before OK'ing the invoice:

Clicking the date button has no impact on the order - and the order is NOT the same as the items in the template.

Here is the invoice after clicking OK - the order has changed again:

Here is some SQL looking at the invoice items:

The above is ordered by act_id - ie the order in which the line items were created.

As you can see it is different again - and is independent of the order of the items in the template.

 

I think that we should try to preserve the item order from the template.

I suspect that this requires two changes: a) to keep the line item creation order matched to the template order (so that the line item acts are created in the template order); and b) when displaying the items in date order that the sorting is done by activity_start_time AND act_id.

Note that this code is also related to AS/EVES question about the secondary sort order within the invoice.  If the secondary sort order is always by date (ie activity start time) then it should be by activity start time then act_id.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Initial order of items from template on screen invoice

I should have added to the above, that I understand that the order on the printed invoice will be dependent on how the invoice items jrxml is written.

In the standard 1.8/1.9 one the sort order is:

ie effectively Patient/Date-time

In my customised one it is:

ie effectively Patient/Date/Product type invoice order/Product name/Date-Time

with in both cases, aggregated template items coming before normal and non-aggregated template items.

Re: Initial order of items from template on screen invoice

There is a JIRA for this here: https://openvpms.atlassian.net/browse/OVPMS-1635

One limitation is the database layer stores timestamps to second precision, so the order of items created within the one second is not guaranteed.

Syndicate content