當前位置: 首頁>>代碼示例>>PHP>>正文


PHP COM::LogOnServer方法代碼示例

本文整理匯總了PHP中COM::LogOnServer方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::LogOnServer方法的具體用法?PHP COM::LogOnServer怎麽用?PHP COM::LogOnServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在COM的用法示例。


在下文中一共展示了COM::LogOnServer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: print_pdf

 private function print_pdf($query = "", $param = array(), $db)
 {
     if (file_exists($this->pdf_name)) {
         if (!unlink($this->pdf_name)) {
             echo "Failed to clear temp.  please try again";
         }
     }
     try {
         $ObjectFactory = new COM("CrystalRunTime.Application") or die("cannot load cr com");
         $creport = $ObjectFactory->OpenReport($this->rpt_name, 1) or die("Couldn’t open report");
         $ObjectFactory->LogOnServer('PDSODBC.DLL', 'mysql_' . $db, $db, 'root', 'mysql');
         //$creport->RecordSelectionFormula="{company.company_name}='AL RUSHAID CONSTRUCTION CO. LTD.'";
         //$creport->RecordSelectionFormula="{ogmr.job_no}='530'";
         $creport->RecordSelectionFormula = $query;
         //$creport->RecordSelectionFormula= mysql_real_escape_string($query);
         $creport->EnableParameterPrompting = 0;
         $creport->DiscardSavedData;
         $creport->ReadRecords();
         if (count($param) > 0) {
             for ($i = 1; $i <= count($param); $i++) {
                 $field = $creport->ParameterFields($i);
                 $end = strlen(substr($creport->ParameterFields($i)->Name, 2)) - 1;
                 $paramName = substr($field->Name, 2, $end);
                 $res = @$field->SetCurrentValue($param[$paramName]);
                 if ($res != 0) {
                     return "Failed to create report.  Failed to set parameter {$i} with value " . $param[$i];
                 }
             }
         }
         $creport->ExportOptions->DiskFileName = $this->pdf_name;
         $creport->ExportOptions->FormatType = 31;
         $creport->ExportOptions->DestinationType = 1;
         $creport->Export(false);
         $crapp = null;
         $creport = null;
         $ObjectFactory = null;
         if (file_exists($this->pdf_name)) {
             echo "true";
             /*$pdf = file_get_contents($this->pdf_name);
             	    if(strlen($pdf) != filesize($this->pdf_name))
             	            return "Error: filesize=".filesize($this->pdf_name)." strlen=".strlen($pdf);
             		
             	    header("Pragma: ");
             	    header("Cache-Control: ");
             	    header("Content-type: application/pdf");
             	    //header("Content-Disposition: attachment;filename=" . extractName($this->rpt_name) . ".pdf"); // For IE
             	    header("Content-Disposition: attachment;filename=localhost/assets/pdf/company.pdf"); // For IE
             	    echo($pdf);
             	    exit();*/
         } else {
             echo "Failed to export";
         }
     } catch (Exception $e) {
         echo "Failed to connect to Crystal Reports 2008: {$e}";
     }
 }
開發者ID:jhersonn20,項目名稱:www,代碼行數:56,代碼來源:To_Pdf.php

示例2: COM

<?php

set_time_limit(0);
//if(isset($_GET['id']))
//{
//$id = $_GET['id'];
//} else {
//die('Please specify an ID');
//}
$path = "D:\\MYrep";
//$file = $chemin."\\bill_".$id.".pdf";
$app_obj = new COM("CrystalRuntime.Application") or die("Did not open");
$report = $path . "\\1234.rpt";
$rpt_obj = $app_obj->OpenReport($report, 1);
$app_obj->LogOnServer("p2ssql.dll", "host", "bdd", "userbd", "passwordbd");
$rpt_obj->EnableParameterPrompting = FALSE;
$rpt_obj->RecordSelectionFormula = "{F_DOCLIGNE.DO_Piece}='{$id}'";
$rpt_obj->ExportOptions->DiskFileName = $file;
$rpt_obj->ExportOptions->PDFExportAllPages = true;
$rpt_obj->ExportOptions->DestinationType = 1;
$rpt_obj->ExportOptions->FormatType = 31;
$rpt_obj->Export(false);
header("Content-Type: application/pdf");
readfile($file);
開發者ID:nirantarnoy,項目名稱:st2,代碼行數:24,代碼來源:crtest.php

示例3: COM

<?php

//set_time_limit(0);
ob_start();
$id = 12345;
$filename = "12345.pdf";
$params = 2015.0;
$params2 = 12;
$path = "D:\\MYrep";
//$file = $chemin."\\bill_".$id.".pdf";
$file = $path . "\\" . $id . ".pdf";
$app_obj = new COM("CrystalRuntime.Application") or die("Did not open");
$report = $path . "\\1234.rpt";
$rpt_obj = $app_obj->OpenReport($report, 1);
$app_obj->LogOnServer("p2ssql.dll", "localhost", "st_data", "sa", "Tamakogi2012");
$rpt_obj->EnableParameterPrompting = FALSE;
$rpt_obj->RecordSelectionFormula = "{rptinvoicesummarybysale.Year} = {$params} ";
$rpt_obj->ExportOptions->DiskFileName = $file;
$rpt_obj->ExportOptions->PDFExportAllPages = true;
$rpt_obj->ExportOptions->DestinationType = 1;
$rpt_obj->ExportOptions->FormatType = 31;
$rpt_obj->Export(false);
//header("location: http://localhost:81/yii2-st/backend/web/index.php?r=openreport/viewpdf");
header('Content-Type: application/pdf');
//header('Content-Disposition: attachment; filename="'.$filename2.'"');
readfile($file);
開發者ID:nirantarnoy,項目名稱:st2,代碼行數:26,代碼來源:viewreport.php


注:本文中的COM::LogOnServer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。