    <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 branchid = $(this).data('branchid');
		   $("#branchid").val(branchid);
var todate = $(this).data('todate');
		   $("#todate").val(todate);
 var fromdate = $(this).data('fromdate');
		   $("#fromdate").val(fromdate);
  var defaulttype = $(this).data('defaulttype');
		   $("#defaulttype").val(defaulttype);
  var employeeid = $(this).data('employeeid');
		   $("#employeeid").val(employeeid); 
		     var period = $(this).data('period');
		   $("#period").val(period); 
		     var year = $(this).data('year');
		   $("#year").val(year); 
		     var mode = $(this).data('mode');
		   $("#mode").val(mode); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		     var target = $(this).data('mytarget');
		   $("#mytarget").val(target);
		  
		     var taskid = $(this).data('taskid');
		   $("#taskid").val(taskid);
		  
		     var tasktype = $(this).data('tasktype');
		   $("#tasktype").val(tasktype);
		  
        });
		
		
		
		
    </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'];	
	 			    $viewalltasks=$this->usermodel->populatuserpermissionsdataarray('task','viewall',$userid);
	 			    $posttaskforothers=$this->usermodel->populatuserpermissionsdataarray('task','posttaskforothers',$userid);

    $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;
					}
					
						      $myyear=date("Y")+1;
						  		      $mymonth=date("m-d");

			$finalnextyeardate=$myyear."-". $mymonth;
					
					
  
  ?>
		<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 Assigned</a>
 
 
 	<?php
		
		 if($posttaskforothers==true){
			?> 
  <a data-toggle='modal' data-target='#posttaskModal' class="btn btn-default">Post Task Report For Others</a>

	<?php
		 }
		?>
		

 <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>
			<div class="panel-body" id="non-printable">

