Invoice question

Hi @Nikolas_Torres_Niko
Perhaps the below snippet works for you?

{note: preview=no}
{products=[
["name":"Salón Ciprés", "price":12900, "selected":yes],
["name":"Coffee D", "price":12900],
["name":"Coffee B", "price":8900],
["name":"Coffee A", "price":5900],
["name":"Almuerzo", "price":5900, "selected":yes],
["name":"Coffee A", "price":5900, "selected":yes],
["name":"Cena", "price":54000],
["name":"Cóctel", "price":52900]
]}
{if: count(selectedProducts) == 0}{selectedProducts=filter(products, (p) -> includes(keys(p), "selected"))}{endif}
{endnote}{note}{formmenu: name=selectedProducts; values={=products}; itemformatter=(p) -> p.name & " (" & p.price & ")"; multiple=yes}
{endnote}{repeat: for product in selectedProducts}
{=product.name} {=product.price*cantidad; format=$,.0f} + IVA{endrepeat}

El total de la propuesta de consumo es de {=sum(map(selectedProducts, (p)->p.price))*cantidad; format=$,.2f}+ IVA (not right) para {formtext: name=Cantidad; default=12; cols=5}

I used same type of list, used multiple formmenu. Also used few list functions like filter, map and sum.

You can use Spaces for the data and the logic can be much simpler. Please check out all the exciting discussion here.

1 Like