<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<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:include href="show.xsl" />
  <xsl:include href="list.xsl" />
	<xsl:include href="editpay.xsl" />
	<xsl:include href="create.xsl" />

  <xsl:template name="pickLayout">
    <xsl:choose>
      <xsl:when test="$cmd = 'show'">
        <xsl:call-template name="statementList" />
      </xsl:when>
      <xsl:when test="$cmd = 'payors'">
        <xsl:call-template name="statementPayorList" />
      </xsl:when>
      <xsl:when test="$cmd = 'editpay'">
        <xsl:call-template name="statementEditPay" />
      </xsl:when>
			<xsl:when test="$cmd = 'create'">
        <xsl:call-template name="createRun" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="statementRunList" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="submitButton">
  	<xsl:choose>
  		<xsl:when test="$cmd = 'show' and DistributorRoyaltyRun/Status = 2">
  			<input type="button" value="Edit Payments" onClick="goToPayments('distributor_royalty',{Params/PayorID},{Params/DistributorRoyaltyRunID})" />
  		</xsl:when>
  		<xsl:when test="$cmd = 'editpay'and Form/DistributorRoyaltyStatementList/DistributorStatement">
  			<input type="submit" value="Save Payments" />
  		</xsl:when>
  		<xsl:when test="$cmd = 'create'">
  			<input type="submit" name="submitButton" value="Create" />
  		</xsl:when>
  		<xsl:otherwise>
    		<xsl:attribute name="class" />
			</xsl:otherwise>
		</xsl:choose>
  </xsl:template>

  <xsl:template name="cancelButton">
  	<xsl:choose>
  		<xsl:when test="$cmd = 'editpay'">
  			<input type="button" name="Back" value="Back to Period Statements" onClick="location.href='distributor_royalty?c=show&amp;PayorID={Params/PayorID}&amp;DistributorRoyaltyRunID={Params/DistributorRoyaltyRunID}'" />
  		</xsl:when>
  		<xsl:otherwise>
    		<input type="button" name="Back" value="Back to Royalty Runs" onClick="location.href='distributor_royalty'" />
			</xsl:otherwise>
		</xsl:choose>	
  </xsl:template>

</xsl:stylesheet>

