<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>assets/custom/css/print_new.css">
    <head><title>Payment Afiliasi</title></head>

    <body style="width:auto; margin:auto">
        <div class="easyui-layout" data-options="fit:true,border:false">
            <!-- Top view-->
            <div id="form-header" data-options="region:'north',border:false">
                <div id="form-header-wrapper">
                    <table cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td  valign="middle">
                                <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()">Print</a>
                                <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-excel'" onClick="modal_open('Import New Account', 'dlg_importfile');" >Export File</a>
                            </td>
                        </tr>
                    </table>  
                </div>      
            </div>

            <div id="limit-container">

            </div>
            <br><br>

            <div id="list-print-container">

                <table class="list-header">
                    <tr>
                        <td colspan="10" class="company-name text-center "><span class="normal_bold span_block " ><?= $company->CompanyName; ?></span></td>
                    </tr>
                    <tr>
                        <td colspan="10" class="branch-name text-center"><span class="normal_bold span_block " ><?= $company->BranchName; ?></span></td>
                    </tr>
                    <tr>
                        <td colspan="10" class="list-title text-center"><span class="normal_bold span_block " >List Payment Afiliasi</span></td>
                    </tr>
                    <tr>
                        <td colspan="10" class="s1">&nbsp;</td>
                    </tr>
                    <tr class="list-header-top">
                        <td width="30" class="">No</td>
                        <td width="" class="">Branch</td>
                        <td width="" class="">Date</td>
                        <td width="" class="">Payment No.</td>
                        <td width="" class="">Piutang No.</td>
                        <td width="" class="">Transfer From</td>
                        <td width="" class="">Bank From</td>
                        <td width="" class="">Transfer To</td>
                        <td width="" class="">Bank To</td>
                        <td width="" class="text-right">Amount</td>
                    </tr>
                    <?php
                    $no = 0;
                    $total = 0;
                    foreach ($list as $row):
                        ?>
                        <tr class="list-header-middle row-preview-list" ondblclick="clickRows('<?php echo $row->AInsNumber; ?>')">
                            <td class="" valign="top"><?php echo ++$no; ?></td>
                            <td class="" valign="top"><?php echo $row->BranchName; ?></td>
                            <td class="" valign="top"><?php echo convert_to_dmy($row->AInsDate); ?></td>
                            <td class="" valign="top"><?php echo $row->AInsNumber; ?></td>
                            <td class="" valign="top"><?php echo $row->ADebtNumber; ?></td>
                            <td class="" valign="top"><?php echo $row->CompTransName; ?></td>
                            <td class="" valign="top"><?php echo $row->BankFrom; ?></td>
                            <td class="" valign="top"><?php echo $row->CompRecptName; ?></td>
                            <td class="" valign="top"><?php echo $row->BankTo; ?></td>
                            <td class="" align="right" valign="top"><?php echo number_format($row->APayAmount, "0", ",", "."); ?><?php $total += $row->APayAmount; ?></td>
                        </tr> 
                    <?php endforeach; ?>
                    <tr>
                        <td class="" align="right" colspan="10">&nbsp;</td>
                    </tr>
                    <tr class="list-header-bottom">
                        <td colspan="8"><span class="normal_bold" >&nbsp;</span></td>
                        <td class="text-left"><span class="normal_bold" >Total</span></td>
                        <td class="text-right text-underline"><span class="normal_bold" ><?php echo number_format($total, "2", ",", "."); ?></span></td>
                    </tr>
                </table>
            </div>
        </div>
    </body>
</html>
<script type="text/javascript">
    function print_detail() {
        //var opt_print   = $("input[type='radio'][name='opt_print']:checked").val();
        var data_print = $("#list-print-container").html();
        Popup(data_print);

    }

    function Popup(data) {
        var mywindow = window.open('', 'list-print-container', 'height=528,width=600');
        var css = css_print();
        mywindow.document.write('<html><head><title>Print Detail</title>');
        mywindow.document.write(css);
        mywindow.document.write('</head><body >');
        mywindow.document.write(data);
        mywindow.document.write('</body></html>');

        mywindow.document.close(); // necessary for IE >= 10
        mywindow.focus(); // necessary for IE >= 10

        mywindow.print();
        mywindow.close();

        return true;
    }
    function clickRows(idNumber) {
        parent.tab_edit('Edit <?php echo $menu_label; ?>', '<?php echo $menu_link; ?>', 'icon-edit', 'edit', idNumber);
    }
</script>