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

@@ -739,7 +739,7 @@ class DistributionController extends BackendController
$pointSale->initOrders($ordersArray);
}

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

@@ -759,7 +759,7 @@ class DistributionController extends BackendController

$index ++ ;

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

table tr th {
font-size: 13px ;
font-size: 10px ;
}
table tr td {
font-size: 11px ;
font-size: 10px ;
}
table thead tr {
@@ -858,7 +858,7 @@ class DistributionController extends BackendController
.th-user,
.td-nb-products {
width: 35px ;
/* width: 35px ; */
text-align: center ;
}

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

@@ -2,7 +2,7 @@

$html = '' ;

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

if(isset($ordersArray[$pointSale->id]) && count($ordersArray[$pointSale->id]) > 0) {
$html .= '<h1>'.$pointSale->name.'</h1>' ;
@@ -73,36 +73,52 @@ foreach($pointsSaleArray as $pointSale) {

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

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

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

echo $html ;

function line_product($product, $orders) {
$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 ;
}

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