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
|
$COM_Object = "CrystalRunTime.Application.10";
$my_report = getcwd() . "\\rapports\\rapport.rpt";
$my_pdf = getcwd() . "\\rapports\\test.pdf";
$crapp= New COM($COM_Object) or die("Unable to Create Object");
try
{
$creport = $crapp->OpenReport($my_report, 1);
$creport->DiscardSavedData;
if (!empty($_POST['dateCT']))
{
$formuleSelection .= "(";
$formuleSelection .= "{tblcartetempsmain.Date} >= #" . formaterDate($_POST['dateCT']) . "# ";
$formuleSelection .= ")";
$estPremier = false;
}
$creport->RecordSelectionFormula = $formuleSelection;
$creport->ReadRecords();
$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF
$creport->Export(false);
header("Location: rapports/test.pdf");
}
catch (com_exception $error)
{
echo $error->getMessage();
} |