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
|
?php
//Ouverture du rapport
#######################################
//merci futurist LOL
#########################################
//pour mis a jour de la base depuis crystal report
//il faut mettre cela
$db = 'intranet'; //nom de la base de données
$host = 'localhost'; // nom de la machine hôte
$user = 'root'; // nom de l'utilisateur
$pwd = '';// mot de passe
$dsn = "mysql:dbname=$db;host=$host";
$app_obj = new PDO($dsn, $user, $pwd);
##################################
$app_obj = new COM("CrystalRuntime.Application") or Die ("Did not open");
$etat="C:\\wamp\\www\\requete\\utilisateur.rpt"; // donner le chemain du rapport
$rpt_obj=$app_obj->OpenReport($etat);
$rpt_obj->RecordSelectionFormula = "{nom_table.nom_du_champ1} =$varnum and {nom_table.nom_du_champ2}="."'". $var_string."'"....;
$rpt_obj->ExportOptions->DiskFileName="C:\\wamp\\www\\requete\\nomFichier.pdf"; // chemain ou mettre le fichier pdf
$rpt_obj->ExportOptions->PDFExportAllPages=true;
$rpt_obj->ExportOptions->DestinationType=1; // Export to File
$rpt_obj->ExportOptions->FormatType=31; // Type: PDF
$rpt_obj->Export(false);
?>
<?php /*
header('Location:\requete\pdf.html');
exit();*/
// la fonction de redirection ------------
function redir($url){
echo "<script language=\"javascript\">";
echo "window.location='$url';";
//echo "window.open('$url','menuchd','toolbar=1, location=1, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=1, width=700, height=600, left=200, top=50');";
echo "</script>";
}
// Utiliser la redirection ---------------
redir("requete/\pdf2.html");
?> |
Partager