    <script>
        $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
	   </script>
	   
	   
 

         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
		$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
 
		    var code = $(this).data('code');
		   $("#code").val(code); 
		     var expamount = $(this).data('expamount');
		   $("#expamount").val(expamount); 
		     var year = $(this).data('year');
		   $("#year").val(year); 
		     var month = $(this).data('month');
		   $("#month").val(month); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		     var usedamount = $(this).data('usedamount');
		   $("#usedamount").val(usedamount);
		  
		   
        });
		
		
		
		
    </script> 
	   	  <style type="text/css">
  
  

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;20px;
  
    width:100%; 


}

#sale{  	


    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		    	#myprint { display: block; font-size:16; width:100%; }

    }
    </style>
 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>
 <div class="row">
  
   	

   	<div class="col-md-12">

  <?php
   echo $this->session->flashdata('deletemsg'); 
 
				echo $this->session->flashdata('msg'); 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
    $deletebank=$this->usermodel->populatuserpermissionsdataarray('accounting','deletebank',$userid);
function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						
						return $number;
					}
  
  ?>
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading" id="non-printable">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				 <span class="pull-right"> View Task  </span>

				 	  				 <a href="<?php echo base_url();?>user/viewtasks" class="btn btn-info"> Back </a>
				 	  				 <a href="<?php echo base_url();?>user/viewtasks" class="btn btn-info"> Refresh </a>
 <a data-toggle='modal' data-target='#purchaseModal' class="btn btn-default">View Task Report</a>
 <div class="pull-right"  >
<form name="print" method="post" action="">
 <input type="submit" id="print"  accesskey="p" class="btn btn-default"  name="print"onclick="printDiv('sortable_table')" value="print receipt!" />

 </form></div>
				 
            	</div>
            </div>
					
					
					
					<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
		   							<th>User /Employee  </th>

  							<th>Task  </th>
							  							<th>Target   </th>
															<th>Period </th>


		<th> Mode </th>
					<th>From Date </th>

		<th>Year </th>
			<th> Description </th>

										<th> Status </th>
										<th> Branch </th>

	
		


                 </tr>
             </thead>
<?php
 if(!is_array($assigntask)) {

	
    }else {
?>
    
             <?php 
 
 
  	foreach ($assigntask as $c): 

	
	

             ?>


             <tr>
                
            <?php 
$id=$c->id;


?>






 <td>
												 
	<?php 
					// $branch="";
					 $employeeid=$c->employeeid;

					 $employee= $this->usermodel->populateallarray('people','id',$employeeid);
			echo$employeename=$employee[0]['firstname'];	


					 
?>
												 
	 </td>											 
												 
			
              
    <td>
	<?php 
					// $branch="";
					 $taskid=$c->taskid;

					 $task= $this->usermodel->populateallarray('tasktype','id',$taskid);
			echo$taskname=$task[0]['name'];	


					 
?>	
	
	</td>
		    <td><?php echo $c->target; ?></td>

	  <td>
	<?php 
					// $branch="";
					 $periodid=$c->period;

					 $period= $this->usermodel->populateallarray('periods','id',$periodid);
			echo$periodname=$period[0]['name'];	


					 
?>	
	
	</td>

	    <td><?php echo $c->mode; ?></td>

	    <td><?php echo $c->fromdate; ?></td>

   

	  <td><?php echo $c->year ; ?></td>
	  <td><?php echo $c->description ; ?></td>

	  	  	  <td><?php echo $c->status ; ?></td>
<td>
	<?php 
					// $branch="";
					 $branchid=$c->branchid;

					 $branch= $this->usermodel->populateallarray('branch','id',$branchid);
			echo$branchname=$branch[0]['name'];	


					 
?>	
	
	</td>
	
   	 	 <td id="non-printable"> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									<?php
										if($usertype=="admin"){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
										
                                        
                                     	  <li> 

									
										  
	 <a class="btn btn-primary editbtn" id="editbtn" data-usedamount='<?php echo  $c->usedamount;?>' data-code='<?php echo  $c->code;?>' data-expamount='<?php echo  $c->expamount;?>'data-year='<?php echo  $c->year;?>'data-month='<?php echo  $c->month;?>' data-description='<?php echo  $c->description;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
     	
                  
             </tr>

	<?php endforeach;} ?>

          
 
			<tr border="1" background="green">
									<td ><center><b>Expected  Amount:</center></b></td>
									<td ><center><b>
		<?php if(isset($ttexpected)) {echo formatMoney($ttexpected, true);  }?><b></center></td>

		<td>  <b><?php if(isset($ttused)) {echo formatMoney($ttused, true);  }?><b></td>
			<td>  <b><?php if(isset($ttbalance)) {echo formatMoney($ttbalance, true);  }?><b></td>

			
			
			
			<td>  <b><?php if(isset($totalcard)) {echo formatMoney($totalcard, true);  }?><b></td>
<td colspan="5" ></td>
<td  id="non-printable"></td>

</tr>
        </table>
		<div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. " Records " ;?>    </span>

        
        </div>
	</div>
					
					
					
					
						

<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- 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 Budget</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addbudget' , 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="mycategoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">
			<input type="hidden" name="action" value="update"id="action" class="form-control" required placeholder="Enter mycategoryid">
		  		<input type="hidden" name="view" value="user/viewbudget" class="form-control" required placeholder="view ">

<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">Account</label>
    <div class="col-sm-10">
		
	
		<select class="form-control" name="code" id="code" required >
	
		<option value=""  selected="selected"> </option>

	<option value=""  >---Select Income/Expense Account---</option>

	


	<?php 
					 
		
											$mybanking= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'description','5');


