Browse Source

[backend] Export PDF : correctif bug crédit (affichage crédit autre producteur)

dev
Guillaume 4 years ago
parent
commit
e929a07053
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      backend/views/distribution/report.php

+ 11
- 4
backend/views/distribution/report.php View File

foreach ($productsArray as $product) { foreach ($productsArray as $product) {
$add = false; $add = false;
foreach ($order->productOrder as $productOrder) { foreach ($order->productOrder as $productOrder) {
if ($product->id == $productOrder->id_product) {
if($product->id == $productOrder->id_product) {
$unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($productOrder->unit, 'wording_short', true) ; $unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($productOrder->unit, 'wording_short', true) ;
$strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')<br />'; $strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')<br />';
$add = true; $add = true;
} }
} }
} }

$html .= '<td>'.substr($strProducts, 0, strlen($strProducts) - 6).'</td>'; $html .= '<td>'.substr($strProducts, 0, strlen($strProducts) - 6).'</td>';
if($isBig) { if($isBig) {
if($pointSale->credit) { if($pointSale->credit) {
$credit = '' ; $credit = '' ;
if(isset($order->user) && isset($order->user->userProducer)) {
$credit = number_format($order->user->userProducer[0]->credit,2).' €' ;

if(isset($order->user) && $order->user->id) {
$userProducer = UserProducer::searchOne([
'id_user' => $order->user->id
]);

if($userProducer) {
$credit = number_format($userProducer->credit,2).' €' ;
}
} }

$html .= '<td>'.$credit.'</td>' ; $html .= '<td>'.$credit.'</td>' ;
} }

Loading…
Cancel
Save