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

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

if (!isset($_SESSION)) {
}

  
if (isset($_REQUEST["dd"])) {
	$myday = $_REQUEST["dd"];
} else {
	$myday = date("Y-m-d");
}
?>
<!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="../dist/css/bootstrap.css" />
	<script src="../js/jquery.js"></script>
	<script src="../dist/js/umd/popper.min.js"></script>
	<script src="../dist/js/bootstrap.js"></script>
</head>
<style>
	@import url(http://fonts.googleapis.com/earlyaccess/notosanskufiarabic.css);

	html {
		/* specifing the A4 dimensions for page*/
		width: 20cm;
		height: 27.7cm;
	}

	.form-control {
		display: block;
		width: 100%;
	}

	* {
		font-family: 'Noto Sans Kufi Arabic', sans-serif;
		margin: 0;
		padding: 3;
	}

	body {
		font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
		font-size: 13px;
		font-weight: bold;
		line-height: 1.2;
		color: #333;
		margin-top: 1cm;
		margin-right: 0cm;
		margin-bottom: 1cm;
		margin-left: 0cm;
		width: 20cm;
		height: 27.7cm;
	}

	button {
		visibility: hidden !important;
	}

	input {
		border: 0pt !important;
	}

	th {
		font-size: 13px;
	}

	.table>thead>tr>th,
	.table>tbody>tr>th,
	.table>tfoot>tr>th,
	.table>thead>tr>td,
	.table>tbody>tr>td,
	.table>tfoot>tr>td {
		padding: 3px;
		line-height: 1.2;
		font-size: 13px;
		border-top: 0px solid #ddd;
	}
</style>

<body onload="javascript: window.print(); setTimeout(window.close, 1000);">
	<div class="container-fluid">
		<!--<div class="form-row">-->
		<!--	<br style="line-height:255px;" />-->
		<!--</div>-->
		<br /> <br/><br/>
		<br /> <br/><br/>
		<br /> <br/><br/>
		<br /> <br/><br/>
		<br /> <br/><br/>
		<br /> <br/>
		<div class="form-row">
			<div class="col">
				<h6 class="text-right" style="font-size:12px;font-weight:bold;"><?php echo $myday; ?> الخزينة </h6>
			</div>
		</div>
		<div class="form-row">
			<div class="col">
				<table class="table table-bordered w-50 p-3">
					<thead>
						<tr>
							<th class="text-center" width="5%">م</th>
							<th class="text-left" width="20%">المبلغ</th>
							<th class="text-center" width="25%">كود</th>
							<th class="text-center" width="50%">البيان </th>
						</tr>
					</thead>
					<tbody id="tstandby">
						<?php
						$output = '';
						$sql = $conn->prepare("SELECT boxmoney.box_id ,  boxmoney.money_box , branches.b_name from boxmoney , branches
			WHERE boxmoney.pay_method = 1 AND boxmoney.branch = branches.branchID AND boxmoney.month_date = ?  order by boxmoney.box_id ");
						$sql->bindParam(1, $myday);
						$sql->execute();
						if ($sql->rowCount() > 0) {
							$sam = 0;
							$qq = 1;
							while ($row = $sql->fetch()) {
								$output .= '<tr>
									<td>' . $qq . '</td>
									<td class="text-center">' . $row['money_box'] . '</td>
									<td>' . $row['box_id'] . '</td>
									<td>' . $row['b_name'] . '</td>
									</tr>  ';
								$sam = $sam + $row['money_box'];
								$qq = $qq + 1;
							}
							$output .= '<tr>
											<td colspan="2" class="text-center">' . $sam . '</td>
											<td>إجمالي</td>
										</tr>';
						} else {
							$output .= '<tr><td colspan="4" >لا يوجد سجلات ...</td> </tr>';
						}
						echo $output;
						?>
					</tbody>
					<tfoot></tfoot>
				</table>
			</div><!-- home sanad in row -->
		</div><!-- end of banking money -->
	</div>
</body>

</html>