← Back
Editing: avere.php
<?php require_once ("../funct.php"); require_once ("sess.php"); require_once ("conn.php"); require_once ("testacoda.php"); $query = new doQuery(); $num = array (11, 12); $utn = array (11=>'Riva', 12=>'Baia'); foreach ($num as $u) { $cifra_gg = 0; $cifra_cm = 0; $sql = "SELECT numero, pagamenti.id, cifra, data, id_contratto FROM `pagamenti`, contratti WHERE `pagamenti`.`id_utente`=$u and `pagamenti`.`tipo`=2 and `pagamenti`.`data`>'2010-01-01' and contratti.id=`id_contratto` and (stato=5 or stato=6 or stato=7 or stato=15 or stato=16 or stato=17) and id_contratto!=6619 and id_contratto!=6620 and id_contratto!=6792 order by numero "; $rows = $query->freeQuery ($sql, 0); foreach ($rows as $row) { if (strpos ("@".$row->numero, 'CM')) $cifra_cm+= $row->cifra; else if (strpos ("@".$row->numero, 'GG')) $cifra_gg+= $row->cifra; } $testo.= "<tr><td>Caparre versate ".$utn[$u]."<td align=\"right\">".addzero ($cifra_cm, 2)." € <td align=\"right\">".addzero ($cifra_gg, 2)." € <br />"; $cifra_gg = 0; $cifra_cm = 0; $sql = "SELECT numero, pagamenti.id, cifra, data, id_contratto FROM `pagamenti`, contratti WHERE `pagamenti`.`id_utente`=$u and `pagamenti`.`tipo`=3 and `pagamenti`.`data` like '0000%' and contratti.id=`id_contratto` and (stato=5 or stato=6 or stato=7 or stato=15 or stato=16 or stato=17) and id_contratto!=6619 and id_contratto!=6620 and id_contratto!=6792 order by numero "; $rows = $query->freeQuery ($sql, 0); foreach ($rows as $row) { if (strpos ("@".$row->numero, 'CM')) $cifra_cm+= $row->cifra; else if (strpos ("@".$row->numero, 'GG')) $cifra_gg+= $row->cifra; } $testo.= "<tr><td>Saldi da avere ".$utn[$u]."<td align=\"right\">".addzero ($cifra_cm, 2)." € <td align=\"right\">".addzero ($cifra_gg, 2)." € <br />"; } echo "<table><tr><td>Totali<td align=\"center\">CM<td align=\"center\">GG $testo</table>"; ?>
Save File
Cancel