<script type="text/javascript">
$(document).ready(function() {   
   //Datepicker
   jQuery('.datepicker2').datepicker({
			dateFormat : 'dd-mm-yy',
			changeMonth : true,
			changeYear : true
			});
   
   //Data table configurations
   var oTable = $("#test").dataTable({
	   	"iDisplayLength": 10,
		"aLengthMenu": [5,10,25,50,100],
		"sPaginationType": "full_numbers",
		"aoColumns": [	{"bSortable": false },
						{"bSortable": false },
					<?php foreach($tbHdr as $v): ?>
						null,
					<?php endforeach; ?>
					] 
	});
	oTable.fnSort( [ [0,'asc'] ] );
   
	//Location transfer detail 
	$('.detail').live('click',function(){
		window.location = "<?php echo base_url() ?>locationtransfer/reportdetail/"+$(this).parents('tr').find('.ID').text();
	});
	
	//Location change get items
	$('.location').change(function(){
		var locID = $('.location').val();
		var urls = "<?php echo base_url();?>inventory/rptstatus/"+locID;
		window.location = urls;
		
	});
	
}); 

function changeList(){
	var dateFrom = $('.dateFrom').val();
	var dateTo = $('.dateTo').val();
	var locID = $('.location').val();
	var itemID = $('.itemList').val();
	var urls = "<?php echo base_url();?>inventory/rptmovement/"+dateFrom+"/"+dateTo+"/"+locID+"/"+itemID;
		window.location = 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 base_url(); ?>'><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
            <li><a href="<?php echo base_url(); ?>/locationtransfer"><?php echo $this->lang->line('module') ?></a> <span class="divider">-</span></li>
            <li class="active"><?php echo $this->lang->line('title') ?></li>
        </ul>
	</div>
	<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="content">
            <div class="wrap">   
                
                <div class="row-fluid">
                    <div class="span12">
                        <div class="block">
                        	<div class="head">
                            	<h2><?php echo $this->lang->line('selectLoc') ?></h2>
                            </div>
                            <div class="content">
                                <div class="controls-row"><!-- Row 4-->
                                    <div class="span6 tac">
                                    	<div class="span4 tar"><?php echo form_label($this->lang->line('selectLoc'));?></div>
                                        <div class="input-prepend">
                                            <?php
                                                $preselcat = $locID?$locID:'';
												$options[''] = '--Select Location';
                                                foreach($location as $row){
                                                    $options[$row->fldid] = $row->code;
                                                }
                                                $js='onChange="" class="input-medium location"';
                                                echo form_dropdown('location', $options, $preselcat, $js);
                                            ?>
                                        </div>
                                	</div>                             
                                </div><!-- End Row 4-->
                            </div>
                            <div class="footer"></div>
                        </div>
                        <div class="block">                            
                            <div class="head">
                                <h2><?php echo $this->lang->line('inventoryStatus') ?></h2>
                            	<ul class="buttons">
                                     <li><a href="<?php echo base_url()."inventory/rptstatusprint/".$locID; ?>" name="updatePosting" onclick=""><?php echo $this->lang->line('print') ?></a></li>
                                </ul>
                            </div><!-- head -->
                            <div class="content np table-sorting">
                                <table cellpadding="0" cellspacing="0" width="100%" id="test" class="editable itemTbl">
                                    <thead>
                                    <tr>
                                    	<th style="display:none;">&nbsp;</th>
                                    	<th class="tac">#</th>
                                    <?php 
									foreach($tbHdr as $row): 	
										if(in_array($row,$alignRight)):
									?>
                                        <th class="tar"><?php echo $this->lang->line($row); ?></th>
                                    <?php 
										else:
									?>
                                    	<th class="tac"><?php echo $this->lang->line($row); ?></th>
                                    <?php 
										endif;
									endforeach; ?>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $bil = 0; 
                                    if(isset($datatbls) && !empty($datatbls)):
                                        foreach($datatbls as $item):
                                        $bil++?>
                                        <tr class="itemList">
                                        	<td class="ID" style="display:none"><?php echo $item->ID; ?></td>
                                            <td class="tac"><?php echo $bil; ?></td>
										<?php 
										foreach($tbHdr as $row): 
											if(in_array($row,$alignRight)):
										?>
                                            <td class="tar span2"><?php echo $item->$row; ?></td>
                                        <?php 
											else:
										?>
                                        	<td class="tac span2"><?php echo $item->$row; ?></td>
                                        <?php 
											endif;
										endforeach; ?> 
                                        </tr>
                                        <?php 
                                        endforeach;
                                    endif;?>
                                    </tbody>         
                                </table>
                            </div><!-- content -->                              
                        </div><!-- block -->
                    </div><!-- span12 -->
                </div><!-- row-fluid -->	
            </div><!-- wrap -->
        </div><!-- content -->
	</div>
</div>