<?php
		
		 if($viewalltasks==true){

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

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



		
                 echo form_open('user/assignmytask' , array('class' => 'form-inline 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="action" value="insert" class="form-control" required placeholder="Insert ">
		  		<input type="hidden" name="view" value="user/assigntask" class="form-control" required placeholder="view ">
		  		<input type="hidden" name="mycategoryid" value="" class="form-control" required placeholder="mycategoryid ">

 </div>
	<div class="col-md-12">
 	<div class="form-group">
    <label for="inputemployeeid" class="col-sm-1 control-label">User/ Employee</label>
    <div class="col-sm-5">
		
	
		<select class="chzn-select" style="width:50%" name="employeeid" required >
	
	<option value=""  >---Select User / Employee to assign task---</option>

	


	<?php 
					 
		
									 		$myusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');


if(is_array($myusers)) {

   foreach($myusers as $myusersrow){

   //echo $courserow->coursename;
   ?>
<option value="<?=  $myusersrow->id;   ?>"><?=  $myusersrow->firstname. "  ".$myusersrow->surname."(".$myusersrow->id.")"; ?></option>




	<?php

}} else {
    echo 'No Customer available.';
}
	
?>
</select>		
		<select class="chzn-select" style="width:40%" name="taskid" required >
	
	<option value=""  >---Select task to assign---</option>

	


	<?php 
					 
		
									 			$task = $this->usermodel->populatealldatanoarraythree('tasktype', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($task)) {

   foreach($task as $taskrow){

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




	<?php

}} else {
    echo 'No Task available.';
}
	
?>
</select>	  		
				
		<span class="text-danger"> 	<?php echo form_error('taskid'); ?>
		
		</span>
	</div>
  </div>	
  	
		
		
				
			  <div class="form-group">
    <label for="inputperiod" class="col-sm-1 control-label">Target Periods </label>
    <div class="col-sm-5">
		<select class="chzn-select" name="period" required >
	
	<option value=""  selected="selected">---Select Target Periods---</option>

<?php 
					 
		
									 			$periods = $this->usermodel->populatealldatanoarraythree('periods', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($periods)) {

   foreach($periods as $periodsrow){

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




	<?php

}} else {
    echo 'No Period created.';
}
	
?>
		</select>
		<select class="chzn-select"  name="mode"  required>
							<option value="" >--Select mode of measurement--</option>

						<option value="no" selected="selected" >Number (No)</option>
						<option value="pct">Percentage (%)</option>

</select>
		
		</span>
	</div>
	
  	
	
	 
	   </div>
		<div class="col-md-12">
	<div class="form-group">
    <label for="inputtarget" class="col-sm-1 control-label">Target for the period: </label>
    <div class="col-sm-5">
	
		  		<input type="text" name="target" style="width:50%" value="<?php echo set_value('target'); ?>" class="form-control2" required placeholder="Enter  expected target value in % or No depending on your selection ">
		 
		
				<select class="chzn-select"  name="defaulttype"style="width:30%"  required>
							<option value=""  >--Default period?-</option>

						<option value="no" >No</option>
						<option value="yes" selected="selected">Yes</option>

</select>	
	</div>
  </div>
		
		
			
		
		
		
		
		
		
		
	<div class="form-group">
    <label for="inputyear" class="col-sm-1 control-label">Task type: </label>
    <div class="col-sm-5">
	
		<select class="form-control2" style="width:40%" name="tasktype"  required>
						<option value=""> --Select Task type--</option>
						<option value="General"   >General Task</option>
						<option value="Core" selected="selected"  >Core Task</option>


</select>
	
	
	
	
	
   			Year:	<input type="text" style="width:50%"name="year" value="<?php echo set_value('year',$year); ?>" id="year" class="form-control2"  placeholder="Enter year">
		 
				
		<span class="text-danger"> <?php echo form_error('year'); ?>
		
		</span>
	</div>
  </div>
	
		</div>
		
		
<div class="col-md-12">
	<div class="form-group">
    <label for="inputfromdate" class="col-sm-1 control-label">Start Date </label>
    <div class="col-sm-5">
	
		 		  <input type="date" name="fromdate" value="<?php echo set_value('fromdate',date("Y-m-d")); ?>" class="form-control" required placeholder="Enter start date YYY-MM-DD">

				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
		
		
			
		
		
		
		
		
		
		
		<div class="form-group">
    <label for="inputtodate" class="col-sm-1 control-label">Close Date: </label>
    <div class="col-sm-5">
	
		                      		  		<input type="date" name="todate" value="<?php echo set_value('todate',$finalnextyeardate); ?>" class="form-control" required placeholder="Enter start date">

				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
		</div>
		
					
				<div class="col-md-12">		
					
   <div class="form-group">
    <label for="inputbranchid" class="col-sm-1 control-label"></label>

    <div class="col-sm-5">     
	<select class="form-control" name="branchid"  id="branchid" required>
	

	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
	         <button type="submit"  name="btn_assigntask"  value="task"  class="btn btn-primary">Assign Task Now </button>
		

    </div>
  </div>
  <div class="form-group">
    <label for="inputdescription" class="col-sm-1 control-label">Target Description</label>
    <div class="col-sm-5">
	<textarea name="description" class="form-control" placeholder="Enter Target description/comments"><?php echo set_value('description'); ?></textarea> 

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

 }else{
 }
  ?>
	
		 
					
					
					<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> Task Type </th>

					<th>From Date </th>

		<th>Year </th>
			<th> Description </th>
										<th> Default </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);
			$employeename=$employee[0]['firstname'];	


					 
?>

										  
<a class="btn btn-default editbtn" id="editbtn" data-tasktype='<?php echo  $c->tasktype;?>' data-taskid='<?php echo  $c->taskid;?>' data-employeeid='<?php echo  $c->employeeid;?>'data-period='<?php echo  $c->period;?>'data-mode='<?php echo  $c->mode;?>'data-mytarget='<?php echo  $c->target;?>'data-branchid='<?php echo  $c->branchid;?>' data-todate='<?php echo  $c->todate;?>' data-fromdate='<?php echo  $c->fromdate;?>'data-year='<?php echo  $c->year;?>'data-defaulttype='<?php echo  $c->defaulttype;?>' data-description='<?php echo  $c->description;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 
<?php 
		
			echo$employeename;	


					 
?>
																
                                                </a>
												 
	 </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->tasktype; ?></td>

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

   

	  <td><?php echo $c->year ; ?></td>
	  <td><?php echo $c->description ; ?></td>
			  	  	  	  <td><?php echo $c->defaulttype ; ?></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-tasktype='<?php echo  $c->tasktype;?>' data-taskid='<?php echo  $c->taskid;?>' data-employeeid='<?php echo  $c->employeeid;?>'data-period='<?php echo  $c->period;?>'data-mode='<?php echo  $c->mode;?>'data-mytarget='<?php echo  $c->target;?>'data-branchid='<?php echo  $c->branchid;?>' data-todate='<?php echo  $c->todate;?>' data-fromdate='<?php echo  $c->fromdate;?>'data-year='<?php echo  $c->year;?>'data-defaulttype='<?php echo  $c->defaulttype;?>' 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 Task</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/assignmytask' , 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/assigntask" class="form-control" required placeholder="view ">


		  		

 	<div class="form-group">
    <label for="inputemployeeid" class="col-sm-2 control-label">User/ Employee</label>
    <div class="col-sm-10">
		
	
		<select class="form-control" name="employeeid" id="employeeid" required >
		<option value=""  selected="selected"></option>

	<option value=""  >---Select User / Employee to assign task---</option>

	


	<?php 
					 
		
									 			$myusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'id >',0,'category','user');


