Order confirmation template - trying to add pretty gift cert image with text overlay, but need a little help with the html

Hi everyone!

I have basic/intermediate HTML skills, and I've been trying to add a pretty (still work in progress) image with a text overlay to the order confirmation email for gift certificates so that we don't have to physically mail it out right now.  Everything seemed to work just fine when I validate it in w3schools, but when I try to throw it into tess, I keep getting errors saying that a div element isn't closed, but when I take a look, everything seems to be closed.  Can someone more experienced than I take a look and help me out?  I know it isn't the cleanest (I'm not great with structure - I usually only do smaller things). 

This is the error I'm getting (no matter what I change, it doesn't seem to fix it or it happens to the very next line):

An error occurred while rendering the template. (359:12) - The "tr" element was not closed. All elements must be either self-closing or have a matching end tag.

@*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@
@using Tessitura.Service.Client.CRM;

@{
    var hasConstituent = Model.OrderProductView.Constituent != null;
    var hasAddress = Model.Address != null;
    var hasElectronicAddress = Model.ElectronicAddress != null;
    var hasBooking = Model.Booking != null;
    var isInSpecialConstituency = false;
    var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!";
    var constituency = Model.GetPropertyValue("Constituency") ?? "FRC";
    var hasState = hasAddress && Model.Address.State != null;
    var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0;
}

@if (hasConstituent)
{
    var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true";
    var constituencies = Model.RestClient.AtUrl(url).Get<Constituencies>().ResponseObject;
    isInSpecialConstituency = constituencies != null && constituencies.Count(x => x.ConstituencyType.ShortDescription == constituency) > 0;
}
    
