<?php echo $this->a_this->fetchTemplate('tm_list_js'); ?>

<h3><?php echo L_G_TRANSAPPLICATIONS_TOPMENU; ?></h3>
<p><?php echo L_G_TRANSAPPLICATIONS_DESC; ?></p>

<form name="FilterForm" id="FilterForm" action="index.php" method="GET">
<input type="hidden" name="md" value='Affiliate_Merchants_Views_PendingTransaction' />
<input type="hidden" id="action" name=action value="" />
<input type="hidden" name="filtered" value="1" />
<input type="hidden" name="type" value="all" />
<input type="hidden" id="list_page" name="list_page" value='<?php echo $_REQUEST['list_page']?>' />
<input type="hidden" id="sortby" name="sortby" value="<?php echo $_REQUEST['sortby']?>" />
<input type="hidden" id="sortorder" name="sortorder" value="<?php echo $_REQUEST['sortorder']?>" />

<table class="mt10" cellpadding="0" cellspacing="0" border="0" width="780">
<tr>
    <td>
    <table class="tblist" width="780" cellspacing="0" cellpadding="1">
    <tr class="header">
        <td width="10%"><?php echo L_G_CREATED; ?></td>
        <td width="10%"><?php echo L_G_CATEGORY; ?></td>
        <td width="10%"><?php echo L_G_AFFILIATES; ?></td>
        <td width="10%"><?php echo L_G_COMMISSION; ?></td>
        <td width="10%"><?php echo L_G_TOTALCOST; ?></td>
        <td width="10%"><?php echo L_G_ORDERID; ?></td>
        <td width="10%"><?php echo L_G_ACTIONS; ?></td>
    </tr>
    <?php
    if($this->a_allcount == 0) {
        echo '<tr><td colspan="7">'.L_G_NORECORDSFOUND.'</td></tr>';
    }else {
        $s = '<tr onmouseout="this.className=\'listresult\';" onmouseover="this.className=\'listresultMouseOver\'"><td>%s</td><td>%s</td><td>%s%s</td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
        while($row = $this->a_list_data->getNextRecord()) {
            $transtype = $row['transkind']>TRANSKIND_SECONDTIER?($row['transkind']-TRANSKIND_SECONDTIER).' - '.L_G_TIER.' ':'';
            $transtype .= $GLOBALS['Auth']->getCommissionTypeString($row['transtype']);
            if($row['count']>1) $transtype .= " * ".$row['count'];
            echo sprintf($s,
                $row['dateinserted'],
                $transtype,
                getQuickDetails("index_popup2.php?md=Affiliate_Merchants_Views_AffiliateManager&action=affalldetails&aid=".$row['userid']),
                $row['name'],
                getQuickDetails("index_popup2.php?md=Affiliate_Merchants_Views_TransactionManager&action=transdetails&tid=".$row['transid'], 300),
                empty($row['commission'])?0:$this->a_this->blSettings->showCurrency($row['commission']),
                empty($row['totalcost'])?0:$this->a_this->blSettings->showCurrency($row['totalcost']),
                empty($row['orderid'])?L_G_NONE:$row['orderid'],
                '<a href="javascript:ChangeState(\''.$row['transid'].'\',\'approve\');">'.L_G_APPROVE.'</a> | <a href="javascript:ChangeState(\''.$row['transid'].'\',\'suppress\');">'.L_G_REVERSED.'</a> | <a href="javascript:Delete(\''.$row['transid'].'\');">'.L_G_DELETE.'</a>'
            );
        }
    ?>
    <tr><td align="center" colspan="7"><?php QUnit_Templates::printPaging($this->a_list_page, $this->a_list_pages, $this->a_allcount); ?></td></tr>
    <?php } ?>
    </table>
    </td>
</tr>
</table>
</form>
