<?php
/*
* date last modified 03-10-2017
* Edited by PI-Digi Logical Solutions
* HTML Files - manage_staff.html.php
* Mysql Tables - tbl_admin, tbl_purchase_order, tbl_admin_type
*/
require_once('./classes/class.noseo_pagination.php'); # pagination class
require_once('./includes/functions.php'); # general functions

if(isset($_REQUEST['p']) && $_REQUEST['p']!=''){
	$p = trim($_REQUEST['p']);
} else {
	$p = 1;
}

if(isset($_GET['action']) && $_GET['action'] == 'cancel') {	
	if(isset($_GET['id']) && $_GET['id']!=''){
		$update = mysqli_query($con,"DELETE FROM tbl_job_extra_tech WHERE id='".$_GET['id']."'");
		if($update) {
			$success = 'The request has been cancelled';
			?>
	        <script language="javascript" type="text/javascript">			
				window.location='index.php?page=<?php echo $page;?>&success=<?php echo $success; ?>&p=<?php echo $p;?>';
			</script>
	        <?php
		}
	}
}
/*
if(isset($_GET['action']) && $_GET['action'] == 'settled') {	
	if(isset($_GET['task_id']) && $_GET['task_id']!=''){
		$update = mysqli_query($con,"UPDATE tbl_job_disputes SET status = 'settled' WHERE task_id='".$_GET['task_id']."'");
		if($update) {
			$success = 'The dispute has been settled';
			?>
	        <script language="javascript" type="text/javascript">			
				window.location='index.php?page=<?php echo $page;?>&success=<?php echo $success; ?>&p=<?php echo $p;?>';
			</script>
	        <?php
		}
	}
}*/

$pageVars = '';


$select = "SELECT a.id AS task_id, a.technician_id AS tech_main_id, a.tech_request, b.id AS extra_id, b.technician_id AS tech_extra_id, b.commission_percent, b.commission, b.date FROM `tbl_job` a, `tbl_job_extra_tech` b WHERE a.id = b.job_id ORDER BY b.id DESC";
//echo $select;
// Using pagination class
$pagination = new pagination_noseo($select);
$execDetails = $pagination->createPages(30);

$pageLnk = 'index.php?page='.$page.'&'.$pageVars;
$pageNums = $pagination->pageNumber(5, $pageLnk);
?>