@@ -50,11 +50,11 @@ | |||
<?php foreach($product as $productOrder): ?> | |||
<tr> | |||
<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"><?= Product::strUnit($productOrder->unit, 'wording') ?></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> | |||
<?php endforeach; ?> | |||
<?php endforeach; ?> |
@@ -85,10 +85,15 @@ $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plu | |||
], | |||
[ | |||
'class' => 'yii\grid\ActionColumn', | |||
'template' => '{update} {delete} {download}', | |||
'template' => '{update} {delete} {send} {download}', | |||
'headerOptions' => ['class' => 'column-actions'], | |||
'contentOptions' => ['class' => 'column-actions'], | |||
'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) { | |||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||
'title' => Yii::t('app', 'Télécharger'), 'class' => 'btn btn-default' |
@@ -39,6 +39,7 @@ | |||
namespace common\models; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Price; | |||
use Yii; | |||
use common\components\ActiveRecordCommon; | |||
@@ -71,6 +72,11 @@ class ProductOrder extends ActiveRecordCommon | |||
return $this->hasOne(Product::className(), ['id' => 'id_product']); | |||
} | |||
public function getTaxRate() | |||
{ | |||
return $this->hasOne(TaxRate::className(), ['id' => 'id_tax_rate']); | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
@@ -123,10 +129,18 @@ class ProductOrder extends ActiveRecordCommon | |||
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); | |||
} | |||
} |