include ("../common/public.php") ;
$ORDINA = SORT_DESC ;
$nome_newdir = "asc" ;
$gen_newdir = "asc" ;
$feb_newdir = "asc" ;
$mar_newdir = "asc" ;
$apr_newdir = "asc" ;
$mag_newdir = "asc" ;
$giu_newdir = "asc" ;
$lug_newdir = "asc" ;
$ago_newdir = "asc" ;
$set_newdir = "asc" ;
$ott_newdir = "asc" ;
$nov_newdir = "asc" ;
$dic_newdir = "asc" ;
if ($ord == "nome" && $dir == "asc")
$nome_newdir = "desc" ;
elseif ($ord == "gen" && $dir == "asc")
{
$gen_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "feb" && $dir == "asc")
{
$feb_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "mar" && $dir == "asc")
{
$mar_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "apr" && $dir == "asc")
{
$apr_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "mag" && $dir == "asc")
{
$mag_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "giu" && $dir == "asc")
{
$giu_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "lug" && $dir == "asc")
{
$lug_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "ago" && $dir == "asc")
{
$ago_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "set" && $dir == "asc")
{
$set_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "ott" && $dir == "asc")
{
$ott_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "nov" && $dir == "asc")
{
$nov_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
elseif ($ord == "dic" && $dir == "asc")
{
$dic_newdir = "desc" ;
$ORDINA = SORT_ASC ;
}
$dbt = new FC_SQL ;
$query = "select * from $tclienti order by Nome $dir" ;
$db->query($query) ;
while ($db->next_record())
{
$totclienti ++ ;
$totf = 0 ;
$id = $db->f("IdClienti") ;
$scrivinome = true ;
for ($mese=1; $mese < 13; $mese++)
{
$dbt->query("select count(*) as totf from $tordini where month(DataOrdine) = $mese and idcliente = $id") ;
while ($dbt->next_record())
{
$totord = $dbt->f("totf") ;
if ($conzero == "si" or ($conzero == "no" and $totord > 0))
{
if ($scrivinome)
{
$item[0][] = $db->f("Nome") ;
$scrivinome = false ;
}
$item[$mese][] = $dbt->f("totf") ;
}
}
}
}
/*************************************************************
* controllo il campo in base a quale devo fare l'ordinamento.
**************************************************************/
if ($ord == "gen")
array_multisort ($item[1], SORT_NUMERIC, $ORDINA, $item[0], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "feb")
array_multisort ($item[2], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "mar")
array_multisort ($item[3], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "apr")
array_multisort ($item[4], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[3], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "mag")
array_multisort ($item[5], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[3], $item[4], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "giu")
array_multisort ($item[6], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[3], $item[4], $item[5], $item[7], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "lug")
array_multisort ($item[7], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[3], $item[4], $item[5], $item[6], $item[8], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "ago")
array_multisort ($item[8], SORT_NUMERIC, $ORDINA, $item[0], $item[1], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[9], $item[10], $item[11], $item[12]) ;
elseif ($ord == "set")
array_multisort ($item[9], SORT_NUMERIC, $ORDINA, $item[0], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[1], $item[10], $item[11], $item[12]) ;
elseif ($ord == "ott")
array_multisort ($item[10], SORT_NUMERIC, $ORDINA, $item[0], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[1], $item[11], $item[12]) ;
elseif ($ord == "nov")
array_multisort ($item[11], SORT_NUMERIC, $ORDINA, $item[0], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[1], $item[12]) ;
elseif ($ord == "dic")
array_multisort ($item[12], SORT_NUMERIC, $ORDINA, $item[0], $item[2], $item[3], $item[4], $item[5], $item[6], $item[7], $item[8], $item[9], $item[10], $item[11], $item[1]) ;
?>
New Document
// PRIMA TABELLA ?>
$menu = "clienti" ;
$posizione = 13 ;
include ('../common/temidx.php') ;
?>
// TERZA TABELLA ?>
 |
| Distribuzione Ordini per Cliente per Mese |
|
CLIENTE
if ($ord == "nome")
{
?>
} ?> |
GEN
if ($ord == "gen")
{
?>
} ?> |
FEB
if ($ord == "feb")
{
?>
} ?> |
MAR
if ($ord == "mar")
{
?>
} ?> |
APR
if ($ord == "apr")
{
?>
} ?> |
MAG
if ($ord == "mag")
{
?>
} ?> |
GIU
if ($ord == "giu")
{
?>
} ?> |
LUG
if ($ord == "lug")
{
?>
} ?> |
AGO
if ($ord == "ago")
{
?>
} ?> |
SET
if ($ord == "set")
{
?>
} ?> |
OTT
if ($ord == "ott")
{
?>
} ?> |
NOV
if ($ord == "nov")
{
?>
} ?> |
DIC
if ($ord == "dic")
{
?>
} ?> |
$bgcol[0] = "#0080C0" ;
$bgcol[1] = "#3F97A9" ;
for ($i=0; $i<$totclienti; $i++)
{
printf (" \n",(($i % 2) == 0?$bgcol[0]:$bgcol[1])) ;
?>
| echo $item[0][$i] ?> |
echo $item[1][$i] ?> |
echo $item[2][$i] ?> |
echo $item[3][$i] ?> |
echo $item[4][$i] ?> |
echo $item[5][$i] ?> |
echo $item[6][$i] ?> |
echo $item[7][$i] ?> |
echo $item[8][$i] ?> |
echo $item[9][$i] ?> |
echo $item[10][$i] ?> |
echo $item[11][$i] ?> |
echo $item[12][$i] ?> |
}
?>
|
|
include ("../common/footer.php") ; ?>