<!--                                                                  -->
<!--  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="statementRunList">
        <xsl:call-template name="statementRuns" />
    </xsl:template>
  
  
    <xsl:template name="statementRuns">
        <div class="section" id="runList">
            <xsl:call-template name="statementSuccessMessages" />
    		<xsl:choose>
        		<xsl:when test="LabelRoyaltyRunList/LabelRoyaltyRun/RoyaltyRunStatus/LabelRuns/Error &gt; 0">
        		    <xsl:call-template name="errorRunMessage" />
        		</xsl:when>		
        		<xsl:otherwise>
    	  	        <xsl:call-template name="createRunLink" />
    	  	    </xsl:otherwise>
    	  	</xsl:choose>
			<xsl:choose>
				<xsl:when test="LabelRoyaltyRunList/LabelRoyaltyRun">
					<xsl:call-template name="runTable" />
				</xsl:when>
				<xsl:otherwise>
					<br class="superBreak" />
					<p>No label royalty runs have been created.</p>
				</xsl:otherwise>
			</xsl:choose>
		</div>
	</xsl:template>


    <xsl:template name="runTable">
        <table class="textChart hiOn">
			<tr>
              	<th># of Statements</th>
              	<th>Run Name</th>
              	<th>Ending Sales Date</th>
              	<th>Payor</th>
              	<th>Run Date</th>
              	<th>
      		        Status
					<xsl:call-template name="helpIcon">
						<xsl:with-param name="tip" select="$statusDescriptions" />
					</xsl:call-template>
              	</th>
              	<th>Actions</th>
			</tr>
            <xsl:for-each select="LabelRoyaltyRunList/LabelRoyaltyRun">
                <tr class="row{position() mod 2}">
                    <td>
						<xsl:call-template name="statementCount" />
                    </td>
                    <td>
          	            <xsl:value-of select="Label" />
                    </td>
                    <td>
          	            <xsl:call-template name="endingSalesDate" >
			                <xsl:with-param name="endingSaleDate"><xsl:value-of select="EndingSaleDate" /></xsl:with-param>
			            </xsl:call-template>
                    </td>
                    <td>
						<xsl:call-template name="payorName" />
                    </td>
                    <td>
          	            <xsl:call-template name="runDate" />
                    </td>
                    <td>
          	            <xsl:call-template name="statusCodeToName" />
                    </td>
        	        <td>
						<xsl:call-template name="runActions" />
					</td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>


</xsl:stylesheet>