|
|
@@ -37,6 +37,7 @@ termes. |
|
|
|
*/ |
|
|
|
|
|
|
|
use common\models\Order ; |
|
|
|
use common\models\Product ; |
|
|
|
|
|
|
|
$dayWeek = date('w', strtotime($date)); |
|
|
|
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday']; |
|
|
@@ -91,7 +92,7 @@ foreach ($pointsSaleArray as $pointSale) { |
|
|
|
$add = false; |
|
|
|
foreach ($order->productOrder as $productOrder) { |
|
|
|
if ($product->id == $productOrder->id_product) { |
|
|
|
$strProducts .= $productOrder->quantity . ' ' . $product->name . ', '; |
|
|
|
$strProducts .= $product->name . ' (' .$productOrder->quantity . ' '.Product::strUnit($productOrder->unit, true, true).'), '; |
|
|
|
$add = true; |
|
|
|
} |
|
|
|
} |
|
|
@@ -133,11 +134,11 @@ foreach ($pointsSaleArray as $pointSale) { |
|
|
|
|
|
|
|
$strProducts = ''; |
|
|
|
foreach ($productsArray as $product) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $pointSale->orders); |
|
|
|
$strQuantity = ''; |
|
|
|
if ($quantity) { |
|
|
|
$strQuantity = $quantity; |
|
|
|
$strProducts .= $strQuantity .' '. $product->name . ', '; |
|
|
|
foreach(Product::$unitsArray as $unit => $dataUnit) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); |
|
|
|
if ($quantity) { |
|
|
|
$strProducts .= $product->name . ' (' .$quantity . ' '.Product::strUnit($unit, true, true).'), '; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -170,14 +171,14 @@ foreach ($pointsSaleArray as $pointSale) |
|
|
|
if (count($pointSale->orders)) |
|
|
|
{ |
|
|
|
$html .= '<tr><td>'.$pointSale->name.'</td><td>' ; |
|
|
|
|
|
|
|
foreach ($productsArray as $product) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $pointSale->orders); |
|
|
|
$strQuantity = ($quantity) ? $quantity : '' ; |
|
|
|
|
|
|
|
if(strlen($strQuantity)) { |
|
|
|
$html .= $strQuantity . ' '.$product->name.', ' ; |
|
|
|
foreach(Product::$unitsArray as $unit => $dataUnit) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); |
|
|
|
if ($quantity) { |
|
|
|
$html .= $product->name . ' (' .$quantity . ' '.Product::strUnit($unit, true, true).'), '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$html = substr($html, 0, strlen($html) - 2) ; |
|
|
@@ -189,10 +190,13 @@ foreach ($pointsSaleArray as $pointSale) |
|
|
|
|
|
|
|
// total |
|
|
|
$html .= '<tr><td><strong>Total</strong></td><td>' ; |
|
|
|
|
|
|
|
foreach ($productsArray as $product) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $ordersArray); |
|
|
|
if($quantity) { |
|
|
|
$html .= $quantity . ' '.$product->name.', ' ; |
|
|
|
foreach(Product::$unitsArray as $unit => $dataUnit) { |
|
|
|
$quantity = Order::getProductQuantity($product->id, $ordersArray, false, $unit); |
|
|
|
if ($quantity) { |
|
|
|
$html .= $product->name . ' (' .$quantity . ' '.Product::strUnit($unit, true, true).'), '; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|