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


    <xsl:template name="licenseOverageLayout">
        <div class="section" id="auditReport">
		    <div class="reportNavWrapper">
			    <h2>
				    Tracks Licensed Over 100%
				    <xsl:call-template name="helpIcon">
						<xsl:with-param name="tip">
							Lists tracks where the total share of all licenses attached exceeds 100%
						</xsl:with-param>
					</xsl:call-template>
					<xsl:if test="Access/rps/report/license_overage and Access/rps/report/ca_license_overage">
					    <xsl:call-template name="mechReportSwitcher" />
					</xsl:if>
			    </h2>
			    <xsl:if test="(Report/Track)">
    			    <xsl:call-template name="reportHeading" />
    			    <xsl:call-template name="reportNav" />
			    </xsl:if>
			</div>

			<xsl:if test="(Report/Track)">
      		    <xsl:call-template name="licenseOverageTable" />
      		    <xsl:call-template name="reportNav" />
    			<br class="superBreak" />
    			<br />
            </xsl:if>

			<xsl:if test="not(Report/Track)">
				<p>No tracks with over 100% licensed were found.</p>
			</xsl:if>
		</div>
		<xsl:call-template name="backToStatementsHome" />
	</xsl:template>


	<xsl:template name="licenseOverageTable">
        <table class="textChart hiOn">
            <tr>
              	<th>Label</th>
              	<th>Catalog&#160;#</th>
              	<th>Album&#160;Title</th>
              	<th>Artist</th>
              	<th class="amount">Track&#160;#</th>
                <th>Track&#160;Name</th>
                <th>Product&#160;Type</th>
                <th>Region</th>
                <th class="amount">Overage</th>
            </tr>
            <xsl:for-each select="Report/Track">
                <tr class="row{position() mod 2}">
        	        <td><xsl:value-of select="LabelName" /></td>
                    <td><xsl:value-of select="CatalogNumber" /></td>
					<td>
						<a href="/rps/catalog?c=show&amp;AlbumID={AlbumID}"><xsl:value-of select="AlbumTitle" /></a>
					</td>
					<td><xsl:value-of select="TrackArtistName" /></td>
					<td class="amount"><xsl:value-of select="TrackNumber" /></td>
					<td>
						<a href="/rps/track?c=show&amp;TrackID={TrackID}"><xsl:value-of select="TrackTitle" /></a>
					</td>
					<td>
						<xsl:choose>
			                <xsl:when test="ProductTypeID = 254">All Digital</xsl:when>
			                <xsl:when test="ProductTypeID = 255">All Physical</xsl:when>
							<xsl:when test="normalize-space(ProductTypeID)">
								<xsl:variable name="productTypeID" select="ProductTypeID" />
								<xsl:value-of select="/Root/TypeList/Type[ProductTypeID = $productTypeID]/Description" />
							</xsl:when>
							<xsl:otherwise>All</xsl:otherwise>
						</xsl:choose>
					</td>
					<td><xsl:value-of select="RegionName" /></td>
					<td class="amount"><xsl:value-of select="Overage" />%</td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>


</xsl:stylesheet>
