| 12345678910111213141516171819202122232425262728293031 |
- <?php
- // Include Database connection
- include_once "../../include/DB.php";
- // Include SimpleXLSXGen library
- include_once "../../include/SimpleXLSXGen.php";
- $id = 0;
- $fromDate="";
- $toDate="";
- $serviceSqlfilter="";
- $services = [
- ['#', 'Service History ID', 'Asset ID', 'is Serviced', 'In Ward', 'out Ward', 'Service Created At', 'Service Updated At']
- ];
- if (isset($_GET["fromDate"]) && !empty($_GET["fromDate"]) && isset($_GET["toDate"]) && !empty($_GET["toDate"])) {
- $fromDate=$_GET["fromDate"];
- $toDate=$_GET["toDate"];
- $serviceSqlfilter="AND (servicehistory.CreatedDate BETWEEN '$fromDate' AND '$toDate')";
- }
- if (isset($_GET["AssetID"]) && !empty($_GET["AssetID"])) {
- $AssetID=$_GET["AssetID"];
- $serviceSqlfilter .="AND servicehistory.AssetID='$AssetID'";
- }
- include 'service_report.php';
- $xlsx = SimpleXLSXGen::fromArray($services,'Service');
- $xlsx->downloadAs('service_report.xlsx'); // This will download the file to your local system
- // $xlsx->saveAs('service_report.xlsx'); // This will save the file to your server
- echo "<pre>";
- print_r($services);
|