@@ -687,7 +687,8 @@ class DistributionController extends BackendController | |||
if (count($pointSale->orders)) { | |||
// listing commandes | |||
$datas[] = ['> ' . $pointSale->name]; | |||
foreach ($pointSale->orders as $order) { | |||
/*foreach ($pointSale->orders as $order) { | |||
$orderLine = [$order->getStrUser()]; | |||
foreach ($productsIndexArray as $idProduct => $indexProduct) { | |||
@@ -704,7 +705,7 @@ class DistributionController extends BackendController | |||
} | |||
} | |||
$datas[] = $this->_lineOrderReportCSV($orderLine, $cpt - 1, true); | |||
} | |||
}*/ | |||
// total point de vente | |||
$totalsPointSaleArray = $this->_totalReportCSV( | |||
@@ -714,7 +715,6 @@ class DistributionController extends BackendController | |||
$productsIndexArray | |||
); | |||
$datas[] = $this->_lineOrderReportCSV($totalsPointSaleArray, $cpt - 1, true); | |||
$datas[] = []; | |||
} | |||
} | |||
@@ -81,10 +81,10 @@ class ReportController extends BackendController | |||
// distributions | |||
$firstDistribution = Distribution::searchOne([], [ | |||
'orderby' => 'id ASC' | |||
'orderby' => 'date ASC' | |||
]) ; | |||
$lastDistribution = Distribution::searchOne([], [ | |||
'orderby' => 'id DESC' | |||
'orderby' => 'date DESC' | |||
]) ; | |||
$firstYear = date('Y',strtotime($firstDistribution->date)) ; |
@@ -92,14 +92,13 @@ foreach ($pointsSaleArray as $pointSale) { | |||
foreach ($productsArray as $product) { | |||
$add = false; | |||
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) ; | |||
$strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')<br />'; | |||
$add = true; | |||
} | |||
} | |||
} | |||
$html .= '<td>'.substr($strProducts, 0, strlen($strProducts) - 6).'</td>'; | |||
if($isBig) { | |||
@@ -109,9 +108,17 @@ foreach ($pointsSaleArray as $pointSale) { | |||
if($pointSale->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>' ; | |||
} | |||
@@ -396,7 +396,7 @@ class User extends ActiveRecordCommon implements IdentityInterface | |||
$query->andFilterWhere(['like', 'phone', $params['phone']]); | |||
} | |||
$query->orderBy('user.lastname ASC, user.name ASC'); | |||
$query->orderBy('user.type DESC, user.lastname ASC, user.name ASC'); | |||
return $query; | |||
} |