Browse Source

[Administration] Distribution > édition commande : pouvoir modifier les prix facturés #888

refactoring
Guillaume 1 year ago
parent
commit
18c7ccfaee
7 changed files with 47 additions and 22 deletions
  1. +2
    -2
      backend/controllers/DistributionController.php
  2. +5
    -0
      backend/controllers/OrderController.php
  3. +6
    -7
      backend/views/distribution/index.php
  4. +22
    -12
      backend/web/css/screen.css
  5. +2
    -1
      backend/web/js/vuejs/distribution-index.js
  6. +9
    -0
      backend/web/sass/distribution/_index.scss
  7. +1
    -0
      common/logic/Document/Document/Service/DocumentUtils.php

+ 2
- 2
backend/controllers/DistributionController.php View File

'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'], 'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'],
'unit' => $productOrder->unit, 'unit' => $productOrder->unit,
'price' => number_format($productOrder->price, 3), 'price' => number_format($productOrder->price, 3),
'invoice_price' => number_format($productOrder->invoice_price, 2),
'invoice_price' => number_format($productOrder->invoice_price, 3),
'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value), 'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value),
]; ];
} }
foreach ($order->productOrder as $productOrder) { foreach ($order->productOrder as $productOrder) {
if ($productOrder->id_product == $product['id']) { if ($productOrder->id_product == $product['id']) {
if ($productOrder->invoice_price) { if ($productOrder->invoice_price) {
$invoicePrice = number_format($productOrder->invoice_price, 2);
$invoicePrice = number_format($productOrder->invoice_price, 3);
} else { } else {
$invoicePrice = number_format($productOrder->price, 3); $invoicePrice = number_format($productOrder->price, 3);
} }

+ 5
- 0
backend/controllers/OrderController.php View File

if ($productOrder) { if ($productOrder) {
$productOrder->quantity = $quantity; $productOrder->quantity = $quantity;
$productOrder->price = $dataProductOrder->price; $productOrder->price = $dataProductOrder->price;

if($dataProductOrder->invoice_price && $dataProductOrder->invoice_price != $dataProductOrder->price) {
//die('invoice price : '.$dataProductOrder->invoice_price);
$productOrder->invoice_price = $dataProductOrder->invoice_price;
}
} else { } else {
$product = Product::findOne($key); $product = Product::findOne($key);



+ 6
- 7
backend/views/distribution/index.php View File

<input type="text" v-model="order.productOrder[product.id].price_with_tax" class="form-control input-sm" @change="productPriceChange" :data-with-tax="true" :data-id-product="product.id" /> <input type="text" v-model="order.productOrder[product.id].price_with_tax" class="form-control input-sm" @change="productPriceChange" :data-with-tax="true" :data-id-product="product.id" />
<span class="input-group-addon" id="basic-addon2">€ TTC</span> <span class="input-group-addon" id="basic-addon2">€ TTC</span>
</div> </div>
<div v-if="(order.id_invoice || order.id_delivery_note || order.id_quotation) && order.productOrder[product.id].quantity > 0">
<span class="label label-default">
Facturé
<template v-if="order.productOrder[product.id].invoice_price != null">{{ order.productOrder[product.id].invoice_price }}</template>
<template v-else>{{ order.productOrder[product.id].price }}</template>
€ HT
</span>
<div class="invoice-price" v-show="vatMode == 'all'" v-if="(order.id_invoice || order.id_delivery_note || order.id_quotation) && order.productOrder[product.id].quantity > 0">
<span class="label-invoice-price">Prix facturé</span><br />
<div class="input-group">
<input type="text" v-model="order.productOrder[product.id].invoice_price" class="form-control input-sm" :data-id-product="product.id" />
<span class="input-group-addon" id="basic-addon2">€ HT</span>
</div>
</div> </div>
</td> </td>
<td class="quantity"> <td class="quantity">

+ 22
- 12
backend/web/css/screen.css View File

.distribution-index .modal-form-order table.table-products td.price .input-group-addon { .distribution-index .modal-form-order table.table-products td.price .input-group-addon {
background-color: #eee; background-color: #eee;
} }
/* line 396, ../sass/distribution/_index.scss */
/* line 395, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price {
margin-top: 8px;
}
/* line 397, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
/* line 405, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity { .distribution-index .modal-form-order table.table-products td.quantity {
width: 165px; width: 165px;
} }
/* line 399, ../sass/distribution/_index.scss */
/* line 408, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input { .distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center; text-align: center;
color: black; color: black;
} }
/* line 404, ../sass/distribution/_index.scss */
/* line 413, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control { .distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none; border-right: 0px none;
padding-right: 4px; padding-right: 4px;
} }
/* line 409, ../sass/distribution/_index.scss */
/* line 418, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { .distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px; padding: 5px;
padding-left: 0px; padding-left: 0px;
border-left: 0px none; border-left: 0px none;
border-right: 0px none; border-right: 0px none;
} }
/* line 418, ../sass/distribution/_index.scss */
/* line 427, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining { .distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right; text-align: right;
} }
/* line 421, ../sass/distribution/_index.scss */
/* line 430, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite { .distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite {
color: #00A65A; color: #00A65A;
} }
/* line 425, ../sass/distribution/_index.scss */
/* line 434, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { .distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39; color: #DD4B39;
} }
/* line 429, ../sass/distribution/_index.scss */
/* line 438, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty { .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty {
font-size: 18px; font-size: 18px;
} }
/* line 436, ../sass/distribution/_index.scss */
/* line 445, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button { .distribution-index .modal-form-order .actions-form button {
margin-left: 15px; margin-left: 15px;
} }
/* line 444, ../sass/distribution/_index.scss */
/* line 453, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon { .distribution-index .modal-payment .info-box .info-box-icon {
width: 50px; width: 50px;
} }
/* line 447, ../sass/distribution/_index.scss */
/* line 456, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i { .distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px; font-size: 30px;
} }
/* line 452, ../sass/distribution/_index.scss */
/* line 461, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content { .distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px; margin-left: 50px;
} }

+ 2
- 1
backend/web/js/vuejs/distribution-index.js View File

productOrderArrayRequest[key] = { productOrderArrayRequest[key] = {
quantity: this.order.productOrder[key].quantity, quantity: this.order.productOrder[key].quantity,
unit: this.order.productOrder[key].unit, unit: this.order.productOrder[key].unit,
price: this.order.productOrder[key].price
price: this.order.productOrder[key].price,
invoice_price: this.order.productOrder[key].invoice_price
}; };
} }
return JSON.stringify(productOrderArrayRequest); return JSON.stringify(productOrderArrayRequest);

+ 9
- 0
backend/web/sass/distribution/_index.scss View File

.input-group-addon { .input-group-addon {
background-color: #eee; background-color: #eee;
} }

.invoice-price {
margin-top: 8px;
.label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
}
} }


td.quantity { td.quantity {

+ 1
- 0
common/logic/Document/Document/Service/DocumentUtils.php View File

$aliasDirectoryBase = $this->documentSolver->getAliasDirectoryBase($document); $aliasDirectoryBase = $this->documentSolver->getAliasDirectoryBase($document);
$directoryPdf = \Yii::getAlias($aliasDirectoryBase); $directoryPdf = \Yii::getAlias($aliasDirectoryBase);
if (!file_exists($directoryPdf)) { if (!file_exists($directoryPdf)) {
//die('dir : '.$directoryPdf);
mkdir($directoryPdf, 0755); mkdir($directoryPdf, 0755);
} }
} }

Loading…
Cancel
Save