diff --git a/CONTENT/ROOT_URI/Admin/ADMIN_nav.php b/CONTENT/ROOT_URI/Admin/ADMIN_nav.php index 1379802..4b24bc3 100644 --- a/CONTENT/ROOT_URI/Admin/ADMIN_nav.php +++ b/CONTENT/ROOT_URI/Admin/ADMIN_nav.php @@ -59,21 +59,45 @@ date_default_timezone_set('Asia/Kolkata'); - \ No newline at end of file + diff --git a/CONTENT/ROOT_URI/Admin/Report.php b/CONTENT/ROOT_URI/Admin/Report.php index ddd8b73..21af0bd 100644 --- a/CONTENT/ROOT_URI/Admin/Report.php +++ b/CONTENT/ROOT_URI/Admin/Report.php @@ -28,7 +28,7 @@ while($a = $agents->fetch_assoc()){ $selected = (isset($_GET['agent']) && $_GET['agent']==$a['user_id']) ? "selected" : ""; echo ""; - } + } } ?> @@ -113,11 +113,12 @@ function report_view($type, $dt) { $result = $conn->query($sql); if ($result && $result->num_rows > 0) { while($row = $result->fetch_assoc()) { + $kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes")); echo " ".$row["AT_ID"]." ".($_SESSION['type'] === 'admin' ? "".$row["AA_AGENT"]."" : "")." - ".$row["AT_TIMESTAMP"]." + ".$kolkataTime." ".$row["AT_ACID"]." ".$row["AA_NAME"]." ".$row["AT_AMOUNT"]." diff --git a/CONTENT/ROOT_URI/Admin/Settings_Agent.php b/CONTENT/ROOT_URI/Admin/Settings_Agent.php index dd22369..eb3b406 100644 --- a/CONTENT/ROOT_URI/Admin/Settings_Agent.php +++ b/CONTENT/ROOT_URI/Admin/Settings_Agent.php @@ -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 "
User {$user_name} added successfully.
"; - } else { - echo "
Failed to add user {$user_name}. Error: " . $stmt->error . "
"; - } - - $stmt->close(); - $conn->close(); + if ($stmt->execute()) { + $success = "User {$user_name} 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 @@

Add New Agent


-
+
@@ -84,17 +98,27 @@
- + + - +
+ +
+
+ + +
@@ -115,10 +139,12 @@ ID + Profile User ID User Type Name Phone + Comi Rate (%) Actions @@ -127,6 +153,14 @@ + + + + + + No Photo + + @@ -135,6 +169,7 @@ + Edit @@ -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'; + } + + + } diff --git a/CONTENT/ROOT_URI/Admin/Trans_New.php b/CONTENT/ROOT_URI/Admin/Trans_New.php index e8b1349..5d69abd 100644 --- a/CONTENT/ROOT_URI/Admin/Trans_New.php +++ b/CONTENT/ROOT_URI/Admin/Trans_New.php @@ -382,11 +382,12 @@ if(isset($_GET["no"])){ if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { //$ID=$row["GC_ID"]; + $kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes")); echo " ".$rowcount. " ".$row["AT_ID"]. " - ".$row["AT_TIMESTAMP"]. " + ".$kolkataTime. " ".$row["AT_ADMIN"]. " ".$row["AT_ACID"]. " ".$row["AT_AMOUNT"]. " diff --git a/CONTENT/ROOT_URI/Admin/View_AC.php b/CONTENT/ROOT_URI/Admin/View_AC.php index 1c39da7..99394c0 100644 --- a/CONTENT/ROOT_URI/Admin/View_AC.php +++ b/CONTENT/ROOT_URI/Admin/View_AC.php @@ -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') { diff --git a/CONTENT/ROOT_URI/Admin/agent_View_report.php b/CONTENT/ROOT_URI/Admin/agent_View_report.php index e290315..e026297 100644 --- a/CONTENT/ROOT_URI/Admin/agent_View_report.php +++ b/CONTENT/ROOT_URI/Admin/agent_View_report.php @@ -1,120 +1,118 @@ -
- - - - - - -
..
- - - - - - -
- - -

'.$dateFrom." -> ".$dateTo."(Up to)

"; - -$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']); -if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); - -$totalAmount=0; -$agent="";if(isset($_POST['Agent'])) $agent=$_POST['Agent']; else $agent=$_SESSION['EMAIL']; - -echo ' -
-
VIEW REPORT::::::::

-
-
- - - - - - - - - '; - - - $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 " - - - - - - - - ";$totalAmount+=$row["AT_AMOUNT"]; - } - } else { - echo "0 results"; - } - $conn->close(); - -echo ' -
Transaction IDTimeAC NoNameAmountcommission
".$row["AT_ID"]. "".$row["AT_TIMESTAMP"]. "".$row["AT_ACID"]. "".$row["AA_NAME"]. "".$row["AT_AMOUNT"]. "".$row["AT_AMOUNT"]/100*2.5 . "
-

Total Transaction amount : '.$totalAmount.'

-

Total Commission amount : '.$totalAmount/100*2.5 .'

-
-'; -} - -if(isset($_POST['tday']) && $_POST['tday']!="") report_view('day',$_POST['tday']); -if(isset($_POST['tmonth']) && $_POST['tmonth']!="") report_view('month',$_POST['tmonth']); -if(isset($_POST['dFrom']) && $_POST['dTo']!="") report_view($_POST['dTo'],$_POST['dFrom']); - -//if(isset($_GET['Type']) && $_GET['Type']=="Loan") view_list_ac('Loan'); -// if(isset($_GET['Type']) && $_GET['Type']=="Recurring") view_list_ac('Recurring'); -// if(isset($_GET['Type']) && $_GET['Type']=="FD") view_list_ac('FD'); +// ---- Default date range ---- +$today = date("Y-m-d"); // Today date +$monthStart = date("Y-m-01"); // first date of each month +$dFrom = $_GET['dFrom'] ?? $monthStart; +$dTo = $_GET['dTo'] ?? $today; +?> + +
+
+

Commission Report

+
+
+ + +
+
+ + +
+
+ +
+
+
+
+ + + +
+
Commission Report: '.$dateFrom." → ".$dateTo.'
+
+
'; + + $conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']); + if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); + + // ---- Login user type check ---- + $loginType = $_SESSION['type'] ?? ''; // login session-এ type আছে + $loginId = $_SESSION['user_id']; // login user_id + + // ---- Base Query ---- + $sql = "SELECT u.user_id, u.user_name, u.comi_rate, COALESCE(SUM(t.AT_AMOUNT),0) as total_amount FROM `".$GLOBALS['arif_users']."` u LEFT JOIN `".$GLOBALS['arif_ac']."` a ON u.user_id = a.AA_AGENT LEFT JOIN `".$GLOBALS['arif_tran']."` t ON a.AA_ACNO = t.AT_ACID AND t.AT_TIMESTAMP BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59' WHERE u.type = 'agent'"; + + // ---- if Agent self data filter ---- + if ($loginType === 'agent') { + $sql .= " AND u.user_id = '".$loginId."'"; + } + + $sql .= " GROUP BY u.user_id, u.user_name, u.comi_rate ORDER BY u.user_name ASC"; + + $result = $conn->query($sql); + + echo ' +
+
+
+
+ + + + + + + + + + '; + + $grandTotalCommission = 0; + $grandTotalCollection = 0; + + if ($result && $result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $collection = $row["total_amount"]; + $commission = ($collection * $row["comi_rate"]) / 100; + + $grandTotalCollection += $collection; + $grandTotalCommission += $commission; + + echo " + + + + + + "; + } + } else { + echo ""; + } + + echo ' + +
Agent IDAgent NameTotal CollectionTotal Commission
".$row["user_id"]."".$row["user_name"]."".number_format($collection,2)."".number_format($commission,2)."
No agents found
'; + + // ---- if admin/bm then show grand total ---- + if ($loginType !== 'agent') { + echo '
+ Grand Total Collection : '.number_format($grandTotalCollection,2).'
+ Grand Total Commission : '.number_format($grandTotalCommission,2).' +
'; + } + + echo ' +
+
+
+ '; + + $conn->close(); +} + +// ---- Call commission function ---- +commission_report($dFrom, $dTo); ?> diff --git a/CONTENT/ROOT_URI/Admin/edit_user.php b/CONTENT/ROOT_URI/Admin/edit_user.php index 43094ed..fd86b3f 100644 --- a/CONTENT/ROOT_URI/Admin/edit_user.php +++ b/CONTENT/ROOT_URI/Admin/edit_user.php @@ -1,10 +1,5 @@ prepare($sql); - $stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $password, $id); + $stmt->bind_param("ssssssi", $user_id, $user_name, $user_phone, $type, $password, $profilePicPath, $id); } else { - // Update without password - $sql = "UPDATE `".$GLOBALS['arif_users']."` SET - user_id = ?, - user_name = ?, - user_phone = ?, - type = ? + $sql = "UPDATE `".$GLOBALS['arif_users']."` + SET user_id = ?, user_name = ?, user_phone = ?, type = ?, profile_pic = ? WHERE id = ?"; $stmt = $conn->prepare($sql); - $stmt->bind_param("ssssi", $user_id, $user_name, $user_phone, $type, $id); + $stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $profilePicPath, $id); } if ($stmt->execute()) { @@ -99,7 +106,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { -
+
@@ -114,6 +121,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ +
+
+ +
+ + +
@@ -133,21 +148,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-
-
-
- - - Password must be at least 8 characters long -
-
+
+ + + Password must be at least 8 characters long
-
-
- - Cancel -
+
+ + Cancel
@@ -165,19 +174,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } }); - -close(); ?> \ No newline at end of file +close(); ?> diff --git a/CONTENT/ROOT_URI/Admin/login.php b/CONTENT/ROOT_URI/Admin/login.php index d6916d2..c4344b8 100644 --- a/CONTENT/ROOT_URI/Admin/login.php +++ b/CONTENT/ROOT_URI/Admin/login.php @@ -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 "
Login successful. Redirecting...
"; echo ""; diff --git a/CONTENT/ROOT_URI/Admin/picture/1756899147_new_logo2.jpg b/CONTENT/ROOT_URI/Admin/picture/1756899147_new_logo2.jpg new file mode 100644 index 0000000..3f47010 Binary files /dev/null and b/CONTENT/ROOT_URI/Admin/picture/1756899147_new_logo2.jpg differ diff --git a/CONTENT/ROOT_URI/Admin/picture/1756900298_passport-photo-333.jpg b/CONTENT/ROOT_URI/Admin/picture/1756900298_passport-photo-333.jpg new file mode 100644 index 0000000..d29158f Binary files /dev/null and b/CONTENT/ROOT_URI/Admin/picture/1756900298_passport-photo-333.jpg differ diff --git a/CONTENT/ROOT_URI/Admin/picture/1756901024_gratisography-augmented-reality-800x525.jpg b/CONTENT/ROOT_URI/Admin/picture/1756901024_gratisography-augmented-reality-800x525.jpg new file mode 100644 index 0000000..e46e22c Binary files /dev/null and b/CONTENT/ROOT_URI/Admin/picture/1756901024_gratisography-augmented-reality-800x525.jpg differ diff --git a/pma/tmp/twig/cf/cf151a987d451dbed37630dfabb6c91d.php b/pma/tmp/twig/cf/cf151a987d451dbed37630dfabb6c91d.php new file mode 100644 index 0000000..e46a196 --- /dev/null +++ b/pma/tmp/twig/cf/cf151a987d451dbed37630dfabb6c91d.php @@ -0,0 +1,119 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo "
+ "; + // line 2 + echo PhpMyAdmin\Url::getHiddenInputs(($context["db"] ?? null), ($context["table"] ?? null)); + echo " + env, ($context["goto"] ?? null), "html", null, true); + echo "\"> + env, ($context["err_url"] ?? null), "html", null, true); + echo "\"> + 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 " 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 " 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 " +
+"; + } + + 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"); + } +}