| @@ 231-245 (lines=15) @@ | ||
| 228 | * @param \App\Entity\Orders\Orders $orders The order to process |
|
| 229 | * @param \Doctrine\Common\Persistence\ObjectManager $etm Entity Manager |
|
| 230 | */ |
|
| 231 | private function saveOrdersArticles($articles, $orders, $etm) |
|
| 232 | { |
|
| 233 | foreach ($articles as $article) { |
|
| 234 | $ordersArticles = new OrdersArticles(); |
|
| 235 | $ordersArticles->setOrders($orders); |
|
| 236 | $ordersArticles->setArticle($article); |
|
| 237 | $ordersArticles->setUnitStorage($article->getUnitStorage()); |
|
| 238 | if ($article->getMinstock() > $article->getQuantity()) { |
|
| 239 | $ordersArticles->setQuantity($article->getMinstock() - $article->getQuantity()); |
|
| 240 | } |
|
| 241 | $ordersArticles->setPrice($article->getPrice()); |
|
| 242 | $ordersArticles->setTva($article->getTva()); |
|
| 243 | $etm->persist($ordersArticles); |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| 247 | /** |
|
| 248 | * Print the current order.<br />Creating a `PDF` file for viewing on paper |
|
| @@ 338-353 (lines=16) @@ | ||
| 335 | * @param \App\Entity\Stocks\Inventory $inventory |
|
| 336 | * @param \Doctrine\Common\Persistence\ObjectManager $etm |
|
| 337 | */ |
|
| 338 | private function saveInventoryArticles(array $articles, Inventory $inventory, ObjectManager $etm) |
|
| 339 | { |
|
| 340 | foreach ($articles as $article) { |
|
| 341 | foreach ($article->getZoneStorages()->getSnapshot() as $zoneStorage) { |
|
| 342 | $inventoryArticles = new InventoryArticles(); |
|
| 343 | $inventoryArticles->setArticle($article); |
|
| 344 | $inventoryArticles->setInventory($inventory); |
|
| 345 | $inventoryArticles->setQuantity($article->getQuantity()); |
|
| 346 | $inventoryArticles->setRealstock(0); |
|
| 347 | $inventoryArticles->setUnitStorage($article->getUnitStorage()); |
|
| 348 | $inventoryArticles->setPrice($article->getPrice()); |
|
| 349 | $inventoryArticles->setZoneStorage($zoneStorage->getName()); |
|
| 350 | $etm->persist($inventoryArticles); |
|
| 351 | } |
|
| 352 | } |
|
| 353 | } |
|
| 354 | } |
|
| 355 | ||