qstr($value); } $requete .= $where_clause." ORDER by nom_adh, prenom_adh;"; $resultat = &$DB->Execute($requete); $pdf = new pdffile; $pdf->set_default('margin', 0); $firstpage = $pdf->new_page("a4-landscape"); $param["height"] = PREF_ETIQ_CORPS; $param["fillcolor"] = $pdf->get_color('#000000'); $param["align"] = "center"; $param["width"] = 1; $param["strokecolor"] = $pdf->get_color('#000000'); if ($resultat->EOF) die(); $yorigin=545; $xorigin=round(PREF_ETIQ_MARGES*2.835); $row=1; $nb_etiq=0; $concatname = ""; $i=0; $j=0; while (date("Ym",strtotime("$j saturday", strtotime($datenow))) <= $annee.$mois) { $j++; if (date("m",strtotime("$j saturday", strtotime($datenow))) == $mois) { $panier[$i][0]=0; $panier[$i][1]=0; $date[$i]=date("d/m/Y",strtotime($j . " saturday", strtotime($datenow))); $date2[$i]=date("Y-m-d",strtotime($j . " saturday", strtotime($datenow))); $i++; } if ($j > 10) { print "Problème dans le calcul des mois !"; die(); } } $col = $i; $ligne = 18; $x1 = 70; $x2 = 300; $ecart = 480/$col; $hecart = 490/$ligne; while (!$resultat->EOF) { $y1 = $yorigin-(($row-1)*($hecart)); $y2 = $y1 - $hecart; if ($row==1) { $param["font"] = "Helvetica-Bold"; $pdf->draw_rectangle($yorigin+20, $x1, $yorigin, $x2, $firstpage, $param); $pdf->draw_paragraph($yorigin+20, $x1, $yorigin, $x2, "Nom", $firstpage, $param); $pdf->draw_rectangle($yorigin+20, $x2, $yorigin, $x2+40, $firstpage, $param); $pdf->draw_paragraph($yorigin+20, $x2, $yorigin, $x2+40, "Prix", $firstpage, $param); $i=0; while($i<$col) { $xdr1=$x2+40+$i*$ecart; $xdr2=$x2+40+($i+1)*$ecart; $pdf->draw_paragraph($yorigin+20, $xdr1, $yorigin, $xdr2, $date[$i], $firstpage, $param); $pdf->draw_rectangle($yorigin+20, $xdr1, $yorigin, $xdr2, $firstpage, $param); $i++; } } if ( ($_POST['panier'] == "legume" && $resultat->fields[9] != "-1") || ($_POST['panier'] == "pain" && $resultat->fields[10] != "0") ) { $nom_adh_ext=""; switch($resultat->fields[4]) { case "1" : $nom_adh_ext .= _T("M."); break; case "2" : $nom_adh_ext .= _T("Mme."); break; default : $nom_adh_ext .= _T("Mlle."); } $nom_adh_ext .= " ".strtoupper($resultat->fields[1])." ".ucfirst(strtolower($resultat->fields[2])); $concatname = $concatname . " - " . $nom_adh_ext; $param["font"] = "Helvetica"; $pdf->draw_paragraph($y1-5, $x1, $y2, $x2, $nom_adh_ext, $firstpage, $param); $pdf->draw_rectangle ($y1, $x1, $y2, $x2, $firstpage, $param); $pdf->draw_rectangle($y1, $x2, $y2, $x2+40, $firstpage, $param); // $pdf->draw_rectangle($y1, $x2+20, $y2, $x2+40, $firstpage, $param); if ($_POST['panier'] == "legume") { $qpanier=$resultat->fields[9]; if ($qpanier == "0" ) $qpanier_result="pp"; else $qpanier_result="GP"; } else if ($_POST['panier'] == "pain") { $qpanier=$resultat->fields[10]; if ($qpanier == "1" ) $qpanier_result="3"; if ($qpanier == "2" ) $qpanier_result="5"; if ($qpanier == "3" ) $qpanier_result="7"; if ($qpanier == "4" ) $qpanier_result="9,50"; } $pdf->draw_paragraph($y1, $x2, $y2, $x2+40, $qpanier_result, $firstpage, $param); $i=0; while($i<$col) { $absence = &$DB->Execute("SELECT * FROM `galette_absences` WHERE `id_adh` = " . $resultat->fields[0] . " AND `date_abs` = '$date2[$i]'"); if (!$absence->EOF) $pdf->draw_paragraph($y1, $x2+$i*$ecart+40, $y2, $x2+($i+1)*$ecart+40, "Absent", $firstpage, $param); else $panier[$i+1][$qpanier]=$panier[$i+1][$qpanier]+1; $pdf->draw_rectangle($y1, $x2+$i*$ecart+40, $y2, $x2+($i+1)*$ecart+40, $firstpage, $param); $i++; } $row++; if ($row>$ligne) { $row=1; $firstpage = $pdf->new_page("a4-landscape"); } $nb_etiq++; } $resultat->MoveNext(); } $i=0; while($i<$col) { $pdf->draw_rectangle($y2, $x2+$i*$ecart+40, $y2-20, $x2+($i+1)*$ecart+40, $firstpage, $param); if ($_POST['panier'] == "legume") $display="pp : " . $panier[$i+1][0] . " | GP : " . $panier[$i+1][1]; if ($_POST['panier'] == "pain") $display="3E : " . $panier[$i+1][1] . " | 5E : " . $panier[$i+1][2] . " | 7E : " . $panier[$i+1][3] . " | 9E50 : " . $panier[$i+1][4]; $pdf->draw_paragraph($y2, $x2+$i*$ecart+40, $y2-20, $x2+($i+1)*$ecart+40, $display, $firstpage, $param); $i++; } $resultat->Close(); dblog(_T("Génération de ")." ".$nb_etiq." "._T("feuille emargement"),$concatname); header("Content-Disposition: filename=feuille_emargement.pdf"); header("Content-Type: application/pdf"); $temp = $pdf->generate(); header('Content-Length: ' . strlen($temp)); echo $temp; ?>