<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


    <!--
    This template is used for the uk_mech_retention_summary command
    AND the uk_mech_retention_run_summary command.
    -->

    <xsl:template name="ukMechRetentionSummaryLayout">
        <div class="AuditReport" id="auditReport">
            <xsl:choose>
                <xsl:when test="Report/Product">
                    <xsl:call-template name="ukMechRetentionSummaryDisplay" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:call-template name="ukMechRetentionSummaryHeading" />
                    <section class="Table-empty-results">
                        <p>No retentions are currently being held.</p>
                    </section>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:choose>
                <xsl:when test="$cmd = 'uk_mech_retention_run_summary'">
                    <xsl:call-template name="backToUKMechRun" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:call-template name="backToStatementsHome" />
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

    <xsl:template name="ukMechRetentionSummaryDisplay">
        <xsl:call-template name="ukMechRetentionSummaryHeading" />
        <xsl:call-template name="reportHeading" />
        <xsl:call-template name="ukMechRetentionSummaryTable" />
        <xsl:call-template name="reportFooter" />
    </xsl:template>

    <xsl:template name="ukMechRetentionSummaryHeading">
        <h2 class="AuditReport-header">
            <xsl:choose>
                <xsl:when test="$cmd = 'uk_mech_retention_run_summary'">
                    Retentions - Full Report for Current Period
                    <xsl:call-template name="helpIcon">
                        <xsl:with-param name="tip">
                            Lists all retentions that are being held as of the reporting period of this UK mechanical statement run.
                        </xsl:with-param>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    Retentions - Full Report for All MCPS Products
                    <xsl:call-template name="helpIcon">
                        <xsl:with-param name="tip">
                            Lists all retentions that are currently being held.
                        </xsl:with-param>
                    </xsl:call-template>
                </xsl:otherwise>
            </xsl:choose>
        </h2>
    </xsl:template>

    <xsl:template name="ukMechRetentionSummaryTable">
        <table class="Table Table-with-highlight">
            <thead>
                <tr class="Table-row Table-row-header">
                    <th class="Table-col">Catalog&#160;#</th>
                    <th class="Table-col">Album&#160;Title</th>
                    <th class="Table-col">Artist</th>
                    <th class="Table-col">Product</th>
                    <th class="Table-col">Release Date</th>
                    <th class="Table-col Table-col-status">TV Ad</th>
                    <th class="Table-col Table-col-status">Current Retention Period</th>
                    <th class="Table-col Table-col-amount">P1 Rate</th>
                    <th class="Table-col Table-col-amount">P1 # Held</th>
                    <th class="Table-col Table-col-amount">P2 Rate</th>
                    <th class="Table-col Table-col-amount">P2 # Held</th>
                    <th class="Table-col Table-col-amount">P3 Rate</th>
                    <th class="Table-col Table-col-amount">P3 # Held</th>
                    <th class="Table-col Table-col-amount">P4 Rate</th>
                    <th class="Table-col Table-col-amount">P4 # Held</th>
                    <th class="Table-col Table-col-amount">Total Held</th>
                </tr>
            </thead>
            <tbody>
                <xsl:for-each select="Report/Product">
                    <tr class="Table-row Table-row-data">
                        <td class="Table-col"><xsl:value-of select="CatalogNumber" /></td>
                        <td class="Table-col">
                            <a href="/rps/catalog?c=show&amp;AlbumID={AlbumID}"><xsl:value-of select="AlbumTitle" /></a>
                        </td>
                        <td class="Table-col"><xsl:value-of select="ArtistName" /></td>
                        <td class="Table-col">
                            <xsl:value-of select="ProductType" />
                        </td>
                        <td class="Table-col"><xsl:value-of select="ReleaseDate" /></td>
                        <td class="Table-col Table-col-status">
                            <xsl:choose>
                                <xsl:when test="TVAdvertised = '1'">Y</xsl:when>
                                <xsl:otherwise>N</xsl:otherwise>
                            </xsl:choose>
                        </td>
                        <td class="Table-col Table-col-status">
                            <xsl:value-of select="CurrentPeriod" />
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 0">
                                <xsl:choose>
                                    <xsl:when test="TVAdvertised = '1'">25%</xsl:when>
                                    <xsl:otherwise>10%</xsl:otherwise>
                                </xsl:choose>
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:value-of select="P1Held" />
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 1">
                                <xsl:choose>
                                    <xsl:when test="TVAdvertised = '1'">25%</xsl:when>
                                    <xsl:otherwise>10%</xsl:otherwise>
                                </xsl:choose>
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 1">
                                <xsl:value-of select="P2Held" />
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 2">
                                10%
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 2">
                                <xsl:value-of select="P3Held" />
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 3">
                                10%
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount">
                            <xsl:if test="CurrentPeriod &gt; 3">
                                <xsl:value-of select="P4Held" />
                            </xsl:if>
                        </td>
                        <td class="Table-col Table-col-amount"><xsl:value-of select="TotalHeld" /></td>
                    </tr>
                </xsl:for-each>
            </tbody>
        </table>
    </xsl:template>

</xsl:stylesheet>
