Browse Source

Export PDF : correction affichage prix

dev
Guillaume Bourgeois 5 years ago
parent
commit
b5c62ee20f
3 changed files with 24 additions and 5 deletions
  1. +2
    -2
      backend/views/document/download.php
  2. +6
    -1
      backend/views/quotation/index.php
  3. +16
    -2
      common/models/ProductOrder.php

+ 2
- 2
backend/views/document/download.php View File

<?php foreach($product as $productOrder): ?> <?php foreach($product as $productOrder): ?>
<tr> <tr>
<td class="align-left"><?= Html::encode($productOrder->product->name) ?></td> <td class="align-left"><?= Html::encode($productOrder->product->name) ?></td>
<td class="align-center"><?= Price::format($productOrder->product->getPrice()) ?></td>
<td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td>
<td class="align-center"><?= $productOrder->quantity ?></td> <td class="align-center"><?= $productOrder->quantity ?></td>
<td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td> <td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td>
<td class="align-center"><?= $productOrder->product->taxRate->value * 100 ?> %</td> <td class="align-center"><?= $productOrder->product->taxRate->value * 100 ?> %</td>
<td class="align-center"><?= Price::format($productOrder->product->getPrice() * $productOrder->quantity) ?></td>
<td class="align-center"><?= Price::format($productOrder->getPrice() * $productOrder->quantity) ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>

+ 6
- 1
backend/views/quotation/index.php View File

], ],
[ [
'class' => 'yii\grid\ActionColumn', 'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete} {download}',
'template' => '{update} {delete} {send} {download}',
'headerOptions' => ['class' => 'column-actions'], 'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'], 'contentOptions' => ['class' => 'column-actions'],
'buttons' => [ 'buttons' => [
'send' => function($url, $model) {
return (!$model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [
'title' => Yii::t('app', 'Envoyer'), 'class' => 'btn btn-default'
]) : '');
},
'download' => function($url, $model) { 'download' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [
'title' => Yii::t('app', 'Télécharger'), 'class' => 'btn btn-default' 'title' => Yii::t('app', 'Télécharger'), 'class' => 'btn btn-default'

+ 16
- 2
common/models/ProductOrder.php View File

namespace common\models; namespace common\models;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\helpers\Price;
use Yii; use Yii;
use common\components\ActiveRecordCommon; use common\components\ActiveRecordCommon;


return $this->hasOne(Product::className(), ['id' => 'id_product']); return $this->hasOne(Product::className(), ['id' => 'id_product']);
} }


public function getTaxRate()
{
return $this->hasOne(TaxRate::className(), ['id' => 'id_tax_rate']);
}

/** /**
* @inheritdoc * @inheritdoc
*/ */
parent::afterFind(); parent::afterFind();
} }


public function getTaxRate()
public function getPrice()
{ {
return $this->hasOne(TaxRate::className(), ['id' => 'id_tax_rate']);
return $this->price ;
} }


/**
* Retourne le prix du produit avec taxe
*/
public function getPriceWithTax()
{

return Price::getPriceWithTax($this->price, $this->taxRate->value);
}


} }

Loading…
Cancel
Save