881 lines
34 KiB
PHP
881 lines
34 KiB
PHP
<?
|
|
|
|
$sprawdzanie_uzytkownika=mysql_query("select uprawnienia1 from uzytkownicy where uprawnienia1='0' and id='".$_SESSION['id']."'") or die(mysql_error());
|
|
|
|
if(mysql_num_rows($sprawdzanie_uzytkownika)>0)
|
|
|
|
{
|
|
|
|
echo '<table width="740" border="0" align="center">
|
|
|
|
<tr>
|
|
|
|
<td><div align="center"><a class= link href="?co=tankowania&kto=dodaj">Dodaj Tankowanie</a></div></td>
|
|
|
|
<td><div align="center"><a class=link href="?co=tankowania&kto=show">Zarzadzaj Tankowaniem - wszystkie</a></div></td>
|
|
|
|
<td><div align="center"><a class=link href="?co=tankowania&kto=show2">Zarzadzaj Tankowaniem - 30 dni</a></div></td>
|
|
|
|
</tr>
|
|
|
|
</table><p>';
|
|
|
|
IF(isset($_GET['akcja']))
|
|
|
|
{
|
|
|
|
switch($_GET['akcja'])
|
|
|
|
{
|
|
|
|
case "pokaz":
|
|
|
|
form_poka¿_tankowania($_GET['id_tan']);
|
|
|
|
BREAK;
|
|
|
|
case "edytuj":
|
|
|
|
if(!is_numeric($_GET['id_tan']))
|
|
|
|
uwaga(BLAD. ' Brak danych!');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!isset($_POST['edytuj_tankowania']))
|
|
|
|
form_edytuj_tankowania($_GET['id_tan']);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$blad='';
|
|
|
|
if(strlen(trim($_POST['data']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
|
|
|
else if (!sprawdz_date($_POST['data']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
|
|
|
if ($_POST['id_sam']==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['stankm']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
|
|
|
else if (!sprawdz_liczbe($_POST['stankm']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['litry']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
|
|
|
// koniec sprawdzania danych
|
|
|
|
if($blad)
|
|
|
|
{
|
|
|
|
uwaga($blad);
|
|
|
|
form_edytuj_tankowania($_GET['id_tan']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$edytuj_tankowania=mysql_query("update tankowania SET data_tan='".$_POST['data']."',stankm='".$_POST['stankm']."',litry='".$_POST['litry']."',wyjazd='".$_POST['wyjazd']."' where id_tan='".$_GET['id_tan']."'");
|
|
|
|
if($edytuj_tankowania)
|
|
|
|
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>');
|
|
|
|
else
|
|
|
|
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>');
|
|
|
|
}
|
|
|
|
}//else
|
|
|
|
} //else
|
|
|
|
BREAK;
|
|
|
|
} //switch
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
|
|
|
{
|
|
|
|
switch($_GET['kto'])
|
|
|
|
{
|
|
|
|
case "dodaj":
|
|
|
|
|
|
|
|
if(!isset($_POST['dodaj_tankowania']))
|
|
|
|
form_dodaj_tankowania(); // jezeli nie probowano dodac usera to wyswietla formularz
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// sprawdzanie formularza
|
|
|
|
$blad='';
|
|
|
|
if(strlen(trim($_POST['data']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
|
|
|
else if (!sprawdz_date($_POST['data']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
|
|
|
if ($_POST['id_sam']==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['stankm']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
|
|
|
else if (!sprawdz_liczbe($_POST['stankm']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['litry']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
|
|
|
// koniec sprawdzania danych
|
|
|
|
if($blad)
|
|
|
|
{
|
|
|
|
uwaga($blad);
|
|
|
|
form_dodaj_tankowania();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$dodaj_tankowania=mysql_query("insert into tankowania values('','".$_POST['data']."','".$_SESSION['id']."','".$_POST['id_sam']."','".$_POST['stankm']."','".$_POST['litry']."','0','".$_POST['wyjazd']."')");
|
|
|
|
if($dodaj_tankowania)
|
|
|
|
{
|
|
|
|
uwaga('<center><br><b>Tankowanie zosta³o dodane</b></center><p>');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Tankowanie</b></center><p>');
|
|
|
|
}
|
|
|
|
}//else
|
|
|
|
break;
|
|
|
|
case "show":
|
|
|
|
// pobieranie userów
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' order by data_tan desc");
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
form_szukaj_tankowania();
|
|
|
|
|
|
|
|
$color=$color1;
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].'>Edytuj</a>';
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej']. '</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
case "show2":
|
|
|
|
// pobieranie userów
|
|
|
|
$data=date("Y-m-d",strtotime("-0 days",time()));
|
|
|
|
$data2=date("Y-m-d",strtotime("-30 days",time()));
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' and a.data_tan>='".$data2."' and a.data_tan<='".$data."' order by data_tan desc");
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
form_szukaj_tankowania();
|
|
|
|
|
|
|
|
$color=$color1;
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>StanKm</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].'>Edytuj</a>';
|
|
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
case "szukaj_tankowania":
|
|
|
|
// pobieranie userów
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' order by data_tan desc");
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
$color=$color1;
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>StanKm</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a>';
|
|
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
|
|
|
|
} //switch
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<table width="740" border="0" align="center">
|
|
|
|
<tr>
|
|
|
|
<td><div align="center"><a class= link href="?co=tankowania&kto=dodaj_admin">Dodaj Tankowanie</a></div></td>
|
|
|
|
<td><div align="center"><a class=link href="?co=tankowania&kto=show_admin">Zarzadzaj Tankowaniem - wszystkie</a></div></td>
|
|
|
|
<td><div align="center"><a class=link href="?co=tankowania&kto=show_admin2">Zarzadzaj Tankowaniem - 30 dni</a></div></td>
|
|
|
|
</tr>
|
|
|
|
</table><p>';
|
|
|
|
IF(isset($_GET['akcja']))
|
|
|
|
{
|
|
|
|
switch($_GET['akcja'])
|
|
|
|
{
|
|
|
|
case "usun_admin":
|
|
|
|
if(!is_numeric($_GET['id_tan']))
|
|
|
|
uwaga('Brak danych!');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$usun=mysql_query("update tankowania SET usun='1' where id_tan='".$_GET['id_tan']."'");
|
|
|
|
if($usun)
|
|
|
|
echo('<center><br><b>Tankowanie zosta³o usuniête<center><br><b>');
|
|
|
|
else
|
|
|
|
echo('<center><br><b>Nie mozna by³o usun±æ Tankowania<center><br><b>');
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
case "pokaz_admin":
|
|
|
|
form_poka¿_tankowania_admin($_GET['id_tan']);
|
|
|
|
BREAK;
|
|
|
|
case "edytuj_admin":
|
|
|
|
if(!is_numeric($_GET['id_tan']))
|
|
|
|
uwaga(BLAD. ' Brak danych!');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!isset($_POST['edytuj_tankowania_admin']))
|
|
|
|
form_edytuj_tankowania_admin($_GET['id_tan']);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$blad='';
|
|
|
|
if(strlen(trim($_POST['data']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
|
|
|
else if (!sprawdz_date($_POST['data']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
|
|
|
if ($_POST['id_sam']==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['stankm']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
|
|
|
else if (!sprawdz_liczbe($_POST['stankm']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['litry']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
|
|
|
// koniec sprawdzania danych
|
|
|
|
if($blad)
|
|
|
|
{
|
|
|
|
uwaga($blad);
|
|
|
|
form_edytuj_tankowania_admin($_GET['id_tan']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$edytuj_tankowania_admin=mysql_query("update tankowania SET data_tan='".$_POST['data']."',id='".$_POST['id']."',id_sam='".$_POST['id_sam']."',stankm='".$_POST['stankm']."',litry='".$_POST['litry']."',wyjazd='".$_POST['wyjazd']."' where id_tan='".$_GET['id_tan']."'");
|
|
|
|
if($edytuj_tankowania_admin)
|
|
|
|
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>
|
|
|
|
');
|
|
|
|
else
|
|
|
|
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
|
|
|
');
|
|
|
|
}
|
|
|
|
}//else
|
|
|
|
} //else
|
|
|
|
BREAK;
|
|
|
|
} //switch
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
|
|
|
{
|
|
|
|
switch($_GET['kto'])
|
|
|
|
{
|
|
|
|
case "dodaj_admin":
|
|
|
|
|
|
|
|
if(!isset($_POST['dodaj_tankowania_admin']))
|
|
|
|
form_dodaj_tankowania_admin(); // jezeli nie probowano dodac usera to wyswietla formularz
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// sprawdzanie formularza
|
|
|
|
$blad='';
|
|
|
|
if(strlen(trim($_POST['data']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
|
|
|
else if (!sprawdz_date($_POST['data']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
|
|
|
if ($_POST['id_sam']==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['stankm']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
|
|
|
else if (!sprawdz_liczbe($_POST['stankm']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
|
|
|
if(strlen(trim($_POST['litry']))==0)
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
|
|
|
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
|
|
|
// koniec sprawdzania danych
|
|
|
|
if($blad)
|
|
|
|
{
|
|
|
|
uwaga($blad);
|
|
|
|
form_dodaj_tankowania_admin();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$dodaj_kilometry_admin=mysql_query("insert into tankowania values('','".$_POST['data']."','".$_POST['id']."','".$_POST['id_sam']."','".$_POST['stankm']."','".$_POST['litry']."','0','".$_POST['wyjazd']."')");
|
|
|
|
if($dodaj_kilometry_admin)
|
|
|
|
{
|
|
|
|
uwaga('<center><br><b>Tankowanie zosta³ dodany</b></center><p>
|
|
|
|
');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
uwaga('<center><br><b>Nie mo¿na by³o dodaæ
|
|
|
|
tankowania</b></center><p>');
|
|
|
|
}
|
|
|
|
}//else
|
|
|
|
break;
|
|
|
|
case "show_admin":
|
|
|
|
// pobieranie userów
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam order by data_tan DESC");
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>
|
|
|
|
');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$color=$color1;
|
|
|
|
form_szukaj_tankowania_admin();
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
|
|
|
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
|
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
case "show_admin2":
|
|
|
|
// pobieranie userów
|
|
|
|
$data=date("Y-m-d",strtotime("-0 days",time()));
|
|
|
|
$data2=date("Y-m-d",strtotime("-30 days",time()));
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan>='".$data2."' and a.data_tan<='".$data."' order by data_tan DESC");
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>
|
|
|
|
');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$color=$color1;
|
|
|
|
form_szukaj_tankowania_admin();
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
|
|
|
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
|
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
case "szukaj_tankowania_admin":
|
|
|
|
// pobieranie userów
|
|
|
|
if ($_POST['auto']<>0) {
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.id_sam,c.id_sam,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.id_sam='".$_POST['auto']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (($_POST['data1']==0) or ($_POST['data2']==0))
|
|
|
|
{
|
|
|
|
if ($_POST['id']==0)
|
|
|
|
{
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.id='".$_POST['id']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($_POST['id']==0)
|
|
|
|
{
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' and a.id='".$_POST['id']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
if(mysql_num_rows($pobierz_userow)==0)
|
|
|
|
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
form_szukaj_tankowania_admin();
|
|
|
|
$color=$color1;
|
|
|
|
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data:</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
|
|
|
while($u=mysql_fetch_array($pobierz_userow))
|
|
|
|
{
|
|
|
|
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
|
|
|
$color=zmien_color($color);
|
|
|
|
if($u['blok']=='TAK')
|
|
|
|
$color='red';
|
|
|
|
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
|
|
|
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
|
|
|
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
|
|
|
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
|
|
|
}
|
|
|
|
echo '</table></center>';
|
|
|
|
}
|
|
|
|
BREAK;
|
|
|
|
} //switch
|
|
|
|
} //if
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|