Anyone with a code snippet for grouping same items as one line item in the pdf template and summing up the quantity and amount? Just want to have a starting point for grouping items. Thanks.
That's an example of grouping by class but should be straightforward enough to adapt to item
s
scottvonduhn
02/28/2023, 1:47 AM
It’s easiest/best if you sort the list by the element you’ll be grouping on, that way, they will all be consecutive, and you can look for changes to the field as an indicator of when to switch.
👍 1
l
Luis
02/28/2023, 7:39 AM
Thank you both for the file and tip!
Luis
03/01/2023, 10:17 AM
@michoel is it possible to present the item just once? For example, if my invoice has 2 lines in the UI:
Service Item A 100 qty
Service Item A -5 qty
I would like to show it as one liner in the pdf:
Service Item A 95 qty
I think the code you shared still presents all lines but add a subtotal line per group of item?
m
michoel
03/01/2023, 11:11 AM
Sure, you can adapt the technique from my snippet but only print the "subtotal"