   <div class="row">
  
  
     <div class="col-md-12">
	 <div class="table-responsive">
		
		
	<div class="panel panel-default" data-collapsed="0">
        	
			<div class="panel-body">
		
		
		



    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update  asset</h4>
      </div>
      <div class="modal-body">
      
	  	  				 <a href="<?php echo base_url();?>user/viewassets" class="btn btn-info"> Back to assets </a>


				<?PHP
//$session_data = $this->session->userdata('logged_in');
$imgid = rand(100, 990000).time();
 $session_data = $this->session->userdata('logged_in');


	$smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		  		 	  $display1=$smsconfig[0]['display1'];
					  $mytax=0;
				 if( $display1=="yes"){
					  $mytax=$smsconfig[0]['tax1rate'];
				 }else{
					  $mytax=0;

				 }
					$refno="";
					
					if($main[0]['invoice']!=""){
							$refno=$main[0]['invoice'];
						
					}else{
									 $myfinalsalesid = $userid.time();

					$refno=$myfinalsalesid;

					}
					
   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addasset' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
				  		<input type="hidden" name="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="/user/updateasset?randomitemidentifier=<?php echo$main[0]['id']; ?>"id="view" class="form-control" required placeholder="Enter view">

				 		  		<input readonly type="hidden" name="action" required value="update" class="form-control"  placeholder="Enter invoice or Receip tnumber">
			 		  		<input readonly type="hidden" name="myid" required value="<?php echo set_value('invoice',$main[0]['id']); ?>" class="form-control"  placeholder="Enter invoice or Receip tnumber">




  
  
  	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	Asset Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" value="<?php echo set_value('code',$main[0]['code']); ?>" class="form-control" required placeholder="Enter asset Code">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  

	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	 Name</label>
    <div class="col-sm-10">
		
				<input type="text" name="name" value="<?php echo set_value('name',$main[0]['name']) ;?>"  class="form-control" required placeholder="Enter  asset name">

		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  
  		<input type="hidden" name="shortname" value="<?php echo set_value('shortname',$main[0]['name']) ;?>"  class="form-control"  placeholder="Enter  Short  name">

	
  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status" required>
			<option value=""  >---Select Status---</option>

		<option value="<?php echo $main[0]['status'];     ?>" selected="selected" ><?php echo $main[0]['status'];     ?></option>
		<option value="New"   >New</option>
		<option value="Used"  >Used(Existing)</option>


	

</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>
  
  
	  <div class="form-group">
    <label for="inputassetcondition" class="col-sm-2 control-label">Asset Condition</label>
    <div class="col-sm-10">
	<select class="form-control" name="assetcondition" >
			<option value="<?php echo $main[0]['assetcondition'];     ?>" selected="selected" ><?php echo $main[0]['assetcondition'];     ?></option>

		<option value=""  >---Select asset condition---</option>
		<option value="Good"   >Good</option>
		<option value="Bad"  >Bad</option>
				<option value="Destroyed"  >Destroyed</option>

		<option value="Other"  >Other</option>


	

</select>
		
						<span class="text-danger"><?php echo form_error('assetcondition'); ?>

	</div>
  </div>
	
	
  	
 <div class="form-group">
    <label for="inputmode" class="col-sm-2 control-label">Asset Mode ?</label>
    <div class="col-sm-10">
	<select class="form-control" name="mode" required>
				<option value="<?php echo $main[0]['mode'];     ?>" selected="selected" ><?php echo $main[0]['mode'];     ?></option>

		<option value=""  >---Select Asset mode---</option>
		<option value="depreciating"   >Depreciating</option>
		<option value="appreciating "  >Appreciating </option>

	

</select>
		
						<span class="text-danger"><?php echo form_error('mode'); ?>

	</div>
  </div>
  	
  

  
  
  
  

     <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" required >
					<option value="<?php echo $main[0]['category'];     ?>" selected="selected" ><?php echo $main[0]['category'];     ?></option>

	<option value=""  >---Select Type---</option>
		<option value="Straight-line"  >Straight-line</option>

	<option value="Reducing balance"  >Reducing balance</option>
		<option value="Double declining balance"  >Double declining balance</option>
			<option value="Units of production"  >Units of production</option>
				<option value="Sum of years digits"  >Sum of years digits</option>
					<option value="Accumulated Appreciation"  >Accumulated Appreciation</option>
