Hello, everyone!
Auto-number in items is okay but continue to Sub Total (2 សរុប) like below pic, I would like auto number in only items.
HTML Code:
table {counter-reset: no -1;}
table tr {counter-increment: no;}
table tr td:first-child:before{ content: counter(no);}
<table class="table table-bordered">
<thead class="th50">
<tr class="th50">
<th width="5%" class="text-center">{{ _("ល.រ") }}<br>{{ _("Nº") }}</th>
<th width="40%" class="text-center">{{ _("បរិយាយមុខទំនិញ") }}<br>{{ _("Description") }}</th>
<th width="15%" class="text-center">{{ _("បរិមាណ") }}<br>{{ _("Quantity") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃឯកតា") }}<br>{{ _("Unit Price") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃទំនិញ") }}<br>{{ _("Amount") }}</th>
</tr>
</thead>
<tbody>
{%- for item in doc.items -%}
<tr class="table">
<td class="text-center"></td>
<td> {{ item.item_name }}</td>
<td class="text-center">{{ item.qty }}</td>
<td class="text-center">{{ item.get_formatted("rate") }}</td>
<td class="text-center">{{ item.get_formatted("amount") }}</td>
</tr>
{%- endfor -%}
<tr class="th5">
{% if doc.flags.show_inclusive_tax_in_print %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th5">
{{ _("Total Excl. Tax") }}
</td>
<td class="text-right" colspan= "4">
{{ doc.get_formatted("net_total", doc) }}
</td>
{% else %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th50">
{{ _("សរុប") }}<br>{{ _("Sub Total") }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ doc.get_formatted("total", doc) }}
</td>
{% endif %}
</tr>
{%- for row in doc.taxes -%}
{%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}
<tr>
<td class="text-right" style="width: 70%" colspan= "4" class="th50">
{{ _("អាករលើតម្លៃបន្ថែម ១០%") }}<br>{{ row.description }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ row.get_formatted("tax_amount", doc) }}
</td>
<tr>
{%- endif -%}
{%- endfor -%}
{%- if doc.discount_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
{{ _("Discount") }}
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("discount_amount") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("សរុបរួម") }}<br>{{ _("Grand Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("grand_total") }}
</td>
</tr>
{%- if doc.rounded_total -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Rounded Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("rounded_total") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Paid Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("paid_amount") }}
</td>
</tr>
{%- if doc.change_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Change Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("change_amount") }}
</td>
</tr>
{%- endif -%}
</tbody>
</table><br><br><br>
Thank you. 
table {counter-reset: no -1;}
table tr {counter-increment: no;}
table tr td:first-child:before{ content: counter(no);}
<table class="table table-bordered">
<thead class="th50">
<tr class="th50">
<th width="5%" class="text-center">{{ _("ល.រ") }}<br>{{ _("Nº") }}</th>
<th width="40%" class="text-center">{{ _("បរិយាយមុខទំនិញ") }}<br>{{ _("Description") }}</th>
<th width="15%" class="text-center">{{ _("បរិមាណ") }}<br>{{ _("Quantity") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃឯកតា") }}<br>{{ _("Unit Price") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃទំនិញ") }}<br>{{ _("Amount") }}</th>
</tr>
</thead>
<tbody>
{%- for item in doc.items -%}
<tr class="table">
<td class="text-center">{{loop.index}}</td>
<td> {{ item.item_name }}</td>
<td class="text-center">{{ item.qty }}</td>
<td class="text-center">{{ item.get_formatted("rate") }}</td>
<td class="text-center">{{ item.get_formatted("amount") }}</td>
</tr>
{%- endfor -%}
<tr class="th5">
{% if doc.flags.show_inclusive_tax_in_print %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th5">
{{ _("Total Excl. Tax") }}
</td>
<td class="text-right" colspan= "4">
{{ doc.get_formatted("net_total", doc) }}
</td>
{% else %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th50">
{{ _("សរុប") }}<br>{{ _("Sub Total") }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ doc.get_formatted("total", doc) }}
</td>
{% endif %}
</tr>
{%- for row in doc.taxes -%}
{%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}
<tr>
<td class="text-right" style="width: 70%" colspan= "4" class="th50">
{{ _("អាករលើតម្លៃបន្ថែម ១០%") }}<br>{{ row.description }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ row.get_formatted("tax_amount", doc) }}
</td>
<tr>
{%- endif -%}
{%- endfor -%}
{%- if doc.discount_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
{{ _("Discount") }}
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("discount_amount") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("សរុបរួម") }}<br>{{ _("Grand Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("grand_total") }}
</td>
</tr>
{%- if doc.rounded_total -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Rounded Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("rounded_total") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Paid Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("paid_amount") }}
</td>
</tr>
{%- if doc.change_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Change Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("change_amount") }}
</td>
</tr>
{%- endif -%}
Remove other counter which you declared.
Could you show me how to remove it I don’t know how to remove it cos I’m new fresh about it?
Thank you very much.
<table class="table table-bordered">
<thead class="th50">
<tr class="th50">
<th width="5%" class="text-center">{{ _("ល.រ") }}<br>{{ _("Nº") }}</th>
<th width="40%" class="text-center">{{ _("បរិយាយមុខទំនិញ") }}<br>{{ _("Description") }}</th>
<th width="15%" class="text-center">{{ _("បរិមាណ") }}<br>{{ _("Quantity") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃឯកតា") }}<br>{{ _("Unit Price") }}</th>
<th width="15%" class="text-center">{{ _("ថ្លៃទំនិញ") }}<br>{{ _("Amount") }}</th>
</tr>
</thead>
<tbody>
{%- for item in doc.items -%}
<tr class="table">
<td class="text-center">{{loop.index}}</td>
<td> {{ item.item_name }}</td>
<td class="text-center">{{ item.qty }}</td>
<td class="text-center">{{ item.get_formatted("rate") }}</td>
<td class="text-center">{{ item.get_formatted("amount") }}</td>
</tr>
{%- endfor -%}
<tr class="th5">
{% if doc.flags.show_inclusive_tax_in_print %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th5">
{{ _("Total Excl. Tax") }}
</td>
<td class="text-right" colspan= "4">
{{ doc.get_formatted("net_total", doc) }}
</td>
{% else %}
<td class="text-right th5" style="width: 80%" colspan= "4" class="th50">
{{ _("សរុប") }}<br>{{ _("Sub Total") }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ doc.get_formatted("total", doc) }}
</td>
{% endif %}
</tr>
{%- for row in doc.taxes -%}
{%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}
<tr>
<td class="text-right" style="width: 70%" colspan= "4" class="th50">
{{ _("អាករលើតម្លៃបន្ថែម ១០%") }}<br>{{ row.description }}
</td>
<td class="text-center" colspan= "4" class="th50">
{{ row.get_formatted("tax_amount", doc) }}
</td>
<tr>
{%- endif -%}
{%- endfor -%}
{%- if doc.discount_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
{{ _("Discount") }}
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("discount_amount") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("សរុបរួម") }}<br>{{ _("Grand Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("grand_total") }}
</td>
</tr>
{%- if doc.rounded_total -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Rounded Total") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("rounded_total") }}
</td>
</tr>
{%- endif -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Paid Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("paid_amount") }}
</td>
</tr>
{%- if doc.change_amount -%}
<tr>
<td class="text-right" style="width: 75%" colspan= "4">
<b>{{ _("Change Amount") }}</b>
</td>
<td class="text-center" colspan= "4">
{{ doc.get_formatted("change_amount") }}
</td>
</tr>
{%- endif -%}
try this one
1 Like