first commit
This commit is contained in:
120
CONTENT/ROOT_URI/Admin/agent_View_report.php
Normal file
120
CONTENT/ROOT_URI/Admin/agent_View_report.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<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 method="post">
|
||||
<select name="Agent">
|
||||
<option value=""> Select Agent </option>
|
||||
<?php
|
||||
$users = glob(APP_DIR.'/CONTENT/ROOT_URI/Admin/users/*');
|
||||
$user_arr = array();
|
||||
for($i = 0; $i < count($users); $i++) {
|
||||
$new_user = explode('/', $users[$i]);
|
||||
$new_user = end($new_user);
|
||||
echo '<option value="'.$new_user.'">'.$new_user.'</option>';
|
||||
// $user_arr[$i] = $new_user;
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
<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;
|
||||
$agent="";if(isset($_POST['Agent'])) $agent=$_POST['Agent']; else $agent=$_SESSION['EMAIL'];
|
||||
|
||||
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`= '".$agent."' 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($_POST['tday']) && $_POST['tday']!="") report_view('day',$_POST['tday']);
|
||||
if(isset($_POST['tmonth']) && $_POST['tmonth']!="") report_view('month',$_POST['tmonth']);
|
||||
if(isset($_POST['dFrom']) && $_POST['dTo']!="") report_view($_POST['dTo'],$_POST['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');
|
||||
?>
|
||||
Reference in New Issue
Block a user