<script>
$(document).ready(function(){
	$('select').select2();
//	$('#acctCodel').select2();savedetails
	jQuery('.datepicker2').datepicker({
			dateFormat : 'dd-mm-yy',
			changeMonth : true,
			changeYear : true
			});
   var oTable = $("#test").dataTable( {
        "iDisplayLength": 10,
		 "aLengthMenu": [5,10,25,50,100],
		 "sPaginationType": "full_numbers", 
		 "aoColumns": [ { 
		 	"bSortable": false }, 
			null, 
			null, 
			null, 
			null,
			null ]});
//     oTable.fnSort( [ [1,'asc'] ] );
$(".back").click(function () {
parent.history.back();
return false;
});
});


function do_print(){
	window.open("<?php echo base_url() ?>glreports/journalDetailsPrint/<?php echo $ID;?>");
}

function do_print2(){
	window.open("<?php echo base_url() ?>glreports/journalDetails1Print/<?php echo $ID;?>");
}

</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()."home" ?>'><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
					<li><a href='<?php echo base_url()."GeneralLedger" ?>'> <?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" id="grid_content_1">
			<div class="row-fluid scRow">  
				<div class="span 12">
				
					<div class="block" id="grid_block_1">
						<div class="head">
							<h2><?php echo $this->lang->line('title'); ?></h2>
							<ul class="buttons">
								<li><a href="#" class="block_toggle"><span class="i-arrow-down-3"></span></a></li>
							</ul>                                        
						</div><!-- head -->
						<div class="content np">
							<div class="controls-row"><!-- Row 1-->
								<div class="span3"><?php echo form_label($this->lang->line('jlnumber'),'journal_number');?></div>
								<div class="span5">
                            	<?php 								
								$data = array(
									'name'=>'journal_number', 
									'id'=>'journal_number', 
									'disabled'=>'disabled', 
									'class'=>'span8 input-medium',); 
									echo form_input($data, $journalHead->journalID); ?>
								</div>
							</div><!-- End Row 1-->
							<div class="controls-row"><!-- Row 2-->
								<div class="span3"><?php echo form_label('Description:','description');?></div>
								<div class="span5">
                            	<?php 								
								$data = array(
									'name'=>'description', 
									'id'=>'description', 
									'disabled'=>'disabled', 
									'class'=>'span8',); 
									echo form_input($data, $journalHead->description); ?>
								</div>
							</div><!-- End Row 2-->
							<div class="controls-row"><!-- Row 3 -->
								<div class="span3"><?php echo form_label($this->lang->line('effective_date'),'effdate');?></div>
								<div class="span5">
									<div class="input-prepend span12">
										<span class="add-on"><i class="i-calendar"></i></span>
										<?php 								
										$data = array(
											'type'=>'text',
											'name'=>'effdate', 
											'id'=>'effdate', 
											'disabled'=>'disabled', 
											'class'=>'span7 datepicker2 tac financhk',); 
											echo form_input($data, date("d-m-Y", strtotime($journalHead->effective_date))); ?>
									</div>                                                                                                
								</div>
							</div><!-- End Row 3 -->
							
							<div class="controls-row"><!-- Row 4-->
								<div class="span3"><?php echo $this->lang->line('amount_dr_ttl');?></div>
								<div class="span4">
								<?php                 
								$data = array(
									'name'=>'amountdebit', 
									'id'=>'amountdebit', 
									'disabled'=>'disabled',
									'class'=>'span6 input-medium tar',); 
									echo form_input($data, number_format($journalHead->total_amount_cr,2)); ?>
								</div>
								<div class="span2"><?php echo $this->lang->line('amount_cr_ttl');?></div>
								<div class="span3">
                            	<?php 								
								$data = array(
									'name'=>'amountcredit', 
									'id'=>'amountcredit', 
									'disabled'=>'disabled',
									'class'=>'span6 input-medium tar',); 
									echo form_input($data, number_format($journalHead->total_amount_dr,2)); ?>
								</div>
							</div><!-- End Row 4-->
						
							
						</div><!-- content np-->
					</div>  <!-- Block grid-->                                  
				</div>     <!-- span12 -->   
			</div> <!--row fluid -->
			
			<div class="row-fluid scRow">                            
				<div class="span12 scCol">
					<div class="block" id="journalTable">
						<div class="head">
							<h2><?php echo $this->lang->line('details') ?></h2>
							<ul class="buttons">
								<li><a href="#" class="block_toggle"><span class="i-arrow-down-3"></span></a></li>
							</ul>
                            <div class="side fr">
							<?php
								if($fad == 0){
									echo "<button class='btn-form btn-success-form' onClick='do_print()'>Print</button>";
								}
								else{
									echo "<button class='btn-form btn-success-form' onClick='do_print2()'>Print</button>";
								}
							?>
							</div>
						</div>
						<div class="content np table-sorting">
							<table cellpadding="0" cellspacing="0" width="100%" id="oTable" class="editable">
								<thead>
									<tr>
										<th style="display:none"></th>
										<th width="5">#</th>
										<th><?php echo $this->lang->line('acctCode')?></th>
										<th><?php echo $this->lang->line('description')?></th>
										<th class="tar"><?php echo $this->lang->line('amount_dr')?></th>
										<th class="tar"><?php echo $this->lang->line('amount_cr')?></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 $datatbl->sequence; ?></td>
										<td><?php echo substr($datatbl->acctcode,0, 4).'-'.substr($datatbl->acctcode,4, 3).'-'.substr($datatbl->acctcode,7, 2) . "  [" . $datatbl->acctname. "]"?></td>
										<td><?php echo $datatbl->description?></td>
										<td class="tar"><?php echo number_format($datatbl->amount_dr,2); ?></td>
										<td class="tar"><?php echo number_format($datatbl->amount_cr,2); ?></td>
									</tr>
									<?php endforeach; 
									}?>
								</tbody>
							</table>                                         
						</div> <!-- content np -->
						<div class="footer">
							<div class="side fr">
								<div class="btn-group">
									<button class="btn-icon btn-warning-form back ">
										<span class="i-arrow-left-5 "> <?php echo $this->lang->line('goback')?> </span>
									</button>
								</div>
							</div>
						</div><!--footer -->                                    
						</form>
					</div><!-- block grid-->
				</div> <!--span 12 -->
			</div> <!--row fluid -->
			
		</div>  <!--content class -->
	</div>  <!--wrap -->
</div> <!--content id -->