Skip to content

Commit 60d06f8

Browse files
committed
2 parents 0e34ecd + f09e8d5 commit 60d06f8

File tree

7 files changed

+310
-112
lines changed

7 files changed

+310
-112
lines changed

admin/Asset/js/pages/dashboard.init.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
var sh1_staff = document.getElementById("sh1_staff_am").value;
1212
var sh2_staff = document.getElementById("sh2_staff_am").value;
1313
var sh3_staff = document.getElementById("sh3_staff_am").value;
14-
1514
var e = function () {};
1615

1716
(e.prototype.respChart = function (e, r, a, t) {
@@ -119,13 +118,10 @@
119118
xAxes: [{ gridLines: { color: "rgba(0,0,0,0.1)" } }],
120119
},
121120
}
122-
);
121+
);
123122

124123
}),
124+
125125
(i.ChartJs = new e()),
126126
(i.ChartJs.Constructor = e);
127127
})(window.jQuery),
128-
(function (e) {
129-
"use strict";
130-
window.jQuery.ChartJs.init();
131-
})();

admin/Controller/Order/order_c.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function __construct()
1111
$this->order = new Order_m();
1212
}
1313

14-
public function getAmountOfOrder() {
14+
public function Order() {
1515

1616
$order = $this->order->getAmountOfOrder();
1717
$getDetailOrder = $this->order->getDetailOrder();
@@ -36,6 +36,20 @@ public function getAmountOfOrder() {
3636
$avgAmountCustomerSh2 = $this->order->avgAmountCustomerSh2();
3737
$avgAmountCustomerSh3 = $this->order->avgAmountCustomerSh3();
3838
$amountOfProduct = $this->order->amountOfProduct();
39+
40+
$personalAmount = $this->order->personalAmount($_SESSION['id']);
41+
42+
$sumBonus = $this->order->sumBonus($_SESSION['id']);
43+
44+
$personalProductAmount = $this->order->personalProductAmount($_SESSION['id']);
45+
46+
$personalCustomerBeingCare = $this->order->personalCustomerBeingCare($_SESSION['id']);
47+
48+
$personalTotalCustomer = $this->order->personalTotalCustomer($_SESSION['id']);
49+
50+
$personalTransference = $this->order->personalTransference($_SESSION['id']);
51+
52+
$getShowroomId = $this->order->getShowroomId($_SESSION['id']);
3953
include_once("View/Dashboard/dashboard.php");
4054

4155
}

admin/Includes/footer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
2626
<script src="Asset/js/pages/dashboard.init.js"></script>
27-
27+
2828
<!-- Tost-->
2929
<script src="Asset/libs/jquery-toast/jquery.toast.min.js"></script>
3030

admin/Model/Order/order_m.php

+109
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,113 @@ protected function sh3StaffAmount() {
281281

282282
}
283283

284+
protected function personalAmount($id) {
285+
286+
$sql = "SELECT user_id FROM tbl_detail WHERE user_id = :id";
287+
288+
$pre = $this->pdo->prepare($sql);
289+
290+
$pre->bindParam(":id", $id);
291+
292+
$pre->execute();
293+
294+
return $pre->rowCount();
295+
296+
}
297+
298+
protected function sumBonus($id) {
299+
300+
$sql = "SELECT SUM(bonus) from tbl_bonus WHERE user_id = :id";
301+
302+
$pre = $this->pdo->prepare($sql);
303+
304+
$pre->bindParam(":id", $id);
305+
306+
$pre->execute();
307+
308+
$row = $pre->fetch(PDO::FETCH_ASSOC);
309+
310+
return $sum = $row['SUM(bonus)'];
311+
312+
}
313+
314+
protected function personalProductAmount($id) {
315+
316+
$sql = "SELECT order_id FROM tbl_bonus WHERE user_id = :id";
317+
318+
$pre = $this->pdo->prepare($sql);
319+
320+
$pre->bindParam(":id", $id);
321+
322+
$pre->execute();
323+
324+
return $pre->rowCount();
325+
326+
}
327+
328+
protected function personalCustomerBeingCare($id) {
329+
330+
$sql = "SELECT user_id FROM tbl_care WHERE user_id = $id AND status = 1";
331+
332+
$pre = $this->pdo->prepare($sql);
333+
334+
$pre->bindParam(":id", $id);
335+
336+
$pre->execute();
337+
338+
return $pre->rowCount();
339+
340+
}
341+
342+
protected function personalTotalCustomer($id) {
343+
344+
$sql = "SELECT user_id FROM tbl_care WHERE user_id = $id";
345+
346+
$pre = $this->pdo->prepare($sql);
347+
348+
$pre->bindParam(":id", $id);
349+
350+
$pre->execute();
351+
352+
return $pre->rowCount();
353+
354+
}
355+
356+
protected function personalTransference($id) {
357+
358+
$sql = "SELECT user_id_move FROM tbl_history WHERE user_id_move = $id";
359+
360+
$pre = $this->pdo->prepare($sql);
361+
362+
$pre->bindParam(":id", $id);
363+
364+
$pre->execute();
365+
366+
return $pre->rowCount();
367+
368+
}
369+
370+
protected function getShowroomId($id) {
371+
372+
$sql = "SELECT * FROM tbl_user, tbl_showroom
373+
WHERE id = :id AND tbl_user.showroom_id = tbl_showroom.showroom_id";
374+
375+
$pre = $this->pdo->prepare($sql);
376+
377+
$pre->bindParam(":id", $id);
378+
379+
$pre->execute();
380+
381+
$result = array();
382+
383+
while ($row = $pre->fetch(PDO::FETCH_ASSOC)) {
384+
385+
$result[] = $row;
386+
387+
}
388+
389+
return $result;
390+
391+
}
392+
284393
}

0 commit comments

Comments
 (0)