$productDescription .= ' / '.$product->description ; | $productDescription .= ' / '.$product->description ; | ||||
} | } | ||||
if($product->price) { | if($product->price) { | ||||
$productDescription .= ' / '.Price::format($product->price) ; | |||||
$productDescription .= ' / '.Price::format($product->getPriceWithTax()) ; | |||||
} | } | ||||
$messageAutoText .= '- '.$productDescription.' | $messageAutoText .= '- '.$productDescription.' |
?> | ?> | ||||
<div class="delivery-note-index"> | <div class="delivery-note-index"> | ||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
<?php if(DeliveryNote::searchCount()): ?> | |||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
], | |||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | ], | ||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
} | |||||
return '' ; | |||||
} | } | ||||
return '' ; | |||||
} | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'date_distribution', | |||||
'header' => 'Jour de distribution', | |||||
'filter' => \yii\jui\DatePicker::widget([ | |||||
'language' => 'fr', | |||||
'dateFormat' => 'dd/MM/yyyy', | |||||
'model' => $searchModel, | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'date_distribution', | 'attribute' => 'date_distribution', | ||||
'options' => ['class' => 'form-control'] | |||||
]), | |||||
'value' => function($model) { | |||||
$distribution = $model->getDistribution() ; | |||||
if($distribution) { | |||||
return date('d/m/Y',strtotime($distribution->date)) ; | |||||
'header' => 'Jour de distribution', | |||||
'filter' => \yii\jui\DatePicker::widget([ | |||||
'language' => 'fr', | |||||
'dateFormat' => 'dd/MM/yyyy', | |||||
'model' => $searchModel, | |||||
'attribute' => 'date_distribution', | |||||
'options' => ['class' => 'form-control'] | |||||
]), | |||||
'value' => function($model) { | |||||
$distribution = $model->getDistribution() ; | |||||
if($distribution) { | |||||
return date('d/m/Y',strtotime($distribution->date)) ; | |||||
} | |||||
return '' ; | |||||
} | } | ||||
return '' ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'id_point_sale', | |||||
'header' => 'Point de vente', | |||||
'filter' => ArrayHelper::map(PointSale::searchAll([], ['as_array'=>true]), 'id', 'name'), | |||||
'format' => 'html', | |||||
'value' => function($model) { | |||||
$pointSale = $model->getPointSale() ; | |||||
if($pointSale) { | |||||
return Html::encode($pointSale->name); | |||||
], | |||||
[ | |||||
'attribute' => 'id_point_sale', | |||||
'header' => 'Point de vente', | |||||
'filter' => ArrayHelper::map(PointSale::searchAll([], ['as_array'=>true]), 'id', 'name'), | |||||
'format' => 'html', | |||||
'value' => function($model) { | |||||
$pointSale = $model->getPointSale() ; | |||||
if($pointSale) { | |||||
return Html::encode($pointSale->name); | |||||
} | |||||
return '' ; | |||||
} | } | ||||
return '' ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{validate} {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' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
], | |||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | } | ||||
], | ], | ||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{validate} {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' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
} | |||||
], | |||||
], | |||||
], | ], | ||||
], | |||||
]); ?> | |||||
]); ?> | |||||
<?php else: ?> | |||||
<div class="alert alert-info">Aucun bon de livraison enregistré</div> | |||||
<?php endif; ?> | |||||
</div> | </div> |
?> | ?> | ||||
<div class="invoice-index"> | <div class="invoice-index"> | ||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
<?php if(Invoice::searchCount()): ?> | |||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
], | |||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | ], | ||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
} | |||||
return '' ; | |||||
} | } | ||||
return '' ; | |||||
} | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'id_user', | |||||
'header' => 'Utilisateur', | |||||
'value' => function($model) { | |||||
return $model->user->getUsername() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'date', | |||||
'header' => 'Date', | |||||
'value' => function($model) { | |||||
return date('d/m/Y',strtotime($model->date)) ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{validate} {update} {delete} {send} {download}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'send' => function($url, $model) { | |||||
return (!$model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [ | |||||
'title' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'id_user', | |||||
'header' => 'Utilisateur', | |||||
'value' => function($model) { | |||||
return $model->user->getUsername() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'date', | |||||
'header' => 'Date', | |||||
'value' => function($model) { | |||||
return date('d/m/Y',strtotime($model->date)) ; | |||||
} | } | ||||
], | ], | ||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{validate} {update} {delete} {send} {download}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'send' => function($url, $model) { | |||||
return (!$model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [ | |||||
'title' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
} | |||||
], | |||||
], | |||||
], | ], | ||||
], | |||||
]); ?> | |||||
]); ?> | |||||
<?php else: ?> | |||||
<div class="alert alert-info">Aucune facture enregistrée</div> | |||||
<?php endif; ?> | |||||
</div> | </div> |
?> | ?> | ||||
<div class="quotation-index"> | <div class="quotation-index"> | ||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
<?php if(Quotation::searchCount()): ?> | |||||
<?= GridView::widget([ | |||||
'filterModel' => $searchModel, | |||||
'dataProvider' => $dataProvider, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'status', | |||||
'label' => 'Statut', | |||||
'filter' => [ | |||||
'draft' => 'Brouillon', | |||||
'valid' => 'Valide', | |||||
], | |||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | ], | ||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
return $model->getHtmlLabel() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
[ | |||||
'attribute' => 'reference', | |||||
'value' => function($model) { | |||||
if(strlen($model->reference) > 0) { | |||||
return $model->reference ; | |||||
} | |||||
return '' ; | |||||
} | } | ||||
return '' ; | |||||
} | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'id_user', | |||||
'header' => 'Utilisateur', | |||||
'value' => function($model) { | |||||
return $model->user->getUsername() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'date', | |||||
'header' => 'Date', | |||||
'value' => function($model) { | |||||
return date('d/m/Y',strtotime($model->date)) ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{transform} {validate} {update} {delete} {send} {download}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'transform' => function ($url, $model) { | |||||
return ($model->isStatusValid() ? Html::a('<span class="glyphicon glyphicon-check"></span>', $url, [ | |||||
'title' => 'Transformer en facture', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'send' => function($url, $model) { | |||||
return (!$model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [ | |||||
'title' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
], | |||||
'name', | |||||
[ | |||||
'attribute' => 'id_user', | |||||
'header' => 'Utilisateur', | |||||
'value' => function($model) { | |||||
return $model->user->getUsername() ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'date', | |||||
'header' => 'Date', | |||||
'value' => function($model) { | |||||
return date('d/m/Y',strtotime($model->date)) ; | |||||
} | } | ||||
], | ], | ||||
[ | |||||
'attribute' => 'amount', | |||||
'header' => 'Montant', | |||||
'value' => function($invoice) { | |||||
return $invoice->getAmountWithTax(Order::AMOUNT_TOTAL, true) ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{transform} {validate} {update} {delete} {send} {download}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'transform' => function ($url, $model) { | |||||
return ($model->isStatusValid() ? Html::a('<span class="glyphicon glyphicon-check"></span>', $url, [ | |||||
'title' => 'Transformer en facture', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'validate' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ | |||||
'title' => 'Valider', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'send' => function($url, $model) { | |||||
return (!$model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [ | |||||
'title' => 'Envoyer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'download' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [ | |||||
'title' => 'Télécharger', 'class' => 'btn btn-default' | |||||
]); | |||||
}, | |||||
'update' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
}, | |||||
'delete' => function ($url, $model) { | |||||
return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
]) : ''); | |||||
} | |||||
], | |||||
], | |||||
], | ], | ||||
], | |||||
]); ?> | |||||
]); ?> | |||||
<?php else: ?> | |||||
<div class="alert alert-info">Aucun devis enregistré</div> | |||||
<?php endif; ?> | |||||
</div> | </div> |
public static function format($number) | public static function format($number) | ||||
{ | { | ||||
return str_replace('.', ',',number_format($number, 2)) . ' €'; | |||||
return self::numberTwoDecimals($number).' €'; | |||||
} | } | ||||
public static function getPrice($priceWithTax, $taxRate) | public static function getPrice($priceWithTax, $taxRate) | ||||
{ | { | ||||
return round(floatval($priceWithTax) / ($taxRate + 1), 2); | |||||
return floatval($priceWithTax) / ($taxRate + 1); | |||||
} | } | ||||
public static function getPriceWithTax($priceWithoutTax, $taxRate) | public static function getPriceWithTax($priceWithoutTax, $taxRate) | ||||
{ | { | ||||
return round(floatval($priceWithoutTax) * ($taxRate + 1), 2); | |||||
return floatval($priceWithoutTax) * ($taxRate + 1) ; | |||||
} | |||||
public static function numberTwoDecimals($number) | |||||
{ | |||||
return number_format(((int) ($number * 100)) / 100, 2) ; | |||||
} | } | ||||
} | } |
if ($ordersOpendistrib) { | if ($ordersOpendistrib) { | ||||
foreach ($ordersOpendistrib as $orderOpendistrib) { | foreach ($ordersOpendistrib as $orderOpendistrib) { | ||||
$ordersOpendistribSynchro[$orderOpendistrib->id] = false; | $ordersOpendistribSynchro[$orderOpendistrib->id] = false; | ||||
foreach ($ordersTiller->orders as $orderTiller) { | |||||
if ($orderOpendistrib->id == $orderTiller->externalId | |||||
&& ($orderOpendistrib->getAmountWithTax(Order::AMOUNT_TOTAL) * 100) == $orderTiller->currentBill) { | |||||
if(isset($ordersTiller->orders)) { | |||||
foreach ($ordersTiller->orders as $orderTiller) { | |||||
if ($orderOpendistrib->id == $orderTiller->externalId | |||||
&& ($orderOpendistrib->getAmountWithTax(Order::AMOUNT_TOTAL) * 100) == $orderTiller->currentBill) { | |||||
$ordersOpendistribSynchro[$orderOpendistrib->id] = true; | |||||
$ordersOpendistribSynchro[$orderOpendistrib->id] = true; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
$query = DeliveryNote::find() | $query = DeliveryNote::find() | ||||
->with($optionsSearch['with']) | ->with($optionsSearch['with']) | ||||
->joinWith($optionsSearch['join_with']) | |||||
->where(['delivery_note.id_producer' => GlobalParam::getCurrentProducerId()]) | ->where(['delivery_note.id_producer' => GlobalParam::getCurrentProducerId()]) | ||||
->orderBy('delivery_note.status ASC, delivery_note.reference DESC'); | ->orderBy('delivery_note.status ASC, delivery_note.reference DESC'); | ||||
$query = Invoice::find() | $query = Invoice::find() | ||||
->with($optionsSearch['with']) | ->with($optionsSearch['with']) | ||||
->joinWith($optionsSearch['join_with']) | |||||
->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()]) | ->where(['invoice.id_producer' => GlobalParam::getCurrentProducerId()]) | ||||
->orderBy('invoice.status ASC, invoice.reference DESC'); | ->orderBy('invoice.status ASC, invoice.reference DESC'); | ||||
$query = Quotation::find() | $query = Quotation::find() | ||||
->with($optionsSearch['with']) | ->with($optionsSearch['with']) | ||||
->joinWith($optionsSearch['join_with']) | |||||
->where(['quotation.id_producer' => GlobalParam::getCurrentProducerId()]) | ->where(['quotation.id_producer' => GlobalParam::getCurrentProducerId()]) | ||||
->orderBy('quotation.status ASC, quotation.reference DESC'); | ->orderBy('quotation.status ASC, quotation.reference DESC'); | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function getPrice(priceWithTax, taxRate) { | function getPrice(priceWithTax, taxRate) { | ||||
return parseFloat(parseFloat(priceWithTax) / (taxRate + 1)).toFixed(2); | |||||
return numberTwoDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1))); | |||||
} | } | ||||
/** | /** | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function getPriceWithTax(priceWithoutTax, taxRate) { | function getPriceWithTax(priceWithoutTax, taxRate) { | ||||
return parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1)).toFixed(2); | |||||
return numberTwoDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1))); | |||||
} | |||||
function numberTwoDecimals(num) { | |||||
return (parseInt((num * 100)) / 100).toFixed(2) ; | |||||
} | } | ||||
/** | /** |