| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- // Include Database connection
- include_once "../../include/DB.php";
- // Include SimpleXLSXGen library
- include_once "../../include/SimpleXLSXGen.php";
- $id = 0;
- $fromDate="";
- $toDate="";
- $assetSqlfilter="";
- $assets = [
- ['#', 'Asset ID', 'Asset Name', 'IsInServiceCenter', 'Asset Category', 'Asset Created At', 'Asset Updated At']
- ];
- if (isset($_GET["fromDate"]) && !empty($_GET["fromDate"]) && isset($_GET["toDate"]) && !empty($_GET["toDate"])) {
- $fromDate=$_GET["fromDate"];
- $toDate=$_GET["toDate"];
- $assetSqlfilter="AND (asset.CreatedDate BETWEEN '$fromDate' AND '$toDate')";
- }
- if (isset($_GET["AssetID"]) && !empty($_GET["AssetID"])) {
- $AssetID=$_GET["AssetID"];
- $assetSqlfilter .="AND asset.AssetID='$AssetID'";
- }
- include 'asset_report.php';
- $xlsx = SimpleXLSXGen::fromArray($assets,'Assets');
- $xlsx->downloadAs('asset_report.xlsx'); // This will download the file to your local system
- // $xlsx->saveAs('asset_report.xlsx'); // This will save the file to your server
- echo "<pre>";
- print_r($assets);
|