</select>
		
						<span class="text-danger"><?php echo form_error('category'); ?>

	</div>
  </div>
  	


  

 
  
  
	<div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">Supplier</label>
    <div class="col-sm-10">

				<input type="text" required name="supplier" value="<?php echo set_value('supplier',$main[0]['supplier']); ?>"  class="form-control"  placeholder="Enter asset supplier">
			
		<span class="text-danger"> <?php echo form_error('supplier'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
	<div class="form-group">
    <label for="inputbuyingprice" class="col-sm-2 control-label">Buying Price (Unit)</label>
    <div class="col-sm-10">

				<input type="text" required name="buyingprice" value="<?php echo set_value('buyingprice',$main[0]['buyingprice']); ?>"  class="form-control"  placeholder="Enter asset buying price">
			
		<span class="text-danger"> <?php echo form_error('buyingprice'); ?>
		
		</span>
	</div>
  </div>
  	
	<div class="form-group">
    <label for="inputaccumdepreciation" class="col-sm-2 control-label">	Accumulative Amt </label>
    <div class="col-sm-10">

				<input type="text" name="accumdepreciation" value="<?php echo set_value('accumdepreciation',$main[0]['accumdepreciation']); ?>"  class="form-control"  placeholder="Enter asset accumulative Depreciation/Appreciation value  ">
			
		<span class="text-danger"> Accumulative Dep/Appreciation value<?php echo form_error('accumdepreciation'); ?>
		
		</span>
	</div>
  </div>
		
		
		
	
			<div class="form-group">
    <label for="inputdepreciation" class="col-sm-2 control-label">	Value(Yearly)</label>
    <div class="col-sm-10">

				<input type="text" name="depreciation" value="<?php echo set_value('depreciation',$main[0]['depreciation']); ?>"  class="form-control2"  placeholder="Enter asset Depreciation/Appreciation value  ">

		<span class="text-danger"> Dep/Appreciation value<?php echo form_error('depreciation'); ?>
		
		</span>
	</div>
  </div>
  
  
				<div class="form-group">
    <label for="inputdepreciationpercent" class="col-sm-2 control-label">	Pecentage (%) </label>
    <div class="col-sm-10">

							<input type="text" name="depreciationpercent" value="<?php echo set_value('depreciationpercent',$main[0]['depreciationpercent']); ?>"  class="form-control2"  placeholder="Enter depreciation percent(%)  ">
			
		<span class="text-danger"> Accumulative Dep/Appreciation Pecentage<?php echo form_error('depreciationpercent'); ?>
		
		</span>
	</div>
  </div>
				
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
			<div class="form-group">
    <label for="inputserialno" class="col-sm-2 control-label">	Serial Number</label>
    <div class="col-sm-10">

				<input type="text" name="serialno" value="<?php echo set_value('serialno',$main[0]['serialno']); ?>"  class="form-control"  placeholder="Enter asset serial number if any  ">
			
		<span class="text-danger"> <?php echo form_error('serialno'); ?>
		
		</span>
	</div>
  </div>
	
	

					<input type="hidden" name="uom" value="piece"  class="form-control" required  placeholder="Enter quantity in stock">

  
  	
	
	
	<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Quantity</label>
    <div class="col-sm-10">

				<input type="text" name="qty" value="<?php echo set_value('qty',$main[0]['qty']); ?>"  class="form-control" required  placeholder="Enter quantity in stock">
			
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  	

  <div class="form-group">
    <label for="inputbranch" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch"  required>
	
	<option value=""  >Select branch</option>

	
	<?php 
	
	
	
			 
					 		$maincategory = $this->usermodel->populateall('branch','id',$main[0]['branch']);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option  selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No Branch/Counter.';
}
				 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option   value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No Branch/Counter.';
}
	
?>
</select>
		

		
	</div>
  </div>
  
  
  	
	
	
	<div class="form-group">
    <label for="inputstart_date" class="col-sm-2 control-label">		Date purchased</label>
    <div class="col-sm-10">

				<input type="date" required name="start_date" value="<?php echo set_value('start_date',$main[0]['start_date']); ?>"  class="form-control"  placeholder="Enter start date">
			
		<span class="text-danger"> <?php echo form_error('start_date'); ?>
		
		</span>
	</div>
  </div>
	
	
	
