<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="no" doctype-system="" encoding="utf-8" />

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

    <xsl:template name="pickLayout">
        <xsl:call-template name="helpLink" />

        <xsl:choose>
            <xsl:when test="$area='ca_mechanical'">
                <xsl:call-template name="mechanicalStatementRunList">
                    <xsl:with-param name="statusList" select="RoyaltyRunStatus/CAMechanicalRuns" />
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="mechanicalStatementRunList">
                    <xsl:with-param name="statusList" select="RoyaltyRunStatus/USMechanicalRuns" />
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <xsl:template name="mechanicalStatementRunList">
        <xsl:param name="statusList" />

        <xsl:variable name="reportCommandModifier">
            <xsl:choose>
                <xsl:when test="$area = 'ca_mechanical'">
                    <xsl:text>ca_</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text></xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="reportItems">
            <map>
                <mapEntry>
                    <title>Inactive Licenses</title>
                    <url>report?c=<xsl:value-of select="$reportCommandModifier" />inactive_licenses</url>
                </mapEntry>
                <mapEntry>
                    <title>Tracks Licensed Over 100%</title>
                    <url>report?c=<xsl:value-of select="$reportCommandModifier" />license_overage</url>
                </mapEntry>
                <mapEntry>
                    <title>Tracks Not 100% Licensed</title>
                    <url>report?c=<xsl:value-of select="$reportCommandModifier" />tracks_no_licenses</url>
                </mapEntry>
                <mapEntry>
                    <title>Tracks Without Timings</title>
                    <url>report?c=<xsl:value-of select="$reportCommandModifier" />tracks_no_timings</url>
                </mapEntry>
            </map>
        </xsl:variable>

        <xsl:call-template name="statementRunList">
            <xsl:with-param name="runs" select="MechanicalRunList/MechanicalRun" />
            <xsl:with-param name="statusList" select="$statusList" />
            <xsl:with-param name="payors" select="PayorList" />
            <xsl:with-param name="reportItems" select="$reportItems" />
        </xsl:call-template>
    </xsl:template>

</xsl:stylesheet>
