finish thanatofeestat and order stat

This commit is contained in:
Tiavina 2025-02-10 09:20:57 +03:00
parent e0f37ee1cc
commit 21924ddfee
27 changed files with 67 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ namespace OCA\Gestion\Controller;
use Exception; use Exception;
use OCA\Gestion\Service\NavigationService; use OCA\Gestion\Service\NavigationService;
use OCA\Gestion\Service\Order\OrderService;
defined("TAB1") or define("TAB1", "\t"); defined("TAB1") or define("TAB1", "\t");
use OCP\IGroupManager; use OCP\IGroupManager;
@ -63,6 +64,9 @@ class PageController extends Controller {
/** @var \OCA\Gestion\Service\NavigationService */ /** @var \OCA\Gestion\Service\NavigationService */
private $navigationService; private $navigationService;
/** @var \OCA\Gestion\Service\Order\OrderService */
private $orderService;
/** /**
* Constructor * Constructor
*/ */
@ -81,7 +85,8 @@ class PageController extends Controller {
InvoicePdfService $invoicePdfService, InvoicePdfService $invoicePdfService,
DevisPdfService $devisPdfService, DevisPdfService $devisPdfService,
CertificateService $certificateService, CertificateService $certificateService,
NavigationService $navigationService){ NavigationService $navigationService,
OrderService $orderService){
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
@ -96,6 +101,7 @@ class PageController extends Controller {
$this->devisPdfService = $devisPdfService; $this->devisPdfService = $devisPdfService;
$this->certificateService = $certificateService; $this->certificateService = $certificateService;
$this->navigationService = $navigationService; $this->navigationService = $navigationService;
$this->orderService = $orderService;
//$this->fpdf = $fpdf; //$this->fpdf = $fpdf;
if ($userSession->isLoggedIn()) { if ($userSession->isLoggedIn()) {
@ -1959,6 +1965,8 @@ class PageController extends Controller {
$res['produit'] = json_decode($this->myDb->numberProduit($this->idNextcloud))[0]->c; $res['produit'] = json_decode($this->myDb->numberProduit($this->idNextcloud))[0]->c;
$res['article'] = json_decode($this->myDb->numberArticle($this->idNextcloud))[0]->c; $res['article'] = json_decode($this->myDb->numberArticle($this->idNextcloud))[0]->c;
$res['bibliotheque'] = json_decode($this->myDb->numberBibliotheque($this->idNextcloud))[0]->c; $res['bibliotheque'] = json_decode($this->myDb->numberBibliotheque($this->idNextcloud))[0]->c;
$res['order'] = $this->orderService->getOrderCount();
$res['thanatoProductFee'] = $this->orderService->getThanatoProductFeeCount();
return json_encode($res); return json_encode($res);
} }

View File

@ -263,4 +263,28 @@ class OrderBdd {
$this->execSQLNoData($sql, []); $this->execSQLNoData($sql, []);
} }
public function getOrderCount(){
$count = 0;
$sql = "SELECT COUNT(orders.id) as order_count
FROM ".$this->orderTablePrefix."orders as orders;";
$result = $this->execSQLNoJsonReturn($sql,[]);
if(!empty($result)){
$count = $result[0]["order_count"];
}
return $count;
}
public function getThanatoProductFeeCount(){
$count = 0;
$sql = "SELECT COUNT(thanato_product_discount.id) as thanato_product_fee_count
FROM ".$this->orderTablePrefix."thanato_product_discount as thanato_product_discount;";
$result = $this->execSQLNoJsonReturn($sql,[]);
if(!empty($result)){
$count = $result[0]["thanato_product_fee_count"];
}
return $count;
}
} }

View File

@ -75,4 +75,12 @@ class OrderService {
public function createDefaultThanatoProductFee(){ public function createDefaultThanatoProductFee(){
$this->orderBdd->createDefaultThanatoProductFee(); $this->orderBdd->createDefaultThanatoProductFee();
} }
public function getOrderCount(){
return $this->orderBdd->getOrderCount();
}
public function getThanatoProductFeeCount(){
return $this->orderBdd->getThanatoProductFeeCount();
}
} }

View File

@ -36,6 +36,6 @@ CREATE TABLE IF NOT EXISTS oc_gestion_thanato_product_discount(
id INT AUTO_INCREMENT PRIMARY KEY, id INT AUTO_INCREMENT PRIMARY KEY,
fk_thanato_id INT NOT NULL, fk_thanato_id INT NOT NULL,
fk_product_id INT NOT NULL, fk_product_id INT NOT NULL,
ht_price INT NOT NULL, ht_price FLOAT NOT NULL,
id_nextcloud VARCHAR(100) id_nextcloud VARCHAR(100)
); );

View File

@ -79,6 +79,8 @@ export function getStats() {
$("#statsproduit").text(res.produit); $("#statsproduit").text(res.produit);
$("#statsarticles").text(res.article); $("#statsarticles").text(res.article);
$("#statsbibliotheque").text(res.bibliotheque); $("#statsbibliotheque").text(res.bibliotheque);
$("#thanatoProductFeeStat").text(res.thanatoProductFee);
$("#orderStat").text(res.order);
}).fail(function (response, code) { }).fail(function (response, code) {
showError(response); showError(response);
}); });

View File

@ -180,7 +180,7 @@
<div class="app-navigation-entry-utils-submenu"> <div class="app-navigation-entry-utils-submenu">
<ul> <ul>
<li class="app-navigation-entry-utils-counter"> <li class="app-navigation-entry-utils-counter">
<span>5</span> <span id="thanatoProductFeeStat"><div class="loader"></div></span>
</li> </li>
</ul> </ul>
</div> </div>
@ -193,7 +193,7 @@
<div class="app-navigation-entry-utils-submenu"> <div class="app-navigation-entry-utils-submenu">
<ul> <ul>
<li class="app-navigation-entry-utils-counter"> <li class="app-navigation-entry-utils-counter">
<span>5</span> <span id="orderStat"><div class="loader"></div></span>
</li> </li>
</ul> </ul>
</div> </div>