Browse Source

[backend] Récap : produits sur 2 colonnes

refactoring
Guillaume 4 years ago
parent
commit
00551c3f2d
1 changed files with 18 additions and 4 deletions
  1. +18
    -4
      backend/views/distribution/report.php

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



$html = '' ; $html = '' ;


$count = count($productsArray) ;
$limit = 100 ;
$isBig = $count > $limit ;

// par point de vente // par point de vente
foreach ($pointsSaleArray as $pointSale) { foreach ($pointsSaleArray as $pointSale) {
if (count($pointSale->orders)) { if (count($pointSale->orders)) {
. '<tr>' . '<tr>'
. '<th>Client</th>' . '<th>Client</th>'
. '<th>Produits</th>' . '<th>Produits</th>'
. ($isBig ? '<th>Produits</th>' : '')
. '<th>Commentaire</th>' . '<th>Commentaire</th>'
. $colCredit . $colCredit
. '<th>Montant</th>' . '<th>Montant</th>'
$html .= '<tr><td><strong>Total</strong></td>' ; $html .= '<tr><td><strong>Total</strong></td>' ;
$strProducts = ''; $strProducts = '';
$cpt = 0 ;
foreach ($productsArray as $product) { foreach ($productsArray as $product) {
foreach(Product::$unitsArray as $unit => $dataUnit) { foreach(Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); $quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit);
$strProducts .= $product->name . ' (' .$quantity .$theUnit.')<br />'; $strProducts .= $product->name . ' (' .$quantity .$theUnit.')<br />';
} }
} }

if($isBig && $cpt == $limit) {
$strProducts .= '</td><td>' ;
}

$cpt ++ ;
} }
$strProducts = substr($strProducts, 0, strlen($strProducts) - 6) ; $strProducts = substr($strProducts, 0, strlen($strProducts) - 6) ;


// par point de vente // par point de vente


$count = count($productsArray) ;
$limit = 100 ;
$isBig = $count > $limit ;

$html .= '<h3>Points de vente</h3>' ; $html .= '<h3>Points de vente</h3>' ;
$html .= '<table class="">' $html .= '<table class="">'
. '<thead>' . '<thead>'
// total // total
$html .= '<tr><td><strong>Total</strong></td><td>' ; $html .= '<tr><td><strong>Total</strong></td><td>' ;


$cpt = 0 ;
foreach ($productsArray as $product) { foreach ($productsArray as $product) {
foreach(Product::$unitsArray as $unit => $dataUnit) { foreach(Product::$unitsArray as $unit => $dataUnit) {
$quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit); $quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit);
$html .= $product->name . ' (' .$quantity .$theUnit.')<br />'; $html .= $product->name . ' (' .$quantity .$theUnit.')<br />';
} }
} }
if($isBig && $cpt == $limit) {
$html .= '</td><td>' ;
}

$cpt ++ ;
} }


$html = substr($html, 0, strlen($html) - 6) ; $html = substr($html, 0, strlen($html) - 6) ;

Loading…
Cancel
Save