arif_grafin/CONTENT/ROOT_URI/Admin0/agent_View_report.php

106 lines
3.3 KiB
PHP

<div class="container">
<table>
<!-- <tr>
<td>
<form>
<input type="date" name="tday">
<input type="submit" class="btn-info" value="Daily Report">
</form>
</td>
<td>
<form>
<input type="date" name="tmonth">
<input type="submit" class="btn-info" value="Monthly Report">
</form>
</td>
</tr> -->
<tr><td>.</td><td>.</td></tr>
<tr>
<td colspan="2">
<form>
<label for="">From </label><input type="date" name="dFrom">
<label for="">To </label><input type="date" name="dTo">
<input type="submit" class="btn-info" value="Report">
</form>
</td>
</tr>
</table>
</div>
<?php
function report_view($type,$dt) {
$dateFrom=$dt;
if($type!="month" || $type!="day") {
$dateFrom= strtotime($dt); $dateFrom = date("Y-m-d", $dateFrom);
$dateTo= strtotime('+1 day', strtotime($type)); $dateTo = date("Y-m-d", $dateTo);
}
//$dateFrom=$dt;
else{
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 '<div class="container"> <h3>'.$dateFrom." -> ".$dateTo."(Up to)</h3> </div>";
$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>Name</th>
<th>Amount</th>
<th>commission</th>
</tr>';
$sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` INNER JOIN `".$GLOBALS['arif_ac']."` ON `".$GLOBALS['arif_tran']."`.`AT_ACID`=`".$GLOBALS['arif_ac']."`.`AA_ACNO` WHERE `AT_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00.000000' AND '".$dateTo." 00:00:00.000000' AND `AA_AGENT`= '".$_SESSION['EMAIL']."' ORDER BY `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["AA_NAME"]. "</td>
<td>".$row["AT_AMOUNT"]. "</td>
<td>".$row["AT_AMOUNT"]/100*2.5 . "</td>
</tr>";$totalAmount+=$row["AT_AMOUNT"];
}
} else {
echo "0 results";
}
$conn->close();
echo '
</table>
<hr> <h2> Total Transaction amount : '.$totalAmount.'</h2>
<hr> <h2> Total Commission amount : '.$totalAmount/100*2.5 .'</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['dFrom']) && $_GET['dTo']!="") report_view($_GET['dTo'],$_GET['dFrom']);
//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');
?>