PHP - Something Like Crystal Report Or Active Reports For Php?
hi,
i looking for a design report like crystal report or active reports but for php the objective is creat a report using mysql data and save the template and load that report in a pdf file for print or save any one know something like that? i already use classes like class.ezpdf.php but i spend many hours creating complex reports, all is created using a text editor.. thanks for your help Similar TutorialsHi Guys My site has a shout box, now and again people post inappropriate content and if a moderator is not online to mute them it doesnt look good for other users. I have written a snippet of code to report an offender. My goal is that if 3 different people report an offender the site auto mutes them. (manual mute function already exists for moderators) I setup a table that records the reporters name the offenders name the post id the message content and the time stamp. I have never been good at counting num rows etc and need some help in what direction to go in. My current code that inserts the reported content. Code: [Select] mysql_query("INSERT INTO `chicka_pets`.`records_sbreports` (`id`, `offender`, `reporter`, `post_id`, `post_content`, `timestamp`) VALUES ('', '$offender', '$username', '$id', '$sbmessage', '$timestamp')"); I am guessing that somewhere after that I need some sort of count numrows on the post id where reporter is NOT the same and then an if numrows >2 set offender to mute my problem is how to do the num rows bit where the reporters are unique? Any help is much appreciated I need to email this report but I don't know where to start
I have included the report code.
<html> <head> <title>Customer Load Report</title> </head> <body> <h1>Customer Load Report</h1> <?php $custid=$_POST["Cust_ID"]; $connect =odbc_connect("removed"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql="SELECT m1_DC.dbo.organizationlocations.cmlName ,m1_DC.dbo.SalesOrders.OMPSHIPPINGMETHODID ,m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER ,m1_DC.dbo.SalesOrders.ompCustomerPO ,m1_DC.dbo.SalesOrders.UOMPTOTALBOXCOUNT ,m1_DC.dbo.SalesOrders.UOMPVOLUMETOTAL ,m1_DC.dbo.organizationlocations.CMLADDRESSLINE1 ,m1_DC.dbo.organizationlocations.CMLADDRESSLINE2 ,m1_DC.dbo.organizationlocations.CMLCITY ,m1_DC.dbo.organizationlocations.CMLSTATE ,m1_DC.dbo.organizationlocations.CMLPOSTCODE ,m1_DC.dbo.SalesOrders.OMPREQUESTEDSHIPDATE ,m1_DC.dbo.SalesOrders.ompSalesOrderID ,convert(varchar(10),m1_DC.dbo.SalesOrders.ompRequestedShipDate,110) as ShipDate FROM m1_DC.dbo.SalesOrders LEFT OUTER JOIN m1_DC.dbo.organizationlocations ON ompshiporganizationid = cmlorganizationid AND ompshiplocationid = cmllocationid WHERE m1_DC.dbo.SalesOrders.ompCustomerOrganizationID='$custid' and (ompOrderDate>=CONVERT(VARCHAR(10),DATEADD(day, -7, getdate()),110) or convert(varchar(10),m1_DC.dbo.SalesOrders.ompRequestedShipDate,110) >=getdate())"; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } $data= ''; while (odbc_fetch_row($result)) { $cmlName=odbc_result($result,"cmlName"); $ompCustomerPO=odbc_result($result,"ompCustomerPO"); $UOMPTOTALBOXCOUNT=odbc_result($result,"UOMPTOTALBOXCOUNT"); $UOMPVOLUMETOTAL=odbc_result($result,"UOMPVOLUMETOTAL"); $CMLADDRESSLINE1=odbc_result($result,"CMLADDRESSLINE1"); $CMLADDRESSLINE2=odbc_result($result,"CMLADDRESSLINE2"); $CMLCITY=odbc_result($result,"CMLCITY"); $CMLSTATE=odbc_result($result,"CMLSTATE"); $CMLPOSTCODE=odbc_result($result,"CMLPOSTCODE"); $ompSalesOrderID=odbc_result($result,"ompSalesOrderID"); $ompRequestedShipDate=odbc_result($result,"ShipDate"); $data .= "<td style='text-align:left' > $ompCustomerPO</td>"; $data .= "<td style='text-align:left'> $UOMPTOTALBOXCOUNT</td>"; $data .= "<td style='text-align:left'> $UOMPVOLUMETOTAL</td>"; $data .= "<td style='text-align:left'> $CMLADDRESSLINE1</td>"; $data .= "<td style='text-align:left'> $CMLADDRESSLINE2</td>"; $data .= "<td style='text-align:left'> $CMLCITY</td>"; $data .= "<td style='text-align:left'> $CMLSTATE</td>"; $data .= "<td style='text-align:left'> $CMLPOSTCODE</td>"; $data .= "<td style='text-align:left'> $ompSalesOrderID</td>"; $data .= "<td style='text-align:left'> $ompRequestedShipDate</td></tr>"; } echo "<table><tr>"; echo "<th>PO</th>"; echo "<th>Box_count</th>"; echo "<th>Cubes</th>"; echo "<th>ADDRESSLINE</th>"; echo "<th>ADDRESS2</th>"; echo "<th>CITY</th>"; echo "<th>STATE</th>"; echo "<th>ZIP</th>"; echo "<th>Order_ID</th>"; echo "<th>Ship Date</th></tr>"; echo $data; odbc_close($connect); ?> </body> </html> Hello guys. By the end of the day, my client wants the daily report sent to his email account in .xls format. how can i attain this? I know the php mail() function but i dont know how will php create an excel file and email it to my client automatically. Where should i start? Thanks guys! Have you guys ever build a smart queries for users too generate reports basically on anything they may want. I am looking on making something very user friendly. I do not have any ideas where to start
Hello I am using SQL Server 2008 and Xampp server for PHP. I am trying to call SQL Server reports from PHP and I am using the code from https://ssrsphp.code...ussions/577518# I can call the URL which connects to the Reports server from PHP but when I try to click the dropdown and run the reports I get an error. Fatal error: Class 'PReportException' not found in E:\PHP_SRS\ssrsphp\Factory\SSRSTypeFactory.php on line 75 Can someone please tell me how to fix this error ? Thanks Hi guys, I want to generate reports and i want to use some fields of one table and other fields of another table. How can i use that? Ex. customer(customer_id, full_name,name_with_initials, address, contact_number,gender) transaction_table(tran_ID, account_number,account_type,transaction_type, amount, Date) If i want to use only customer_id, tran_ID, full_name and amount how can i use them to generate reports. I want them to be taken as fields of one table and use it.. Thanks, Heshan Good day, How can I create a pdf report on my web page pulling out data from my database. I have never done this before I just need an idea. Hi all, I have a few questions and like some input on how best to approach this, I have a form in which customers can order different size online ads, the form has fields such as customer name, sales rep name, date needed by etc, my issue is I want to be able to run a report on how many different size ads I'm building in a day or month, would using MySQL be my solution to this? My PHP form right now gathers the information entered and sends me an email. Hi, I have to build some reports based on mysql queries. Nothing fancy, just text, columns... There are a lot of paid softwares but I can't (and don't want to) spend any $$ right now... So, considering that I want very simple reports almost like a table with heading and subtotals, I should write it myself. But I don't know how (still...). I'm looking for tips, tutorials, ebooks... anything that explains how to make a very simply report. Regards, Pedro. Hi all, For a logging tool I need to make some automated reports. On 1 page it needs to give for 4 clients the amount of calls per month for the last 12 months. Also it needs to give the amount of calls for the employees per month for the last 12 months. I was hoping you could help me with a better solution than seperate queries. Gr Ryflex Hi All, I am trying to generate a PDF report using the below code. the report is being generated perfectly. The problem that I face is that, while printing the report the browser disregards the "IF" condition that I have given in the code. Explanation : ----------------- It prints all the data in the MySQL database wherein I wanted the data to be printed only on a certain condition. How do I achieve this? Quote <?php mysql_connect('localhost','user','pass'); mysql_select_db('vaccine'); $array = mysql_query("SELECT cattle_n FROM vactbl"); $num_rows = mysql_num_rows($array); $array = mysql_query("SELECT * FROM vactbl"); $num_rows = mysql_num_rows($array); while($info = mysql_fetch_array( $array )) { $mas_date = $info['masdt']; $mas_time = strtotime($mas_date); $two_week = strtotime("+2 week"); $rpt_date = abs($two_week - $mas_time); if ($rpt_date >= 7776000) { require('mysql_table.php'); class PDF extends PDF_MySQL_Table { function Header() { //Title $this->SetFont('Arial','B',40); $this->Cell(0,6,'Cattle List',0,1,'C'); $this->Ln(10); //Ensure table header is output parent::Header(); } } //Connect to database $pdf=new PDF(); $pdf->AddPage(); //First table: put all columns automatically //$pdf->Table('select * from cattle_det order by no'); //$pdf->AddPage(); //Second table: specify 3 columns $pdf->AddCol('cattle_n',20,'Cattle','C'); $pdf->AddCol('masdt',40,'Mastitis Date', 'C'); $pdf->AddCol('fmdt',40,'FM Date','C'); $pdf->AddCol('onedt',40,'Vaccine1 Date','C'); $pdf->AddCol('twodt',40,'Vaccine2 Date','C'); $prop=array('HeaderColor'=>array(255,150,100), 'color1'=>array(210,245,255), 'color2'=>array(255,255,210), 'padding'=>2); $pdf->Table('select cattle_n, masdt, fmdt, onedt, twodt from vactbl order by cattle_n limit 0,10',$prop); $pdf->Output(); } else {} } ?> Hi guys, this is very urgent. Can anyone help me out..... I want to generate reports using php and MySQL. I have one table which includes customer_id, full_name, name_with_initials, address, contact_number and gender fields. I want to print the details of all the records of the table. It should be good if results will come on a PDF format. Thanks, ok. this may make now sense at all, I will try to explain as best as I can. anyways, what I need is for a mysql query to run that will pull all data from table payment between certain days. Then all the rows will show, but I want only one row with each cart_id(there will be multiple) to show. After it does that, in a new column on a table, all the payment types with the amount will show with a slash between each one. I want all of this in a table generated from a php loop. maybe a visual represenation will be better. I hope the picture I attached makes a bit more sense. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=314049.0 Hello, I have a database with the following tables: students groups exams examDay relation master detail ======= ===== ===== ======= ====== ====== ===== idStudent idGroup idExam idExDay idRelation idMaster idDetail idGroup groupName examName exDate idGroup idGroup idMaster studName idExDay idRelation idExam idExam idStudent coursesAtt idExDay I am trying to make a report from the Master and Detail tables that will have the table header like this: Group | Examination Date | Student Name | Exam1 | Exam2| .... | Exam n in which Exam1, Exam2,... are the exams names and they had to take the values from coursesAtt column. Is this possible? I could make a view (doing joins and group by) by the results will be displayed on row. That's why I ask for your help. Thanks Hi there I have a PHP file that works perfectly when I run it in my browser (compiles a report and saves it to my server), however when run from Cron gives a totally different output. Below is the code, and below that is the output I get when run from Cron. <?php include("db_conn.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Customer Appreciation Project</title> </head> <body> <?php $date = date("Y-m-d"); $time = date("h:i:s",time()); $file = $date.".html"; $fp=@fopen("active_members/".$file, 'w'); $content = "<html><head><title>Active Members Report</title></head><body>"; $content = $content . "<h1>Active Members</h1>"; $content = $content . "<p><font size=1>Report run on ". $date . " at ". $time."</font></p>"; $fetch_members = mysql_query("SELECT * FROM membership_periods WHERE (membership_periods.Start_Date <= Now() AND membership_periods.End_Date >= Now()) ORDER BY Member_Number"); if (mysql_num_rows($fetch_members) == "0") { $content = $content . "<p>No results were found.</p>"; } else { $content = $content . "<table border=0 cellpadding=2 width=100%>"; $content = $content . "<tr><td><b>Member Number</b></td><td><b>Start Date</b></td><td><b>End Date</b></td><td><b>Affiliation</b></td><td><b>Voucher</b></td></tr>"; while($row = mysql_fetch_array($fetch_members)) { $content = $content . "<tr><td>". $row['Member_Number'] ."</td><td>". $row['Start_Date']."</td><td>". $row['End_Date'] ."</td>"; $Affiliation_ID = $row['Affiliation_Group_ID']; if (Affiliation_ID > 0) { $fetch_affiliation= mysql_query("SELECT * FROM affiliation_groups WHERE ID = '$Affiliation_ID'"); $Affiliation_Group_Name = mysql_result($fetch_affiliation, 0, "Affiliation_Group_Name"); $content = $content . "<td>". $Affiliation_Group_Name ."</td>"; } else { $content = $content . "<td> </td>"; } $Member_Number = $row['Member_Number']; $fetch_member_id = mysql_query("SELECT ID FROM members WHERE Member_Number = '$Member_Number'"); $Member_ID = mysql_result($fetch_member_id, 0, "ID"); $fetch_voucher = mysql_query("SELECT Voucher_ID FROM reward_assignments WHERE Member_ID = '$Member_ID' AND Reward_Valid_To >= Now()"); if (mysql_num_rows($fetch_voucher) > 0) { $Voucher_ID = mysql_result($fetch_voucher, 0, "Voucher_ID"); $fetch_voucher_no = mysql_query("SELECT Voucher_Number FROM reward_vouchers WHERE ID = '$Voucher_ID'"); $Voucher_Number = mysql_result($fetch_voucher_no, 0, "Voucher_Number"); } $content = $content . "<td>". $Voucher_Number ."</td></tr>"; $Affiliation_Group_Name = ""; $Voucher_Number = ""; } $content = $content . "</table>"; } $content = $content . "</body></html>"; fwrite($fp, $content); fclose($fp); ?> </body> </html> And this is the Output I get mailed to me when Cron job runs: PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Customer Appreciation Project</title> </head> <body> PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Undefined variable: Voucher_Number in /var/www/reports/active_members.php on line 63 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Notice: Use of undefined constant Affiliation_ID - assumed 'Affiliation_ID' in /var/www/reports/active_members.php on line 40 PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/reports/active_members.php on line 75 PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/reports/active_members.php on line 76 </body> </html> Any assistance would be much appreciated. Hi I have a db that has the following Data for example: PolicyNumber, StoreId, ConsultantName,ClientName, ClientSurname I would like to have a report that will give me a list of policies done for that day seperated by store printed to PDF. So Basically Store - 12CEL 24Hr001 Bob Joe Soap 24Hr002 Bill Gill Henry Store - 1156 24Hr003 Luke Manfred Kiy 24Hr004 Peter Ursula Jent I currently use R&OS for pdf Printing http://www.ros.co.nz/pdf The Code below Gives me all policies, I just need to now seperate them in the PDF //include pdf class include ('class.ezpdf.php'); //Include PHP Mailer Class require("class.phpmailer.php"); //Connect to database mysql_connect("localhost", "root", ""); @mysql_select_db("mobility") or die("Unable to select database"); $queryP= mysql_query("SELECT * FROM tblpolicies WHERE CaptureDate='2006-04-03' ORDER BY StoreId"); $pdf =& new Cezpdf(); //$pdf->addJpegFromFile('policy.jpg',60,$pdf->y-750,500,0); $pdf->selectFont('./fonts/Helvetica.afm'); $p = 750; While($x=mysql_fetch_array($queryP)){ $pdf->addText(50,$p,7,"{$x['PolicyNumber']}"); $pdf->addText(80,$p,7,"{$x['StoreId']}"); $pdf->addText(120,$p,7,"{$x['NickName']}"); $pdf->addText(220,$p,7,"{$x['ClientsName']}"); $pdf->addText(330,$p,7,"{$x['DateReceived']}"); $pdf->addText(410,$p,7,"{$x['Comments']}"); $p = $p - 10; if($p == 10){ $pdf->ezNewPage(); $p = 750; } } $pdf->ezText("\n\n\n\n\n\n\n" . $body,16,array('justification'=>'centre')); $pdf->output(); $pdf->ezStream(); //write pdf stream to pdf file $pdfcode = $pdf->ezOutput(); $fp=fopen('policy.pdf','wb'); fwrite($fp,$pdfcode); fclose($fp); Hello i am working on an application where i want to count from a selected date to another date and query all entries my database right now is composed of the following sales_id barcode_id student_id type of lunch date i have created the count per day, but now dont know how to go about to query the results and the count for the month. Code: [Select] $query = 'SELECT COUNT(*) FROM `sales` WHERE `tlunch` = 1 AND DATE(date) = CURDATE()'; $result = mysql_query($query) or die('Sorry, we could not count the number of results: ' . mysql_error()); $free = mysql_result($result, 0); has any one done something similar This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314453.0 Hi, How can I get others informations on another page by clicking on one row's value I have this code, but it doesn't work: while($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo"<th><p><a href='student.php?id='".$row['topic']."'\'>".$row['topic']."</p></a></th>"; echo "</tr>"; } echo "</table>"; Student.php <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("college", $con); $result = mysql_query("SELECT * FROM students"); $topic = $_Get['topic']; while($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo "<th><p>" . $row['month']." " .$row['datetime']."</p></th>"; echo"<th><p>". $row['topic'] ."</p></th>"; echo "<th><p>" . $row['gender'] . "</p></th>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo "<th ><p>" . $row['id'] . "</p></th>"; echo "</tr>"; echo "</table>"; mysql_close($con); } ?> |