Link to home
Start Free TrialLog in
Avatar of Mutiara Bela
Mutiara Bela

asked on

Making dynamic financial reports with PHP, MySQL, and HTML

Hi
I need help to make financial reports.

I have a website that can show reports about sales and I need it to be printed when the user want it.

The condition is that:
1. Every page must have page number.
2. Printer can tell wheter to change to another paper or not, like a customer reports if the customers is change, so it will be printed to another page even to the current page for the current customer is just half the page.
3. There have to be header for every page and date too under the header, and the footer is just a straight line, like a border bottom.
4. It just can be printed if the user have the permission to do so.
5. It just can be exported if the user have the permission to do so, the export can be csv, excel, and pdf.
6. The tools control can be made by me and can be control by the permission the user have.

I already tried mpdf but I can't handle the download button and other tools because my reports is a dynamic one not the fixed that can be just called like a normal document.

What tools I can use to make the reports I need and with the condition I want?

Thank you...

This is the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <style>
	.table td {
		border-top:none;	
	}
	.titlerpt {
		font-size: larger;	
		color: #800000;
	}
	.tbltitle {
		border-bottom: 1px black solid;
		font-size: medium;
		color: #000080;
	}
	.tblisi {
		font-size: small;
	}
	
	@media print and (orientation:portrait) {	
		.table td {
			border-top:none;	
		}
		tr .titlerpt {
			font-size: x-large;	
		}
		tr .tbltitle {
			font-size: larger;
		}
		tr .tblisi {
			font-size: medium;
		}
	}

	</style>
    
    <script type="text/javascript">
	function printDiv(divName) {
     	var printContents    = document.getElementById(divName).innerHTML;
     	var originalContents = document.body.innerHTML;
			
     	document.body.innerHTML = printContents;
		window.print();
     	document.body.innerHTML = originalContents;
	}
	
    </script>
		
</head>

<body class=""> 
<!--<![endif]-->
   <div class="content" style="margin-left:0px;">
      <div class="breadcrumb">
      	  <div class="breadcrumb-inleft">
      	  	 <ul>
		        <li><a href="<?php echo $crootpath .'index.php';?>">Home</a> <span class="divider">/</span></li>
		        <li><a href="<?php echo $cdirpath .'phpsl/sreports.php';?>">Reports List</a> 
                	<span class="divider">/</span></li>
		        <li><a href="<?php echo $cdirpath .'phpsl/docs/cust2_doc.php';?>">Customer File</a>
                	<span class="divider">/</span></li>
        	    <li class="active">Report</li>
      	     </ul>
          </div>
          <div class="breadcrumb-inright">
          	 <?php if (isset($DtStatus) and !empty($DtStatus)) { ?>
             	<label>Report Name ==>  <i class="info"><?php echo $DtStatus; ?></i> </label>
             <?php } ?>
          </div>
      </div>     
      
      <div class="container-fluid">
         <div class="row-fluid">
             <a href="javascript:printDiv('printtTableArea');" class="btn btn-primary" id="printButton">Print</a>
			 <div class="well" style="overflow:auto;max-height:520px;" id="printtTableArea">
			    <table class="table">
		        <tbody>
	            <?php 
			 	if (isset($dt_custom) and count($dt_custom)>0) { 
					for ($ncount=0; $ncount<count($dt_custom); $ncount++) {
						if (($ncount%48)==0 or $ncount==0) {
					           echo "<tr><td colspan='7' height='20px;'></td></tr>";	
					           echo "<tr class='titlerpt'><td colspan='7' height='50px;'>
						   			<h2 align='center'>Customer File [Summary]</h2></td></tr>";	
					           echo "<tr><td colspan='7' height='20px;'></td></tr>";	
					           echo "<tr><td colspan='7' height='20px;'></td></tr>";	
					           echo "<tr class='tbltitle'>";	
		           	                   echo "<td><b>#</b></td>";
                    	                           echo "<td><b>Customer Name</b></td>";
                    	                           echo "<td><b>ID #</b></td>";
	                                           echo "<td><b>Phone</b></td>";
		 	                           echo "<td><b>Contact Person</b></td>";
			                           echo "<td><b>Credit Limit</b></td>";
			                           echo "<td><b>Balance</b></td>";
	 		      	                   echo "</tr>";
				                   echo "";

						   if ($cKdSales!=''){
						      echo "<tr class='tbltitle'><td colspan='7' style='padding-left:20px;'>Salesman : ".
							  		$dt_custom[$ncount][2]."</td></tr>";   } 
					      }
		            	                  echo '<tr class="tblisi">';
		               	                  echo '<td>'. ((($page_num - 1)*$rec_limit)+($ncount+1)) .'</td>';
						  echo '<td>'. substr($dt_custom[$ncount][1],0,30).'</td>';
		              	                  echo '<td>'. $dt_custom[$ncount][0] .'</td>';
		              	                  echo '<td>'. trim($dt_custom[$ncount][15]).', '. trim($dt_custom[$ncount][16]) .'</td>';
		              	                  echo '<td>'. $dt_custom[$ncount][18] .'</td>';
		              	                  echo '<td>'. number_format($dt_custom[$ncount][28],2,'.',',') .'</td>';
		              	                  echo '<td>'. number_format($dt_custom[$ncount][29],2,'.',',') .'</td></tr>';
					} 
                                }
				?>
	            </tbody>
	            </table>
                                
	         </div> <!-- End div well-->
         </div> <!-- End div row-fluid-->
      </div> <!-- End div container-fluid  -->
   </div> <!-- End div content   -->


</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
abandoned question - accepting the commonsense starting point