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
|
<? require("testa.php");?>
<TABLE Border="0">
<TR>
<TD colspan="6">
<HR NOSHADE SIZE="2">
</TD>
</TR>
<TR>
<TH><? echo gettext ("Q.");?></TH>
<TH><? echo gettext ("Charge/U");?></TH>
<TH><? echo gettext ("Treatment");?></TH>
<TH><? echo gettext ("Total charge");?></TH>
<TH><? echo gettext ("Due");?></TH>
<TH><? echo gettext ("Click!");?></TH>
</TR>
<TR>
<TD colspan="6">
<HR NOSHADE SIZE="2">
</TD>
</TR>
<TR>
<TD>
<?PHP
!$esito = pg_Exec($conn, "SELECT idvocepagamenti FROM pagamenti where id LIKE '$idpz';");
if (!$esito) {
echo "Si è verificato un errore.\n";
exit;
} // Errore interrogazione database
$nume = pg_NumRows($esito); //inizia l'output tabelare della query
$i = 0;
$q = 1;
while ($i < $nume) {
if ($i == 0) {
$arraio[0] = pg_Result($esito, 0, "idvocepagamenti");
} else {
$m = $i -1;
$attuale = pg_Result($esito, $i, "idvocepagamenti");
$precedente = pg_Result($esito, $m, "idvocepagamenti");
if ($attuale != $precedente) {
$arraio[$q] = pg_Result($esito, $i, "idvocepagamenti");
$q++;
}
}
$i++;
}
$dimensionearraio = sizeof($arraio);
// echo "<BR>L'array contiene ", $dimensionearraio, " record<BR>";
$p = 0;
while ($p < $dimensionearraio) {
$esitox = pg_Exec($conn, "SELECT quantita, prezzounitario, prestazione, prezzodovuto, MIN(rimanedapagare) FROM pagamenti where id LIKE '$idpz' and idvocepagamenti LIKE '$arraio[$p]' GROUP BY quantita, prezzounitario, prestazione, prezzodovuto ;");
if (!$esitox) {
echo "Si è verificato un errore.\n";
exit;
} // Errore interrogazione database
$numa = pg_NumRows($esitox); //inizia l'output tabelare della query
$i = 0;
while ($i < $numa) {
if (pg_Result($esitox, $i, "min") == 0) {
break;
}
echo "<TR bgcolor=\"#C0C0C0\"><TD>";
echo pg_Result($esitox, $i, "quantita");
echo "</TD><TD><CENTER>";
echo number_format(pg_Result($esitox, $i, "prezzounitario"),2);
echo "</CENTER></TD><TD ALIGN=RIGHT>";
echo pg_Result($esitox, $i, "prestazione");
echo "</TD><TD ALIGN=RIGHT>";
echo number_format(pg_Result($esitox, $i, "prezzodovuto"),2);
echo "</TD><TD ALIGN=RIGHT><U>";
$dando = pg_Result($esitox, $i, "min");
echo number_format($dando,2);
echo "</U></TD>";
// ***********************************************************************************************************************************
$esitoy = pg_Exec($conn, "SELECT idpagamenti FROM pagamenti where id LIKE '$idpz' and idvocepagamenti LIKE '$arraio[$p]' and rimanedapagare LIKE '$dando';");
if (!$esitoy) {
echo "Si è verificato un errore.\n";
exit;
} // Errore interrogazione database
$numz = pg_NumRows($esitoy); //inizia l'output tabelare della query
$zz = 0;
// ***********************************************************************************************************************************
echo "<TD ALIGN=\"CENTER\"><B><FONT COLOR=\"#ff0000\"><a href=\"modificapagamentiinserimento.php?idx=";
echo pg_Result($esitoy, $zz, "idpagamenti");
echo "\">*</a></FONT></B></TD></TR>";
$i++ ;
}
$p++;
}
// pg_FreeResult($esito); //liberazione memoria
// pg_FreeResult($esitox); //liberazione memoria
?>
<TR>
<TD colspan="6">
<HR NOSHADE SIZE="2">
</TD>
</TR>
</TABLE>
<BR>
<a href="index.php"><? echo gettext ("Back to main menu");?></a>
<? include("piede.php");?>
|