![]() |
fhumanes 2/2/2014 |
Connecting to Jasper Server through webservices interface. |
A
|
Abul 2/2/2014 |
Connecting to Jasper Server through webservices interface. Examples: report.php: <?php if (isset($_REQUEST['rep'])){ if ($_REQUEST['rep']=='1'){ $listado='prueba6_1_1_1'; } if ($_REQUEST['rep']==2){ $listado='AuditoriaABAP2_1'; } if ($_REQUEST['rep']==3){ $listado='AuditoriaABAP2_1_1'; } } require_once('GenerateReport.php'); $client = new GenerateReport(); $report_unit = $listado; $report_path = "/reports/Nexus/"; $report_format = "PDF"; $report_params=$_REQUEST; $result = $client->printReport($report_path,$report_unit, $report_format,$report_params); header('Content-Type: application/pdf'); echo $result; ?> GenerateReport.php: <?php class GenerateReport { //Properties private $_wsdlURL; private $_username; private $_password; private $_soapClient; private $_imageFolder; private $_reportPath; private $_reportName; private $_outputFormat; private $_parameterArray; //Constructor public function construct() { // $config = parse_ini_file('config.ini',true); // $this->_wsdlURL = str_replace("\\", "/", dirname(FILE)) . '/' . $config['Jasper']['wsdlURL']; // $this->_username = $config['Jasper']['username']; // $this->_password = $config['Jasper']['password']; // $this->_imageFolder = str_replace("\\", "/", dirname(dirname(FILE))) . '/public/images/'; $this->_wsdlURL = "http://10.82.0.51:8080/jasperserver/services/repository"; $this->_username = "jasperadmin"; $this->_password = "jasperadmin"; $this->_imageFolder = "c:/temporal"; try { // $this->_soapClient = new SOAPClient($this->_wsdlURL, array('login' => $this->_username,'password' => $this->_password,'trace' => 1,)); $this->_soapClient = new SoapClient(null, array( 'location' => $this->_wsdlURL, 'uri' => 'urn:', 'login' => $this->_username, 'password' => $this->_password, 'trace' => 1, 'exception'=> 1, 'soap_version' => SOAP_1_1, 'style' => SOAP_RPC, 'use' => SOAP_LITERAL )); } catch (Exception $e) { throw $e; } } //Methods public function printReport($reportPath, $reportName, $outputFormat = "HTML", $parameterArray = "") { $this->_reportPath = $reportPath; $this->_reportName = $reportName; $this->_outputFormat = $outputFormat; $this->_parameterArray = $parameterArray; $requestXML = "<request operationName=\"runReport\">"; $requestXML .= "<argument name=\"RUN_OUTPUT_FORMAT\">$outputFormat</argument>"; $requestXML .= "<resourceDescriptor name=\"\" wsType=\"reportUnit\" uriString=\"$reportPath$reportName\" isNew=\"false\">"; $requestXML .= "<label></label>"; foreach ($parameterArray as $key=>$value) { $requestXML .= "<parameter name=\"$key\"><![CDATA[$value]]></parameter>"; } $requestXML .= "</resourceDescriptor></request>"; $params = array("request" => $requestXML ); $reportOutput = ""; try { $response = $this->_soapClient->runReport($requestXML); $reportOutput = $this->parseResponseWithReportData( $this->_soapClient->__getLastResponseHeaders(), $this->_soapClient->getLastResponse(), $outputFormat ); }//end of try catch (SoapFault $e) { if ($e->faultstring == 'looks like we got no XML document') { $reportOutput = $this->parseResponseWithReportData( $this->_soapClient->__getLastResponseHeaders(), $this->_soapClient->__getLastResponse(), $outputFormat ); }//end of if else { throw new Exception("Error Creating Report " . $e->faultstring); }//end of else }//end of catch return $reportOutput; }//end of function private function parseResponseWithReportData($responseHeaders, $response, $outputFormat) { preg_match('/boundary="(.*?)"/', $responseHeaders, $matches); $boundary = $matches[1]; $parts = explode($boundary, $response); $reportOutput = ""; switch ($outputFormat) { case 'HTML': foreach($parts as $part) { if (strpos($part, "Content-Type: image/png") !== false) { $start = strpos($part, "<") + 1; $length = (strpos($part, ">") - $start); $filename = substr($part, $start, $length) . '.png'; $file = fopen("$this->_imageFolder$filename","wb"); $contentStart = strpos($part, "PNG") - 1; $contentLength = (strpos($part, "--") - $contentStart) + 1; $contents = substr($part, $contentStart, $contentLength); fwrite($file, $contents); fclose($file); } if (strpos($part, "Content-Type: image/gif") !== false) { $start = strpos($part, "<") + 1; $length = (strpos($part, ">") - $start); $filename = substr($part, $start, $length) . '.gif'; $file = fopen("$this->_imageFolder$filename","wb"); $contentStart = strpos($part, "GIF"); $contentLength = (strpos($part, "--") - $contentStart) + 1; $contents = substr($part, $contentStart, $contentLength); fwrite($file, $contents); fclose($file); } if (strpos($part, "Content-Type: text/html") !== false) { $contentStart = strpos($part, '<html>'); $contentLength = (strpos($part, '</html>') - $contentStart) + 7; $reportOutput = substr($part, $contentStart, $contentLength); } }//end of for each break; case 'PDF': foreach($parts as $part) { if (strpos($part, "Content-Type: application/pdf") !== false) { $reportOutput = substr($part, strpos($part, '%PDF-')); break; } } //end of foreach break; case 'RTF': foreach($parts as $part) { if (strpos($part, "Content-Type: application/rtf") !== false) { $reportOutput = substr($part, (strpos($part, 'Content-Id: <report>')+24)); break; } } break; case 'XLS': foreach($parts as $part) { if (strpos($part, "Content-Type: application/xls") !== false) { $reportOutput = substr($part, (strpos($part, 'Content-Id: <report>') + 24)); break; } } break; case 'XLSX': foreach($parts as $part) { if (strpos($part, "Content-Type: application/xls") !== false) { $reportOutput = substr($part, (strpos($part, 'Content-Id: <report>') + 24)); break; } } break; case 'CSV': foreach($parts as $part) { if (strpos($part, "Content-Type: application/vnd.ms-excel") !== false) { $contentStart = strpos($part, 'Content-Id: <report>') + 24; $reportOutput = substr($part, $contentStart); break; } } break; } return $reportOutput; }//end of functoin }//end of class
|
![]() |
HJB 2/2/2014 |
http://demo.asprunner.net/volinrok_yahoo_com/Version71Demo/products_list.php - CHARTS / REPORTS AS DETAILS <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73899&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> |
A
|
Abhijeet author 2/2/2014 |
http://demo.asprunner.net/volinrok_yahoo_com/Version71Demo/products_list.php - CHARTS / REPORTS AS DETAILS <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=73900&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> ... with all due respect to the jaspering open source folks ..., the very best "2-in-1" charts / reporting web shampoo maker, namely PHPR v7.1, is said to get its 1st final release on 4th/5th instant. Just my 2 cents on the issue.
|
![]() |
HJB 2/3/2014 |
Abhijeet, as of v7.1 "customizable template" is offered as an option where one can place any wished field content under the VISUAL EDITOR section in that very shape you/your client finally wants to see it or in other words, in regard to yours "I am not able to move the fields to whichever position I want on the report to make it look form like" I must say that you are definitely wrong here on that issue. |
A
|
Abhijeet author 2/3/2014 |
Abhijeet, as of v7.1 "customizable template" is offered as an option where one can place any wished field content under the VISUAL EDITOR section in that very shape you/your client finally wants to see it or in other words, in regard to yours "I am not able to move the fields to whichever position I want on the report to make it look form like" I must say that you are definitely wrong here on that issue.
|
![]() |
HJB 2/3/2014 |
Abhijeet, sequel to NEW built-in v7.1 features in regard to (among others) charts/reports under master/detail, we really talk in fact about "report output page" here rather than so far seen LIST/VIEW standards, say, you are getting TWO different "report design" options here, 1st, the "online shape" one (by cistomizable HTML template) and 2nd the "printed matter" shaped one, each of which which can be individually designed as you like. Rather than to promote that new PHPR v7.1 features are that very remedy to cure any client, you need to weigh things here under "best compromise" here because any "third party" enhancement means, seeing it from the administration point of a project, wearing programmer's glasses, that you are about to play a "jump and run", so, while I'm sure that your "individual form design needs" are 100% covered here or in other words, in regard to "best compromise" I would advise to stay with only ONE design and code generation tool on a project, provided it is covering all your needs, simply because it can save you a lot of time on your project development and maintenance issues later on. Finally, since you raised the keyword "encryption" of fields, I think, you are much better off to start from this point of view in 1st instance when looking at the other things like form design and else while I'm sure, the v7.1 shall cover all your needs properly, giving you a "peace of mind" like atmosphere later on. |
A
|
Abhijeet author 2/3/2014 |
Abhijeet, sequel to NEW built-in v7.1 features in regard to (among others) charts/reports under master/detail, we really talk in fact about "report output page" here rather than so far seen LIST/VIEW standards, say, you are getting TWO different "report design" options here, 1st, the "online shape" one (by cistomizable HTML template) and 2nd the "printed matter" shaped one, each of which which can be individually designed as you like. Rather than to promote that new PHPR v7.1 features are that very remedy to cure any client, you need to weigh things here under "best compromise" here because any "third party" enhancement means, seeing it from the administration point of a project, wearing programmer's glasses, that you are about to play a "jump and run", so, while I'm sure that your "individual form design needs" are 100% covered here or in other words, in regard to "best compromise" I would advise to stay with only ONE design and code generation tool on a project, provided it is covering all your needs, simply because it can save you a lot of time on your project development and maintenance issues later on. Finally, since you raised the keyword "encryption" of fields, I think, you are much better off to start from this point of view in 1st instance when looking at the other things like form design and else while I'm sure, the v7.1 shall cover all your needs properly, giving you a "peace of mind" like atmosphere later on.
|
![]() |
HJB 2/3/2014 |
http://asprunner.com/tmp/phprunner-trial-setup.exe - v7.1 preview download with whopping 21 days "peace of mind" period |
A
|
Abul 2/22/2014 |
Jasper report is not working in phprunner project with encrypted fields. The encryption/decryption method used in phprunner does not work in Jasper report I saw. May be some one can provide good solution.
|
A
|
Abhijeet author 3/27/2014 |
Hi Walk2fly ! |
![]() |
Admin 3/27/2014 |
What is "form like report"? Screenshot please. |
A
|
Abhijeet author 3/28/2014 |
What is "form like report"? Screenshot please.
|
![]() |
Admin 3/28/2014 |
This is not a report but a simple view page with data from both master and details tables on the same screen. This functionality been available in PHPRunner forever. |
A
|
Abhijeet author 3/28/2014 |
I am confused. Are you showing me the invoice template ? Actually Invoice is just one of the example, it may be cash voucher, or a cash receipt or a admission form, all these things needs to be printed may be with a logo and nice looking features. view page is not always helpful and suitable for printing purposes. |