-
Notifications
You must be signed in to change notification settings - Fork 0
/
BilansPioniera.php
144 lines (120 loc) · 5.22 KB
/
BilansPioniera.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
require 'auth.php';
if (isset($_SESSION['TOTP']) && $_SESSION['TOTP'] = 'JW')
{?>
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Bilans pioniera</title>
<?php require "czesci/head";?>
</head>
<body>
<?php require "czesci/navbar_glowny";?>
<div class="table-responsive">
<table class="table table-dark text-center">
<thead>
<tr>
<th scope="col">Dzień</th>
<th scope="col">Godziny</th>
<th scope="col">Cel dzienny</th>
<th scope="col">Bilans</th>
</tr>
</thead>
<tbody>
<?php
$miesiac = $_SESSION['miesiac'];
$rok = $_SESSION['rok'];
require "ConnectToDB.php";
$KwBilansPioniera = "call BilansPioniera ($id_uzytkownika, 0,$miesiac,$rok)";
$BilansPioniera = mysqli_query($link, $KwBilansPioniera);
$ostatni = mysqli_fetch_array($BilansPioniera);
$ostatni = $ostatni['ostatni'];
for ($dzien = 1;$dzien <= $ostatni;$dzien++)
{
echo "<tr>";
require "ConnectToDB.php";
$KwBilansPioniera = "call BilansPioniera ($id_uzytkownika,$dzien,$miesiac,$rok)";
$BilansPioniera = mysqli_query($link, $KwBilansPioniera);
$Pionier = mysqli_fetch_array($BilansPioniera);
$godziny = $Pionier['godziny'];
$cel_dzienny = $Pionier['cel_dzienny'];
$bilans = $Pionier['bilans'];
$nazwa_dnia = $Pionier['nazwa_dnia'];
switch ($nazwa_dnia)
{
case 'Monday':
$nazwa_dnia = 'Poniedziałek';
break;
case 'Tuesday':
$nazwa_dnia = 'Wtorek';
break;
case 'Wednesday':
$nazwa_dnia = 'Środa';
break;
case 'Thursday':
$nazwa_dnia = 'Czwartek';
break;
case 'Friday':
$nazwa_dnia = 'Piątek';
break;
case 'Saturday':
$nazwa_dnia = 'Sobota';
break;
case 'Sunday':
$nazwa_dnia = 'Niedziela';
break;
default:
$nazwa_dnia = '';
break;
}
if ($bilans > '00:00')
{
echo "<th scope='row' class='bg-success'>" . $dzien . ' (' . $nazwa_dnia . ')' . "</th>";
echo "<td class='bg-success'>" . $godziny . "</td>";
echo "<td class='bg-success'>" . $cel_dzienny . "</td>";
echo "<td class='bg-success'>" . $bilans . "</td>";
}
if ($bilans == '00:00')
{
echo "<th scope='row' class='bg-warning'>" . $dzien . ' (' . $nazwa_dnia . ')' . "</th>";
echo "<td class='bg-warning'>" . $godziny . "</td>";
echo "<td class='bg-warning'>" . $cel_dzienny . "</td>";
echo "<td class='bg-warning'>" . $bilans . "</td>";
}
if ($bilans < '00:00')
{
echo "<th scope='row' class='bg-danger'>" . $dzien . ' (' . $nazwa_dnia . ')' . "</th>";
echo "<td class='bg-danger'>" . $godziny . "</td>";
echo "<td class='bg-danger'>" . $cel_dzienny . "</td>";
echo "<td class='bg-danger'>" . $bilans . "</td>";
}
}
echo "</tr>"; ?>
<tr>
<td class='font-weight-bold' colspan="3">Suma:</td>
<?php
require "ConnectToDB.php";
$KwBilansPionieraSuma = "call BilansPionieraSuma ($id_uzytkownika,$miesiac,$rok);";
$BilansPionieraSuma = mysqli_query($link, $KwBilansPionieraSuma);
$suma = mysqli_fetch_array($BilansPionieraSuma);
$suma = $suma['suma_celu'];
if ($suma >= '00:00')
{
echo "<td colspan='2' class='font-weight-bold bg-success'>" . $suma . "</td>";
}
else
{
echo "<td colspan='2' class='font-weight-bold bg-warning'>" . $suma . "</td>";
} ?>
</tr>
</tbody>
</table>
</div>
</body>
</html>
<?php
}
else
{
header("refresh:0;url=Logowanie.php?skad=BilansPioniera.php");
}?>