-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimpression_main_courante.php
executable file
·91 lines (79 loc) · 2.22 KB
/
impression_main_courante.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
include_once('./parametres.php');
try
{
$bdd = new PDO( DB_PDO_DSN, DB_USERNAME, DB_PASSWORD);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
} ?>
<html>
<head>
<title>Impression des Mains Courantes</title>
<meta charset="UTF-8" />
<style type="text/css">
.variable{
font-family: Courier;
font-type: monospace;
}
</style>
<script type="text/javascript">
function edition()
{
options = "Width=700,Height=700" ;
window.open( "impression_main_courante.php", "impression_main_courante", options ) ;
}
</script>
</head>
<body>
<?php
$sql = "SELECT date_heure, recu_de, emis_vers, degre_urgence, mode_transmission, message FROM main_courante ORDER BY `date_heure` DESC";
if ($res = $bdd->query($sql)) {
/* Récupère le nombre de lignes qui correspond à la requête SELECT */
if ($res->fetchColumn() > 0) {
/* Effectue la vraie requête SELECT et travaille sur le résultat */
$sql = "SELECT date_heure, recu_de, emis_vers, degre_urgence, mode_transmission, message FROM main_courante ORDER BY `date_heure` DESC";
foreach ($bdd->query($sql) as $row) {
switch( $row['degre_urgence']) {
case 'Urgent':
$text_color = "blue";
break;
case 'Immediat':
$text_color = "tomato";
break;
case 'Flash':
$text_color = "red";
break;
case 'Sauvetage Vie Humaine':
$text_color = "darksalmon";
break;
case 'Priorité Absolue':
$text_color = "orangered";
break;
case 'Routine':
default:
$text_color = "black";
}
//FIXME: Generate standard HTML output.
?>
<span style ="color: '.$text_color.';"><b><u><?php echo( $row['degre_urgence']); ?></u></b></span><br />
<br />
<b><?php echo( $row['date_heure']); ?></b><br />
<br />
Reçu de : <b><?php echo( strtoupper( $row['recu_de'])); ?></b> | Emis vers : <b><?php echo( strtoupper( $row['emis_vers'])); ?></b><br />
<br />
Mode de transmission : <b><?php echo( $row['mode_transmission']); ?></b><br /><br />
<span style="font-family: Courier; font-type: monospace;"><?php echo( $row['message']); ?></span><br />
<br />
*******************************************<br />
<br />
<?php
}
}
} ?>
<script type="text/javascript">
window.print() ;
</script>
</body>
</html>