Solved

Migrating Away from Crystal Reports to Straight PHP

Posted on 2011-09-06
6
398 Views
Last Modified: 2012-05-12
I have interesting idea for a customer who uses Crystal Reports to run their invoices and certification letters on their Intranet.  

It is setup to pull data from a MySQL database, show the result in the web browser which they then click EXPORT then choose PDF and export it.  

My idea is to use fPDF (or something similar) to create the same report, PHP pulling in the data from the database and organizing it, then instantly making a PDF file with the file's default name (that they normally have to type in).  

Is there anything that Crystal Reports does that I could not simulate in PHP?
0
Comment
Question by:hydrazi
6 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 36489870
anything that Crystal Reports does...
That "anything" part covers a lot of ground.  But in my experience you can do a lot with FPDF.  It's time-consuming to set it up the first time, but once it's working, it is lightning fast and accurate in placement to about 1/100 inch.

Is there anything in particular that you are concerned about?
0
 
LVL 19

Expert Comment

by:GJParker
ID: 36495549
Why not use the development tools available with CR to automate the process with an ASP page
0
 
LVL 1

Assisted Solution

by:gimecoffee
gimecoffee earned 100 total points
ID: 36496516
anything that Crystal Reports does...
I've been working with PHP and MySQL for 14+ years and Crystal reports for almost 2.  There is nothing you can do in Crystal that can't be duplicated with PHP, SQL queries and FPDF if you've already got a web application running PHP.  Like Ray mentioned it is a little more time consuming to setup the layout in FPDF but I've found that pulling and organizing data with MySQL and PHP is a much easier and faster.  Could be because I've have a lot more experience with PHP than I do with Crystal but my data tends to be more complex to pull together (payroll services.)  I still write CR for staff that already have direct access to running CR reports but for everyone else I use PHP.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 108

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 36496735
In case you're interested here is the "hello world" exercise in FPDF.
http://www.laprbass.com/RAY_fpdf_hello_world.php

<?php // RAY_fpdf_hello_world.php
error_reporting(E_ALL);

// BRING IN THE PDF THING
require_once('fpdf16/fpdf.php');



// DEMONSTRATE THE BASICS OF FPDF



// SYNTHESIZE THE PDF FILE INFORMATION
$pdf_file_link = '/RAY_junk/' . 'temp_pdf_blue' . '.pdf';
$pdf_file_name = getcwd()     . $pdf_file_link;

// DO THE HELLO WORLD EXERCISE IN WHITE ON A BLUE BACKGROUND
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->SetFillColor(  0,   0, 255);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(40, 10, 'Hello World!', 0, 2, 'L', TRUE);

// WRITE THE PDF TO DISK
$pdf->Output($pdf_file_name, 'F');

// PRESENT A LINK
echo '<a target="my_PDF" href="' . $pdf_file_link . '">Blue PDF</a>';



// START OVER FOR A NEW PDF
unset($pdf);
echo PHP_EOL . "<br/>";

// SYNTHESIZE THE PDF FILE INFORMATION
$pdf_file_link = '/RAY_junk/' . 'temp_pdf_red' . '.pdf';
$pdf_file_name = getcwd()     . $pdf_file_link;

// DO THE HELLO WORLD EXERCISE IN WHITE ON A RED BACKGROUND
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->SetFillColor(255,   0,   0);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(40, 10, 'Hello World!', 0, 2, 'L', TRUE);

// WRITE THE PDF TO DISK
$pdf->Output($pdf_file_name, 'F');

// PRESENT A LINK
echo '<a target="my_PDF" href="' . $pdf_file_link . '">Red PDF</a>';

Open in new window

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36496998
What is the concern or reason for migrating away from Crystal and not to another reporting tool?

If it is the user interaction, there is no need to have them display the report then export it.  With Crystal you can export directly to PDF then view the PDF.

Have you considered the effort involved in changing horses at this point?

mlmcc
0
 

Author Comment

by:hydrazi
ID: 36519024
I think changing horses at this point is just what we want to do.  We are looking for faster, lower-overhead reports that go directly to PDF.  Crystal Reports is becoming an increasing expense and I do not think we need all the power it comes with.  

Sorry for the "anything crystal reports does" line.  Much too vague.  Still, the answers here are extremely helpful in that I am now convinced after much playing around with the above suggestions, that we are going to start our migration away from Crystal Reports.

Many thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now