Need help with my HTML Template

Hi Everyone,

I need your help with configuring the HTML Template for tickets.
I am already quite far underway, however the discount part of the template does not work correctly.
Can someone help me with that?

Here is the template:

[LAYOUT]
-- General layout
<EC>
<XCT>29,40,76,6,0,49,69,32,32,1,1
<L00>
<L00>
<div style="font-size:20px;font-weight:bold;text-align:center;font-family:'Calibri'">Name Restaurant</div>
<div style="font-size:15px;font-weight:normal;text-align:center;font-family:'Calibri'">Address</div>
<div style="font-size:15px;font-weight:normal;text-align:center;font-family:'Calibri'">Zipcode Place</div>
<div style="font-size:15px;font-weight:normal;text-align:center;font-family:'Calibri'">Phone Nr</div>
<div style="font-size:15px;font-weight:normal;text-align:center;font-family:'Calibri'">HTML</div>
<div style="font-size:15px;font-weight:normal;text-align:center;font-family:'Calibri'">Additional</div>
</tr>
<L00>
<div style="font-size:25px;font-weight:bold;text-align:center;font-family:'Calibri'">Rechnung</div>
</tr>
<L00>
</div>
<div style="font-size:13px;font-weight:bold;text-align:left;font-family:'Calibri'">
<table>
<tr>
</div>
{ORDERS}
<L00>
<F>-
<div style="font-size:15px;font-weight:bold;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Zwisschensumme:</td><td align="right">€[=F(TN('{PLAIN TOTAL}')+TN('{ORDER TAG TOTAL:Discount Item Custom Value}')*-1+TN('{ORDER TAG TOTAL:Discount Item Custom Percent}')*-1+TN('{ORDER TAG TOTAL:Price Override}')*-1+TN('{CALCULATION TOTAL:Discount Ticket Total Percent}')*-1+TN('{CALCULATION TOTAL:Staff Discount}')*-1+TN('{CALCULATION TOTAL:Manager Discount}')*-1+TN('{CALCULATION TOTAL:Loyalty Discount}')*-1,'0.00')]</td>
</tr>
</table>
</div>
<F>-
<L00>
{DISCOUNTS}
[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Regel Rabatt:</td><td align "right">-€{DISCOUNT TOTAL}</td>
</tr>
</table>
</div>]


[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Regel Rabatt:</td><td align "right">-€[=F(TN('{ORDER TAG TOTAL:Discount Item Custom Value}')*-1+TN('{ORDER TAG TOTAL:Price Override}')*-1+TN('{ORDER TAG TOTAL:Discount Item Custom Percent}')*-1,'0.00')]</td>
</tr>
</table>
</div>]

[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Transaktion Rabattt:</td><td align "right">-€[=F(TN('{CALCULATION TOTAL:Discount Ticket Total Percent}')*-1,'0.00')]</td>
</tr>
</table>
</div>]

[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Angestellte Rabatt 10%:</td><td align "right">-€[=F(TN('{CALCULATION TOTAL:Staff Discount}')*-1,'0.00')]</td>
</tr>
</table>
</div>]

[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Owner Discount 100%:</td><td align "right">-£[=F(TN('{CALCULATION TOTAL:Manager Discount}')*-1,'0.00')]</td>
</tr>
</table>
</div>]

[<div style="font-size:15px;font-weight:normal;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Loyalty Discount 10%:</td><td align "right">-£[=F(TN('{CALCULATION TOTAL:Loyalty Discount}')*-1,'0.00')]</td>
</tr>
</table>
</div>]

[<div style="font-size:15px;font-weight:bold;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">Rabatt Total:</td><td align "right">-€[=F(TN('{ORDER TAG TOTAL:Discount Item Custom Value}')*-1+TN('{ORDER TAG TOTAL:Discount Item Custom Percent}')*-1+TN('{ORDER TAG TOTAL:Price Override}')*-1+TN('{CALCULATION TOTAL:Discount Ticket Total Percent}')*-1+TN('{CALCULATION TOTAL:Staff Discount}')*-1+TN('{CALCULATION TOTAL:Manager Discount}')*-1+TN('{CALCULATION TOTAL:Loyalty Discount}')*-1,'0.00')]</td>
</tr>
</table>
</div>
<F>-]
<div style="font-size:18px;font-weight:bold;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<L00>
<td align="left">Rechnungsbetrag:</td><td align "right">€{TICKET TOTAL}</td>
</table>
</div>
<L00>
{TAXES}

</div>
<F>
<F>
<L00>
<div style="font-size:15px;font-weight:bold;text-align:center;font-family:'Calibri'">
<L00>Wir danken für Ihren Besuch<br/>
</div>
<EC>
<BAR13>
<EL>
<F>-
<div style=font-size:15px;font-weight:bold;text-align:center;font-family:'Calibri'">
<table>
<tr>
<td width=60 align=center>{TICKET ID}</td>
<td width=80 align=center>{TICKET DATE}</td>
<td width=60 align=center>{TIME}</td>
<td width=60 align=center>{USER NAME}</td>
</tr>
</table>
</div>
<F>-
<br/>
<br/>
<br/>
{ENTITIES}

[DISCOUNTS]
<J00>{CALCULATION NAME}|£{CALCULATION TOTAL}

[PAYMENTS]
<div style="font-size:15px;font-weight:bold;text-align:justify;font-family:'Calibri'">
<table>
<tr>
<td align="left">{PAYMENT NAME}</td>
<td align="right">€{TENDERED}</td>
</tr>
</table>
</div>
[ORDERS]
-- Default format for orders
<div style="font-size:13px;text-align:left;font-family:'Calibri'">
<table>
<tr>
<td width="25">{QUANTITY}x</td>
<td width="196">{ITEM TAG:Receipt Name} {NAME}</td>
<td width=45 align=right>€{TOTAL PRICE}</td>
</tr>
</table>
</div>
{ORDER TAGS}
[ORDERS:Gift]
-- Format for gifted orders
<J00>{QUANTITY} {NAME}|**FREE ITEM**


[ORDERS:Void]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
[<div style="font-size:10px;text-align:left;font-family:'Calibri'">
<table>
<tr>
<td width="25">***</td>
<td width="196">Regel Rabatt: {ORDER STATE:DStatus}</td>
<td width=45 align=right>-€[=F(TN('{ORDER TAG TOTAL:Discount Item Custom Value}')+TN('{ORDER TAG TOTAL:Discount Item Custom Percent}')*-1),'0.00']</td>
</tr>
</table>
</div>]

[<div style="font-size:10px;text-align:left;font-family:'Calibri'">
<table>
<tr>
<td width="25">***</td>
<td width="196">Preis anpassung: {ORDER STATE:PStatus}</td>
<td width=45 align=right>-€[=F(TN('{ORDER TAG TOTAL:Price Override}')*-1),'0.00']</td>
</tr>
</table>
</div>]


[ENTITIES:Customers]
-- Customer entity format
<F>
<F>

[TAXES]
  
  <L00>{TAX NAME}  {TAX AMOUNT}
  <L00>Netto: {TAXABLE AMOUNT}
  
  <F>-
  
[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}
<F>
<F>

Looks overly complex.
Also can’t really see what you doing, you need to highkight code and click the code button else forum will stop the code.