<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title><?php echo $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" class="noPrint">
                    <a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail();">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" 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 style="overflow: auto; overflow-y:visible; height:650px;" id="print-container">
                <table width="80%" border="0" cellspacing="0" cellpadding="0" style="margin-left:9%; margin-top:10px;">
                    <tr>
                        <td height="40" colspan="6" class="company-name text-center"><?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?></td>
                    </tr>
                    <tr>
                        <td colspan="6" class="list-title text-center">List <?php echo $menu_label; ?></td>
                    </tr>
                    <tr>
                        <td colspan="6" class=""><br></td>
                    </tr>
                    <tr class="list-header-top">
                        <td width="30" class="s4">Item Code</td>
                        <td width="40" class="s4">Item Description</td>
                        <td width="35" class="s4">Category</td>
                        <td width="25" class="s4">Type</td>
                        <td width="15" class="s4">Unit</td>
                        <td width="20" class="s4">Status</td>
                    </tr>
                    <?php
                    foreach ($list as $row) {
                        //$TransStatus = get_status_master($row->TransStatus);
                        ?>
                        <tr ondblclick="clickRows('<?php echo $row->ItemCode; ?>')" class="row-preview-list">
                            <td class="text-top s5"><?php echo $row->ItemCode; ?></td>
                            <td class="text-top s5"><?php echo $row->ItemDesc; ?></td>
                            <td class="text-top s5"><?php echo $row->ItemCategoryName; ?></td>
                            <td class="text-top s5"><?php echo $row->ItemTypeName; ?></td>
                            <td class="text-top s5"><?php echo $row->unit; ?></td>
                            <td class="text-top s5"><?php echo $row->TransStatus; ?></td>
                        </tr> 
                        <?php
                    }
                    ?>
                </table>
            </div>
        </div>
    </body>
</html>
<script>
    function print_detail() {
        //var opt_print   = $("input[type='radio'][name='opt_print']:checked").val();
        var data_print = $("#print-container").html();
        Popup(data_print);
    }

    function Popup(data) {
        var mywindow = window.open('', 'print-container', 'height=528,width=700');
        var css = '<link rel="stylesheet" href="<?php echo base_url() ?>assets/custom/css/table.css" type="text/css" />';
//        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>
