Browse Source

Merge branch 'dev'

master
Guillaume 3 years ago
parent
commit
70e5c5ede8
2 changed files with 39 additions and 23 deletions
  1. +7
    -7
      backend/controllers/DistributionController.php
  2. +32
    -16
      backend/views/distribution/report-grid.php

+ 7
- 7
backend/controllers/DistributionController.php View File

$pointSale->initOrders($ordersArray); $pointSale->initOrders($ordersArray);
} }


$ordersByPage = 12 ;
$ordersByPage = 22 ;
$nbPages = ceil(count($ordersArray) / $ordersByPage) ; $nbPages = ceil(count($ordersArray) / $ordersByPage) ;
$ordersArrayPaged = [] ; $ordersArrayPaged = [] ;




$index ++ ; $index ++ ;


if($index == $ordersByPage - 1) {
if($index == $ordersByPage) {
$index = 0 ; $index = 0 ;
$indexPage ++ ; $indexPage ++ ;
} }
padding: 0px ; padding: 0px ;
margin: 0px ; margin: 0px ;
border: solid 1px #e0e0e0 ; border: solid 1px #e0e0e0 ;
padding: 3px 8px ;
padding: 3px ;
vertical-align : top; vertical-align : top;
page-break-inside: avoid !important; page-break-inside: avoid !important;
} }


table tr th { table tr th {
font-size: 13px ;
font-size: 10px ;
} }
table tr td { table tr td {
font-size: 11px ;
font-size: 10px ;
} }
table thead tr { table thead tr {
.th-user, .th-user,
.td-nb-products { .td-nb-products {
width: 35px ;
/* width: 35px ; */
text-align: center ; text-align: center ;
} }

+ 32
- 16
backend/views/distribution/report-grid.php View File



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


foreach($pointsSaleArray as $pointSale) {
foreach($pointsSaleArray as $keyPointSale => $pointSale) {


if(isset($ordersArray[$pointSale->id]) && count($ordersArray[$pointSale->id]) > 0) { if(isset($ordersArray[$pointSale->id]) && count($ordersArray[$pointSale->id]) > 0) {
$html .= '<h1>'.$pointSale->name.'</h1>' ; $html .= '<h1>'.$pointSale->name.'</h1>' ;


$html .= '</tbody></table>'; $html .= '</tbody></table>';


$html .= '<pagebreak>';
$html .= ' <pagebreak>';
} }
} }
} }


echo($html) ;
$html = substr($html, 0, strlen($html) - 11) ;

echo $html ;


function line_product($product, $orders) { function line_product($product, $orders) {
$html = '' ; $html = '' ;


$html .= '<tr>' ;
$html .= '<td>'.$product->name.'</td>' ;
if(has_quantity($product, $orders)) {
$html .= '<tr>' ;
$html .= '<td>'.$product->name.'</td>' ;


foreach($orders as $order) {
$quantity = '' ;
foreach($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'.Product::strUnit($productOrder->unit, 'wording_short', true) ;
foreach($orders as $order) {
$quantity = '' ;
foreach($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
$unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : '&nbsp;'.Product::strUnit($productOrder->unit, 'wording_short', true) ;


$quantity .= $productOrder->quantity .$unit ;
if($productOrder->quantity > 1) {
$quantity = '<strong>'.$quantity.'</strong>' ;
$quantity .= $productOrder->quantity .$unit ;
if($productOrder->quantity > 1) {
$quantity = '<strong>'.$quantity.'</strong>' ;
}
} }
} }

$html .= '<td class="td-nb-products">'.$quantity.'</td>' ;
} }


$html .= '<td class="td-nb-products">'.$quantity.'</td>' ;
$html .= '</tr>' ;
} }


$html .= '</tr>' ;

return $html ; return $html ;
} }

function has_quantity($product, $orders) {
foreach($orders as $order) {
foreach($order->productOrder as $productOrder) {
if($product->id == $productOrder->id_product) {
return true ;
}
}
}

return false ;
}

Loading…
Cancel
Save