<script type="text/javascript">
$(document).ready(function() {
    /* Build the DataTable with third column using our custom sort functions */
   $('select').select2();
   var oTable = $("#test").dataTable( {
        "iDisplayLength": 10,
		 "aLengthMenu": [5,10,25,50,100],
		 "sPaginationType": "full_numbers", "aoColumns": [ { 
		 	"bSortable": false }, 
			null, 
			null, 
			null,
			null,
			null,
			null,
			null ]});
     oTable.fnSort( [ [1,'asc'] ] );
}); 
 

function printsalesByCustomer(){
	var addyear = $('#add_year option:selected').val();
	var addper = $('#add_period option:selected').val();
	var urls = "<?php echo base_url();?>soreport/SalesOrderByItem_print/"+addyear+"/"+addper;
		window.open(urls);
}
</script>
<div id="content">                        
<div class="wrap">
	<div class="head">
		<div class="info">
			<h1><?php echo element('compName', $this->session->userdata('logged_in')) ?> [ 
			<?php echo element('compNo', $this->session->userdata('logged_in')) ?> ]</h1>
			<ul class="breadcrumb">
            	<li><a href="#"><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
                <li><a href="<?php echo base_url()?>SalesOrder"><?php echo $this->lang->line('module') ?></a> <span class="divider">-</span></li>
                <li class="active"><?php echo $this->lang->line('titlelist') ?></li>
            </ul>
		</div><!-- info -->
	<div class="search">
		<form action="<?php echo base_url() ?>admin/search" method="post">
			<input name="search_text" type="text" placeholder="search..."/>                                
            <button type="submit"><span class="i-magnifier"></span></button>
		</form>
	</div>                        
</div><!-- head --> 
<div class="content">
	<div class="wrap">    
		<div class="row-fluid">
			<div class="span12">
            	<div class="block">
                	<div class="head">
                    	<h2><?php echo $this->lang->line('titlelist') ?></h2>
                    	<ul class="buttons">
                         <button class="btn btn-link" onClick="printsalesByCustomer()">Print</button>
                        </ul>                                        
                    </div><!-- head -->
            	<div class="content np table-sorting">
            	<table cellpadding="0" cellspacing="0" width="100%" id="test" class="editable">
                	<thead>
                    <tr>
            			<th style="display:none"></th>
            			<th class="tac">#</th>
                        <th><?php echo $this->lang->line('itemCode') ?></th>
                        <th><?php echo $this->lang->line('description') ?></th>
                        <th class="tar"><?php echo $this->lang->line('qtyOrd') ?></th>
                        <th class="tar"><?php echo $this->lang->line('qtyShipped') ?></th>
                        <th class="tar"><?php echo $this->lang->line('qtyOut') ?></th>
                        <th class="tar"><?php echo $this->lang->line('amount') ?></th>
            		</tr>
        			</thead>
       				 <tbody>
			<?php $bil = 0; 
				if($datatbls){
				foreach($datatbls as $datatbl):
				$bil++
				?>
            	<tr>
                	<td style="display:none" ><?php echo $datatbl->ID; ?></td>
                	<td class="tac"><?php echo $bil; ?></td>
                	<td><?php echo $datatbl->itemCode; ?></td>
                	<td><?php echo $datatbl->description; ?></td>
                    <td class="tar"><?php echo number_format($datatbl->qtyOrdered, 2); ?></td>
                    <td class="tar"><?php echo number_format($datatbl->qtyShipped, 2); ?></td>
                    <td class="tar"><?php echo number_format($datatbl->qtyOut, 2); ?></td>
                    <td class="tar"><?php echo number_format($datatbl->itemTotal, 2); ?></td>
               </tr>
            <?php endforeach; }?>
                     </tbody>
                     </table>
				</div><!-- content -->
				</div><!-- block -->
			</div><!-- span12 -->
		</div><!-- row-fluid -->	
	</div><!-- wrap -->
</div><!-- content -->
