コード例 #1
0
 function exportCSV($t_empr)
 {
     if (SESSrights & CIRCULATION_AUTH) {
         $req = "TRUNCATE TABLE cache_amendes";
         pmb_mysql_query($req);
         $requete = "select id_empr from empr, pret, exemplaires where 1 ";
         if (!isset($t_empr)) {
             $t_empr[] = "0";
         }
         $requete .= " and id_empr in (" . implode(",", $t_empr) . ") ";
         //$requete.= $loc_filter;
         $requete .= "and pret_retour<now() and pret_idempr=id_empr and pret_idexpl=expl_id group by id_empr";
         $resultat = pmb_mysql_query($requete);
         $not_all_mail = 0;
         while ($r = pmb_mysql_fetch_object($resultat)) {
             $amende = new amende($r->id_empr);
             $level = $amende->get_max_level();
             $niveau_min = $level["level_min"];
             $printed = $level["printed"];
             if (!$printed && $niveau_min) {
                 $not_all_mail += print_relance($r->id_empr);
             }
         }
         $req = "select id_empr  from empr, pret, exemplaires, empr_categ where 1 ";
         $req .= "and pret_retour<CURDATE() and pret_idempr=id_empr and pret_idexpl=expl_id and id_categ_empr=empr_categ group by id_empr";
         $res = pmb_mysql_query($req);
         while ($r = pmb_mysql_fetch_object($res)) {
             $relance_liste .= get_relance($r->id_empr);
         }
         //modification du template importé
         //possiblité de l'appeler sans le mot global
         //(juste pour noté qu'elle n'est pas valorisée ici)
         global $export_relance_tpl;
         $export_relance_tpl = str_replace("!!relance_liste!!", $relance_liste, $export_relance_tpl);
         return $export_relance_tpl;
     } else {
         return 0;
     }
 }
コード例 #2
0
$base_nosession = 1;
//$base_nocheck = 1 ;
require_once "{$base_path}/includes/init.inc.php";
header("Content-Type: application/download\n");
header("Content-Disposition: atachement; filename=\"tableau.xls\"");
require_once $class_path . "/emprunteur.class.php";
require_once $class_path . "/comptes.class.php";
require_once $class_path . "/mono_display.class.php";
require_once $class_path . "/serial_display.class.php";
require_once $class_path . "/amende.class.php";
$export_relance_tpl = "\n<html>\n<head>\n\t<meta http-equiv=Content-Type content='text/html; charset=" . $charset . "' />\n</head>\n<body>\n\t<table>\n\t\t<tr>\n\t\t\t<th>" . $msg["relance_export_empr_cb"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_name"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_surname"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_adr1"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_adr2"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_cp"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_ville"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_mail"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_tel1"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_tel2"] . "</th>\n\t\t\t" . ($pmb_lecteurs_localises ? "<th>" . $msg["relance_export_empr_location"] . "</th>" : "") . "\n\t\t\t<th>" . $msg["relance_export_empr_categ"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_codestat"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_statut"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_groupes"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_niveau_suppose"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_total_amende"] . "</th>\n\t\t\t<th>" . $msg["relance_export_empr_frais_relance"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_titre"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_cb"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_pret_date"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_pret_retour"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_niveau_relance"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_date_relance"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_mail"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_printed"] . "</th>\n\t\t\t<th>" . $msg["relance_export_expl_amende"] . "</th>\n\t\t</tr>\n\t\t!!relance_liste!!\n\t</table>\n</body>\n</html>";
$req = "select id_empr  from empr, pret, exemplaires, empr_categ where 1 ";
$req .= "and pret_retour<CURDATE() and pret_idempr=id_empr and pret_idexpl=expl_id and id_categ_empr=empr_categ group by id_empr";
$res = pmb_mysql_query($req);
while ($r = pmb_mysql_fetch_object($res)) {
    $relance_liste .= get_relance($r->id_empr);
}
print str_replace("!!relance_liste!!", $relance_liste, $export_relance_tpl);
function get_relance($id_empr)
{
    global $dbh, $charset, $msg, $pmb_gestion_financiere, $pmb_gestion_amende;
    global $pmb_lecteurs_localises;
    // liste des relances
    if ($pmb_gestion_financiere && $pmb_gestion_amende) {
        $amende = new amende($id_empr);
        $level = $amende->get_max_level();
        $niveau_min = $level["level_min"];
        $id_expl = $level["level_min_id_expl"];
        $total_amende = $amende->get_total_amendes();
    }
    $niveau_suppose = $level["level_normal"];