Kaynağa Gözat

Merge branch 'dev'

prodstable
Guillaume Bourgeois 2 yıl önce
ebeveyn
işleme
6e10e1276a
13 değiştirilmiş dosya ile 61 ekleme ve 60 silme
  1. +5
    -5
      backend/controllers/DistributionController.php
  2. +9
    -7
      backend/views/distribution/index.php
  3. +3
    -1
      backend/views/document/_download_product_line.php
  4. +9
    -9
      backend/views/document/download.php
  5. +1
    -1
      backend/views/invoice/index.php
  6. +0
    -1
      backend/views/layouts/main.php
  7. +11
    -7
      backend/web/css/document/download.css
  8. +6
    -2
      backend/web/sass/document/download.scss
  9. +6
    -7
      common/models/Document.php
  10. +11
    -6
      common/models/Order.php
  11. +0
    -10
      common/views/_analytics.php
  12. +0
    -3
      frontend/views/layouts/main.php
  13. +0
    -1
      producer/views/layouts/main.php

+ 5
- 5
backend/controllers/DistributionController.php Dosyayı Görüntüle

@@ -282,15 +282,15 @@ class DistributionController extends BackendController

$order = array_merge($order->getAttributes(), [
'selected' => false,
'amount' => $order->getAmountWithTax(Order::AMOUNT_TOTAL),
'amount_paid' => $order->getAmount(Order::AMOUNT_PAID),
'amount_remaining' => $order->getAmount(Order::AMOUNT_REMAINING),
'amount_surplus' => $order->getAmount(Order::AMOUNT_SURPLUS),
'amount' => Price::numberTwoDecimals($order->getAmountWithTax(Order::AMOUNT_TOTAL)),
'amount_paid' => Price::numberTwoDecimals($order->getAmount(Order::AMOUNT_PAID)),
'amount_remaining' => Price::numberTwoDecimals($order->getAmount(Order::AMOUNT_REMAINING)),
'amount_surplus' => Price::numberTwoDecimals($order->getAmount(Order::AMOUNT_SURPLUS)),
'user' => (isset($order->user)) ? array_merge(
$order->user->getAttributes(),
$arrayCreditUser
) : null,
'pointSale' => ['id' => $order->pointSale->id, 'name' => $order->pointSale->name],
'pointSale' => $order->pointSale ? ['id' => $order->pointSale->id, 'name' => $order->pointSale->name] : null,
'productOrder' => $productOrderArray,
'creditHistory' => $creditHistoryArray,
'oneProductUnactivated' => $oneProductUnactivated

+ 9
- 7
backend/views/distribution/index.php Dosyayı Görüntüle

@@ -336,9 +336,11 @@ $this->setPageTitle('Distributions') ;
<span v-if="order.delivery_home && order.delivery_address && order.delivery_address.length > 0" class="glyphicon glyphicon-home"></span>
</td>
<td class="column-point-sale" v-if="idActivePointSale == 0">
{{ order.pointSale.name }}
<template v-if="order.pointSale">
{{ order.pointSale.name }}
</template>
</td>
<td class="column-amount">{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+'&nbsp;€' }}</td>
<td class="column-amount">{{ order.amount.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+'&nbsp;€' }}</td>
<td class="column-state-payment">
<div class="input-group">
<span class="label label-success input-group-addon" v-if="order.amount_paid == order.amount">payé</span>
@@ -420,7 +422,7 @@ $this->setPageTitle('Distributions') ;
<span :class="'info-box-icon ' +((order.amount_paid == order.amount) ? 'bg-green' : 'bg-red')"><i class="fa fa-check"></i></span>
<div class="info-box-content">
<span class="info-box-text">Montant</span>
<span class="info-box-number">{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
<span class="info-box-number">{{ order.amount.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
<span class="info-box-text">
Statut<br />
<span class="label label-success" v-if="order.amount_paid == order.amount">payé</span>
@@ -445,7 +447,7 @@ $this->setPageTitle('Distributions') ;
data-type="refund"
@click="orderPaymentClick" >
<span class="glyphicon glyphicon-chevron-right"></span>
Rembourser {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
Rembourser {{ order.amount.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
</button>

<button v-else-if="order.amount_paid == 0"
@@ -454,7 +456,7 @@ $this->setPageTitle('Distributions') ;
data-type="payment"
@click="orderPaymentClick">
<span class="glyphicon glyphicon-chevron-right"></span>
Payer {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
Payer {{ order.amount.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
</button>

<button v-else-if="order.amount_paid > order.amount"
@@ -463,7 +465,7 @@ $this->setPageTitle('Distributions') ;
data-type="refund"
@click="orderPaymentClick">
<span class="glyphicon glyphicon-chevron-right"></span>
Rembourser {{ order.amount_surplus.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
Rembourser {{ order.amount_surplus.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
</button>

<button v-else-if="order.amount_paid < order.amount"
@@ -472,7 +474,7 @@ $this->setPageTitle('Distributions') ;
data-type="payment"
@click="orderPaymentClick">
<span class="glyphicon glyphicon-chevron-right"></span>
Payer le restant {{ order.amount_remaining.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
Payer le restant {{ order.amount_remaining.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
</button>
</div>


+ 3
- 1
backend/views/document/_download_product_line.php Dosyayı Görüntüle

@@ -21,7 +21,9 @@
<?= Price::format($price) ?>
</td>
<?php endif; ?>
<td class="align-center"><?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?></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($displayPrices): ?>
<?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>

+ 9
- 9
backend/views/document/download.php Dosyayı Görüntüle

@@ -106,16 +106,16 @@ $displayProductDescription = Producer::getConfig('document_display_product_descr
<?php endforeach; ?>
<?php endforeach; ?>
<?php else: ?>
<?php foreach($document->getProductsOrders() as $product): ?>
<?php foreach($product as $productOrder): ?>
<?= $this->render('_download_product_line', [
'document' => $document,
'productOrder' => $productOrder,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
]) ?>
<?php endforeach; ?>
<?php foreach($document->getProductsOrders() as $product): ?>
<?php foreach($product as $productOrder): ?>
<?= $this->render('_download_product_line', [
'document' => $document,
'productOrder' => $productOrder,
'displayPrices' => $displayPrices,
'displayProductDescription' => $displayProductDescription
]) ?>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if($displayPrices): ?>
<?php $typeAmount = $document->isInvoicePrice() ? Order::INVOICE_AMOUNT_TOTAL : Order::AMOUNT_TOTAL ; ?>

+ 1
- 1
backend/views/invoice/index.php Dosyayı Görüntüle

@@ -96,7 +96,7 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
'attribute' => 'amount',
'header' => 'Montant',
'value' => function($invoice) {
return $invoice->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL, true) ;
return $invoice->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL, true) ;
}
],
[

+ 0
- 1
backend/views/layouts/main.php Dosyayı Görüntüle

@@ -97,7 +97,6 @@ if (Yii::$app->controller->action->id === 'login') {

<script type="text/javascript" src="https://cdn.polyfill.io/v3/polyfill.min.js?features=Intl.~locale.fr"></script>
<?php $this->endBody() ?>
<?= $this->render('@common/views/_analytics.php'); ?>

</body>
</html>

+ 11
- 7
backend/web/css/document/download.css Dosyayı Görüntüle

@@ -62,11 +62,11 @@ body {
}
/* line 71, ../../sass/document/download.scss */
.document-download #block-products table td, .document-download #block-products table th {
padding: 5px;
padding: 2px 5px;
border-top: solid 1px #c0c0c0;
border-left: solid 1px #c0c0c0;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
font-size: 12px;
}
/* line 78, ../../sass/document/download.scss */
.document-download #block-products table td.align-left, .document-download #block-products table th.align-left {
@@ -80,32 +80,36 @@ body {
.document-download #block-products table td.align-right, .document-download #block-products table th.align-right {
text-align: right;
}
/* line 91, ../../sass/document/download.scss */
/* line 89, ../../sass/document/download.scss */
.document-download #block-products table td {
font-size: 11px;
}
/* line 95, ../../sass/document/download.scss */
.document-download .block-infos {
margin-top: 20px;
padding: 10px;
border: solid 1px #c0c0c0;
}
/* line 96, ../../sass/document/download.scss */
/* line 100, ../../sass/document/download.scss */
.document-download .block-infos strong {
font-size: 12px;
}

/* line 102, ../../sass/document/download.scss */
/* line 106, ../../sass/document/download.scss */
#footer {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
padding-top: 10px;
border-top: solid 1px gray;
}
/* line 108, ../../sass/document/download.scss */
/* line 112, ../../sass/document/download.scss */
#footer .infos-bottom {
padding-bottom: 20px;
margin-bottom: 40px;
font-size: 12px;
line-height: 18px;
}
/* line 114, ../../sass/document/download.scss */
/* line 118, ../../sass/document/download.scss */
#footer .reference-document {
font-weight: bold;
}

+ 6
- 2
backend/web/sass/document/download.scss Dosyayı Görüntüle

@@ -69,11 +69,11 @@ body {
border-collapse: collapse ;

td, th {
padding: 5px ;
padding: 2px 5px;
border-top: solid 1px $border-color ;
border-left: solid 1px $border-color ;
font-family: $font-family ;
font-size: 13px;
font-size: 12px;

&.align-left {
text-align: left ;
@@ -85,6 +85,10 @@ body {
text-align: right ;
}
}

td {
font-size: 11px;
}
}
}


+ 6
- 7
common/models/Document.php Dosyayı Görüntüle

@@ -342,26 +342,25 @@ class Document extends ActiveRecordCommon
if ($ordersArray && count($ordersArray)) {
foreach ($ordersArray as $order) {
foreach ($order->productOrder as $productOrder) {

//$indexProductOrder = $productOrder->id_product ;
$indexProductOrder = $productOrder->product->order ;
$newProductOrder = clone $productOrder ;

if (!isset($productsOrdersArray[$indexProductOrder])) {
$newProductOrder = clone $productOrder ;
$productsOrdersArray[$indexProductOrder] = [$newProductOrder];
} else {
$productOrderMatch = false;
foreach ($productsOrdersArray[$indexProductOrder] as &$theProductOrder) {
if ($theProductOrder->unit == $productOrder->unit
&& ($theProductOrder->price == $productOrder->price
|| ($this->isInvoicePrice()
&& $theProductOrder->invoice_price == $productOrder->invoice_price))) {
&& ( (!$this->isInvoicePrice() && $theProductOrder->price == $productOrder->price)
|| ($this->isInvoicePrice() && $theProductOrder->invoice_price == $productOrder->invoice_price)
)) {

$theProductOrder->quantity += $productOrder->quantity;
$productOrderMatch = true;
}
}
if (!$productOrderMatch) {
$productsOrdersArray[$indexProductOrder][] = $productOrder;
$productsOrdersArray[$indexProductOrder][] = $newProductOrder;
}
}
}

+ 11
- 6
common/models/Order.php Dosyayı Görüntüle

@@ -251,7 +251,13 @@ class Order extends ActiveRecordCommon
$productOrder->taxRate->value
) * $productOrder->quantity;

$invoicePrice = $productOrder->invoice_price ? $productOrder->invoice_price : $productOrder->price;
if($productOrder->invoice_price) {
$invoicePrice = $productOrder->invoice_price;
}
else {
$invoicePrice = $productOrder->price;
}

$this->invoice_amount += $invoicePrice * $productOrder->quantity;
$this->invoice_amount_with_tax += Price::getPriceWithTax(
$invoicePrice,
@@ -416,7 +422,7 @@ class Order extends ActiveRecordCommon
public function getAmount($type = self::AMOUNT_TOTAL, $format = false)
{
$amount = $this->amount;
if ($type == self::INVOICE_AMOUNT_TOTAL) {
if ($type == self::INVOICE_AMOUNT_TOTAL && $this->invoice_amount) {
$amount = $this->invoice_amount;
}

@@ -426,7 +432,7 @@ class Order extends ActiveRecordCommon
public function getAmountWithTax($type = self::AMOUNT_TOTAL, $format = false)
{
$amount = $this->amount_with_tax;
if ($type == self::INVOICE_AMOUNT_TOTAL) {
if ($type == self::INVOICE_AMOUNT_TOTAL && $this->invoice_amount) {
$amount = $this->invoice_amount_with_tax;
}

@@ -452,8 +458,6 @@ class Order extends ActiveRecordCommon
$amount = $this->getAmountWithTax(self::AMOUNT_PAID)
- $this->getAmountWithTax(self::AMOUNT_TOTAL);
break;
/*default:
throw new NotFoundHttpException('Type de montant inconnu : '.$type) ;*/
}

if ($format) {
@@ -981,7 +985,8 @@ class Order extends ActiveRecordCommon
$productOrder->invoice_price = $productOrder->product->getPrice([
'user' => isset($params['user']) ? $params['user'] : null,
'user_producer' => isset($params['user_producer']) ? $params['user_producer'] : null,
'point_sale' => isset($params['point_sale']) ? $params['point_sale'] : null
'point_sale' => isset($params['point_sale']) ? $params['point_sale'] : null,
'quantity' => $productOrder->quantity
]);
$productOrder->save();
}

+ 0
- 10
common/views/_analytics.php Dosyayı Görüntüle

@@ -1,10 +0,0 @@
<!-- analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>

+ 0
- 3
frontend/views/layouts/main.php Dosyayı Görüntüle

@@ -233,9 +233,6 @@ if(!Yii::$app->user->isGuest && Yii::$app->user->identity->id_producer > 0) {
</footer>
<?php $this->endBody() ?>
<?= $this->render('@common/views/_analytics.php'); ?>
</body>
</html>
<?php $this->endPage() ?>

+ 0
- 1
producer/views/layouts/main.php Dosyayı Görüntüle

@@ -334,7 +334,6 @@ if (!Yii::$app->user->isGuest) {
</footer>
<script type="text/javascript" src="https://cdn.polyfill.io/v3/polyfill.min.js?features=Intl.~locale.fr"></script>
<?php $this->endBody() ?>
<?= $this->render('@common/views/_analytics.php'); ?>
</body>
</html>
<?php $this->endPage() ?>

Yükleniyor…
İptal
Kaydet