if(is_array($mybanking)) {

   foreach($mybanking as $mybankingrow){

   //echo $courserow->coursename;
   ?>
					<option value="<?=  $mybankingrow->number;   ?>"><?=  $mybankingrow->accountname; ?></option>




	<?php

}} else {
    echo 'No Customer available.';
}
	
?>
</select>		
		  		
				
		<span class="text-danger"> 	<?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>







		<div class="form-group">
    <label for="inputexpamount" class="col-sm-2 control-label">Expected Amount: </label>
    <div class="col-sm-10">
	
		  		<input type="number" name="expamount" id="expamount" value="<?php echo set_value('expamount'); ?>" class="form-control" required placeholder="Enter  expected amount ">
		 
				
		<span class="text-danger"> <?php echo form_error('expamount'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputusedamount" class="col-sm-2 control-label">Actual Amount: </label>
    <div class="col-sm-10">
	
		  		<input type="number" name="usedamount" id="usedamount" value="<?php echo set_value('usedamount'); ?>" class="form-control" required placeholder="Enter  actual amount used ">
		 
				
		<span class="text-danger"> <?php echo form_error('usedamount'); ?>
		
		</span>
	</div>
  </div>

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

 <select name='month' id='month'  class="form-control" required>
 		<option value=""  selected="selected"> </option>

    <option value=''>--Select Month for payment--</option>
    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		
		</span>
	</div>
  </div>		
			
		
		
		
		
		
		
		
		<div class="form-group">
    <label for="inputyear" class="col-sm-2 control-label">Year: </label>
    <div class="col-sm-10">
	
   				<input type="text" name="year"  id="year" value="<?php echo set_value('year',$year); ?>" id="idno" class="form-control"  placeholder="Enter year">
		 
				
		<span class="text-danger"> <?php echo form_error('year'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
 
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">Comments</label>
    <div class="col-sm-10">
	<textarea name="description" id="description" class="form-control" placeholder="Bussines/comments"><?php echo set_value('description'); ?></textarea> 

			
	</div>
  </div>
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-20">
     	         <button type="submit"  name="btn_budget"  value="budget"  class="btn btn-primary">Update Budget </button>


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

    

				</div>

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

	
			
			
			
<div id="purchaseModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Budget Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
					  $mydate=date("Y-m-d H:i:s");
					  $frommydate=date("Y-m-d 00:00:00");

         $YEAR = date('Y');
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewbudgetreport' , 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;?>

	
	
	
	
	
	
	

  	
	
	<div class="form-group">
    <label for="inputbmonth" class="col-sm-2 control-label">	Month </label>
    <div class="col-sm-10">
	
     <select name='bmonth' class="form-control" required>
    <option value=''>--Select Month for payment--</option>
	    <option  value='all'>The whole year</option>

    <option  value='Janaury'>Janaury</option>
    <option value='February'>February</option>
    <option value='March'>March</option>
    <option value='April'>April</option>
    <option value='May'>May</option>
    <option value='June'>June</option>
    <option value='July'>July</option>
    <option value='August'>August</option>
    <option value='September'>September</option>
    <option value='October'>October</option>
    <option value='November'>November</option>
    <option value='December'>December</option>
    </select> 		 
				
		<span class="text-danger"> <?php echo form_error('bmonth'); ?>
		
		</span>
	</div>
  </div>

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


		  		<input type="number" name="byear" value="<?php echo set_value('byear',$YEAR); ?>" class="form-control" required placeholder="Enter salary year">
		 

		<span class="text-danger"> <?php echo form_error('byear'); ?>
		
		</span>
	</div>
  </div>
  
	 <div class="form-group">
    <label for="inputdownload" class="col-sm-2 control-label">Download?</label>
    <div class="col-sm-10">
	<select class="form-control" name="download" required>
	
	<option value=""  >---Select your option---</option>

		<option value="no" selected="selected" >--I want to view the budget---</option>
			<option value="yes"  >--I want to download the budget---</option>

</select>
		

	</div>
  </diV>
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_invoice" class="btn btn-primary"> View Budget  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
			
			
			
			
			
			
					
					
	
	<div id="deleteModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="assigntask">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/assigntask">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>		
	
	
	
					
					
					
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

 
</div>



<script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

    // document.body.innerHTML = printContents.fontsize(12);
     window.print();

	 if( window.print()) {
         window.location.href = "../user/viewbudget";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/viewbudget";

		    // document.body.innerHTML = originalContents;

	}
}
	</script>















