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

        });
	   </script>
	   
	   
 

         <script type="text/javascript">
  
		 function selectAllCheckBoxes(obj){
        $('input:checkbox:not(:disabled).checkBoxInLoop').prop('checked', jQuery(obj).prop('checked'));
    }

    function unselectCheckBoxUnik(){

        /*first you verify if the quantity of checkboxes equals number of checkboxes*/
        a = $('input:checkbox:not(:disabled).checkBoxInLoop:checked').size();
        b = $('input:checkbox:not(:disabled).checkBoxInLoop').size();

        /*if equals, mark a checkBoxUnik*/
        ((a == b)? $('#checkBoxUnik').prop("checked", true) : $('#checkBoxUnik').prop("checked", false));
    }

		
		
		
		
		
		 $(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);
		  	     var createdate = $(this).data('createdate');
		   $("#createdate").val(createdate);
		   
		    var qty = $(this).data('qty');
		   $("#qty").val(qty);
		   
        });
		
		
		
		
    </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');
 $fromdate=date("Y-m-d 00:00:00");
 $todate=date("Y-m-30 23:59:59");
      $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);
	   	      $viewserials=$this->usermodel->populatuserpermissionsdataarray('purchases','viewserials',$userid);

	   $viewquotation=$this->usermodel->populatuserpermissionsdataarray('purchases','viewquotation',$userid);
  $viewpurchase=$this->usermodel->populatuserpermissionsdataarray('purchases','viewpurchase',$userid);
   $salesorder=$this->usermodel->populatuserpermissionsdataarray('purchases','salesorder',$userid);
	   	      $viewdirectpurchases=$this->usermodel->populatuserpermissionsdataarray('purchases','viewdirectpurchases',$userid);

  $budget=$this->usermodel->populatuserpermissionsdataarray('purchases','budget',$userid);
    $addpeople=$this->usermodel->populatuserpermissionsdataarray('members','add',$userid);

  
$viewdebtors=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewdebtors',$userid);
  $viewcreditors=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewcreditors',$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 Requisted Items   </span>

				 	  				 <a href="<?php echo base_url();?>user/viewprojets" class="btn btn-info"> Back </a>
				 	  				 <a href="<?php echo base_url();?>user/viewprojets" class="btn btn-info"> Refresh </a>
									 				 	  				 <a href="<?php echo base_url();?>user/viewexpenses" class="btn btn-info"> Post expenses </a>
													 <a href="<?php echo base_url();?>user/viewpurchases" class="btn btn-info"> Post purchases </a>
													 <a href="<?php echo base_url();?>user/allquatation" class="btn btn-info"> Post Requistition </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 class="collapse navbar-collapse" id="app-navbar-collapse">
             <ul class="nav navbar-nav">

	  <?php

 if( $addpeople==true){
 ?>
                         <a data-toggle='modal' data-target='#addsupplierModal' class="btn btn-default">Add Campany </a>

 
<?php	
}
  ?>
	  		


			  
				 
                </ul>
					
                <!-- Right Side Of Navbar -->

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

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



  
  	
		
<?php 
 
 	//$serial = $userid.time();
                 echo form_open('user/bulkrequistion' , 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;?>		
		
  

  <table cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped table-hover" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
       <tr>
	   
	   		   							 <th> <input type="checkbox" onclick="selectAllCheckBoxes(this)" id="checkBoxUnik"/>All
</th>
	<th>Approved Qty 



	</th>

		<th>Request Qty </th>
			<th>Issued Qty </th>
					<th>Bal Qty </th>
									   							<th>Item Name  </th>
  		
															<th>Approved </th>



		
		<th>Uom </th>

			<th>From Date </th>
			<th>Description</th>

		


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

	
    }else {
?>
    
            
 
  
 
 
 
 
 
  <?php 
 
  $ttexpected=0;
  $ttused=0;
  $ttbalance=0;
  	foreach ($viewbudget as $c){

	
	
			
		  $ttexpected= $ttexpected+$c->expamount;
  $ttused= $ttused+$c->usedamount;
  $ttbalance=$ttbalance+$c->balance;

             ?>


			
	
	 
			 
			 
			 
			 
			 
			 
			 
			 
			 

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


?>

				<td>
			<input name="selector[]" type="checkbox" onclick="unselectCheckBoxUnik()" class="checkBoxInLoop" value="<?php echo $c->id ; ?>">
				</td>
						<td>
													
 		<input type="hidden" name="subtaskid" id="subtaskid" value="<?php echo set_value('subtaskid',$c->subtaskid); ?>" class="form-control" required placeholder="subtaskid" >

 		<input type="hidden" name="taskid" id="taskid" value="<?php echo set_value('taskid',$c->taskid); ?>" class="form-control" required placeholder="taskid" >

			 	  
  							
													
		<input type="hidden" name="myid[]" id="myid" value="<?php echo set_value('myid',$c->id); ?>" class="form-control"  placeholder="myid" >


					<input type="text"  name="usedqty[]" id="usedqty" value="<?php echo set_value('usedqty',""); ?>" class="form-control"  placeholder="Qty" >

													
													</td>
			

   <td><?php echo $c->qty ; ?></td>
      <td><?php echo $c->usedqty ; ?></td>

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


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

					 $branch= $this->usermodel->populateall('products','code',$code);



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'General.';
}
	
?>
												 
	 </td>											 
												 
						<input type="hidden" name="invoice[]" id="invoice" value="<?php echo set_value('invoice',$c->invoice); ?>" class="form-control" required placeholder="invoice" >
			
  
<td>
 <select name='status' id='status'  class="form-control" required>

    <option value=''  >--Select Approved status--</option>
	    <option selected="selected" value='<?php echo set_value('status',$c->status); ?>'><?php echo $c->status; ?></option>

    <option  value='Approved'>Approved</option>
    <option value='Rejected'>Rejected</option>
   <option  value='Pending'>Pending</option>
    <option value='New'>New</option>
    </select> 




		    </td>

   


   
   
   
   
   
   
   
   
	  <td><?php echo $c->uom ; ?></td>
	  
	  	  <td><?php echo $c->createdate ; ?></td>
	
	  	  <td>
		  
		  					<input type="text"  name="description[]" id="description" value="<?php echo set_value('description'); ?>" class="form-control"  placeholder="Description" >

		  
		  </td>


     	
                  
             </tr>

			 
			 	
			 
			 
			 

	<?php 
	};
	?>
	
             <tfoot>
       <tr>
	   
	  <th colspan="11"> 