<table width="700" style="font-size: 12px; text-align:left;	color: #000000; font-family:Arial, Helvetica, sans-serif;">
    <tr>
        <td align="left" valign="top">

            <table style="vertical-align: top;text-align:left">
                <tr>
                    <td colspan="2" style="text-align:left">
                        <h3>Thank You for Your Order with the Tessitura Network!</h3>
                        <b>Order Date:</b> @Model.OrderProductView.OrderDateTime <br />
                        <b>Order Number:</b> @Model.OrderProductView.Id<br />
                        @if (hasConstituent)
                        {
                            <b>Customer Number:</b>
                            @Model.OrderProductView.Constituent.Id
                            <br />
                            <br />
                        }
                        <p style="margin-top: -10px; padding-bottom: 20px;"><small>Please retain this receipt for your reference.</small></p>
                    </td>
                </tr>
                @{
                    var state = hasState ? ", " + Model.Address.State.StateCode : "";
                    var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : "";
                }
                
                <tr>
                    <td width="50%" style="padding-bottom: 20px; vertical-align: top;">
                        <b>Your Account Information:</b><BR />
                        @if (isInSpecialConstituency)
                        {
                            @constituencyMessage <br />
                        }
                        @if (hasConstituent)
                        {
                            @Model.OrderProductView.Constituent.DisplayName <br />
                        }
                        @if (hasAddress)
                        {
                            @Model.Address.Street1<br />
                            @Model.Address.City@state @Model.Address.PostalCode<br />
                        }
                        @electronicAddress<br />
                    </td>
                    <td width="50%" style="padding-bottom: 20px; text-align: left;vertical-align: top">
                        <b>Order Shipping Information</b><BR />
                        @if (Model.OrderProductView.DeliveryMethod.Id == -1)
                        {
                            <text> Hold order at Box Office</text><br />
                            <i>Please pick up your tickets no later than 30 minutes before curtain</i>
                        }
                        else if (hasAddress)
                        {
                            <text>
                                @Model.Address.Street1<br />
                                @Model.Address.City@state @Model.Address.PostalCode<br />
                            </text>
                        }


                    </td>
                </tr>
            </table>
        </td>
    </tr>
    @if (hasProducts)
    {
        /* PERFORMANCES */
        var perfs = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Performance");

        // If the order has performances, loop through them and display them in a table
        if (perfs != null && perfs.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">
                    <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                        <tr>
                            <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Performances</b>
                            </th>
                        </tr>
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="250" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                        <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                        <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                        <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Price</th>
                                        <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                    </tr>

                                    @{
                                        var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue);
                                    }

                                    @foreach (var product in perfs)
                                    {
                                        var performance = product.Performance.LineItem.Performance;
                                        <tr>
                                            <td>
                                                @performance.Description<br />
                                                @performance.Facility.Description<br />
                                                @performance.PerformanceDateTime
                                            </td>
                                            <td style="vertical-align: top">
                                                @product.Performance.LineItem.SubLineItems[0].Zone.Description
                                            </td>
                                            <td style="vertical-align: top">
                                                @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                {
                                                    var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                    @seatRow<br />
                                                }
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                {
                                                    var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                    @amount<br />
                                                }
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @string.Format("{0:C}", product.Performance.LineItem.TotalDue)
                                            </td>
                                        </tr>
                                    }
                                    <tr>
                                        <td colspan="4" style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right;">
                                            <b>Total Single Tickets Cost:</b>
                                        </td>
                                        <td style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right;">
                                            <b>@string.Format("{0:C}", performanceTotal)</b>
                                        </td>
                                    </tr>
                                </table>

                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

        }

        /* PACKAGES */
        var packages = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Package");

        // If the order has packages, loop through them and display them in a table
        if (packages != null && packages.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">

                    <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                        <tr>
                            <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Packages</b>
                            </th>
                        </tr>
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="255" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                        <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                        <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                        <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Price</th>
                                        <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                    </tr>
                                    @{
                                        var packageTotal = packages.Sum(x => x.Package.LineItems.Sum(y => y.TotalDue));
                                    }

                                    @foreach (var product in packages)
                                    {
                                        foreach (var lineItem in product.Package.LineItems)
                                        {
                                            if (lineItem.Performance == null)
                                            {
                                                <tr>
                                                    <td colspan="5" style="text-align: left; vertical-align: top">
                                                        <b>@lineItem.Package.Description</b>
                                                    </td>
                                                </tr>
                                            }
                                            else
                                            {
                                                var performance = lineItem.Performance;
                                                <tr>
                                                    <td>
                                                        @performance.Description<br />
                                                        @performance.Facility.Description<br />
                                                        @performance.PerformanceDateTime
                                                    </td>
                                                    <td style="vertical-align: top">
                                                        @lineItem.SubLineItems[0].Zone.Description
                                                    </td>
                                                    <td style="vertical-align: top">
                                                        @foreach (var subLineItem in lineItem.SubLineItems)
                                                        {
                                                            var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                            @seatRow<br />
                                                        }
                                                    </td>
                                                    <td style="vertical-align: top; text-align: right">
                                                        @foreach (var subLineItem in lineItem.SubLineItems)
                                                        {
                                                            var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                            @amount<br />
                                                        }
                                                    </td>
                                                    <td style="vertical-align: top; text-align: right">
                                                        @string.Format("{0:C}", lineItem.TotalDue)
                                                    </td>
                                                </tr>
                                            }
                                        }
                                    }
                                    <tr>
                                        <td colspan="4" style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right">
                                            <b>Total Packages Cost:</b>
                                        </td>
                                        <td style="border-top: 1px solid #6C208D; color: #6C208D; text-align: right">
                                            <b>@string.Format("{0:C}", packageTotal)</b>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        }

        /* CONTRIBUTIONS */
        var contributions = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Contribution");
        var contributionTotal = contributions.Sum(x => x.Contribution.Amount);

        // If the order has contributions, loop through them and display them in a table
        if (contributions != null && contributions.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">

                    <table style="font-size: 12px; color: #6C208D; font-family: Arial, Helvetica, sans-serif;">
                        <tr>
                            <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Contributions</b>
                            </th>
                        </tr>
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                        <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                    </tr>
                                    @foreach (var contribution in contributions)
                                    {
                                        <tr>
                                            <td>
                                                @contribution.Contribution.Fund.Description
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @string.Format("{0:C}", contribution.Contribution.Amount)
                                            </td>
                                        </tr>
                                    }
                                    <tr>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                            <b>Total Contribution Cost:</b>
                                        </td>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                            <b>@string.Format("{0:C}", contributionTotal)</b>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        }

        var memberships = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Membership");
        var membershipTotal = memberships.Sum(x => x.Membership.Amount);

        if (memberships != null && memberships.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">

                    <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                        <tr>
                            <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Memberships</b>
                            </th>
                        </tr>
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                        <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                    </tr>
                                    @foreach (var membership in memberships)
                                    {
                                        <tr>
                                            <td>
                                                @membership.Membership.MembershipLevel.Description
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @string.Format("{0:C}", membership.Membership.Amount)
                                            </td>
                                        </tr>
                                    }
                                    <tr>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                            <b>Total Membership Cost:</b>
                                        </td>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                            <b>@string.Format("{0:C}", membershipTotal)</b>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        }

        var giftCertificates = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Gift Certificate");
        var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount);

        if (giftCertificates != null && giftCertificates.Count() > 0)
        {
            <tr>
                <td align="left" valign="top">

                    <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                        <tr>
                            <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                <b>Gift Certificates</b>
                            </th>
                        </tr>
                        
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
  position: relative;
  text-align: center;
  color: black;
}

.bottom-left {
  position: absolute;
  bottom: 8px;
  left: 16px;
}

.top-left {
  position: absolute;
  top: 8px;
  left: 16px;
}

.top-right {
  position: absolute;
  top: 8px;
  right: 16px;
}

.bottom-right {
  position: absolute;
  bottom: 25px;
  right: 16px;
  text-align: right;
}

.centered {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  
}
</style>

<body>


