|
 |
|
วิธีเชื่อมต่อ Crystal Report กับ PHP มันสามารถทำได้อย่างไรค่ะ |
|
 |
|
|
 |
 |
|
สรุปว่าจะเป็น Crystal Report หรือ pdf
|
 |
 |
 |
 |
Date :
2011-08-04 12:00:08 |
By :
NineMee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อธิบายขั้นตอนน่ะค่ะ
1. ทำการรับค่าพารามิเตอร์ จากหน้าเว็บ โดย user
2. ส่งค่าตัวแปรไปยัง Crystal Report ที่มีอยู๋แล้วให้ดึงค่าที่ต้องการออกมา
3.นำค่าที่ได้แสดงผล ออกมาเป็นรายงานด้วย PDF
ไม่รู้ว่าสามารถทำได้หรือเป่า แต่หาในเน็ตเค้าบอกว่า PHP สามารถเชื่อมต่อกับ Crystal report ได้
แต่ยังหาวิธีทำไม่ได้
|
ประวัติการแก้ไข 2011-08-04 16:05:16 2011-08-04 16:05:50
 |
 |
 |
 |
Date :
2011-08-04 13:36:13 |
By :
nidnoiiz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่มีใครรู้เลยเหรอค่ะ เศร้าแหะ !!
|
 |
 |
 |
 |
Date :
2011-08-05 14:55:21 |
By :
nidnoiiz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
// Create an Crystal Object Factory.
$o_CrObjectFactory = new COM('CrystalReports11.ObjectFactory.1');
// Create the Crystal Reports Runtime Application.
$o_CrApplication =
$o_CrObjectFactory->CreateObject("CrystalRunTime.Application.11");
// Register the typelibrary.
com_load_typelib('CrystalDesignRunTime.Application');
// Load the report.
$o_CrReport = $o_CrApplication->OpenReport('C:\Report.rpt', 1); // 1
== crOpenReportByTempCopy.
// Logon to the database.
$o_CrReport->Database->LogOnServer
(
'odbc',
'Accounts',
registryDatabaseLocations::Database('Accounts'),
registryDatabaseLocations::Username('Accounts'),
registryDatabaseLocations::Password('Accounts')
);
// Don't tell anyone what is going on when running live.
$o_CrReport->DisplayProgressDialog = False;
$s_ExportedReport = 'C:\Report.pdf';
// Run the report and save the PDF to disk.
$o_CrReport->ExportOptions->DiskFileName = $s_ExportedReport;
$o_CrReport->ExportOptions->PDFExportAllPages = True;
$o_CrReport->ExportOptions->DestinationType = 1; // Export to File
$o_CrReport->ExportOptions->FormatType = 31; // 31 = PDF, 36 = XLS, 14 =
DOC
// Assign the parameters to the report.
$m_Stuff = new Variant();
$o_CrPeriodsParam =
$o_CrReport->ParameterFields->GetItemByName('PeriodIDs', $m_Stuff);
$o_CrPeriodsParam->ClearCurrentValueAndRange();
foreach($_SESSION['tabRG_PeriodIDs'] as $i_Period)
{
$o_CrPeriodsParam->AddCurrentValue(intval($i_Period));
}
$o_CrReport->ReadRecords();
$o_CrReport->Export(False);
?>
Go to : พอจะมีบทความเกี่ยวกับ php ติดต่อกับ Crystal Report ไหมครับ
|
 |
 |
 |
 |
Date :
2011-09-25 08:41:52 |
By :
thaicreate |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|