<?php
require_once __DIR__ . '/../magic/auth.php';

$auth = bdr_require_privilege([5, 20], '../logout.php');
$user = $auth['user_id'];
$father = $auth['user_id'];
$branch = $auth['branch'];
$conn = $auth['conn'];
$db = $auth['conn'];

if (!isset($_SESSION)) {
}
$sanad = $_REQUEST['sanad'];
include "../op/number_text.php";
$sql = $db->prepare("SELECT ak.id , ak.contract_id , ak.money_add , ak.date_payed , ak.payMethod , ak.comm , us.realName
					FROM `aksat_addition` as ak , users as us
					WHERE ak.father = us.user_Id AND ak.id = ?");
$sql->bindParam(1, $sanad);
$sql->execute();
if ($sql->rowCount() > 0) {
	$result = $sql->fetch(PDO::FETCH_ASSOC);
}
$payy =  $result['payMethod'];
switch ($payy) {
	case "1":
		$pay =  "كاش";
		break;
	case "2":
		$pay =  "تحويل الراجحي";
		break;
	case "3":
		$pay =  "نقاط بيع";
		break;
	case "4":
		$pay = "فواتير";
		break;
	case "5":
	$pay = "تحويل الأهلي";
			break;
}

?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>الوسام المعتمد</title>
	<link rel="stylesheet" href="../css/bootstrap.css" />
	<link rel="stylesheet" href="../css/sanad.css" />
	<script src="../js/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>
	<script src="../hj2/jquery.plugin.js"></script>
	<script src="../hj2/jquery.calendars.js"></script>
	<script src="../hj2/jquery.calendars.plus.js"></script>
	<script src="../hj2/jquery.calendars.ummalqura.js"></script>
</head>
<body onload="javascript: window.print(); setTimeout(window.close, 2500);">
    <div class="row">
        <h1>_</h1>
    </div>
        <br /> <br/> <br/>
        <br /> <br/><br />
        <br />

	<div class="col-xs-12" style="float:right;">
		<form method="post" class="form-horizontal " style="float:center;" id="new_sanad">
	<!--	    	<div class="row" style="padding:0 ;">-->
	<!--	<br style="line-height:5000px;" />-->
	<!--</div>-->
			<div class="row" style="padding:0 ;">
				<div class="col-xs-3" style="float:right;">
					<input readonly type="text" class="form-control text-center" style="font-weight:bold;" value="<?php echo $result['id']; ?>" />
				</div>
				<div class="col-xs-6" style="padding:0;float:right;font-size:12px;">
					<input readonly type="text" style="font-weight:bold;" class="form-control text-center" value=" سداد إضافي عقد <?php echo $result['contract_id']; ?> " />
				</div>
				<div class="col-xs-3" style="float:left;">
					<input type="text" class="form-control text-left" style="font-weight:bold;" value="<?php echo $result['contract_id']; ?>" />
				</div>
			</div>
			<div class="row" style="padding:0 ;">
				<div class="col-xs-3" style="float:right;">
					<input readonly type="text" class="form-control text-center" style="font-weight:bold;" value="<?php echo $result['date_payed']; ?>" />
				</div>
				<div class="col-xs-2" style="padding:0; float:left;">
					
				</div>
			</div>
			<div class="row" style="padding:0 ;">
				<div class="col-xs-3" style="float:right;">
					<input readonly type="text" class="form-control text-left" style="font-weight:bold;font-size:12pt;" value="<?php echo "# " . $result['money_add'] . " #"; ?>" />
				</div>
				<div class="col-xs-7" style="padding:2; float:right;">
					<input readonly type="text" class="form-control text-right" style="margin-right:11px;font-size:10pt;" value=" <?php echo samTXT($result['money_add']); ?> لا غير " />
				</div>
				<div class="col-xs-2" style="float:right;">
					<input readonly type="text" class="form-control text-right" style="font-size:9pt;" value="<?php echo $pay; ?>" />
				</div>
			</div>
			<div class="row" style="padding:0 ;">
				<div class="col-xs-9" style="padding:0; float:left;">
					<input readonly type="text" class="form-control text-right" value="<?php echo $result['comm']; ?>" />
				</div>
			</div>
			<div class="row" style="padding:0 ;">
	
			</div>
			<div class="row" style="padding:0 ;">
				<div class="col-xs-3" style="float:left;">
					<input readonly type="text" class="form-control text-left" value="<?php echo $result['realName']; ?>" />
				</div>
			</div>
		</form>
	</div>
	<!-- <script>
	    onload="javascript: window.print(); setTimeout(window.close, 1000);"
	</script> -->
</body>

</html>