<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title><?= $menu_label ?></title>
        <style type="text/css">
            @media print {
                .noPrint { display: none; }
            }
        </style>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>assets/custom/css/print_new.css">
    </head>
    <body style="width:auto; margin:auto">
        <!--        <div style="padding:2px">
                    <a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-print'" onClick="link_print('<?php echo $menu_link; ?>/to_print')">Print</a>
                </div><br />-->
        <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="60%">
                        <tr>
                            <td  valign="middle">
                                <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()">Print</a>
                            </td>
                        </tr>
                    </table>  
                </div>      
            </div>

            <div id="limit-container">

            </div>
            <br><br>

            <div id="list-print-container">
                <table class="list-header">
        <!--<table width="70%" border="0" cellspacing="0" cellpadding="0" align="center">-->
                    <tr>
                        <td height="40" colspan="8" class="company-name text-center "><?php echo $this->load->model('file/m_new_company')->get_company_name($company_code); ?></td>
                    </tr>
                    <tr>
                        <td height="40" colspan="8" class="company-name text-center "><?php echo $branch_code; ?></td>
                    </tr>
                    <tr>
                        <td colspan="8" class="list-title text-center">List <?= $menu_label ?></td>
                    </tr>
                    <tr>
                        <td colspan="6" class=""><br></td>
                    </tr>
                    <tr class="list-header-top">
                        <td width="30" class="s4">No Transaction</td>
                        <td width="30" class="s4">Customer</td>
                        <td width="30" class="s4">DO Number</td>
                        <td width="30" class="s4">Date</td>
                        <td width="15" class="s4">Description</td>
                        <td width="20" class="s4">Status</td>
                    </tr>
                    <?php
                    foreach ($list as $row) {
                        ?>
                        <tr class="row-preview-list" onDblClick="clickRows('<?php echo $row->SInvNumber; ?>')">
                            <td class="text-top s5"><?php echo $row->SInvNumber; ?></td>
                            <td class="text-top s5"><?php echo $row->CustomerName; ?></td>
                            <td class="text-top s5"><?php echo $row->DOrdNumber; ?></td>
                            <td class="text-top s5"><?php echo convert_to_dmy($row->SInvDate); ?></td>
                            <td class="text-top s5"><?php echo $row->SInvDesc; ?></td>
                            <td class="text-top s5"><?php echo $row->Status; ?></td>
                        </tr>  
                        <?php
                    }
                    ?>
                </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 >= 6
        mywindow.focus(); // necessary for IE >= 6

        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>