finish command detail
This commit is contained in:
parent
69385a37c7
commit
c209f3c251
File diff suppressed because one or more lines are too long
@ -5,6 +5,7 @@ use Exception;
|
||||
use OCA\Gestion\Service\ConfigurationService;
|
||||
use OCA\Gestion\Service\NavigationService;
|
||||
use OCA\Gestion\Service\Order\OrderService;
|
||||
use Psr\Log\LoggerInterface;
|
||||
defined("TAB1") or define("TAB1", "\t");
|
||||
|
||||
use OCP\IGroupManager;
|
||||
@ -45,6 +46,8 @@ class OrderController extends Controller {
|
||||
private $navigationService;
|
||||
private $configurationService;
|
||||
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -60,7 +63,8 @@ class OrderController extends Controller {
|
||||
IGroupManager $groupManager,
|
||||
OrderService $orderService,
|
||||
NavigationService $navigationService,
|
||||
ConfigurationService $configurationService
|
||||
ConfigurationService $configurationService,
|
||||
LoggerInterface $logger
|
||||
){
|
||||
|
||||
parent::__construct($AppName, $request);
|
||||
@ -73,6 +77,7 @@ class OrderController extends Controller {
|
||||
$this->orderService = $orderService;
|
||||
$this->navigationService = $navigationService;
|
||||
$this->configurationService = $configurationService;
|
||||
$this->logger = $logger;
|
||||
|
||||
if ($userSession->isLoggedIn()) {
|
||||
$this->user = $userSession->getUser();
|
||||
@ -148,7 +153,6 @@ class OrderController extends Controller {
|
||||
return true;
|
||||
}
|
||||
catch(Exception $e){
|
||||
var_dump($e->getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -190,6 +194,8 @@ class OrderController extends Controller {
|
||||
* @param string $orderId
|
||||
*/
|
||||
public function orderDetails($orderId) {
|
||||
$this->logger->debug("logId");
|
||||
$this->logger->debug("$orderId");
|
||||
$orderWithDetail = $this->orderService->getOrderByIdWithDetails($orderId);
|
||||
return new TemplateResponse(
|
||||
'gestion',
|
||||
@ -197,8 +203,8 @@ class OrderController extends Controller {
|
||||
array(
|
||||
'groups' => $this->groups,
|
||||
'user' => $this->user,
|
||||
"configuration" => $this->configurationService->getDefaultConfiguration(),
|
||||
'order'=>json_decode($orderWithDetail),
|
||||
"configuration" => json_decode(json_encode($this->configurationService->getDefaultConfiguration())),
|
||||
'order'=>json_decode(json_encode($orderWithDetail)),
|
||||
'path' => $this->idNextcloud,
|
||||
'url' => $this->navigationService->getNavigationLink(),
|
||||
'logo' => $this->getLogo()
|
||||
@ -222,8 +228,7 @@ class OrderController extends Controller {
|
||||
*/
|
||||
public function getOrderTotalAmount($orderId) {
|
||||
$configuration = $this->configurationService->getDefaultConfiguration();
|
||||
$configuration = json_decode($configuration);
|
||||
$orderTotalAmount = $this->orderService->getOrderTotalAmount($orderId,$configuration->tva_default ?? 0);
|
||||
$orderTotalAmount = $this->orderService->getOrderTotalAmount($orderId,$configuration["tva_default"] ?? 0);
|
||||
return json_encode($orderTotalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class Bdd {
|
||||
|
||||
public function getConfigurationByIdNextcloud($idNextcloud){
|
||||
$sql = "SELECT * FROM `".$this->tableprefix."configuration` WHERE id_nextcloud = ?";
|
||||
$result = $this->execSQL($sql, array($idNextcloud));
|
||||
$result = $this->execSQLNoJsonReturn($sql, array($idNextcloud));
|
||||
if(!empty($result)){
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ class OrderBdd {
|
||||
"
|
||||
;
|
||||
|
||||
$result = $this->execSQL($sql,[$orderId]);
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$orderId]);
|
||||
if(!empty($result)){
|
||||
return $result[0];
|
||||
}
|
||||
@ -368,8 +368,8 @@ class OrderBdd {
|
||||
$totalTvaAmount = 0;
|
||||
$orderProducts = $this->getOrderProductsByOrderId($orderId);
|
||||
foreach($orderProducts as $orderProduct){
|
||||
$totalHt += $orderProduct["produit_ht_price"];
|
||||
$totalTvaAmount += $orderProduct["produit_ht_price"] * $tva;
|
||||
$totalHt += $orderProduct["produit_ht_price"] * $orderProduct["order_product_quantity"];
|
||||
$totalTvaAmount += $orderProduct["produit_ht_price"] * $tva / 100;
|
||||
$totalTtc += ($totalHt * ($tva + 100)) / 100;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { showSuccess, showError } from "@nextcloud/dialogs";
|
||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||
import { baseUrl, showLoader } from "../mainFunction.mjs";
|
||||
import { baseUrl, showLoader , cur} from "../mainFunction.mjs";
|
||||
|
||||
/**
|
||||
* Update order date
|
||||
@ -61,13 +61,15 @@ export function getTotalAmountOfOrder(orderId) {
|
||||
$.ajax({
|
||||
url: baseUrl + '/order/'+orderId+'/totalAmount',
|
||||
type: 'PROPFIND',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
numdevis: id_devis
|
||||
})
|
||||
contentType: 'application/json'
|
||||
}).done((function (totalAmountResult) {
|
||||
var totalAmount = JSON.parse(totalAmountResult);
|
||||
$('#totalOrderProducts tbody').empty();
|
||||
$('#totalOrderProducts tbody').append('<tr><td>' + cur.format(totalAmount.totalHt) + '</td><td id="tva">' + totalAmount.tva + ' %</td><td id="totaltva">' + cur.format(Math.round(totalAmount.totalTvaAmount)) + '</td><td>' + cur.format(Math.round(totalAmount.totalTtc)) + '</td></tr>');
|
||||
$('#totalOrderProducts tbody').append(
|
||||
'<tr>'+
|
||||
'<td style="text-align:center;">' + cur.format(totalAmount.totalHt)+'</td>'+
|
||||
'<td id="tva" style="text-align:center;">' + totalAmount.tva + ' %</td>'+
|
||||
'<td id="totaltva" style="text-align:center;">' + cur.format(Math.round((totalAmount.totalHt * totalAmount.tva)) / 100) + '</td>'+
|
||||
'<td style="text-align:center;">' + cur.format(Math.round((totalAmount.totalHt * (totalAmount.tva + 100))) / 100) + '</td></tr>');
|
||||
}));
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$order = $_['order'];
|
||||
$configuration = json_decode($_['configuration']);
|
||||
$configuration = $_['configuration'];
|
||||
$orderComment = $order->order_comment == null || $order->order_comment == "" ? "-": $order->order_comment;
|
||||
?>
|
||||
<div class="bootstrap-iso">
|
||||
<h2 class="mt-3 mb-3 text-center"> <?php p($l->t('Commande'));?>
|
||||
@ -46,14 +47,20 @@
|
||||
<span>Lieu : <b><?php echo $order->lieu_nom;?> (<?php echo $order->lieu_adresse;?>)</b>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-md">
|
||||
<hr />
|
||||
<div class="col col-xl mb-3 text-center editable" style="display:inline" data-table="orders" data-column="order_comment" data-id="<?php echo $order->id; ?>"><?php echo ($order->order_comment ?? "-"); ?></div>
|
||||
<hr />
|
||||
<label class="fw-bold">Commentaires :</label>
|
||||
<div class="col col-xl mb-3 text-center editable"
|
||||
style="display:inline"
|
||||
data-table="orders" data-column="order_comment"
|
||||
data-id="<?php echo $order->id;?>">
|
||||
<?php echo $orderComment; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div><h2>Articles</h2></div>
|
||||
<button id="addProductToOrder" type="button" class="mb-2 btn btn-outline-success">Ajouter un article</button>
|
||||
@ -65,7 +72,6 @@
|
||||
<tr>
|
||||
<th><?php p($l->t('Reference'));?></th>
|
||||
<th><?php p($l->t('Designation'));?></th>
|
||||
<th><?php p($l->t('Comment'));?></th>
|
||||
<th><?php p($l->t('Quantity'));?></th>
|
||||
<th><?php p($l->t('Unit price without VAT'));?></th>
|
||||
<th><?php p($l->t('Total without VAT'));?></th>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user