function getcantinelist($client, $range) { $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB); $query = "SELECT * FROM `factures_cantine` INNER JOIN `clients` ON `factures_cantine`.`idclient` = `clients`.`clientid` WHERE `factures_cantine`.`validation` = '1' AND `acceptation` = '1' AND `reglement` = '0' AND `bourse` = '0' {$range}{$client} ORDER BY `datefacture` ASC"; $result = $mysqli->query($query); while ($row = $result->fetch_array(MYSQLI_ASSOC)) { if ($row["duplicata"] == '0') { $pdf = "<img src=\"img/opdf.png\" alt=\"original\" class=\"ico\">"; } else { $pdf = "<img src=\"img/dpdf.png\" alt=\"duplicata\" class=\"ico\">"; } $datef = $row["datefacture"]; $dayslate = strtotime("now") - strtotime($datef); $dayslate = floor($dayslate / 86400); $type = 'cantine'; $enfant_prenom = "<br/>" . getEnfantPrenom($row['idfacture']); $relance_date = getRelance($row['idfacture']); if (isset($relance_date)) { $relance_date_fr = french_date($relance_date); $titlerelance = "Dernière relance le " . $relance_date_fr; } else { $relance_date_fr = ""; $titlerelance = ""; } $output .= "<tr><td>{$type}{$enfant_prenom}</td><td><a href='clients.php?edit=" . $row["clientid"] . "&hideerrors=1'>" . $row["clientcivilite"] . " " . strtoupper(htmlentities($row["clientnom"])) . " " . strtoupper(htmlentities($row["clientprenom"])) . " " . strtoupper(htmlentities($row["clientprenom2"])) . "</a></td>" . "<td>Facture " . $row["communeid"] . " du " . french_date($row["datefacture"]) . " montant de "; $output .= trispace($row["montantfcp"]); $output .= " FCP (soit " . $row["montanteuro"] . "€)</td><td><a href='createpdf.php?idfacture=" . $row['idfacture'] . "&type={$type}' target='_blank'>{$pdf}</a></td>" . "<td class='center'>{$dayslate} jours</td><td>{$relance_date_fr}<br/><a href='javascript:relance_warning(\"{$relance_date_fr}\",\"create_relance.php?idfacture=" . $row['idfacture'] . "&type={$type}&table=factures_cantine&montant=" . $row["montantfcp"] . "&communeid=" . $row["communeid"] . "&date=" . $row["datefacture"] . "&relancedate={$relance_date}\");'><img src='img/gmail.png' title='{$titlerelance}'/></a></td></tr>"; $ar_ids[] .= $row["idfacture"]; } $mysqli->close(); //return $output; //print_r($ar_ids); return array($output, $ar_ids); }
function getcantinelist($client) { $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB); $query = "SELECT * FROM `" . DB . "`.`factures_cantine` INNER JOIN `clients` ON `factures_cantine`.`idclient` = `clients`.`clientid` WHERE `factures_cantine`.`validation` = '1' AND `acceptation` = '1' AND `reglement` = '0'{$client}"; $result = $mysqli->query($query); while ($row = $result->fetch_array(MYSQLI_ASSOC)) { if ($row["duplicata"] == '0') { $pdf = "<img src=\"img/opdf.png\" alt=\"original\" class=\"ico\">"; } else { $pdf = "<img src=\"img/dpdf.png\" alt=\"duplicata\" class=\"ico\">"; } $type = 'cantine'; $enfant_prenom = "<br/>" . getEnfantPrenom($row['idfacture']); $output .= "<tr><td>{$type}{$enfant_prenom}</td><td><a href='clients.php?edit=" . $row["clientid"] . "&hideerrors=1'>" . $row["clientcivilite"] . " " . strtoupper(htmlentities($row["clientnom"])) . " " . strtoupper(htmlentities($row["clientprenom"])) . " " . strtoupper(htmlentities($row["clientprenom2"])) . "</td>" . "<td>Facture " . $row["communeid"] . " du " . french_date($row["datefacture"]) . " montant de "; $output .= trispace($row["montantfcp"]); $output .= " FCP (soit " . $row["montanteuro"] . "€)</a></td><td><a href='createpdf.php?idfacture=" . $row['idfacture'] . "&type={$type}' target='_blank'>{$pdf}</a></td>" . "<td class='center'><a href=\"javascript:devalidate('{$type}','" . $row["idfacture"] . "')\"><img src=\"img/close.png\" alt=\"close\" height=\"32\" style=\"border:0px\"></a></td></tr>"; } return $output; }