Pārlūkot izejas kodu

Merge branch 'dev'

prodstable
Guillaume pirms 4 gadiem
vecāks
revīzija
b07f6d3d56
11 mainītis faili ar 94 papildinājumiem un 30 dzēšanām
  1. +10
    -3
      backend/controllers/DistributionController.php
  2. +12
    -2
      backend/controllers/OrderController.php
  3. +1
    -0
      backend/models/MailForm.php
  4. +7
    -0
      backend/views/distribution/index.php
  5. +2
    -2
      backend/views/document/_form.php
  6. +1
    -1
      backend/views/document/download.php
  7. +2
    -2
      backend/views/point-sale/_form.php
  8. +31
    -19
      backend/web/css/screen.css
  9. +18
    -1
      backend/web/js/vuejs/distribution-index.js
  10. +3
    -0
      backend/web/sass/_responsive.scss
  11. +7
    -0
      backend/web/sass/distribution/_index.scss

+ 10
- 3
backend/controllers/DistributionController.php Parādīt failu

@@ -156,7 +156,7 @@ class DistributionController extends BackendController
// products
$productsArray = Product::find()
->orWhere(['id_producer' => GlobalParam::getCurrentProducerId(),])
->joinWith(['productDistribution' => function ($query) use ($distribution) {
->joinWith(['taxRate','productDistribution' => function ($query) use ($distribution) {
$query->andOnCondition('product_distribution.id_distribution = ' . $distribution->id);
}])
->orderBy('product_distribution.active DESC, order ASC')
@@ -188,6 +188,10 @@ class DistributionController extends BackendController
$potentialRevenues += $theProduct['productDistribution'][0]['quantity_max'] * $theProduct['price'];
$potentialWeight += $theProduct['productDistribution'][0]['quantity_max'] * $theProduct['weight'] / 1000;
}

if(!isset($theProduct['taxRate'])) {
$theProduct['taxRate'] = $producer->taxRate ;
}
}

$json['distribution']['potential_revenues'] = Price::format($potentialRevenues);
@@ -204,6 +208,7 @@ class DistributionController extends BackendController
$productOrderArray[$productOrder->id_product] = [
'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'],
'unit' => $productOrder->unit,
'price' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value)
];
}

@@ -211,7 +216,8 @@ class DistributionController extends BackendController
if (!isset($productOrderArray[$product['id']])) {
$productOrderArray[$product['id']] = [
'quantity' => 0,
'unit' => $product['unit']
'unit' => $product['unit'],
'price' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']),
];
}
}
@@ -296,7 +302,8 @@ class DistributionController extends BackendController
foreach ($productsArray as $product) {
$productOrderArray[$product['id']] = [
'quantity' => 0,
'unit' => $product['unit']
'unit' => $product['unit'],
'price' => Price::getPriceWithTax($product['price'], $product['taxRate']['value']),
];
}
$json['order_create'] = [

+ 12
- 2
backend/controllers/OrderController.php Parādīt failu

@@ -864,7 +864,12 @@ class OrderController extends BackendController
$productOrder->quantity = $quantity;
$productOrder->unit = $product->unit;
$productOrder->step = $product->step;
$productOrder->price = $product->price;
if($dataProductOrder->price) {
$productOrder->price = number_format(Price::getPrice($dataProductOrder->price, $product->taxRate->value), 3) ;
}
else {
$productOrder->price = $product->price;
}
$productOrder->id_tax_rate = $product->taxRate->id;
$productOrder->save();
}
@@ -928,7 +933,12 @@ class OrderController extends BackendController
$productOrder->quantity = $quantity;
$productOrder->unit = $product->unit;
$productOrder->step = $product->step;
$productOrder->price = $product->price;
if($dataProductOrder->price) {
$productOrder->price = number_format(Price::getPrice($dataProductOrder->price, $product->taxRate->value), 3) ;
}
else {
$productOrder->price = $product->price;
}
$productOrder->id_tax_rate = $product->taxRate->id;
}
}

