bug fix in store room extracy data

This commit is contained in:
Hesabix 2024-11-09 11:10:18 +00:00
parent f85d73e195
commit 5343345f15
2 changed files with 23 additions and 13 deletions

View file

@ -30,7 +30,7 @@ use Symfony\Component\Routing\Annotation\Route;
class StoreroomController extends AbstractController class StoreroomController extends AbstractController
{ {
#[Route('/api/storeroom/list/{type}', name: 'app_storeroom_list')] #[Route('/api/storeroom/list/{type}', name: 'app_storeroom_list')]
public function app_storeroom_list(Extractor $extractor,Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, string $type = 'active'): JsonResponse public function app_storeroom_list(Extractor $extractor, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, string $type = 'active'): JsonResponse
{ {
$acc = $access->hasRole('store'); $acc = $access->hasRole('store');
if (!$acc) if (!$acc)
@ -45,7 +45,13 @@ class StoreroomController extends AbstractController
'bid' => $acc['bid'], 'bid' => $acc['bid'],
]); ]);
return $this->json($extractor->operationSuccess(Explore::ExploreStoreRooms($items))); return $this->json(
$extractor->operationSuccess(
Explore::ExploreStoreRooms(
$items
)
)
);
} }
#[Route('/api/storeroom/mod/{code}', name: 'app_storeroom_mod')] #[Route('/api/storeroom/mod/{code}', name: 'app_storeroom_mod')]
@ -122,7 +128,7 @@ class StoreroomController extends AbstractController
$buys = $entityManager->getRepository(HesabdariDoc::class)->findBy([ $buys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'type' => 'buy', 'type' => 'buy',
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
$buysForExport = []; $buysForExport = [];
foreach ($buys as $buy) { foreach ($buys as $buy) {
@ -143,7 +149,7 @@ class StoreroomController extends AbstractController
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([ $sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'type' => 'sell', 'type' => 'sell',
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
$sellsForExport = []; $sellsForExport = [];
foreach ($sells as $sell) { foreach ($sells as $sell) {
@ -164,7 +170,7 @@ class StoreroomController extends AbstractController
$rfsells = $entityManager->getRepository(HesabdariDoc::class)->findBy([ $rfsells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'type' => 'rfsell', 'type' => 'rfsell',
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
$rfsellsForExport = []; $rfsellsForExport = [];
foreach ($rfsells as $sell) { foreach ($rfsells as $sell) {
@ -185,7 +191,7 @@ class StoreroomController extends AbstractController
$rfbuys = $entityManager->getRepository(HesabdariDoc::class)->findBy([ $rfbuys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'type' => 'rfbuy', 'type' => 'rfbuy',
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
$rfbuysForExport = []; $rfbuysForExport = [];
foreach ($rfbuys as $buy) { foreach ($rfbuys as $buy) {
@ -243,7 +249,7 @@ class StoreroomController extends AbstractController
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'code' => $id, 'code' => $id,
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
if (!$doc) if (!$doc)
throw $this->createNotFoundException('سند یافت نشد.'); throw $this->createNotFoundException('سند یافت نشد.');
@ -341,7 +347,7 @@ class StoreroomController extends AbstractController
} }
#[Route('/api/storeroom/ticket/insert', name: 'app_storeroom_ticket_insert')] #[Route('/api/storeroom/ticket/insert', name: 'app_storeroom_ticket_insert')]
public function app_storeroom_ticket_insert(PluginService $pluginService,registryMGR $registryMGR, SMS $sms, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse public function app_storeroom_ticket_insert(PluginService $pluginService, registryMGR $registryMGR, SMS $sms, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
{ {
$acc = $access->hasRole('store'); $acc = $access->hasRole('store');
if (!$acc) if (!$acc)
@ -357,7 +363,7 @@ class StoreroomController extends AbstractController
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
'id' => $params['doc']['id'], 'id' => $params['doc']['id'],
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'money'=> $acc['money'] 'money' => $acc['money']
]); ]);
if (!$doc) if (!$doc)
throw $this->createNotFoundException('سند یافت نشد'); throw $this->createNotFoundException('سند یافت نشد');
@ -446,9 +452,12 @@ class StoreroomController extends AbstractController
$entityManager->persist($ticket); $entityManager->persist($ticket);
$entityManager->flush(); $entityManager->flush();
if ($transferType->getName() == 'باربری') { if ($transferType->getName() == 'باربری') {
if($ticket->getTransfer() == null) $ticket->setTransfer(0); if ($ticket->getTransfer() == null)
if($ticket->getReferral() == null) $ticket->setReferral(0); $ticket->setTransfer(0);
if($ticket->getSenderTel() == null) $ticket->setSenderTel(0); if ($ticket->getReferral() == null)
$ticket->setReferral(0);
if ($ticket->getSenderTel() == null)
$ticket->setSenderTel(0);
$smsres = $sms->sendByBalance( $smsres = $sms->sendByBalance(
[ [
$person->getNikename(), $person->getNikename(),

View file

@ -471,7 +471,8 @@ class Explore
'name' => $item->getName(), 'name' => $item->getName(),
'tel' => $item->getTel(), 'tel' => $item->getTel(),
'address' => $item->getAdr(), 'address' => $item->getAdr(),
'manager' => $item->getManager() 'manager' => $item->getManager(),
'active'=>$item->isActive()
]; ];
} }