<script>
$(document).ready(function(){
	jQuery('.datepicker2').datepicker({
			dateFormat : 'dd-mm-yy',
			changeMonth : true,
			changeYear : true
			});
	jQuery("#supplierCode").keyup(function() {
		jQuery(this).val(jQuery(this).val().toUpperCase());
	});
});
	function changeList(obj){
		var id = obj.value;
		$.ajax({
			type: "POST",
			url: "<?php base_url()?>../setting/getState/",
			data: "region="+id,
			dataType:"json",
			success: function(content){
				if(content.status == "success") {
					var items = [];
					items.push('<option>-Please Select-</option>');
					for ( var i = 0; i < content.message.length; i++) {
					items.push('<option value="'+content.message[i].fldid+'">'
						+ content.message[i].fldname + '</option>');
					}
					jQuery("#state").empty();
					jQuery("#state").append(items.join('</br>'));
				} else {
					$("#error").html('<p>'+content.message+'</p>');
				}
			}
		});
		return false;
	}
</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 $this->lang->line('module') ?></a> <span class="divider">-</span></li>
                <li class="active"><?php echo $this->lang->line('titlelist') ?></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="row-fluid">
		<div class="span12">
			<?php 
				$hidden = array('order_time' => date('Y-m-d H-i-s'));
				$attrib = array('id'=>'validate'); 
				echo form_open('', $attrib, $hidden);?>
            	<div class="block">
                	<div class="head">
                    	<h2><?php echo $title ?></h2>
                        <div class="side fr">
                        <button class="btn-form btn-danger-form" onClick="clear_form('#validate');" type="button"><?php echo $this->lang->line('clear'); ?></button>
                    </div>
				</div>
				<div class="content np"> <!-- Content 1 -->   
                <table border="0" width="100%"><tr><td width="49%">
                <?php
                     echo $companyInfo->companyName;?>
                  <?php
                     echo $companyInfo->companyNo;?> <br/>
                  <?php
                     echo $companyInfo->line1;?><br><?php echo $companyInfo->line2;?>
                  <?php
                     echo $companyInfo->line3;?><br/><?php echo $companyInfo->companyPostCode;?><?php echo $companyInfo->city;?><br/>
                  <?php
                     echo $companyInfo->phoneNo;?><br/>
                  <?php
                     echo $companyInfo->faxNo;?>
     
                  
                </td><td width="51%">
                  <?php
					 echo $customerDetails->customerName;?><br/>
                  <?php
                     echo $customerDetails->line1;?><br><?php echo $customerDetails->line2;?>
                  <?php
                     echo $customerDetails->line3;?><br/><?php echo $customerDetails->customerPostCode;?><?php echo $customerDetails->city;?><br/>
                  <?php
					 echo $customerDetails->phoneNumber1;?><br/>
                  <?php
					 echo $customerDetails->fax;?><br/>
                      
               </td></tr><tr><td colspan="2"></td></tr></table>     
                  </div>
                  <div>
                <div class="content np table-sorting">
            	<table cellpadding="0" cellspacing="0" width="100%" id="test" class="editable" border="0">
                	<thead>
                    <tr>
              			<th style="display:none"></th>
            			<th><?php echo form_label($this->lang->line('ID'),'ID');?></th>
            			<th><?php echo form_label($this->lang->line('transDate'),'transDate');?></th>
                        <th><?php echo form_label($this->lang->line('refNo'),'refNo');?></th>
                        <th><?php echo form_label($this->lang->line('formNo'),'formNo');?></th>   
                        <th><?php echo form_label($this->lang->line('description'),'description');?></th>
                		<th><?php echo form_label($this->lang->line('debit'),'debit');?></th>    
                        <th><?php echo form_label($this->lang->line('credit'),'credit');?></th>   
                        <th><?php echo form_label($this->lang->line('balance'),'balance');?></th>   
            		</tr>
        			</thead>
       				 <tbody>
                     <?php
					 $balance = 0 ; //need to get balance b/f
					   // var_dump($supplierStatement);
						foreach($customerStatement as $row){
							  echo '<tr><td>'.$row->ID;
					  ?>	
                     </td>  
                     <?php
                     echo '<td>'.$row->transDate.'</td>';?>
                     
                     <?php
                     echo '<td>'.$row->refNo.'</td>';?>
                     
                     <?php
                     echo '<td>'.$row->formNo.'</td>';?>
                     
                     <?php
                     echo '<td>description lah</td>';
                    
					$balance += $row->dr;
					$balance -= $row->cr;
                     echo '<td>'.number_format($row->dr,2,'.',',').'</td>'; //dr
					 echo '<td>'.number_format($row->cr,2,'.',',').'</td>'; //cr
					 echo '<td>'.number_format($balance,2,'.',',').'</td>'; //balance
	
                      } ?> 
                    
                     </div><div> 
                     	<tr>
                     		<td colspan="8" class="tar"><h8>
					 			<?php echo $this->lang->line('total').' '.number_format ($balance,2,'.',','); ?></h8>
                            </td>
                     	</tr>
                        <tr>
                        	<td>
                            	<?php echo num_to_word(-101.35,$dictionary); ?>
                            </td>
                        </tr>
                     </tbody>
			</table>                           
			</div>
                  </div>
                </div>
        </div>             
	  </div>

    </div>
    
              <table border="1" width="100%">
                <tr>
                  <th width="17%"><?php echo $this->lang->line('current'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('1M'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('2M'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('3M'); ?></th>
                  <th width="18%"><?php echo $this->lang->line('4M'); ?></th>
                  <th width="14%"><?php echo $this->lang->line('5M'); ?></th>
                </tr>
                <tr>  
                  <?php
				 // echo var_dump($supplierAging);
				    if($customerAging)		
					foreach($customerAging as $row1){
					   echo '<tr><td>'.$row1->current.'</td>';
					   echo '<td>'.$row1->month1.'</td>';
					   echo '<td>'.$row1->month2.'</td>';
					   echo '<td>'.$row1->month3.'</td>';
					   echo '<td>'.$row1->month4.'</td>';
					   echo '<td>'.$row1->month5.'</td>';
		               echo '</tr>';
              			echo '</table><br/>'; 
   			 			echo '<table border="1" width="100%">';
                		echo '<tr>';
                  		echo '<th width="17%">'. $this->lang->line('current').'</th>';
                  		echo '<th width="17%">'. $this->lang->line('6M').'</th>';
                  		echo '<th width="17%">'. $this->lang->line('7M').'</th>';
                  		echo '<th width="17%">'. $this->lang->line('8M').'</th>';
                  		echo '<th width="18%">'. $this->lang->line('9M').'</th>';
						echo '<th width="18%">'. $this->lang->line('10M').'</th>';
						echo '<th width="18%">'. $this->lang->line('11M').'</th>';
                		echo '</tr><tr>';
					   echo '<td>'.$row1->month6.'</td>';
					   echo '<td>'.$row1->month7.'</td>';
					   echo '<td>'.$row1->month8.'</td>';
					   echo '<td>'.$row1->month9.'</td>';
					   echo '<td>'.$row1->month10.'</td>';
					   echo '<td>'.$row1->month11.'</td>';
		               echo '</tr>';
             			echo '</table><br/>'; 
			}?>	
  
           <th><h5>
              <div align="right">SYSTEM GENERATED NO SIGNATURE REQUIRED</div></th>
  <table border="1" width="100%">
           <tr>
             <td class="tac">THANK YOU FOR DOING BUSINESS WITH US</strong><p>Prepared by Salihin<br/>Copyright Controlled/Private and Confidential</td></td>
             </tr>
             <tr>
                <td>
                <div align="justify">WE SHALL BE GRATEFUL IF YOU LET US HAVE PAYMENT AS SOON AS POSSIBLE. ANY DISCREPANCY IN THIS STATEMENT PLEASE INFORM US IN WRITING WITHIN 10 DAYS.</div></td>
     
</div>
</div>
</div>                                   
</div>
	</form>
</div>
</div>                        
</div>
</div>