+ 1
- 0
backend/models/MailForm.php Parādīt failu

@@ -139,6 +139,7 @@ Produits disponibles :
}
if($product->price) {
$productDescription .= ' / '.Price::format($product->getPriceWithTax()) ;
$productDescription .= ' ('.Product::strUnit($product->unit, 'wording_unit').')' ;
}
$messageAutoText .= '- '.$productDescription.'

+ 7
- 0
backend/views/distribution/index.php Parādīt failu

@@ -580,6 +580,7 @@ $this->setPageTitle('Distributions') ;
<tr>
<th></th>
<th>Nom</th>
<th>Prix unitaire</th>
<th>Quantité</th>
<th>Reste</th>
</tr>
@@ -591,6 +592,12 @@ $this->setPageTitle('Distributions') ;
<span class="label label-danger" v-else>Inactif</span>
</td>
<td>{{ product.name }}</td>
<td class="price">
<div class="input-group">
<input type="text" v-model="order.productOrder[product.id].price" class="form-control" @change="productPriceChange" :data-id-product="product.id" />
<span class="input-group-addon" id="basic-addon2">€ TTC</span>
</div>
</td>
<td class="quantity">
<div class="input-group">
<span class="input-group-btn">

+ 2
- 2
backend/views/document/_form.php Parādīt failu

