@@ -21,7 +21,7 @@ |
||
| 21 | 21 | RequestStack $requestStack |
| 22 | 22 | |
| 23 | 23 | ) { |
| 24 | - $this->request = $requestStack->getCurrentRequest(); |
|
| 24 | + $this->request = $requestStack->getCurrentRequest(); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function calculateOrderPrice(Order $order) |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | use ControleOnline\Entity\Status; |
| 8 | 8 | use Doctrine\ORM\EntityManagerInterface; |
| 9 | 9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
| 10 | - AS Security; |
|
| 10 | + AS Security; |
|
| 11 | 11 | use Doctrine\ORM\QueryBuilder; |
| 12 | 12 | use Symfony\Component\HttpFoundation\RequestStack; |
| 13 | 13 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $quantity = $orderProduct->getQuantity(); |
| 49 | 49 | $this->printService->addLine( |
| 50 | - $indent . $quantity . ' X ' . $product->getProduct(), |
|
| 51 | - " R$ " . number_format($orderProduct->getTotal(), 2, ',', '.'), |
|
| 50 | + $indent.$quantity.' X '.$product->getProduct(), |
|
| 51 | + " R$ ".number_format($orderProduct->getTotal(), 2, ',', '.'), |
|
| 52 | 52 | '.' |
| 53 | 53 | ); |
| 54 | 54 | } |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | foreach ($groupedChildren as $groupName => $orderProductChildren) { |
| 69 | - $this->printService->addLine(strtoupper($groupName) . ":"); |
|
| 69 | + $this->printService->addLine(strtoupper($groupName).":"); |
|
| 70 | 70 | foreach ($orderProductChildren as $orderProductChild) { |
| 71 | 71 | $product = $orderProductChild->getProduct(); |
| 72 | - $this->printService->addLine(" - " . $product->getProduct()); |
|
| 72 | + $this->printService->addLine(" - ".$product->getProduct()); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | $this->printService->addLine('', '', '-'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | foreach ($queues as $queueName => $orderProducts) { |
| 97 | 97 | $parentOrderProducts = array_filter($orderProducts, fn($orderProduct) => $orderProduct->getOrderProduct() === null); |
| 98 | 98 | if (!empty($parentOrderProducts)) { |
| 99 | - $this->printService->addLine(strtoupper($queueName) . ":"); |
|
| 99 | + $this->printService->addLine(strtoupper($queueName).":"); |
|
| 100 | 100 | $this->printQueueProducts($orderProducts); |
| 101 | 101 | $this->printService->addLine('', '', ' '); |
| 102 | 102 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | public function generatePrintData(Order $order, string $printType, string $deviceType) |
| 107 | 107 | { |
| 108 | 108 | |
| 109 | - $this->printService->addLine("PEDIDO #" . $order->getId()); |
|
| 109 | + $this->printService->addLine("PEDIDO #".$order->getId()); |
|
| 110 | 110 | $this->printService->addLine($order->getOrderDate()->format('d/m/Y H:i')); |
| 111 | 111 | $client = $order->getClient(); |
| 112 | 112 | $this->printService->addLine(($client !== null ? $client->getName() : 'Não informado')); |
| 113 | - $this->printService->addLine("R$ " . number_format($order->getPrice(), 2, ',', '.')); |
|
| 113 | + $this->printService->addLine("R$ ".number_format($order->getPrice(), 2, ',', '.')); |
|
| 114 | 114 | $this->printService->addLine("", "", "-"); |
| 115 | 115 | $queues = $this->getQueues($order); |
| 116 | 116 | |
@@ -84,8 +84,9 @@ |
||
| 84 | 84 | $this->printProduct($parentOrderProduct); |
| 85 | 85 | |
| 86 | 86 | $childs = $parentOrderProduct->getOrderProductComponents(); |
| 87 | - if (!empty($childs)) |
|
| 88 | - $this->printChildren($childs); |
|
| 87 | + if (!empty($childs)) { |
|
| 88 | + $this->printChildren($childs); |
|
| 89 | + } |
|
| 89 | 90 | |
| 90 | 91 | $this->printService->addLine('', '', '-'); |
| 91 | 92 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | $this->orderProductQueueService->addProductToQueue($OProduct); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - private function checkInventory(OrderProduct &$orderProduct) |
|
| 58 | + private function checkInventory(OrderProduct & $orderProduct) |
|
| 59 | 59 | { |
| 60 | 60 | $order = $orderProduct->getOrder(); |
| 61 | - $product = $orderProduct->getProduct(); |
|
| 61 | + $product = $orderProduct->getProduct(); |
|
| 62 | 62 | |
| 63 | 63 | if ($order->getOrderType() == 'sale' && !$orderProduct->getOutInventory()) |
| 64 | 64 | $orderProduct->setOutInventory($product->getDefaultOutInventory()); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this->checkInventory($orderProduct); |
| 79 | 79 | foreach ($subProducts as $subproduct) { |
| 80 | 80 | $product = $this->manager->getRepository(Product::class)->find($subproduct['product']); |
| 81 | - $productGroup = $this->manager->getRepository(ProductGroup::class)->find($subproduct['productGroup']); |
|
| 81 | + $productGroup = $this->manager->getRepository(ProductGroup::class)->find($subproduct['productGroup']); |
|
| 82 | 82 | $this->addSubproduct($orderProduct, $product, $productGroup, $subproduct['quantity']); |
| 83 | 83 | } |
| 84 | 84 | $this->orderProductQueueService->addProductToQueue($orderProduct); |
@@ -60,17 +60,21 @@ discard block |
||
| 60 | 60 | $order = $orderProduct->getOrder(); |
| 61 | 61 | $product = $orderProduct->getProduct(); |
| 62 | 62 | |
| 63 | - if ($order->getOrderType() == 'sale' && !$orderProduct->getOutInventory()) |
|
| 64 | - $orderProduct->setOutInventory($product->getDefaultOutInventory()); |
|
| 63 | + if ($order->getOrderType() == 'sale' && !$orderProduct->getOutInventory()) { |
|
| 64 | + $orderProduct->setOutInventory($product->getDefaultOutInventory()); |
|
| 65 | + } |
|
| 65 | 66 | |
| 66 | - if ($order->getOrderType() == 'purchase' && !$orderProduct->getInInventory()) |
|
| 67 | - $orderProduct->setInInventory($product->getDefaultInInventory()); |
|
| 67 | + if ($order->getOrderType() == 'purchase' && !$orderProduct->getInInventory()) { |
|
| 68 | + $orderProduct->setInInventory($product->getDefaultInInventory()); |
|
| 69 | + } |
|
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | public function postPersist(OrderProduct $orderProduct) |
| 71 | 73 | { |
| 72 | 74 | |
| 73 | - if (!self::$mainProduct) return; |
|
| 75 | + if (!self::$mainProduct) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 74 | 78 | self::$mainProduct = false; |
| 75 | 79 | |
| 76 | 80 | $json = json_decode($this->request->getContent(), true); |
@@ -88,7 +92,9 @@ discard block |
||
| 88 | 92 | public function preRemove(OrderProduct $orderProduct) |
| 89 | 93 | { |
| 90 | 94 | |
| 91 | - if (!self::$mainProduct) return; |
|
| 95 | + if (!self::$mainProduct) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 92 | 98 | self::$mainProduct = false; |
| 93 | 99 | $order = $orderProduct->getOrder(); |
| 94 | 100 | $this->manager->persist($order->setPrice(0)); |
@@ -97,8 +103,9 @@ discard block |
||
| 97 | 103 | 'parentProduct' => $orderProduct->getProduct(), |
| 98 | 104 | ]); |
| 99 | 105 | |
| 100 | - foreach ($parentProducts as $parentProduct) |
|
| 101 | - $this->manager->remove($parentProduct); |
|
| 106 | + foreach ($parentProducts as $parentProduct) { |
|
| 107 | + $this->manager->remove($parentProduct); |
|
| 108 | + } |
|
| 102 | 109 | $this->manager->flush(); |
| 103 | 110 | |
| 104 | 111 | self::$calculateBefore[] = $order; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | use ControleOnline\Entity\ProductGroupProduct; |
| 9 | 9 | use Doctrine\ORM\EntityManagerInterface; |
| 10 | 10 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
| 11 | - AS Security; |
|
| 11 | + AS Security; |
|
| 12 | 12 | use Doctrine\ORM\QueryBuilder; |
| 13 | 13 | use Symfony\Component\HttpFoundation\RequestStack; |
| 14 | 14 | |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | use ControleOnline\Entity\Status; |
| 8 | 8 | use Doctrine\ORM\EntityManagerInterface; |
| 9 | 9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
| 10 | - AS Security; |
|
| 10 | + AS Security; |
|
| 11 | 11 | |
| 12 | 12 | class OrderInvoiceService |
| 13 | 13 | { |
@@ -905,8 +905,9 @@ |
||
| 905 | 905 | |
| 906 | 906 | public function canAccess($currentUser): bool |
| 907 | 907 | { |
| 908 | - if (($provider = $this->getProvider()) === null) |
|
| 909 | - return false; |
|
| 908 | + if (($provider = $this->getProvider()) === null) { |
|
| 909 | + return false; |
|
| 910 | + } |
|
| 910 | 911 | |
| 911 | 912 | return $currentUser->getPeople()->getLink()->exists( |
| 912 | 913 | fn($key, $element) => $element->getCompany() === $provider |