settype($d_sconto,double);
$d_costo_tot = round(($d_costo_tariffa + $costo_agg_tot - $d_sconto),2);
settype($d_costo_tot,double);
if (strcmp($d_pagato,"~~~~")) {
settype($d_pagato,double);
$d_da_pagare = $d_costo_tot - $d_pagato;
$d_da_pagare = round(($d_costo_tot - $d_pagato),2);
settype($d_da_pagare,double);
$d_da_pagare_p = virgola_in_num($d_da_pagare,$stile_soldi);
} # fine if (strcmp($d_pagato,"~~~~"))
$d_costo_tot_p = virgola_in_num($d_costo_tot,$stile_soldi);
} # fine if (strcmp($d_costo_tariffa,"~~~~") and...
else $d_costo_tot_p = "~~~~";
echo "<div style=\"line-height: 1.4; padding: 2px 0 0 2px;\">";
echo mex("Totale da pagare",$pag).": <b>$d_costo_tot_p</b> $Euro";
if ($tasse_tot) echo " <small>(".mex("tasse",$pag)." ".virgola_in_num($tasse_tot,$stile_soldi)." $Euro, ".mex("resto",$pag)." ".virgola_in_num(($d_costo_tot - $tasse_tot),$stile_soldi)." $Euro)</small>";
echo "<br>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>
".mex("Pagato",$pag).": <b>$d_pagato_p</b> $Euro</td>";
$vedi_tab_pagamenti = "NO";
$num_pagamenti = 0;
if ($priv_vedi_tab_costi != "n" and $num_id_prenota == 1) {
$righe_pagamenti = "";
if ($id_anni_prec) {
while (list($anno_prec_paga,$id_anno_prec) = each($id_anni_prec_vett)) {
$pagamenti = esegui_query("select metodo_pagamento,saldo_prenota,data_inserimento,utente_inserimento from $PHPR_TAB_PRE"."soldi$anno_prec_paga where saldo_prenota is not NULL and motivazione $LIKE '%;$id_anno_prec' order by data_inserimento");
$num_pagamenti2 = numlin_query($pagamenti);
for ($num1 = 0 ; $num1 < $num_pagamenti2 ; $num1++) {
$data_paga[$num_pagamenti] = substr(risul_query($pagamenti,$num1,'data_inserimento'),0,10);
$utente_paga[$num_pagamenti] = risul_query($pagamenti,$num1,'utente_inserimento');
$metodo_paga[$num_pagamenti] = risul_query($pagamenti,$num1,'metodo_pagamento');
function genera_istogramma ($x,$nome_x,$y1,$y2,$y3,$y4,$y5,$titolo,$titolo_serie,$titolo_col,$commento_col,$colore_col,$colore,$colore_riga,$simbolo_val,$stile_soldi) {

$num_x = count($x);
$num_col = 0;
for ($num1 = 1 ; $num1 <= 5 ; $num1++) {
if (@is_array(${"y".$num1})) $num_col = $num1;
} # fine for $num1
$max = 0;
for ($num1 = 1 ; $num1 <= $num_col ; $num1++) {
for ($num2 = 0 ; $num2 < $num_x ; $num2++) if (${"y".$num1}[$x[$num2]] > $max) $max = ${"y".$num1}[$x[$num2]];
} # fine for $num1
$num_col_tot = ($num_x * $num_col);
$width_cols = (($num_col * 20) - 4);
if ($num_x < 3) $width_cols = $width_cols + ($num_col * 10);
if ($num_x < 2) $width_cols = $width_cols + ($num_col * 20);

$istogramma = "<h5>$titolo</h5>
<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin-left: auto; margin-right: auto; background-color: $colore; border: 1px solid #000000;\">
<tr><td colspan=\"$num_col_tot\" align=\"center\">
<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"margin-left: auto; margin-right: auto;\">
<tr>";
$linea_tot = "NO";
for ($num1 = 1 ; $num1 <= $num_col ; $num1++) {
$istogramma .= "<td valign=\"middle\" align=\"center\">
<table style=\"width: 15px; height: 9px; border: 1px solid #000000; background-color: ".$colore_col[$num1].";\"><tr><td></td></tr></table>
</td>
<td valign=\"bottom\"><small style=\"padding: 0px;\"><b>&nbsp;".$titolo_serie[$num1]."</b></small></td>";
if ($num1 != $num_col) $istogramma .= "<td style=\"width: 20px;\"></td>";
if ($titolo_serie['TOT'][$num1]) $linea_tot = "SI";
} # fine for $num1
if ($linea_tot == "SI") {
$istogramma .= "</tr><tr>";
for ($num1 = 1 ; $num1 <= $num_col ; $num1++) {
$istogramma .= "<td colspan=\"2\" valign=\"top\" align=\"center\" style=\"line-height: 0.60em;\">";
if ($titolo_serie['TOT'][$num1]) $istogramma .= "<small><small>(".$titolo_serie["TOT"][$num1]."$simbolo_val)</small></small>";
$istogramma .= "</td>";
$linea_tot = "SI";
if ($num1 != $num_col) $istogramma .= "<td style=\"width: 20px;\"></td>";
} # fine for $num1
} # fine if ($linea_tot == "SI")
$istogramma .= "</tr></table></td></tr>
<tr><td colspan=\"$num_col_tot\" style=\"height: 4px;\"></td></tr><tr>";

for ($num1 = 0 ; $num1 < $num_x ; $num1++) {
for ($num2 = 1 ; $num2 <= $num_col ; $num2++) {
$y = ${"y".$num2};
if (($num2 + 1) > $num_col) {
$y_prox = $y1;
$num1_prox = $num1 + 1;
} # fine if (($num2 + 1) > $num_col)
else {
$y_prox = ${"y".($num2 + 1)};
$num1_prox = $num1;
} # fine else if (($num2 + 1) > $num_col)
if ($max > 0) $altezza = round(200 / $max * $y[$x[$num1]]);
else $altezza = 0;
if ($altezza < 0) $altezza = 2;
$resto_alt = 200 - $altezza;
$cifra_vedi = $y[$x[$num1]];
if (substr($cifra_vedi,0,1) == "-") $cifra_vedi = substr($cifra_vedi,1);
if ($cifra_vedi == 0) $cifra_vedi = "";
else {
if (strlen($cifra_vedi) > 3) {
$cifra_vedi = (double) round($cifra_vedi,1);
if (strlen($cifra_vedi) > 3) {
$cifra_vedi = (double) floor($cifra_vedi);
if (strlen($cifra_vedi) > 3) {
$cifra_vedi = (double) $cifra_vedi / 1000;
$cifra_vedi = (floor($cifra_vedi * 10) / 10);
if (strlen($cifra_vedi) > 3) $cifra_vedi = floor($cifra_vedi);
if (strlen($cifra_vedi) > 3) {
$cifra_vedi = (double) $cifra_vedi / 1000;
$cifra_vedi = (floor($cifra_vedi * 10) / 10);
if (strlen($cifra_vedi) > 3) $cifra_vedi = floor($cifra_vedi);
$cifra_vedi .= "M";
} # fine if (strlen($cifra_vedi) > 3)
else $cifra_vedi .= "k";
} # fine if (strlen($cifra_vedi) > 3)
} # fine if (strlen($cifra_vedi) > 3)
} # fine if (strlen($cifra_vedi) > 3)
} # fine else if ($cifra_vedi == 0)
if (substr($y[$x[$num1]],0,1) == "-") $cifra_vedi = "-".$cifra_vedi;
$cifra_vedi = virgola_in_num($cifra_vedi,$stile_soldi);
if (@is_array($commento_col)) $commento_int = $commento_col[$titolo_serie[$num2]][$x[$num1]];
$titolo_int = $titolo_col[$x[$num1]]." ".$titolo_serie[$num2]."$commento_int: ".punti_in_num($y[$x[$num1]],$stile_soldi).$simbolo_val;
$istogramma .= "<td valign=\"bottom\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%; border: none;\">
<tr><td valign=\"bottom\" align=\"center\" style=\"height: $resto_alt"."px;\"><small><small>".$cifra_vedi."</small></small></td></tr>
<tr><td title=\"$titolo_int\" style=\"width: 20px; height: $altezza"."px; background-color: ".$colore_col[$num2]."; border: 1px solid #000000;";
if ($num1_prox == ($num_x) or $y_prox[$x[($num1_prox)]] >= $y[$x[$num1]]) {
$istogramma .= " border-right: none;";
if ($num2 == $num_col) $bordo_des[$num1] = "NO";
} # fine if ($num1_prox == ($num_x) or...
if (($num1 == 0 and $num2 == 1) or $ultima_y > $y[$x[$num1]]) {
$istogramma .= " border-left: none;";
if ($num2 == 1) $bordo_sin[$num1] = "NO";
} # fine if (($num1 == 0 and $num2 == 1) or...
if ($altezza == 0) $istogramma .= " border-top: none;";
$istogramma .= "\"></td></tr>
</table></td>";
$ultima_y = $y[$x[$num1]];
} # fine for $num2
} # fine for $num1

$istogramma .= "</tr><tr style=\"text-align: center; background-color: $colore_riga;\">";
for ($num1 = 0 ; $num1 < $num_x ; $num1++) {
$istogramma .= "<td colspan=\"$num_col\" valign=\"middle\" style=\"width: $width_cols"."px; padding: 2px; line-height: 0.75em;";
if ($bordo_sin[$num1] != "NO" or $bordo_des[$num1] != "NO") {
if ($bordo_sin[$num1] != "NO") $istogramma .= " border-left: 1px solid #000000;";
if ($bordo_des[$num1] != "NO") $istogramma .= " border-right: 1px solid #000000;";
} # fine if ($bordo_sin[$num1] != "NO" or...
$tag_aper = "<small><b>";
$tag_chiu = "</b></small>";
if (strlen($x[$num1]) > 5) {
$tag_aper = "<small><small><b>";
$tag_chiu = "</b></small></small>";
} # fine if (strlen($x[$num1]) > 5)
if (strlen($x[$num1]) > 10) {
$tag_aper = "<small><small>";
$tag_chiu = "</small></small>";
} # fine if (strlen($x[$num1]) > 10)
$istogramma .= "\">$tag_aper".$nome_x[$num1]."$tag_chiu</td>";
} # fine for $num1
$istogramma .= "</tr></table>";

return $istogramma;

} # fine function genera_istogramma
Example #3
0
         if ($priv_mod_tariffe != "n" and $lista_opt_tariffe) {
             $arrotond_tas = $arrotond_predef * 1;
             echo "<form accept-charset=\"utf-8\" method=\"post\" action=\"creaprezzi.php\"><div>\n<input type=\"hidden\" name=\"anno\" value=\"{$anno}\">\n<input type=\"hidden\" name=\"id_sessione\" value=\"{$id_sessione}\">\n<input type=\"hidden\" name=\"modificatasse\" value=\"SI\">\n<h5>" . mex("Tasse", $pag) . "</h5><br>\n" . mex("Tasse applicate su", $pag) . "\n <select name=\"tipotariffa\">";
             if ($id_utente == 1) {
                 echo "<option value=\"tutte\">" . mex("tutte le tariffe", $pag) . "</option>";
             }
             echo "{$lista_opt_tariffe}\n</select>:\n <input type=\"text\" name=\"tasse_percent\" size=\"3\" maxlength=\"6\">%\n <input class=\"sbutton\" type=\"submit\" value=\"" . mex("Inserisci o modifica le tasse", $pag) . "\">\n</div></form>\n<small>(" . mex("tutti i prezzi delle tariffe si intendono con tasse già incluse", $pag) . ")</small><br><br>";
             if ($modifica_pers != "NO") {
                 if ($id_utente == 1) {
                     $id_utente_mod = "tutti";
                 } else {
                     $id_utente_mod = $id_utente;
                 }
                 echo "<form accept-charset=\"utf-8\" method=\"post\" action=\"./personalizza.php\"><div>\n<input type=\"hidden\" name=\"anno\" value=\"{$anno}\">\n<input type=\"hidden\" name=\"id_sessione\" value=\"{$id_sessione}\">\n<input type=\"hidden\" name=\"id_utente_mod\" value=\"{$id_utente_mod}\">\n<input type=\"hidden\" name=\"aggiorna_qualcosa\" value=\"SI\">\n<input type=\"hidden\" name=\"origine\" value=\"./creaprezzi.php\">\n<input type=\"hidden\" name=\"cambiaarrtasse\" value=\"SI\">";
                 $arrotond_tasse = esegui_query("select * from {$tablepersonalizza} where idpersonalizza = 'arrotond_tasse' and idutente = '{$id_utente}'");
                 $arrotond_tasse = virgola_in_num(risul_query($arrotond_tasse, 0, 'valpersonalizza'), $stile_soldi);
                 echo ucfirst(mex("valore a cui arrotondare le percentuali delle tasse", "personalizza.php")) . ":\n <input type=\"text\" name=\"nuovo_arrotond_tasse\" size=\"4\" value=\"{$arrotond_tasse}\">\n<input class=\"sbutton\" type=\"submit\" value=\"" . mex("Cambia", "personalizza.php") . "\">\n</div></form><br>";
             }
             # fine if ($modifica_pers != "NO")
             echo "<hr style=\"width: 95%\">";
         }
         # fine if ($priv_mod_tariffe != "n" and $lista_opt_tariffe)
         if ($priv_vedi_tab_periodi != "n") {
             echo "<div style=\"text-align: center;\"><br>\n<form accept-charset=\"utf-8\" method=\"post\" action=\"visualizza_tabelle.php\"><div>\n<input type=\"hidden\" name=\"anno\" value=\"{$anno}\">\n<input type=\"hidden\" name=\"id_sessione\" value=\"{$id_sessione}\">\n<input type=\"hidden\" name=\"tipo_tabella\" value=\"periodi\">\n<input class=\"sbutton\" type=\"submit\" name=\"visualizza\" value=\"" . mex("Vedi i prezzi già inseriti", $pag) . "\">\n</div></form><br>";
         }
         # fine if ($priv_vedi_tab_periodi != "n")
         echo "<form accept-charset=\"utf-8\" method=\"post\" action=\"inizio.php\"><div>\n<input type=\"hidden\" name=\"anno\" value=\"{$anno}\">\n<input type=\"hidden\" name=\"id_sessione\" value=\"{$id_sessione}\">\n<input class=\"sbutton\" type=\"submit\" name=\"indietro\" value=\"" . mex("Torna al menù principale", $pag) . "\">\n</div></form></div><br>";
     }
     # fine if ($mostra_form_iniziale != "NO")
 }
 # fine else if (($modificacaparra or $modificacommissioni or $modificacommper or $modificatasse) and $priv_mod_tariffe != "n")