@@ -70,7 +70,7 @@ use common\models\Producer;
])->hiddenInput(); ?>
<?php else: ?>
<?php
$usersArray = User::findBy()->all();
$usersArray = User::findBy()->orderBy('type DESC')->all();
?>
<?= $form->field($model, 'id_user', [
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
@@ -78,7 +78,7 @@ use common\models\Producer;
->dropDownList(
ArrayHelper::map($usersArray, 'user_id', function ($model) {
if(isset($model['name_legal_person']) && strlen($model['name_legal_person'])) {
return $model['name_legal_person'] ;
return 'Personne morale / '.$model['name_legal_person'] ;
}
else {
return $model['lastname'] . ' ' . $model['name'];

+ 1
- 1
backend/views/document/download.php Parādīt failu

@@ -68,7 +68,7 @@
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td>
<?php endif; ?>
<td class="align-center"><?= $productOrder->quantity ?></td>
<td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></td>
<td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td>
<?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>

+ 2
- 2
backend/views/point-sale/_form.php Parādīt failu

@@ -59,9 +59,9 @@ use common\models\Producer;
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
])
->dropDownList(
ArrayHelper::map(User::findBy()->all(), 'user_id', function ($model) {
ArrayHelper::map(User::findBy()->orderBy('type DESC')->all(), 'user_id', function ($model) {
if(strlen($model['name_legal_person'])) {
return $model['name_legal_person'] ;
return 'Personne morale / '.$model['name_legal_person'] ;
}
else {
return $model['lastname'] . ' ' . $model['name'];

+ 31
- 19
backend/web/css/screen.css Parādīt failu

@@ -2127,20 +2127,28 @@ termes.
font-weight: bold;
}
/* line 351, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price {
width: 150px;
}
/* line 353, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price input {
text-align: center;
}
/* line 358, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 165px;
}
/* line 354, ../sass/distribution/_index.scss */
/* line 361, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: black;
}
/* line 359, ../sass/distribution/_index.scss */
/* line 366, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none;
padding-right: 4px;
}
/* line 364, ../sass/distribution/_index.scss */
/* line 371, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -2148,35 +2156,35 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 373, ../sass/distribution/_index.scss */
/* line 380, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 376, ../sass/distribution/_index.scss */
/* line 383, ../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 {
color: #00A65A;
}
/* line 380, ../sass/distribution/_index.scss */
/* line 387, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39;
}
/* line 384, ../sass/distribution/_index.scss */
/* line 391, ../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 {
font-size: 18px;
}
/* line 391, ../sass/distribution/_index.scss */
/* line 398, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 399, ../sass/distribution/_index.scss */
/* line 406, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 402, ../sass/distribution/_index.scss */
/* line 409, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 407, ../sass/distribution/_index.scss */
/* line 414, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}
@@ -2440,41 +2448,45 @@ termes.
width: 50px;
height: 52px;
}
/* line 76, ../sass/_responsive.scss */
/* line 67, ../sass/_responsive.scss */
.distribution-index .modal-form-order .modal-container .modal-body table.table-products td.price {
display: none;
}
/* line 79, ../sass/_responsive.scss */
.distribution-index #orders #buttons-top-orders .left {
width: 100%;
float: none;
}
/* line 80, ../sass/_responsive.scss */
/* line 83, ../sass/_responsive.scss */
.distribution-index #orders #buttons-top-orders .right {
width: 100%;
float: none;
}
/* line 85, ../sass/_responsive.scss */
/* line 88, ../sass/_responsive.scss */
.distribution-index #orders #buttons-top-orders .btn {
padding: 8px 15px;
margin: 10px;
display: block;
width: 100%;
}
/* line 95, ../sass/_responsive.scss */
/* line 98, ../sass/_responsive.scss */
.distribution-index #orders #wrapper-nav-points-sale ul#nav-points-sale li {
float: none;
width: 100%;
}
/* line 98, ../sass/_responsive.scss */
/* line 101, ../sass/_responsive.scss */
.distribution-index #orders #wrapper-nav-points-sale ul#nav-points-sale li a {
display: block;
}
/* line 107, ../sass/_responsive.scss */
/* line 110, ../sass/_responsive.scss */
.distribution-index #orders table ul.dropdown-menu a {
padding: 15px;
}
/* line 111, ../sass/_responsive.scss */
/* line 114, ../sass/_responsive.scss */
.distribution-index #orders table button {
padding: 15px;
}
/* line 116, ../sass/_responsive.scss */
/* line 119, ../sass/_responsive.scss */
.distribution-index #orders table .column-origin,
.distribution-index #orders table .column-point-sale,
.distribution-index #orders table .column-state-payment,

+ 18
- 1
backend/web/js/vuejs/distribution-index.js Parādīt failu

@@ -613,9 +613,26 @@ Vue.component('order-form',{
}
if(parseFloat(this.order.productOrder[id_product].quantity) + quantity >= 0) {
var theQuantity = parseFloat(this.order.productOrder[id_product].quantity) + parseFloat(quantity) ;
Vue.set(this.order.productOrder, id_product, {quantity: theQuantity, unit: this.order.productOrder[id_product].unit});
Vue.set(this.order.productOrder, id_product, {
quantity: theQuantity,
unit: this.order.productOrder[id_product].unit,
price: this.order.productOrder[id_product].price
});
}
},
productPriceChange: function(event) {
var idProduct = event.currentTarget.getAttribute('data-id-product') ;
var price = parseFloat(event.currentTarget.value) ;
if(isNaN(price)) {
price = 0 ;
}

Vue.set(this.order.productOrder, idProduct, {
quantity: this.order.productOrder[idProduct].quantity,
unit: this.order.productOrder[idProduct].unit,
price: price
});
},
userChange: function(event) {
var app = this ;
axios.get(UrlManager.getBaseUrlAbsolute()+"distribution/ajax-point-sale-favorite",{params: {

+ 3
- 0
backend/web/sass/_responsive.scss Parādīt failu

@@ -64,6 +64,9 @@ termes.
height: 52px;
}
}
td.price {
display: none ;
}
}

}

+ 7
- 0
backend/web/sass/distribution/_index.scss Parādīt failu

@@ -348,6 +348,13 @@ termes.
}
}

td.price {
width: 150px ;
input {
text-align: center ;
}
}

td.quantity {
width: 165px;


Notiek ielāde…
Atcelt
Saglabāt