add some report
This commit is contained in:
parent
733d1ecad7
commit
6614093aca
|
@ -540,7 +540,8 @@ class BusinessController extends AbstractController
|
|||
]);
|
||||
|
||||
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$buss
|
||||
'bid'=>$buss,
|
||||
'year'=>$year,
|
||||
]);
|
||||
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
|
@ -550,7 +551,23 @@ class BusinessController extends AbstractController
|
|||
$bssum = 0;
|
||||
foreach ($rows as $row)
|
||||
$bssum += $row->getBs();
|
||||
|
||||
$buys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$buss,
|
||||
'year'=>$year,
|
||||
'type'=>'buy',
|
||||
]);
|
||||
$buysTotal = 0;
|
||||
foreach($buys as $item)
|
||||
$buysTotal += $item->getAmount();
|
||||
|
||||
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$buss,
|
||||
'year'=>$year,
|
||||
'type'=>'sell',
|
||||
]);
|
||||
$sellsTotal = 0;
|
||||
foreach($sells as $item)
|
||||
$sellsTotal += $item->getAmount();
|
||||
$response = [
|
||||
'personCount'=>count($persons),
|
||||
'bankCount'=>count($banks),
|
||||
|
@ -558,7 +575,9 @@ class BusinessController extends AbstractController
|
|||
'income'=> $bssum,
|
||||
'commodity'=>count($entityManager->getRepository(Commodity::class)->findby([
|
||||
'bid'=>$buss
|
||||
]))
|
||||
])),
|
||||
'buys_total'=>$buysTotal,
|
||||
'sells_total'=>$sellsTotal,
|
||||
];
|
||||
return $this->json($response);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,10 @@ class HesabdariController extends AbstractController
|
|||
$temp['ref'] = $item->getCommodity()->getName();
|
||||
$temp['refCode'] = $item->getCommodity()->getCode();
|
||||
$temp['count'] = $item->getCommdityCount();
|
||||
$temp['unitPrice'] = $item->getBs()/$item->getCommdityCount();
|
||||
if($doc->getType() == 'sell')
|
||||
$temp['unitPrice'] = $item->getBs()/$item->getCommdityCount();
|
||||
elseif($doc->getType() == 'buy')
|
||||
$temp['unitPrice'] = $item->getBd()/$item->getCommdityCount();
|
||||
$temp['commodity'] = [
|
||||
'id' => $item->getCommodity()->getId(),
|
||||
'name' => $item->getCommodity()->getName(),
|
||||
|
|
|
@ -158,7 +158,6 @@ class PersonsController extends AbstractController
|
|||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
}
|
||||
|
||||
$response = $provider->ArrayEntity2Array($persons,0);
|
||||
foreach ($persons as $key =>$person){
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
|
@ -177,6 +176,179 @@ class PersonsController extends AbstractController
|
|||
return $this->json($response);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list/debtors/{amount}', name: 'app_persons_list_debtors')]
|
||||
public function app_persons_list_debtors(string $amount,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('person'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(array_key_exists('speedAccess',$params)){
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'speedAccess'=>true
|
||||
]);
|
||||
}
|
||||
else{
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
}
|
||||
|
||||
$response = $provider->ArrayEntity2Array($persons,0);
|
||||
foreach ($persons as $key =>$person){
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'person'=>$person
|
||||
]);
|
||||
$bs = 0;
|
||||
$bd = 0;
|
||||
foreach ($rows as $row){
|
||||
$bs += $row->getBs();
|
||||
$bd += $row->getBd();
|
||||
}
|
||||
$response[$key]['bs'] = $bs;
|
||||
$response[$key]['bd'] = $bd;
|
||||
$response[$key]['balance'] = $bs - $bd;
|
||||
}
|
||||
$result = [];
|
||||
foreach ($response as $key =>$person){
|
||||
if($person['bd'] - $person['bs'] > $amount ){
|
||||
array_push($result,$person);
|
||||
}
|
||||
}
|
||||
return $this->json($result);
|
||||
}
|
||||
#[Route('/api/person/list/debtors/print/{amount}', name: 'app_persons_debtors_list_print')]
|
||||
public function app_persons_debtors_list_print(string $amount,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('person');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
$response = $provider->ArrayEntity2Array($persons,0);
|
||||
foreach ($persons as $key =>$person){
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'person'=>$person
|
||||
]);
|
||||
$bs = 0;
|
||||
$bd = 0;
|
||||
foreach ($rows as $row){
|
||||
$bs += $row->getBs();
|
||||
$bd += $row->getBd();
|
||||
}
|
||||
$response[$key]['bs'] = $bs;
|
||||
$response[$key]['bd'] = $bd;
|
||||
$response[$key]['balance'] = $bs - $bd;
|
||||
}
|
||||
$result = [];
|
||||
foreach ($response as $key =>$person){
|
||||
if($person['bd'] - $person['bs'] > $amount ){
|
||||
array_push($result,$person);
|
||||
}
|
||||
}
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/personsDebtors.html.twig',[
|
||||
'page_title'=>'فهرست بدهکاران',
|
||||
'bid'=>$acc['bid'],
|
||||
'persons'=>$result
|
||||
]));
|
||||
return $this->json(['id'=>$pid]);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list/depositors/{amount}', name: 'app_persons_list_depoistors')]
|
||||
public function app_persons_list_depoistors(string $amount,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('person'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(array_key_exists('speedAccess',$params)){
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'speedAccess'=>true
|
||||
]);
|
||||
}
|
||||
else{
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
}
|
||||
|
||||
$response = $provider->ArrayEntity2Array($persons,0);
|
||||
foreach ($persons as $key =>$person){
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'person'=>$person
|
||||
]);
|
||||
$bs = 0;
|
||||
$bd = 0;
|
||||
foreach ($rows as $row){
|
||||
$bs += $row->getBs();
|
||||
$bd += $row->getBd();
|
||||
}
|
||||
$response[$key]['bs'] = $bs;
|
||||
$response[$key]['bd'] = $bd;
|
||||
$response[$key]['balance'] = $bs - $bd;
|
||||
}
|
||||
$result = [];
|
||||
foreach ($response as $key =>$person){
|
||||
if($person['bs'] - $person['bd'] > $amount ){
|
||||
array_push($result,$person);
|
||||
}
|
||||
}
|
||||
return $this->json($result);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list/depositors/print/{amount}', name: 'app_persons_depositors_list_print')]
|
||||
public function app_persons_depositors_list_print(string $amount,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('person');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
$response = $provider->ArrayEntity2Array($persons,0);
|
||||
foreach ($persons as $key =>$person){
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'person'=>$person
|
||||
]);
|
||||
$bs = 0;
|
||||
$bd = 0;
|
||||
foreach ($rows as $row){
|
||||
$bs += $row->getBs();
|
||||
$bd += $row->getBd();
|
||||
}
|
||||
$response[$key]['bs'] = $bs;
|
||||
$response[$key]['bd'] = $bd;
|
||||
$response[$key]['balance'] = $bs - $bd;
|
||||
}
|
||||
$result = [];
|
||||
foreach ($response as $key =>$person){
|
||||
if($person['bs'] - $person['bd'] > $amount ){
|
||||
array_push($result,$person);
|
||||
}
|
||||
}
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/personsDepositors.html.twig',[
|
||||
'page_title'=>'فهرست بستانکاران',
|
||||
'bid'=>$acc['bid'],
|
||||
'persons'=>$result
|
||||
]));
|
||||
return $this->json(['id'=>$pid]);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list/print', name: 'app_persons_list_print')]
|
||||
public function app_persons_list_print(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue