2016-02-01 26 views
8

Bir php komut dosyasını kullanarak bir kristal rapor oluşturmaya çalışıyorum. Komut dosyası ReadRecords(); Günlük dosyasında bir hata mesajı üretilmiyor. Yanlış bir şey mi yapıyorum?PHP ile Kristal Raporu Oluşturuluyor

$my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\invoice.rpt"; 
$my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf"; 

$ObjectFactory = new COM("CrystalReports115.ObjectFactory.1"); 

$crapp = $ObjectFactory->CreateObject("CrystalDesignRuntime.Application.11"); 

$creport = $crapp->OpenReport($my_report, 1); 

$creport->EnableParameterPrompting = 0; 

$creport->DiscardSavedData; 
$creport->ReadRecords(); 

$creport->FormulaSyntax = 0; 
$creport->RecordSelectionFormula = "{invoice.invoiceid} = 20070128114815"; 

$creport->ExportOptions->DiskFileName = $my_pdf; 
$creport->ExportOptions->FormatType = 31; 
$creport->ExportOptions->DestinationType=1; 
$creport->Export(false); 

$creport = null; 
$crapp = null; 
$ObjectFactory = null; 

Bu kodun benzer bir sürümü farklı bir rapor için çalışır. Sen $creport->DiscardSavedData aradığınız DIRECTORY_SEPARATOR yerine

  • \\ ait

    $my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\" . $name; 
    $my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf"; 
    
    $ObjectFactory = new COM("CrystalReports115.ObjectFactory.1"); 
    
    $crapp = $ObjectFactory->CreateObject("CrystalDesignRuntime.Application.11"); 
    
    $creport = $crapp->OpenReport($my_report, 1); 
    
    $creport->EnableParameterPrompting = 0; 
    
    $creport->DiscardSavedData; 
    $creport->ReadRecords(); 
    
    $creport->ExportOptions->DiskFileName = $my_pdf; 
    $creport->ExportOptions->FormatType = 31; 
    $creport->ExportOptions->DestinationType=1; 
    $creport->Export(false); 
    
    $creport = null; 
    $crapp = null; 
    $ObjectFactory = null; 
    
  • cevap

    3

    olduğunu.

    $my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\invoice.rpt"; 
    $my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf"; 
    
    $ObjectFactory = new COM("CrystalReports115.ObjectFactory.1"); 
    
    $crapp = $ObjectFactory->CreateObject("CrystalRuntime.Application.11"); 
    
    $creport = $crapp->OpenReport($my_report, 1); 
    
    $creport->EnableParameterPrompting = 0; 
    $creport->FormulaSyntax = 0; 
    
    
    $creport->DiscardSavedData(); 
    $creport->RecordSelectionFormula = "{invoice.invoiceid} = 20070128114815"; 
    $creport->ReadRecords(); 
    
    $creport->ExportOptions->DiskFileName = $my_pdf; 
    $creport->ExportOptions->FormatType = 31; 
    $creport->ExportOptions->DestinationType=1; 
    $creport->Export(false); 
    
    $creport = null; 
    $crapp = null; 
    $ObjectFactory = null; 
    
    +0

    Bunun için teşekkürler. Yaptığım aynı SO sorusu tarafından sokuldun - CrystalRuntime, CrystalDesignRuntime değil – Patrick

    1
    1. Sen kullanmalıdır - Bu değişken ise, bu hiçbir şey yapmaz. Bir işlev çağrısı ise, $creport->DiscardSavedData() olmalıdır.

    2. senaryonun başlangıcında bu ayarları deneyin: Bu benim sorunum sabit neyi

      ini_set('error_reporting', -1); # displays all errors 
      ini_set('display_errors', 1); # reports errors to browser/console 
      
    +0

    Yardımın için teşekkürler! Anlamaya başladım. Ama ben de bu ayarlarla oynayacağım :) – Hackmodford

    İlgili konular