<button type="submit"  value="bulkinsertrquest" name="btn_bulkrequst" class="btn btn-primary"> Dispatch Request  </button>
										 <?php echo form_close();?>	

		
		
		</th>


                 </tr>
             </tfoot>
		
			 
	
	
	
		<?php
	} ?>

          
 
        </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="inputclosingtype" class="col-sm-2 control-label">Closing type </label>
    <div class="col-sm-10">

 <select name='closingtype' id='closingtype'  class="form-control" required>

    <option value=''  >--Select Closing action type--</option>
	    <option selected="selected" value='Automatic'>Automatic closing</option>

    <option  value='Manual'>Manual closing</option>
    <option value='Update'>Just want to update data</option>

    </select> 		 
				
		
		</span>
	</div>
  </div>








<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 Item---</option>

	

					<option value="<?=  $mybankingrow->code;   ?>"><?=  $mybankingrow->name," " .$mybankingrow->code; ?></option>



	<?php 
					// 
		
											$mybanking= $this->usermodel->populatealldatanoarray('productlist','companyid',$companyid,'status','active');


if(is_array($mybanking)) {

   foreach($mybanking as $mybankingrow){

   //echo $courserow->coursename;
   ?>
					<option value="<?=  $mybankingrow->code;   ?>"><?=  $mybankingrow->name," " .$mybankingrow->code; ?></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',0); ?>" 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="inputqty" class="col-sm-2 control-label">Actual Qty: </label>
    <div class="col-sm-10">
	
		  		<input type="number" name="qty" id="qty" value="<?php echo set_value('qty'); ?>" class="form-control" required placeholder="Enter  qty ">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>	
			
		
		<div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date: </label>
    <div class="col-sm-10">
	
   				<input type="text" name="fromdate"  id="createdate" value="<?php echo set_value('createdate'); ?>" id="createdate" class="form-control"  placeholder="Enter Start date of the month">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
		
		<div class="form-group">
		    <label for="inputfromdate" class="col-sm-2 control-label">Closing Date: </label>

    <div class="col-sm-10">
	
   				<input type="date" name="todate" required  id="todate" value="<?php echo set_value('todate'); ?>" id="todate" class="form-control"  placeholder="Enter closing date of the month">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</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="projectsbudget">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewmybudget?randomitemidentifier=<?php  echo $projectid;  ?>">
 <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>















