<?php require('../../includes/connection.php');require('../../includes/master/finance_functions.php');
$stmt = $GLOBALS['con']->prepare("SELECT * FROM `clientdetails` WHERE `clientnumber`=? ")or die(mysqli_error($GLOBALS['con']));
$stmt->bind_param('i',$_REQUEST['clientnumber']);$stmt->execute();$cr=$stmt->get_result();$stmt->close();
$cd=mysqli_fetch_array($cr);

echo checkStatus($_REQUEST['clientnumber']);

?>

<div class="row justify-content-between">
<div class="col-md-6">
<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="clientname">Clientname</label>
<div class="col-xs-12 col-md-9"><input class="form-control" type="text" name="clientname" id="clientname" value="<?php echo $cd['clientname']?>" /></div>
</div>

<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="agent_number">Agent</label>
<div class="col-xs-12 col-md-9"><?php echo listAgent($cd['agent_number'],'agent_number','name')?></div>
</div>

<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="account_handler">Account Handler</label>
<div class="col-xs-12 col-md-9"><input class="form-control" type="text" name="account_handler" id="account_handler" value="<?php echo $cd['account_handler']?>" /></div>
</div>

<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="contract_number">Contract Number</label>
<div class="col-xs-12 col-md-9"><input class="form-control" type="text" name="contract_number" id="contract_number" value="<?php echo $cd['contract_number']?>" /></div>
</div>

<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="incepton_date">Inception Date</label>
<div class="col-xs-12 col-md-9 input-group"><input class="form-control datepicker" type="text" name="incepton_date" id="incepton_date" value="<?php if($cd['incepton_date']==""){}else{ echo date('d-m-Y',$cd['incepton_date']);}?>" placeholder="DD-MM-YYYY"></div>
</div>

<div class="form-group row">
<label class="col-xs-12 col-md-2 control-label" for="rate_per_hour">Rate Per Hour</label>
<div class="col-xs-12 col-md-3"><input class="form-control" type="number" name="rate_per_hour" id="rate_per_hour" value="<?php echo $cd['rate_per_hour']?>" /></div>
</div>
</div>

<div class="col-md-2">
<ul class="list-group">
<li class="list-group-item"><a href="javascript:void(0)" onClick="renew('agent')">Renewal Notice (Agent)</a></li>
<li class="list-group-item"><a href="javascript:void(0)" onClick="renew('client')">Renewal Notice (Direct)</a></li>
<li class="list-group-item"><a href="javascript:void(0)" onClick="renew('agent')">Renewed</a></li>
<li class="list-group-item"><a href="javascript:void(0)" onClick="renew('agent')">Lapsed</a></li>
</ul>
</div>

</div>

<script>
function renew(i){
$('#popupBox .modal-body').html('');
$('#popupBox').modal('show');
$('#popupBox .modal-body').load('functions/finance_renewals.php',{'clientnumber':'<?php echo $_REQUEST['clientnumber']?>','mode':i});
}
</script>