spme progress and bug fix in sell and some other plugins

This commit is contained in:
babak alizadeh 2024-06-04 14:23:07 +03:30
parent f71147a127
commit 1804a01c2a
2 changed files with 84 additions and 1 deletions

View file

@ -17,6 +17,7 @@ use App\Entity\PlugNoghreOrder;
use App\Entity\Salary; use App\Entity\Salary;
use App\Entity\StoreroomTicket; use App\Entity\StoreroomTicket;
use App\Service\Access; use App\Service\Access;
use App\Service\Explore;
use App\Service\Jdate; use App\Service\Jdate;
use App\Service\JsonResp; use App\Service\JsonResp;
use App\Service\Log; use App\Service\Log;
@ -222,7 +223,7 @@ class HesabdariController extends AbstractController
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item, 'person'); $mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item, 'person');
$temp['person'] = ''; $temp['person'] = '';
if ($mainRow) if ($mainRow)
$temp['person'] = $mainRow->getPerson()->getNikename(); $temp['person'] = Explore::ExplorePerson($mainRow->getPerson());
} }
//get status of doc //get status of doc

View file

@ -723,6 +723,47 @@ class PersonsController extends AbstractController
return $this->json(['id' => $pid]); return $this->json(['id' => $pid]);
} }
#[Route('/api/person/receive/list/search', name: 'app_persons_receive_list_search')]
public function app_persons_receive_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
{
$acc = $access->hasRole('person_receive');
if (!$acc)
throw $this->createAccessDeniedException();
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy(
[
'bid' => $acc['bid'],
'type' => 'person_receive',
'year'=>$acc['year']
],
['id' => 'DESC']
);
$res = [];
foreach($items as $item){
$temp = [
'id'=>$item->getId(),
'date'=>$item->getDate(),
'code'=>$item->getCode(),
'des'=>$item->getDes(),
'amount'=>$item->getAmount()
];
$persons = [];
foreach($item->getHesabdariRows() as $row){
if($row->getPerson()){
$persons[] = Explore::ExplorePerson($row->getPerson());
}
}
$temp['persons'] = $persons;
$res[] = $temp;
}
return $this->json($res);
}
/** /**
* @throws Exception * @throws Exception
*/ */
@ -799,6 +840,47 @@ class PersonsController extends AbstractController
return $this->json(['id' => $pid]); return $this->json(['id' => $pid]);
} }
#[Route('/api/person/send/list/search', name: 'app_persons_send_list_search')]
public function app_persons_send_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
{
$acc = $access->hasRole('person_send');
if (!$acc)
throw $this->createAccessDeniedException();
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy(
[
'bid' => $acc['bid'],
'type' => 'person_send',
'year'=>$acc['year']
],
['id' => 'DESC']
);
$res = [];
foreach($items as $item){
$temp = [
'id'=>$item->getId(),
'date'=>$item->getDate(),
'code'=>$item->getCode(),
'des'=>$item->getDes(),
'amount'=>$item->getAmount()
];
$persons = [];
foreach($item->getHesabdariRows() as $row){
if($row->getPerson()){
$persons[] = Explore::ExplorePerson($row->getPerson());
}
}
$temp['persons'] = $persons;
$res[] = $temp;
}
return $this->json($res);
}
/** /**
* @throws Exception * @throws Exception
*/ */