Aggiunta associazione
This commit is contained in:
41
associazione/funzioni.php
Normal file
41
associazione/funzioni.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
function categoria ($data) {
|
||||
global $DB_ID;
|
||||
|
||||
$query = " SELECT
|
||||
categoria
|
||||
FROM
|
||||
wf_categoria
|
||||
WHERE
|
||||
STR_TO_DATE('$data', '%d.%m.%Y')
|
||||
BETWEEN
|
||||
DATE_SUB(CONCAT(YEAR(NOW()),'-01-01 00:00:00'), INTERVAL fine YEAR)
|
||||
AND
|
||||
DATE_SUB(CONCAT(YEAR(NOW()),'-12-31 00:00:00'), INTERVAL inizio YEAR)
|
||||
";
|
||||
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$categoria = "";
|
||||
while ($dato = mysql_fetch_array ($res)) {
|
||||
$categoria .= $dato['categoria']." - ";
|
||||
}
|
||||
return substr($categoria, 0, -3);
|
||||
}
|
||||
|
||||
function differenza ($ora, $prima, $inverso=0) {
|
||||
$valore = $ora-$prima;
|
||||
if ($inverso) {
|
||||
if ( $valore >= 0) {
|
||||
return "<div align=\"center\" style=\"color:#FF0000;font-size: 10px\">+$valore</div>";
|
||||
} else {
|
||||
return "<div align=\"center\" style=\"color:#00FF00;font-size: 10px\">$valore</div>";
|
||||
}
|
||||
} else {
|
||||
if ($valore >= 0) {
|
||||
return "<div align=\"center\" style=\"color:#00FF00;font-size: 10px\">+$valore</div>";
|
||||
} else {
|
||||
return "<div align=\"center\" style=\"color:#FF0000;font-size: 10px\">$valore</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user