<!--                                                                  -->
<!--  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="section" id="auditReport">
    	    <xsl:choose>
    		    <xsl:when test="Report/Product">
                    <xsl:call-template name="ukMechRetentionSummaryDisplay" />
				</xsl:when>
				<xsl:otherwise>
				    <xsl:call-template name="ukMechRetentionSummaryHeading" />
					<p>No retentions are currently being held.</p>
				</xsl:otherwise>
			</xsl:choose>
		</div>

        <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>

	</xsl:template>
	
	
	<xsl:template name="ukMechRetentionSummaryDisplay">
        <div class="reportNavWrapper">
            <xsl:call-template name="ukMechRetentionSummaryHeading" />
            <xsl:call-template name="reportHeading" />
            <xsl:call-template name="reportNav" />
        </div>
        <xsl:call-template name="ukMechRetentionSummaryTable" />
        <xsl:call-template name="reportNav" />
        <br class="superBreak" />
        <br />
	</xsl:template>			
	

	<xsl:template name="ukMechRetentionSummaryHeading">
        <h2>
            <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<xsl:value-of select="$tipBreak" />
        			        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="textChart hiOn">
            <tr>
              	<th>Catalog&#160;#</th>
              	<th>Album&#160;Title</th>
              	<th>Artist</th>
              	<th>Product</th>
              	<th>Release Date</th>
              	<th class="status">TV Ad</th>
              	<th class="status">Current Retention Period</th>
              	<th class="amount">P1 Rate</th>
              	<th class="amount">P1 # Held</th>
              	<th class="amount">P2 Rate</th>
              	<th class="amount">P2 # Held</th>
              	<th class="amount">P3 Rate</th>
              	<th class="amount">P3 # Held</th>
              	<th class="amount">P4 Rate</th>
              	<th class="amount">P4 # Held</th>              	              	              	
              	<th class="amount">Total Held</th>
            </tr>
            <xsl:for-each select="Report/Product">
                
                <tr class="row{position() mod 2}">
                    <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="ArtistName" /></td>
    			    <td>
    			        <xsl:value-of select="ProductType" />
    			    </td>
    			    <td><xsl:value-of select="ReleaseDate" /></td>
    			    <td class="status">
    			        <xsl:choose>
    			            <xsl:when test="TVAdvertised = '1'">Y</xsl:when>
    			            <xsl:otherwise>N</xsl:otherwise>
    			        </xsl:choose>
    			    </td>   
    			    <td class="status">
    			        <xsl:value-of select="CurrentPeriod" />
    			    </td>
    			    <td class="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="amount">
    			        <xsl:value-of select="P1Held" />
    			    </td>
    			    <td class="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="amount">
    			        <xsl:if test="CurrentPeriod &gt; 1">
    			            <xsl:value-of select="P2Held" />
    			        </xsl:if>
    			    </td>    	
    			    <td class="amount">
    			        <xsl:if test="CurrentPeriod &gt; 2">
                            10%	
                        </xsl:if>	        
    			    </td>
    			    <td class="amount">
    			        <xsl:if test="CurrentPeriod &gt; 2">
    			            <xsl:value-of select="P3Held" />
    			        </xsl:if>
    			    </td>    	
    			    <td class="amount">
    			        <xsl:if test="CurrentPeriod &gt; 3">
                            10%	
                        </xsl:if>		        
    			    </td>
    			    <td class="amount">
    			        <xsl:if test="CurrentPeriod &gt; 3">
    			            <xsl:value-of select="P4Held" />
    			        </xsl:if>
    			    </td>    	    			        			    		    
    			    <td class="amount"><xsl:value-of select="TotalHeld" /></td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>

</xsl:stylesheet>
