Displaying the Total Charge
Next, we want to display the total charge for the order, which is stored in the Total property of the TicketOrder class.
The value of Total is displayed in a text box, which is created with an <input> tag. To format the amount, we call the $FN (format number) function, requesting the default format with two decimal places.
Because the total value is for display purposes only—the user cannot change it—we have used the “readonly” attribute. (Unfortunately, Netscape browsers ignore this attribute, so the user may think he or she can change the value. If they do so, the value on the server is not affected.)
Order.csp
<html> <head></head>
<body>
<csp:class super="%CSP.Page,Cinema.Utils">
<csp:if condition='$D(%session.Data("Order"))'>
<img src="YourTicketOrder.gif"><br>
<script language="cache" runat="server">
// Open Order object for display
Set ord = ##class(Cinema.TicketOrder).%OpenId(%session.Data("Order"))
</script>
<form name="OrderTickets">
<csp:loop counter="num" from=1 to=#( ord.Items.Count() )#>
<script language="cache" runat="server">
Set itm = ord.Items.GetAt(num)
</script>
#($ZT(itm.Show.StartTime,4))#
showing of #(itm.Show.Film.Title)#
at #(itm.Show.Theater.TheaterName)#
<br><br>
<select name="AdultTickets">
...
</select>
<select name="ChildTickets">
...
</select>
</csp:loop>
Total Charge:
<input
type="text"
name="TotalCharge"
size=5 readonly
value=#($FN(ord.Total, "", 2))#>
<br><br>
</form>
</csp:if>
</body> </html>