<div class="container">
  <img src="https://www.sunsetcenter.org/webart/press/files/165_3.jpg" alt="Gift Certificate" style="width:100%;">
  <div class="bottom-left"> </div>
  <div class="top-left"> </div>
  <div class="top-right"> </div>
  <div class="bottom-right">Redemption Code: @giftCertificate.GiftCertificate.GiftCertificateNumber </p> @string.Format("{0:C}", amount)</div>
  <div class="centered">To <p>From<p>Note</div>
</div>

</body>        }
                        <tr>
                            <td style="text-align: left; vertical-align: top">
                                <table width="700" style="vertical-align: top; text-align: left">
                                    <tr>
                                        <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                        <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                    </tr>
                                    @foreach (var giftCertificate in giftCertificates)
                                    {
                                        var amount = -giftCertificate.GiftCertificate.Amount;
                                        <tr>
                                            <td>
                                                Redemption Code: @giftCertificate.GiftCertificate.GiftCertificateNumber
                                            </td>
                                            <td style="vertical-align: top; text-align: right">
                                                @string.Format("{0:C}", amount)
                                            </td>
                                        </tr>
                                    }
                                    <tr>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                            <b>Total Gift Certificate Cost:</b>
                                        </td>
                                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                            <b>@string.Format("{0:C}", giftCertificateTotal)</b>
                                        </td>
                                    </tr>
                                    
                                </table>
                                
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        }


        var subTotal = string.Format("{0:C}", Model.OrderProductView.TotalPurchaseAmount + Model.OrderProductView.TotalContributionAmount);

        <tr>
            <td colspan="2">
                <table width="700" style="padding-top: 20px;">
                    <tr>
                        <td width="600" style="color: #6e6d6d; vertical-align: top; text-align: right">
                            <b>Order Subtotal:</b>
                        </td>
                        <td style="color: #6e6d6d; vertical-align: top; text-align: right">@subTotal</td>
                    </tr>
                    <tr>
                        <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                            <b>Fees:</b>
                        </td>
                        <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                            <b>@string.Format("{0:C}", Model.OrderProductView.TotalFeeAmount)</b>
                        </td>
                    </tr>
                    <tr>
                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                            <b>Total:</b>
                        </td>
                        <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                            @string.Format("{0:C}", Model.OrderProductView.TotalDueAmount)
                        </td>

                    </tr>
                </table>
            </td>
        </tr>
    }

    @if (hasBooking)
    {
        <tr>
            <td>
                <table style="font-size: 12px;	color: #000000; font-family:Arial, Helvetica, sans-serif; text-align: left">
                    <tr>
                        <th colspan="3" style="background-color: #6C208D;color: #ffffff;font-weight: bold;font-size: 12px;text-align: left;vertical-align: top">
                            <b>Booking</b>
                        </th>
                    </tr>
                    <tr>
                        <td><h3>@Model.Booking.Description </h3></td>
                    </tr>
                    <tr>
                        <td><h4>Confirmation: @Model.Booking.ConfirmationText </h4></td>
                    </tr>
                    @if (Model.Booking.Assignments != null && Model.Booking.Assignments.Count > 0)
                    {
                        <tr>
                            <td><b>Resources</b></td>
                        </tr>
                        <tr>
                            <td style="text-align:left;vertical-align:top">
                                <table style="vertical-align: top;text-align:left">
                                    <tr>
                                        <th width="140" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Type</th>
                                        <th width="200" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Description</th>
                                        <th width="60" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Count</th>
                                        <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Start</th>
                                        <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">End</th>
                                    </tr>
                                    @foreach (var assignment in @Model.Booking.Assignments)
                                    {
                                        var description = @assignment.Resource != null ? @assignment.Resource.Description : "TBD";

                                        <tr>
                                            <td>@assignment.ResourceType.Description</td>
                                            <td>@description</td>
                                            <td>@assignment.Schedule.Count</td>
                                            <td>@assignment.Schedule.StartDateTime</td>
                                            <td>@assignment.Schedule.EndDateTime</td>
                                        </tr>
                                        if (assignment.ConfirmationText != null)
                                        {
                                            <tr>
                                                <td></td>
                                                <td colspan="4">@assignment.ConfirmationText</td>
                                            </tr>
                                        }
                                    }
                                </table>
                            </td>
                        </tr>
                    }
                </table>

            </td>
        </tr>

    }
</table>

I am adding to a copy of the existing template in Tess.  