if(is_array($myusers)) {

   foreach($myusers as $myusersrow){

   //echo $courserow->coursename;
   ?>
<option value="<?=  $myusersrow->id;   ?>"><?=  $myusersrow->firstname. "  ".$myusersrow->surname."(".$myusersrow->id.")"; ?></option>




	<?php

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

  </div>	
  	</div>
	
	<div class="form-group">
    <label for="inputtaskid" class="col-sm-2 control-label">Task</label>
    <div class="col-sm-10">
		<select class="form-control" name="taskid"  id="taskid" required >
	
	<option value=""  selected="selected"></option>
	<option value=""  >---Select task to assign---</option>

	


	<?php 
					 
		
									 			$task = $this->usermodel->populatealldatanoarraythree('tasktype', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($task)) {

   foreach($task as $taskrow){

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




	<?php

}} else {
    echo 'No Task available.';
}
	
?>
</select>	
		  </div>	
  	</div>
		
		
				
			  <div class="form-group">
    <label for="inputperiod" class="col-sm-2 control-label">Target Periods </label>
    <div class="col-sm-10">
		<select class="form-control" name="period" id="period" required >
		<option value=""  selected="selected"></option>

	<option value=""  >---Select Target Periods---</option>

<?php 
					 
		
									 			$periods = $this->usermodel->populatealldatanoarraythree('periods', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($periods)) {

   foreach($periods as $periodsrow){

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




	<?php

}} else {
    echo 'No Period created.';
}
	
?>
		</select>
	
		
		</span>
	</div>
	
  	
	
	 
	   </div>
	     <div class="form-group">
    <label for="inputmode" class="col-sm-2 control-label">Default item: </label>
    <div class="col-sm-10">
		<select class="form-control"  name="defaulttype"   id="defaulttype"    required>
		<option value=""  selected="selected"></option>
							<option value="" >--Select Default item--</option>

						<option value="yes">Yes</option>
						<option value="no">No</option>

</select>
	</div>
	</div>
	
	
	
	  	
		<div class="form-group">
    <label for="inputyear" class="col-sm-2 control-label">Task type: </label>
    <div class="col-sm-10">
	
		<select class="form-control" style="width:60%" name="tasktype"  required>
						<option value=""> --Select Task type--</option>
						<option value="General" selected="selected"  >General Task</option>
						<option value="Core">Core Task</option>


</select>
	
	
	
	
	
   			Year:	<input type="text" style="width:40%"name="year" value="<?php echo set_value('year',$year); ?>" id="year" class="form-control2"  placeholder="Enter year">
		 
				
		<span class="text-danger"> <?php echo form_error('year'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
	
	
	
	
	   <div class="form-group">
    <label for="inputmode" class="col-sm-2 control-label">Target mode: </label>
    <div class="col-sm-10">
		<select class="form-control"  name="mode"  id="mode"  required>
							<option value="" >--Select mode of measurement--</option>
		<option value=""  selected="selected"></option>

						<option value="no">Number (No)</option>
						<option value="pct">Percentage (%)</option>

</select>
	</div>
	</div>
	
	<div class="form-group">
    <label for="inputtarget" class="col-sm-2 control-label">Target for the period: </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="target" id="mytarget" value="<?php echo set_value('target'); ?>" class="form-control" required placeholder="Enter  expected target value in % or No depending on your selection ">
		 
		
			
	</div>
  </div>
		
		
			
		
		
		
		
		
		
		
		<div class="form-group">
    <label for="inputyear" class="col-sm-2 control-label">Task type: </label>
    <div class="col-sm-10">
	
		<select class="form-control2" style="width:40%" name="tasktype" id="tasktype"  required>
				<option value=""  selected="selected"></option>

						<option value=""> --Select Task type--</option>
						<option value="General"  >General Task</option>
						<option value="Core">Core Task</option>


</select>
	
	
	
	
	
   			Year:	<input type="text" style="width:40%"name="year" value="<?php echo set_value('year',$year); ?>" id="year" class="form-control2"  placeholder="Enter year">
		 
				
		<span class="text-danger"> <?php echo form_error('year'); ?>
		
		</span>
	</div>
  </div>
	
		
		
	<div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">Start Date </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="fromdate"  id="fromdate"  value="<?php echo set_value('fromdate'); ?>" class="form-control" required placeholder="Enter  start date YYY-MM-DD ">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
		
		
			
		
		
		
		
		
		
		
		<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">Close Date: </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="todate" id="todate" value="<?php echo set_value('todate'); ?>" class="form-control" required placeholder="Enter  close date YYY-MM-DD ">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
		
		
					
					
   <div class="form-group">
    <label for="inputbranchid" class="col-sm-2 control-label">Counter</label>

    <div class="col-sm-10">     
	<select class="form-control" name="branchid"  id="branchid" required>
						<option selected="selected" value=""></option>


	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

    </div>
  </div>
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">Target Description</label>
    <div class="col-sm-10">
	<textarea name="description"  id="description" class="form-control" placeholder="Enter Target description/comments"><?php echo set_value('description'); ?></textarea> 

			
	</div>
  </div>
  
  

	
  
  	
		
  
  
  
 
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label"></label>
    <div class="col-sm-10">
	         <button type="submit"  name="btn_assigntask"  value="task"  class="btn btn-primary">Update Task Now </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">Task 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/viewtaskassigned' , 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="inputperiod" class="col-sm-2 control-label">Target Periods </label>
    <div class="col-sm-10">
		<select class="form-control" name="period" required >
	
	<option value=""  >---Select specifi Target Periods---</option>
	<option value="all"  selected="selected">I want View all tasks for all periods</option>

<?php 
					 
		
									 			$periods = $this->usermodel->populatealldatanoarraythree('periods', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($periods)) {

   foreach($periods as $periodsrow){

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




	<?php

}} else {
    echo 'No Period created.';
}
	
?>
		</select>
		
		
		</span>
	</div>
		</div>


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

						<?php
		
		 if($viewalltasks==true){
			 					//$allusers = $this->usermodel->populatealldatanoarraythree('productlist','expdate <>', '0000-00-00','expdate <', $currentdate,'companyid', $companyid);			   

			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
			?>
						<option value="all"  >All 	users</option>
<?php


 }else{
	 			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'userid',$userid,'status',1,'category','user');

	 
			//$allusers = $this->usermodel->populatealldatanoarray('people', 'id',$userid,'status',1);

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
						<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>




	<?php

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

	</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">

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

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

    

				</div>

		</div>
	    </div>
    </div>	
	
			
			
			
			
			
					
<div id="posttaskModal" 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">Post Task 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/assignedtasknow' , 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="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>

						<?php
		
		 if($viewalltasks==true){
			 					//$allusers = $this->usermodel->populatealldatanoarraythree('productlist','expdate <>', '0000-00-00','expdate <', $currentdate,'companyid', $companyid);			   
				$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');

			//$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
			?>
						<option value="all"  >All 	users</option>
<?php


 }else{
	 			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'userid',$userid,'status',1,'category','user');

	 
			//$allusers = $this->usermodel->populatealldatanoarray('people', 'id',$userid,'status',1);

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
						<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>




	<?php

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

	</div>
  </div>
  

	

			  <div class="form-group">
    <label for="inputperiod" class="col-sm-2 control-label">Target Periods </label>
    <div class="col-sm-10">
		<select class="form-control" name="period" required >
	
	<option value=""  selected="selected">---Select Target Periods---</option>
	<option value="all"  selected="selected">---View Everything---</option>

<?php 
					 
		
									 			$periods = $this->usermodel->populatealldatanoarraythree('periods', 'companyid',$companyid,'id >',0,'status','active');


if(is_array($periods)) {

   foreach($periods as $periodsrow){

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




	<?php

}} else {
    echo 'No Period created.';
}
	
?>
		</select>
	
		
		</span>
	</div>
		</div>
  	
	
	
	
	
	
	
	
	

	

    <div class="form-group">
    <label for="inputexactdate" class="col-sm-2 control-label">Task Date </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="exactdate" value="<?php echo  date("Y-m-d"); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('exactdate'); ?>
		
		</span>
	</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"> Post Task  </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>















