我可以使用以下代码打开打印页面但我想直接打印到打印机而不显示打印对话框。我需要直接打印2页。
<?php
require_once('config.php');
$date = '23-10-2017';
$department = '5';
$worked_time = dayClosure($department, $date, $conn);
function dayClosure($department, $date, $conn) {
echo $department;
echo $date;
$qClosure = 'SELECT * FROM timeRegistration WHERE department IN ("'. $department .'")';
$rClosure = mysqli_query($conn, $qClosure);
while($row = mysqli_fetch_assoc($rClosure)) {
if ($row['enddate'] == $date && $row['status'] == '3') {
$totalWorkedTime += $row['worktime'];
}
}
return $totalWorkedTime;
}
$amount_persons = 2;
$qDayClosure = 'INSERT INTO day_closures (date, department, amount_persons, worked_time) VALUES ("'. $date .'", "'. $department .'", "'. $amount_persons .'", "'. $worked_time .'")';
mysqli_query($conn, $qDayClosure);
?>