Compare commits

80 Commits

Author SHA1 Message Date
Suvo
8608b92e72 report page admin issue 2025-11-01 10:39:55 +00:00
Suvo
36e4935a98 s1 2025-10-16 13:17:19 +00:00
Suvo
1256daecd4 s1 2025-10-16 13:08:22 +00:00
Suvo
5d2d6d0b0d s1 2025-10-16 13:02:59 +00:00
Suvo
3c14d7b5b3 s1 2025-10-16 12:59:30 +00:00
Suvo
88fb6ff5bc update commission page 2025-10-16 12:51:03 +00:00
Suvo
d84ed20b19 add account opening comission function 2025-10-06 13:47:10 +00:00
Suvo
34dadd8de5 add account opening comission function 2025-10-06 07:31:15 +00:00
Suvo
b00a2bcdc9 allow and disallow multiple payment 2025-09-28 07:41:08 +00:00
Suvo
45b9187fd5 allow and disallow multiple payment 2025-09-28 07:36:57 +00:00
Suvo
e9f9f2b037 allow and disallow multiple payment 2025-09-28 07:24:36 +00:00
Suvo
0a68a91b0e allow and disallow multiple payment 2025-09-27 09:00:26 +00:00
Suvo
fc26db1ce6 allow and disallow multiple payment 2025-09-27 08:41:13 +00:00
Suvo
a0d8602bb9 allow and disallow multiple payment 2025-09-27 08:26:28 +00:00
Suvo
62120de429 allow and disallow multiple payment 2025-09-27 08:08:36 +00:00
Suvo
5e6bbd14ff allow and disallow multiple payment 2025-09-27 07:25:55 +00:00
Suvo
ab034aeb72 update agent dashboard, agent target assign, 2025-09-26 14:19:31 +00:00
ns77@siliconpin.com
32562554ad fix some error 2025-09-25 13:41:16 +00:00
ns77@siliconpin.com
11000bbacd now bm can access report pages 2025-09-16 08:24:43 +00:00
ns77@siliconpin.com
4b7dc82f29 notification link only for bm and admin 2025-09-10 15:33:46 +00:00
ns77@siliconpin.com
5a12de1c64 implemented admin or bm approval functionality 2025-09-10 13:57:41 +00:00
ns77@siliconpin.com
4a1128066d add upcoming maturity page 2025-09-09 14:06:14 +00:00
ns77@siliconpin.com
ed0741cbb2 fix bottom nav 2025-09-08 15:27:37 +00:00
ns77@siliconpin.com
a7141792f9 commision page and header user image 2025-09-06 06:56:53 +00:00
ns77@siliconpin.com
f345be6d21 commision page and header user image 2025-09-06 06:47:12 +00:00
ns77@siliconpin.com
ad3e2a11b1 commision page and header user image 2025-09-05 15:08:09 +00:00
ns77@siliconpin.com
6d8f87d5a4 commision page and header user image 2025-09-05 15:07:28 +00:00
ns77@siliconpin.com
01966257bc commision page and header user image 2025-09-05 15:05:00 +00:00
ns77@siliconpin.com
3af87688c0 v2 2025-09-04 15:04:21 +00:00
ns77@siliconpin.com
c1a38558c6 v2 2025-09-04 14:56:15 +00:00
ns77@siliconpin.com
fdf623e84d v2 2025-09-03 16:00:25 +00:00
ns77@siliconpin.com
e143ac4d9a v2 2025-09-03 15:53:03 +00:00
ns77@siliconpin.com
f4d9d7073d v2 2025-09-03 15:52:39 +00:00
ns77@siliconpin.com
1d736c99c8 v2 2025-09-03 15:38:53 +00:00
ns77@siliconpin.com
6d59aeb66f v2 2025-09-03 15:07:23 +00:00
ns77@siliconpin.com
d894ea3d66 v2 2025-09-03 15:06:33 +00:00
ns77@siliconpin.com
969c2e2186 v2 2025-09-03 15:05:26 +00:00
ns77@siliconpin.com
5cce7f9f09 v2 2025-09-03 15:03:20 +00:00
ns77@siliconpin.com
46c689c2bd v2 2025-09-03 14:58:14 +00:00
ns77@siliconpin.com
b00efdc47f v2 2025-09-03 14:57:16 +00:00
ns77@siliconpin.com
4cded3b7d8 v2 2025-09-03 14:56:33 +00:00
ns77@siliconpin.com
222f9f2584 v2 2025-09-03 14:55:11 +00:00
ns77@siliconpin.com
879f4e3080 v2 2025-09-03 14:53:43 +00:00
ns77@siliconpin.com
1592a73197 v2 2025-09-03 14:52:37 +00:00
ns77@siliconpin.com
111dd1ec7b v2 2025-09-03 14:51:48 +00:00
ns77@siliconpin.com
035c697802 v2 2025-09-03 14:49:58 +00:00
ns77@siliconpin.com
5a1dad9213 v2 2025-09-03 14:47:41 +00:00
ns77@siliconpin.com
ac7e572558 v2 2025-09-03 14:46:45 +00:00
ns77@siliconpin.com
dad99cf76f v2 2025-09-03 14:45:52 +00:00
ns77@siliconpin.com
2c82868373 v2 2025-09-03 14:44:42 +00:00
ns77@siliconpin.com
9c700687c2 v2 2025-09-03 14:42:36 +00:00
ns77@siliconpin.com
ede9937da7 v2 2025-09-03 14:41:21 +00:00
ns77@siliconpin.com
c51f385927 v2 2025-09-03 14:39:11 +00:00
ns77@siliconpin.com
26fbcb1fb5 v2 2025-09-03 14:37:14 +00:00
ns77@siliconpin.com
86c5fb392e v2 2025-09-03 14:33:23 +00:00
ns77@siliconpin.com
4516d7aad8 v2 2025-09-03 14:32:28 +00:00
ns77@siliconpin.com
cb73f1fdd7 v2 2025-09-03 14:28:37 +00:00
ns77@siliconpin.com
80f50d3ee4 v2 2025-09-03 14:24:53 +00:00
ns77@siliconpin.com
9faae333d6 v2 2025-09-03 14:24:05 +00:00
ns77@siliconpin.com
7b7e4161b6 v2 2025-09-03 14:23:05 +00:00
ns77@siliconpin.com
37d32f3ec9 v2 2025-09-03 14:22:36 +00:00
ns77@siliconpin.com
d5f88aa754 v2 2025-09-03 14:21:44 +00:00
ns77@siliconpin.com
9cd1303ccf v2 2025-09-03 14:21:07 +00:00
ns77@siliconpin.com
57b8090d6f v2 2025-09-03 14:19:55 +00:00
ns77@siliconpin.com
c910e9a0a1 v2 2025-09-03 14:18:58 +00:00
ns77@siliconpin.com
6679e0ce03 v2 2025-09-03 14:13:31 +00:00
ns77@siliconpin.com
cae1ac6745 v2 2025-09-03 14:07:25 +00:00
ns77@siliconpin.com
533d1b572d v2 2025-09-03 14:04:44 +00:00
ns77@siliconpin.com
10881c6a5b add new functionality in agent dashboard 2025-09-02 12:11:58 +00:00
ns77@siliconpin.com
ddd3d2bcae add new functionality in agent dashboard 2025-09-02 12:11:31 +00:00
ns77@siliconpin.com
3e27f7da01 add new functionality in agent dashboard 2025-09-02 12:10:34 +00:00
ns77@siliconpin.com
aefcd3fdc6 add new functionality in agent dashboard 2025-09-02 12:06:32 +00:00
ns77@siliconpin.com
b515e6d501 add new functionality in agent dashboard 2025-09-02 12:05:44 +00:00
ns77@siliconpin.com
58e3e33b4a add new functionality in agent dashboard 2025-09-02 07:32:41 +00:00
ns77@siliconpin.com
88e8efa31f add time zome 2025-09-01 15:28:42 +00:00
ns77@siliconpin.com
eec8d5c5c4 replace logo 2025-09-01 15:11:19 +00:00
ns77@siliconpin.com
aef0c4a91b add agent panel 2025-09-01 11:39:43 +00:00
02b34117de Merge pull request 'add agent panel' (#3) from copy_main into main
Reviewed-on: #3
2025-09-01 11:34:14 +00:00
de0c186dad Merge pull request 'add agent panel' (#2) from copy_main into main
Reviewed-on: #2
2025-09-01 09:59:33 +00:00
721bacc9e8 Merge pull request 's13' (#1) from copy_main into main
Reviewed-on: #1
2025-08-30 09:36:10 +00:00
53 changed files with 6273 additions and 474 deletions

View File

@@ -1,8 +1,48 @@
<?php
include(__DIR__ . '/auth.php');
require_login();
date_default_timezone_set('Asia/Kolkata');
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Don't send ANY HTML or echo above this line
$pendingCount = 0; // Default value
try {
$table = 'fund_trans';
// Check user type and prepare appropriate query
if ($_SESSION['type'] === 'admin') {
// Admin can only see BM requests
$countStmt = $conn->prepare("SELECT COUNT(*) AS pending_count FROM `$table` WHERE status = 0 AND request_usr_type = 'bm'");
} elseif ($_SESSION['type'] === 'bm') {
// BM can only see Admin requests
$countStmt = $conn->prepare("SELECT COUNT(*) AS pending_count FROM `$table` WHERE status = 0 AND request_usr_type = 'admin'");
} else {
// Other user types see nothing
$countStmt = false;
$pendingCount = 0;
}
if ($countStmt) {
$countStmt->execute();
$countResult = $countStmt->get_result();
if ($countResult) {
$row = $countResult->fetch_assoc();
$pendingCount = $row['pending_count'] ?? 0;
}
$countStmt->close();
}
} catch (Exception $e) {
// Log error instead of showing to user
error_log("Error getting pending count: " . $e->getMessage());
}
$conn->close();
?>
<style>
.logo {
@@ -19,64 +59,162 @@ require_login();
display: flex;
align-items: center;
}
/* Dropdown menu styling */
.dropdown-menu > li > a {
padding: 10px 20px;
}
.navbar-nav > li > .dropdown-menu {
border-top: 2px solid #337ab7;
}
/* Mobile-specific styles */
@media (max-width: 767px) {
.mobile-welcome {
padding: 15px;
color: #FFF;
line-height: 20px;
margin-left: 15px;
.mobile-welcome,
.mobile-profile {
display: inline-block;
}
.desktop-welcome {
display: none;
.desktop-welcome,
.desktop-profile,
.navbar-right {
display: none !important; /* hide right side in mobile */
}
/* Adjust dropdown for mobile */
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu > li > a {
padding: 10px 15px 10px 35px;
color: #777;
}
}
/* Desktop styles */
@media (min-width: 768px) {
.mobile-welcome {
display: none;
.mobile-welcome,
.mobile-profile {
display: none !important; /* hide mobile items in desktop */
}
.desktop-welcome {
display: inline-block;
}
}
</style>
<!-- nav start -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Mobile profile + welcome -->
<img class="mobile-profile"
src="<?php echo $imagePath; ?>"
width="40" height="40"
style="border-radius:50%; object-fit:cover;"
alt="Profile">
<span class="mobile-welcome">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<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/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'){ ?>
<?php
$userType = $_SESSION['type'] ?? '';
if ($userType === 'admin' || $userType === 'bm') {
?>
<!-- Create New Dropdown Menu -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Create New <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="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 role="separator" class="divider"></li>
<li><a href="/Admin/Add_group">Add New Group</a></li>
</ul>
</li>
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
<!-- Other menu items -->
<li><a href="/Admin/Trans_New">Transaction</a></li>
<li><a href="/Admin/Report">Report</a></li>
<?php if ($userType === 'admin') { ?>
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
<?php } ?>
<li><a href="/Admin/agent_View_report">Commission</a></li>
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
<?php } ?>
<?php if ($userType === 'admin') { ?>
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
<?php } ?>
<li><a href="/Admin/upcoming-maturity">Upcoming Maturity</a></li>
<?php if ($userType === 'admin' || $userType === 'bm') { ?>
<li><a href="/Admin/Due">Deemand Sheet</a></li>
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
<?php } ?>
<?php
} elseif ($userType === 'agent') {
?>
<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/agent_View_report">Commission</a></li>
<?php
}
?>
</ul>
<!-- Desktop right side -->
<ul class="nav navbar-nav navbar-right">
<li class="desktop-welcome"><span class="welcome-text">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span></li>
<li class="desktop-welcome">
<span class="welcome-text">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span>
</li>
<li class="desktop-profile">
<?php
if (!empty($_SESSION['profile_pic'])) {
$profilePicPath = '/CONTENT/ROOT_URI/Admin/' . $_SESSION['profile_pic'];
echo '<img src="' . htmlspecialchars($profilePicPath) . '" width="40" height="40" style="border-radius:50%; object-fit:cover;" alt="Profile" onerror="this.replaceWith(this.nextElementSibling.cloneNode(true))" />';
}
// Default SVG (always output but initially hidden)
echo '<svg style="border-radius:50%; object-fit:cover; border: 1px solid #ffffff; display: ' .
(empty($_SESSION['profile_pic']) ? 'block' : 'none') . ';"
class="img-responsive" version="1.1" width="38px" height="38px"
viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"
fill="#ffffff" stroke="#ffffff">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path fill="#ffffff" d="M628.736 528.896A416 416 0 0 1 928 928H96a415.872 415.872 0 0 1 299.264-399.104L512 704l116.736-175.104zM720 304a208 208 0 1 1-416 0 208 208 0 0 1 416 0z"></path>
</g>
</svg>';
?>
</li>
<li><a href="/Admin/Signout">Signout</a></li>
<?php if ($userType === 'admin' || $userType === 'bm' ) { ?>
<li>
<a href="/Admin/notification" style="position: relative; display: inline-block; padding: 8px;">
<?php if($pendingCount > 0) { ?>
<div style="width: 18px; height: 18px; border-radius: 50%; background-color: #ff4444; position: absolute; top: 2px; right: 2px; z-index: 10; box-shadow: 0 0 0 2px rgba(255,255,255,0.8); font-size: 11px; font-weight: bold; color: white; text-align: center; line-height: 18px;">
<?= $pendingCount > 99 ? '99+' : $pendingCount ?>
</div>
<?php } ?>
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 64 64" fill="#4a5568" style="filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));"><g><path fill="currentColor" d="M56,44c-1.832,0-4-2.168-4-4V20C52,8.973,43.027,0,32,0S12,8.973,12,20v20c0,1.793-2.207,4-4,4 c-2.211,0-4,1.789-4,4s1.789,4,4,4h48c2.211,0,4-1.789,4-4S58.211,44,56,44z"></path><path fill="currentColor" d="M32,64c4.418,0,8-3.582,8-8H24C24,60.418,27.582,64,32,64z"></path></g></svg>
</a>
</li>
<?php } ?>
</ul>
</div>
</div>

View File

@@ -0,0 +1,133 @@
<?php
include(__DIR__ . '/auth.php');
require_login();
date_default_timezone_set('Asia/Kolkata');
?>
<style>
.logo {
display: inline-block;
margin: auto;
vertical-align: middle;
}
.welcome-text {
padding: 15px;
color: #FFF;
display: inline-block;
}
.navbar-right {
display: flex;
align-items: center;
}
/* Mobile-specific styles */
@media (max-width: 767px) {
.mobile-welcome,
.mobile-profile {
display: inline-block;
}
.desktop-welcome,
.desktop-profile,
.navbar-right {
display: none !important; /* hide right side in mobile */
}
}
/* Desktop styles */
@media (min-width: 768px) {
.mobile-welcome,
.mobile-profile {
display: none !important; /* hide mobile items in desktop */
}
.desktop-welcome {
display: inline-block;
}
}
</style>
<!-- nav start -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Mobile profile + welcome -->
<?php
$imagePath = '';
if(isset($_SESSION['profile_pic']) && !empty($_SESSION['profile_pic'])){
$imagePath = "/CONTENT/ROOT_URI/Admin/".$_SESSION['profile_pic'];
}else{
$imagePath = "/CONTENT/ROOT_URI/Admin/default.svg";
}
?>
<img class="mobile-profile"
src="<?php echo $imagePath; ?>"
width="40" height="40"
style="border-radius:50%; object-fit:cover;"
alt="Profile">
<span class="mobile-welcome">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<?php
$userType = $_SESSION['type'] ?? '';
if ($userType === 'admin') {
?>
<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> -->
<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') {
?>
<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') {
?>
<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/agent_View_report">Commission</a></li> -->
<?php
}
?>
</ul>
<!-- Desktop right side -->
<ul class="nav navbar-nav navbar-right">
<li class="desktop-welcome">
<span class="welcome-text">Welcome! <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?></span>
</li>
<li class="desktop-profile">
<img src="<?php echo $imagePath; ?>"
width="40" height="40"
style="border-radius:50%; object-fit:cover;"
alt="Profile">
</li>
<li><a href="/Admin/Signout">Signout</a></li>
</ul>
</div>
</div>
</nav>

View File

@@ -14,7 +14,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/new_logo2.jpg" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>

View File

@@ -14,13 +14,14 @@
$ca["ac_no"]="GV".$_POST["ac_type"].date("Ymd")."L";
$AA_BAL=$_POST["Mature_Value"];$AA_BAL=$AA_BAL-($AA_BAL*2);
$ca["ac_agent"] = $_POST["ac_agent"] ?? null;
$ca["reffer_agent"] = $_POST["reffer_agent"] ?? null;
//GC_new_entry($ca);
//echo $GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db'];
$t="Loan";
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_BAL`,`AA_G1_DETAILS`,`AA_G2_DETAILS`,`AA_INSTALLMENT`,`AA_ICARD_NO`,`AA_INTEREST`,`AA_DATE`,`AA_DATE_MATURE`,`AA_NO_OF_PAYMENT`,`AA_AMOUNT`,`AA_MATURE_VALUE`,`AA_TYPE`,`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`, `AA_ADMIN`, `AA_AGENT`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("issssssssssssssssss" ,$AA_BAL,$_POST["AA_G1_DETAILS"],$_POST["AA_G2_DETAILS"],$_POST["CA_installment"],$_POST["AA_ICARD_NO"],$_POST["CA_interest"],$_POST["date_today"],$_POST["date_mature"],$_POST["CA_No_Of_Payment"],$_POST["CA_Amount"],$_POST["Mature_Value"], $t,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"],$_SESSION["EMAIL"], $ca["ac_agent"]);
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_BAL`,`AA_G1_DETAILS`,`AA_G2_DETAILS`,`AA_INSTALLMENT`,`AA_ICARD_NO`,`AA_INTEREST`,`AA_DATE`,`AA_DATE_MATURE`,`AA_NO_OF_PAYMENT`,`AA_AMOUNT`,`AA_MATURE_VALUE`,`AA_TYPE`,`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`, `AA_ADMIN`, `AA_AGENT`, `refferTo`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("isssssssssssssssssss" ,$AA_BAL,$_POST["AA_G1_DETAILS"],$_POST["AA_G2_DETAILS"],$_POST["CA_installment"],$_POST["AA_ICARD_NO"],$_POST["CA_interest"],$_POST["date_today"],$_POST["date_mature"],$_POST["CA_No_Of_Payment"],$_POST["CA_Amount"],$_POST["Mature_Value"], $t,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"],$_SESSION["EMAIL"], $ca["ac_agent"], $ca["reffer_agent"]);
if($stmt->execute()){
$lid=$conn->insert_id;$ca["ac_no"]=$ca["ac_no"].$lid;
@@ -116,6 +117,17 @@
<small class="form-text text-muted">Dedicate a Agent</small>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="reffer_agent">
<option>-Reffer a Agent-</option>
<?php foreach ($agentList as $agent): ?>
<option Value="<?php echo htmlspecialchars($agent['user_id']) ?>"><?php echo htmlspecialchars($agent['user_id']); ?></option>
<?php endforeach; ?>
</select>
<small class="form-text text-muted">Reffer a Agent</small>
</div>
</td>
</tr></table>
<div class="form-group">
<input type="text" class="form-control" id="date_today" name="date_today" value="<?php echo date('Y-m-d');?>" >

View File

@@ -13,11 +13,12 @@ if(isset($_POST["ac_type"]) && isset($_POST["ac_name"]) && $_POST["ac_name"]!=""
$ca["ac_address"]=$_POST["ac_address"];
$ca["ac_no"]="GV".$_POST["ac_type"].date("Ymd")."R";
$ca["ac_agent"] = $_POST["ac_agent"] ?? null;
$ca["reffer_agent"] = $_POST["reffer_agent"] ?? null;
$t="Recurring";
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_INTEREST`,`AA_DATE`,`AA_ICARD_NO`,`AA_DATE_MATURE`,`AA_NO_OF_PAYMENT`,`AA_INSTALLMENT`,`AA_MATURE_VALUE`,`AA_TYPE`,`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`, `AA_NOMINEE_DETAILS`, `AA_ADMIN`, `AA_AGENT`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssssssssssssss" ,$_POST["CA_interest"],$_POST["date_today"],$_POST["AA_ICARD_NO"],$_POST["date_mature"],$_POST["CA_No_Of_Payment"],$_POST["CA_Amount"],$_POST["Mature_Value"], $t,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"],$_POST["AA_NOMINEE_DETAILS"],$_SESSION["EMAIL"], $ca["ac_agent"]);
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_INTEREST`,`AA_DATE`,`AA_ICARD_NO`,`AA_DATE_MATURE`,`AA_NO_OF_PAYMENT`,`AA_INSTALLMENT`,`AA_MATURE_VALUE`,`AA_TYPE`,`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`, `AA_NOMINEE_DETAILS`, `AA_ADMIN`, `AA_AGENT`, `refferTo`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sssssssssssssssss" ,$_POST["CA_interest"],$_POST["date_today"],$_POST["AA_ICARD_NO"],$_POST["date_mature"],$_POST["CA_No_Of_Payment"],$_POST["CA_Amount"],$_POST["Mature_Value"], $t,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"],$_POST["AA_NOMINEE_DETAILS"],$_SESSION["EMAIL"], $ca["ac_agent"], $ca["reffer_agent"]);
if($stmt->execute()){
$lid=$conn->insert_id;$ca["ac_no"]=$ca["ac_no"].$lid;
@@ -96,6 +97,17 @@ if(isset($_POST["ac_type"]) && isset($_POST["ac_name"]) && $_POST["ac_name"]!=""
<small class="form-text text-muted">Dedicate a Agent</small>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="reffer_agent">
<option>-Reffer a Agent-</option>
<?php foreach ($agentList as $agent): ?>
<option Value="<?php echo htmlspecialchars($agent['user_id']) ?>"><?php echo htmlspecialchars($agent['user_id']); ?></option>
<?php endforeach; ?>
</select>
<small class="form-text text-muted">Reffer a Agent</small>
</div>
</td>
</tr></table>
<div class="form-group">
<input type="text" class="form-control" id="date_today" name="date_today" value="<?php echo date('Y-m-d');?>" required>

View File

@@ -83,6 +83,26 @@
}
}
if (isset($_POST['allowMultiple_submit']) && !empty($_POST['allowMultiple_acno'])) {
$acno = $_POST['allowMultiple_acno'];
$action = $_POST['allowMultiple_action']; // will be 1 or 0
$sql = "UPDATE `{$GLOBALS['arif_ac']}` SET allowMultiple = ? WHERE AA_ACNO = ?";
$stmt = $conn->prepare($sql);
if ($stmt->bind_param("is", $action, $acno) && $stmt->execute()) {
if ($action == 1) {
echo "<div class='alert alert-success'>Multiple payments <strong>allowed</strong> for A/C {$acno}.</div>";
} else {
echo "<div class='alert alert-info'>Multiple payments <strong>disallowed</strong> for A/C {$acno}.</div>";
}
} else {
echo "<div class='alert alert-danger'>Failed to update multiple payment setting for A/C {$acno}.</div>";
}
$stmt->close();
}
// Get agent list for dropdown
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'] . "";
$agentResult = $conn->query($getAgentListsQuery);
@@ -195,11 +215,23 @@
<th style='vertical-align: middle;'>Recurring A/C of ".$row["AA_NAME"]. "</th>
<td style='vertical-align: middle; text-align: right;'>
<form method='post' style='display: inline;'>
" . ($isMatured ? "<br/><span>Matured on: " . date('d-m-Y', strtotime($row["CLOSING_DATE"])) . "</span>" : "") . "
<input type='hidden' name='maturity_acno' value='".$row["AA_ACNO"]."'>
<input type='hidden' name='maturity_action' value='".($isMatured ? 'unmature' : 'mature')."'>
<button type='submit' name='recurring_maturity_submit' class='btn " . ($isMatured ? 'btn-warning' : 'btn-info') . "'>" . ($isMatured ? 'Mark as Active' : 'Mark as Matured') . "</button>
" . ($isMatured ? "<br/><span>Matured on: " . date('d-m-Y', strtotime($row["CLOSING_DATE"])) . "</span>" : "") . "
</form>
</form>";
if (isset($_SESSION['type']) && $_SESSION['type'] === 'admin') {
echo "
<form method='post' style='display:inline;'>
<input type='hidden' name='allowMultiple_acno' value='" . $row['AA_ACNO'] . "'>
<input type='hidden' name='allowMultiple_action' value='" . ($row["allowMultiple"] == 0 ? 1 : 0) . "'>
<button type='submit' name='allowMultiple_submit'
class='btn " . ($row["allowMultiple"] == 0 ? 'btn-warning' : 'btn-primary') . "'>
" . ($row["allowMultiple"] == 0 ? 'Allow Multiple' : 'Disallow Multiple') . "
</button>
</form>";
}
echo "
</td>
</tr>
<tr>
@@ -273,7 +305,7 @@
echo !empty($row["AA_AGENT"]) ? $row["AA_AGENT"] : "Not assigned";
}
echo "</td></tr>";
// var_dump($row);
echo "
<tr>
<th>INTEREST</th>
@@ -289,7 +321,7 @@
</tr>
<tr>
<th>NUMBER OF INSTALLMENTS PAID</th>
<td>".$row["AA_NO_OF_PAYPAID"]. "</td>
<td>".$row["AA_BAL"] / $row["AA_INSTALLMENT"]. "</td>
</tr>
<tr>
<th>MATURITY DATE</th>

View File

@@ -108,7 +108,7 @@ document.addEventListener('DOMContentLoaded', function() {
}
const logo = new Image();
logo.src = '/asset/images/logo.webp';
logo.src = '/asset/images/new_logo2.jpg';
logo.onload = function() { addHeader(); };
logo.onerror = function() { addHeader(); };

View File

@@ -146,6 +146,11 @@
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
$totalLoanEMIAmount = 0;
$totalDeuEMITillDate = 0;
$totalRecurringEMIAmount = 0;
$totalDeuInstallTillDate = 0;
$agent_id = $_SESSION['user_id'];
$types = ['Loan', 'Recurring'];
@@ -162,7 +167,7 @@ $grandTotal = [
foreach($types as $type){
$typeLike = "%$type%";
if($_SESSION['type']==='admin'){
if($_SESSION['type']==='admin' || $_SESSION['type']==='bm'){
$sql = "SELECT * FROM `" . $GLOBALS['arif_ac'] . "` WHERE `AA_TYPE` LIKE ? AND (`STATUS` IS NULL OR (`STATUS`!='closed' AND `STATUS`!='matured')) ORDER BY `AA_ID` DESC";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $typeLike);
@@ -197,9 +202,13 @@ foreach($types as $type){
$paidInstallment = number_format($paidInstallment, 2, '.', '');
$deuEMITillDate = countCycles($row['AA_ACTYPE'], $row['AA_DATE'], $row['AA_NO_OF_PAYMENT'], $row['AA_TYPE']) - $paidInstallment;
// $deuEMITillDate = abs($deuEMITillDate);
$deuEMITillDate = number_format($deuEMITillDate, 2, '.', '');
if($deuEMITillDate > 0){
// echo $deuEMITillDate;
$totalDeuEMITillDate += $deuEMITillDate; // এখানে যোগ হচ্ছে
$totalLoanEMIAmount += $row['AA_INSTALLMENT'];
}
}elseif($row['AA_TYPE'] === 'Recurring'){
$paidInstallment = $row['AA_BAL'] / $row['AA_INSTALLMENT'];
$paidInstallment = number_format($paidInstallment, 2, '.', '');
@@ -208,6 +217,13 @@ foreach($types as $type){
// $deuEMITillDate = abs($deuEMITillDate);
$deuEMITillDate = number_format($deuEMITillDate, 2, '.', '');
if($deuEMITillDate > 0){
// echo $deuEMITillDate;
$totalDeuInstallTillDate += $deuEMITillDate; // এখানে যোগ হচ্ছে
$totalRecurringEMIAmount += $row['AA_INSTALLMENT'];
}
}
// HTML table row
if($deuEMITillDate > 0){
@@ -262,6 +278,12 @@ foreach($types as $type){
}
}
$conn->close();
$grandTotal['totalNumberOfLoanEMI'] = $totalDeuEMITillDate;
$grandTotal['totalNumberOfRecurringEMI'] = $totalDeuInstallTillDate;
$grandTotal['totalLoanEMIAmount'] = $totalLoanEMIAmount;
$grandTotal['totalRecurringEMIAmount'] = $totalRecurringEMIAmount;
// echo "<br>Total Due EMI Till Date (Loan): ".$totalDeuEMITillDate;
// echo "<br>Total Due Installment Till Date (Recurring): ".$totalDeuInstallTillDate;
?>
</table>
@@ -284,7 +306,7 @@ document.addEventListener('DOMContentLoaded', function() {
const grandTotal = <?php echo json_encode($grandTotal); ?>;
const logo = new Image();
logo.src = '/asset/images/logo.webp';
logo.src = '/asset/images/new_logo2.jpg';
logo.onload = () => addHeader();
logo.onerror = () => addHeader();
@@ -352,12 +374,21 @@ document.addEventListener('DOMContentLoaded', function() {
y = doc.lastAutoTable.finalY + 20;
}
// Grand Total
doc.setFont(undefined,'bold');
doc.text(`Grand Total Accounts: ${grandTotal.accounts}`,40,y);
doc.text(`Grand Total Paid Installments: ${grandTotal.paidInstallments}`,40,y+15);
doc.text(`Grand Total Due Installments: ${grandTotal.dueInstallments}`,40,y+30);
doc.text(`Grand Total Due Amount: ${grandTotal.dueAmount.toLocaleString('en-IN',{minimumFractionDigits:2, maximumFractionDigits:2})}`,40,y+45);
// Grand Total totalNumberOfLoanEMI totalNumberOfRecurringEMI totalLoanEMIAmount totalRecurringEMIAmount
doc.setFont(undefined, 'bold');
let lineHeight = 12; // fixed gap between lines
let currentY = y-8;
doc.text(`Total Number of Loan EMI: ${grandTotal.totalNumberOfLoanEMI}`, 20, currentY);
currentY += lineHeight;
doc.text(`Total Number of Recurring Installment: ${grandTotal.totalNumberOfRecurringEMI}`, 20, currentY);
currentY += lineHeight;
doc.text(`Grand Total Loan EMI Amount: ${grandTotal.totalLoanEMIAmount.toLocaleString('en-IN',{minimumFractionDigits:2, maximumFractionDigits:2})}`, 20, currentY);
currentY += lineHeight;
doc.text(`Grand Total Recurring EMI Amount: ${grandTotal.totalRecurringEMIAmount.toLocaleString('en-IN',{minimumFractionDigits:2, maximumFractionDigits:2})}`, 20, currentY);
// Footer with page numbers
const pageCount = doc.internal.getNumberOfPages();
@@ -365,7 +396,7 @@ document.addEventListener('DOMContentLoaded', function() {
doc.setPage(i);
doc.setFontSize(9);
doc.setFont(undefined,'normal');
doc.text(`Generated by Loan Portal - Confidential`,40,doc.internal.pageSize.height-20);
// doc.text(`Generated by Loan Portal - Confidential`,40,doc.internal.pageSize.height-20);
doc.text(`Page ${i} of ${pageCount}`,doc.internal.pageSize.width-60,doc.internal.pageSize.height-20);
}

View File

@@ -13,7 +13,7 @@
<?php
// ---- if Admin then Agent dropdown and filter with agent----
if($_SESSION['type'] === 'admin'){
if($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' ){
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
@@ -28,7 +28,7 @@
while($a = $agents->fetch_assoc()){
$selected = (isset($_GET['agent']) && $_GET['agent']==$a['user_id']) ? "selected" : "";
echo "<option value='".$a['user_id']."' $selected>".$a['user_name']." (".$a['user_id'].")</option>";
}
}
}
?>
</select>
@@ -84,12 +84,12 @@ function report_view($type, $dt) {
<thead class="table-light">
<tr>
<th>Transaction ID</th>
'.($_SESSION['type'] === 'admin' ? "<th>Agent</th>" : "").'
'.($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' ? "<th>Agent</th>" : "").'
<th>Time</th>
<th>AC No</th>
<th>Name</th>
<th>Amount</th>
'.($_SESSION['type'] === 'admin' ? "<th>Remarks</th>" : "").'
'.($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' ? "<th>Remarks</th>" : "").'
</tr>
</thead>
<tbody>';
@@ -103,7 +103,7 @@ function report_view($type, $dt) {
}
// ----- if admin filter option -----
if($_SESSION['type'] === 'admin' && isset($_GET['agent']) && $_GET['agent']!="") {
if( ($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm') && isset($_GET['agent']) && $_GET['agent']!="") {
$agentId = $conn->real_escape_string($_GET['agent']);
$sql .= " AND `AA_AGENT`='".$agentId."'";
}
@@ -113,15 +113,16 @@ 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>
".($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' ? "<td>".$row["AA_AGENT"]."</td>" : "")."
<td>".$kolkataTime."</td>
<td>".$row["AT_ACID"]."</td>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AT_AMOUNT"]."</td>
".($_SESSION['type'] === 'admin' ? "<td style='font-size: 12px;'>".($row["REMARKS"] ?? '')."</td>" : "")."
".($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' ? "<td style='font-size: 12px;'>".($row["REMARKS"] ?? '')."</td>" : "")."
</tr>";
$totalAmount += $row["AT_AMOUNT"];
$rowsData[] = [$row["AT_ID"], $row["AT_TIMESTAMP"], $row["AT_ACID"], $row["AA_NAME"], $row["AT_AMOUNT"]];
@@ -171,7 +172,7 @@ document.addEventListener('DOMContentLoaded', function() {
const titleText = "Grafin Ventures Transaction Report";
const logo = new Image();
logo.src = '/asset/images/logo.webp';
logo.src = '/asset/images/new_logo2.jpg';
logo.onload = () => addContent();
logo.onerror = () => addContent();

View File

@@ -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'];
$user_id = $_POST['user_id'];
$user_name = $_POST['user_name'] ?? '';
$user_phone = $_POST['user_phone'] ?? '';
$type = $_POST['type'] ?? 'agent';
$comiRate = $_POST['comi_rate'] ?? null;
$passwordPlain = $_POST['password'] ?? '';
if (empty($_POST['user_name']) || empty($_POST['user_phone']) || empty($_POST['password'])) {
die("All fields are required.");
}
// 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);
$user_name = $_POST['user_name'];
$user_phone = $_POST['user_phone'];
$type = $_POST['type'] ?? 'agent';
$password = password_hash($_POST['password'], 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 (!preg_match("/^[0-9]{10}$/", $user_phone)) {
die("Invalid phone number format");
}
if (!isset($error)) {
$table = $GLOBALS['arif_users'] ?? 'arif_users';
$sql = "INSERT INTO `$table`
(user_id, password, type, user_name, user_phone, comi_rate, profile_pic)
VALUES (?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssssss", $user_id, $password, $type, $user_name, $user_phone, $comiRate, $profilePicPath);
$table = $GLOBALS['arif_users'] ?? 'arif_users';
$sql = "INSERT INTO `$table` (user_id, password, type, user_name, user_phone) VALUES (?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Prepare failed: " . $conn->error);
}
$stmt->bind_param("sssss", $user_id, $password, $type, $user_name, $user_phone);
if ($stmt->execute()) {
echo "<div class='alert alert-success'>User <strong>{$user_name}</strong> added successfully.</div>";
} else {
echo "<div class='alert alert-danger'>Failed to add user <strong>{$user_name}</strong>. Error: " . $stmt->error . "</div>";
}
$stmt->close();
$conn->close();
if ($stmt->execute()) {
$success = "User <strong>{$user_name}</strong> added successfully.";
} else {
$error = "Failed to add user: " . $stmt->error;
}
$stmt->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>

View File

@@ -88,7 +88,7 @@ function calculateAmount() {
<small>Installment Amount:</small>
<input type="text" id="inst_amount" value="' . $row['AA_INSTALLMENT'] . '" style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()">
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()" >
<small>Total received:</small>
<input type="number" id="total_rec" value="'.$total_rec.'" style="width:50px;" onchange="calculateFine()" disabled>
</td>
@@ -110,7 +110,7 @@ function calculateAmount() {
<small>Amount:</small>
<input type="text" id="show_amount" value="'.$row['AA_INSTALLMENT']. '" disabled style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()">
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()" ' . ($row['allowMultiple'] == 0 ? 'readonly' : '') . '>
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO']. '">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
@@ -172,25 +172,34 @@ function calculateAmount() {
<table class="table table-bordered">
<tr>
<td>
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO'].'">
<input type="hidden" name="ins_no" value="'.$due_i. '">
<input type="hidden" name="AA_ACNO" value="' . $row['AA_ACNO'] . '">
<input type="hidden" name="ins_no" value="' . $due_i . '">
<small>Due Amount:</small>
<input type="text" id="due_amount" value="'.$due_amount. '" disabled style="width:50px;border:1px solid red">
<input type="text" class="due_amount" value="' . $due_amount . '" disabled style="width:50px;border:1px solid red">
<small>Installment Amount:</small>
<input type="text" id="inst_amount" value="' . $row['AA_INSTALLMENT'] . '" style="width:50px;">
<input type="text" class="inst_amount" name="inst_amount"
value="' . $row['AA_INSTALLMENT'] . '"
style="width:50px;" ' . ($row['allowMultiple'] == 0 ? 'readonly' : '') . ' >
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()">
<input type="number" class="inst_no" name="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()" ' . ($row['allowMultiple'] == 0 ? 'readonly' : '') . '>
<small>Total received:</small>
<input type="number" id="total_rec" value="'.$total_rec.'" style="width:50px;" onchange="calculateFine()" disabled>
<input type="number" class="total_rec" name="total_rec" value="' . $total_rec . '" style="width:50px;" onchange="calculateFine()" disabled>
</td>
</tr>
<tr>
<td>
<input type="hidden" id="hidden_total_rec" value="'.$total_rec.'" name="add_i" style="width:50px;" onchange="calculateFine()">
<input type="hidden" class="hidden_total_rec" value="' . $total_rec . '" name="add_i" onchange="calculateFine()">
<small>Fine:</small>
<input type="number" id="fine" name="fine_amount" value="'.$fine_amount.'" min="0" style="width:50px;border:1px solid red" onchange="calculateFine()">
<input type="number" class="fine" name="fine_amount" value="' . $fine_amount . '" min="0" style="width:50px;border:1px solid red" onchange="calculateFine()">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$total_amount. '" disabled style="width:50px;border:1px solid red">
<input type="text" class="total_amount" value="' . $total_amount . '" disabled style="width:50px;border:1px solid red">
<input type="hidden" name="allowMultiple" value="'.($row['allowMultiple'] == 0 ? 0 : 1).'">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">
</td>
</tr>
@@ -201,11 +210,12 @@ function calculateAmount() {
<small>Amount:</small>
<input type="text" id="show_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()">
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()" ' . ($row['allowMultiple'] == 0 ? 'readonly' : '') . '>
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO']. '">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
<input type="hidden" id="hidden_total_amount" name="add_i" value="'.$row['AA_INSTALLMENT'].'">
<input type="hidden" name="allowMultiple" value="'.($row['allowMultiple'] == 0 ? 0 : 1).'">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">';
echo '</form></td></tr>';
}
@@ -215,14 +225,10 @@ function calculateAmount() {
}
?>
<?php
if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") {
if (
$_SERVER['REQUEST_METHOD'] === 'POST'
&& isset($_POST['PAY_LOAN_EMI_FROM_RECURRING'], $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'], $_POST['DEDUCT_LOAN_AMOUNT'])
&& $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'] === 'axakassaoxnnxsaoij34866'
) {
if ($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") {
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['PAY_LOAN_EMI_FROM_RECURRING'], $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'], $_POST['DEDUCT_LOAN_AMOUNT']) && $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'] === 'axakassaoxnnxsaoij34866') {
$loanEMIAmount = floatval($_POST['DEDUCT_LOAN_AMOUNT']);
$deductAmount = -$loanEMIAmount; // negative for recurring deduction
$deductAmount = $loanEMIAmount; // negative for recurring deduction
$paidToLoanAccountNumber = $_POST['LOAN_AC_NUMBER'];
$accountId = $_GET['no'];
@@ -259,35 +265,20 @@ if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"])
$conn->begin_transaction();
try {
$table = $GLOBALS['arif_tran'] ?? 'arif_tran';
$userType = 'admin';
// $table = $GLOBALS['arif_tran'] ?? 'arif_tran';
$table = 'fund_trans';
$requestBy = $_SESSION['user_id'];
$requestUSRType = $_SESSION['type'];
$recACNumber = $accountId;
$loanACNumber = $paidToLoanAccountNumber;
$transferAmount = $deductAmount;
// Entry 1: Deduction from recurring
$remarksText1 = "₹$loanEMIAmount deducted from Recurring for Loan A/c $paidToLoanAccountNumber EMI";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $accountId, $deductAmount, $remarksText1);
$stmt->execute();
$stmt->close();
// Entry 2: Credit to loan account
$remarksText2 = "₹$loanEMIAmount credited to Loan A/c $paidToLoanAccountNumber EMI (from Recurring $accountId)";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $paidToLoanAccountNumber, $loanEMIAmount, $remarksText2);
$stmt->execute();
$stmt->close();
// Update Loan Account
$ins_no = 1;
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` + ?, `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID` + ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("dis", $loanEMIAmount, $ins_no, $paidToLoanAccountNumber);
$stmt->execute();
$stmt->close();
// Update Recurring Account
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` - ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ds", $loanEMIAmount, $accountId);
// $remarksText1 = "₹$loanEMIAmount deducted from Recurring for Loan A/c $paidToLoanAccountNumber EMI";
$stmt = $conn->prepare("INSERT INTO `$table` (request_by, request_usr_type, rec_ac_number, loan_ac_number, transfer_amount) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("sssss", $requestBy, $requestUSRType, $recACNumber, $loanACNumber, $transferAmount);
$stmt->execute();
$stmt->close();
@@ -310,7 +301,7 @@ if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"])
}
?>
<?php if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") { ?>
<?php if ($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") { ?>
<div class="container">
<h4>Pay Loan EMI from Recurring balance</h4>
<div style="display: flex; gap: 20px; flex-direction: row; max-width: 60%;">
@@ -382,11 +373,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>

View File

@@ -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') {

View File

@@ -0,0 +1,74 @@
<?php
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
$conn->set_charset("utf8");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get agent list
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'];
$agentResult = $conn->query($getAgentListsQuery);
$agentList = [];
if ($agentResult && $agentResult->num_rows > 0) {
while ($row = $agentResult->fetch_assoc()) {
$agentList[] = $row;
}
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$collectableLoanAmount = isset($_POST['COLLECTABLE_LOAN_AMOUNT']) ? floatval($_POST['COLLECTABLE_LOAN_AMOUNT']) : 0;
$collectableRecurringAmount = isset($_POST['COLLECTABLE_RECURRING_AMOUNT']) ? floatval($_POST['COLLECTABLE_RECURRING_AMOUNT']) : 0;
$collectableAgent = isset($_POST['COLLECTABLE_AGENT']) ? $_POST['COLLECTABLE_AGENT'] : null;
if (($collectableLoanAmount > 0 || $collectableRecurringAmount > 0) && $collectableAgent) {
$stmt = $conn->prepare("
INSERT INTO agent_collections (
agent,
collectable_loan_amount,
collected_loan_amount,
collectable_recurring_amount,
collected_recurring_amount,
date
) VALUES (?, ?, 0, ?, 0, CURDATE())
");
$stmt->bind_param("sdd", $collectableAgent, $collectableLoanAmount, $collectableRecurringAmount);
if ($stmt->execute()) {
echo "<div class='alert alert-success'>Target assigned successfully!</div>";
} else {
echo "<div class='alert alert-danger'>Error: " . $stmt->error . "</div>";
}
$stmt->close();
} else {
echo "<div class='alert alert-warning'>Please enter a valid target amount and select an agent.</div>";
}
}
$conn->close();
?>
<div class="container">
<h2>Agent Collection Targets</h2>
<form method="post" style="display: flex; flex-direction: column; gap: 15px;">
<div>
<label for="COLLECTABLE_LOAN_AMOUNT">Loan Target Amount:</label>
<input id="COLLECTABLE_LOAN_AMOUNT" class="form-control" name="COLLECTABLE_LOAN_AMOUNT" type="text" placeholder="Enter Loan Amount" />
</div>
<div>
<label for="COLLECTABLE_RECURRING_AMOUNT">Recurring Target Amount:</label>
<input id="COLLECTABLE_RECURRING_AMOUNT" class="form-control" name="COLLECTABLE_RECURRING_AMOUNT" type="text" placeholder="Enter Recurring Amount" />
</div>
<div>
<label for="COLLECTABLE_AGENT">Assign To Agent:</label>
<select class="form-control" name="COLLECTABLE_AGENT" id="COLLECTABLE_AGENT">
<?php
foreach($agentList as $agent){
echo '<option value="'.$agent['user_id'].'">'.$agent['user_id'].' / '.$agent['user_name'].'</option>';
}
?>
</select>
</div>
<button class="btn btn-primary" type="submit">Assign Target</button>
</form>
</div>

View File

@@ -1,120 +1,319 @@
<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");
$monthStart = date("Y-m-01");
$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>
<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>
';
function calculateOpeningCommission($accountCycle, $accountType, $totalAmount, $installmentAmount, $refferTo, $totalPayments) {
// Commission chart data - Account Opening Commission
$commissionChart = [
'180' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'360' => ['50' => 25, '100' => 60, '200' => 150, '500' => 200, 'above' => 250],
'25' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'50' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200],
'6' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'12' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200]
];
$commission = 0;
// Loan account commission (0.5% of total amount)
if ($accountType === 'Loan') {
$commission = $totalAmount * 0.005;
return $commission;
}
// Recurring account commission - ONLY for exact amounts in chart (50, 100, 200, 500, above 500)
if ($accountType === 'Recurring') {
$planKey = '';
if ($accountCycle === 'D') {
$planKey = ($totalPayments <= 180) ? '180' : '360';
}
elseif ($accountCycle === 'W') {
$planKey = ($totalPayments <= 25) ? '25' : '50';
}
elseif ($accountCycle === 'M') {
$planKey = ($totalPayments <= 6) ? '6' : '12';
}
if (isset($commissionChart[$planKey])) {
$plan = $commissionChart[$planKey];
// ONLY give commission for exact amounts that are in the chart
if ($installmentAmount == 50) {
$commission = $plan['50'];
} elseif ($installmentAmount == 100) {
$commission = $plan['100'];
} elseif ($installmentAmount == 200) {
$commission = $plan['200'];
} elseif ($installmentAmount == 500) {
$commission = $plan['500'];
} elseif ($installmentAmount > 500) {
$commission = $plan['above'];
}
// For amounts like 20, 30, 40, 70, 150, 300 etc. - NO COMMISSION (commission remains 0)
}
}
return $commission;
}
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']);
function calculateCollectionCommission($agentId, $dateFrom, $dateTo) {
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
// Get agent's commission rate
$agentSql = "SELECT comi_rate FROM `".$GLOBALS['arif_users']."` WHERE user_id = '$agentId'";
$agentResult = $conn->query($agentSql);
$comiRate = 0;
if ($agentResult && $agentResult->num_rows > 0) {
$agentData = $agentResult->fetch_assoc();
$comiRate = $agentData['comi_rate'];
}
// Get total collection amount for this agent's accounts
$collectionSql = "SELECT COALESCE(SUM(t.AT_AMOUNT),0) as total_collection
FROM `".$GLOBALS['arif_tran']."` t
JOIN `".$GLOBALS['arif_ac']."` a ON t.AT_ACID = a.AA_ACNO
WHERE a.AA_AGENT = '$agentId'
AND t.AT_TIMESTAMP BETWEEN '$dateFrom 00:00:00' AND '$dateTo 23:59:59'";
$collectionResult = $conn->query($collectionSql);
$totalCollection = 0;
if ($collectionResult && $collectionResult->num_rows > 0) {
$collectionData = $collectionResult->fetch_assoc();
$totalCollection = $collectionData['total_collection'];
}
$conn->close();
// Calculate collection commission
$collectionCommission = ($totalCollection * $comiRate) / 100;
return [
'total_collection' => $totalCollection,
'comi_rate' => $comiRate,
'collection_commission' => $collectionCommission
];
}
//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');
function dual_commission_report($dateFrom, $dateTo) {
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Dual Commission Report: '.$dateFrom."".$dateTo.'</h5>
<small class="text-muted">Showing both Account Opening Commission and Collection Commission</small>
</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'] ?? '';
$loginId = $_SESSION['user_id'] ?? '';
// ---- Get ALL agents first ----
$agentsSql = "SELECT user_id, user_name, comi_rate FROM `".$GLOBALS['arif_users']."` WHERE type = 'agent'";
// ---- If Agent then filter only themselves ----
if ($loginType === 'agent') {
$agentsSql .= " AND user_id = '".$loginId."'";
}
$agentsResult = $conn->query($agentsSql);
$agentCommissions = [];
if ($agentsResult && $agentsResult->num_rows > 0) {
while($agent = $agentsResult->fetch_assoc()) {
$agentId = $agent['user_id'];
// Initialize agent data with collection commission
$collectionData = calculateCollectionCommission($agentId, $dateFrom, $dateTo);
$agentCommissions[$agentId] = [
'agent_name' => $agent['user_name'],
'opening_commission' => 0,
'collection_commission' => $collectionData['collection_commission'],
'total_collection' => $collectionData['total_collection'],
'account_count' => 0,
'comi_rate' => $collectionData['comi_rate']
];
}
}
// ---- Now get accounts created in the date range and add opening commission ----
$accountsSql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59'";
// ---- if Agent then filter only their accounts ----
if ($loginType === 'agent') {
$accountsSql .= " AND `refferTo` = '".$loginId."'";
}
$accountsResult = $conn->query($accountsSql);
if ($accountsResult && $accountsResult->num_rows > 0) {
while($account = $accountsResult->fetch_assoc()) {
// Calculate OPENING commission
$openingCommission = calculateOpeningCommission(
$account['AA_ACTYPE'],
$account['AA_TYPE'],
$account['AA_AMOUNT'] ?? 0,
$account['AA_INSTALLMENT'],
$account['refferTo'],
$account['AA_NO_OF_PAYMENT']
);
$commissionAgent = $account['refferTo'];
// If agent exists in our list, add opening commission
if (isset($agentCommissions[$commissionAgent])) {
$agentCommissions[$commissionAgent]['opening_commission'] += $openingCommission;
$agentCommissions[$commissionAgent]['account_count']++;
}
}
}
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>Accounts</th>
<th>Collection Amount</th>
<th>Collection Rate</th>
<th>Acc Opening Commission</th>
<th>Collection Commission</th>
<th>Total Commission</th>
</tr>
</thead>
<tbody>';
$grandTotalOpening = 0;
$grandTotalCollection = 0;
$grandTotalCommission = 0;
$grandTotalCollectionAmount = 0;
if (!empty($agentCommissions)) {
foreach($agentCommissions as $agentId => $agentData) {
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
$grandTotalOpening += $agentData['opening_commission'];
$grandTotalCollection += $agentData['collection_commission'];
$grandTotalCommission += $totalCommission;
$grandTotalCollectionAmount += $agentData['total_collection'];
echo "
<tr>
<td>".$agentId."</td>
<td>".$agentData['agent_name']."</td>
<td class='text-center'>".$agentData['account_count']."</td>
<td class='text-end'>".number_format($agentData['total_collection'], 2)."</td>
<td class='text-center'>".$agentData['comi_rate']."%</td>
<td class='text-end text-primary'>".number_format($agentData['opening_commission'], 2)."</td>
<td class='text-end text-success'>".number_format($agentData['collection_commission'], 2)."</td>
<td class='text-end fw-bold'>".number_format($totalCommission, 2)."</td>
</tr>";
}
} else {
echo "<tr><td colspan='8' class='text-center text-muted'>No commission data found</td></tr>";
}
echo '
</tbody>
</table>';
// ---- Show grand totals ----
if ($loginType !== 'agent' && !empty($agentCommissions)) {
echo '<div class="row mt-4">
<div class="col-md-4">
<div class="card bg-primary text-white">
<div class="card-body text-center">
<h6>Opening Commission</h6>
<h4>'.number_format($grandTotalOpening, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-success text-white">
<div class="card-body text-center">
<h6>Collection Commission</h6>
<h4>'.number_format($grandTotalCollection, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>Total Commission</h6>
<h4>'.number_format($grandTotalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
} elseif ($loginType === 'agent' && !empty($agentCommissions)) {
// Show individual agent summary
$agentData = reset($agentCommissions); // Get first (and only) agent data
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
echo '<div class="row mt-4">
<div class="col-md-6">
<div class="card bg-light">
<div class="card-body text-center">
<h6>My Summary</h6>
<p>Total Accounts: <b>'.$agentData['account_count'].'</b></p>
<p>Total Collection: <b>'.number_format($agentData['total_collection'], 2).'</b></p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>My Total Commission</h6>
<h4>'.number_format($totalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
}
echo '
</div>
</div>
</div>
</div>';
$conn->close();
}
?>
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Dual 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">
<button type="submit" class="btn btn-info w-100" style="margin-top: 25px;">Generate Report</button>
</div>
</form>
</div>
</div>
<?php
// ---- Call dual commission function ----
dual_commission_report($dFrom, $dTo);
?>

View File

@@ -0,0 +1,337 @@
<?php
// ---- Default date range ----
$today = date("Y-m-d");
$monthStart = date("Y-m-01");
$dFrom = $_GET['dFrom'] ?? $monthStart;
$dTo = $_GET['dTo'] ?? $today;
function calculateOpeningCommission($accountCycle, $accountType, $totalAmount, $installmentAmount, $refferTo, $totalPayments) {
// Commission chart data - Account Opening Commission
$commissionChart = [
'180' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'360' => ['50' => 25, '100' => 60, '200' => 150, '500' => 200, 'above' => 250],
'25' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'50' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200],
'6' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'12' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200]
];
$commission = 0;
// Loan account commission (0.5% of total amount)
if ($accountType === 'Loan') {
$commission = $totalAmount * 0.005;
return $commission;
}
// Recurring account commission - ONLY for exact amounts in chart (50, 100, 200, 500, above 500)
if ($accountType === 'Recurring') {
$planKey = '';
if ($accountCycle === 'D') {
$planKey = ($totalPayments <= 180) ? '180' : '360';
}
elseif ($accountCycle === 'W') {
$planKey = ($totalPayments <= 25) ? '25' : '50';
}
elseif ($accountCycle === 'M') {
$planKey = ($totalPayments <= 6) ? '6' : '12';
}
if (isset($commissionChart[$planKey])) {
$plan = $commissionChart[$planKey];
// ONLY give commission for exact amounts that are in the chart
if ($installmentAmount == 50) {
$commission = $plan['50'];
} elseif ($installmentAmount == 100) {
$commission = $plan['100'];
} elseif ($installmentAmount == 200) {
$commission = $plan['200'];
} elseif ($installmentAmount == 500) {
$commission = $plan['500'];
} elseif ($installmentAmount > 500) {
$commission = $plan['above'];
}
// For amounts like 20, 30, 40, 70, 150, 300 etc. - NO COMMISSION (commission remains 0)
}
}
return $commission;
}
function calculateCollectionCommission($agentId, $dateFrom, $dateTo) {
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
// Get agent's commission rate
$agentSql = "SELECT comi_rate FROM `".$GLOBALS['arif_users']."` WHERE user_id = '$agentId'";
$agentResult = $conn->query($agentSql);
$comiRate = 0;
if ($agentResult && $agentResult->num_rows > 0) {
$agentData = $agentResult->fetch_assoc();
$comiRate = $agentData['comi_rate'];
}
// Get total collection amount for this agent's accounts
$collectionSql = "SELECT COALESCE(SUM(t.AT_AMOUNT),0) as total_collection
FROM `".$GLOBALS['arif_tran']."` t
JOIN `".$GLOBALS['arif_ac']."` a ON t.AT_ACID = a.AA_ACNO
WHERE a.AA_AGENT = '$agentId'
AND t.AT_TIMESTAMP BETWEEN '$dateFrom 00:00:00' AND '$dateTo 23:59:59'";
$collectionResult = $conn->query($collectionSql);
$totalCollection = 0;
if ($collectionResult && $collectionResult->num_rows > 0) {
$collectionData = $collectionResult->fetch_assoc();
$totalCollection = $collectionData['total_collection'];
}
$conn->close();
// Calculate collection commission
$collectionCommission = ($totalCollection * $comiRate) / 100;
return [
'total_collection' => $totalCollection,
'comi_rate' => $comiRate,
'collection_commission' => $collectionCommission
];
}
function dual_commission_report($dateFrom, $dateTo) {
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Dual Commission Report: '.$dateFrom."".$dateTo.'</h5>
<small class="text-muted">Showing both Account Opening Commission and Collection Commission</small>
</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'] ?? '';
$loginId = $_SESSION['user_id'] ?? '';
// ---- Get all accounts created in the date range ----
$accountsSql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59'";
// ---- if Agent then filter only their accounts ----
if ($loginType === 'agent') {
$accountsSql .= " AND `refferTo` = '".$loginId."'";
}
$accountsResult = $conn->query($accountsSql);
// ---- Group commissions by agent ----
$agentCommissions = [];
if ($accountsResult && $accountsResult->num_rows > 0) {
while($account = $accountsResult->fetch_assoc()) {
// Calculate OPENING commission
$openingCommission = calculateOpeningCommission(
$account['AA_ACTYPE'],
$account['AA_TYPE'],
$account['AA_AMOUNT'] ?? 0,
$account['AA_INSTALLMENT'],
$account['refferTo'],
$account['AA_NO_OF_PAYMENT']
);
// Determine which agent gets commission
$commissionAgent = $account['refferTo'];
// If agent is viewing, only show their own data
if ($loginType === 'agent' && $commissionAgent !== $loginId) {
continue;
}
if (!isset($agentCommissions[$commissionAgent])) {
// Get agent name
$agentNameSql = "SELECT user_name FROM `".$GLOBALS['arif_users']."` WHERE user_id = '".$commissionAgent."'";
$agentNameResult = $conn->query($agentNameSql);
$agentName = $agentNameResult && $agentNameResult->num_rows > 0 ? $agentNameResult->fetch_assoc()['user_name'] : $commissionAgent;
$agentCommissions[$commissionAgent] = [
'agent_name' => $agentName,
'opening_commission' => 0,
'collection_commission' => 0,
'total_collection' => 0,
'account_count' => 0,
'comi_rate' => 0
];
// Calculate COLLECTION commission for this agent
$collectionData = calculateCollectionCommission($commissionAgent, $dateFrom, $dateTo);
$agentCommissions[$commissionAgent]['collection_commission'] = $collectionData['collection_commission'];
$agentCommissions[$commissionAgent]['total_collection'] = $collectionData['total_collection'];
$agentCommissions[$commissionAgent]['comi_rate'] = $collectionData['comi_rate'];
}
$agentCommissions[$commissionAgent]['opening_commission'] += $openingCommission;
$agentCommissions[$commissionAgent]['account_count']++;
}
}
// ---- If no data found and user is agent, show their own record with zero commission ----
if ($loginType === 'agent' && empty($agentCommissions)) {
$agentNameSql = "SELECT user_name, comi_rate FROM `".$GLOBALS['arif_users']."` WHERE user_id = '".$loginId."'";
$agentNameResult = $conn->query($agentNameSql);
if ($agentNameResult && $agentNameResult->num_rows > 0) {
$agentData = $agentNameResult->fetch_assoc();
$collectionData = calculateCollectionCommission($loginId, $dateFrom, $dateTo);
$agentCommissions[$loginId] = [
'agent_name' => $agentData['user_name'],
'opening_commission' => 0,
'collection_commission' => $collectionData['collection_commission'],
'total_collection' => $collectionData['total_collection'],
'account_count' => 0,
'comi_rate' => $collectionData['comi_rate']
];
}
}
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>Accounts</th>
<th>Collection Amount</th>
<th>Collection Rate</th>
<th>Opening Commission</th>
<th>Collection Commission</th>
<th>Total Commission</th>
</tr>
</thead>
<tbody>';
$grandTotalOpening = 0;
$grandTotalCollection = 0;
$grandTotalCommission = 0;
$grandTotalCollectionAmount = 0;
if (!empty($agentCommissions)) {
foreach($agentCommissions as $agentId => $agentData) {
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
$grandTotalOpening += $agentData['opening_commission'];
$grandTotalCollection += $agentData['collection_commission'];
$grandTotalCommission += $totalCommission;
$grandTotalCollectionAmount += $agentData['total_collection'];
echo "
<tr>
<td>".$agentId."</td>
<td>".$agentData['agent_name']."</td>
<td class='text-center'>".$agentData['account_count']."</td>
<td class='text-end'>".number_format($agentData['total_collection'], 2)."</td>
<td class='text-center'>".$agentData['comi_rate']."%</td>
<td class='text-end text-primary'>".number_format($agentData['opening_commission'], 2)."</td>
<td class='text-end text-success'>".number_format($agentData['collection_commission'], 2)."</td>
<td class='text-end fw-bold'>".number_format($totalCommission, 2)."</td>
</tr>";
}
} else {
echo "<tr><td colspan='8' class='text-center text-muted'>No commission data found</td></tr>";
}
echo '
</tbody>
</table>';
// ---- Show grand totals ----
if ($loginType !== 'agent' && !empty($agentCommissions)) {
echo '<div class="row mt-4">
<div class="col-md-4">
<div class="card bg-primary text-white">
<div class="card-body text-center">
<h6>Opening Commission</h6>
<h4>'.number_format($grandTotalOpening, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-success text-white">
<div class="card-body text-center">
<h6>Collection Commission</h6>
<h4>'.number_format($grandTotalCollection, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>Total Commission</h6>
<h4>'.number_format($grandTotalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
} elseif ($loginType === 'agent' && !empty($agentCommissions)) {
// Show individual agent summary
$agentData = reset($agentCommissions); // Get first (and only) agent data
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
echo '<div class="row mt-4">
<div class="col-md-6">
<div class="card bg-light">
<div class="card-body text-center">
<h6>My Summary</h6>
<p>Total Accounts: <b>'.$agentData['account_count'].'</b></p>
<p>Total Collection: <b>'.number_format($agentData['total_collection'], 2).'</b></p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>My Total Commission</h6>
<h4>'.number_format($totalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
}
echo '
</div>
</div>
</div>
</div>';
$conn->close();
}
?>
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Dual 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">
<button type="submit" class="btn btn-info w-100" style="margin-top: 25px;">Generate Report</button>
</div>
</form>
</div>
</div>
<?php
// ---- Call dual commission function ----
dual_commission_report($dFrom, $dTo);
?>

View File

@@ -0,0 +1,226 @@
[
{
"AA_ID": "1766",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251001R1766",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-01 07:21:20",
"AA_BAL": "600",
"AA_NAME": "BHANJAN BAR",
"AA_FATHER": null,
"AA_ICARD_NO": "7063172814",
"AA_EMAIL": "",
"AA_PHONE": "7063172814",
"AA_ADDRESS": "KUMRA SCHOOL MATH",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.634",
"AA_INSTALLMENT": "100",
"AA_AMOUNT": null,
"AA_FINE": "25",
"AA_NO_OF_PAYMENT": "360",
"AA_NO_OF_PAYPAID": "5",
"AA_DATE_MATURE": "2026-11-1",
"AA_DATE": "2025-10-01",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "38000",
"AA_NOMINEE_DETAILS": "Name:\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "1",
"refferTo": "PUJA@KIRTANIA"
},
{
"AA_ID": "1767",
"AA_ADMIN": null,
"AA_ACNO": "GVF20251003F1767",
"AA_ACTYPE": "F",
"AA_TIMESTAMP": "2025-10-03 04:46:15",
"AA_BAL": "0",
"AA_NAME": "SELIMA BIBI",
"AA_FATHER": null,
"AA_ICARD_NO": "3176 5017 7202",
"AA_EMAIL": "",
"AA_PHONE": "",
"AA_ADDRESS": "",
"AA_TYPE": "FD",
"AA_INTEREST": "5.634",
"AA_INSTALLMENT": "0",
"AA_AMOUNT": "50",
"AA_FINE": "0",
"AA_NO_OF_PAYMENT": "180",
"AA_NO_OF_PAYPAID": "0",
"AA_DATE_MATURE": "2790-1-3",
"AA_DATE": "2025-10-03",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "92",
"AA_NOMINEE_DETAILS": "Name:\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "PUJA@KIRTANIA"
},
{
"AA_ID": "1768",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251003R1768",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-03 04:47:35",
"AA_BAL": "200",
"AA_NAME": "SELIMA BIBI",
"AA_FATHER": null,
"AA_ICARD_NO": "3176 5017 7202",
"AA_EMAIL": "",
"AA_PHONE": "933638783",
"AA_ADDRESS": "KAMDEBKATI",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.634",
"AA_INSTALLMENT": "50",
"AA_AMOUNT": null,
"AA_FINE": "20",
"AA_NO_OF_PAYMENT": "180",
"AA_NO_OF_PAYPAID": "4",
"AA_DATE_MATURE": "2026-5-3",
"AA_DATE": "2025-10-03",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "9250",
"AA_NOMINEE_DETAILS": "Name:\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "RUKSANA@KHATUN"
},
{
"AA_ID": "1769",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251003R1769",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-03 10:37:07",
"AA_BAL": "60",
"AA_NAME": "BHUPAL MONDAL",
"AA_FATHER": null,
"AA_ICARD_NO": "7007 7717 9952",
"AA_EMAIL": "",
"AA_PHONE": "7699665158",
"AA_ADDRESS": "KUMRA",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.634",
"AA_INSTALLMENT": "30",
"AA_AMOUNT": null,
"AA_FINE": "10",
"AA_NO_OF_PAYMENT": "360",
"AA_NO_OF_PAYPAID": "2",
"AA_DATE_MATURE": "2026-11-3",
"AA_DATE": "2025-10-03",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "11400",
"AA_NOMINEE_DETAILS": "Name:\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "RUKSANA@KHATUN"
},
{
"AA_ID": "1770",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251003R1770",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-03 10:52:17",
"AA_BAL": "40",
"AA_NAME": "RENU BISWAS",
"AA_FATHER": null,
"AA_ICARD_NO": "8768690705",
"AA_EMAIL": "",
"AA_PHONE": "8768690705",
"AA_ADDRESS": "KUMRA, KUSHI PALACE",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.634",
"AA_INSTALLMENT": "20",
"AA_AMOUNT": null,
"AA_FINE": "10",
"AA_NO_OF_PAYMENT": "360",
"AA_NO_OF_PAYPAID": "2",
"AA_DATE_MATURE": "2026-11-3",
"AA_DATE": "2025-10-03",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "7600",
"AA_NOMINEE_DETAILS": "Name:HARIDAS BISWAS\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "PUJA@KIRTANIA"
},
{
"AA_ID": "1771",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251005R1771",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-05 12:55:40",
"AA_BAL": "100",
"AA_NAME": "NARESH CH BAIRAGI ",
"AA_FATHER": null,
"AA_ICARD_NO": "12345678",
"AA_EMAIL": "",
"AA_PHONE": "9733773954",
"AA_ADDRESS": "KAMDEVKATHI ",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.647",
"AA_INSTALLMENT": "100",
"AA_AMOUNT": null,
"AA_FINE": "5",
"AA_NO_OF_PAYMENT": "180",
"AA_NO_OF_PAYPAID": "1",
"AA_DATE_MATURE": "2026-5-5",
"AA_DATE": "2025-10-05",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "18501",
"AA_NOMINEE_DETAILS": "Name:\r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "PUJA@KIRTANIA",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "RUKSANA@KHATUN"
},
{
"AA_ID": "1772",
"AA_ADMIN": null,
"AA_ACNO": "GVD20251006R1772",
"AA_ACTYPE": "D",
"AA_TIMESTAMP": "2025-10-06 09:37:16",
"AA_BAL": "200",
"AA_NAME": "RIYAJUL MONDAL",
"AA_FATHER": null,
"AA_ICARD_NO": "123456",
"AA_EMAIL": "",
"AA_PHONE": "9093692025",
"AA_ADDRESS": "PANCHGHARIA",
"AA_TYPE": "Recurring",
"AA_INTEREST": "5.467",
"AA_INSTALLMENT": "200",
"AA_AMOUNT": null,
"AA_FINE": "5",
"AA_NO_OF_PAYMENT": "360",
"AA_NO_OF_PAYPAID": "1",
"AA_DATE_MATURE": "2026-11-6",
"AA_DATE": "2025-10-06",
"AA_G2_DETAILS": null,
"AA_G1_DETAILS": null,
"AA_MATURE_VALUE": "75882",
"AA_NOMINEE_DETAILS": "Name: ARBINA BIBI \r\nDOB:\r\nRelation:\r\nID:\r\n ",
"AA_AGENT": "RUKSANA@KHATUN",
"CLOSING_DATE": null,
"STATUS": null,
"allowMultiple": "0",
"refferTo": "PUJA@KIRTANIA"
}
]

View File

@@ -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,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user_phone = $_POST['user_phone'];
$type = $_POST['type'];
$user_id = $_POST['user_id'];
$comi_rate = $_POST['comi_rate'] ?? null;
$profilePicPath = $user['profile_pic']; // default old pic
// Validate inputs
if (empty($user_name) || empty($user_phone) || empty($user_id)) {
@@ -44,29 +41,36 @@ 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;
// Delete old file if exists
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 = ?
WHERE id = ?";
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET user_id = ?, user_name = ?, user_phone = ?, type = ?, comi_rate = ?, 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("ssssdssi", $user_id, $user_name, $user_phone, $type, $comi_rate, $password, $profilePicPath, $id);
} else {
// Update without password
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET
user_id = ?,
user_name = ?,
user_phone = ?,
type = ?
WHERE id = ?";
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET user_id = ?, user_name = ?, user_phone = ?, type = ?, comi_rate = ?, profile_pic = ? WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssi", $user_id, $user_name, $user_phone, $type, $id);
$stmt->bind_param("ssssdsi", $user_id, $user_name, $user_phone, $type, $comi_rate, $profilePicPath, $id);
}
if ($stmt->execute()) {
@@ -99,7 +103,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 +118,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">
@@ -124,30 +136,30 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<div class="form-group mb-3">
<label for="type" class="form-label">User Type</label>
<select class="form-control" id="type" name="type" required>
<select class="form-control" id="type" name="type" required onchange="toggleCommissionField()">
<option value="agent" <?php echo $user['type'] === 'agent' ? 'selected' : ''; ?>>Agent</option>
<option value="admin" <?php echo $user['type'] === 'admin' ? 'selected' : ''; ?>>Admin</option>
<option value="supervisor" <?php echo $user['type'] === 'supervisor' ? 'selected' : ''; ?>>Supervisor</option>
<option value="bm" <?php echo $user['type'] === 'bm' ? 'selected' : ''; ?>>Branch Manager</option>
</select>
</div>
</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 class="form-group mb-3" id="commission-field" style="<?php echo ($user['type'] === 'agent') ? '' : 'display: none;'; ?>">
<label for="comi_rate" class="form-label">Commission Rate (%)</label>
<input type="number" step="0.01" class="form-control" id="comi_rate" name="comi_rate"
value="<?php echo htmlspecialchars($user['comi_rate']); ?>" placeholder="Enter commission rate">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-primary">Update User</button>
<a href="/Admin/Settings_Agent" class="btn ">Cancel</a>
</div>
<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 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>
</form>
<?php else: ?>
@@ -164,20 +176,31 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
this.setCustomValidity("");
}
});
// Toggle commission field based on user type
function toggleCommissionField() {
const selectedUserType = document.getElementById('type').value;
const commissionField = document.getElementById('commission-field');
if (selectedUserType === 'agent') {
commissionField.style.display = 'block';
document.getElementById('comi_rate').setAttribute('required', 'required');
} else {
commissionField.style.display = 'none';
document.getElementById('comi_rate').removeAttribute('required');
}
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
toggleCommissionField();
});
</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(); ?>

View File

@@ -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>";

View File

@@ -0,0 +1,502 @@
<?php
session_start();
date_default_timezone_set('Asia/Kolkata');
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
// Database connection
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Process status update if form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_status'])) {
$id = $conn->real_escape_string($_POST['id']);
$status = $conn->real_escape_string($_POST['status']);
$approved_by = $_SESSION['user_id'];
$remarks = $conn->real_escape_string($_POST['remarks'] ?? '');
try {
$conn->begin_transaction();
// First get the transaction details
$getStmt = $conn->prepare("SELECT * FROM fund_trans WHERE id = ?");
$getStmt->bind_param("i", $id);
$getStmt->execute();
$transaction = $getStmt->get_result()->fetch_assoc();
$getStmt->close();
if ($transaction) {
// Check if the current user has permission to approve this request
$can_approve = false;
// Admin can approve BM requests
if ($_SESSION['type'] === 'admin' && $transaction['request_usr_type'] === 'bm') {
$can_approve = true;
}
// BM can approve Admin requests
elseif ($_SESSION['type'] === 'bm' && $transaction['request_usr_type'] === 'admin') {
$can_approve = true;
}
if (!$can_approve) {
throw new Exception("You don't have permission to approve this request.");
}
$updateStmt = $conn->prepare("UPDATE fund_trans SET status = ?, approved_by = ?, approved_usr_type = ?, remarks = ? WHERE id = ?");
$updateStmt->bind_param("ssssi", $status, $approved_by, $_SESSION['type'], $remarks, $id);
$updateStmt->execute();
// If approved, process the fund transfer
if ($status == 1) {
$transfer_amount = abs($transaction['transfer_amount']); // Make it positive
$rec_ac_number = $transaction['rec_ac_number']; // Recurring Account Number
$loan_ac_number = $transaction['loan_ac_number']; // Loan Account Number
// Check if Recurring Account has sufficient balance
$balanceCheck = $conn->prepare("SELECT AA_BAL FROM `" . $GLOBALS['arif_ac'] . "` WHERE AA_ACNO = ?");
$balanceCheck->bind_param("s", $rec_ac_number);
$balanceCheck->execute();
$balanceCheck->bind_result($current_balance);
$balanceCheck->fetch();
$balanceCheck->close();
if ($current_balance < $transfer_amount) {
throw new Exception("Insufficient balance in Recurring Account.");
}
// Deduct from Recurring Account
$deductStmt = $conn->prepare("UPDATE `" . $GLOBALS['arif_ac'] . "` SET AA_BAL = AA_BAL - ? WHERE AA_ACNO = ?");
$deductStmt->bind_param("ds", $transfer_amount, $rec_ac_number);
$deductStmt->execute();
$deductStmt->close();
// Add to Loan Account
$addStmt = $conn->prepare("UPDATE `" . $GLOBALS['arif_ac'] . "` SET AA_BAL = AA_BAL + ? WHERE AA_ACNO = ?");
$addStmt->bind_param("ds", $transfer_amount, $loan_ac_number);
$addStmt->execute();
$addStmt->close();
// Create transaction records
$userType = $_SESSION['type'];
$table = $GLOBALS['arif_tran'] ?? 'arif_tran';
// Deduction from Recurring Account
$remarksText1 = "$transfer_amount transferred to Loan A/c $loan_ac_number";
$stmt1 = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$negative_amount = -$transfer_amount;
$stmt1->bind_param("ssds", $userType, $rec_ac_number, $negative_amount, $remarksText1);
$stmt1->execute();
$stmt1->close();
// Credit to Loan Account
$remarksText2 = "$transfer_amount received from Recurring A/c $rec_ac_number";
$stmt2 = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt2->bind_param("ssds", $userType, $loan_ac_number, $transfer_amount, $remarksText2);
$stmt2->execute();
$stmt2->close();
}
if ($updateStmt->affected_rows > 0) {
$conn->commit();
$success_message = "Status updated successfully!";
} else {
throw new Exception("No rows affected. Update failed.");
}
$updateStmt->close();
} else {
throw new Exception("Transaction not found.");
}
} catch (Exception $e) {
$conn->rollback();
$error_message = "Error updating status: " . $e->getMessage();
}
}
// Get all pending items where status = 0
$countResult = [];
try {
$table = 'fund_trans';
// Only show requests that the current user can approve
if ($_SESSION['type'] === 'admin') {
$countStmt = $conn->prepare("SELECT * FROM `$table` WHERE status = 0 AND request_usr_type = 'bm' ORDER BY created DESC");
} elseif ($_SESSION['type'] === 'bm') {
$countStmt = $conn->prepare("SELECT * FROM `$table` WHERE status = 0 AND request_usr_type = 'admin' ORDER BY created DESC");
} else {
// For other user types, show nothing
$countStmt = $conn->prepare("SELECT * FROM `$table` WHERE status = 0 AND 1=0 ORDER BY created DESC");
}
$countStmt->execute();
$result = $countStmt->get_result();
while ($row = $result->fetch_assoc()) {
$countResult[] = $row;
}
$countStmt->close();
} catch (Exception $e) {
$error_message = "Error: " . $e->getMessage();
}
// Get approval history
$historyResult = [];
try {
if ($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm') {
$historyStmt = $conn->prepare("SELECT * FROM `fund_trans` WHERE status != 0 ORDER BY created DESC LIMIT 20");
$historyStmt->execute();
$history = $historyStmt->get_result();
while ($row = $history->fetch_assoc()) {
$historyResult[] = $row;
}
$historyStmt->close();
}
} catch (Exception $e) {
$history_error = "Error loading history: " . $e->getMessage();
}
$conn->close();
?>
<!-- Notification Section -->
<div class="container mt-4">
<?php if (isset($success_message)): ?>
<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<strong>Success!</strong> <?php echo $success_message; ?>
</div>
<?php endif; ?>
<?php if (isset($error_message)): ?>
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<strong>Error!</strong> <?php echo $error_message; ?>
</div>
<?php endif; ?>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4 class="pull-left">Pending Fund Transfer Requests</h4>
<span class="badge pull-right"><?php echo count($countResult); ?> Pending</span>
<div class="clearfix"></div>
</div>
</div>
<div class="panel-body">
<?php if (count($countResult) > 0): ?>
<div class="table-responsive">
<table class="table table-bordered table-hover" id="notificationTable" style="font-size: 14px;">
<thead>
<tr>
<th>ID</th>
<th>Requested By</th>
<th>Req. User Type</th>
<th>Recurring Account</th>
<th>Loan Account</th>
<th>Amount</th>
<th>Req. On</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($countResult as $row): ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['request_by']; ?></td>
<td><span class="label label-<?php echo $row['request_usr_type'] === 'admin' ? 'primary' : 'info'; ?>"><?php echo strtoupper($row['request_usr_type']); ?></span></td>
<td><?php echo $row['rec_ac_number']; ?></td>
<td><?php echo $row['loan_ac_number']; ?></td>
<td class="text-danger"><strong><?php echo $row['transfer_amount']; ?></strong></td>
<td><?php echo date("d M Y, h:i A", strtotime($row['created'])); ?></td>
<td>
<div class="btn-group btn-group-sm">
<button class="btn btn-success" onclick="openStatusModal(<?php echo $row['id']; ?>, 1)">
<i class="glyphicon glyphicon-ok"></i> Approve
</button>
<button class="btn btn-danger" onclick="openStatusModal(<?php echo $row['id']; ?>, 2)">
<i class="glyphicon glyphicon-remove"></i> Reject
</button>
<button class="btn btn-info" onclick="viewDetails(<?php echo $row['id']; ?>)">
<i class="glyphicon glyphicon-eye-open"></i> View
</button>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-info text-center">
<i class="glyphicon glyphicon-info-sign" style="font-size: 24px;"></i>
<h4>No pending fund transfer requests</h4>
<p>All requests have been processed or you don't have any requests to approve.</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Approval History Section -->
<div class="container mt-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Approval History</h4>
</div>
<div class="panel-body">
<?php if (isset($history_error)): ?>
<div class="alert alert-warning">
<?php echo $history_error; ?>
</div>
<?php elseif (count($historyResult) > 0): ?>
<div class="table-responsive">
<table class="table table-bordered table-hover" id="historyTable" style="font-size: 14px;">
<thead>
<tr>
<th>ID</th>
<th>Requested By</th>
<th>Requested User Type</th>
<th>Approved By</th>
<th>Approved User Type</th>
<th>Recurring Account</th>
<th>Loan Account</th>
<th>Amount</th>
<th>Status</th>
<th>Requested On</th>
<th>Approved On</th>
</tr>
</thead>
<tbody>
<?php foreach ($historyResult as $row): ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['request_by']; ?></td>
<td><span class="label label-<?php echo $row['request_usr_type'] === 'admin' ? 'primary' : 'info'; ?>"><?php echo strtoupper($row['request_usr_type']); ?></span></td>
<td><?php echo $row['approved_by'] ?? 'N/A'; ?></td>
<td>
<?php if ($row['approved_usr_type']): ?>
<span class="label label-<?php echo $row['approved_usr_type'] === 'admin' ? 'primary' : 'info'; ?>"><?php echo strtoupper($row['approved_usr_type']); ?></span>
<?php else: ?>
N/A
<?php endif; ?>
</td>
<td><?php echo $row['rec_ac_number']; ?></td>
<td><?php echo $row['loan_ac_number']; ?></td>
<td class="<?php echo $row['status'] == 1 ? 'text-success' : 'text-danger'; ?>">
<strong><?php echo $row['transfer_amount']; ?></strong>
</td>
<td>
<?php if ($row['status'] == 1): ?>
<span class="label label-success">Approved</span>
<?php elseif ($row['status'] == 2): ?>
<span class="label label-danger">Rejected</span>
<?php else: ?>
<span class="label label-warning">Pending</span>
<?php endif; ?>
</td>
<td><?php echo date("d M Y, h:i A", strtotime($row['created'])); ?></td>
<td>
<?php if ($row['status'] != 0): ?>
<?php echo date("d M Y, h:i A", strtotime($row['created'])); ?>
<?php else: ?>
N/A
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-info text-center">
<i class="glyphicon glyphicon-info-sign" style="font-size: 24px;"></i>
<h4>No approval history found</h4>
<p>There are no approved or rejected requests in the history.</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- View Details Modal -->
<div class="modal fade" id="viewModal" tabindex="-1" role="dialog" aria-labelledby="viewModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="viewModalLabel">Transaction Details</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<p><strong>ID:</strong> <span id="detail-id"></span></p>
<p><strong>Requested By:</strong> <span id="detail-request-by"></span></p>
<p><strong>User Type:</strong> <span id="detail-usr-type"></span></p>
</div>
<div class="col-md-6">
<p><strong>Recurring Account:</strong> <span id="detail-rec-account"></span></p>
<p><strong>Loan Account:</strong> <span id="detail-loan-account"></span></p>
<p><strong>Amount:</strong> <span id="detail-amount" class="text-danger"><strong></strong></span></p>
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<p><strong>Requested On:</strong> <span id="detail-created"></span></p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Status Update Modal -->
<div class="modal fade" id="statusModal" tabindex="-1" role="dialog" aria-labelledby="statusModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form method="post" action="">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="statusModalLabel">Update Transaction Status</h4>
</div>
<div class="modal-body">
<input type="hidden" name="id" id="status-id">
<input type="hidden" name="update_status" value="1">
<div class="form-group">
<label for="status" class="control-label">Status</label>
<select class="form-control" id="status" name="status" required>
<option value="1">Approve</option>
<option value="2">Reject</option>
</select>
</div>
<div class="form-group">
<label for="remarks" class="control-label">Remarks (Optional)</label>
<textarea class="form-control" id="remarks" name="remarks" rows="3"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Update Status</button>
</div>
</form>
</div>
</div>
</div>
<script>
// View transaction details
function viewDetails(id) {
<?php foreach ($countResult as $row): ?>
if (<?php echo $row['id']; ?> === id) {
document.getElementById('detail-id').textContent = <?php echo $row['id']; ?>;
document.getElementById('detail-request-by').textContent = "<?php echo $row['request_by']; ?>";
document.getElementById('detail-usr-type').textContent = "<?php echo $row['request_usr_type']; ?>";
document.getElementById('detail-rec-account').textContent = "<?php echo $row['rec_ac_number']; ?>";
document.getElementById('detail-loan-account').textContent = "<?php echo $row['loan_ac_number']; ?>";
document.getElementById('detail-amount').textContent = "<?php echo $row['transfer_amount']; ?>";
document.getElementById('detail-created').textContent = "<?php echo date("d M Y, h:i A", strtotime($row['created'])); ?>";
}
<?php endforeach; ?>
// Use Bootstrap 3 modal method
$('#viewModal').modal('show');
}
// Open status update modal
function openStatusModal(id, status) {
document.getElementById('status-id').value = id;
document.getElementById('status').value = status;
// Use Bootstrap 3 modal method
$('#statusModal').modal('show');
}
// Initialize DataTable if we have records (if DataTable is available)
document.addEventListener('DOMContentLoaded', function() {
// Check if DataTable is available (if you're using it)
if (typeof $.fn.DataTable !== 'undefined') {
<?php if (count($countResult) > 0): ?>
$('#notificationTable').DataTable({
"pageLength": 10,
"order": [[6, "desc"]],
"language": {
"search": "Search transactions:",
"lengthMenu": "Show _MENU_ entries",
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
"paginate": {
"previous": "Previous",
"next": "Next"
}
}
});
<?php endif; ?>
<?php if (count($historyResult) > 0): ?>
$('#historyTable').DataTable({
"pageLength": 10,
"order": [[9, "desc"]],
"language": {
"search": "Search history:",
"lengthMenu": "Show _MENU_ entries",
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
"paginate": {
"previous": "Previous",
"next": "Next"
}
}
});
<?php endif; ?>
}
});
</script>
<style>
.panel {
border-radius: 4px;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.table th {
font-weight: 600;
background-color: #f5f5f5;
}
.btn-group-sm > .btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.badge {
background-color: #d9534f;
font-size: 14px;
padding: 5px 10px;
margin-top: 5px;
}
.label {
font-size: 85%;
padding: 0.2em 0.6em 0.3em;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -0,0 +1 @@
<svg width="64px" height="64px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="#ffffff" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="#ffffff" d="M628.736 528.896A416 416 0 0 1 928 928H96a415.872 415.872 0 0 1 299.264-399.104L512 704l116.736-175.104zM720 304a208 208 0 1 1-416 0 208 208 0 0 1 416 0z"></path></g></svg>

After

Width:  |  Height:  |  Size: 475 B

View File

@@ -0,0 +1,468 @@
<script>
function calculateFine() {
var due_amount = document.getElementById('due_amount'),
inst_no = document.getElementById('inst_no').value,
inst_amount = document.getElementById('inst_amount').value,
total_rec = document.getElementById('total_rec').value,
// rec_amount = document.getElementById('rec_amount'),
fine = document.getElementById('fine');
due_amount = parseInt(due_amount.value);
fine = parseInt(fine.value);
// document.getElementById('due_amount').value = due_amount;
// document.getElementById('rec_amount').value = due_amount + fine;
document.getElementById('total_amount').value = inst_amount * inst_no + fine;
document.getElementById('hidden_total_rec').value = inst_amount * inst_no;
document.getElementById('total_rec').value = inst_amount * inst_no;
}
function calculateAmount() {
var inst_amount = document.getElementById('inst_amount').value,
// rec_amount = document.getElementById('rec_amount').value,
inst_no = document.getElementById('inst_no').value;
show_amount = document.getElementById('show_amount').value;
// document.getElementById('rec_amount').value = inst_amount * inst_no;
// document.getElementById('show_amount').value = inst_amount * inst_no;
document.getElementById('total_amount').value = inst_amount * inst_no;
document.getElementById('hidden_total_amount').value = inst_amount * inst_no;
}
</script>
<div class="container" style="margin-top: 20px;margin-bottom:20px;">
<form method="get" action="Trans_New">
<div class="form-group">
<input class="form-control" type="text" placeholder="input A/C no and enter" name="no">
</div>
</form>
</div>
<?php
$CURRENT_RECURRING_BALANCE = 0;
if(isset($_GET["no"]) && isset($_GET["type"])&&$_GET["type"]=="Loan"){
echo '
<div class="container" style="margin-top: 20px;"> <h5>New Transaction : '.$GLOBALS['post_info'].' </h5><hr></div>
<div class="container">
<table class="table table-striped table-bordered table-hover table-responsive">
<tr>
<th>Name</th>
<th>Phone</th>
<th>AC No</th>
<th>Remaining Amount</th>
<th>Installment</th>
</tr>';
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_ACNO` = '".$_GET["no"]."' ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$date1 = date_create($row["AA_DATE"]);
$date2 = date_create(date("Y/m/d"));
$diff = date_diff($date1, $date2);
if ($row["AA_ACTYPE"] == 'D'){$diff = $diff->format("%a"); $diff=(int)$diff;$due_i=$diff-$row["AA_NO_OF_PAYPAID"];} else {$diff=$diff->format("%m"); $diff=(int)$diff;$due_i=$diff-$row["AA_NO_OF_PAYPAID"];}
//$ID=$row["GC_ID"];
echo "
<tr>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AA_PHONE"]."</td>
<td>".$row["AA_ACNO"]."</td>
<td>".$row["AA_BAL"]. '</td>
<td>
<form method="post" enctype="multipart/form-data" id="submitInstallment">
<input type="hidden" name="FORM_NAME" value="add_installment">';
if ($due_i > 0 && $_GET['type'] == "Loan") {
$due_amount = $due_i * $row["AA_INSTALLMENT"];
$due_amount = intval($due_amount);
$fine_amount = ($due_amount * 40) / 100;
$total_amount = $row["AA_INSTALLMENT"] + $fine_amount;
$total_rec = $row["AA_INSTALLMENT"] * 1;
echo '
<table class="table table-bordered">
<tr>
<td>
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO'].'">
<input type="hidden" name="ins_no" value="'.$due_i. '">
<small>Due Amount:</small>
<input type="text" id="due_amount" value="'.$due_amount. '" disabled style="width:50px;border:1px solid red">
<small>Installment Amount:</small>
<input type="text" id="inst_amount" value="' . $row['AA_INSTALLMENT'] . '" style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()">
<small>Total received:</small>
<input type="number" id="total_rec" value="'.$total_rec.'" style="width:50px;" onchange="calculateFine()" disabled>
</td>
</tr>
<tr>
<td>
<input type="hidden" id="hidden_total_rec" value="'.$total_rec.'" name="add_i" style="width:50px;" onchange="calculateFine()">
<small>Fine:</small>
<input type="number" id="fine" name="fine_amount" value="'.$fine_amount.'" min="0" style="width:50px;border:1px solid red" onchange="calculateFine()">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$total_amount. '" disabled style="width:50px;border:1px solid red">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">
</td>
</tr>
</table>';
} else
echo'
<input type="hidden" id="inst_amount" value="'.$row['AA_INSTALLMENT']. '">
<small>Amount:</small>
<input type="text" id="show_amount" value="'.$row['AA_INSTALLMENT']. '" disabled style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()">
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO']. '">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
<input type="hidden" id="hidden_total_amount" name="add_i" value="'.$row['AA_INSTALLMENT'].'">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">';
echo '</form></td></tr>';
}
} else {echo "Check A/C no.";};
$conn->close();
echo '</table></div>';
}
if(isset($_GET["no"]) && isset($_GET["type"])&&$_GET["type"]=="Recurring"){
echo '
<div class="container" style="margin-top: 10px;"> <h5>New Transaction : '.$GLOBALS['post_info'].' </h5><hr></div>
<div class="container table-responsive">
<table class="table table-striped table-bordered table-hover">
<tr>
<th>Name</th>
<th>Phone</th>
<th>AC No</th>
<th>Total Deposit</th>
<th>Installment</th>
<th>Receive Amount</th>
</tr>';
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_ACNO` = '".$_GET["no"]."' ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$date1 = date_create($row["AA_DATE"]);
$date2 = date_create(date("Y/m/d"));
$diff = date_diff($date1, $date2);
if ($row["AA_ACTYPE"] == 'D'){$diff = $diff->format("%a"); $diff=(int)$diff;$due_i=$diff-$row["AA_NO_OF_PAYPAID"];} else {$diff=$diff->format("%m"); $diff=(int)$diff;$due_i=$diff-$row["AA_NO_OF_PAYPAID"];}
//$ID=$row["GC_ID"];
$CURRENT_RECURRING_BALANCE = $row["AA_BAL"];
echo "
<tr>
<td>".$row["AA_NAME"]. "</td>
<td>".$row["AA_PHONE"]. "</td>
<td>".$row["AA_ACNO"]."</td>
<td>".$row["AA_BAL"]. "</td>
<td>".$row["AA_INSTALLMENT"]. '</td>
<td>
<form method="post" enctype="multipart/form-data" id="submitInstallment">
<input type="hidden" name="FORM_NAME" value="add_installment">';
if ($due_i > 0 && $_GET['type'] == "Recurring") {
$due_amount = $due_i * $row["AA_INSTALLMENT"];
$due_amount = intval($due_amount);
$fine_amount = ($due_amount * 20) / 100;
$total_amount = $row["AA_INSTALLMENT"] + $fine_amount;
$total_rec = $row["AA_INSTALLMENT"] * 1;
echo '
<table class="table table-bordered">
<tr>
<td>
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO'].'">
<input type="hidden" name="ins_no" value="'.$due_i. '">
<small>Due Amount:</small>
<input type="text" id="due_amount" value="'.$due_amount. '" disabled style="width:50px;border:1px solid red">
<small>Installment Amount:</small>
<input type="text" id="inst_amount" value="' . $row['AA_INSTALLMENT'] . '" style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateFine()">
<small>Total received:</small>
<input type="number" id="total_rec" value="'.$total_rec.'" style="width:50px;" onchange="calculateFine()" disabled>
</td>
</tr>
<tr>
<td>
<input type="hidden" id="hidden_total_rec" value="'.$total_rec.'" name="add_i" style="width:50px;" onchange="calculateFine()">
<small>Fine:</small>
<input type="number" id="fine" name="fine_amount" value="'.$fine_amount.'" min="0" style="width:50px;border:1px solid red" onchange="calculateFine()">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$total_amount. '" disabled style="width:50px;border:1px solid red">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">
</td>
</tr>
</table>';
} else
echo '
<input type="hidden" id="inst_amount" value="'.$row['AA_INSTALLMENT']. '">
<small>Amount:</small>
<input type="text" id="show_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
<small>No:</small>
<input type="number" id="inst_no" value="1" min="1" style="width:50px;" onchange="calculateAmount()">
<input type="hidden" name="AA_ACNO" value="'.$row['AA_ACNO']. '">
<small>Total:</small>
<input type="text" id="total_amount" value="'.$row['AA_INSTALLMENT'].'" disabled style="width:50px;">
<input type="hidden" id="hidden_total_amount" name="add_i" value="'.$row['AA_INSTALLMENT'].'">
<input type="submit" class="btn-info" value="Receive" onclick="sendData(event)">';
echo '</form></td></tr>';
}
} else {echo "Check A/C no.";};
$conn->close();
echo '</table></div>';
}
?>
<?php
if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") {
if (
$_SERVER['REQUEST_METHOD'] === 'POST'
&& isset($_POST['PAY_LOAN_EMI_FROM_RECURRING'], $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'], $_POST['DEDUCT_LOAN_AMOUNT'])
&& $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'] === 'axakassaoxnnxsaoij34866'
) {
$loanEMIAmount = floatval($_POST['DEDUCT_LOAN_AMOUNT']);
$deductAmount = -$loanEMIAmount; // negative for recurring deduction
$paidToLoanAccountNumber = $_POST['LOAN_AC_NUMBER'];
$accountId = $_GET['no'];
if (!$accountId) {
echo "Account number missing";
exit;
}
// ✅ DB connection
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// ✅ Check recurring balance first
$sql = "SELECT AA_BAL FROM `" . $GLOBALS['arif_ac'] . "` WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $accountId);
$stmt->execute();
$stmt->bind_result($CURRENT_RECURRING_BALANCE);
$stmt->fetch();
$stmt->close();
if ($loanEMIAmount > $CURRENT_RECURRING_BALANCE) {
echo "<div class='container' style=' background-color: #f8d7da; color: #721c24; padding: 12px 20px; border: 1px solid #f5c6cb; border-radius: 5px; font-family: Arial, sans-serif; font-size: 15px; margin: 10px auto; position: relative;'>
<strong>Error!</strong> Insufficient balance in Recurring account.
<span style=\" position: absolute; top: 8px; right: 12px; color: #721c24; font-weight: bold; cursor: pointer; \" onclick=\"this.parentElement.style.display='none';\">&times;</span>
</div>";
exit;
}
// ✅ Begin transaction for atomicity
$conn->begin_transaction();
try {
$table = $GLOBALS['arif_tran'] ?? 'arif_tran';
$userType = 'admin';
// Entry 1: Deduction from recurring
$remarksText1 = "₹$loanEMIAmount deducted from Recurring for Loan A/c $paidToLoanAccountNumber EMI";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $accountId, $deductAmount, $remarksText1);
$stmt->execute();
$stmt->close();
// Entry 2: Credit to loan account
$remarksText2 = "₹$loanEMIAmount credited to Loan A/c $paidToLoanAccountNumber EMI (from Recurring $accountId)";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $paidToLoanAccountNumber, $loanEMIAmount, $remarksText2);
$stmt->execute();
$stmt->close();
// Update Loan Account
$ins_no = 1;
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` + ?, `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID` + ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("dis", $loanEMIAmount, $ins_no, $paidToLoanAccountNumber);
$stmt->execute();
$stmt->close();
// Update Recurring Account
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` - ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ds", $loanEMIAmount, $accountId);
$stmt->execute();
$stmt->close();
// ✅ Commit if everything ok
$conn->commit();
echo "<div class='container' style=' background-color: #d4edda; color: #155724; padding: 12px 20px; border: 1px solid #c3e6cb; border-radius: 5px; font-family: Arial, sans-serif; font-size: 15px; margin: 10px auto; position: relative;'>
<strong>Success!</strong> Loan EMI paid successfully!
<span style=\" position: absolute; top: 8px; right: 12px; color: #155724; font-weight: bold; cursor: pointer; \" onclick=\"this.parentElement.style.display='none';\">&times;</span>
</div>";
} catch (Exception $e) {
$conn->rollback();
echo "Error processing EMI payment: " . $e->getMessage();
}
$conn->close();
}
}
?>
<?php if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") { ?>
<div class="container">
<h4>Pay Loan EMI from Recurring balance</h4>
<div style="display: flex; gap: 20px; flex-direction: row; max-width: 60%;">
<input class="form-control" type="text" id="acno" placeholder="Enter Account No" />
<button class="btn btn-primary" onclick="getAccountDetails()">Get Details</button>
</div>
<form id="PAY_LOAN_RECURRING_FORM" method="post" style="display: none; gap: 20px; flex-direction: column; max-width: 60%; margin-top: 30px;">
<input type="hidden" name="PAY_LOAN_EMI_FROM_RECURRING" value="1">
<input type="hidden" name="PAY_LOAN_EMI_FROM_RECURRING_ID" value="axakassaoxnnxsaoij34866">
<div>
<label for="ACCOUNT_HOLDER_NAME">Account holder Name:</label>
<input class="form-control" id="ACCOUNT_HOLDER_NAME" name="ACCOUNT_HOLDER_NAME" type="text" readOnly />
</div>
<div>
<label for="ACCOUNT_HOLDER_NAME">Recurring Balance:</label>
<input class="form-control" id="ACCOUNT_HOLDER_NAME" name="ACCOUNT_HOLDER_NAME" type="text" value="<?= $CURRENT_RECURRING_BALANCE ?>" readOnly />
</div>
<div>
<label for="LOAN_AC_NUMBER">Loan Account Number:</label>
<input class="form-control" id="LOAN_AC_NUMBER" name="LOAN_AC_NUMBER" type="text" required readOnly />
</div>
<div>
<label for="DEDUCT_LOAN_AMOUNT">Deduct Loan Amount:</label>
<input class="form-control" id="DEDUCT_LOAN_AMOUNT" name="DEDUCT_LOAN_AMOUNT" type="number" required />
</div>
<div style="">
<input class="btn btn-success" type="submit" value="Deduct & Pay Now" />
</div>
</form>
</div>
<?php } ?>
<div class="container" style="margin-top: 70px;">
<div class="row">
<div class="col-md-2">
<h5>Past Transactions::::</h5>
</div>
<div class="col-md-2">
<button class="btn btn-success" onclick="window.location.reload()">Refresh</button>
</div>
</div><hr>
</div>
<?php
if(isset($_GET["no"])){
echo '
<div class="container table-responsive">
<table class="table table-striped table-bordered table-hover">
<tr>
<th>SL</th>
<th>Tr No</th>
<th>TimeStamp</th>
<th>User</th>
<th>A/C No</th>
<th>Amount</th>
</tr>';
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
// $sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` WHERE `AT_ACID` = '".$_GET['no']."'";
$sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` WHERE `AT_ACID` = '".$_GET['no']."' ORDER BY `".$GLOBALS['arif_tran']."`.`AT_ID` DESC";
$result = $conn->query($sql);
$rowcount=mysqli_num_rows($result);//$rowcount++;
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>".$kolkataTime. "</td>
<td>".$row["AT_ADMIN"]. "</td>
<td>".$row["AT_ACID"]. "</td>
<td>".$row["AT_AMOUNT"]. "</td>
</tr>";
$rowcount--;
}
} else echo "No Past record Found";
mysqli_free_result($result);$conn->close();
echo '</table></div>';
}
?>
<script>
function getAccountDetails() {
let acno = document.getElementById("acno").value;
fetch("/exe/get-loan-details/", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: "AA_ACNO=" + encodeURIComponent(acno)
})
.then(res => res.json())
.then(data => {
document.getElementById('PAY_LOAN_RECURRING_FORM').style.display = 'flex';
console.log(data.data[0].AA_ACNO);
document.getElementById('LOAN_AC_NUMBER').value = data.data[0].AA_ACNO;
document.getElementById('DEDUCT_LOAN_AMOUNT').value = data.data[0].AA_INSTALLMENT;
document.getElementById('ACCOUNT_HOLDER_NAME').value = data.data[0].AA_NAME;
document.getElementById('INSTALLMENT_NUMBER').value = data.data[0].AA_BAL / data.data[0].AA_INSTALLMENT;
if(data.status === "Success"){
// Example: show first record
console.log("Account Holder: " + data.data[0].AA_NAME + "\nBalance: " + data.data[0].AA_BAL);
} else {
alert(data.statusmsg);
}
})
.catch(err => console.error("Error:", err));
}
var submitInstallment = document.getElementById("submitInstallment");
function sendData(event) {
event.preventDefault();
var XHR = new XMLHttpRequest();
var FD = new FormData(submitInstallment);
XHR.addEventListener("load", function (event) {
var obj = JSON.parse(event.target.responseText);
// console.log(obj);
alert(obj.statusmsg);
// window.location.reload(true);
window.history.back();
});
XHR.addEventListener("error", function () {
alert('Error', 'Ooops!! Something went wrong.');
});
console.log(FD);
XHR.open("POST", "/exe/receive_amount/");
XHR.send(FD);
}
function addACNumberToField(){
document.getElementById('LOAN_ACC_NUMBER').value = document.getElementById('LOAN_AC_NUMBER').value;
}
</script>
<!-- GVD20210607R519 -->

View File

@@ -0,0 +1,114 @@
<?php
// ---- Default date range ----
$today = date("Y-m-d");
$monthStart = date("Y-m-01");
$monthEnd = date("Y-m-t"); // Gets last day of current month
$dFrom = $_GET['dFrom'] ?? $monthStart;
$dTo = $_GET['dTo'] ?? $monthEnd;
?>
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Maturity 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>
<?php
function maturity_report($dateFrom, $dateTo) {
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Maturity 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);
// ---- Fetch matured accounts ----
$sql = "SELECT * FROM ".$GLOBALS['arif_ac']."
WHERE DATE_FORMAT(AA_DATE_MATURE, '%Y-%m-%d')
BETWEEN '".$dateFrom."' AND '".$dateTo."'
AND AA_TYPE = 'Recurring'
ORDER BY AA_DATE_MATURE ASC";
$result = $conn->query($sql);
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>AC No</th>
<th>Name</th>
<th>Type</th>
<th>Total Installments</th>
<th>Paid</th>
<th>Pending</th>
<th>Mature Value</th>
<th>Maturity Date</th>
</tr>
</thead>
<tbody>';
$grandTotal = 0;
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
// Installment calculation
$paid_installments = floor($row['AA_BAL'] / $row['AA_INSTALLMENT']);
$pending_installments = $row['AA_NO_OF_PAYMENT'] - $paid_installments;
// ✅ Show only fully paid accounts
if ($pending_installments == 0 && $paid_installments == $row['AA_NO_OF_PAYMENT']) {
$payout = $row['AA_MATURE_VALUE'];
$grandTotal += $payout;
echo "
<tr>
<td>".$row['AA_ACNO']."</td>
<td>".$row['AA_NAME']."</td>
<td>".$row['AA_ACTYPE']."</td>
<td>".$row['AA_NO_OF_PAYMENT']."</td>
<td>".$paid_installments."</td>
<td>".$pending_installments."</td>
<td>".number_format($payout,2)."</td>
<td>".$row['AA_DATE_MATURE']."</td>
</tr>";
}
}
} else {
echo "<tr><td colspan='8' class='text-center text-muted'>No matured accounts found</td></tr>";
}
echo '
</tbody>
</table>
<h5 class="text-end">Grand Total Payout: <b>'.number_format($grandTotal,2).'</b></h5>
</div>
</div>
</div>
';
$conn->close();
}
// ---- Call maturity function ----
maturity_report($dFrom, $dTo);
?>

View File

@@ -9,7 +9,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/new_logo2.jpg" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>

View File

@@ -14,7 +14,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/new_logo2.jpg" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>

View File

@@ -1,3 +1,6 @@
<?php
date_default_timezone_set('Asia/Kolkata');
?>
<style>
.agent-body {
margin: 0;
@@ -11,7 +14,7 @@
.agent-header {
background: #e95420;
color: #fff;
padding: 30px 15px 12px 15px;
padding: 35px 15px 15px 15px;
display: flex;
justify-content: space-between;
align-items: center;
@@ -25,12 +28,25 @@
}
.agent-header-title {
margin: 0;
display: flex;
align-items: center;
gap: 10px;
}
.agent-header-title img {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #fff;
}
.agent-header-logout {
display: flex;
flex-direction: column;
align-items: center;
background: transparent;
border: none;
color: #fff;
font-size: 16px;
font-size: 8px;
cursor: pointer;
}
@@ -41,17 +57,30 @@
left: 0;
right: 0;
height: 55px;
margin-bottom: 50px; /*important for bottom nav in mobile */
background: #e95420;
display: flex;
justify-content: space-around;
align-items: center;
border-top: 1px solid rgba(255,255,255,0.2);
z-index: 999;
/* border-top: 1px solid rgba(10, 10, 10, 1);
z-index: 999; */
}
/* important for bottom nav in mobile */
.agent-bottom-nav::after {
content: "";
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 50px;
background: black;
z-index: -1;
}
.agent-bottom-link {
color: #fff;
text-align: center;
font-size: 14px;
font-size: 12px;
text-decoration: none;
flex: 1;
padding: 5px 0;
@@ -71,42 +100,75 @@
<!-- Top Header -->
<div class="agent-header">
<div class="agent-header-title">Agent Panel</div>
<div class="agent-header-title">
<?php
if (!empty($_SESSION['profile_pic'])) {
$profilePicPath = '/CONTENT/ROOT_URI/Admin/' . $_SESSION['profile_pic'];
echo '<img src="' . htmlspecialchars($profilePicPath) . '" style="width: 35px; height: 35px; border-radius:50%; object-fit:cover;" alt="Profile" onerror="this.style.display=\'none\'; this.nextElementSibling.style.display=\'block\'" />';
// SVG fallback (initially hidden)
echo '<svg style="border-radius:50%; object-fit:cover; border: 1px solid #ffffff; display: none;" class="img-responsive" version="1.1" width="28px" height="28px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="#ffffff" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="#ffffff" d="M628.736 528.896A416 416 0 0 1 928 928H96a415.872 415.872 0 0 1 299.264-399.104L512 704l116.736-175.104zM720 304a208 208 0 1 1-416 0 208 208 0 0 1 416 0z"></path></g></svg>';
} else {
echo '<svg style="border-radius:50%; object-fit:cover; border: 1px solid #ffffff;" class="img-responsive" version="1.1" width="28px" height="28px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="#ffffff" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="#ffffff" d="M628.736 528.896A416 416 0 0 1 928 928H96a415.872 415.872 0 0 1 299.264-399.104L512 704l116.736-175.104zM720 304a208 208 0 1 1-416 0 208 208 0 0 1 416 0z"></path></g></svg>';
}
?>
<span>Agent Panel</span>
</div>
<?php if(isset($_SESSION) && !empty($_SESSION['user_id'])){ ?>
<button onclick="window.location.href='/Agent/logout'" class="agent-header-logout">Logout</button>
<button onclick="window.location.href='/Agent/logout'" class="agent-header-logout">
<svg width="22px" height="22px" viewBox="0 -0.5 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M11.75 9.874C11.75 10.2882 12.0858 10.624 12.5 10.624C12.9142 10.624 13.25 10.2882 13.25 9.874H11.75ZM13.25 4C13.25 3.58579 12.9142 3.25 12.5 3.25C12.0858 3.25 11.75 3.58579 11.75 4H13.25ZM9.81082 6.66156C10.1878 6.48991 10.3542 6.04515 10.1826 5.66818C10.0109 5.29121 9.56615 5.12478 9.18918 5.29644L9.81082 6.66156ZM5.5 12.16L4.7499 12.1561L4.75005 12.1687L5.5 12.16ZM12.5 19L12.5086 18.25C12.5029 18.25 12.4971 18.25 12.4914 18.25L12.5 19ZM19.5 12.16L20.2501 12.1687L20.25 12.1561L19.5 12.16ZM15.8108 5.29644C15.4338 5.12478 14.9891 5.29121 14.8174 5.66818C14.6458 6.04515 14.8122 6.48991 15.1892 6.66156L15.8108 5.29644ZM13.25 9.874V4H11.75V9.874H13.25ZM9.18918 5.29644C6.49843 6.52171 4.7655 9.19951 4.75001 12.1561L6.24999 12.1639C6.26242 9.79237 7.65246 7.6444 9.81082 6.66156L9.18918 5.29644ZM4.75005 12.1687C4.79935 16.4046 8.27278 19.7986 12.5086 19.75L12.4914 18.25C9.08384 18.2892 6.28961 15.5588 6.24995 12.1513L4.75005 12.1687ZM12.4914 19.75C16.7272 19.7986 20.2007 16.4046 20.2499 12.1687L18.7501 12.1513C18.7104 15.5588 15.9162 18.2892 12.5086 18.25L12.4914 19.75ZM20.25 12.1561C20.2345 9.19951 18.5016 6.52171 15.8108 5.29644L15.1892 6.66156C17.3475 7.6444 18.7376 9.79237 18.75 12.1639L20.25 12.1561Z" fill="currentColor"></path> </g></svg>
<span>Logout</span>
</button>
<?php } ?>
</div>
<!-- Some content -->
<div style="margin-top:20px; padding:15px;">
<!-- Dashboard Content -->
</div>
<div style="margin-top:80px; padding:15px;"></div>
<!-- Bottom Navigation -->
<?php if(isset($_SESSION) && !empty($_SESSION['user_id'])){ ?>
<div class="agent-bottom-nav">
<a href="/Agent/Dashboard" class="agent-bottom-link active">
<i class="fa-solid fa-house"></i>
Home
</a>
<a href="/Agent/report" class="agent-bottom-link">
<i class="fa-solid fa-chart-line"></i>
Reports
</a>
<a href="/Agent/Receive" class="agent-bottom-link" style="">
<i class="fa-solid fa-plus"></i>
Payment
</a>
<a href="/Agent/transaction" class="agent-bottom-link">
<i class="fa-solid fa-money-check-dollar"></i>
Transaction
</a>
<!-- <a href="javascript:void(0)" onclick="window.location.reload();" class="agent-bottom-link">
<i class="fa-solid fa-rotate-right"></i>
Reload
</a> -->
<a href="/Agent/Dashboard" class="agent-bottom-link <?php echo ($current_page == 'Dashboard' || $current_page == 'Agent') ? 'active' : ''; ?>" data-page="Dashboard"><i class="fa-solid fa-house"></i> Home</a>
<a href="/Agent/report" class="agent-bottom-link <?php echo ($current_page == 'report') ? 'active' : ''; ?>" data-page="report"><i class="fa-solid fa-chart-line"></i> Reports</a>
<a href="/Agent/Receive" class="agent-bottom-link <?php echo ($current_page == 'Receive') ? 'active' : ''; ?>" data-page="Receive"><i class="fa-solid fa-plus"></i> Payment</a>
<!-- <a href="/Agent/commission" class="agent-bottom-link"><i class="fa-solid fa-plus"></i> Commission</a> -->
<a href="/Agent/transaction" class="agent-bottom-link <?php echo ($current_page == 'transaction') ? 'active' : ''; ?>" data-page="transaction"><i class="fa-solid fa-money-check-dollar"></i> Transaction</a>
</div>
<?php } ?>
</div>
</div>
<script>
// Function to set active state based on current page
function setActiveNavLink() {
// Get all navigation links
const navLinks = document.querySelectorAll('.agent-bottom-link');
// Get current page from URL
const currentPage = window.location.pathname.split('/').pop() || 'Dashboard';
// Remove active class from all links
navLinks.forEach(link => {
link.classList.remove('active');
// Get the page identifier from data attribute or href
const linkPage = link.getAttribute('data-page') || link.getAttribute('href').split('/').pop();
// Add active class if matches current page
if (linkPage === currentPage) {
link.classList.add('active');
}
});
}
// Set active nav link on page load
document.addEventListener('DOMContentLoaded', setActiveNavLink);
// Also set active state when navigating (optional)
document.querySelectorAll('.agent-bottom-link').forEach(link => {
link.addEventListener('click', function() {
document.querySelectorAll('.agent-bottom-link').forEach(l => l.classList.remove('active'));
this.classList.add('active');
});
});
</script>

View File

@@ -0,0 +1,339 @@
<?php
session_start();
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$today = date("Y-m-d");
$userId = $_SESSION['user_id'];
$message = "";
/* ---------------- Loan & Recurring Transactions (Today) ---------------- */
$sqlLoan = "SELECT SUM(AT_AMOUNT) as total
FROM {$GLOBALS['arif_tran']}
WHERE AT_ADMIN = '$userId'
AND DATE(AT_TIMESTAMP) = '$today'
AND AT_ACID LIKE '%L%'";
$resLoan = $conn->query($sqlLoan);
$totalLoan = $resLoan->fetch_assoc()['total'] ?? 0;
$sqlRecurring = "SELECT SUM(AT_AMOUNT) as total
FROM {$GLOBALS['arif_tran']}
WHERE AT_ADMIN = '$userId'
AND DATE(AT_TIMESTAMP) = '$today'
AND AT_ACID LIKE '%R%'";
$resRecurring = $conn->query($sqlRecurring);
$totalRecurring = $resRecurring->fetch_assoc()['total'] ?? 0;
/* ---------------- Get Today's Target ---------------- */
$targetSql = "SELECT * FROM agent_collections WHERE agent = '$userId' AND date = '$today'";
$targetResult = $conn->query($targetSql);
$targetRows = $targetResult->fetch_all(MYSQLI_ASSOC);
$collectableLoan = $targetRows[0]['collectable_loan_amount'] ?? 0;
$collectableRecurring = $targetRows[0]['collectable_recurring_amount'] ?? 0;
$remainingLoan = max($collectableLoan - $totalLoan, 0);
$remainingRecurring = max($collectableRecurring - $totalRecurring, 0);
$loanPercent = $collectableLoan > 0 ? ($totalLoan / $collectableLoan) * 100 : 0;
$recurringPercent = $collectableRecurring > 0 ? ($totalRecurring / $collectableRecurring) * 100 : 0;
/* ---------------- Save Collection ---------------- */
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_collection'])) {
$rowId = intval($_POST['row_id']);
$collectedLoan = $totalLoan;
$collectedRecurring = $totalRecurring;
$stmt = $conn->prepare("UPDATE agent_collections
SET collected_loan_amount = ?, collected_recurring_amount = ?
WHERE id = ? AND agent = ? AND date = ?");
$stmt->bind_param("ddiss", $collectedLoan, $collectedRecurring, $rowId, $userId, $today);
if ($stmt->execute()) {
$message = "<p class='success-msg'>✅ Collection saved successfully!</p>";
} else {
$message = "<p class='error-msg'>❌ Failed to save collection!</p>";
}
$stmt->close();
}
/* ---------------- Last 10 Days Report ---------------- */
$repStmt = "SELECT * FROM agent_collections WHERE agent = '$userId' ORDER BY date DESC LIMIT 10";
$reportsStmt = $conn->query($repStmt);
$reportRows = $reportsStmt->fetch_all(MYSQLI_ASSOC);
$conn->close();
?>
<div class="container" style="margin-bottom: 105px;">
<h3 class="welcome-text">
Welcome, <?= htmlspecialchars($_SESSION['name']) ?> 👋
</h3>
<?= $message ?>
<div class="dashboard-total-section">
<!-- Loan Box -->
<div class="card-box highlight">
<h3>₹ <?= number_format($totalLoan, 2) ?></h3>
<p>Loan Collection</p>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $loanPercent ?>%;"></div>
</div>
<small><?= round($loanPercent, 2) ?>% Completed</small>
<div class="remaining-text">
Target: ₹ <?= number_format($collectableLoan, 2) ?> |
Remaining: ₹ <?= number_format($remainingLoan, 2) ?>
</div>
</div>
<!-- Recurring Box -->
<div class="card-box normal">
<h3>₹ <?= number_format($totalRecurring, 2) ?></h3>
<p>Recurring Collection</p>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $recurringPercent ?>%;"></div>
</div>
<small><?= round($recurringPercent, 2) ?>% Completed</small>
<div class="remaining-text">
Target: ₹ <?= number_format($collectableRecurring, 2) ?> |
Remaining: ₹ <?= number_format($remainingRecurring, 2) ?>
</div>
</div>
</div>
<!-- Buttons -->
<div style="display: flex; flex-direction: row; width: 100%; justify-content: space-between; margin-top: 20px;">
<a class="btn btn-primary w-100" href="/Agent/Receive">
<i class="fa-solid fa-credit-card"></i> Receive New Payment
</a>
<?php if (!empty($targetRows)) : ?>
<form method="post" class="w-100">
<input type="hidden" name="save_collection" value="1">
<input type="hidden" name="row_id" value="<?= $targetRows[0]['id'] ?>">
<button type="submit" class="btn btn-success w-100">
<i class="fa-solid fa-save"></i> Save Collection
</button>
</form>
<?php endif; ?>
</div>
<!-- Report Section -->
<?php if (!empty($reportRows)) : ?>
<div class="report-section">
<h4 class="report-title">📊 Last 10 Days Report</h4>
<div class="report-cards">
<?php foreach ($reportRows as $report): ?>
<?php
$loanPercentDone = $report['collectable_loan_amount'] > 0
? ($report['collected_loan_amount'] / $report['collectable_loan_amount']) * 100 : 0;
$recurringPercentDone = $report['collectable_recurring_amount'] > 0
? ($report['collected_recurring_amount'] / $report['collectable_recurring_amount']) * 100 : 0;
?>
<div class="report-card">
<div class="report-date">
<?= date("d M Y", strtotime($report['date'])) ?>
</div>
<div class="report-details">
<p><strong>Loan Target:</strong> ₹ <?= number_format($report['collectable_loan_amount'], 2) ?></p>
<p><strong>Loan Collected:</strong> ₹ <?= number_format($report['collected_loan_amount'], 2) ?></p>
<p><strong>Recurring Target:</strong> ₹ <?= number_format($report['collectable_recurring_amount'], 2) ?></p>
<p><strong>Recurring Collected:</strong> ₹ <?= number_format($report['collected_recurring_amount'], 2) ?></p>
</div>
<div class="report-progress">
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $loanPercentDone ?>%; background: #e95420;"></div>
</div>
<small>Loan: <?= round($loanPercentDone, 2) ?>% Completed</small>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $recurringPercentDone ?>%; background: #007bff;"></div>
</div>
<small>Recurring: <?= round($recurringPercentDone, 2) ?>% Completed</small>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<div class="android-links">
<a href="/Agent/commission">Commission</a>
</div>
</div>
<style>
.welcome-text {
font-size: 20px;
font-weight: 600;
margin-bottom: 15px;
}
.success-msg {
color: green;
background: #e6ffe6;
padding: 8px 12px;
border-radius: 6px;
margin-bottom: 15px;
}
.error-msg {
color: red;
background: #ffe6e6;
padding: 8px 12px;
border-radius: 6px;
margin-bottom: 15px;
}
.dashboard-total-section {
display: flex;
gap: 20px;
margin-top: 20px;
flex-wrap: wrap;
}
.card-box {
flex: 1;
min-width: 200px;
background: linear-gradient(135deg, #f0f0f0ff, #d3d3d3ff);
border-radius: 20px;
padding: 20px;
text-align: center;
box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.card-box.highlight {
background: linear-gradient(135deg, #e95420, #f37249);
color: #fff;
}
.progress-bar {
width: 100%;
height: 10px;
background: rgba(255, 255, 255, 0.3);
border-radius: 10px;
margin: 10px 0;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: #fff;
border-radius: 10px;
transition: width 0.4s ease;
}
.remaining-text {
margin-top: 8px;
font-size: 13px;
color: #333;
background: #f0f0f0;
display: inline-block;
padding: 4px 10px;
border-radius: 12px;
}
/* Report Section - Scroll Snap Slider */
.report-section {
margin-top: 30px;
}
.report-title {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
color: #333;
}
.report-cards {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
gap: 16px;
}
.report-card {
flex: 0 0 85%;
scroll-snap-align: center;
background: linear-gradient(135deg, #ecececff, #ffffffff);
border-radius: 16px;
padding: 16px;
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.report-date {
font-size: 14px;
font-weight: 500;
color: #666;
margin-bottom: 10px;
}
.report-details p {
margin: 4px 0;
font-size: 14px;
color: #444;
}
.report-progress {
margin-top: 12px;
}
.report-card .progress-bar {
width: 100%;
height: 8px;
background: #eee;
border-radius: 10px;
margin: 8px 0;
overflow: hidden;
}
.report-card .progress-fill {
height: 100%;
background: linear-gradient(135deg, #e95420, #f37249);
border-radius: 10px;
}
/* Report-cards horizontal scrollbar */
.report-cards {
scrollbar-width: thin; /* Firefox */
scrollbar-color: #f37249 rgba(0,0,0,0.04); /* Firefox */
}
/* --- WebKit browsers (Chrome, Edge, Safari) --- */
.report-cards::-webkit-scrollbar {
height: 8px; /* thin horizontal scrollbar */
}
.report-cards::-webkit-scrollbar-track {
background: rgba(0,0,0,0.08);
border-radius: 10px;
}
.report-cards::-webkit-scrollbar-thumb {
background: linear-gradient(90deg, #e95420, #f37249);
border-radius: 999px; /* ✅ fully rounded pill shape */
min-width: 30px;
}
/* Hover effect */
.report-cards::-webkit-scrollbar-thumb:hover {
background: linear-gradient(90deg, #d7461c, #e65f3c);
}
.android-links {
display: flex;
gap: 12px; /* বাটনের মাঝে ফাঁকা */
flex-wrap: wrap; /* ছোট স্ক্রিনে ভাঙবে */
margin-top: 20px;
}
.android-links a {
background: #e95420; /* বাটনের ব্যাকগ্রাউন্ড */
color: #fff; /* টেক্সট কালার */
text-decoration: none;
padding: 10px 20px;
border-radius: 25px; /* গোলাকার প্রান্ত */
font-size: 12px;
font-weight: 500;
box-shadow: 0 3px 8px rgba(0,0,0,0.2);
transition: all 0.25s ease;
}
.android-links a:hover {
background: #cf471c; /* hover হলে একটু গাঢ় */
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
</style>

View File

@@ -1,15 +1,9 @@
<?php
if(!isset($_SESSION) && empty($_SESSION['user_id'])){
session_start();
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
function getTotalAmount(array $rows): float {
// array_column diye sudhu AT_AMOUNT gulo niye ashbo
$amounts = array_column($rows, 'AT_AMOUNT');
// jodi kono data na thake tahole 0 return hobe
return array_sum($amounts);
}
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
@@ -17,90 +11,330 @@ if ($conn->connect_error) {
}
$today = date("Y-m-d");
$userId = $_SESSION['user_id'];
$message = "";
// query
$sql = "SELECT * FROM {$GLOBALS['arif_tran']} WHERE AT_ADMIN = '{$_SESSION['user_id']}' AND DATE(AT_TIMESTAMP) = '$today'";
/* ---------------- Loan & Recurring Transactions (Today) ---------------- */
$sqlLoan = "SELECT SUM(AT_AMOUNT) as total
FROM {$GLOBALS['arif_tran']}
WHERE AT_ADMIN = '$userId'
AND DATE(AT_TIMESTAMP) = '$today'
AND AT_ACID LIKE '%L%'";
$resLoan = $conn->query($sqlLoan);
$totalLoan = $resLoan->fetch_assoc()['total'] ?? 0;
$result = $conn->query($sql);
$sqlRecurring = "SELECT SUM(AT_AMOUNT) as total
FROM {$GLOBALS['arif_tran']}
WHERE AT_ADMIN = '$userId'
AND DATE(AT_TIMESTAMP) = '$today'
AND AT_ACID LIKE '%R%'";
$resRecurring = $conn->query($sqlRecurring);
$totalRecurring = $resRecurring->fetch_assoc()['total'] ?? 0;
// direct fetch_all
$rows = $result ? $result->fetch_all(MYSQLI_ASSOC) : [];
$totalAmount = getTotalAmount($rows);
// var_dump($rows); // ekhane pura array peye jabe
/* ---------------- Get Today's Target ---------------- */
$targetSql = "SELECT * FROM agent_collections WHERE agent = '$userId' AND date = '$today'";
$targetResult = $conn->query($targetSql);
$targetRows = $targetResult->fetch_all(MYSQLI_ASSOC);
$collectableLoan = $targetRows[0]['collectable_loan_amount'] ?? 0;
$collectableRecurring = $targetRows[0]['collectable_recurring_amount'] ?? 0;
$remainingLoan = max($collectableLoan - $totalLoan, 0);
$remainingRecurring = max($collectableRecurring - $totalRecurring, 0);
$loanPercent = $collectableLoan > 0 ? ($totalLoan / $collectableLoan) * 100 : 0;
$recurringPercent = $collectableRecurring > 0 ? ($totalRecurring / $collectableRecurring) * 100 : 0;
/* ---------------- Save Collection ---------------- */
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_collection'])) {
$rowId = intval($_POST['row_id']);
$collectedLoan = $totalLoan;
$collectedRecurring = $totalRecurring;
$stmt = $conn->prepare("UPDATE agent_collections
SET collected_loan_amount = ?, collected_recurring_amount = ?
WHERE id = ? AND agent = ? AND date = ?");
$stmt->bind_param("ddiss", $collectedLoan, $collectedRecurring, $rowId, $userId, $today);
if ($stmt->execute()) {
$message = "<p class='success-msg'>✅ Collection saved successfully!</p>";
} else {
$message = "<p class='error-msg'>❌ Failed to save collection!</p>";
}
$stmt->close();
}
/* ---------------- Last 10 Days Report ---------------- */
$repStmt = "SELECT * FROM agent_collections WHERE agent = '$userId' ORDER BY date DESC LIMIT 10";
$reportsStmt = $conn->query($repStmt);
$reportRows = $reportsStmt->fetch_all(MYSQLI_ASSOC);
$conn->close();
// var_dump($_SESSION);
?>
<div class="container">
<h3 style="font-size: 20px; font-weight: 600; margin-bottom: 15px;">
Welcome, <?= $_SESSION['name'] ?> 👋
<div class="container" style="margin-bottom: 105px;">
<h3 class="welcome-text">
Welcome, <?= htmlspecialchars($_SESSION['name']) ?> 👋
</h3>
<?= $message ?>
<div class="dashboard-total-section">
<!-- Total Collection Card -->
<!-- Loan Box -->
<div class="card-box highlight">
<h3><?= $totalAmount ?></h3>
<p>Total Collection</p>
<h3><?= number_format($totalLoan, 2) ?></h3>
<p>Loan Collection</p>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $loanPercent ?>%;"></div>
</div>
<p style="font-size: 18px; font-weight: bold;"><?= round($loanPercent, 2) ?>% Completed</p>
<div class="remaining-text">
Target: ₹ <?= number_format($collectableLoan, 2) ?> |
Remaining: ₹ <?= number_format($remainingLoan, 2) ?>
</div>
</div>
<!-- Loan & Recurring Card -->
<!-- Recurring Box -->
<div class="card-box normal">
<!-- <p><strong>Loan:</strong> <?= $totalLoan ?? 0 ?></p>
<p><strong>Recurring:</strong> <?= $totalRecurring ?? 0 ?></p> -->
<h3>₹ <?= number_format($totalRecurring, 2) ?></h3>
<p>Recurring Collection</p>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $recurringPercent ?>%;"></div>
</div>
<p style="font-size: 18px; font-weight: bold;"><?= round($recurringPercent, 2) ?>% Completed</p>
<div class="remaining-text">
Target: ₹ <?= number_format($collectableRecurring, 2) ?> |
Remaining: ₹ <?= number_format($remainingRecurring, 2) ?>
</div>
</div>
</div>
<a class="btn btn-primary w-100" href="/Agent/Receive" style="width: 100%; margin-top: 20px;">
<i class="fa-solid fa-credit-card"></i>
Recive New Payment
</a>
</div>
<!-- Buttons -->
<div style="display: flex; flex-direction: row; width: 100%; justify-content: space-between; margin-top: 20px;">
<a class="btn btn-primary w-100" href="/Agent/Receive">
<i class="fa-solid fa-credit-card"></i> Receive New Payment
</a>
<?php if (!empty($targetRows)) : ?>
<form method="post" class="w-100">
<input type="hidden" name="save_collection" value="1">
<input type="hidden" name="row_id" value="<?= $targetRows[0]['id'] ?>">
<button type="submit" class="btn btn-success w-100">
<i class="fa-solid fa-save"></i> Save Collection
</button>
</form>
<?php endif; ?>
</div>
<!-- Report Section -->
<?php if (!empty($reportRows)) : ?>
<div class="report-section">
<h4 class="report-title">📊 Last 10 Days Report</h4>
<div class="report-cards">
<?php foreach ($reportRows as $report): ?>
<?php
$loanPercentDone = $report['collectable_loan_amount'] > 0
? ($report['collected_loan_amount'] / $report['collectable_loan_amount']) * 100 : 0;
$recurringPercentDone = $report['collectable_recurring_amount'] > 0
? ($report['collected_recurring_amount'] / $report['collectable_recurring_amount']) * 100 : 0;
?>
<div class="report-card">
<div class="report-date">
<?= date("d M Y", strtotime($report['date'])) ?>
</div>
<div class="report-details">
<p><strong>Loan Target:</strong> ₹ <?= number_format($report['collectable_loan_amount'], 2) ?></p>
<p><strong>Loan Collected:</strong> ₹ <?= number_format($report['collected_loan_amount'], 2) ?></p>
<p><strong>Recurring Target:</strong> ₹ <?= number_format($report['collectable_recurring_amount'], 2) ?></p>
<p><strong>Recurring Collected:</strong> ₹ <?= number_format($report['collected_recurring_amount'], 2) ?></p>
</div>
<div class="report-progress">
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $loanPercentDone ?>%; background: #e95420;"></div>
</div>
<small>Loan: <?= round($loanPercentDone, 2) ?>% Completed</small>
<div class="progress-bar">
<div class="progress-fill" style="width: <?= $recurringPercentDone ?>%; background: #007bff;"></div>
</div>
<small>Recurring: <?= round($recurringPercentDone, 2) ?>% Completed</small>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<div class="android-links">
<a href="/Agent/commission">Commission</a>
</div>
</div>
<style>
.welcome-text {
font-size: 20px;
font-weight: 600;
margin-bottom: 15px;
}
.success-msg {
color: green;
background: #e6ffe6;
padding: 8px 12px;
border-radius: 6px;
margin-bottom: 15px;
}
.error-msg {
color: red;
background: #ffe6e6;
padding: 8px 12px;
border-radius: 6px;
margin-bottom: 15px;
}
.dashboard-total-section {
display: flex;
gap: 20px;
margin-top: 20px;
flex-wrap: wrap;
}
.card-box {
flex: 1;
min-width: 180px;
background: #fff;
border-radius: 16px;
padding: 20px;
min-width: 200px;
background: linear-gradient(135deg, #f0f0f0ff, #d3d3d3ff);
border-radius: 20px;
padding: 15px;
text-align: center;
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
transition: transform 0.2s ease, box-shadow 0.2s ease;
box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.card-box:hover {
transform: translateY(-5px);
box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.card-box h3 {
margin: 0;
font-size: 28px;
font-weight: bold;
color: #222;
}
.card-box p {
margin: 5px 0 0;
font-size: 14px;
color: #555;
}
.card-box.highlight {
background: #e95420;
background: linear-gradient(135deg, #e95420, #f37249);
color: #fff;
}
.progress-bar {
width: 100%;
height: 10px;
background: rgba(255, 255, 255, 0.3);
border-radius: 10px;
margin: 10px 0;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: #fff;
border-radius: 10px;
transition: width 0.4s ease;
}
.remaining-text {
margin-top: 4px;
font-size: 18px;
font-weight: bold;
color: #333;
background: #f0f0f0;
display: inline-block;
padding: 4px 10px;
border-radius: 12px;
}
.card-box.highlight h3,
.card-box.highlight p {
color: #fff;
/* Report Section - Scroll Snap Slider */
.report-section {
margin-top: 30px;
}
.report-title {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
color: #333;
}
.report-cards {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
gap: 16px;
}
.report-card {
flex: 0 0 85%;
scroll-snap-align: center;
background: linear-gradient(135deg, #ecececff, #ffffffff);
border-radius: 16px;
padding: 16px;
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.report-date {
font-size: 14px;
font-weight: 500;
color: #666;
margin-bottom: 10px;
}
.report-details p {
margin: 4px 0;
font-size: 14px;
color: #444;
}
.report-progress {
margin-top: 12px;
}
.report-card .progress-bar {
width: 100%;
height: 8px;
background: #eee;
border-radius: 10px;
margin: 8px 0;
overflow: hidden;
}
.report-card .progress-fill {
height: 100%;
background: linear-gradient(135deg, #e95420, #f37249);
border-radius: 10px;
}
/* Report-cards horizontal scrollbar */
.report-cards {
scrollbar-width: thin; /* Firefox */
scrollbar-color: #f37249 rgba(0,0,0,0.04); /* Firefox */
}
/* --- WebKit browsers (Chrome, Edge, Safari) --- */
.report-cards::-webkit-scrollbar {
height: 8px; /* thin horizontal scrollbar */
}
.report-cards::-webkit-scrollbar-track {
background: rgba(0,0,0,0.08);
border-radius: 10px;
}
.report-cards::-webkit-scrollbar-thumb {
background: linear-gradient(90deg, #e95420, #f37249);
border-radius: 999px; /* ✅ fully rounded pill shape */
min-width: 30px;
}
/* Hover effect */
.report-cards::-webkit-scrollbar-thumb:hover {
background: linear-gradient(90deg, #d7461c, #e65f3c);
}
.android-links {
display: flex;
gap: 12px; /* বাটনের মাঝে ফাঁকা */
flex-wrap: wrap; /* ছোট স্ক্রিনে ভাঙবে */
margin-top: 20px;
}
.android-links a {
background: #e95420; /* বাটনের ব্যাকগ্রাউন্ড */
color: #fff; /* টেক্সট কালার */
text-decoration: none;
padding: 10px 20px;
border-radius: 25px; /* গোলাকার প্রান্ত */
font-size: 12px;
font-weight: 500;
box-shadow: 0 3px 8px rgba(0,0,0,0.2);
transition: all 0.25s ease;
}
.android-links a:hover {
background: #cf471c; /* hover হলে একটু গাঢ় */
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
</style>

View File

@@ -1,10 +1,10 @@
<?php
if(!isset($_SESSION) && empty($_SESSION['user_id'])){
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
?>
<div class="container">
<div class="container" style="margin-bottom: 105px;">
<h3 class="">New Payment</h3>
<div style="display: flex; gap: 20px; flex-direction: row;">
<input class="form-control" type="text" id="acno" placeholder="Enter Account No" />
@@ -26,10 +26,11 @@
<label for="INSTALLMENT_AMOUNT">Amount: </label>
<input id="INSTALLMENT_AMOUNT" name="add_i" class="form-control" type="text" placeholder="" />
</div>
<input id="ALLOW_MULTIPLE_FLAG" type="hidden" name="allowMultiple" value="">
<input class="btn btn-primary" type="submit" value="Receive Now" style="margin-top: 20px;" />
</form>
</div>
<!-- GVW20250722L1718 -->
<script>
function showMessage(msg, type = "success") {
let box = document.getElementById("userMessage");
@@ -67,6 +68,12 @@
document.getElementById("PAYMENT_RECEIVE_FORM").style.display = "block";
document.getElementById("ACCOUNT_NUMBER").value = data.data[0].AA_ACNO;
document.getElementById("ACCOUNT_HOLDER_NAME").value = data.data[0].AA_NAME;
document.getElementById("ALLOW_MULTIPLE_FLAG").value = data.data[0].allowMultiple;
const input = document.getElementById("INSTALLMENT_AMOUNT");
input && Number(data.data[0].allowMultiple) === 0 ? input.readOnly = true : input.readOnly = false;
document.getElementById("INSTALLMENT_AMOUNT").value = data.data[0].AA_INSTALLMENT;
showMessage("Account found: " + data.data[0].AA_NAME, "success");

View File

@@ -21,7 +21,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (empty($userId) || empty($password)) {
$error = "Please fill in all fields.";
} else {
$stmt = $conn->prepare("SELECT * FROM $table_users WHERE user_id = ? AND type = 'agent'");
$stmt = $conn->prepare("SELECT * FROM $table_users WHERE user_id = ?");
if (!$stmt) {
$error = "Internal server error.";
} else {
@@ -56,6 +56,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<div class="container py-5 mx-auto" style="max-width: 420px; margin-top: 200px;">
<div class="mx-auto" style="">
<div class="card shadow-lg border-0 rounded-4 p-4" style="background: linear-gradient(135deg, #f5f7fa, #d9dce0ff); padding: 20px; border-radius: 15px;">
<img src="/asset/images/new_logo2.jpg" alt="Agent Logo" style="width: 80px; height: 80px; border-radius: 20px; display: block; margin: 0 auto 20px auto;">
<h4 class="text-center mb-4 fw-semibold text-primary">Agent Login</h4>
<?php if ($error): ?>

View File

@@ -0,0 +1,319 @@
<?php
// ---- Default date range ----
$today = date("Y-m-d");
$monthStart = date("Y-m-01");
$dFrom = $_GET['dFrom'] ?? $monthStart;
$dTo = $_GET['dTo'] ?? $today;
function calculateOpeningCommission($accountCycle, $accountType, $totalAmount, $installmentAmount, $refferTo, $totalPayments) {
// Commission chart data - Account Opening Commission
$commissionChart = [
'180' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'360' => ['50' => 25, '100' => 60, '200' => 150, '500' => 200, 'above' => 250],
'25' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'50' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200],
'6' => ['50' => 10, '100' => 25, '200' => 60, '500' => 100, 'above' => 150],
'12' => ['50' => 20, '100' => 50, '200' => 120, '500' => 170, 'above' => 200]
];
$commission = 0;
// Loan account commission (0.5% of total amount)
if ($accountType === 'Loan') {
$commission = $totalAmount * 0.005;
return $commission;
}
// Recurring account commission - ONLY for exact amounts in chart (50, 100, 200, 500, above 500)
if ($accountType === 'Recurring') {
$planKey = '';
if ($accountCycle === 'D') {
$planKey = ($totalPayments <= 180) ? '180' : '360';
}
elseif ($accountCycle === 'W') {
$planKey = ($totalPayments <= 25) ? '25' : '50';
}
elseif ($accountCycle === 'M') {
$planKey = ($totalPayments <= 6) ? '6' : '12';
}
if (isset($commissionChart[$planKey])) {
$plan = $commissionChart[$planKey];
// ONLY give commission for exact amounts that are in the chart
if ($installmentAmount == 50) {
$commission = $plan['50'];
} elseif ($installmentAmount == 100) {
$commission = $plan['100'];
} elseif ($installmentAmount == 200) {
$commission = $plan['200'];
} elseif ($installmentAmount == 500) {
$commission = $plan['500'];
} elseif ($installmentAmount > 500) {
$commission = $plan['above'];
}
// For amounts like 20, 30, 40, 70, 150, 300 etc. - NO COMMISSION (commission remains 0)
}
}
return $commission;
}
function calculateCollectionCommission($agentId, $dateFrom, $dateTo) {
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
// Get agent's commission rate
$agentSql = "SELECT comi_rate FROM `".$GLOBALS['arif_users']."` WHERE user_id = '$agentId'";
$agentResult = $conn->query($agentSql);
$comiRate = 0;
if ($agentResult && $agentResult->num_rows > 0) {
$agentData = $agentResult->fetch_assoc();
$comiRate = $agentData['comi_rate'];
}
// Get total collection amount for this agent's accounts
$collectionSql = "SELECT COALESCE(SUM(t.AT_AMOUNT),0) as total_collection
FROM `".$GLOBALS['arif_tran']."` t
JOIN `".$GLOBALS['arif_ac']."` a ON t.AT_ACID = a.AA_ACNO
WHERE a.AA_AGENT = '$agentId'
AND t.AT_TIMESTAMP BETWEEN '$dateFrom 00:00:00' AND '$dateTo 23:59:59'";
$collectionResult = $conn->query($collectionSql);
$totalCollection = 0;
if ($collectionResult && $collectionResult->num_rows > 0) {
$collectionData = $collectionResult->fetch_assoc();
$totalCollection = $collectionData['total_collection'];
}
$conn->close();
// Calculate collection commission
$collectionCommission = ($totalCollection * $comiRate) / 100;
return [
'total_collection' => $totalCollection,
'comi_rate' => $comiRate,
'collection_commission' => $collectionCommission
];
}
function dual_commission_report($dateFrom, $dateTo) {
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Dual Commission Report: '.$dateFrom."".$dateTo.'</h5>
<small class="text-muted">Showing both Account Opening Commission and Collection Commission</small>
</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'] ?? '';
$loginId = $_SESSION['user_id'] ?? '';
// ---- Get ALL agents first ----
$agentsSql = "SELECT user_id, user_name, comi_rate FROM `".$GLOBALS['arif_users']."` WHERE type = 'agent'";
// ---- If Agent then filter only themselves ----
if ($loginType === 'agent') {
$agentsSql .= " AND user_id = '".$loginId."'";
}
$agentsResult = $conn->query($agentsSql);
$agentCommissions = [];
if ($agentsResult && $agentsResult->num_rows > 0) {
while($agent = $agentsResult->fetch_assoc()) {
$agentId = $agent['user_id'];
// Initialize agent data with collection commission
$collectionData = calculateCollectionCommission($agentId, $dateFrom, $dateTo);
$agentCommissions[$agentId] = [
'agent_name' => $agent['user_name'],
'opening_commission' => 0,
'collection_commission' => $collectionData['collection_commission'],
'total_collection' => $collectionData['total_collection'],
'account_count' => 0,
'comi_rate' => $collectionData['comi_rate']
];
}
}
// ---- Now get accounts created in the date range and add opening commission ----
$accountsSql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59'";
// ---- if Agent then filter only their accounts ----
if ($loginType === 'agent') {
$accountsSql .= " AND `refferTo` = '".$loginId."'";
}
$accountsResult = $conn->query($accountsSql);
if ($accountsResult && $accountsResult->num_rows > 0) {
while($account = $accountsResult->fetch_assoc()) {
// Calculate OPENING commission
$openingCommission = calculateOpeningCommission(
$account['AA_ACTYPE'],
$account['AA_TYPE'],
$account['AA_AMOUNT'] ?? 0,
$account['AA_INSTALLMENT'],
$account['refferTo'],
$account['AA_NO_OF_PAYMENT']
);
$commissionAgent = $account['refferTo'];
// If agent exists in our list, add opening commission
if (isset($agentCommissions[$commissionAgent])) {
$agentCommissions[$commissionAgent]['opening_commission'] += $openingCommission;
$agentCommissions[$commissionAgent]['account_count']++;
}
}
}
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>Accounts</th>
<th>Collection Amount</th>
<th>Collection Rate</th>
<th>Acc Opening Commission</th>
<th>Collection Commission</th>
<th>Total Commission</th>
</tr>
</thead>
<tbody>';
$grandTotalOpening = 0;
$grandTotalCollection = 0;
$grandTotalCommission = 0;
$grandTotalCollectionAmount = 0;
if (!empty($agentCommissions)) {
foreach($agentCommissions as $agentId => $agentData) {
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
$grandTotalOpening += $agentData['opening_commission'];
$grandTotalCollection += $agentData['collection_commission'];
$grandTotalCommission += $totalCommission;
$grandTotalCollectionAmount += $agentData['total_collection'];
echo "
<tr>
<td>".$agentId."</td>
<td>".$agentData['agent_name']."</td>
<td class='text-center'>".$agentData['account_count']."</td>
<td class='text-end'>".number_format($agentData['total_collection'], 2)."</td>
<td class='text-center'>".$agentData['comi_rate']."%</td>
<td class='text-end text-primary'>".number_format($agentData['opening_commission'], 2)."</td>
<td class='text-end text-success'>".number_format($agentData['collection_commission'], 2)."</td>
<td class='text-end fw-bold'>".number_format($totalCommission, 2)."</td>
</tr>";
}
} else {
echo "<tr><td colspan='8' class='text-center text-muted'>No commission data found</td></tr>";
}
echo '
</tbody>
</table>';
// ---- Show grand totals ----
if ($loginType !== 'agent' && !empty($agentCommissions)) {
echo '<div class="row mt-4">
<div class="col-md-4">
<div class="card bg-primary text-white">
<div class="card-body text-center">
<h6>Opening Commission</h6>
<h4>'.number_format($grandTotalOpening, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-success text-white">
<div class="card-body text-center">
<h6>Collection Commission</h6>
<h4>'.number_format($grandTotalCollection, 2).'</h4>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>Total Commission</h6>
<h4>'.number_format($grandTotalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
} elseif ($loginType === 'agent' && !empty($agentCommissions)) {
// Show individual agent summary
$agentData = reset($agentCommissions); // Get first (and only) agent data
$totalCommission = $agentData['opening_commission'] + $agentData['collection_commission'];
echo '<div class="row mt-4">
<div class="col-md-6">
<div class="card bg-light">
<div class="card-body text-center">
<h6>My Summary</h6>
<p>Total Accounts: <b>'.$agentData['account_count'].'</b></p>
<p>Total Collection: <b>'.number_format($agentData['total_collection'], 2).'</b></p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h6>My Total Commission</h6>
<h4>'.number_format($totalCommission, 2).'</h4>
</div>
</div>
</div>
</div>';
}
echo '
</div>
</div>
</div>
</div>';
$conn->close();
}
?>
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Dual 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">
<button type="submit" class="btn btn-info w-100" style="margin-top: 25px;">Generate Report</button>
</div>
</form>
</div>
</div>
<?php
// ---- Call dual commission function ----
dual_commission_report($dFrom, $dTo);
?>

View File

@@ -1,61 +1,84 @@
<?php
if(!isset($_SESSION) && empty($_SESSION['user_id'])){
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
session_start();
date_default_timezone_set('Asia/Kolkata');
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
// Set default date range: 1st of current month to today
$firstDayOfMonth = date('Y-m-01');
$today = date('Y-m-d');
$defaultFrom = $firstDayOfMonth;
$defaultTo = $today;
// Use submitted dates or defaults
$dFrom = $_GET['dFrom'] ?? $defaultFrom;
$dTo = $_GET['dTo'] ?? $defaultTo;
?>
<!-- Generate Report Form -->
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Generate Report</h4>
<form method="get" class="row g-3">
<div class="col-md-3">
<label class="form-label">From</label>
<input value="<?= $_GET['dFrom'] ?? '' ?>" type="date" name="dFrom" class="form-control" required>
<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="<?= $_GET['dTo'] ?? '' ?>" type="date" name="dTo" class="form-control" required>
<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;">
<?php
// Show agent dropdown for admin users
if($_SESSION['type'] === 'admin'){
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$agents = $conn->query("SELECT * FROM `".$GLOBALS['arif_users']."` WHERE `type`='agent' ORDER BY user_name ASC");
?>
<div class="col-md-3">
<label class="form-label">Agent</label>
<select name="agent" id="agent" class="form-control">
<option value="">-- All Agents --</option>
<?php
if($agents && $agents->num_rows > 0){
while($a = $agents->fetch_assoc()){
$selected = (isset($_GET['agent']) && $_GET['agent']==$a['user_id']) ? "selected" : "";
echo "<option value='".$a['user_id']."' $selected>".$a['user_name']." (".$a['user_id'].")</option>";
}
}
?>
</select>
</div>
<?php } ?>
<div class="col-md-3 d-flex align-items-end" style="margin-top: 25px; z-index: -1;">
<button type="submit" class="btn btn-info w-100">Generate Report</button>
</div>
</form>
</div>
</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);
} 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 mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Report Period: '.$dateFrom." → ".$dateTo." (Up to)</h5>
</div>
</div>";
function report_view($fromDate, $toDate) {
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
// Display alert for report period
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Report Period: '.$fromDate.' → '.$toDate.' (Up to)</h5>
</div>
</div>';
$totalAmount = 0;
echo '
<div class="container mt-3">
<div class="container mt-3" style="margin-bottom: 105px;">
<div class="card shadow-sm rounded-3">
<div class="card-body">
<h5 class="mb-3">Transaction Report</h5>
@@ -64,6 +87,7 @@ function report_view($type, $dt) {
<thead class="table-light">
<tr>
<th>Transaction ID</th>
'.($_SESSION['type'] === 'admin' ? "<th>Agent</th>" : "").'
<th>Time</th>
<th>AC No</th>
<th>Name</th>
@@ -72,30 +96,52 @@ function report_view($type, $dt) {
</thead>
<tbody>';
// ----- base query -----
$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' AND '".$dateTo." 00:00:00'";
// ----- always agent filter -----
$sql .= " AND `AT_ADMIN`='".$_SESSION['user_id']."'";
$sql .= " ORDER BY `".$GLOBALS['arif_tran']."`.`AT_ID` DESC";
// Base query
$sql = "SELECT t.*, a.AA_NAME, a.AA_AGENT
FROM `".$GLOBALS['arif_tran']."` t
INNER JOIN `".$GLOBALS['arif_ac']."` a ON t.AT_ACID = a.AA_ACNO
WHERE DATE(CONVERT_TZ(t.AT_TIMESTAMP,'+00:00','+05:30')) BETWEEN '$fromDate' AND '$toDate'";
// Add agent filter if admin has selected a specific agent
if ($_SESSION['type'] === 'admin' && isset($_GET['agent']) && !empty($_GET['agent'])) {
$agentId = $conn->real_escape_string($_GET['agent']);
$sql .= " AND a.AA_AGENT = '$agentId'";
} else if ($_SESSION['type'] === 'agent') {
// For agents, only show their own transactions - FIXED
$sql .= " AND a.AA_AGENT = '".$_SESSION['user_id']."'";
}
$sql .= " ORDER BY t.AT_ID DESC";
$result = $conn->query($sql);
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
// Convert UTC timestamp to Kolkata time
$kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes"));
echo "
<tr>
<td>".$row["AT_ID"]."</td>
<td>".$row["AT_TIMESTAMP"]."</td>
<td>".$row["AT_ID"]."</td>";
// Show agent column for admin
if ($_SESSION['type'] === 'admin') {
echo "<td>".$row["AA_AGENT"]."</td>";
}
echo "
<td>".$kolkataTime."</td>
<td>".$row["AT_ACID"]."</td>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AT_AMOUNT"]."</td>
</tr>";
$totalAmount += $row["AT_AMOUNT"];
}
} else {
echo "<tr><td colspan='5' class='text-center text-muted'>No results found</td></tr>";
echo "<tr><td colspan='".($_SESSION['type'] === 'admin' ? 6 : 5)."' class='text-center text-muted'>No results found</td></tr>";
}
$conn->close();
echo '
@@ -111,7 +157,6 @@ function report_view($type, $dt) {
}
// ---- Call report function ----
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']);
?>
// Always show report with default or selected dates
report_view($dFrom, $dTo);
?>

View File

@@ -1,5 +1,7 @@
<?php
if(!isset($_SESSION) && empty($_SESSION['user_id'])){
date_default_timezone_set('Asia/Kolkata');
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
echo "<script>window.location.href = '/Agent/agent-login'</script>";
exit;
}
@@ -8,14 +10,15 @@ if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `" . $GLOBALS['arif_tran'] . "`WHERE `AT_ADMIN` = '" . $conn->real_escape_string($_SESSION['user_id']) . "'AND DATE(`AT_TIMESTAMP`) = CURDATE()";
$sql = "SELECT * FROM `" . $GLOBALS['arif_tran'] . "`WHERE `AT_ADMIN` = '" . $conn->real_escape_string($_SESSION['user_id']) . "'AND DATE(`AT_TIMESTAMP`) = CURDATE() ORDER BY AT_TIMESTAMP DESC";
$result = $conn->query($sql);
?>
<div class="container" style="margin-top:80px;">
<div class="container" style="margin-top:0px; margin-bottom: 105px;">
<h3>Transaction Records</h3>
<?php if ($result && $result->num_rows > 0): ?>
<?php if ($result && $result->num_rows > 0): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
@@ -27,7 +30,7 @@ $result = $conn->query($sql);
<tbody>
<?php while ($row = $result->fetch_assoc()): ?>
<tr>
<td><?= date("d M Y, h:i A", strtotime($row['AT_TIMESTAMP'])) ?></td>
<td><?= date("d M Y, h:i A", strtotime($row['AT_TIMESTAMP'] . ' +5 hours 30 minutes')) ?></td>
<td><?= htmlspecialchars($row['AT_ACID']) ?></td>
<td><?= htmlspecialchars($row['AT_AMOUNT']) ?></td>
</tr>

View File

@@ -9,7 +9,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/new_logo2.jpg" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>

View File

@@ -14,7 +14,7 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/logo.webp" alt=""></a>
<a href="/Admin/"><img class="img-responsive logo" style="height:50px" src="/asset/images/new_logo2.jpg" alt=""></a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>

View File

@@ -0,0 +1,95 @@
<?php
if ($_SESSION['type'] === 'admin' && isset($_GET["no"]) && isset($_GET["type"]) && $_GET["type"] == "Recurring") {
if (
$_SERVER['REQUEST_METHOD'] === 'POST'
&& isset($_POST['PAY_LOAN_EMI_FROM_RECURRING'], $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'], $_POST['DEDUCT_LOAN_AMOUNT'])
&& $_POST['PAY_LOAN_EMI_FROM_RECURRING_ID'] === 'axakassaoxnnxsaoij34866'
) {
$loanEMIAmount = floatval($_POST['DEDUCT_LOAN_AMOUNT']);
$deductAmount = -$loanEMIAmount; // negative for recurring deduction
$paidToLoanAccountNumber = $_POST['LOAN_AC_NUMBER'];
$accountId = $_GET['no'];
if (!$accountId) {
echo "Account number missing";
exit;
}
// ✅ DB connection
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// ✅ Check recurring balance first
$sql = "SELECT AA_BAL FROM `" . $GLOBALS['arif_ac'] . "` WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $accountId);
$stmt->execute();
$stmt->bind_result($CURRENT_RECURRING_BALANCE);
$stmt->fetch();
$stmt->close();
if ($loanEMIAmount > $CURRENT_RECURRING_BALANCE) {
echo "<div class='container' style=' background-color: #f8d7da; color: #721c24; padding: 12px 20px; border: 1px solid #f5c6cb; border-radius: 5px; font-family: Arial, sans-serif; font-size: 15px; margin: 10px auto; position: relative;'>
<strong>Error!</strong> Insufficient balance in Recurring account.
<span style=\" position: absolute; top: 8px; right: 12px; color: #721c24; font-weight: bold; cursor: pointer; \" onclick=\"this.parentElement.style.display='none';\">&times;</span>
</div>";
exit;
}
// ✅ Begin transaction for atomicity
$conn->begin_transaction();
try {
$table = $GLOBALS['arif_tran'] ?? 'arif_tran';
$userType = 'admin';
// Entry 1: Deduction from recurring
$remarksText1 = "$loanEMIAmount deducted from Recurring for Loan A/c $paidToLoanAccountNumber EMI";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $accountId, $deductAmount, $remarksText1);
$stmt->execute();
$stmt->close();
// Entry 2: Credit to loan account
$remarksText2 = "$loanEMIAmount credited to Loan A/c $paidToLoanAccountNumber EMI (from Recurring $accountId)";
$stmt = $conn->prepare("INSERT INTO `$table` (AT_ADMIN, AT_ACID, AT_AMOUNT, REMARKS) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssds", $userType, $paidToLoanAccountNumber, $loanEMIAmount, $remarksText2);
$stmt->execute();
$stmt->close();
// Update Loan Account
$ins_no = 1;
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` + ?, `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID` + ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("dis", $loanEMIAmount, $ins_no, $paidToLoanAccountNumber);
$stmt->execute();
$stmt->close();
// Update Recurring Account
$sql = "UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_BAL` = `AA_BAL` - ? WHERE `AA_ACNO` = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ds", $loanEMIAmount, $accountId);
$stmt->execute();
$stmt->close();
// ✅ Commit if everything ok
$conn->commit();
echo "<div class='container' style=' background-color: #d4edda; color: #155724; padding: 12px 20px; border: 1px solid #c3e6cb; border-radius: 5px; font-family: Arial, sans-serif; font-size: 15px; margin: 10px auto; position: relative;'>
<strong>Success!</strong> Loan EMI paid successfully!
<span style=\" position: absolute; top: 8px; right: 12px; color: #155724; font-weight: bold; cursor: pointer; \" onclick=\"this.parentElement.style.display='none';\">&times;</span>
</div>";
} catch (Exception $e) {
$conn->rollback();
echo "Error processing EMI payment: " . $e->getMessage();
}
$conn->close();
}
}
?>

View File

@@ -0,0 +1,35 @@
<?php
$response = new stdClass();
$total = array();
if (isset($_POST["add_i"]) && isset($_POST["AA_ACNO"]) && is_numeric($_POST["add_i"]) && $_POST["add_i"] > 0) {
if(isset($_POST["ins_no"])) $ins_no = $_POST["ins_no"]; else $ins_no = 1;
if(isset($_POST["fine_amount"])) $fine_amt = $_POST["fine_amount"]; else $fine_amt = 0;
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
if ($conn->query("UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_FINE` = `AA_FINE` + 5, `AA_BAL` = `AA_BAL`+".$_POST["add_i"]." , `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID`+".$ins_no." WHERE `AA_ACNO` = '" . $_POST["AA_ACNO"] . "'"));
//Add entry to Transaction
{
$AT_USER = $_SESSION['user_id'];
if ($conn->query("INSERT INTO `" . $GLOBALS['arif_tran'] . "` (`AT_ID`, `AT_TIMESTAMP`, `AT_ADMIN`, `AT_ACID`, `AT_AMOUNT`) VALUES (NULL, CURRENT_TIMESTAMP, '" . $AT_USER . "', '" . $_POST["AA_ACNO"] . "', '" . $_POST["add_i"] . "')")){
$total['status'] = 'Success';
$total['statusmsg'] = 'Transaction Successful! Rs. '.$_POST["add_i"];
}
else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Error in Config';
// $total['statusmsg'] = mysqli_error($conn);
}
}
$conn->close();
} else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Error!! Check Input Details'.$_POST["add_i"].$_POST["AA_ACNO"];
}
$response = $total;
echo json_encode($response);
?>

View File

@@ -1,35 +1,80 @@
<?php
$response = new stdClass();
$total = array();
if (isset($_POST["add_i"]) && isset($_POST["AA_ACNO"]) && is_numeric($_POST["add_i"]) && $_POST["add_i"] > 0) {
if(isset($_POST["ins_no"])) $ins_no = $_POST["ins_no"]; else $ins_no = 1;
if(isset($_POST["fine_amount"])) $fine_amt = $_POST["fine_amount"]; else $fine_amt = 0;
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
if ($conn->query("UPDATE `" . $GLOBALS['arif_ac'] . "` SET `AA_FINE` = `AA_FINE` + 5, `AA_BAL` = `AA_BAL`+".$_POST["add_i"]." , `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID`+".$ins_no." WHERE `AA_ACNO` = '" . $_POST["AA_ACNO"] . "'"));
//Add entry to Transaction
{
$AT_USER = $_SESSION['user_id'];
if ($conn->query("INSERT INTO `" . $GLOBALS['arif_tran'] . "` (`AT_ID`, `AT_TIMESTAMP`, `AT_ADMIN`, `AT_ACID`, `AT_AMOUNT`) VALUES (NULL, CURRENT_TIMESTAMP, '" . $AT_USER . "', '" . $_POST["AA_ACNO"] . "', '" . $_POST["add_i"] . "')")){
$total['status'] = 'Success';
$total['statusmsg'] = 'Transaction Successful! Rs. '.$_POST["add_i"];
}
else {
$AA_ACNO = $conn->real_escape_string($_POST["AA_ACNO"]);
$add_i = $conn->real_escape_string($_POST["add_i"]);
$AT_USER = $_SESSION['user_id'];
$USER_TYPE = $_SESSION['type'] ?? 'agent'; // default = user
$allowMultiple = isset($_POST['allowMultiple']) ? intval($_POST['allowMultiple']) : 0;
// 1. Check account type & owner
$sql_ac = "SELECT AA_TYPE, AA_AGENT FROM `".$GLOBALS['arif_ac']."` WHERE `AA_ACNO`='$AA_ACNO' LIMIT 1";
$res_ac = $conn->query($sql_ac);
if($res_ac && $res_ac->num_rows > 0){
$acc = $res_ac->fetch_assoc();
// --- যদি admin না হয় তাহলে শুধু নিজের account-এ কাজ করতে পারবে ---
if($USER_TYPE != 'admin' && $acc['AA_AGENT'] != $AT_USER){
$total['status'] = 'Error';
$total['statusmsg'] = 'Error in Config';
// $total['statusmsg'] = mysqli_error($conn);
$total['statusmsg'] = 'Unauthorized Access!';
echo json_encode($total); exit;
}
// 2. যদি account Recurring হয়, allowMultiple না থাকে, এবং user admin না হয় → দিনে একবারের বেশি হবে না
// যদি account Recurring হয়, আর multiple allow না থাকে, আর user admin না হয় → দিনে একবারের বেশি হবে না
if($acc['AA_TYPE'] == "Recurring" && $allowMultiple == 0 && $USER_TYPE != 'admin'){
$today = date("Y-m-d");
$sql_chk = "SELECT COUNT(*) as cnt FROM `".$GLOBALS['arif_tran']."` WHERE `AT_ACID`='$AA_ACNO' AND `AT_ADMIN`='$AT_USER' AND DATE(`AT_TIMESTAMP`)='$today'";
$res_chk = $conn->query($sql_chk);
$row_chk = $res_chk->fetch_assoc();
if($row_chk['cnt'] > 0){
$total['status'] = 'Error';
$total['statusmsg'] = 'You can do only one transaction per day for This Account!';
echo json_encode($total); exit;
}
}
// 3. Update Account
$sql_upd = "UPDATE `".$GLOBALS['arif_ac']."` SET `AA_FINE` = `AA_FINE` + 5, `AA_BAL` = `AA_BAL` + $add_i, `AA_NO_OF_PAYPAID` = `AA_NO_OF_PAYPAID` + $ins_no WHERE `AA_ACNO` = '$AA_ACNO'";
if ($conn->query($sql_upd)){
// Insert Transaction
$sql_ins = "INSERT INTO `".$GLOBALS['arif_tran']."` (`AT_ID`, `AT_TIMESTAMP`, `AT_ADMIN`, `AT_ACID`, `AT_AMOUNT`) VALUES (NULL, CURRENT_TIMESTAMP, '$AT_USER', '$AA_ACNO', '$add_i')";
if ($conn->query($sql_ins)){
$total['status'] = 'Success';
$total['statusmsg'] = 'Transaction Successful! Rs. '.$add_i;
} else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Error in Transaction Insert!';
}
} else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Error in Account Update!';
}
} else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Account Not Found!';
}
$conn->close();
} else {
} else {
$total['status'] = 'Error';
$total['statusmsg'] = 'Error!! Check Input Details'.$_POST["add_i"].$_POST["AA_ACNO"];
$total['statusmsg'] = 'Error!! Check Input Details '.($_POST["add_i"] ?? '').($_POST["AA_ACNO"] ?? '');
}
$response = $total;
echo json_encode($response);
?>
?>

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
asset/images/new_logo.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
asset/images/new_logo2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

View File

@@ -0,0 +1,182 @@
<?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/actions_panel.twig */
class __TwigTemplate_7afb17d589b273308658448423e89d40 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 "<fieldset class=\"pma-fieldset\" id=\"actions_panel\">
<table class=\"table table-borderless w-auto tdblock\">
<tr>
<td class=\"text-nowrap align-middle\">
<select name=\"submit_type\" class=\"control_at_footer\">
";
// line 6
if ( !twig_test_empty(($context["where_clause"] ?? null))) {
// line 7
echo " <option value=\"save\">";
echo _gettext("Save");
echo "</option>
";
}
// line 9
echo " <option value=\"insert\">";
echo _gettext("Insert as new row");
echo "</option>
<option value=\"insertignore\">";
echo _gettext("Insert as new row and ignore errors");
// line 10
echo "</option>
<option value=\"showinsert\">";
echo _gettext("Show insert query");
// line 11
echo "</option>
</select>
</td>
<td class=\"align-middle\">
<strong>";
echo _gettext("and then");
// line 15
echo "</strong>
</td>
<td class=\"text-nowrap align-middle\">
<select name=\"after_insert\" class=\"control_at_footer\">
<option value=\"back\"";
// line 19
echo (((($context["after_insert"] ?? null) == "back")) ? (" selected") : (""));
echo ">";
echo _gettext("Go back to previous page");
echo "</option>
<option value=\"new_insert\"";
// line 20
echo (((($context["after_insert"] ?? null) == "new_insert")) ? (" selected") : (""));
echo ">";
echo _gettext("Insert another new row");
echo "</option>
";
// line 21
if ( !twig_test_empty(($context["where_clause"] ?? null))) {
// line 22
echo " <option value=\"same_insert\"";
echo (((($context["after_insert"] ?? null) == "same_insert")) ? (" selected") : (""));
echo ">";
echo _gettext("Go back to this page");
echo "</option>
";
// line 23
if ((($context["found_unique_key"] ?? null) && ($context["is_numeric"] ?? null))) {
// line 24
echo " <option value=\"edit_next\"";
echo (((($context["after_insert"] ?? null) == "edit_next")) ? (" selected") : (""));
echo ">";
echo _gettext("Edit next row");
echo "</option>
";
}
// line 26
echo " ";
}
// line 27
echo " </select>
</td>
</tr>
<tr>
<td>
";
// line 32
echo PhpMyAdmin\Html\Generator::showHint(_gettext("Use TAB key to move from value to value, or CTRL+arrows to move anywhere."));
echo "
</td>
<td colspan=\"3\" class=\"text-end align-middle\">
<input type=\"button\" class=\"btn btn-secondary preview_sql control_at_footer\" value=\"";
echo _gettext("Preview SQL");
// line 35
echo "\">
<input type=\"reset\" class=\"btn btn-secondary control_at_footer\" value=\"";
echo _gettext("Reset");
// line 36
echo "\">
<input type=\"submit\" class=\"btn btn-primary control_at_footer\" value=\"";
echo _gettext("Go");
// line 37
echo "\" id=\"buttonYes\">
</td>
</tr>
</table>
</fieldset>
<div class=\"modal fade\" id=\"previewSqlModal\" tabindex=\"-1\" aria-labelledby=\"previewSqlModalLabel\" aria-hidden=\"true\">
<div class=\"modal-dialog\">
<div class=\"modal-content\">
<div class=\"modal-header\">
<h5 class=\"modal-title\" id=\"previewSqlModalLabel\">";
echo _gettext("Loading");
// line 46
echo "</h5>
<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"";
echo _gettext("Close");
// line 47
echo "\"></button>
</div>
<div class=\"modal-body\">
</div>
<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" id=\"previewSQLCloseButton\" data-bs-dismiss=\"modal\">";
echo _gettext("Close");
// line 52
echo "</button>
</div>
</div>
</div>
</div>
";
}
public function getTemplateName()
{
return "table/insert/actions_panel.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 155 => 52, 147 => 47, 143 => 46, 131 => 37, 127 => 36, 123 => 35, 116 => 32, 109 => 27, 106 => 26, 98 => 24, 96 => 23, 89 => 22, 87 => 21, 81 => 20, 75 => 19, 69 => 15, 62 => 11, 58 => 10, 52 => 9, 46 => 7, 44 => 6, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "table/insert/actions_panel.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/insert/actions_panel.twig");
}
}

View File

@@ -0,0 +1,94 @@
<?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/get_head_and_foot_of_insert_row_table.twig */
class __TwigTemplate_b1781500677588d72e4b67bd7af6c8f4 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 "<div class=\"table-responsive-lg\">
<table class=\"table table-striped align-middle my-3 insertRowTable w-auto\">
<thead>
<tr>
<th>";
echo _gettext("Column");
// line 5
echo "</th>
";
// line 6
echo ($context["type"] ?? null);
echo "
";
// line 7
echo ($context["function"] ?? null);
echo "
<th>";
echo _gettext("Null");
// line 8
echo "</th>
<th class=\"w-50\">";
echo _gettext("Value");
// line 9
echo "</th>
</tr>
</thead>
<tfoot>
<tr>
<th colspan=\"5\" class=\"tblFooters text-end\">
<input class=\"btn btn-primary\" type=\"submit\" value=\"";
echo _gettext("Go");
// line 15
echo "\">
</th>
</tr>
</tfoot>";
}
public function getTemplateName()
{
return "table/insert/get_head_and_foot_of_insert_row_table.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 69 => 15, 60 => 9, 56 => 8, 51 => 7, 47 => 6, 44 => 5, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "table/insert/get_head_and_foot_of_insert_row_table.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/insert/get_head_and_foot_of_insert_row_table.twig");
}
}

View File

@@ -0,0 +1,67 @@
<?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;
/* display/results/value_display.twig */
class __TwigTemplate_5bb3e212d22c5db3ec0156119cf83967 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 "<td class=\"text-start ";
echo twig_escape_filter($this->env, ($context["class"] ?? null), "html", null, true);
echo ((($context["condition_field"] ?? null)) ? (" condition") : (""));
echo "\">";
// line 2
echo ($context["value"] ?? null);
// line 3
echo "</td>
";
}
public function getTemplateName()
{
return "display/results/value_display.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 44 => 3, 42 => 2, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "display/results/value_display.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/display/results/value_display.twig");
}
}

View File

@@ -0,0 +1,502 @@
<?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;
/* columns_definitions/partitions.twig */
class __TwigTemplate_87c8d6a9bb025f5a957415bc8c9b04bd 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
$context["partition_options"] = [0 => "", 1 => "HASH", 2 => "LINEAR HASH", 3 => "KEY", 4 => "LINEAR KEY", 5 => "RANGE", 6 => "RANGE COLUMNS", 7 => "LIST", 8 => "LIST COLUMNS"];
// line 12
$context["sub_partition_options"] = [0 => "", 1 => "HASH", 2 => "LINEAR HASH", 3 => "KEY", 4 => "LINEAR KEY"];
// line 13
$context["value_type_options"] = [0 => "", 1 => "LESS THAN", 2 => "LESS THAN MAXVALUE", 3 => "IN"];
// line 14
echo "
<table class=\"table table-borderless w-auto align-middle mb-0\" id=\"partition_table\">
<tr class=\"align-middle\">
<td><label for=\"partition_by\">";
echo _gettext("Partition by:");
// line 17
echo "</label></td>
<td>
<select name=\"partition_by\" id=\"partition_by\">
";
// line 20
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["partition_options"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["option"]) {
// line 21
echo " <option value=\"";
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "\"";
// line 22
if (((($__internal_compile_0 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_0) || $__internal_compile_0 instanceof ArrayAccess ? ($__internal_compile_0["partition_by"] ?? null) : null) == $context["option"])) {
// line 23
echo " selected=\"selected\"";
}
// line 24
echo ">
";
// line 25
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "
</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['option'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 28
echo " </select>
</td>
<td>
(<input name=\"partition_expr\" type=\"text\"
placeholder=\"";
echo _gettext("Expression or column list");
// line 32
echo "\"
value=\"";
// line 33
echo twig_escape_filter($this->env, (($__internal_compile_1 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_1) || $__internal_compile_1 instanceof ArrayAccess ? ($__internal_compile_1["partition_expr"] ?? null) : null), "html", null, true);
echo "\">)
</td>
</tr>
<tr class=\"align-middle\">
<td><label for=\"partition_count\">";
echo _gettext("Partitions:");
// line 37
echo "</label></td>
<td colspan=\"2\">
<input name=\"partition_count\" type=\"number\" min=\"2\"
value=\"";
// line 40
(((($__internal_compile_2 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_2) || $__internal_compile_2 instanceof ArrayAccess ? ($__internal_compile_2["partition_count"] ?? null) : null)) ? (print (twig_escape_filter($this->env, (($__internal_compile_3 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_3) || $__internal_compile_3 instanceof ArrayAccess ? ($__internal_compile_3["partition_count"] ?? null) : null), "html", null, true))) : (print ("")));
echo "\">
</td>
</tr>
";
// line 43
if ((($__internal_compile_4 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_4) || $__internal_compile_4 instanceof ArrayAccess ? ($__internal_compile_4["can_have_subpartitions"] ?? null) : null)) {
// line 44
echo " <tr class=\"align-middle\">
<td><label for=\"subpartition_by\">";
echo _gettext("Subpartition by:");
// line 45
echo "</label></td>
<td>
<select name=\"subpartition_by\" id=\"subpartition_by\">
";
// line 48
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["sub_partition_options"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["option"]) {
// line 49
echo " <option value=\"";
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "\"";
// line 50
if (((($__internal_compile_5 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_5) || $__internal_compile_5 instanceof ArrayAccess ? ($__internal_compile_5["subpartition_by"] ?? null) : null) == $context["option"])) {
// line 51
echo " selected=\"selected\"";
}
// line 52
echo ">
";
// line 53
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "
</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['option'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 56
echo " </select>
</td>
<td>
(<input name=\"subpartition_expr\" type=\"text\"
placeholder=\"";
echo _gettext("Expression or column list");
// line 60
echo "\"
value=\"";
// line 61
echo twig_escape_filter($this->env, (($__internal_compile_6 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_6) || $__internal_compile_6 instanceof ArrayAccess ? ($__internal_compile_6["subpartition_expr"] ?? null) : null), "html", null, true);
echo "\">)
</td>
</tr>
<tr class=\"align-middle\">
<td><label for=\"subpartition_count\">";
echo _gettext("Subpartitions:");
// line 65
echo "</label></td>
<td colspan=\"2\">
<input name=\"subpartition_count\" type=\"number\" min=\"2\"
value=\"";
// line 68
(((($__internal_compile_7 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_7) || $__internal_compile_7 instanceof ArrayAccess ? ($__internal_compile_7["subpartition_count"] ?? null) : null)) ? (print (twig_escape_filter($this->env, (($__internal_compile_8 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_8) || $__internal_compile_8 instanceof ArrayAccess ? ($__internal_compile_8["subpartition_count"] ?? null) : null), "html", null, true))) : (print ("")));
echo "\">
</td>
</tr>
";
}
// line 72
echo "</table>
";
// line 73
if (((($__internal_compile_9 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_9) || $__internal_compile_9 instanceof ArrayAccess ? ($__internal_compile_9["partition_count"] ?? null) : null) > 1)) {
// line 74
echo " <table class=\"table align-middle\" id=\"partition_definition_table\">
<thead><tr>
<th>";
echo _gettext("Partition");
// line 76
echo "</th>
";
// line 77
if ((($__internal_compile_10 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_10) || $__internal_compile_10 instanceof ArrayAccess ? ($__internal_compile_10["value_enabled"] ?? null) : null)) {
// line 78
echo " <th>";
echo _gettext("Values");
echo "</th>
";
}
// line 80
echo " ";
if (((($__internal_compile_11 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_11) || $__internal_compile_11 instanceof ArrayAccess ? ($__internal_compile_11["can_have_subpartitions"] ?? null) : null) && ((($__internal_compile_12 = // line 81
($context["partition_details"] ?? null)) && is_array($__internal_compile_12) || $__internal_compile_12 instanceof ArrayAccess ? ($__internal_compile_12["subpartition_count"] ?? null) : null) > 1))) {
// line 82
echo " <th>";
echo _gettext("Subpartition");
echo "</th>
";
}
// line 84
echo " <th>";
echo _gettext("Engine");
echo "</th>
<th>";
echo _gettext("Comment");
// line 85
echo "</th>
<th>";
echo _gettext("Data directory");
// line 86
echo "</th>
<th>";
echo _gettext("Index directory");
// line 87
echo "</th>
<th>";
echo _gettext("Max rows");
// line 88
echo "</th>
<th>";
echo _gettext("Min rows");
// line 89
echo "</th>
<th>";
echo _gettext("Table space");
// line 90
echo "</th>
<th>";
echo _gettext("Node group");
// line 91
echo "</th>
</tr></thead>
";
// line 93
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((($__internal_compile_13 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_13) || $__internal_compile_13 instanceof ArrayAccess ? ($__internal_compile_13["partitions"] ?? null) : null));
foreach ($context['_seq'] as $context["_key"] => $context["partition"]) {
// line 94
echo " ";
$context["rowspan"] = (( !twig_test_empty((($__internal_compile_14 = $context["partition"]) && is_array($__internal_compile_14) || $__internal_compile_14 instanceof ArrayAccess ? ($__internal_compile_14["subpartition_count"] ?? null) : null))) ? (((($__internal_compile_15 = // line 95
$context["partition"]) && is_array($__internal_compile_15) || $__internal_compile_15 instanceof ArrayAccess ? ($__internal_compile_15["subpartition_count"] ?? null) : null) + 1)) : (2));
// line 96
echo " <tr>
<td rowspan=\"";
// line 97
echo twig_escape_filter($this->env, ($context["rowspan"] ?? null), "html", null, true);
echo "\">
<input type=\"text\" name=\"";
// line 98
echo twig_escape_filter($this->env, (($__internal_compile_16 = $context["partition"]) && is_array($__internal_compile_16) || $__internal_compile_16 instanceof ArrayAccess ? ($__internal_compile_16["prefix"] ?? null) : null), "html", null, true);
echo "[name]\"
value=\"";
// line 99
echo twig_escape_filter($this->env, (($__internal_compile_17 = $context["partition"]) && is_array($__internal_compile_17) || $__internal_compile_17 instanceof ArrayAccess ? ($__internal_compile_17["name"] ?? null) : null), "html", null, true);
echo "\">
</td>
";
// line 101
if ((($__internal_compile_18 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_18) || $__internal_compile_18 instanceof ArrayAccess ? ($__internal_compile_18["value_enabled"] ?? null) : null)) {
// line 102
echo " <td rowspan=\"";
echo twig_escape_filter($this->env, ($context["rowspan"] ?? null), "html", null, true);
echo "\" class=\"align-middle\">
<select class=\"partition_value\"
name=\"";
// line 104
echo twig_escape_filter($this->env, (($__internal_compile_19 = $context["partition"]) && is_array($__internal_compile_19) || $__internal_compile_19 instanceof ArrayAccess ? ($__internal_compile_19["prefix"] ?? null) : null), "html", null, true);
echo "[value_type]\">
";
// line 105
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["value_type_options"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["option"]) {
// line 106
echo " <option value=\"";
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "\"";
// line 107
if (((($__internal_compile_20 = $context["partition"]) && is_array($__internal_compile_20) || $__internal_compile_20 instanceof ArrayAccess ? ($__internal_compile_20["value_type"] ?? null) : null) == $context["option"])) {
// line 108
echo " selected=\"selected\"";
}
// line 109
echo ">
";
// line 110
echo twig_escape_filter($this->env, $context["option"], "html", null, true);
echo "
</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['option'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 113
echo " </select>
<input type=\"text\" class=\"partition_value\"
name=\"";
// line 115
echo twig_escape_filter($this->env, (($__internal_compile_21 = $context["partition"]) && is_array($__internal_compile_21) || $__internal_compile_21 instanceof ArrayAccess ? ($__internal_compile_21["prefix"] ?? null) : null), "html", null, true);
echo "[value]\"
value=\"";
// line 116
echo twig_escape_filter($this->env, (($__internal_compile_22 = $context["partition"]) && is_array($__internal_compile_22) || $__internal_compile_22 instanceof ArrayAccess ? ($__internal_compile_22["value"] ?? null) : null), "html", null, true);
echo "\">
</td>
";
}
// line 119
echo " </tr>
";
// line 121
if (twig_get_attribute($this->env, $this->source, $context["partition"], "subpartitions", [], "array", true, true, false, 121)) {
// line 122
echo " ";
$context["subpartitions"] = (($__internal_compile_23 = $context["partition"]) && is_array($__internal_compile_23) || $__internal_compile_23 instanceof ArrayAccess ? ($__internal_compile_23["subpartitions"] ?? null) : null);
// line 123
echo " ";
} else {
// line 124
echo " ";
$context["subpartitions"] = [0 => $context["partition"]];
// line 125
echo " ";
}
// line 126
echo "
";
// line 127
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["subpartitions"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["subpartition"]) {
// line 128
echo " <tr>
";
// line 129
if (((($__internal_compile_24 = ($context["partition_details"] ?? null)) && is_array($__internal_compile_24) || $__internal_compile_24 instanceof ArrayAccess ? ($__internal_compile_24["can_have_subpartitions"] ?? null) : null) && ((($__internal_compile_25 = // line 130
($context["partition_details"] ?? null)) && is_array($__internal_compile_25) || $__internal_compile_25 instanceof ArrayAccess ? ($__internal_compile_25["subpartition_count"] ?? null) : null) > 1))) {
// line 131
echo " <td>
<input type=\"text\" name=\"";
// line 132
echo twig_escape_filter($this->env, (($__internal_compile_26 = $context["subpartition"]) && is_array($__internal_compile_26) || $__internal_compile_26 instanceof ArrayAccess ? ($__internal_compile_26["prefix"] ?? null) : null), "html", null, true);
echo "[name]\"
value=\"";
// line 133
echo twig_escape_filter($this->env, (($__internal_compile_27 = $context["subpartition"]) && is_array($__internal_compile_27) || $__internal_compile_27 instanceof ArrayAccess ? ($__internal_compile_27["name"] ?? null) : null), "html", null, true);
echo "\">
</td>
";
}
// line 136
echo " <td>
<select name=\"";
// line 137
echo twig_escape_filter($this->env, (($__internal_compile_28 = $context["subpartition"]) && is_array($__internal_compile_28) || $__internal_compile_28 instanceof ArrayAccess ? ($__internal_compile_28["prefix"] ?? null) : null), "html", null, true);
echo "[engine]\" aria-label=\"";
echo _gettext("Storage engine");
echo "\">
<option value=\"\"></option>
";
// line 139
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["storage_engines"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["engine"]) {
// line 140
echo " <option value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["engine"], "name", [], "any", false, false, false, 140), "html", null, true);
echo "\"";
if ( !twig_test_empty(twig_get_attribute($this->env, $this->source, $context["engine"], "comment", [], "any", false, false, false, 140))) {
echo " title=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["engine"], "comment", [], "any", false, false, false, 140), "html", null, true);
echo "\"";
}
// line 141
echo (((twig_lower_filter($this->env, twig_get_attribute($this->env, $this->source, $context["engine"], "name", [], "any", false, false, false, 141)) == twig_lower_filter($this->env, (($__internal_compile_29 = $context["subpartition"]) && is_array($__internal_compile_29) || $__internal_compile_29 instanceof ArrayAccess ? ($__internal_compile_29["engine"] ?? null) : null)))) ? (" selected") : (""));
echo ">";
// line 142
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["engine"], "name", [], "any", false, false, false, 142), "html", null, true);
// line 143
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['engine'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 145
echo " </select>
</td>
<td>
<textarea name=\"";
// line 148
echo twig_escape_filter($this->env, (($__internal_compile_30 = $context["subpartition"]) && is_array($__internal_compile_30) || $__internal_compile_30 instanceof ArrayAccess ? ($__internal_compile_30["prefix"] ?? null) : null), "html", null, true);
echo "[comment]\">";
// line 149
echo twig_escape_filter($this->env, (($__internal_compile_31 = $context["subpartition"]) && is_array($__internal_compile_31) || $__internal_compile_31 instanceof ArrayAccess ? ($__internal_compile_31["comment"] ?? null) : null), "html", null, true);
// line 150
echo "</textarea>
</td>
<td>
<input type=\"text\" name=\"";
// line 153
echo twig_escape_filter($this->env, (($__internal_compile_32 = $context["subpartition"]) && is_array($__internal_compile_32) || $__internal_compile_32 instanceof ArrayAccess ? ($__internal_compile_32["prefix"] ?? null) : null), "html", null, true);
echo "[data_directory]\"
value=\"";
// line 154
echo twig_escape_filter($this->env, (($__internal_compile_33 = $context["subpartition"]) && is_array($__internal_compile_33) || $__internal_compile_33 instanceof ArrayAccess ? ($__internal_compile_33["data_directory"] ?? null) : null), "html", null, true);
echo "\">
</td>
<td>
<input type=\"text\" name=\"";
// line 157
echo twig_escape_filter($this->env, (($__internal_compile_34 = $context["subpartition"]) && is_array($__internal_compile_34) || $__internal_compile_34 instanceof ArrayAccess ? ($__internal_compile_34["prefix"] ?? null) : null), "html", null, true);
echo "[index_directory]\"
value=\"";
// line 158
echo twig_escape_filter($this->env, (($__internal_compile_35 = $context["subpartition"]) && is_array($__internal_compile_35) || $__internal_compile_35 instanceof ArrayAccess ? ($__internal_compile_35["index_directory"] ?? null) : null), "html", null, true);
echo "\">
</td>
<td>
<input type=\"number\" name=\"";
// line 161
echo twig_escape_filter($this->env, (($__internal_compile_36 = $context["subpartition"]) && is_array($__internal_compile_36) || $__internal_compile_36 instanceof ArrayAccess ? ($__internal_compile_36["prefix"] ?? null) : null), "html", null, true);
echo "[max_rows]\"
value=\"";
// line 162
echo twig_escape_filter($this->env, (($__internal_compile_37 = $context["subpartition"]) && is_array($__internal_compile_37) || $__internal_compile_37 instanceof ArrayAccess ? ($__internal_compile_37["max_rows"] ?? null) : null), "html", null, true);
echo "\">
</td>
<td>
<input type=\"number\" min=\"0\" name=\"";
// line 165
echo twig_escape_filter($this->env, (($__internal_compile_38 = $context["subpartition"]) && is_array($__internal_compile_38) || $__internal_compile_38 instanceof ArrayAccess ? ($__internal_compile_38["prefix"] ?? null) : null), "html", null, true);
echo "[min_rows]\"
value=\"";
// line 166
echo twig_escape_filter($this->env, (($__internal_compile_39 = $context["subpartition"]) && is_array($__internal_compile_39) || $__internal_compile_39 instanceof ArrayAccess ? ($__internal_compile_39["min_rows"] ?? null) : null), "html", null, true);
echo "\">
</td>
<td>
<input type=\"text\" min=\"0\" name=\"";
// line 169
echo twig_escape_filter($this->env, (($__internal_compile_40 = $context["subpartition"]) && is_array($__internal_compile_40) || $__internal_compile_40 instanceof ArrayAccess ? ($__internal_compile_40["prefix"] ?? null) : null), "html", null, true);
echo "[tablespace]\"
value=\"";
// line 170
echo twig_escape_filter($this->env, (($__internal_compile_41 = $context["subpartition"]) && is_array($__internal_compile_41) || $__internal_compile_41 instanceof ArrayAccess ? ($__internal_compile_41["tablespace"] ?? null) : null), "html", null, true);
echo "\">
</td>
<td>
<input type=\"text\" name=\"";
// line 173
echo twig_escape_filter($this->env, (($__internal_compile_42 = $context["subpartition"]) && is_array($__internal_compile_42) || $__internal_compile_42 instanceof ArrayAccess ? ($__internal_compile_42["prefix"] ?? null) : null), "html", null, true);
echo "[node_group]\"
value=\"";
// line 174
echo twig_escape_filter($this->env, (($__internal_compile_43 = $context["subpartition"]) && is_array($__internal_compile_43) || $__internal_compile_43 instanceof ArrayAccess ? ($__internal_compile_43["node_group"] ?? null) : null), "html", null, true);
echo "\">
</td>
</tr>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['subpartition'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 178
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['partition'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 179
echo " </table>
";
}
}
public function getTemplateName()
{
return "columns_definitions/partitions.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 478 => 179, 472 => 178, 462 => 174, 458 => 173, 452 => 170, 448 => 169, 442 => 166, 438 => 165, 432 => 162, 428 => 161, 422 => 158, 418 => 157, 412 => 154, 408 => 153, 403 => 150, 401 => 149, 398 => 148, 393 => 145, 386 => 143, 384 => 142, 381 => 141, 372 => 140, 368 => 139, 361 => 137, 358 => 136, 352 => 133, 348 => 132, 345 => 131, 343 => 130, 342 => 129, 339 => 128, 335 => 127, 332 => 126, 329 => 125, 326 => 124, 323 => 123, 320 => 122, 318 => 121, 314 => 119, 308 => 116, 304 => 115, 300 => 113, 291 => 110, 288 => 109, 285 => 108, 283 => 107, 279 => 106, 275 => 105, 271 => 104, 265 => 102, 263 => 101, 258 => 99, 254 => 98, 250 => 97, 247 => 96, 245 => 95, 243 => 94, 239 => 93, 235 => 91, 231 => 90, 227 => 89, 223 => 88, 219 => 87, 215 => 86, 211 => 85, 205 => 84, 199 => 82, 197 => 81, 195 => 80, 189 => 78, 187 => 77, 184 => 76, 179 => 74, 177 => 73, 174 => 72, 167 => 68, 162 => 65, 154 => 61, 151 => 60, 144 => 56, 135 => 53, 132 => 52, 129 => 51, 127 => 50, 123 => 49, 119 => 48, 114 => 45, 110 => 44, 108 => 43, 102 => 40, 97 => 37, 89 => 33, 86 => 32, 79 => 28, 70 => 25, 67 => 24, 64 => 23, 62 => 22, 58 => 21, 54 => 20, 49 => 17, 43 => 14, 41 => 13, 39 => 12, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "columns_definitions/partitions.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/columns_definitions/partitions.twig");
}
}

View File

@@ -0,0 +1,65 @@
<?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/get_html_for_insert_edit_form_header.twig */
class __TwigTemplate_6b965c234ea03d43250a2e015c7fb944 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=\"insertForm\" class=\"lock-page";
echo (((($context["has_blob_field"] ?? null) && ($context["is_upload"] ?? null))) ? (" disableAjax") : (""));
echo "\" method=\"post\" action=\"";
echo PhpMyAdmin\Url::getFromRoute("/table/replace");
echo "\" name=\"insertForm\"";
echo ((($context["is_upload"] ?? null)) ? (" enctype=\"multipart/form-data\"") : (""));
echo ">";
}
public function getTemplateName()
{
return "table/insert/get_html_for_insert_edit_form_header.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "table/insert/get_html_for_insert_edit_form_header.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/insert/get_html_for_insert_edit_form_header.twig");
}
}

View 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");
}
}

View File

@@ -0,0 +1,81 @@
<?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;
/* sql/enum_column_dropdown.twig */
class __TwigTemplate_fe9ccad84ec94f5ed3dbc0e98a30bd23 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 "<select>
<option value=\"\">&nbsp;</option>
";
// line 3
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["values"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["value"]) {
// line 4
echo " <option value=\"";
echo $context["value"];
echo "\"";
echo ((twig_in_filter($context["value"], ($context["selected_values"] ?? null))) ? (" selected") : (""));
echo ">";
echo $context["value"];
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 6
echo "</select>
";
}
public function getTemplateName()
{
return "sql/enum_column_dropdown.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 58 => 6, 45 => 4, 41 => 3, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "sql/enum_column_dropdown.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/sql/enum_column_dropdown.twig");
}
}

View File

@@ -0,0 +1,643 @@
<?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/column_row.twig */
class __TwigTemplate_5d987e0c3be8e12755f389a9d36d94b8 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 "<tr class=\"noclick\">
<td class=\"text-center\">
";
// line 3
echo twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_title", [], "any", false, false, false, 3);
echo "
<input type=\"hidden\" name=\"fields_name[multi_edit][";
// line 4
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 4), "html", null, true);
echo "]\" value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field", [], "any", false, false, false, 4), "html", null, true);
echo "\">
</td>
";
// line 7
if (($context["show_field_types_in_data_edit_view"] ?? null)) {
// line 8
echo " <td class=\"text-center";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "wrap", [], "any", false, false, false, 8), "html", null, true);
echo "\">
<span class=\"column_type\" dir=\"ltr\">";
// line 9
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 9), "html", null, true);
echo "</span>
</td>
";
}
// line 12
echo "
";
// line 13
if (($context["show_function_fields"] ?? null)) {
// line 14
echo " ";
if (($context["is_column_binary"] ?? null)) {
// line 15
echo " <td class=\"text-center\">";
echo _gettext("Binary");
echo "</td>
";
} elseif ((twig_in_filter("enum", twig_get_attribute($this->env, $this->source, // line 16
($context["column"] ?? null), "True_Type", [], "any", false, false, false, 16)) || twig_in_filter("set", twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "True_Type", [], "any", false, false, false, 16)))) {
// line 17
echo " <td class=\"text-center\">--</td>
";
} else {
// line 19
echo " <td>
<select name=\"funcs[multi_edit][";
// line 20
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 20), "html", null, true);
echo "]\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 20));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 20), "html", null, true);
echo "')\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_1\">
";
// line 21
echo ($context["function_options"] ?? null);
echo "
</select>
</td>
";
}
// line 25
echo " ";
}
// line 26
echo "
<td>
";
// line 28
if (((twig_upper_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Null", [], "any", false, false, false, 28)) == "YES") && !($context["read_only"] ?? null))) {
// line 29
echo " <input type=\"hidden\" name=\"fields_null_prev[multi_edit][";
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 29), "html", null, true);
echo "]\"";
echo (((($context["real_null_value"] ?? null) && !twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "first_timestamp", [], "any", false, false, false, 29))) ? (" value=\"on\"") : (""));
echo ">
<input type=\"checkbox\" class=\"checkbox_null\" name=\"fields_null[multi_edit][";
// line 30
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 30), "html", null, true);
echo "]\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_2\" aria-label=\"";
echo _gettext("Use the NULL value for this column.");
echo "\"";
echo ((($context["real_null_value"] ?? null)) ? (" checked") : (""));
echo ">
<input type=\"hidden\" class=\"nullify_code\" name=\"nullify_code[multi_edit][";
// line 31
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 31), "html", null, true);
echo "]\" value=\"";
echo twig_escape_filter($this->env, ($context["nullify_code"] ?? null), "html", null, true);
echo "\">
<input type=\"hidden\" class=\"hashed_field\" name=\"hashed_field[multi_edit][";
// line 32
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 32), "html", null, true);
echo "]\" value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 32), "html", null, true);
echo "\">
<input type=\"hidden\" class=\"multi_edit\" name=\"multi_edit[multi_edit][";
// line 33
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 33), "html", null, true);
echo "]\" value=\"";
echo PhpMyAdmin\Sanitize::escapeJsString((("[multi_edit][" . ($context["row_id"] ?? null)) . "]"));
echo "\">
";
}
// line 35
echo " </td>
<td data-type=\"";
// line 37
echo twig_escape_filter($this->env, ($context["type"] ?? null), "html", null, true);
echo "\" data-decimals=\"";
echo twig_escape_filter($this->env, ($context["decimals"] ?? null), "html", null, true);
echo "\">
";
// line 39
echo " <span class=\"default_value hide\">";
echo ($context["special_chars"] ?? null);
echo "</span>
";
// line 41
if ( !twig_test_empty(($context["transformed_value"] ?? null))) {
// line 42
echo " ";
echo ($context["transformed_value"] ?? null);
echo "
";
} else {
// line 44
echo " ";
if (($context["is_value_foreign_link"] ?? null)) {
// line 45
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 46
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 46), "html", null, true);
echo "]\" value=\"foreign\">
<input type=\"text\" name=\"fields[multi_edit][";
// line 47
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 47), "html", null, true);
echo "]\" class=\"textfield\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 47));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 47), "html", null, true);
echo "')\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" value=\"";
echo twig_escape_filter($this->env, ($context["data"] ?? null), "html", null, true);
echo "\">
<a class=\"ajax browse_foreign\" href=\"";
// line 48
echo PhpMyAdmin\Url::getFromRoute("/browse-foreigners");
echo "\" data-post=\"";
echo PhpMyAdmin\Url::getCommon(["db" => ($context["db"] ?? null), "table" => ($context["table"] ?? null), "field" => twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field", [], "any", false, false, false, 48), "rownumber" => ($context["row_id"] ?? null), "data" => ($context["data"] ?? null)]);
echo "\">";
echo PhpMyAdmin\Html\Generator::getIcon("b_browse", _gettext("Browse foreign values"));
echo "</a>
";
} elseif ( !twig_test_empty( // line 49
($context["foreign_dropdown"] ?? null))) {
// line 50
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 51
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 51), "html", null, true);
echo "]\" value=\"";
echo ((twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "is_binary", [], "any", false, false, false, 51)) ? ("hex") : ("foreign"));
echo "\">
<select name=\"fields[multi_edit][";
// line 52
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 52), "html", null, true);
echo "]\" class=\"textfield\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 52));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 52), "html", null, true);
echo "')\">
";
// line 53
echo ($context["foreign_dropdown"] ?? null);
echo "
</select>
";
} elseif (((( // line 55
($context["longtext_double_textarea"] ?? null) && twig_in_filter("longtext", twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 55))) || twig_in_filter("json", twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 55))) || twig_in_filter("text", twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 55)))) {
// line 56
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<textarea name=\"fields[multi_edit][";
// line 57
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 57), "html", null, true);
echo "]\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" data-type=\"";
echo twig_escape_filter($this->env, ($context["data_type"] ?? null), "html", null, true);
echo "\" dir=\"";
echo twig_escape_filter($this->env, ($context["text_dir"] ?? null), "html", null, true);
echo "\" rows=\"";
echo twig_escape_filter($this->env, ($context["textarea_rows"] ?? null), "html", null, true);
echo "\" cols=\"";
echo twig_escape_filter($this->env, ($context["textarea_cols"] ?? null), "html", null, true);
echo "\"";
// line 58
((($context["max_length"] ?? null)) ? (print (twig_escape_filter($this->env, ((" data-maxlength=\"" . ($context["max_length"] ?? null)) . "\""), "html", null, true))) : (print ("")));
echo ((twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "is_char", [], "any", false, false, false, 58)) ? (" class=\"char charField\"") : (""));
echo " onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 58));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 58), "html", null, true);
echo "')\">";
// line 60
echo (((is_string($__internal_compile_0 = ($context["special_chars"] ?? null)) && is_string($__internal_compile_1 = "
") && ('' === $__internal_compile_1 || 0 === strpos($__internal_compile_0, $__internal_compile_1)))) ? ("
") : (""));
echo ($context["special_chars"] ?? null);
// line 61
echo "</textarea>
";
// line 62
if ((twig_in_filter("text", twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 62)) && (twig_length_filter($this->env, ($context["special_chars"] ?? null)) > 32000))) {
// line 63
echo " </td>
<td>
";
echo _gettext("Because of its length,<br> this column might not be editable.");
// line 66
echo " ";
}
// line 67
echo " ";
} elseif ((twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 67) == "enum")) {
// line 68
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 69
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 69), "html", null, true);
echo "]\" value=\"enum\">
";
// line 70
if ((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Type", [], "any", false, false, false, 70)) > 20)) {
// line 71
echo " <select name=\"fields[multi_edit][";
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 71), "html", null, true);
echo "]\" class=\"textfield\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 71));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 71), "html", null, true);
echo "')\">
<option value=\"\"></option>
";
// line 73
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "values", [], "any", false, false, false, 73));
foreach ($context['_seq'] as $context["_key"] => $context["enum_value"]) {
// line 74
echo " <option value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 74), "html", null, true);
echo "\"";
echo (((twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 74) == ($context["enum_selected_value"] ?? null))) ? (" selected") : (""));
echo ">";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 74), "html", null, true);
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['enum_value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 76
echo " </select>
";
} else {
// line 78
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "values", [], "any", false, false, false, 78));
$context['loop'] = [
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
];
if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
$length = count($context['_seq']);
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context["_key"] => $context["enum_value"]) {
// line 79
echo " <input type=\"radio\" name=\"fields[multi_edit][";
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 79), "html", null, true);
echo "]\" value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 79), "html", null, true);
echo "\" class=\"textfield\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3_";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 79), "html", null, true);
echo "\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 79));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 79), "html", null, true);
echo "')\"";
echo (((twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 79) == ($context["enum_selected_value"] ?? null))) ? (" checked") : (""));
echo ">
<label for=\"field_";
// line 80
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3_";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 80), "html", null, true);
echo "\">";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["enum_value"], "plain", [], "any", false, false, false, 80), "html", null, true);
echo "</label>
";
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if (isset($context['loop']['length'])) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['enum_value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 82
echo " ";
}
// line 83
echo " ";
} elseif ((twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 83) == "set")) {
// line 84
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 85
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 85), "html", null, true);
echo "]\" value=\"set\">
<select name=\"fields[multi_edit][";
// line 86
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 86), "html", null, true);
echo "][]\" class=\"textfield\" size=\"";
echo twig_escape_filter($this->env, ($context["set_select_size"] ?? null), "html", null, true);
echo "\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 86));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 86), "html", null, true);
echo "')\" multiple>
";
// line 87
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["set_values"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["set_value"]) {
// line 88
echo " <option value=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["set_value"], "plain", [], "any", false, false, false, 88), "html", null, true);
echo "\"";
echo ((twig_in_filter(twig_get_attribute($this->env, $this->source, $context["set_value"], "plain", [], "any", false, false, false, 88), twig_split_filter($this->env, ($context["data"] ?? null), ","))) ? (" selected") : (""));
echo ">";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["set_value"], "plain", [], "any", false, false, false, 88), "html", null, true);
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['set_value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 90
echo " </select>
";
} elseif ((twig_get_attribute($this->env, $this->source, // line 91
($context["column"] ?? null), "is_binary", [], "any", false, false, false, 91) || twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "is_blob", [], "any", false, false, false, 91))) {
// line 92
echo " ";
if (($context["is_column_protected_blob"] ?? null)) {
// line 93
echo " ";
echo _gettext("Binary - do not edit");
// line 94
echo " (";
echo twig_escape_filter($this->env, ($context["blob_value"] ?? null), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ($context["blob_value_unit"] ?? null), "html", null, true);
echo ")
<input type=\"hidden\" name=\"fields[multi_edit][";
// line 95
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 95), "html", null, true);
echo "]\" value=\"\">
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 96
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 96), "html", null, true);
echo "]\" value=\"protected\">
";
} elseif ((twig_get_attribute($this->env, $this->source, // line 97
($context["column"] ?? null), "is_blob", [], "any", false, false, false, 97) || (twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "len", [], "any", false, false, false, 97) > ($context["limit_chars"] ?? null)))) {
// line 98
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 99
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 99), "html", null, true);
echo "]\" value=\"hex\">
<textarea name=\"fields[multi_edit][";
// line 100
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 100), "html", null, true);
echo "]\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" data-type=\"HEX\" dir=\"";
echo twig_escape_filter($this->env, ($context["text_dir"] ?? null), "html", null, true);
echo "\" rows=\"";
echo twig_escape_filter($this->env, ($context["textarea_rows"] ?? null), "html", null, true);
echo "\" cols=\"";
echo twig_escape_filter($this->env, ($context["textarea_cols"] ?? null), "html", null, true);
echo "\"";
// line 101
((($context["max_length"] ?? null)) ? (print (twig_escape_filter($this->env, ((" data-maxlength=\"" . ($context["max_length"] ?? null)) . "\""), "html", null, true))) : (print ("")));
echo ((twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "is_char", [], "any", false, false, false, 101)) ? (" class=\"char charField\"") : (""));
echo " onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 101));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 101), "html", null, true);
echo "')\">";
// line 103
echo (((is_string($__internal_compile_2 = ($context["special_chars"] ?? null)) && is_string($__internal_compile_3 = "
") && ('' === $__internal_compile_3 || 0 === strpos($__internal_compile_2, $__internal_compile_3)))) ? ("
") : (""));
echo ($context["special_chars"] ?? null);
// line 104
echo "</textarea>
";
} else {
// line 106
echo " ";
echo ($context["backup_field"] ?? null);
echo "
<input type=\"hidden\" name=\"fields_type[multi_edit][";
// line 107
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 107), "html", null, true);
echo "]\" value=\"hex\">
";
// line 108
echo ($context["input_field_html"] ?? null);
echo "
";
}
// line 110
echo " ";
if ((($context["is_upload"] ?? null) && twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "is_blob", [], "any", false, false, false, 110))) {
// line 111
echo " <br>
";
// line 113
echo " <input type=\"file\" name=\"fields_upload[multi_edit][";
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "][";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 113), "html", null, true);
echo "]\" class=\"textfield noDragDrop\" id=\"field_";
echo twig_escape_filter($this->env, ($context["id_index"] ?? null), "html", null, true);
echo "_3\" size=\"10\" onchange=\"return verificationsAfterFieldChange('";
echo PhpMyAdmin\Sanitize::escapeJsString(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "Field_md5", [], "any", false, false, false, 113));
echo "', '";
echo PhpMyAdmin\Sanitize::escapeJsString(($context["row_id"] ?? null));
echo "', '";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 113), "html", null, true);
echo "')\">
";
// line 114
echo twig_escape_filter($this->env, ($context["max_upload_size"] ?? null), "html", null, true);
echo "
";
}
// line 116
echo " ";
echo ($context["select_option_for_upload"] ?? null);
echo "
";
} else {
// line 118
echo " ";
echo ($context["value"] ?? null);
echo "
";
}
// line 120
echo "
";
// line 121
if (twig_in_filter(twig_get_attribute($this->env, $this->source, ($context["column"] ?? null), "pma_type", [], "any", false, false, false, 121), ($context["gis_data_types"] ?? null))) {
// line 122
echo " <span class=\"open_gis_editor\" data-row-id=\"";
echo twig_escape_filter($this->env, ($context["row_id"] ?? null), "html", null, true);
echo "\">";
echo PhpMyAdmin\Html\Generator::linkOrButton("#", null, PhpMyAdmin\Html\Generator::getIcon("b_edit", _gettext("Edit/Insert")), [], "_blank");
echo "</span>
";
}
// line 124
echo " ";
}
// line 125
echo " </td>
</tr>
";
}
public function getTemplateName()
{
return "table/insert/column_row.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 619 => 125, 616 => 124, 608 => 122, 606 => 121, 603 => 120, 597 => 118, 591 => 116, 586 => 114, 571 => 113, 568 => 111, 565 => 110, 560 => 108, 554 => 107, 549 => 106, 545 => 104, 540 => 103, 530 => 101, 517 => 100, 511 => 99, 506 => 98, 504 => 97, 498 => 96, 492 => 95, 485 => 94, 482 => 93, 479 => 92, 477 => 91, 474 => 90, 461 => 88, 457 => 87, 441 => 86, 435 => 85, 430 => 84, 427 => 83, 424 => 82, 404 => 80, 383 => 79, 365 => 78, 361 => 76, 348 => 74, 344 => 73, 328 => 71, 326 => 70, 320 => 69, 315 => 68, 312 => 67, 309 => 66, 304 => 63, 302 => 62, 299 => 61, 294 => 60, 284 => 58, 269 => 57, 264 => 56, 262 => 55, 257 => 53, 243 => 52, 235 => 51, 230 => 50, 228 => 49, 220 => 48, 204 => 47, 198 => 46, 193 => 45, 190 => 44, 184 => 42, 182 => 41, 176 => 39, 170 => 37, 166 => 35, 157 => 33, 149 => 32, 141 => 31, 129 => 30, 120 => 29, 118 => 28, 114 => 26, 111 => 25, 104 => 21, 90 => 20, 87 => 19, 83 => 17, 81 => 16, 76 => 15, 73 => 14, 71 => 13, 68 => 12, 62 => 9, 57 => 8, 55 => 7, 45 => 4, 41 => 3, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "table/insert/column_row.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/insert/column_row.twig");
}
}

