HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/www/m.beatleanalytics.com/application/views/beatleAdmin/managepurchase.php
<?php 
	include('include/header.php');
	 $this->load->model('Admin_model');
?>
<script>
  $(document).ready(function(){
	  // ================== DELETE USER START FROM HERE ========================
 
		 $(".deluser").click(function(){
			var txt;
			var r = confirm("Would you like to delete this data");
			if (r == true) 
			{
				var deluser = $(this);
				var id = deluser.attr('data-uid');
				 
				var token = 'deleteuser';		
				 $.ajax({
					
					type : 'POST',
					url	 : 'deleteUserById',
					data : {id:id,token:token},
					success : function(res)
					{ 
						//alert(res);
						$("#rowid_"+id).hide('500');
					}			
					
				 });
			} 
			else 
			{
					
			}
			 
		 });
 
			$("#searchUser").change(function()
			{
				var usertype = $("#searchUser").val();
				 
				  $.ajax({
					
					type : 'POST',
					url	 : 'SearchUserByType',
					data : {usertype:usertype},
					success : function(res)
					{  
						if (res)
						{
							$("#hidedata").hide();
							$("#showdata").html(res);
						}
					}			
					
				 });
			});
			
			
	$('#example').DataTable();
	
	
	   
	   
                      
	  $('#startdate').daterangepicker({
		  singleDatePicker: 0,
		  singleClasses: "picker_1"
		}, function(start, end, label) {
		  console.log(start.toISOString(), end.toISOString(), label);
	  });
  });
  </script> 
  
  <style>
	.ajaxcalldata
	{
		padding:5px;
		color:#FFF;
		cursor:pointer;
		background-color:rgb(76,76,76);
	}
	 .success_div
	{
		padding:100%; padding:10px; color:#FFF; background-color:#42af42;border-radius:4px; text-align:center;margin-top:20px;
	}
	.error_div
	{
		padding:100%; padding:10px; color:#FFF; background-color:#FF0000;border-radius:4px; text-align:center;margin-top:20px;
	}
  </style>

	<?php 
	
	if(($this->uri->segment(3) != '' || $this->uri->segment(3) == 'email' || $this->uri->segment(3) == 'sms' || $this->uri->segment(3) == 'whatsapp') && $this->uri->segment(4) != 'edit') {  
	
	/*echo '<pre style="margin-left:200px;">';
	print_r($productData);
	echo '</pre>';*/
	
	?>
    <div class="right_col" role="main">
          <div class="">
		   <div class="col-md-12 col-sm-12 col-xs-12">
		   
		   
		   
		    <!-----------------------new theme--------------------------------->
		  
		  <div class="new-theme">
		   <h1>Purchase Manage</h1>
		   
		   <br>
<table id="datatable" class="table table-striped new-table"> 
    <thead>
      <tr>
						 <th>Request ID</th>
                          <th>Org. Name</th>
                          <th>Quantity</th>
                          <th>Date</th>
                          <th>status</th>
                          <th style="max-width:50px !important;">Action</th>
      </tr>
    </thead>
           <tbody>
					  <?php 
					  
					  		//echo "<pre>";
					  		//print_r($productData);
							//echo "</pre>";
					  
							if (empty($productData)){ ?>
							<tr class="ng-hide">
								<td colspan="13"><h1 class="text-center text-muted ng-scope">No any data found.</h1><!-- end ngIf: !UsersList.ui.loading --></td>
							</tr>
						<?php } else {
									foreach ($productData as $keyuser=>$valuser){
										
						?>							
                        <tr id="rowid_<?php echo $valuser->purchaseid;?>">
                          <td align="left"><?php echo $valuser->uiqueid;?></td>
                          <?php
						  	$objOrg = $this->Admin_model->getOrganizationById($valuser->orgid);
                          ?>
                          <td align="left"><?php echo $objOrg[0]->db_Orgname;?></td>
                          <td align="left"><?php echo $valuser->quantity;?></td>
                          <td align="left"><?php echo date("d/m/Y",strtotime($valuser->created_date));?></td>
                          <td align="left"><?php echo $valuser->status;?></td>
						  <td align="center" style="max-width:50px !important;">
                          
							<ul class="nav navbar-right panel_toolbox">
							  <li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
								<ul class="dropdown-menu" role="menu">
								  <li><a href="<?php echo base_url() ?>index.php/beatleAdmin/managepurchase/<?php echo $this->uri->segment(3)?>/edit/<?php echo $valuser->purchaseid;?>">Edit</a>
								  </li>
								  <li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->purchaseid;?>">Delete</a>
								  </li>
								</ul>
							  </li>
							  </li>
							</ul></td>
                        </tr>
                        
						<?php 
									//}
								}
							}
						?>
                      </tbody>
  </table>
  
  </div>
		  
		  <!-----------------------// new theme------------------------------------->
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
		   
                <div class="x_panel"  style="display:none;">
                  <div class="x_title">
                    <h2>Purchase Manage---------<small></small></h2>
                      <!-- <ul class="nav navbar-right panel_toolbox">
                          <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                          </li>
                          <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                            <ul class="dropdown-menu" role="menu">
                              <li><a href="#">Settings 1</a>
                              </li>
                              <li><a href="#">Settings 2</a>
                              </li>
                            </ul>
                          </li>
                          <li><a class="close-link"><i class="fa fa-close"></i></a>
                          </li>
                        </ul> -->
                    <div class="clearfix"></div>
                  </div>
                  
                  <div class="x_content">

                    <table id="datatable" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Request ID</th>
                          <th>Org. Name</th>
                          <th>Quantity</th>
                          <th>Date</th>
                          <th>status</th>
                          <th style="max-width:50px !important;">Action</th>
						 </tr>
                      </thead>


                      <tbody>
					  <?php 
					  
					  		//echo "<pre>";
					  		//print_r($productData);
							//echo "</pre>";
					  
							if (empty($productData)){ ?>
							<tr class="ng-hide">
								<td colspan="13"><h1 class="text-center text-muted ng-scope">No any data found.</h1><!-- end ngIf: !UsersList.ui.loading --></td>
							</tr>
						<?php } else {
									foreach ($productData as $keyuser=>$valuser){
										
						?>							
                        <tr id="rowid_<?php echo $valuser->purchaseid;?>">
                          <td align="left"><?php echo $valuser->uiqueid;?></td>
                          <?php
						  	$objOrg = $this->Admin_model->getOrganizationById($valuser->orgid);
                          ?>
                          <td align="left"><?php echo $objOrg[0]->db_Orgname;?></td>
                          <td align="left"><?php echo $valuser->quantity;?></td>
                          <td align="left"><?php echo date("d/m/Y",strtotime($valuser->created_date));?></td>
                          <td align="left"><?php echo $valuser->status;?></td>
						  <td align="center" style="max-width:50px !important;">
                          
							<ul class="nav navbar-right panel_toolbox">
							  <li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
								<ul class="dropdown-menu" role="menu">
								  <li><a href="<?php echo base_url() ?>index.php/beatleAdmin/managepurchase/<?php echo $this->uri->segment(3)?>/edit/<?php echo $valuser->purchaseid;?>">Edit</a>
								  </li>
								  <li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->purchaseid;?>">Delete</a>
								  </li>
								</ul>
							  </li>
							  </li>
							</ul></td>
                        </tr>
                        
						<?php 
									//}
								}
							}
						?>
                      </tbody>
                    </table>
                  </div>
                </div>
            
		  </div>
    </div>

    <?php  }
	else if($this->uri->segment(4) == 'edit' && $this->uri->segment(5) != '') {  ?>
    	<div class="right_col" role="main">
          <div class="">
             


            <div class="row">
			<?php if (!empty($message) && $message == 'img_size_error'){  ?>
			   <div class="error_div">
					Banner size suhould be match with our criteria ( Height 400 to 500) X ( Width 1000 to 1200)
.
			   </div>
		   <?php } else if (!empty($message) && $message == 'title_taken'){?>
				<div class="error_div">
					Title has been taken, please try again with different title.
			   </div>
			<?php } else if (!empty($message) && $message == 'img_ext_error'){?>
				<div class="error_div">
					Please select image from slected format only.(jpg, jpeg, png)
			    </div>
		   <?php }else if (!empty($message) && $message == 'success'){ ?>
				<div class="success_div">
					Purchase request data upldated successfuly.
				</div>		
		    <?php } ?>
            
              <div class="col-md-12 col-sm-12 col-xs-12">
			    <h1 class="sub-model">Manage Purchase Data </h1>
				<br>
			   <!----test 3-5-2018------------>
				   <form class="form-horizontal form-label-left" novalidate name="createUserForm" method="post" id="createUserForm" action="" enctype="multipart/form-data" >
 						
                      <?php
					   // echo "<pre>";
					   //	print_r($data);
					   //	echo "</pre>";

						$orgname = "";
						$mainOrgId =  "";
						$orgid_edit =  "";
						$title =  "";
						$spoint =  "";
						$epoint =  "";
						$description =  "";
						$startdate = "";
						$comment = "";
							
						
					  
					  	$name = "";
						$points = "";
						$stock = "";
						
					  	if($this->uri->segment(4) == 'add'){
							echo '<input type="hidden" name="actionfollow" value="addnewproducts" >';	
						}else if($this->uri->segment(4) == 'edit'){
							
							//print_r($productData);
							$orgid = $productData[0]->orgid;
							$status = $productData[0]->status;
							$Qty	= $productData[0]->quantity;
							//$description = $productData[0]->description;
							//$startdate = date("m/d/Y",strtotime($productData[0]->startdate))." - ".date("m/d/Y",strtotime($productData[0]->enddate));
							
							echo '<input type="hidden" name="actionfollow" value="editproducts" >';
							echo '<input type="hidden" name="points" value="'.$productData[0]->quantity.'" >';
							echo '<input type="hidden" name="orgid" value="'.$productData[0]->orgid.'" >';
							echo '<input type="hidden" name="purid" value="'.$productData[0]->purchaseid.'" >';
						}
						
						if(isset($data)){
							
							//$comment = $data['description'];
							//$startdate = $data['startdate'];
							//$startdate = date("m/d/Y",strtotime($data['startdate']))." - ".date("m/d/Y",strtotime($data['enddate']));
						}
						
                      ?>
                     <!-- <span class="section">Personal Info</span>-->

                       
                      
					   
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 no-padding" for="Stocks">Org. Name<span class="required">*</span>
                        </label>
                        <div class="label-sub col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	
							$objOrg = $this->Admin_model->getOrganizationById($orgid);
                          	echo $objOrg[0]->db_Orgname;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 no-padding" for="Stocks">Quantity : 
                        </label>
                        <div class="label-sub  col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	echo $Qty;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 no-padding" for="Stocks">Current status : 
                        </label>
                        <div class="label-sub  col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	echo $status;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Change status : <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                        		<?php if($status != 'cancel') { ?>
		                          <select  onchange="javascript" id="status" name="status" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern">
                                	<?php if($status != 'new') { ?> <option <?php if($status == 'new') echo 'selected="selected"';?> value="new">New</option> <?php } ?>
                                    <?php if($status != 'approved') { ?><option <?php if($status == 'approved') echo 'selected="selected"';?> value="approved">Approved</option><?php } ?>
                                    <?php if($status != 'reject') { ?><option <?php if($status == 'reject') echo 'selected="selected"';?> value="reject">Reject</option><?php } ?>
                                    <?php if($status != 'hold') { ?><option <?php if($status == 'hold') echo 'selected="selected"';?> value="hold">Hold</option><?php } ?>
                                 </select>
                                <?php } else{
									echo "Cancelled by owner";
								}?>
                          
                        </div>
                      </div>
                      
                      <!--<div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="addUserEmail2">Comment<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                        <textarea id="description" name="description" autocomplete="off" placeholder="News description at here"  class="form-control col-md-7 col-xs-12"><?php echo $comment?></textarea>
                        </div>
                      </div> -->
                      
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button type="submit" class="btn btn-primary">Cancel</button>
						  <input type="submit" class="btn btn-success" <?php if (!empty($productData)){echo 'name="editusersubmit" id="editusersubmit"';}else{ echo 'name="addusersubmit" id="addusersubmit"';}?> value="Submit">
                        </div>
                      </div>
					  
                    </form>
				  <!-----//test-3-5-2018------------->
			  
                <div class="x_panel" style="display:none;">
                  <div class="x_title">
				 
				  
				  
				  
				  
                    <h2>Manage Purchase Data  </h2>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

                    <form class="form-horizontal form-label-left" novalidate name="createUserForm" method="post" id="createUserForm" action="" enctype="multipart/form-data" >
 						
                      <?php
					   // echo "<pre>";
					   //	print_r($data);
					   //	echo "</pre>";

						$orgname = "";
						$mainOrgId =  "";
						$orgid_edit =  "";
						$title =  "";
						$spoint =  "";
						$epoint =  "";
						$description =  "";
						$startdate = "";
						$comment = "";
							
						
					  
					  	$name = "";
						$points = "";
						$stock = "";
						
					  	if($this->uri->segment(4) == 'add'){
							echo '<input type="hidden" name="actionfollow" value="addnewproducts" >';	
						}else if($this->uri->segment(4) == 'edit'){
							
							//print_r($productData);
							$orgid = $productData[0]->orgid;
							$status = $productData[0]->status;
							$Qty	= $productData[0]->quantity;
							//$description = $productData[0]->description;
							//$startdate = date("m/d/Y",strtotime($productData[0]->startdate))." - ".date("m/d/Y",strtotime($productData[0]->enddate));
							
							echo '<input type="hidden" name="actionfollow" value="editproducts" >';
							echo '<input type="hidden" name="points" value="'.$productData[0]->quantity.'" >';
							echo '<input type="hidden" name="orgid" value="'.$productData[0]->orgid.'" >';
							echo '<input type="hidden" name="purid" value="'.$productData[0]->purchaseid.'" >';
						}
						
						if(isset($data)){
							
							//$comment = $data['description'];
							//$startdate = $data['startdate'];
							//$startdate = date("m/d/Y",strtotime($data['startdate']))." - ".date("m/d/Y",strtotime($data['enddate']));
						}
						
                      ?>
                     <!-- <span class="section">Personal Info</span>-->

                       
                      
					   
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Org. Name<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	
							$objOrg = $this->Admin_model->getOrganizationById($orgid);
                          	echo $objOrg[0]->db_Orgname;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Quantity : 
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	echo $Qty;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Current status : 
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <?php
						  	echo $status;
						  ?>
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Change status : <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                        		<?php if($status != 'cancel') { ?>
		                          <select  onchange="javascript" id="status" name="status" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern">
                                	<?php if($status != 'new') { ?> <option <?php if($status == 'new') echo 'selected="selected"';?> value="new">New</option> <?php } ?>
                                    <?php if($status != 'approved') { ?><option <?php if($status == 'approved') echo 'selected="selected"';?> value="approved">Approved</option><?php } ?>
                                    <?php if($status != 'reject') { ?><option <?php if($status == 'reject') echo 'selected="selected"';?> value="reject">Reject</option><?php } ?>
                                    <?php if($status != 'hold') { ?><option <?php if($status == 'hold') echo 'selected="selected"';?> value="hold">Hold</option><?php } ?>
                                 </select>
                                <?php } else{
									echo "Cancelled by owner";
								}?>
                          
                        </div>
                      </div>
                      
                      <!--<div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="addUserEmail2">Comment<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                        <textarea id="description" name="description" autocomplete="off" placeholder="News description at here"  class="form-control col-md-7 col-xs-12"><?php echo $comment?></textarea>
                        </div>
                      </div> -->
                      
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button type="submit" class="btn btn-primary">Cancel</button>
						  <input type="submit" class="btn btn-success" <?php if (!empty($productData)){echo 'name="editusersubmit" id="editusersubmit"';}else{ echo 'name="addusersubmit" id="addusersubmit"';}?> value="Submit">
                        </div>
                      </div>
					  
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
		  </div>
        
    <?php } ?>
	
<?php include ('include/footer.php'); ?>