<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>Journal Voucher</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 class="easyui-layout" data-options="fit:true,border:false">
            <div style="padding:2px" class="noPrint">
                <!--<a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-print'" onClick="link_print('list/journal_voucher/to_print')">Print</a>-->
                <a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()">Print</a>
            </div><br />

            <!--        <div style="overflow: auto; height:700px;" id="print-container">
                        <table width="80%" border="0" cellspacing="0" cellpadding="0" style="margin-left:9%; margin-top:10px;">-->

            <div id="list-print-container">
                <table class="list-header">
                    <tr>
                        <td colspan="5" class="company-name text-center "><?php echo $this->session->userdata('company_name'); ?></td>
                    </tr>
                    <tr>
                        <td colspan="5" class="list-title text-center">Journal Voucher</td>
                    </tr>
                    <tr>
                        <td colspan="5" class="s1"><br></td>
                    </tr>
                    <tr class="list-header-top">
                        <td width="10" class="s4">No</td>
                        <td width="43" class="s4">Journal Number</td>
                        <td width="43" class="s4">Date</td>
                        <td width="85" class="s4">Amount</td>
                        <td width="185" class="s4">Description</td>
                    </tr>
                    <?php
                    $list = json_encode($list);
                    $journal = json_decode($list);
                    $no = 0;
                    $total = 0;
                    foreach ($journal as $row) {
                        ?>
                        <tr ondblclick="clickRows('<?php echo $row->JVchNumber; ?>')" class="row-preview-list">
                            <td class="s5"><?php echo ++$no; ?></td>
                            <td class="s5"><?php echo $row->JVchNumber; ?></td>
                            <td class="s3"><span class="s5"><?php echo convert_to_textual($row->JVchDate); ?></span></td>
                            <td class="s3"><span class="s5"><?php echo number_format($row->JournalVoucherAmout, "2", ",", "."); ?></span></td>
                            <td class="s3"><span class="s5"><?php echo $row->JVchDesc; ?></span></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 = $("#list-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>


