<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn">
    <xsl:output method="html" indent="no" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN" encoding="utf-8" />

    <xsl:include href="/app/tools/rps/templates/global.xsl" />
    <xsl:include href="../shared_layouts/statements.xsl" />


    <xsl:template name="pickLayout">
        <div id="statement">  
            <xsl:call-template name="summary" />
            <xsl:call-template name="payable_units" />
            <xsl:call-template name="details" />          
        </div>
        <xsl:call-template name="buttons" />
    </xsl:template>


    <xsl:template name="payable_units">
   	    <div class="section" id="statementSummary">
            <div class="statementInfo">    	
            <table class="transactionTable">
              <tr>
                <td><strong>Royalty Payable Units:</strong></td><td><xsl:value-of select="Statement/McpsStatement/RoyaltyPayableUnits" /></td>
              </tr>
              <tr>
                <td><strong>Estimated Liability:</strong></td><td><xsl:value-of select="Statement/McpsStatement/EstimatedLiability" /> </td>
              </tr>
              <tr>
                <td>&#160;</td><td>&#160;</td>
              </tr>
            </table>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="summary">
   	    <div class="section" id="statementSummary">
   	        <xsl:call-template name="helpLink" /> 
            <div class="statementInfo">    	
       	        <strong>MCPS <xsl:value-of select="Statement/McpsStatement/McpsScheme" /> Statement
       	        &#160;&#160;&#160;&#160;&#160;&#160;
       	        Date: <xsl:call-template name="runDate"><xsl:with-param name="runDate" select="substring(Statement/UKMechanicalRun/StartTime,1,10)" /></xsl:call-template>
       	        </strong>
       	        <br />
       	        <br />

       	        <xsl:if test="Statement/UKMechanicalRun/CanDownloadPDF = 1">
	                <a href="?c=pdf_mcps&amp;McpsStatementID={Statement/McpsStatement/McpsStatementID}" title="Download PDF">
						<img src="/production/images/pdficon_small.gif" height="17" width="17" class="pdfIcon" />
					</a>
					<a href="?c=pdf_mcps&amp;McpsStatementID={Statement/McpsStatement/McpsStatementID}">PDF Version</a>
					<br /><br />
       	        </xsl:if>
       	
       	        <xsl:if test="Statement/UKMechanicalRun/CanDownloadText = 1">    		        
	                <a href="?c=text_mcps&amp;UKMechanicalRunID={Statement/McpsStatement/UKMechanicalRunID}" title="Download Electronic Format">
						<img src="/production/images/icons/office/Document-(16x16).gif" height="16" width="16" class="pdfIcon" />
					</a>
					<a href="?c=text_mcps&amp;UKMechanicalRunID={Statement/McpsStatement/UKMechanicalRunID}">Electronic Format</a>		
					<br /><br />			
				</xsl:if>

       	        
       	        <xsl:value-of select="Statement/Payor/Name" />
                <xsl:if test="normalize-space(Statement/Payor/StreetAddress)">
                    <br />
                    <xsl:call-template name="replaceLineBreak">
                        <xsl:with-param name="string" select="Statement/Payor/StreetAddress"/>
                    </xsl:call-template>
                </xsl:if>
                <xsl:if test="normalize-space(Statement/Payor/City) or normalize-space(Statement/Payor/StateProvince)">
                    <br />
                    <xsl:if test="normalize-space(Statement/Payor/City)"><xsl:value-of select="Statement/Payor/City" /><xsl:if test="normalize-space(Statement/Payor/StateProvince)">, </xsl:if></xsl:if><xsl:value-of select="Statement/Payor/StateProvince" />&#160;<xsl:value-of select="Statement/Payor/PostalCode" />
                </xsl:if>
                <xsl:if test="normalize-space(Statement/Payor/CountryCode)">
                    <br />
                    <xsl:value-of select="Statement/Payor/CountryCode" />
                </xsl:if> 
                      	        
       	        <br />
       	        <br />
       	        Account Number: <xsl:value-of select="Statement/Payor/SupplierCode" />
       	        <br />
       	        Reporting Period: Q<xsl:value-of select="Statement/UKMechanicalRun/Quarter" />&#160;<xsl:value-of select="Statement/UKMechanicalRun/Year" />
       	        <br />
       	        Scheme Code: <xsl:value-of select="Statement/McpsStatement/McpsScheme" />
       	        <br />
       	        <br />
       	        Mechanical Copyright Protection Society Ltd
       	        <br />
       	        Elgar House
       	        <br />
       	        41 Streatham High Road
       	        <br />
       	        London
       	        <br />
       	        SW161ER
       	        <br /><br />                      
            </div>
        </div>
    </xsl:template>

  
    <xsl:template name="details">
        <xsl:if test="Statement/McpsStatement/McpsStatementItemList/McpsStatementItem">
            <table class="statementTable">
                <xsl:call-template name="detailsHeader" />   
                <xsl:for-each select="Statement/McpsStatement/McpsStatementItemList/McpsStatementItem">
                    <xsl:call-template name="detailsRow" />
                </xsl:for-each>
                <xsl:call-template name="totalRow" />
            </table>
        </xsl:if>
    </xsl:template>  


    <xsl:template name="detailsHeader">
        <tr class="statementHeader">
            <th>Album Title</th>
            <th>Catalog #</th>                   
            <th>MCPS ID</th>
            <th>Product Format</th>
            
            <xsl:if test="Statement/McpsStatement/McpsScheme = 'DVD1'">
                <th>DVD Cat</th>
            </xsl:if>
            
            <th class="center">Release Date</th>
            <th>Country</th>
            <th class="amount">Gross</th>
            <th class="amount">Prior (&#8209;)</th> 
            <th class="amount">Promo</th>  
            <th class="amount">Returns</th>
            <th class="amount">Net Royalty Units</th>
            <th class="amount">Retentions</th>
            <th class="amount">TV Retentions</th>  
            <th class="amount">Net</th>
            <th class="amount">Price</th>
            <th class="center">Price Type</th>
            <th class="center">Adj?</th>  
            <th>Comments</th>                        
        </tr>
    </xsl:template>
 

    <xsl:template name="detailsRow">
        <tr>
         	<xsl:if test="position() = 1">
        		<xsl:attribute name="class">total</xsl:attribute>
        	</xsl:if> 
            <td>
                <a href="catalog?AlbumID={AlbumID}&amp;c=show">
                    <xsl:value-of select="substring(AlbumTitle,1,20)" /><xsl:if test="substring(AlbumTitle,21,1)">...</xsl:if>
                </a>
            </td>
            <td>
                <xsl:choose>
                    <xsl:when test="(/Root/Client/ClientID = 315 or /Root/Client/ClientID = 288) and ProductCode != ''">
                        <xsl:value-of select="ProductCode" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="CatalogNumber" />
                    </xsl:otherwise>
                </xsl:choose>
            </td>               
            <td>
                <a href="uk_mech?c=show_mcps_license&amp;McpsLicenseID={McpsLicenseID}"><xsl:value-of select="McpsID" /></a>
            </td>              
            <td>
                <xsl:variable name="productTypeID" select="ProductTypeID" />
                <xsl:value-of select="/Root/Statement/TypeList/Type[ProductTypeID = $productTypeID]/Description" />
            </td>      

            <xsl:if test="/Root/Statement/McpsStatement/McpsScheme = 'DVD1'">
                <td><xsl:value-of select="DVDCategory" /></td>
            </xsl:if>            
                  
            <td class="center">
                <xsl:value-of select="ReleaseDate" />
            </td>            
            <td>
                <xsl:value-of select="CountryCode" />
            </td>
            <td class="amount">
                <xsl:value-of select="GrossUnits" />
            </td>
            <td class="amount">
                <xsl:value-of select="PriorUnits" />
            </td>
			<td class="amount">
				<xsl:value-of select="PromoUnits" />
			</td>
            <td class="amount">
                <xsl:value-of select="ReturnUnits" />
            </td>
            <td class="amount">
                <xsl:value-of select="NetUnits" />
            </td>     
            <td class="amount">
                <xsl:value-of select="Retentions" />
            </td>
             <td class="amount">
                <xsl:value-of select="TVRetentions" />
            </td>     
            <td class="amount">
                <xsl:value-of select="FinalNetUnits" />
            </td>
            <td class="amount">
                <xsl:value-of select="Price" />
            </td>
            <td class="center">
                <xsl:value-of select="McpsPriceType" />
            </td>       
            <td class="center">
                <xsl:if test="Adjustment = 1">Y</xsl:if>
            </td>                                 
            <td>
                <xsl:value-of select="Comments" />
            </td>                                  
        </tr>
    </xsl:template>


    <xsl:template name="totalRow">
        <tr class="total">
            <td colspan="6" class="amount">
                <xsl:if test="/Root/Statement/McpsStatement/McpsScheme = 'DVD1'">
                    <xsl:attribute name="colspan">7</xsl:attribute>
                </xsl:if>             
                Gross Units:
            </td>
            <td class="amount">
                <xsl:value-of select="Statement/McpsStatement/GrossUnits" />
            </td>
            <td colspan="6" class="amount">
                Net Units:
            </td>
            <td class="amount">
                <xsl:value-of select="Statement/McpsStatement/NetUnits" />
            </td>
            <td colspan="5">
            </td>                             
        </tr>
    </xsl:template>


    <xsl:template name="submitButton">
        <xsl:attribute name="class" />
    </xsl:template>


    <xsl:template name="cancelButton">
        <input type="button" name="Back" value="Back to Statements" onClick="location.href='uk_mech?UKMechanicalRunID={Statement/McpsStatement/UKMechanicalRunID}&amp;c=show'" />
    </xsl:template>


</xsl:stylesheet>

