    <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);
		  	     var createdate = $(this).data('createdate');
		   $("#createdate").val(createdate);
		   
        });
		
		
		
		
    </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");
      $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 Budget  </span>

				 	  				 <a href="<?php echo base_url();?>user/viewpurchases" class="btn btn-info"> Back </a>
				 	  				 <a href="<?php echo base_url();?>user/viewbudget" class="btn btn-info"> Refresh </a>
 <a data-toggle='modal' data-target='#purchaseModal' class="btn btn-default">View Budget Report</a>
 	  <a data-toggle='modal' data-target='#uploadbudgetModal' class="btn btn-default">Upload Budget </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( $viewserials==true){
 ?>
				   <li><a href="<?php echo base_url(); ?>user/viewserialnumbers">View Serials </a></li>

 
<?php	
}
  ?>
  
   <?php

 if( $viewdirectpurchases==true){
 ?>
                    <li><a href="<?php echo base_url(); ?>user/viewpurchases">View Purchase</a></li>

 
<?php	
}
  ?>
 <?php

 if( $viewquotation==true){
 ?>
                    <li><a href="<?php echo base_url(); ?>user/allquatation">View Quotation</a></li>

 
<?php	
}
  ?>
	  <?php

 if( $salesorder==true){
 ?>
 	  	  				 	  	                    <li> <a href="<?php echo base_url(); ?>user/salesorder"> Sales order</a>	</li>


 
<?php	
}
  ?>
  
  
  
   <?php

 if( $viewpurchase==true){
 ?>
 	  	  				 	  	  			                   <li> <a href="<?php echo base_url(); ?>user/allpurchaseorder">Purchases order</a>	</li>


 
<?php	
}
  ?>
  
  
  
    
   <?php

 if( $budget==true){
 ?>
 	  	  				 	  	  			                   <li> <a href="<?php echo base_url(); ?>user/viewbudget"> Budget</a>	</li>

 
<?php	
}
  ?>
  
  
  
	
	  <?php

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

 
<?php	
}
  ?>
	  		


  <?php

 if( $viewdebtors==true){
 ?>
 	  	  				 <a href="<?php echo base_url();?>user/allcreditors" class="btn btn-default"> All Debtors</a>

 
<?php	
}
  ?>
	  <?php

 if( $viewcreditors==true){
 ?>
 						 	  	  				 <a href="<?php echo base_url();?>user/viewallcreditors" class="btn btn-default"> All Creditors</a>

 
<?php	
}
  ?>			

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

            </div>
				 
            	</div>
            </div>
			<div class="panel-body" id="non-printable">


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

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



		
                 echo form_open('user/addbudget' , 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="usedamount" id="usedamount" value="0.00" class="form-control" required placeholder="Enter  actual amount used ">

		  		<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Insert ">
		  		<input type="hidden" name="view" value="user/viewbudget" class="form-control" required placeholder="view ">
		  		<input type="hidden" name="mycategoryid" value="" class="form-control" required placeholder="mycategoryid ">

 </div>   				<input type="hidden" name="todate"   id="todate" value="" id="todate" class="form-control"  placeholder="Enter closing date of the month">

	<div class="col-md-12">
 	<div class="form-group">
    <label for="inputcode" class="col-sm-1 control-label">Account</label>
    <div class="col-sm-5">
		
	
		<select class="chzn-select" name="code" required >
	
	<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. " ".$mybankingrow->number; ?></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-1 control-label">Expected Amount: </label>
    <div class="col-sm-5">
	
		  		<input type="number" name="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>
		<div class="col-md-12">

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

 <select name='month' class="form-control" required>
    <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-1 control-label">Year: </label>
    <div class="col-sm-5">
	
   				<input type="text" name="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>
		
		

					
				<div class="col-md-12">		
					
   <div class="form-group">
    <label for="inputdescription" class="col-sm-1 control-label"></label>

    <div class="col-sm-5"> 
   				<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" id="idno" class="form-control"  placeholder="Enter fromdate">
    
	         <button type="submit"  name="btn_budget"  value="budget"  class="btn btn-primary">Save Budget </button>

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

			
	</div>
  </div>
  
  
</div>
	
  
  	
		
  
  
	
	
  					<?php echo form_close();?>
					
		 </div>			
					
					
					<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
		   							<th>Account  </th>

  							<th>Budget  </th>
							  							<th>Actual   </th>
															<th>Balance </th>


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

			<th>From Date </th>
						<th>To Date </th>

										<th> User </th>

		<th id="non-printable">Staff</th>
		


                 </tr>
             </thead>
<?php
 if(!is_array($viewbudget)) {
				    echo '<div class="alert alert-danger text-center">There was no record found in the system</div>';

	
    }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>
												 
	<?php 
					// $branch="";
					 $branch=$c->code;

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->accountname;
 
 
}} else {
    echo 'General.';
}
	
?>
												 
	 </td>											 
												 
			
              
    <td><?php echo formatMoney($c->expamount , true); ?></td>

	    <td><?php echo formatMoney($c->usedamount , true); ?></td>

		    <td><?php echo formatMoney($c->balance , true); ?></td>

   

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

	  
	 <td><?php  $userids= $c->userid ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];

  ?></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-createdate='<?php echo  $c->createdate;?>'  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="addsupplierModal" 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">Add new  Campany/Customer</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addmember' , 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="status" value="1"id="status" class="form-control" required placeholder="Enter status">

<input type="hidden" name="view" value="user/allpurchaseorder"id="view" class="form-control" required placeholder="Enter status">


	
		  		<input type="hidden" name="category" readonly     value="<?php echo set_value('category','supplier'); ?>" class="form-control"  placeholder="Enter ocategory">
		 
				
				
						
						
					<div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Company Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" required value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>	
						
						
						
						
						
						
						
	<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label"> Contact	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>

  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Phone 2	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter other line e.g 254712345678">
		 
				
		<span class="text-danger">Other Number e.g 254712345678 <?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">Contact	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

	</div>
  </div>
  
  
  
  
    	<div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">	Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email" value="<?php echo set_value('email'); ?>" class="form-control"  placeholder="Enter Your email">
		 
				
		<span class="text-danger"> <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
  	
 
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">	ID Number	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter idno if any ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     
   	<div class="form-group">
    <label for="inputidnumber" class="col-sm-2 control-label">	PIN  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idnumber" value="<?php echo set_value('idnumber'); ?>" class="form-control"  placeholder="Enter Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idnumber'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Zip Code 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Zip Code">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
  	
 
  
    	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">		Website/Link 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter website if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate'); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="comments" value="<?php echo set_value('comments'); ?>"  class="form-control"  placeholder="Enter comments"></textarea>
			
		<span class="text-danger"> <?php echo form_error('comments'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-primary"> Add Campany   </button>

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

    

				</div>

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



		
	
	
	<div id="uploadbudgetModal" 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">Please Upload  Budget</h4>
		
      </div>
      <div class="modal-body">
       <a href="<?php echo base_url();?>downloads/budget.xlsx" class="btn btn-info">Download    template </a>	 

	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadbudget' , 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/viewbudget"id="view" class="form-control" required placeholder="Enter view">
	
		<div class="form-group">
    <label for="inputsurname" class="col-sm-2 control-label">	File to Upload</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of excel here..<?php echo form_error('file'); ?>
		
		</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" >--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="inputfromdate" class="col-sm-2 control-label">Budget Start Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$new_date); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</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">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="assets" name="btn_uploadbudget" class="btn btn-default">Upload Budget </button>

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

    

				</div>

		</div>
	    </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 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',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="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="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="budget">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewbudget">
 <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>















