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