<div class="form-group">
    <label for="inputexpdate" class="col-sm-2 control-label">	Expiry date(YYYY-MM-DD)</label>
    <div class="col-sm-10">

				<input type="text"    name="expdate" value="<?php echo set_value('expdate',$main[0]['expdate']); ?>"  class="form-control"   placeholder="Enter expiry date">
			
		<span class="text-danger"> Enter expiry date  if any<?php echo form_error('expdate'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
  	
		<div class="form-group">
    <label for="inputstore" class="col-sm-2 control-label">	Asset Location</label>
    <div class="col-sm-10">

				<input type="text" name="store" value="<?php echo set_value('store',$main[0]['store']); ?>"  class="form-control"   placeholder="Enter store / rack name">
			
		<span class="text-danger">Enter the name where the asset is stored <?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
  		
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description',$main[0]['description']); ?>"  class="form-control"  placeholder="Enter description"><?php echo set_value('description',$main[0]['description']); ?></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
	
	
	
		<div class="form-group">
    <label for="inputtax_included" class="col-sm-2 control-label">	Tax included (%)</label>
    <div class="col-sm-10">

				<input type="text" name="tax_included" value="<?php echo set_value('tax_included',$main[0]['tax_included']); ?>"  class="form-control"   placeholder="Enter tax if any">
			
		<span class="text-danger">Enter tax to be included if any <?php echo form_error('tax_included'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	<div class="form-group">
    <label for="inputsalesaccount" class="col-sm-2 control-label">Asset / Purchase Acount?</label>
    <div class="col-sm-10">
	<select class="form-control"  name="salesaccount" >
	
							<option  value="" selected="selected" >--Select account to be used to buy the asset</option>

<?php 
						           		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
			 
//$assetaccount=$configuration[0]['assetaccount'];

		

						$myglaccounts = $this->usermodel->populateall('glaccounts','number',$main[0]['salesaccount']);
		


if(is_array($myglaccounts)) {

   foreach($myglaccounts as $myglaccounts){

    ?>
					<option selected  value="<?=  $myglaccounts->number;   ?>"><?=  $myglaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
	$myglaccounts = $this->usermodel->populateall('glaccounts','number',3010);
		


if(is_array($myglaccounts)) {

   foreach($myglaccounts as $myglaccounts){

    ?>
					<option  value="<?=  $myglaccounts->number;   ?>"><?=  $myglaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
					$glaccounts = $this->usermodel->populateall('glaccounts','accounttype',1);
		


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	?>


</select>
		
	

		
		<span class="text-danger"><?php echo form_error('salesaccount'); ?>

	</div>
  </div>
	
	
	
	<div class="form-group">
    <label for="inputassetaccount" class="col-sm-2 control-label">Asset Acount?</label>
    <div class="col-sm-10">
	<select class="form-control"  name="assetaccount" >
	
		
<?php 
						           		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
			 
$assetaccount=$configuration[0]['assetaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$main[0]['assetaccount']);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>
			<option value=""   >---Select asset Account---</option>

	<?php
  //  echo 'No GL Account.';
}
	

								$glaccounts = $this->usermodel->populateall('glaccounts','accounttype',7);
		


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>


</select>
		
	

		
		<span class="text-danger"><?php echo form_error('assetaccount'); ?>

	</div>
  </div>
	
	<div class="form-group">
    <label for="inputaccumulateaccount" class="col-sm-2 control-label">Accumulate Depreciation Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="accumulateaccount" >
	
<?php 

$assetaccount=$configuration[0]['salesaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$main[0]['accumulateaccount']);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>

	<?php
  //  echo 'No GL Account.';
}
	

								$glaccounts = $this->usermodel->populateall('glaccounts','companyid',$companyid);
		


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>
		

	

</select>
		
		<span class="text-danger"><?php echo form_error('salesaccount'); ?>

	</div>
  </div>
	
	<div class="form-group">
    <label for="inputexpenseaccount" class="col-sm-2 control-label">Expense Depreciation Acount?</label>
    <div class="col-sm-10">
	<select class="form-control" name="expenseaccount" >
	
			
<?php 
					 
$assetaccount=$configuration[0]['expenseaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$main[0]['expenseaccount']);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>
			<option value=""   >---Select Expense Account---</option>

	<?php
  //  echo 'No GL Account.';
}
	

								$glaccounts = $this->usermodel->populateall('glaccounts','companyid',$companyid);
		


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>
		


	

</select>
		
		<span class="text-danger"><?php echo form_error('expenseaccount'); ?>

	</div>
  </div>
	
		<div class="form-group">
    <label for="inputinvoice" class="col-sm-2 control-label">	REF Number</label>
    <div class="col-sm-10">
	
			 		  		<input  type="text" name="invoice" required value="<?php echo set_value('invoice',$refno); ?>" class="form-control"  placeholder="Enter REF Number">
		 
				
		<span class="text-danger"> <?php echo form_error('invoice'); ?>
		
		</span>
	</div>
  </div>
  
  
	
	
	<div class="form-group">
    <label for="inputphoto" class="col-sm-2 control-label">	Upload Image</label>
    <div class="col-sm-10">
	<input type="hidden" name="imgid"   value="<?php if(isset($imgid)) {echo $imgid; }?>"  class="form-control">


	<input type="file" name="photo" value="<?php echo set_value('photo'); ?>"id="photo" class="form-control"  placeholder="Please upload image if any">
			<span class="text-danger"> <?php echo form_error('photo'); ?>
		
		</span>
	</div>
	</div>
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="asset" name="btn_addasset" class="btn btn-default"> Update Asset   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>


							
							
						</div>
				</div>

			
			</div>
		</div>
  

			
		
		
		
		
		
		
		
  <div class="col-md-12">
<p class="text-left">






<h1><center>
Update asset
</center>
</h1>

								
 
 
 
 
 
 
 
 
 
 



	
	  </div>
 
</div>
</div>
</div>
	
		
</div>
	
		

</div>