Parents
  • This won't fix everything but there are a few erroneous <p> tags floating around near your image code:

  • Thanks!  I'll try taking that out to see if it will help!

  • Try this

    @*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@
    @using Tessitura.Service.Client.CRM;
    
    @{
        var hasConstituent = Model.OrderProductView.Constituent != null;
        var hasAddress = Model.Address != null;
        var hasElectronicAddress = Model.ElectronicAddress != null;
        var hasBooking = Model.Booking != null;
        var isInSpecialConstituency = false;
        var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!";
        var constituency = Model.GetPropertyValue("Constituency") ?? "FRC";
        var hasState = hasAddress && Model.Address.State != null;
        var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0;
    }
    
    @if (hasConstituent)
    {
        var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true";
        var constituencies = Model.RestClient.AtUrl(url).Get<Constituencies>().ResponseObject;
        isInSpecialConstituency = constituencies != null && constituencies.Count(x => x.ConstituencyType.ShortDescription == constituency) > 0;
    }
        
    <table width="700" style="font-size: 12px; text-align:left;	color: #000000; font-family:Arial, Helvetica, sans-serif;">
        <tr>
            <td align="left" valign="top">
    
                <table style="vertical-align: top;text-align:left">
                    <tr>
                        <td colspan="2" style="text-align:left">
                            <h3>Thank You for Your Order with the Tessitura Network!</h3>
                            <b>Order Date:</b> @Model.OrderProductView.OrderDateTime <br />
                            <b>Order Number:</b> @Model.OrderProductView.Id<br />
                            @if (hasConstituent)
                            {
                                <b>Customer Number:</b>
                                @Model.OrderProductView.Constituent.Id
                                <br />
                                <br />
                            }
                            <p style="margin-top: -10px; padding-bottom: 20px;"><small>Please retain this receipt for your reference.</small></p>
                        </td>
                    </tr>
                    @{
                        var state = hasState ? ", " + Model.Address.State.StateCode : "";
                        var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : "";
                    }
                    
                    <tr>
                        <td width="50%" style="padding-bottom: 20px; vertical-align: top;">
                            <b>Your Account Information:</b><BR />
                            @if (isInSpecialConstituency)
                            {
                                @constituencyMessage <br />
                            }
                            @if (hasConstituent)
                            {
                                @Model.OrderProductView.Constituent.DisplayName <br />
                            }
                            @if (hasAddress)
                            {
                                @Model.Address.Street1<br />
                                @Model.Address.City@state @Model.Address.PostalCode<br />
                            }
                            @electronicAddress<br />
                        </td>
                        <td width="50%" style="padding-bottom: 20px; text-align: left;vertical-align: top">
                            <b>Order Shipping Information</b><BR />
                            @if (Model.OrderProductView.DeliveryMethod.Id == -1)
                            {
                                <text> Hold order at Box Office</text><br />
                                <i>Please pick up your tickets no later than 30 minutes before curtain</i>
                            }
                            else if (hasAddress)
                            {
                                <text>
                                    @Model.Address.Street1<br />
                                    @Model.Address.City@state @Model.Address.PostalCode<br />
                                </text>
                            }
    
    
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        @if (hasProducts)
        {
            /* PERFORMANCES */
            var perfs = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Performance");
    
            // If the order has performances, loop through them and display them in a table
            if (perfs != null && perfs.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
                        <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Performances</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="250" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                            <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                            <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                            <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Price</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                        </tr>
    
                                        @{
                                            var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue);
                                        }
    
                                        @foreach (var product in perfs)
                                        {
                                            var performance = product.Performance.LineItem.Performance;
                                            <tr>
                                                <td>
                                                    @performance.Description<br />
                                                    @performance.Facility.Description<br />
                                                    @performance.PerformanceDateTime
                                                </td>
                                                <td style="vertical-align: top">
                                                    @product.Performance.LineItem.SubLineItems[0].Zone.Description
                                                </td>
                                                <td style="vertical-align: top">
                                                    @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                    {
                                                        var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                        @seatRow<br />
                                                    }
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                    {
                                                        var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                        @amount<br />
                                                    }
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", product.Performance.LineItem.TotalDue)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td colspan="4" style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right;">
                                                <b>Total Single Tickets Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right;">
                                                <b>@string.Format("{0:C}", performanceTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
    
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
    
            }
    
            /* PACKAGES */
            var packages = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Package");
    
            // If the order has packages, loop through them and display them in a table
            if (packages != null && packages.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Packages</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="255" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                            <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                            <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                            <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Price</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                        </tr>
                                        @{
                                            var packageTotal = packages.Sum(x => x.Package.LineItems.Sum(y => y.TotalDue));
                                        }
    
                                        @foreach (var product in packages)
                                        {
                                            foreach (var lineItem in product.Package.LineItems)
                                            {
                                                if (lineItem.Performance == null)
                                                {
                                                    <tr>
                                                        <td colspan="5" style="text-align: left; vertical-align: top">
                                                            <b>@lineItem.Package.Description</b>
                                                        </td>
                                                    </tr>
                                                }
                                                else
                                                {
                                                    var performance = lineItem.Performance;
                                                    <tr>
                                                        <td>
                                                            @performance.Description<br />
                                                            @performance.Facility.Description<br />
                                                            @performance.PerformanceDateTime
                                                        </td>
                                                        <td style="vertical-align: top">
                                                            @lineItem.SubLineItems[0].Zone.Description
                                                        </td>
                                                        <td style="vertical-align: top">
                                                            @foreach (var subLineItem in lineItem.SubLineItems)
                                                            {
                                                                var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                                @seatRow<br />
                                                            }
                                                        </td>
                                                        <td style="vertical-align: top; text-align: right">
                                                            @foreach (var subLineItem in lineItem.SubLineItems)
                                                            {
                                                                var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                                @amount<br />
                                                            }
                                                        </td>
                                                        <td style="vertical-align: top; text-align: right">
                                                            @string.Format("{0:C}", lineItem.TotalDue)
                                                        </td>
                                                    </tr>
                                                }
                                            }
                                        }
                                        <tr>
                                            <td colspan="4" style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right">
                                                <b>Total Packages Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #6C208D; color: #6C208D; text-align: right">
                                                <b>@string.Format("{0:C}", packageTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            /* CONTRIBUTIONS */
            var contributions = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Contribution");
            var contributionTotal = contributions.Sum(x => x.Contribution.Amount);
    
            // If the order has contributions, loop through them and display them in a table
            if (contributions != null && contributions.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #6C208D; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Contributions</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var contribution in contributions)
                                        {
                                            <tr>
                                                <td>
                                                    @contribution.Contribution.Fund.Description
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", contribution.Contribution.Amount)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Contribution Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", contributionTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            var memberships = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Membership");
            var membershipTotal = memberships.Sum(x => x.Membership.Amount);
    
            if (memberships != null && memberships.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Memberships</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var membership in memberships)
                                        {
                                            <tr>
                                                <td>
                                                    @membership.Membership.MembershipLevel.Description
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", membership.Membership.Amount)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Membership Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", membershipTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            var giftCertificates = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Gift Certificate");
            var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount);
    
            if (giftCertificates != null && giftCertificates.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Gift Certificates</b>
                                </th>
                            </tr>
                            
    
    
    
    
            
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var giftCertificate in giftCertificates)
                                        {
                                            var amount = -giftCertificate.GiftCertificate.Amount;
                                            <tr>
                                                <td>
                                                    Redemption Code: @giftCertificate.GiftCertificate.GiftCertificateNumber
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", amount)
                                                </td>
                                            </tr>
                                            <div class="container" style="position: relative; text-align: center; color: black;">
                                                <img src="https://www.sunsetcenter.org/webart/press/files/165_3.jpg" alt="Gift Certificate" style="width:100%;">
                                                <div class="bottom-left" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="top-left" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="top-right" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="bottom-right" style="position: absolute; bottom: 25px; right:16px; text-align: right;">Redemption Code:<p> @giftCertificate.GiftCertificate.GiftCertificateNumber </p> @string.Format("{0:C}", amount)</div>
                                                <div class="centered" style="position: absolute; top: 40%; left: 50%; transform: traslate(-50%, -50%);">To <p>From</p>Note</div>
                                            </div>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Gift Certificate Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", giftCertificateTotal)</b>
                                            </td>
                                        </tr>
                                        
                                    </table>
                                    
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
    
            var subTotal = string.Format("{0:C}", Model.OrderProductView.TotalPurchaseAmount + Model.OrderProductView.TotalContributionAmount);
    
            <tr>
                <td colspan="2">
                    <table width="700" style="padding-top: 20px;">
                        <tr>
                            <td width="600" style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Order Subtotal:</b>
                            </td>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">@subTotal</td>
                        </tr>
                        <tr>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Fees:</b>
                            </td>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>@string.Format("{0:C}", Model.OrderProductView.TotalFeeAmount)</b>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Total:</b>
                            </td>
                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                @string.Format("{0:C}", Model.OrderProductView.TotalDueAmount)
                            </td>
    
                        </tr>
                    </table>
                </td>
            </tr>
        }
    
        @if (hasBooking)
        {
            <tr>
                <td>
                    <table style="font-size: 12px;	color: #000000; font-family:Arial, Helvetica, sans-serif; text-align: left">
                        <tr>
                            <th colspan="3" style="background-color: #6C208D;color: #ffffff;font-weight: bold;font-size: 12px;text-align: left;vertical-align: top">
                                <b>Booking</b>
                            </th>
                        </tr>
                        <tr>
                            <td><h3>@Model.Booking.Description </h3></td>
                        </tr>
                        <tr>
                            <td><h4>Confirmation: @Model.Booking.ConfirmationText </h4></td>
                        </tr>
                        @if (Model.Booking.Assignments != null && Model.Booking.Assignments.Count > 0)
                        {
                            <tr>
                                <td><b>Resources</b></td>
                            </tr>
                            <tr>
                                <td style="text-align:left;vertical-align:top">
                                    <table style="vertical-align: top;text-align:left">
                                        <tr>
                                            <th width="140" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Type</th>
                                            <th width="200" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Description</th>
                                            <th width="60" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Count</th>
                                            <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Start</th>
                                            <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">End</th>
                                        </tr>
                                        @foreach (var assignment in @Model.Booking.Assignments)
                                        {
                                            var description = @assignment.Resource != null ? @assignment.Resource.Description : "TBD";
    
                                            <tr>
                                                <td>@assignment.ResourceType.Description</td>
                                                <td>@description</td>
                                                <td>@assignment.Schedule.Count</td>
                                                <td>@assignment.Schedule.StartDateTime</td>
                                                <td>@assignment.Schedule.EndDateTime</td>
                                            </tr>
                                            if (assignment.ConfirmationText != null)
                                            {
                                                <tr>
                                                    <td></td>
                                                    <td colspan="4">@assignment.ConfirmationText</td>
                                                </tr>
                                            }
                                        }
                                    </table>
                                </td>
                            </tr>
                        }
                    </table>
    
                </td>
            </tr>
    
        }
    </table>
    

Reply
  • Try this

    @*using statement required for access to Constituencies object type when making REST call to CRM/Constituencies*@
    @using Tessitura.Service.Client.CRM;
    
    @{
        var hasConstituent = Model.OrderProductView.Constituent != null;
        var hasAddress = Model.Address != null;
        var hasElectronicAddress = Model.ElectronicAddress != null;
        var hasBooking = Model.Booking != null;
        var isInSpecialConstituency = false;
        var constituencyMessage = Model.GetPropertyValue("ConstituencyMessage") ?? "Thank you for being a part of Friend's Circle!";
        var constituency = Model.GetPropertyValue("Constituency") ?? "FRC";
        var hasState = hasAddress && Model.Address.State != null;
        var hasProducts = Model.OrderProductView.Products != null && Model.OrderProductView.Products.Count > 0;
    }
    
    @if (hasConstituent)
    {
        var url = "CRM/Constituencies?constituentId=" + Model.OrderProductView.Constituent.Id + "&includeAffiliations=true";
        var constituencies = Model.RestClient.AtUrl(url).Get<Constituencies>().ResponseObject;
        isInSpecialConstituency = constituencies != null && constituencies.Count(x => x.ConstituencyType.ShortDescription == constituency) > 0;
    }
        
    <table width="700" style="font-size: 12px; text-align:left;	color: #000000; font-family:Arial, Helvetica, sans-serif;">
        <tr>
            <td align="left" valign="top">
    
                <table style="vertical-align: top;text-align:left">
                    <tr>
                        <td colspan="2" style="text-align:left">
                            <h3>Thank You for Your Order with the Tessitura Network!</h3>
                            <b>Order Date:</b> @Model.OrderProductView.OrderDateTime <br />
                            <b>Order Number:</b> @Model.OrderProductView.Id<br />
                            @if (hasConstituent)
                            {
                                <b>Customer Number:</b>
                                @Model.OrderProductView.Constituent.Id
                                <br />
                                <br />
                            }
                            <p style="margin-top: -10px; padding-bottom: 20px;"><small>Please retain this receipt for your reference.</small></p>
                        </td>
                    </tr>
                    @{
                        var state = hasState ? ", " + Model.Address.State.StateCode : "";
                        var electronicAddress = hasElectronicAddress ? Model.ElectronicAddress.Address : "";
                    }
                    
                    <tr>
                        <td width="50%" style="padding-bottom: 20px; vertical-align: top;">
                            <b>Your Account Information:</b><BR />
                            @if (isInSpecialConstituency)
                            {
                                @constituencyMessage <br />
                            }
                            @if (hasConstituent)
                            {
                                @Model.OrderProductView.Constituent.DisplayName <br />
                            }
                            @if (hasAddress)
                            {
                                @Model.Address.Street1<br />
                                @Model.Address.City@state @Model.Address.PostalCode<br />
                            }
                            @electronicAddress<br />
                        </td>
                        <td width="50%" style="padding-bottom: 20px; text-align: left;vertical-align: top">
                            <b>Order Shipping Information</b><BR />
                            @if (Model.OrderProductView.DeliveryMethod.Id == -1)
                            {
                                <text> Hold order at Box Office</text><br />
                                <i>Please pick up your tickets no later than 30 minutes before curtain</i>
                            }
                            else if (hasAddress)
                            {
                                <text>
                                    @Model.Address.Street1<br />
                                    @Model.Address.City@state @Model.Address.PostalCode<br />
                                </text>
                            }
    
    
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        @if (hasProducts)
        {
            /* PERFORMANCES */
            var perfs = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Performance");
    
            // If the order has performances, loop through them and display them in a table
            if (perfs != null && perfs.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
                        <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Performances</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="250" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                            <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                            <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                            <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Price</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                        </tr>
    
                                        @{
                                            var performanceTotal = @perfs.Sum(x => x.Performance.LineItem.TotalDue);
                                        }
    
                                        @foreach (var product in perfs)
                                        {
                                            var performance = product.Performance.LineItem.Performance;
                                            <tr>
                                                <td>
                                                    @performance.Description<br />
                                                    @performance.Facility.Description<br />
                                                    @performance.PerformanceDateTime
                                                </td>
                                                <td style="vertical-align: top">
                                                    @product.Performance.LineItem.SubLineItems[0].Zone.Description
                                                </td>
                                                <td style="vertical-align: top">
                                                    @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                    {
                                                        var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                        @seatRow<br />
                                                    }
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @foreach (var subLineItem in product.Performance.LineItem.SubLineItems)
                                                    {
                                                        var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                        @amount<br />
                                                    }
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", product.Performance.LineItem.TotalDue)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td colspan="4" style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right;">
                                                <b>Total Single Tickets Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right;">
                                                <b>@string.Format("{0:C}", performanceTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
    
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
    
            }
    
            /* PACKAGES */
            var packages = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Package");
    
            // If the order has packages, loop through them and display them in a table
            if (packages != null && packages.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table align="left" style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Packages</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="255" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Description</th>
                                            <th width="150" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Location</th>
                                            <th width="100" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Seat(s)</th>
                                            <th width="85" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: left">Price</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; vertical-align: top; text-align: right">Total</th>
                                        </tr>
                                        @{
                                            var packageTotal = packages.Sum(x => x.Package.LineItems.Sum(y => y.TotalDue));
                                        }
    
                                        @foreach (var product in packages)
                                        {
                                            foreach (var lineItem in product.Package.LineItems)
                                            {
                                                if (lineItem.Performance == null)
                                                {
                                                    <tr>
                                                        <td colspan="5" style="text-align: left; vertical-align: top">
                                                            <b>@lineItem.Package.Description</b>
                                                        </td>
                                                    </tr>
                                                }
                                                else
                                                {
                                                    var performance = lineItem.Performance;
                                                    <tr>
                                                        <td>
                                                            @performance.Description<br />
                                                            @performance.Facility.Description<br />
                                                            @performance.PerformanceDateTime
                                                        </td>
                                                        <td style="vertical-align: top">
                                                            @lineItem.SubLineItems[0].Zone.Description
                                                        </td>
                                                        <td style="vertical-align: top">
                                                            @foreach (var subLineItem in lineItem.SubLineItems)
                                                            {
                                                                var seatRow = string.IsNullOrEmpty(subLineItem.Seat.Number) ? "TBD" : subLineItem.Seat.Row + " " + subLineItem.Seat.Number;
                                                                @seatRow<br />
                                                            }
                                                        </td>
                                                        <td style="vertical-align: top; text-align: right">
                                                            @foreach (var subLineItem in lineItem.SubLineItems)
                                                            {
                                                                var amount = string.Format("{0:C}", subLineItem.DueAmount);
                                                                @amount<br />
                                                            }
                                                        </td>
                                                        <td style="vertical-align: top; text-align: right">
                                                            @string.Format("{0:C}", lineItem.TotalDue)
                                                        </td>
                                                    </tr>
                                                }
                                            }
                                        }
                                        <tr>
                                            <td colspan="4" style="border-top: 1px solid #6C208D; color: #6C208D; vertical-align: top; text-align: right">
                                                <b>Total Packages Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #6C208D; color: #6C208D; text-align: right">
                                                <b>@string.Format("{0:C}", packageTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            /* CONTRIBUTIONS */
            var contributions = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Contribution");
            var contributionTotal = contributions.Sum(x => x.Contribution.Amount);
    
            // If the order has contributions, loop through them and display them in a table
            if (contributions != null && contributions.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #6C208D; font-family: Arial, Helvetica, sans-serif;">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Contributions</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var contribution in contributions)
                                        {
                                            <tr>
                                                <td>
                                                    @contribution.Contribution.Fund.Description
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", contribution.Contribution.Amount)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Contribution Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", contributionTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            var memberships = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Membership");
            var membershipTotal = memberships.Sum(x => x.Membership.Amount);
    
            if (memberships != null && memberships.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Memberships</b>
                                </th>
                            </tr>
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var membership in memberships)
                                        {
                                            <tr>
                                                <td>
                                                    @membership.Membership.MembershipLevel.Description
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", membership.Membership.Amount)
                                                </td>
                                            </tr>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Membership Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", membershipTotal)</b>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
            var giftCertificates = Model.OrderProductView.Products.Where(x => x.ProductClass.Description == "Gift Certificate");
            var giftCertificateTotal = giftCertificates.Sum(x => -x.GiftCertificate.Amount);
    
            if (giftCertificates != null && giftCertificates.Count() > 0)
            {
                <tr>
                    <td align="left" valign="top">
    
                        <table style="font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif; text-align: left">
                            <tr>
                                <th style="background-color: #6C208D; color: #ffffff; font-weight: bold; font-size: 12px; text-align: left; vertical-align: top">
                                    <b>Gift Certificates</b>
                                </th>
                            </tr>
                            
    
    
    
    
            
                            <tr>
                                <td style="text-align: left; vertical-align: top">
                                    <table width="700" style="vertical-align: top; text-align: left">
                                        <tr>
                                            <th width="600" style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: left; vertical-align: top">Description</th>
                                            <th style="background-color: #6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline; color: #FFFFFF; text-align: right; vertical-align: top">Total</th>
                                        </tr>
                                        @foreach (var giftCertificate in giftCertificates)
                                        {
                                            var amount = -giftCertificate.GiftCertificate.Amount;
                                            <tr>
                                                <td>
                                                    Redemption Code: @giftCertificate.GiftCertificate.GiftCertificateNumber
                                                </td>
                                                <td style="vertical-align: top; text-align: right">
                                                    @string.Format("{0:C}", amount)
                                                </td>
                                            </tr>
                                            <div class="container" style="position: relative; text-align: center; color: black;">
                                                <img src="https://www.sunsetcenter.org/webart/press/files/165_3.jpg" alt="Gift Certificate" style="width:100%;">
                                                <div class="bottom-left" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="top-left" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="top-right" style="position: absolute; bottom: 8px; left:16px;"> </div>
                                                <div class="bottom-right" style="position: absolute; bottom: 25px; right:16px; text-align: right;">Redemption Code:<p> @giftCertificate.GiftCertificate.GiftCertificateNumber </p> @string.Format("{0:C}", amount)</div>
                                                <div class="centered" style="position: absolute; top: 40%; left: 50%; transform: traslate(-50%, -50%);">To <p>From</p>Note</div>
                                            </div>
                                        }
                                        <tr>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                                <b>Total Gift Certificate Cost:</b>
                                            </td>
                                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; text-align: right">
                                                <b>@string.Format("{0:C}", giftCertificateTotal)</b>
                                            </td>
                                        </tr>
                                        
                                    </table>
                                    
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            }
    
    
            var subTotal = string.Format("{0:C}", Model.OrderProductView.TotalPurchaseAmount + Model.OrderProductView.TotalContributionAmount);
    
            <tr>
                <td colspan="2">
                    <table width="700" style="padding-top: 20px;">
                        <tr>
                            <td width="600" style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Order Subtotal:</b>
                            </td>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">@subTotal</td>
                        </tr>
                        <tr>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Fees:</b>
                            </td>
                            <td style="color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>@string.Format("{0:C}", Model.OrderProductView.TotalFeeAmount)</b>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                <b>Total:</b>
                            </td>
                            <td style="border-top: 1px solid #FFFFFF; color: #6e6d6d; vertical-align: top; text-align: right">
                                @string.Format("{0:C}", Model.OrderProductView.TotalDueAmount)
                            </td>
    
                        </tr>
                    </table>
                </td>
            </tr>
        }
    
        @if (hasBooking)
        {
            <tr>
                <td>
                    <table style="font-size: 12px;	color: #000000; font-family:Arial, Helvetica, sans-serif; text-align: left">
                        <tr>
                            <th colspan="3" style="background-color: #6C208D;color: #ffffff;font-weight: bold;font-size: 12px;text-align: left;vertical-align: top">
                                <b>Booking</b>
                            </th>
                        </tr>
                        <tr>
                            <td><h3>@Model.Booking.Description </h3></td>
                        </tr>
                        <tr>
                            <td><h4>Confirmation: @Model.Booking.ConfirmationText </h4></td>
                        </tr>
                        @if (Model.Booking.Assignments != null && Model.Booking.Assignments.Count > 0)
                        {
                            <tr>
                                <td><b>Resources</b></td>
                            </tr>
                            <tr>
                                <td style="text-align:left;vertical-align:top">
                                    <table style="vertical-align: top;text-align:left">
                                        <tr>
                                            <th width="140" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Type</th>
                                            <th width="200" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Description</th>
                                            <th width="60" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Count</th>
                                            <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">Start</th>
                                            <th width="150" style="background-color:#6C208D ! important; font-size: 11px ! important; font-weight: bold; text-decoration: underline;color: #FFFFFF; vertical-align: top;text-align:left">End</th>
                                        </tr>
                                        @foreach (var assignment in @Model.Booking.Assignments)
                                        {
                                            var description = @assignment.Resource != null ? @assignment.Resource.Description : "TBD";
    
                                            <tr>
                                                <td>@assignment.ResourceType.Description</td>
                                                <td>@description</td>
                                                <td>@assignment.Schedule.Count</td>
                                                <td>@assignment.Schedule.StartDateTime</td>
                                                <td>@assignment.Schedule.EndDateTime</td>
                                            </tr>
                                            if (assignment.ConfirmationText != null)
                                            {
                                                <tr>
                                                    <td></td>
                                                    <td colspan="4">@assignment.ConfirmationText</td>
                                                </tr>
                                            }
                                        }
                                    </table>
                                </td>
                            </tr>
                        }
                    </table>
    
                </td>
            </tr>
    
        }
    </table>
    

Children
No Data