Total Sum of Weight in Packing Lists (Delivery Notes)

Hi.
For the purposes of a packing list,

I have a custom field type number named “Weight” in inventory items.
I have checked it to show in print documents but I’d like to create a sum as well that will work as well.
Weight * Quantity
And then show the Total Sum of Weight at the end.
Weight sum per Item line, is not required.

I have to remind you that in Delivery notes, no totals are shown by default.

What we would like… Total Weight = sum(10.145 * 8 + 8.9142 + 4.5404) = 118.988

This Guide is an introduction to calculations with custom fields: https://www.manager.io/guides/17115. Because your line-item custom fields are being generated in a loop, I think you will need to implement a serial addition operation, then display the final result after the loop execution ends. But the exact process is beyond the scope of this forum.

Well I am trying to calculate the multiplication of a custom “Weight” column I have with the quantity of each row.
I am trying to find the index of that quantity column though…

Here I am noting the column index of the two columns

   {% for column in table.columns %}
                    {% if column.label == "Weight" %}
                        {% assign weightIndex = forloop.index0 %}
                        {% break %}
                    {% endif %}
                    {% if column.label == "Pcs" %}
                        {% assign quantityIndex = forloop.index0 %}
                        {% break %}
                    {% endif %}
                {% endfor %}

And Then

{% for row in table.rows %}
    {% assign Weight = row.cells[weightIndex].text %}
    {% assign Quant = row.cells[4].text %}
    {% assign RowWeight = Weight | times: Quant %}
    {% assign TotalWeight = TotalWeight | plus: RowWeight %}
    {% assign NQuant = Quant | times: 1 %}
    {% assign totalQuant = totalQuant | plus: NQuant %}

And Finally after </tbody>

<tr>
<td colspan="30">
<div style="font-weight: bold; padding-top: 20px">Total Weight</div>
</td>
</tr>
<tr>
<td>{{TotalWeight}} kgs</td>
</tr>
<tr>
<td colspan="30"><div style="font-weight: bold; padding-top: 20px">Total Quantity</div></td>
</tr>
<tr>
<td>
{{totalQuant}}
</td>
</tr>

What is the variable that I must search for to get the pieces for each line?

Pcs, doesn’t do the job.

This will be used for packing lists that require Total Weight of the products.
This is calculated correctly but I am using index[4] to do the job.

And how could I add a totals line in delivery notes to display the Total Weight and Quantity?
Cause this works like that in the screenshot!

Screenshot%20from%202019-07-18%2016-57-30|657x332