View File

@@ -0,0 +1,517 @@
<?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/index_form.twig */
class __TwigTemplate_0a7062f57794a5824975cb8d2f846971 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 action=\"";
echo PhpMyAdmin\Url::getFromRoute("/table/indexes");
echo "\"
method=\"post\"
name=\"index_frm\"
id=\"index_frm\"
class=\"ajax\">
";
// line 7
echo PhpMyAdmin\Url::getHiddenInputs(($context["form_params"] ?? null));
echo "
";
// line 8
if (($context["is_from_nav"] ?? null)) {
// line 9
echo " <input type=\"hidden\" name=\"do_save_data\" value=\"1\">
";
}
// line 11
echo "
<fieldset class=\"pma-fieldset\" id=\"index_edit_fields\">
<div class=\"index_info\">
<div>
<div class=\"label\">
<strong>
<label for=\"input_index_name\">
";
echo _gettext("Index name:");
// line 19
echo " ";
echo PhpMyAdmin\Html\Generator::showHint(_gettext("\"PRIMARY\" <b>must</b> be the name of and <b>only of</b> a primary key!"));
echo "
</label>
</strong>
</div>
<input type=\"text\"
name=\"index[Key_name]\"
id=\"input_index_name\"
size=\"25\"
maxlength=\"64\"
value=\"";
// line 29
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getName", [], "method", false, false, false, 29), "html", null, true);
echo "\"
onfocus=\"this.select()\">
</div>
<div>
<div class=\"label\">
<strong>
<label for=\"select_index_choice\">
";
echo _gettext("Index choice:");
// line 38
echo " ";
echo PhpMyAdmin\Html\MySQLDocumentation::show("ALTER_TABLE");
echo "
</label>
</strong>
</div>
<select name=\"index[Index_choice]\" id=\"select_index_choice\"";
// line 43
echo ((($context["create_edit_table"] ?? null)) ? (" disabled") : (""));
echo ">
";
// line 44
if (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 44) == "PRIMARY") || !twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "hasPrimary", [], "method", false, false, false, 44))) {
// line 45
echo " <option value=\"PRIMARY\"";
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 45) == "PRIMARY")) ? (" selected") : (""));
echo ">PRIMARY</option>
";
}
// line 47
echo " <option value=\"INDEX\"";
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 47) == "INDEX")) ? (" selected") : (""));
echo ">INDEX</option>
<option value=\"UNIQUE\"";
// line 48
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 48) == "UNIQUE")) ? (" selected") : (""));
echo ">UNIQUE</option>
<option value=\"SPATIAL\"";
// line 49
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 49) == "SPATIAL")) ? (" selected") : (""));
echo ">SPATIAL</option>
<option value=\"FULLTEXT\"";
// line 50
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 50) == "FULLTEXT")) ? (" selected") : (""));
echo ">FULLTEXT</option>
</select>
</div>
";
// line 54
if ((($context["default_sliders_state"] ?? null) != "disabled")) {
// line 55
echo " <div class=\"mb-3\">
<button class=\"btn btn-sm btn-secondary\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#advancedOptions\" aria-expanded=\"";
// line 56
echo (((($context["default_sliders_state"] ?? null) == "open")) ? ("true") : ("false"));
echo "\" aria-controls=\"advancedOptions\">
";
echo _gettext("Advanced options");
// line 58
echo " </button>
</div>
<div class=\"collapse mb-3";
// line 60
echo (((($context["default_sliders_state"] ?? null) == "open")) ? (" show") : (""));
echo "\" id=\"advancedOptions\">
";
}
// line 62
echo "
<div>
<div class=\"label\">
<strong>
<label for=\"input_key_block_size\">
";
echo _gettext("Key block size:");
// line 68
echo " </label>
</strong>
</div>
<input type=\"text\"
name=\"index[Key_block_size]\"
id=\"input_key_block_size\"
size=\"30\"
value=\"";
// line 76
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getKeyBlockSize", [], "method", false, false, false, 76), "html", null, true);
echo "\">
</div>
<div>
<div class=\"label\">
<strong>
<label for=\"select_index_type\">
";
echo _gettext("Index type:");
// line 85
echo " ";
echo PhpMyAdmin\Html\MySQLDocumentation::show("ALTER_TABLE");
echo "
</label>
</strong>
</div>
<select name=\"index[Index_type]\" id=\"select_index_type\">
";
// line 91
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable([0 => "", 1 => "BTREE", 2 => "HASH"]);
foreach ($context['_seq'] as $context["_key"] => $context["index_type"]) {
// line 92
echo " <option value=\"";
echo twig_escape_filter($this->env, $context["index_type"], "html", null, true);
echo "\"";
echo (((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getType", [], "method", false, false, false, 92) == $context["index_type"])) ? (" selected") : (""));
echo ">";
echo twig_escape_filter($this->env, $context["index_type"], "html", null, true);
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['index_type'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 94
echo " </select>
</div>
<div>
<div class=\"label\">
<strong>
<label for=\"input_parser\">
";
echo _gettext("Parser:");
// line 102
echo " </label>
</strong>
</div>
<input type=\"text\"
name=\"index[Parser]\"
id=\"input_parse\"
size=\"30\"
value=\"";
// line 110
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getParser", [], "method", false, false, false, 110), "html", null, true);
echo "\">
</div>
<div>
<div class=\"label\">
<strong>
<label for=\"input_index_comment\">
";
echo _gettext("Comment:");
// line 118
echo " </label>
</strong>
</div>
<input type=\"text\"
name=\"index[Index_comment]\"
id=\"input_index_comment\"
size=\"30\"
maxlength=\"1024\"
value=\"";
// line 127
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getComment", [], "method", false, false, false, 127), "html", null, true);
echo "\">
</div>
";
// line 130
if ((($context["default_sliders_state"] ?? null) != "disabled")) {
// line 131
echo " </div>
";
}
// line 133
echo "
<div class=\"clearfloat\"></div>
<table class=\"table align-middle\" id=\"index_columns\">
<thead>
<tr>
<th></th>
<th>
";
echo _gettext("Column");
// line 142
echo " </th>
<th>
";
echo _gettext("Size");
// line 145
echo " </th>
</tr>
</thead>
";
// line 148
$context["spatial_types"] = [0 => "geometry", 1 => "point", 2 => "linestring", 3 => "polygon", 4 => "multipoint", 5 => "multilinestring", 6 => "multipolygon", 7 => "geomtrycollection"];
// line 158
echo " <tbody>
";
// line 159
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getColumns", [], "method", false, false, false, 159));
foreach ($context['_seq'] as $context["_key"] => $context["column"]) {
// line 160
echo " <tr class=\"noclick\">
<td>
<span class=\"drag_icon\" title=\"";
echo _gettext("Drag to reorder");
// line 162
echo "\"></span>
</td>
<td>
<select name=\"index[columns][names][]\">
<option value=\"\">
-- ";
echo _gettext("Ignore");
// line 167
echo " --
</option>
";
// line 169
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["fields"] ?? null));
foreach ($context['_seq'] as $context["field_name"] => $context["field_type"]) {
// line 170
echo " ";
if ((((twig_get_attribute($this->env, $this->source, ($context["index"] ?? null), "getChoice", [], "method", false, false, false, 170) != "FULLTEXT") || twig_matches("/(char|text)/i", // line 171
$context["field_type"])) && ((twig_get_attribute($this->env, $this->source, // line 172
($context["index"] ?? null), "getChoice", [], "method", false, false, false, 172) != "SPATIAL") || twig_in_filter( // line 173
$context["field_type"], ($context["spatial_types"] ?? null))))) {
// line 174
echo "
<option value=\"";
// line 175
echo twig_escape_filter($this->env, $context["field_name"], "html", null, true);
echo "\"";
// line 176
if (($context["field_name"] == twig_get_attribute($this->env, $this->source, $context["column"], "getName", [], "method", false, false, false, 176))) {
// line 177
echo " selected=\"selected\"";
}
// line 178
echo ">
";
// line 179
echo twig_escape_filter($this->env, $context["field_name"], "html", null, true);
echo " [";
echo twig_escape_filter($this->env, $context["field_type"], "html", null, true);
echo "]
</option>
";
}
// line 182
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['field_name'], $context['field_type'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 183
echo " </select>
</td>
<td>
<input type=\"text\"
size=\"5\"
onfocus=\"this.select()\"
name=\"index[columns][sub_parts][]\"
value=\"";
// line 191
(((twig_get_attribute($this->env, $this->source, // line 190
($context["index"] ?? null), "getChoice", [], "method", false, false, false, 190) != "SPATIAL")) ? (print (twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, // line 191
$context["column"], "getSubPart", [], "method", false, false, false, 191), "html", null, true))) : (print ("")));
echo "\">
</td>
</tr>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['column'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 195
echo " ";
if ((($context["add_fields"] ?? null) > 0)) {
// line 196
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(range(1, ($context["add_fields"] ?? null)));
foreach ($context['_seq'] as $context["_key"] => $context["i"]) {
// line 197
echo " <tr class=\"noclick\">
<td>
<span class=\"drag_icon\" title=\"";
echo _gettext("Drag to reorder");
// line 199
echo "\"></span>
</td>
<td>
<select name=\"index[columns][names][]\">
<option value=\"\">-- ";
echo _gettext("Ignore");
// line 203
echo " --</option>
";
// line 204
$context["j"] = 0;
// line 205
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["fields"] ?? null));
foreach ($context['_seq'] as $context["field_name"] => $context["field_type"]) {
// line 206
echo " ";
if (($context["create_edit_table"] ?? null)) {
// line 207
echo " ";
$context["col_index"] = (($__internal_compile_0 = $context["field_type"]) && is_array($__internal_compile_0) || $__internal_compile_0 instanceof ArrayAccess ? ($__internal_compile_0[1] ?? null) : null);
// line 208
echo " ";
$context["field_type"] = (($__internal_compile_1 = $context["field_type"]) && is_array($__internal_compile_1) || $__internal_compile_1 instanceof ArrayAccess ? ($__internal_compile_1[0] ?? null) : null);
// line 209
echo " ";
}
// line 210
echo " ";
$context["j"] = (($context["j"] ?? null) + 1);
// line 211
echo " <option value=\"";
echo twig_escape_filter($this->env, ((array_key_exists("col_index", $context)) ? ( // line 212
($context["col_index"] ?? null)) : ($context["field_name"])), "html", null, true);
echo "\"";
// line 213
echo (((($context["j"] ?? null) == $context["i"])) ? (" selected=\"selected\"") : (""));
echo ">
";
// line 214
echo twig_escape_filter($this->env, $context["field_name"], "html", null, true);
echo " [";
echo twig_escape_filter($this->env, $context["field_type"], "html", null, true);
echo "]
</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['field_name'], $context['field_type'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 217
echo " </select>
</td>
<td>
<input type=\"text\"
size=\"5\"
onfocus=\"this.select()\"
name=\"index[columns][sub_parts][]\"
value=\"\">
</td>
</tr>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['i'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 228
echo " ";
}
// line 229
echo " </tbody>
</table>
<div class=\"add_more\">
<div class=\"slider\"></div>
<div class=\"add_fields hide\">
<input class=\"btn btn-secondary\" type=\"submit\"
id=\"add_fields\"
value=\"";
// line 237
echo twig_escape_filter($this->env, twig_sprintf(_gettext("Add %s column(s) to index"), 1), "html", null, true);
echo "\">
</div>
</div>
</div>
</fieldset>
";
// line 243
if ( !($context["create_edit_table"] ?? null)) {
// line 244
echo "<fieldset class=\"pma-fieldset tblFooters\">
<button class=\"btn btn-primary\" type=\"submit\">";
echo _gettext("Go");
// line 245
echo "</button>
<button class=\"btn btn-secondary\" type=\"submit\" id=\"preview_index_frm\">";
echo _gettext("Preview SQL");
// line 246
echo "</button>
</fieldset>";
}
// line 249
echo "</form>
";
// line 250
if (($context["is_from_nav"] ?? null)) {
// line 251
echo " ";
echo twig_include($this->env, $context, "modals/preview_sql_modal.twig");
echo "
";
}
}
public function getTemplateName()
{
return "table/index_form.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 491 => 251, 489 => 250, 486 => 249, 482 => 246, 478 => 245, 474 => 244, 472 => 243, 464 => 237, 454 => 229, 451 => 228, 435 => 217, 424 => 214, 420 => 213, 417 => 212, 415 => 211, 412 => 210, 409 => 209, 406 => 208, 403 => 207, 400 => 206, 395 => 205, 393 => 204, 390 => 203, 383 => 199, 378 => 197, 373 => 196, 370 => 195, 360 => 191, 359 => 190, 358 => 191, 349 => 183, 343 => 182, 335 => 179, 332 => 178, 329 => 177, 327 => 176, 324 => 175, 321 => 174, 319 => 173, 318 => 172, 317 => 171, 315 => 170, 311 => 169, 307 => 167, 299 => 162, 294 => 160, 290 => 159, 287 => 158, 285 => 148, 280 => 145, 275 => 142, 264 => 133, 260 => 131, 258 => 130, 252 => 127, 241 => 118, 230 => 110, 220 => 102, 210 => 94, 197 => 92, 193 => 91, 183 => 85, 171 => 76, 161 => 68, 153 => 62, 148 => 60, 144 => 58, 139 => 56, 136 => 55, 134 => 54, 127 => 50, 123 => 49, 119 => 48, 114 => 47, 108 => 45, 106 => 44, 102 => 43, 93 => 38, 81 => 29, 67 => 19, 57 => 11, 53 => 9, 51 => 8, 47 => 7, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "table/index_form.twig", "/home/suvo/web/graffin.ns77.siliconpin.com/public_html/pma/templates/table/index_form.twig");
}
}