Format SQL with HTML?

I get the column fields just fine but I cant wrap my head around how to format it in HTML print template.

-- ---------------------------------
-- Output column values
-- ---------------------------------

{REPORT SQL DETAILS:@@GetStatement;{ENTITY NAME},1:F.Date,F.Time,F.BillNo,F.Description,F.Amount:
<div style="margin-left:20px;margin-right:20px;font-size:12px;background-color:black;color:white;font-weight:bold;font-family:'Calibri'">
<table>
<tr>
<td width=15* align=left>{0}</td>
<td width=15* align=left>{1}</td>
<td width=20* align=right>{2}</td>
<td width=30* align=right>{3}</td>
<td width=20* align=right>{4}</td>
</tr>
</table>
</div>
}

: No
: yes

Here is an example for you. As you can see there is a lot of escaping that needs to be done.

[LAYOUT]
<EC>
-- Alternative logo method
-- <img src="C:\Users\josep\Documents\SambaPOS5\plogo.png">
<div style="font-size:28px;text-align:center;font-weight:bold;font-family:'Helvetica'">Fox Creek BBQ & Catering</div>
<div style="font-size:20px;text-align:center;font-family:'Calibri'">129 Lawrence St.<br>Batesville, AR 72501<br>(870) 698-0034</div>

{REPORT SQL DETAILS:SELECT TOP 1 [Id]
,jsonData.[pdauth_code]
,jsonData.[pdCardholder]
,jsonData.[pdCardBrand]
,jsonData.[pdAccount]
,jsonData.[pdTransactionID]
,jsonData.[pdentry_mode]
,[Date]
,[Amount]
,[Name]
,Format([Date],'hh.mm tt') as Time
FROM [Payments] p
CROSS APPLY OPENJSON(p.[PaymentData])
-- this WITH portion allows explicit definition of the schema JSON Keys for output
-- and gives references to the columns/fields above in the SELECT portion
-- we can also use these as filters in the WHERE clause below
WITH (   
pdTransactionID varchar(1000) '$.TransactionID'
,pdauth_code varchar(1000) '$.auth_code'
,pdCardholder varchar(1000) '$.Cardholder'
,pdCardBrand varchar(1000) '$.CardBrand'
,pdAccount varchar(1000) '$.Account'
,pdTransactionID varchar(1000) '$.TransactionID'
,pdentry_mode varchar(1000) '$.entry_mode'
) jsonData
WHERE 1=1
AND [Name]='Credit Card'
AND [TicketID]='@1'
ORDER BY [Id] desc
;{TICKET ID}
:F.Date
,F.Amount
,F.Id
,F.pdauth_code
,F.pdCardholder
,F.pdCardBrand
,F.pdAccount
,F.Time
,F.pdTransactionID
,F.pdentry_mode::
<div style="font-size\:10px;font-weight\:bold;margin\:20 10 0 20;text-align\:justify;font-family\:'Calibri'">
<table>
<tr>
<td align="left">Acct\: **** **** **** [='{6}'.substr(12,4)]<br />MerchId\: ****8881 <br />TransId\: {8}<br />Auth Code\: {3}<br />Card Type\: {5}</td><td align="right">{0}<br />{7}<br/> Server\: {USER NAME}<br />Pay ID\: {2}<br /> Entry Mode\: {9}</td>
</tr>
<tr>
<td align="left"><br /><span  style="font-size\:13px;">Non Cash Adj\:</span></td><td align="right"><Br /><span  style="font-size\:13px;">${CALCULATION TOTAL:Non Cash Adjustment}</span></td></tr>
<td align="right"><br /><span  style="font-size\:22px;">Sale (USD)\:</span></td><td align="right"><Br /><span  style="font-size\:22px;"> ${1}</span></td>
</tr>
<tr>
<td align="left"><br /></td><td align="right"><span  style="font-size\:22px;"><br />+ Tip\:</span><span style="font-size\: 9pt"> &#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;</span></td>
</tr>
<tr>
<td align="left"><br /></td><td align="right"><span  style="font-size\:22px;"><br />Total\:</span><span style="font-size\: 9pt"> &#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;</span></td>
</tr>
</table>
</div>
</div>




<div style="font-size\:15px;font-weight\:normal;text-align\:center;font-family\:'Calibri'">
<table>
<tr>
<td><span style="font-size\: 9pt"><Br />I agree to pay the above total amount <br>according to the card issuer agreement.<br />(Merchant Agreement if Credit Voucher)</span></td>
</tr>
<tr><td>&zwnj;</td>
</tr>
</tr>
<tr><td>X&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;&#95;
<br /><span style="font-size\: 9pt">{4}</span>
<br /><span style="font-size\: 11pt"><b>Suggested Tip Amount</b></span>
<span style="font-size\: 10pt">  18% = <b>$[=F(Math.round((TN('{1}') * 0.18)*100)/100,'0.00')]</b>    Total <b>$[=F(Math.round((TN('{1}') * 0.18)*100)/100+{1},'0.00')]</b><br />  20% = <b>$[=F(Math.round((TN('{1}') * 0.20)*100)/100,'0.00')]</b>    Total <b>$[=F(Math.round((TN('{1}') * 0.20)*100)/100+{1},'0.00')]</b><br />  22% = <b>$[=F(Math.round((TN('{1}') * 0.22)*100)/100,'0.00')]</b>    Total <b>$[=F(Math.round((TN('{1}') * 0.22)*100)/100+{1},'0.00')]</b><br />  25% = <b>$[=F(Math.round((TN('{1}') * 0.25)*100)/100,'0.00')]</b>    Total <b>$[=F(Math.round((TN('{1}') * 0.25)*100)/100+{1},'0.00')]</b></span>
</td>
</tr>
</table>
</div>

<div style="font-size\:15px;font-weight\:normal;text-align\:center;font-family\:'Calibri'">
<L00>{2}
</div>
<EC>
<BAR>{2}
<div style="font-size\:15px;font-weight\:normal;text-align\:center;font-family\:'Calibri'">
<table>
<tr>
<td><span style="font-size\: 8pt"><br /><br /><Br /><Br />powered by</span><span style="font-size\: 12pt"> Samba<b>POS</b></span></td>
</tr>
</table
</div>
}

Pretty much every colon in the html needs escaped if its used inside the report tag. It looks like you were close to figuring it out.

Looks great, thank you all!

I sorted the order by - after taking the photo :upside_down_face: