arif_grafin/CONTENT/ROOT_URI/Admin0/Report0.php

76 lines
2.3 KiB
PHP

<div class="container">
<form>
<input type="date" name="tday">
<input type="submit" class="btn-info" value="Daily Report">
</form>
<form>
<input type="date" name="tmonth">
<input type="submit" class="btn-info" value="Monthly Report">
</form>
</div>
<?php
function report_view($type,$dt) {
// $dateTo=$dt;
// $dateFrom = strtotime('-1 '.$type, strtotime($dt));
// $dateFrom = date("Y-m-d", $dateFrom);
$dateFrom=$dt;
if($type=="month") {$dateFrom= strtotime('-1 day', strtotime($dt)); $dateFrom = date("Y-m-d", $dateFrom);}
$dateTo = strtotime('+1 '.$type, strtotime($dt));
$dateTo = date("Y-m-d", $dateTo);
echo $dateFrom." -> ".$dateTo."(Up to)";
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$totalAmount=0;
echo '
<div class="container" style="margin-top: 70px;">
<h5>VIEW REPORT::::::::</h5><hr>
</div>
<div class="container">
<table class="table table-striped table-bordered table-hover table-responsive">
<tr>
<th>Transaction ID</th>
<th>Time</th>
<th>AC No</th>
<th>Amount</th>
</tr>';
$sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` WHERE `AT_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00.000000' AND '".$dateTo." 00:00:00.000000' ORDER BY `arif_tran`.`AT_ID` DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
//$ID=$row["GC_ID"];
// $tt=$row["AT_ID"]-10;
echo "
<tr>
<td>".$row["AT_ID"]. "</td>
<td>".$row["AT_TIMESTAMP"]. "</td>
<td>".$row["AT_ACID"]. "</td>
<td>".$row["AT_AMOUNT"]. "</td>
</tr>";$totalAmount+=$row["AT_AMOUNT"];
}
} else {
echo "0 results";
}
$conn->close();
echo '
</table>
<hr> <h2> Total Transaction amount : '.$totalAmount.'</h2>
</div>
';
}
if(isset($_GET['tday']) && $_GET['tday']!="") report_view('day',$_GET['tday']);
if(isset($_GET['tmonth']) && $_GET['tmonth']!="") report_view('month',$_GET['tmonth']);
//if(isset($_GET['Type']) && $_GET['Type']=="Loan") view_list_ac('Loan');
// if(isset($_GET['Type']) && $_GET['Type']=="Recurring") view_list_ac('Recurring');
// if(isset($_GET['Type']) && $_GET['Type']=="FD") view_list_ac('FD');
?>