v2
This commit is contained in:
@@ -59,21 +59,45 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<?php
|
||||
$userType = $_SESSION['type'] ?? '';
|
||||
|
||||
if ($userType === 'admin') {
|
||||
// Admin gets everything
|
||||
?>
|
||||
<li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
|
||||
<li><a href="/Admin/Create_AC_FD">New FD</a></li>
|
||||
<li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
|
||||
<li><a href="/Admin/Add_group">Add New Group</a></li>
|
||||
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
|
||||
<li><a href="/Admin/Trans_New">Transaction</a></li>
|
||||
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
|
||||
<li><a href="/Admin/agent_View_report">Commission</a></li>
|
||||
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
|
||||
<li><a href="/Admin/Report">Report</a></li>
|
||||
<li><a href="/Admin/Due">Deemand Sheet</a></li>
|
||||
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
|
||||
<?php
|
||||
} elseif ($userType === 'bm') {
|
||||
// Branch Manager menu
|
||||
?>
|
||||
<li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
|
||||
<li><a href="/Admin/Create_AC_FD">New FD</a></li>
|
||||
<li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
|
||||
<li><a href="/Admin/Add_group">Add New Group</a></li>
|
||||
<li><a href="/Admin/Trans_New">Transaction</a></li>
|
||||
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
|
||||
<li><a href="/Admin/agent_View_report">Commission</a></li>
|
||||
<?php
|
||||
} elseif ($userType === 'agent') {
|
||||
// Agent menu
|
||||
?>
|
||||
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
|
||||
<li><a href="/Admin/Due">Deemand Sheet</a></li>
|
||||
<li><a href="/Admin/Report">Report</a></li>
|
||||
<!-- <li><a href="/Admin/Revert">Revert</a></li> -->
|
||||
<?php
|
||||
if($_SESSION['type'] === 'admin'){ ?>
|
||||
<li><a href="/Admin/agent_View_report">Commission</a></li>
|
||||
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
|
||||
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
||||
@@ -113,11 +113,12 @@ function report_view($type, $dt) {
|
||||
$result = $conn->query($sql);
|
||||
if ($result && $result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes"));
|
||||
echo "
|
||||
<tr>
|
||||
<td>".$row["AT_ID"]."</td>
|
||||
".($_SESSION['type'] === 'admin' ? "<td>".$row["AA_AGENT"]."</td>" : "")."
|
||||
<td>".$row["AT_TIMESTAMP"]."</td>
|
||||
<td>".$kolkataTime."</td>
|
||||
<td>".$row["AT_ACID"]."</td>
|
||||
<td>".$row["AA_NAME"]."</td>
|
||||
<td>".$row["AT_AMOUNT"]."</td>
|
||||
|
||||
@@ -7,42 +7,56 @@
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
// grafinn01
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user_id = $_POST['user_id'];
|
||||
|
||||
if (empty($_POST['user_name']) || empty($_POST['user_phone']) || empty($_POST['password'])) {
|
||||
die("All fields are required.");
|
||||
}
|
||||
|
||||
$user_name = $_POST['user_name'];
|
||||
$user_phone = $_POST['user_phone'];
|
||||
$user_name = $_POST['user_name'] ?? '';
|
||||
$user_phone = $_POST['user_phone'] ?? '';
|
||||
$type = $_POST['type'] ?? 'agent';
|
||||
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
||||
$comiRate = $_POST['comi_rate'] ?? null;
|
||||
$passwordPlain = $_POST['password'] ?? '';
|
||||
|
||||
if (!preg_match("/^[0-9]{10}$/", $user_phone)) {
|
||||
die("Invalid phone number format");
|
||||
// Validation
|
||||
if (empty($user_name) || empty($user_phone) || empty($passwordPlain)) {
|
||||
$error = "All fields are required.";
|
||||
} elseif (!preg_match("/^[0-9]{10}$/", $user_phone)) {
|
||||
$error = "Invalid phone number format.";
|
||||
} else {
|
||||
$password = password_hash($passwordPlain, PASSWORD_DEFAULT);
|
||||
|
||||
// Profile Picture Upload
|
||||
$profilePicPath = null;
|
||||
if (isset($_FILES['profile_pic']) && $_FILES['profile_pic']['error'] === UPLOAD_ERR_OK) {
|
||||
$uploadDir = __DIR__ . "/picture/";
|
||||
if (!file_exists($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
$fileTmp = $_FILES['profile_pic']['tmp_name'];
|
||||
$fileName = time() . "_" . basename($_FILES['profile_pic']['name']);
|
||||
$filePath = $uploadDir . $fileName;
|
||||
if (move_uploaded_file($fileTmp, $filePath)) {
|
||||
$profilePicPath = "picture/" . $fileName;
|
||||
} else {
|
||||
$error = "Failed to upload profile picture.";
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($error)) {
|
||||
$table = $GLOBALS['arif_users'] ?? 'arif_users';
|
||||
|
||||
$sql = "INSERT INTO `$table` (user_id, password, type, user_name, user_phone) VALUES (?, ?, ?, ?, ?)";
|
||||
$sql = "INSERT INTO `$table`
|
||||
(user_id, password, type, user_name, user_phone, comi_rate, profile_pic)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $conn->prepare($sql);
|
||||
|
||||
if (!$stmt) {
|
||||
die("Prepare failed: " . $conn->error);
|
||||
}
|
||||
|
||||
$stmt->bind_param("sssss", $user_id, $password, $type, $user_name, $user_phone);
|
||||
$stmt->bind_param("sssssss", $user_id, $password, $type, $user_name, $user_phone, $comiRate, $profilePicPath);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo "<div class='alert alert-success'>User <strong>{$user_name}</strong> added successfully.</div>";
|
||||
$success = "User <strong>{$user_name}</strong> added successfully.";
|
||||
} else {
|
||||
echo "<div class='alert alert-danger'>Failed to add user <strong>{$user_name}</strong>. Error: " . $stmt->error . "</div>";
|
||||
$error = "Failed to add user: " . $stmt->error;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'] . " ORDER BY type, user_id";
|
||||
@@ -65,7 +79,7 @@
|
||||
<div class="container">
|
||||
<h3>Add New Agent</h3><hr>
|
||||
|
||||
<form method="post">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="row">
|
||||
<!-- Left Column -->
|
||||
<div class="col-md-6">
|
||||
@@ -84,17 +98,27 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type">User Type</label>
|
||||
<select class="form-control" id="type" name="type" required>
|
||||
<option value="agent" selected>Agent</option>
|
||||
<select onchange="showCommissionField();" class="form-control" id="user-type" name="type" required>
|
||||
<option value="">-Select-</option>
|
||||
<option value="agent" >Agent</option>
|
||||
<option value="admin">Admin</option>
|
||||
<option value="supervisor">Supervisor</option>
|
||||
<option value="bm">BRanch Manager</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="commission-field" style="display: none;">
|
||||
<label for="comi_rate">Commission Rate (%)</label>
|
||||
<input type="number" class="form-control" id="comi_rate" name="comi_rate" value="3" placeholder="" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Enter Password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="profile_pic">Profile Picture</label>
|
||||
<input type="file" class="form-control" id="profile_pic" name="profile_pic" accept="image/*">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success w-100">Add Agent</button>
|
||||
@@ -115,10 +139,12 @@
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Profile</th>
|
||||
<th>User ID</th>
|
||||
<th>User Type</th>
|
||||
<th>Name</th>
|
||||
<th>Phone</th>
|
||||
<th>Comi Rate (%)</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -127,6 +153,14 @@
|
||||
<?php foreach ($agentList as $user): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user['id']); ?></td>
|
||||
<td>
|
||||
<?php if(!empty($user['profile_pic'])): ?>
|
||||
|
||||
<img src="/CONTENT/ROOT_URI/Admin/<?php echo $user['profile_pic']; ?>" width="40" height="40" style="border-radius:50%;">
|
||||
<?php else: ?>
|
||||
<span>No Photo</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($user['user_id']); ?></td>
|
||||
<td class="badge-cell">
|
||||
<span class="badge <?php echo $user['type'] === 'admin' ? 'badge-primary' : 'badge-secondary'; ?>">
|
||||
@@ -135,6 +169,7 @@
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($user['user_name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($user['user_phone']); ?></td>
|
||||
<td><?php echo htmlspecialchars($user['comi_rate']); ?></td>
|
||||
<td>
|
||||
<a href="edit_user?id=<?php echo $user['id']; ?>" class="btn btn-sm btn-warning">Edit</a>
|
||||
<?php if($user['type'] !== 'admin') { ?>
|
||||
@@ -234,6 +269,18 @@
|
||||
}
|
||||
notif.innerHTML = res_txt;
|
||||
}
|
||||
|
||||
function showCommissionField(){
|
||||
const selectedUserType = document.getElementById('user-type').value;
|
||||
const commissionField = document.getElementById('commission-field');
|
||||
if(selectedUserType === 'agent'){
|
||||
commissionField.style.display = 'block';
|
||||
}else{
|
||||
commissionField.style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -382,11 +382,12 @@ if(isset($_GET["no"])){
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
//$ID=$row["GC_ID"];
|
||||
$kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes"));
|
||||
echo "
|
||||
<tr>
|
||||
<td>".$rowcount. "</td>
|
||||
<td>".$row["AT_ID"]. "</td>
|
||||
<td>".$row["AT_TIMESTAMP"]. "</td>
|
||||
<td>".$kolkataTime. "</td>
|
||||
<td>".$row["AT_ADMIN"]. "</td>
|
||||
<td>".$row["AT_ACID"]. "</td>
|
||||
<td>".$row["AT_AMOUNT"]. "</td>
|
||||
|
||||
@@ -161,7 +161,7 @@ function view_list_ac($type) {
|
||||
} else {
|
||||
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TYPE`='".$type."' AND `AA_AGENT`='".$_SESSION['user_id']."' ORDER BY `AA_ID` DESC";
|
||||
}
|
||||
} elseif($_SESSION['type'] === 'admin') {
|
||||
} elseif($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm') {
|
||||
if($type === 'Closed-Acc') {
|
||||
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TYPE`='Loan' AND `STATUS`='closed' ORDER BY `AA_ID` DESC";
|
||||
} elseif($type === 'Matured-Recurring') {
|
||||
|
||||
@@ -1,120 +1,118 @@
|
||||
<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
|
||||
// ---- Default date range ----
|
||||
$today = date("Y-m-d"); // Today date
|
||||
$monthStart = date("Y-m-01"); // first date of each month
|
||||
$dFrom = $_GET['dFrom'] ?? $monthStart;
|
||||
$dTo = $_GET['dTo'] ?? $today;
|
||||
?>
|
||||
|
||||
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 class="container mt-4">
|
||||
<div class="card shadow-lg p-4 rounded-3">
|
||||
<h4 class="mb-3">Commission Report</h4>
|
||||
<form method="get" class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">From</label>
|
||||
<input value="<?= $dFrom ?>" type="date" name="dFrom" class="form-control" required>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">To</label>
|
||||
<input value="<?= $dTo ?>" type="date" name="dTo" class="form-control" required>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-items-end" style="margin-top: 25px;">
|
||||
<button type="submit" class="btn btn-info w-100">Generate Report</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</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";
|
||||
<?php
|
||||
function commission_report($dateFrom, $dateTo) {
|
||||
echo '<div class="container mt-4">
|
||||
<div class="alert alert-primary shadow-sm">
|
||||
<h5 class="mb-0">Commission Report: '.$dateFrom." → ".$dateTo.'</h5>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
|
||||
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
|
||||
|
||||
// ---- Login user type check ----
|
||||
$loginType = $_SESSION['type'] ?? ''; // login session-এ type আছে
|
||||
$loginId = $_SESSION['user_id']; // login user_id
|
||||
|
||||
// ---- Base Query ----
|
||||
$sql = "SELECT u.user_id, u.user_name, u.comi_rate, COALESCE(SUM(t.AT_AMOUNT),0) as total_amount FROM `".$GLOBALS['arif_users']."` u LEFT JOIN `".$GLOBALS['arif_ac']."` a ON u.user_id = a.AA_AGENT LEFT JOIN `".$GLOBALS['arif_tran']."` t ON a.AA_ACNO = t.AT_ACID AND t.AT_TIMESTAMP BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59' WHERE u.type = 'agent'";
|
||||
|
||||
// ---- if Agent self data filter ----
|
||||
if ($loginType === 'agent') {
|
||||
$sql .= " AND u.user_id = '".$loginId."'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY u.user_id, u.user_name, u.comi_rate ORDER BY u.user_name ASC";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
if ($result->num_rows > 0) {
|
||||
|
||||
echo '
|
||||
<div class="container mt-3">
|
||||
<div class="card shadow-sm rounded-3">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Agent ID</th>
|
||||
<th>Agent Name</th>
|
||||
<th>Total Collection</th>
|
||||
<th>Total Commission</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
$grandTotalCommission = 0;
|
||||
$grandTotalCollection = 0;
|
||||
|
||||
if ($result && $result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
//$ID=$row["GC_ID"];
|
||||
// $tt=$row["AT_ID"]-10;
|
||||
$collection = $row["total_amount"];
|
||||
$commission = ($collection * $row["comi_rate"]) / 100;
|
||||
|
||||
$grandTotalCollection += $collection;
|
||||
$grandTotalCommission += $commission;
|
||||
|
||||
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"];
|
||||
<td>".$row["user_id"]."</td>
|
||||
<td>".$row["user_name"]."</td>
|
||||
<td>".number_format($collection,2)."</td>
|
||||
<td>".number_format($commission,2)."</td>
|
||||
</tr>";
|
||||
}
|
||||
} else {
|
||||
echo "0 results";
|
||||
echo "<tr><td colspan='4' class='text-center text-muted'>No agents found</td></tr>";
|
||||
}
|
||||
$conn->close();
|
||||
|
||||
echo '
|
||||
</table>
|
||||
<hr> <h2> Total Transaction amount : '.$totalAmount.'</h2>
|
||||
<hr> <h2> Total Commission amount : '.$totalAmount/100*2.5 .'</h2>
|
||||
</div>
|
||||
';
|
||||
echo '
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
// ---- if admin/bm then show grand total ----
|
||||
if ($loginType !== 'agent') {
|
||||
echo '<h5 class="text-end">
|
||||
Grand Total Collection : <b>'.number_format($grandTotalCollection,2).'</b><br>
|
||||
Grand Total Commission : <b>'.number_format($grandTotalCommission,2).'</b>
|
||||
</h5>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
|
||||
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');
|
||||
// ---- Call commission function ----
|
||||
commission_report($dFrom, $dTo);
|
||||
?>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
// Check if user is logged in and is admin
|
||||
// if (!isset($_SESSION['type']) || $_SESSION['type'] !== 'admin') {
|
||||
// header("Location: login.php");
|
||||
// exit();
|
||||
// }
|
||||
|
||||
// Database connection
|
||||
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
|
||||
@@ -37,6 +32,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user_phone = $_POST['user_phone'];
|
||||
$type = $_POST['type'];
|
||||
$user_id = $_POST['user_id'];
|
||||
$profilePicPath = $user['profile_pic']; // default old pic
|
||||
|
||||
// Validate inputs
|
||||
if (empty($user_name) || empty($user_phone) || empty($user_id)) {
|
||||
@@ -44,29 +40,40 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
} elseif (!preg_match("/^[0-9]{10}$/", $user_phone)) {
|
||||
$error = "Invalid phone number format";
|
||||
} else {
|
||||
// --- Handle Profile Picture Upload ---
|
||||
if (isset($_FILES['profile_pic']) && $_FILES['profile_pic']['error'] === UPLOAD_ERR_OK) {
|
||||
$uploadDir = __DIR__ . "/picture/";
|
||||
if (!file_exists($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
$fileTmp = $_FILES['profile_pic']['tmp_name'];
|
||||
$fileName = time() . "_" . basename($_FILES['profile_pic']['name']);
|
||||
$filePath = $uploadDir . $fileName;
|
||||
|
||||
if (move_uploaded_file($fileTmp, $filePath)) {
|
||||
$profilePicPath = "/picture/" . $fileName;
|
||||
|
||||
// পুরনো ফাইল ডিলিট (যদি থাকে)
|
||||
if (!empty($user['profile_pic']) && file_exists(__DIR__ . "/" . $user['profile_pic'])) {
|
||||
unlink(__DIR__ . "/" . $user['profile_pic']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update query
|
||||
if (!empty($_POST['password'])) {
|
||||
// Update with password
|
||||
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
||||
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET
|
||||
user_id = ?,
|
||||
user_name = ?,
|
||||
user_phone = ?,
|
||||
type = ?,
|
||||
password = ?
|
||||
$sql = "UPDATE `".$GLOBALS['arif_users']."`
|
||||
SET user_id = ?, user_name = ?, user_phone = ?, type = ?, password = ?, profile_pic = ?
|
||||
WHERE id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $password, $id);
|
||||
$stmt->bind_param("ssssssi", $user_id, $user_name, $user_phone, $type, $password, $profilePicPath, $id);
|
||||
} else {
|
||||
// Update without password
|
||||
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET
|
||||
user_id = ?,
|
||||
user_name = ?,
|
||||
user_phone = ?,
|
||||
type = ?
|
||||
$sql = "UPDATE `".$GLOBALS['arif_users']."`
|
||||
SET user_id = ?, user_name = ?, user_phone = ?, type = ?, profile_pic = ?
|
||||
WHERE id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("ssssi", $user_id, $user_name, $user_phone, $type, $id);
|
||||
$stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $profilePicPath, $id);
|
||||
}
|
||||
|
||||
if ($stmt->execute()) {
|
||||
@@ -99,7 +106,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($user)): ?>
|
||||
<form method="post">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="id" value="<?php echo htmlspecialchars($user['id']); ?>">
|
||||
|
||||
<div class="row">
|
||||
@@ -114,6 +121,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<input type="text" class="form-control" id="user_name" name="user_name"
|
||||
value="<?php echo htmlspecialchars($user['user_name']); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="profile_pic" class="form-label">Profile Picture</label><br>
|
||||
<?php if (!empty($user['profile_pic'])): ?>
|
||||
<img src="/CONTENT/ROOT_URI/Admin/<?php echo htmlspecialchars($user['profile_pic']); ?>" width="80" height="80" style="border-radius:50%; margin-bottom:10px;"><br>
|
||||
<?php endif; ?>
|
||||
<input type="file" class="form-control" id="profile_pic" name="profile_pic" accept="image/*">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
@@ -133,21 +148,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-3">
|
||||
<label for="password" class="form-label">New Password (leave blank to keep current)</label>
|
||||
<input type="password" class="form-control" id="password" name="password">
|
||||
<small class="text-muted">Password must be at least 8 characters long</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-3">
|
||||
<button type="submit" class="btn btn-primary">Update User</button>
|
||||
<a href="/Admin/Settings_Agent" class="btn ">Cancel</a>
|
||||
</div>
|
||||
<a href="/Admin/Settings_Agent" class="btn">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
@@ -165,19 +174,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.badge-primary {
|
||||
background-color: #007bff;
|
||||
}
|
||||
.badge-secondary {
|
||||
background-color: #6c757d;
|
||||
}
|
||||
.badge-warning {
|
||||
background-color: #ffc107;
|
||||
}
|
||||
<style>
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
img { border:1px solid #ccc; }
|
||||
</style>
|
||||
<?php $conn->close(); ?>
|
||||
@@ -27,6 +27,7 @@
|
||||
$_SESSION['user_id'] = $user['user_id'];
|
||||
$_SESSION['type'] = $user['type'];
|
||||
$_SESSION['name'] = $user['user_name'];
|
||||
$_SESSION['profile_pic'] = $user['profile_pic'] ?? '';
|
||||
|
||||
echo "<div class='alert alert-success'>Login successful. Redirecting...</div>";
|
||||
echo "<script>setTimeout(() => { window.location.href = '/Admin/View_AC?Type=Loan'; }, 2000);</script>";
|
||||
|
||||
BIN
CONTENT/ROOT_URI/Admin/picture/1756899147_new_logo2.jpg
Normal file
BIN
CONTENT/ROOT_URI/Admin/picture/1756899147_new_logo2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 KiB |
BIN
CONTENT/ROOT_URI/Admin/picture/1756900298_passport-photo-333.jpg
Normal file
BIN
CONTENT/ROOT_URI/Admin/picture/1756900298_passport-photo-333.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
119
pma/tmp/twig/cf/cf151a987d451dbed37630dfabb6c91d.php
Normal file
119
pma/tmp/twig/cf/cf151a987d451dbed37630dfabb6c91d.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
use Twig\Environment;
|
||||
use Twig\Error\LoaderError;
|
||||
use Twig\Error\RuntimeError;
|
||||
use Twig\Extension\SandboxExtension;
|
||||
use Twig\Markup;
|
||||
use Twig\Sandbox\SecurityError;
|
||||
use Twig\Sandbox\SecurityNotAllowedTagError;
|
||||
use Twig\Sandbox\SecurityNotAllowedFilterError;
|
||||
use Twig\Sandbox\SecurityNotAllowedFunctionError;
|
||||
use Twig\Source;
|
||||
use Twig\Template;
|
||||
|
||||
/* table/insert/continue_insertion_form.twig */
|
||||
class __TwigTemplate_904307a5a5f694a38d058a83a4fa8120 extends Template
|
||||
{
|
||||
private $source;
|
||||
private $macros = [];
|
||||
|
||||
public function __construct(Environment $env)
|
||||
{
|
||||
parent::__construct($env);
|
||||
|
||||
$this->source = $this->getSourceContext();
|
||||
|
||||
$this->parent = false;
|
||||
|
||||
$this->blocks = [
|
||||
];
|
||||
}
|
||||
|
||||
protected function doDisplay(array $context, array $blocks = [])
|
||||
{
|
||||
$macros = $this->macros;
|
||||
// line 1
|
||||
echo "<form id=\"continueForm\" method=\"post\" action=\"";
|
||||
echo PhpMyAdmin\Url::getFromRoute("/table/replace");
|
||||
echo "\" name=\"continueForm\">
|
||||
";
|
||||
// line 2
|
||||
echo PhpMyAdmin\Url::getHiddenInputs(($context["db"] ?? null), ($context["table"] ?? null));
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"goto\" value=\"";
|
||||
// line 3
|
||||
echo twig_escape_filter($this->env, ($context["goto"] ?? null), "html", null, true);
|
||||
echo "\">
|
||||
<input type=\"hidden\" name=\"err_url\" value=\"";
|
||||
// line 4
|
||||
echo twig_escape_filter($this->env, ($context["err_url"] ?? null), "html", null, true);
|
||||
echo "\">
|
||||
<input type=\"hidden\" name=\"sql_query\" value=\"";
|
||||
// line 5
|
||||
echo twig_escape_filter($this->env, ($context["sql_query"] ?? null), "html", null, true);
|
||||
echo "\">
|
||||
|
||||
";
|
||||
// line 7
|
||||
if (($context["has_where_clause"] ?? null)) {
|
||||
// line 8
|
||||
echo " ";
|
||||
$context['_parent'] = $context;
|
||||
$context['_seq'] = twig_ensure_traversable(($context["where_clause_array"] ?? null));
|
||||
foreach ($context['_seq'] as $context["key_id"] => $context["where_clause"]) {
|
||||
// line 9
|
||||
echo " <input type=\"hidden\" name=\"where_clause[";
|
||||
echo twig_escape_filter($this->env, $context["key_id"], "html", null, true);
|
||||
echo "]\" value=\"";
|
||||
// line 10
|
||||
echo twig_escape_filter($this->env, twig_trim_filter($context["where_clause"]), "html", null, true);
|
||||
echo "\">
|
||||
";
|
||||
}
|
||||
$_parent = $context['_parent'];
|
||||
unset($context['_seq'], $context['_iterated'], $context['key_id'], $context['where_clause'], $context['_parent'], $context['loop']);
|
||||
$context = array_intersect_key($context, $_parent) + $_parent;
|
||||
// line 12
|
||||
echo " ";
|
||||
}
|
||||
// line 13
|
||||
echo "
|
||||
";
|
||||
// line 14
|
||||
ob_start(function () { return ''; });
|
||||
// line 15
|
||||
echo " <input type=\"number\" name=\"insert_rows\" id=\"insert_rows\" value=\"";
|
||||
// line 16
|
||||
echo twig_escape_filter($this->env, ($context["insert_rows_default"] ?? null), "html", null, true);
|
||||
echo "\" min=\"1\">
|
||||
";
|
||||
$context["insert_rows"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
|
||||
// line 18
|
||||
echo " ";
|
||||
echo twig_sprintf(_gettext("Continue insertion with %s rows"), ($context["insert_rows"] ?? null));
|
||||
echo "
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
public function getTemplateName()
|
||||
{
|
||||
return "table/insert/continue_insertion_form.twig";
|
||||
}
|
||||
|
||||
public function isTraitable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDebugInfo()
|
||||
{
|
||||
return array ( 93 => 18, 88 => 16, 86 => 15, 84 => 14, 81 => 13, 78 => 12, 70 => 10, 66 => 9, 61 => 8, 59 => 7, 54 => 5, 50 => 4, 46 => 3, 42 => 2, 37 => 1,);
|
||||
}
|
||||
|
||||
public function getSourceContext()
|
||||
{
|
||||
return new Source("", "table/insert/continue_insertion_form.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/insert/continue_insertion_form.twig");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user