HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /www/exchange0old/exchange/admin/cache/%%B9^B9C^B9CF01D7%%creditors_statements.html.php
<?php /* Smarty version 2.6.19, created on 2024-06-17 09:07:04
         compiled from statements/creditors_statements.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'siteUrl', 'statements/creditors_statements.html', 95, false),array('modifier', 'number_format', 'statements/creditors_statements.html', 129, false),array('modifier', 'substr', 'statements/creditors_statements.html', 383, false),array('modifier', 'ucfirst', 'statements/creditors_statements.html', 383, false),array('function', 'substr', 'statements/creditors_statements.html', 382, false),array('function', 'getDebtorStatus', 'statements/creditors_statements.html', 387, false),)), $this); ?>
 <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<div id="body_portion">
  <div id="admin_menu">
     <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "left.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

    <div id="left_menu1" class="folded" style="display:none;"> <a href="javascript:void(0)" class="panel_open" onclick="showLeftPanel('left_menu','left_menu1','body_portion');"></a>
            <div class="center_menu"> <a href="#" class="user">&nbsp;</a> </div>

    </div>
    <div id="right_content">
      <table cellpadding="0" cellspacing="0" border="0" width="100%" class="margin_table">
        <tr>
          <td valign="top" align="left" width="2%" class="hdr_tl">&nbsp;</td>
          <td valign="top" align="left" width="96%" class="hdr_tc">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                    <td width="60%">
                        Statement Summary - <?php echo $this->_tpl_vars['organisation']['organisation_name']; ?>


                        <span style="font-weight:bold;padding-left:70px;">Originator ID : <a href="adminindex.php?do=traviewapplications&aid=<?php echo $this->_tpl_vars['organisation']['organisation_id']; ?>
"><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</a></span>          
                    </td>
                    <td width="40%" id="cell_with_tabs">
                        <div id="brief_tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
                            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
                                <li class="ui-state-default ui-corner-top" role="tab" tabindex="1" aria-labelledby="ui-id-3" aria-selected="false">
                                    <a href="#" class="ui-tabs-anchor" onclick="$('#originator-notes').dialog('open'); return false;">Notes</a>
                                </li>
                                <li class="ui-state-default ui-corner-top" role="tab" tabindex="1" aria-labelledby="ui-id-3" aria-selected="false">
                                    <a href="#" class="ui-tabs-anchor" onclick="$('#dialog').dialog('open');">Reports</a>
                                </li>
                                <li class="ui-state-default ui-corner-top <?php if ($this->_tpl_vars['type'] == 'debtor'): ?> ui-tabs-active ui-state-active <?php endif; ?> " role="tab" tabindex="0" aria-controls="debtors_stat" aria-labelledby="ui-id-1" aria-selected="true">
                                    <a href="adminindex.php?do=originatorstatements&user_id=<?php echo $this->_tpl_vars['organisation']['user_id']; ?>
&type=debtor" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">Debtors</a>
                                </li>
                                <li class="ui-state-default ui-corner-top <?php if ($this->_tpl_vars['type'] == 'creditor'): ?> ui-tabs-active ui-state-active <?php endif; ?>" role="tab" tabindex="-1" aria-controls="creditors_stat" aria-labelledby="ui-id-2" aria-selected="false">
                                    <a href="adminindex.php?do=originatorstatements&user_id=<?php echo $this->_tpl_vars['organisation']['user_id']; ?>
&type=creditor" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">Creditors</a>
                                </li>
                                <li class="ui-state-default ui-corner-top <?php if ($this->_tpl_vars['type'] == 'transactions'): ?> ui-tabs-active ui-state-active <?php endif; ?>" role="tab" tabindex="-1" aria-controls="transactions_stat" aria-labelledby="ui-id-2" aria-selected="false">
                                    <a href="adminindex.php?do=all_transactions&user_id=<?php echo $this->_tpl_vars['organisation']['user_id']; ?>
" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">All Transactions</a>
                                </li>
                            </ul>
                        </div>
                    </td>
                </tr>
            </table>
          </td>
          <td valign="top" align="left" width="2%" class="hdr_tr">&nbsp;</td>
        </tr>
            <?php if (count ( $this->_tpl_vars['success_org'] ) > 0): ?>            
              <div class="success-msgbox"><span>
                    <?php $_from = $this->_tpl_vars['success_org']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['err'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['err']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['err']):
        $this->_foreach['err']['iteration']++;
?>
                        <?php echo $this->_tpl_vars['success_org']; ?>
<br>
                    <?php endforeach; endif; unset($_from); ?></span>
              </div>
            <?php endif; ?>  
            <?php $_from = $this->_tpl_vars['data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['country_id'] => $this->_tpl_vars['creditors']):
?>
        <tr  class="grays_bg">
                    <td align="center" colspan="3"><b><?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
</b></td>
                </tr>
                <tr>
                    <td valign="top" align="left" colspan="3" class="hdr_center">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%" class="clsoverride">
                    <tr>
                        <td valign="top" align="center" class="inves_top1" colspan="4" width="50%">Overview</td>
                        <td valign="top" align="right" class="inves_top1" colspan="3" width="50%"><?php echo $this->_tpl_vars['creditors']['creditors']['0']['country_name']; ?>
 &nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="6"> <div style="display:none;" class="error-msgbox"></div></td>
                    </tr>
                    <tr class="row3">
                        <td valign="top" align="right" width="17%"><strong>Start Date :</strong></td>
                        <td valign="top" align="left" width="15%"><?php echo $this->_tpl_vars['rate']['3']['3']; ?>
</td>
                        <td valign="top" align="right" width="23%"><strong>Originator ID :</strong></td>
                        <td valign="top" align="left" width="16%"><?php echo $this->_tpl_vars['rate']['5']; ?>
</td>
                        <td valign="top" align="center" colspan="2" width="25%"><strong style="color:#666;">Period Overview</strong></td>
                        <td></td>
                    </tr>
                    <tr class="row3">
                        <td valign="bottom" align="right"><strong>Statement From :</strong></td>
                        <td valign="middle" align="left">
                            <?php if ($_GET['stmt_from']): ?>
                            <?php echo $_GET['stmt_from']; ?>
 <input type="hidden" name="stmt_from_date<?php echo $this->_tpl_vars['country_id']; ?>
" id="stmt_from_date<?php echo $this->_tpl_vars['country_id']; ?>
"  value="<?php echo $_GET['stmt_from']; ?>
">
                            <?php else: ?>
                            <?php echo $this->_tpl_vars['rate']['3']['3']; ?>
<input type="hidden" name="stmt_from_date<?php echo $this->_tpl_vars['country_id']; ?>
" id="stmt_from_date<?php echo $this->_tpl_vars['country_id']; ?>
"  value="<?php echo $this->_tpl_vars['rate']['3']['3']; ?>
">
                            <?php endif; ?>

                            <input type="hidden" name="statement_date" id="statement_date<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <input type="hidden" name="statement_month" id="statement_month<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <input type="hidden" name="statement_year" id="statement_year<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <script type="text/javascript">
                                // * For Date Picker
                                $(function(){
                                    $("#statement_year<?php echo $this->_tpl_vars['country_id']; ?>
").datepicker({
                                        minDate: null,
                                        showOn: "button",
                                        buttonImage: "<?php echo ((is_array($_tmp='/images/calender_month.png')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
",
                                        buttonImageOnly: true,
                                        onSelect: function( selectedDate ) {

                                            var i=0;selDate=selectedDate.split("/");
                                            var dates=new Array("statement_month<?php echo $this->_tpl_vars['country_id']; ?>
","statement_date<?php echo $this->_tpl_vars['country_id']; ?>
","statement_year<?php echo $this->_tpl_vars['country_id']; ?>
");
                                            var datasplited=selDate[2]+"-"+selDate[0]+"-"+selDate[1];
                                            var toDate=$("#stmt_to_date<?php echo $this->_tpl_vars['country_id']; ?>
").val();

                                            if(datasplited > toDate) {
                                                $(".error-msgbox<?php echo $this->_tpl_vars['country_id']; ?>
").css("display","block").html("Statement from date is greater than statement to date.");
                                            }else{
                                                var url=document.URL;
                                                var url_split=url.split("&");
                                                var id=url_split[1];

                                                if(id!=""){
                                                    window.location.href="adminindex.php?do=originatorstatements&stmt_from="+datasplited+"&stmt_to="+toDate+"&user_id=<?php echo $this->_tpl_vars['originator_id']; ?>
&type=creditor";
                                                }else{
                                                    window.location.href="adminindex.php?do=originatorstatements&stmt_from="+datasplited+"&stmt_to="+toDate+"&user_id=<?php echo $this->_tpl_vars['originator_id']; ?>
&type=creditor";
                                                }
                                            }

                                            for(i = 0; i <=2; i++){
                                                $( "#"+dates[i] ).val(selDate[i]);
                                            }
                                        }
                                    });
                                });
                            </script>
                        </td>
                        <td valign="top" align="right"><strong>Monthly Average Purchase Price (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
):</strong></td>
                        <td valign="top" align="left" width="">
                            <span id="avgPurchase<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['avgValues'][$this->_tpl_vars['country_id']]['AvgPurchase'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 1) : smarty_modifier_number_format($_tmp, 1)); ?>

                            </span>
                        </td>
                        <td valign="top" align="right">
                            <strong>Total ETR Face Value (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
):</strong>
                        </td>
                        <td valign="top" align="right" width="">
                            <span id="traded<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tradedTPurchase'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                            </span>
                        </td>
                    </tr>
                    <tr class="row3">
                        <td valign="bottom" align="right"><strong>Statement To :</strong></td>
                        <td valign="middle" align="left">
                            <?php if ($_GET['stmt_to']): ?>
                            <?php echo $_GET['stmt_to']; ?>
<input type="hidden" name="stmt_to_date<?php echo $this->_tpl_vars['country_id']; ?>
" id="stmt_to_date<?php echo $this->_tpl_vars['country_id']; ?>
"  value="<?php echo $_GET['stmt_to']; ?>
">
                            <?php else: ?>
                            <?php echo $this->_tpl_vars['rate']['3']['2']; ?>
<input type="hidden" name="stmt_to_date<?php echo $this->_tpl_vars['country_id']; ?>
" id="stmt_to_date<?php echo $this->_tpl_vars['country_id']; ?>
" value="<?php echo $this->_tpl_vars['rate']['3']['2']; ?>
">
                            <?php endif; ?>
                            <input type="hidden" name="statement_date_to" id="statement_date_to<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <input type="hidden" name="statement_month_to" id="statement_month_to<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <input type="hidden" name="statement_year_to" id="statement_year_to<?php echo $this->_tpl_vars['country_id']; ?>
" value="" />
                            <script type="text/javascript">
                                // * For Date Picker
                                $(function() {
                                    $( "#statement_year_to<?php echo $this->_tpl_vars['country_id']; ?>
" ).datepicker({
                                        minDate: null,
                                        showOn: "button",
                                        buttonImage: "<?php echo ((is_array($_tmp='/images/calender_month.png')) ? $this->_run_mod_handler('siteUrl', true, $_tmp) : smarty_modifier_siteUrl($_tmp)); ?>
",
                                        buttonImageOnly: true,
                                        onSelect: function( selectedDate ) {

                                            var i=0;selDate=selectedDate.split("/");
                                            var dates=new Array("statement_month_to<?php echo $this->_tpl_vars['country_id']; ?>
","statement_date_to<?php echo $this->_tpl_vars['country_id']; ?>
","statement_year_to<?php echo $this->_tpl_vars['country_id']; ?>
");
                                            var datasplited=selDate[2]+"-"+selDate[0]+"-"+selDate[1];
                                            var fromDate=$("#stmt_from_date<?php echo $this->_tpl_vars['country_id']; ?>
").val();

                                            if(datasplited < fromDate) {
                                                $(".error-msgbox<?php echo $this->_tpl_vars['country_id']; ?>
").css("display","block").html("Statement to date is less than statement from date.");
                                            } else{
                                                var url=document.URL;
                                                var url_split=url.split("&");
                                                var id=url_split[1];

                                                if(id!=""){
                                                    window.location.href="adminindex.php?do=originatorstatements&stmt_from="+fromDate+"&stmt_to="+datasplited+"&user_id=<?php echo $this->_tpl_vars['originator_id']; ?>
&type=creditor";
                                                }else{
                                                    window.location.href="adminindex.php?do=originatorstatements&stmt_from="+fromDate+"&stmt_to="+datasplited+"&user_id=<?php echo $this->_tpl_vars['originator_id']; ?>
&type=creditor";
                                                }
                                            }

                                            for(i = 0; i <=2; i++){
                                                $( "#"+dates[i] ).val(selDate[i]);
                                            }
                                        }
                                    });
                                });
                            </script>

                        </td>
                <td colspan="2"></td>
                <td valign="top" align="right"><strong>Total Purchase Price (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
):</strong></td>
                <td valign="top" align="right" width="">
                    <span id="total<?php echo $this->_tpl_vars['country_id']; ?>
">
                        <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tradedTotal'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                    </span>
                </td>
            </tr>
            <tr class="row3">
                <td valign="bottom" align="right"><strong>Last Traded Date :</strong></td>
                <td valign="middle" align="left">
                    <?php if ($this->_tpl_vars['last_dates'][$this->_tpl_vars['originator_id']][$this->_tpl_vars['type']][$this->_tpl_vars['country_id']]['last_traded_date']): ?>
                    <?php echo $this->_tpl_vars['last_dates'][$this->_tpl_vars['originator_id']][$this->_tpl_vars['type']][$this->_tpl_vars['country_id']]['last_traded_date']; ?>

                    <?php else: ?>
                    -
                    <?php endif; ?>
                </td>
                <td valign="top" align="right"></td>
                <td valign="top" align="left"></td>
                <td valign="top" align="right"></td>
                <td valign="top" align="right"></td>
            </tr>
            <tr class="row3">
                <td valign="bottom" align="right"><strong>Last Payment Date :</strong></td>
                <td valign="middle" align="left">
                    <?php if ($this->_tpl_vars['last_dates'][$this->_tpl_vars['originator_id']][$this->_tpl_vars['type']][$this->_tpl_vars['country_id']]['last_payment_date']): ?>
                    <?php echo $this->_tpl_vars['last_dates'][$this->_tpl_vars['originator_id']][$this->_tpl_vars['type']][$this->_tpl_vars['country_id']]['last_payment_date']; ?>

                    <?php else: ?>
                    -
                    <?php endif; ?>
                </td>
                <td valign="top" align="right"></td>
                <td valign="top" align="left"></td>
                <td valign="top" align="right"></td>
                <td valign="top" align="right"></td>
            </tr>
            <tr class="row3">
                <td colspan="6"></td>
            </tr>
            </table>
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr>
                <td valign="top" align="center" class="inves_top1" width="29%">Counterparty Details</td>
                <td valign="top" align="center" class="inves_top1" width="31%">Transaction Overview</td>
                <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                <td valign="top" align="center" class="inves_top1" width="9%">Commission</td>
                <?php endif; ?>
            </tr>
            </table>
            <style>
            .hdr_center td b{font-size:11px !important;}
            </style>
            <table cellpadding="0" cellspacing="0" border="0" width="100%" id="listDebtor" class="table table-hover table-striped table-responsive">
                <tr class="grays_bg4">
                    <td valign="top" align="left" width="" >ID</td>
                    <td valign="top" align="left" width="">Name</td>
                    <td valign="top" align="center" width="">Type</td>
                    <td valign="top" align="right" width="10%">Face Value (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="right" width="10%">Receipts (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="center" width="7%">Paid (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="left" width="7%">Status</td>
                    <td valign="top" align="right" width="8%">Traded (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="right" width="11%">Overdue Now (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="right" width="8%">Total (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)</td>
                    <td valign="top" align="center" width="">
                        <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                        ADSO (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)
                        <?php endif; ?>
                    </td>
                    <td valign="top" align="center" width="">
                        <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                        Settled (<?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
)
                        <?php endif; ?>
                    </td>
                    </tr>
                    <tbody>
                    <?php if ($this->_tpl_vars['old_balance']): ?>
                    <tr>
                        <td align="right" colspan="3">Closing Balance as at <?php echo $this->_tpl_vars['before_from_date']; ?>
 :</td>
                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['tradedTotal'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['totalReceipts'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['tot_paid'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td></td>
                        <td></td>
                        <td valign="top" align="right" style="color:#FF0000; font-weight: bold; text-align: right;"><?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['totOverdueNow'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['tot_outstanding'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td valign="top" align="right">
                            <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['revenue_commission_total'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                            <?php endif; ?>
                        </td>
                        <td valign="top" align="right">
                            <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['old_balance'][$this->_tpl_vars['country_id']]['stat']['total_settled_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                            <?php endif; ?>
                        </td>
                    </tr>
                    <?php if ($this->_tpl_vars['delayed_commissions']['summary'][$this->_tpl_vars['country_id']] || $this->_tpl_vars['delayed_balance']['summary'][$this->_tpl_vars['country_id']]): ?>
                    <tr>
                        <td align="right" colspan="3">
                            <!--<i class="glyphicon glyphicon-th-list" style="cursor: pointer" onclick="showDelayedReserves(<?php echo $this->_tpl_vars['country_id']; ?>
);return false;"></i>-->
                            Period Sell Rate - ADSO :
                            <div class="delayed_reserves" style="display:none;" id="delayed_reserves_<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
                                    <tr class="grays_bg4">
                                        <td>Debtor ID</td>
                                        <td>Debtor Name</td>
                                        <td>Trade ID</td>
                                        <td>Invoice Ref.</td>
                                        <td>Ccy</td>
                                        <td>Face Value</td>
                                        <td>Traded Date</td>
                                        <td>Commission</td>
                                    </tr>
                                    <?php $_from = $this->_tpl_vars['delayed_commissions']['items'][$this->_tpl_vars['country_id']]; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['invoice']):
?>
                                    <tr>
                                        <td><?php echo $this->_tpl_vars['invoice']['debtor_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['debtor_name']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['trade_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['invoice_no']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['face_value'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                        <td align="right"><?php echo $this->_tpl_vars['invoice']['logapprove_date']; ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['com'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                    </tr>
                                    <?php endforeach; endif; unset($_from); ?>
                                    <tr>
                                        <td colspan="7" align="right"><b>Processing Commission :</b></td>
                                        <td align="right"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['delayed_commissions']['processing'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></td>
                                    </tr>
                                    <tr>
                                        <td colspan="7" align="right"><b>Total Commission :</b></td>
                                        <td align="right"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['delayed_commissions']['summary'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td align="right">
                            <i class="glyphicon glyphicon-th-list" style="cursor: pointer" onclick="showDelayedBalance(<?php echo $this->_tpl_vars['country_id']; ?>
);return false;"></i>
                            <div class="delayed_balance" style="display:none;" id="delayed_balance_<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
                                    <tr class="grays_bg4">
                                        <td nowrap>Debtor ID</td>
                                        <td nowrap>Debtor Name</td>
                                        <td nowrap>Trade ID</td>
                                        <td nowrap>Invoice Ref.</td>
                                        <td nowrap>Ccy</td>
                                        <td nowrap>Face Value</td>
                                        <td nowrap>Balance on <?php echo $_GET['stmt_from']; ?>
</td>
                                        <td nowrap>Balance on <?php echo $_GET['stmt_to']; ?>
</td>
                                        <td nowrap>Balance Increase</td>
                                    </tr>
                                    <?php $_from = $this->_tpl_vars['delayed_balance']['data'][$this->_tpl_vars['country_id']]; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['invoice']):
?>
                                    <tr>
                                        <td><?php echo $this->_tpl_vars['invoice']['debtor_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['debtor_name']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['trade_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['invoice']['item_reference']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['face_value'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['from_date_balance'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['to_date_balance'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['invoice']['balance_diff'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                    </tr>
                                    <?php endforeach; endif; unset($_from); ?>
                                    <tr>
                                        <td colspan="8" align="right"><b>Total :</b></td>
                                        <td align="right"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['delayed_balance']['summary'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></td>
                                    </tr>
                                </table>
                            </div>
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['delayed_balance']['summary'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                        </td>
                        <td></td>
                        <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                        <td align="right"><i class="glyphicon glyphicon-th-list" style="cursor: pointer" onclick="showDelayedReserves(<?php echo $this->_tpl_vars['country_id']; ?>
);return false;"></i>
                        <?php echo ((is_array($_tmp=$this->_tpl_vars['delayed_commissions']['summary'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <?php endif; ?>
                    </tr>
                    <?php endif; ?>
                    <?php endif; ?>
                    <?php $_from = $this->_tpl_vars['creditors']['creditors']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['creditor']):
?>
                        <tr>
                            <td valign="top" align="left">
                                <a class="btn-link" href="adminindex.php?do=trastatusmgnt&id=<?php echo $this->_tpl_vars['creditor']['debtor_id']; ?>
&user_id=<?php echo $this->_tpl_vars['originator_id']; ?>
&type=creditor"><?php echo $this->_tpl_vars['creditor']['debtor_reference_id']; ?>
</a>
                            </td>
                            <td valign="top" align="left"><?php echo smarty_function_substr(array('string' => $this->_tpl_vars['creditor']['debtor_name'],'lenght' => 45), $this);?>
</td>
                            <td valign="top" align="center"><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['creditor']['type'])) ? $this->_run_mod_handler('substr', true, $_tmp, 0, 1) : substr($_tmp, 0, 1)))) ? $this->_run_mod_handler('ucfirst', true, $_tmp) : ucfirst($_tmp)); ?>
</td>
                            <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['traded'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                            <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['total_receipts'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                            <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['paid'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                            <td valign="top" align="left"><?php echo smarty_function_getDebtorStatus(array('data' => $this->_tpl_vars['creditor']), $this);?>
</td>
                            <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['outstanding_traded'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                            <td valign="top" align="right">
                                <?php if ($this->_tpl_vars['creditor']['overdue_now'] > 0): ?>
                                <strong style="color:#FF0000;"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['overdue_now'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</strong>
                                <?php else: ?>
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['overdue_now'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                                <?php endif; ?>
                            </td>
                            <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['balance'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                            <td valign="top" align="right">
                                <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['revenue_commission_total'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                                <?php endif; ?>
                            </td>
                            <td valign="top" align="right">
                                <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditor']['total_settled_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                                <?php endif; ?>
                            </td>
                        </tr>
                    <?php endforeach; endif; unset($_from); ?>
                    
                    <?php if ($this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]): ?>
                     <?php $this->assign('tot_outstanding', $this->_tpl_vars['creditors']['stat']['tot_outstanding']-$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]); ?>
                     <?php $this->assign('tot_receipts', $this->_tpl_vars['creditors']['stat']['totalReceipts']+$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]); ?>
                     <?php $this->assign('tot_overdue', $this->_tpl_vars['creditors']['stat']['totOverdueNow']-$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]); ?>
                     <tr>
                        <td valign="top" align="left">
                            <a class="btn-link" style="cursor: pointer;" onclick="showOcpaList(<?php echo $this->_tpl_vars['country_id']; ?>
);"><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</a>
                        </td>
                        <td valign="top" align="left" colspan="3">Payments on Account</td>
                        <td valign="top" align="right" style="padding-right:25px;">
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                        </td>
                        <td valign="top" align="right"></td>
                        <td valign="top" align="right"></td>
                        <td valign="top" align="right"></td>
                        <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]*-1)) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['OPA'][$this->_tpl_vars['country_id']]*-1)) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td valign="top" align="right"></td>
                        <td valign="top" align="right"></td>
                    </tr>
                    <?php else: ?> 
                    <?php $this->assign('tot_outstanding', $this->_tpl_vars['creditors']['stat']['tot_outstanding']); ?>
                    <?php $this->assign('tot_receipts', $this->_tpl_vars['creditors']['stat']['totalReceipts']); ?>
                    <?php $this->assign('tot_overdue', $this->_tpl_vars['creditors']['stat']['totOverdueNow']); ?>
                    <?php endif; ?>
                    <?php if (isset ( $this->_tpl_vars['isFees'][$this->_tpl_vars['country_id']]['count'] ) && $this->_tpl_vars['isFees'][$this->_tpl_vars['country_id']]['count'] > 0): ?>
                    <?php $this->assign('tot_outstanding', $this->_tpl_vars['tot_outstanding']+$this->_tpl_vars['isFees'][$this->_tpl_vars['country_id']]['amount']); ?>
                    <tr>
                        <td valign="top" align="left">
                            <a class="btn-link" style="cursor: pointer;" onclick="showFeesList(<?php echo $this->_tpl_vars['country_id']; ?>
);"><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</a>
                        </td>
                        <td valign="top" align="left" colspan="8">Fees and Charges</td>
                        <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['isFees'][$this->_tpl_vars['country_id']]['amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                        <td valign="top" align="right"></td>
                        <td valign="top" align="right"></td>
                    </tr>
                    <?php endif; ?>
                    <?php if ($this->_tpl_vars['processing_commissions'][$this->_tpl_vars['country_id']] && ( $_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin' )): ?>
                    <tr>
                        <td valign="top" align="left">
                            <a class="btn-link" style="cursor: pointer;" onclick="showCommissions(<?php echo $this->_tpl_vars['country_id']; ?>
);return false;"><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</a>
                        </td>
                        <td valign="top" align="left" colspan="9">Processing Commissions</td>
                        <td valign="top" align="right">
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tot_processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                            <?php if ($this->_tpl_vars['processing_commissions'][$this->_tpl_vars['country_id']]): ?>
                            <div class="commissions" style="display: none;" id="commissions_<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
                                    <tr class="grays_bg4">
                                        <td>Receipt</td>
                                        <td>Originator ID</td>
                                        <td>Originator Name</td>
                                        <td><?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
</td>
                                    </tr>
                                    <?php $_from = $this->_tpl_vars['processing_commissions'][$this->_tpl_vars['country_id']]; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['com']):
?>
                                    <tr>
                                        <td><?php echo $this->_tpl_vars['com']['logapprove_date']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['organisation']['organisation_name']; ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['com']['c_etr_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                    </tr>
                                    <?php endforeach; endif; unset($_from); ?>
                                    <tr>
                                        <td colspan="3" align="right"><b>Total :</b></td>
                                        <td align="right"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tot_processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></td>
                                    </tr>
                                </table>
                            </div>
                            <?php endif; ?>
                        </td>
                        <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                    </tr>
                    <?php endif; ?>
                    <?php if ($this->_tpl_vars['rp_processing_commissions'][$this->_tpl_vars['country_id']]['tot_commissions'] > 0 && ( $_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin' )): ?>
                    <tr>
                        <td valign="top" align="left">
                            <a class="btn-link" style="cursor: pointer;" onclick="showRpCommissions(<?php echo $this->_tpl_vars['country_id']; ?>
);return false;"><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</a>
                        </td>
                        <td valign="top" align="left" colspan="9">Processing Commissions (Returned Payments)</td>
                        <td valign="top" align="right">
                            <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['rp_tot_processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                            <?php if ($this->_tpl_vars['rp_processing_commissions'][$this->_tpl_vars['country_id']]): ?>
                            <div class="rpcommissions" style="display: none;" id="rp_commissions_<?php echo $this->_tpl_vars['country_id']; ?>
">
                                <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
                                    <tr class="grays_bg4">
                                        <td>Receipt</td>
                                        <td>Originator ID</td>
                                        <td>Originator Name</td>
                                        <td><?php echo $this->_tpl_vars['creditors']['currency']['currency_code']; ?>
</td>
                                    </tr>
                                    <?php $_from = $this->_tpl_vars['rp_processing_commissions'][$this->_tpl_vars['country_id']]['rp_commissions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['com']):
?>
                                    <tr>
                                        <td><?php echo $this->_tpl_vars['com']['posted_date']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['organisation']['organisation_reference_id']; ?>
</td>
                                        <td><?php echo $this->_tpl_vars['organisation']['organisation_name']; ?>
</td>
                                        <td align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['com']['retpay_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                                    </tr>
                                    <?php endforeach; endif; unset($_from); ?>
                                    <tr>
                                        <td colspan="3" align="right"><b>Total :</b></td>
                                        <td align="right"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['rp_tot_processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></td>
                                    </tr>
                                </table>
                            </div>
                            <?php endif; ?>
                        </td>
                        <td valign="top" align="right"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['rp_tot_processing_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                    </tr>
                    <?php endif; ?>
                    </tbody>
                    <tfoot>
                        <tr>
                            <th valign="top" align="left" colspan="2"><strong>Balances</strong></th>
                            <th valign="top" align="left">&nbsp;</th>
                            <th valign="top" align="right" style="text-align: right;"><?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tradedTotal'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</th>
                            <th valign="top" align="right" style="text-align: right;"><?php echo ((is_array($_tmp=$this->_tpl_vars['tot_receipts'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</th>
                            <th valign="top" align="right" style="text-align: right;"> <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['tot_paid'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</th>
                            <th valign="top" align="left">&nbsp;</th>
                            <th valign="top" align="left">&nbsp;</th>
                            <th valign="top" align="right" style="text-align: right"><strong style="color:#FF0000;"><?php echo ((is_array($_tmp=$this->_tpl_vars['tot_overdue'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</strong></th>
                            <th valign="top" align="right" style="text-align: right;"><?php echo ((is_array($_tmp=$this->_tpl_vars['tot_outstanding'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</th>
                            <th valign="top" align="right" style="text-align: right">
                                <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['revenue_commission_total'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                                <?php endif; ?>
                            </th>
                            <th valign="top" align="right" style="text-align: right">
                                <?php if ($_SESSION['admin_type'] == 'Board' || $_SESSION['admin_type'] == 'Admin'): ?>
                                <?php echo ((is_array($_tmp=$this->_tpl_vars['creditors']['stat']['total_settled_commission'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>

                                <?php endif; ?>
                            </th>
                        </tr>
                        <tr class="excel-remove">
                            <td colspan="8">
                                <form method="post" action="?do=downloadreport" onsubmit="downloadTable(this);" style="display: inline-block">
                                    <input type="hidden" name="html">
                                    <input type="hidden" name="country_id" value="<?php echo $this->_tpl_vars['country_id']; ?>
">
                                    <input type="hidden" name="user_id" value="<?php echo $this->_tpl_vars['organisation']['user_id']; ?>
">
                                    <input type="hidden" name="report_type" value="28">
                                    <input type="hidden" name="currency_id" value="<?php echo $this->_tpl_vars['country_id']; ?>
">
                                    <input type="hidden" name="stmt_from" value="">
                                    <input type="hidden" name="stmt_to" value="">
                                    <button type="submit"><span class="glyphicon glyphicon-download" aria-hidden="true"></span>&nbsp;Download XLS</button>
                                </form>
                                <form method="post" action="?do=download-pdf&type=creditor" onsubmit="downloadPdf(this);" style="display: inline-block">
                                    <input type="hidden" name="user_id" value="<?php echo $this->_tpl_vars['organisation']['user_id']; ?>
">
                                    <input type="hidden" name="currency_id" value="<?php echo $this->_tpl_vars['country_id']; ?>
">
                                    <input type="hidden" name="stmt_from" value="">
                                    <input type="hidden" name="stmt_to" value="">
                                    <button type="submit"><span class="glyphicon glyphicon-download" aria-hidden="true"></span>&nbsp;Download PDF</button>
                                </form>
                            </td>
                            <td align="right">
                                <button onclick="$('#dialog_two').dialog('open'); get_overdue_report(<?php echo $this->_tpl_vars['country_id']; ?>
); return false;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;View</button>
                            </td>
                            <td colspan="3"></td>
                        </tr>

                    </tfoot>
                </table>
            </td>
          </tr>
          <?php endforeach; endif; unset($_from); ?>
        <tr>
          <td valign="top" align="left" width="2%" class="hdr_bl">&nbsp;</td>
          <td valign="top" align="left" width="96%" class="hdr_bc">&nbsp;</td>
          <td valign="top" align="left" width="2%" class="hdr_br">&nbsp;</td>
        </tr>
      </table>
    </div>
    <div class="clear"></div>
  </div>
</div>
 <div id="ocpa_dialog">
     <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
         <tr class="grays_bg4">
             <td>Id</td>
             <td>Date</td>
             <td>Ccy</td>
             <td>Amount</td>
             <td>Notes</td>
             <td>Type</td>
         </tr>

         <tbody>
         <?php if (isset ( $this->_tpl_vars['ocpa_list']['ocpa'] )): ?>
                <?php $_from = $this->_tpl_vars['ocpa_list']['ocpa']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['trans']):
?>
                     <?php if (! $_GET['stmt_from'] || ( $_GET['stmt_from'] <= $this->_tpl_vars['trans']['transaction_date'] && $this->_tpl_vars['trans']['transaction_date'] <= $_GET['stmt_to'] )): ?>
                     <tr class="ocpa_currency ocpa_currency_<?php echo $this->_tpl_vars['trans']['currency_id']; ?>
">
                         <td><?php echo $this->_tpl_vars['trans']['manual_transaction_id']; ?>
</td>
                         <td><nobr><?php echo $this->_tpl_vars['trans']['transaction_date']; ?>
</nobr></td>
                         <td><?php echo $this->_tpl_vars['trans']['currency_code']; ?>
</td>
                         <td style="text-align: right"><?php echo ((is_array($_tmp=$this->_tpl_vars['trans']['amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                         <td><?php echo $this->_tpl_vars['trans']['notes']; ?>
</td>
                         <td>
                             <?php if ($this->_tpl_vars['trans']['transaction_type'] == @OCPA_RETURN): ?>
                             Return
                             <?php elseif ($this->_tpl_vars['trans']['transaction_type'] == @ORIGINATOR_DEPOSIT): ?>
                             Deposit
                             <?php else: ?>
                             On Account
                             <?php endif; ?>
                         </td>
                     </tr>
                     <?php endif; ?>
                 <?php endforeach; endif; unset($_from); ?>
         <?php endif; ?>
         </tbody>
     </table>
 </div>
 <div id="fees_dialog">
     <table class="table table-hover table-striped table-responsive" width="100%" cellspacing="0" cellpadding="0" border="0">
         <tr class="grays_bg4">
             <td>Id</td>
             <td>Date</td>
             <td>Ccy</td>
             <td>Amount</td>
             <td>Notes</td>
             <td>Type</td>
         </tr>

         <tbody>
         <?php if (isset ( $this->_tpl_vars['ocpa_list']['fees'] )): ?>

         <?php $this->assign('fees_balance_1', 0); ?>
         <?php $this->assign('fees_balance_2', 0); ?>
         <?php $this->assign('fees_balance_3', 0); ?>

         <?php $_from = $this->_tpl_vars['ocpa_list']['fees']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['trans']):
?>
             <?php if (! $_GET['stmt_from'] || ( $_GET['stmt_from'] <= $this->_tpl_vars['trans']['transaction_date'] && $this->_tpl_vars['trans']['transaction_date'] <= $_GET['stmt_to'] )): ?>
             <tr class="fees_currency fees_currency_<?php echo $this->_tpl_vars['trans']['currency_id']; ?>
">
                 <td><?php echo $this->_tpl_vars['trans']['manual_transaction_id']; ?>
</td>
                 <td><nobr><?php echo $this->_tpl_vars['trans']['transaction_date']; ?>
</nobr></td>
                 <td><?php echo $this->_tpl_vars['trans']['currency_code']; ?>
</td>
                 <td style="text-align: right"><?php echo ((is_array($_tmp=$this->_tpl_vars['trans']['amount'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</td>
                 <td>
                     <?php echo $this->_tpl_vars['trans']['notes']; ?>


                     <?php if ($this->_tpl_vars['trans']['currency_id'] == 1): ?>
                        <?php $this->assign('fees_balance_1', $this->_tpl_vars['fees_balance_1']+$this->_tpl_vars['trans']['amount']); ?>
                     <?php endif; ?>

                     <?php if ($this->_tpl_vars['trans']['currency_id'] == 2): ?>
                        <?php $this->assign('fees_balance_2', $this->_tpl_vars['fees_balance_2']+$this->_tpl_vars['trans']['amount']); ?>
                     <?php endif; ?>

                     <?php if ($this->_tpl_vars['trans']['currency_id'] == 3): ?>
                        <?php $this->assign('fees_balance_3', $this->_tpl_vars['fees_balance_3']+$this->_tpl_vars['trans']['amount']); ?>
                     <?php endif; ?>
                 </td>
                 <td>
                     <?php if ($this->_tpl_vars['trans']['transaction_type'] == @CREDITOR_FEES_CHARGES): ?>
                     Fees & Charges
                     <?php endif; ?>

                     <?php if ($this->_tpl_vars['trans']['transaction_type'] == @ORIGINATOR_PAYMENT_ON_ACCOUNT): ?>
                     On Account
                     <?php endif; ?>

                     <?php if ($this->_tpl_vars['trans']['transaction_type'] == @OCPA_RETURN): ?>
                     Return
                     <?php endif; ?>
                 </td>
             </tr>
             <?php endif; ?>
         <?php endforeach; endif; unset($_from); ?>

         </tbody>

         <tr class="grays_bg4">
             <td></td>
             <td></td>
             <td></td>
             <td align="right" style="text-align: right">
                 <span class="fees_currency fees_currency_1"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['fees_balance_1'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></span>
                 <span class="fees_currency fees_currency_2"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['fees_balance_2'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></span>
                 <span class="fees_currency fees_currency_3"><b><?php echo ((is_array($_tmp=$this->_tpl_vars['fees_balance_3'])) ? $this->_run_mod_handler('number_format', true, $_tmp, 2) : smarty_modifier_number_format($_tmp, 2)); ?>
</b></span>
             </td>
             <td></td>
             <td></td>
         </tr>
         <?php endif; ?>

     </table>
 </div>
<style>
    #ocpa_dialog, #fees_dialog, .commissions
    {
        display: none;
    }

#cell_with_tabs .ui-widget-content,#cell_with_tabs .ui-widget-header{background: none !important;border: none !important;}
#listDebtor td{
  padding:5px;
  font-size:11px;
}
#listDebtor td b{
 font-size:11px;
}
.clsoverride .row1 td{
  padding:5px 3px !important; 
  line-height: 15px !important; 
  
}
.clsoverride .row1 td img{
vertical-align: bottom;
}
* {
    color: #000000;
    font-family: Verdana,Geneva,sans-serif;
    font-size: 11px;
    margin: 0;
}

.inves_top1{ background:#848284;height:35px;color:#fff;line-height:32px; padding-left:10px;font-weight:bold;}
.inves_top3{ background:#e4e3e3;height:15px;line-height:32px; padding-left:10px;font-weight:bold;}
.inves_top1 span{ background:#848284;height:35px;color:#fff;line-height:32px; padding-left:10px;font-weight:bold;cursor:pointer;}
.inves_top1 span:hover{ background:#848284;height:35px;color:#fff;line-height:32px; padding-left:10px;font-weight:bold;text-decoration:underline;}


.row3 td {
    background: none repeat scroll 0 0 #FFFFFF;
    font-size: 11px;
    line-height: 18px;
    padding: 5px 10px;
    border-bottom: none;
}

.grays_bg4 td{background:#c0c0c0; padding:10px 0px; font-size:11px; line-height:16px; border-top:2px solid #fff; font-weight: bolder;}

</style>

<script type="text/javascript">

    $(function () {
        $("#ocpa_dialog").dialog({
            autoOpen: false,
            width: 900,
            height: 600,
            modal: true,
            title: 'Creditor Payments on Account',
            open: function () {

            }
        });
        $("#fees_dialog").dialog({
            autoOpen: false,
            width: 900,
            height: 600,
            modal: true,
            title: 'Fees and Charges',
            open: function () {

            }
        });

        $(".commissions").dialog({
            autoOpen: false,
            width: 900,
            height: 600,
            modal: true,
            title: 'Processing Commissions',
            open: function () {

            }
        });
        $(".rpcommissions").dialog({
            autoOpen: false,
            width: 900,
            height: 600,
            modal: true,
            title: 'Processing Commissions (Returned Payments)',
            open: function () {

            }
        });

        $(".delayed_reserves").dialog({
            autoOpen: false,
            width: 900,
            height: 600,
            modal: true,
            title: 'Commissions',
            open: function () {

            }
        });

        $(".delayed_balance").dialog({
            autoOpen: false,
            width: 1100,
            height: 600,
            modal: true,
            title: 'Balance Increase',
            open: function () {

            }
        });
    });

    function changeDeb(id)
    {

      window.location = 'adminindex.php?do=originatorstatements&cid='+id;
    }

    function showOcpaList(currency_id) {
        $(".ocpa_currency").hide();
        $('#ocpa_dialog').dialog('open');
        $(".ocpa_currency_"+currency_id).show();
        return false;
    }

    function showFeesList(currency_id) {
        $(".fees_currency").hide();
        $('#fees_dialog').dialog('open');
        $(".fees_currency_"+currency_id).show();
        return false;
    }

    function showCommissions(currency) {
        var id = '#commissions_' + currency;
        $(id).dialog('open');
    }
    
    function showRpCommissions(currency) {
        var id = '#rp_commissions_' + currency;
        $(id).dialog('open');
    }

    function showDelayedReserves(ccy) {
        $('#delayed_reserves_' + ccy).dialog('open');
    }

    function showDelayedBalance(ccy) {
        $('#delayed_balance_' + ccy).dialog('open');
    }

    function downloadPdf(obj) {
        var curId = $(obj).find('[name="currency_id"]').val();
        $(obj).find('[name="stmt_from"]').val($('#stmt_from_date' + curId).val());
        $(obj).find('[name="stmt_to"]').val($('#stmt_to_date' + curId).val());
    }

    function downloadTable(obj){
        downloadPdf(obj);
    }
</script>
<style>
    .ui-tabs-nav li{float:right !important}

    #report_date_table tr td{padding-right: 50px; padding-bottom: 30px;  line-height: 20px; vertical-align: middle}

    #report_date_table .form_date{padding-top: 10px}

    #report_table{margin-top: 20px;}

    .download_report, .delayed_reserves{display: none}

    .wait {
        background: url("images/wait.gif");
        height: 200px;
        width: 200px;
        background-position: 50%;
        position: absolute;
        left: 40%;
        top: 30%;
        display: none;
    }

    .ui-dialog .ui-dialog-titlebar-close {
        background-image: url("../css/ui-lightness/images/ui-icons_ef8c08_256x240.png");
        background-position: -97px -129px;
    }
</style>
 <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "reports/originator_creditors_reports.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
 <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "reports/creditors_overdue_reports.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
 <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "originator_notes.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
 <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "footer.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>