some progress
This commit is contained in:
parent
49eb437fd7
commit
3346a98624
|
@ -703,4 +703,6 @@ class HesabdariController extends AbstractController
|
||||||
}
|
}
|
||||||
return $temp;
|
return $temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,22 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Business;
|
use App\Entity\BankAccount;
|
||||||
use App\Entity\Year;
|
use App\Entity\Year;
|
||||||
|
use App\Service\Log;
|
||||||
use App\Service\Jdate;
|
use App\Service\Jdate;
|
||||||
|
use App\Service\Access;
|
||||||
|
use App\Entity\Business;
|
||||||
|
use App\Entity\Cashdesk;
|
||||||
|
use App\Entity\HesabdariRow;
|
||||||
|
use App\Entity\Person;
|
||||||
|
use App\Entity\Salary;
|
||||||
|
use App\Service\Explore;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
class YearController extends AbstractController
|
class YearController extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -44,4 +52,105 @@ class YearController extends AbstractController
|
||||||
return $this->json($yearLoad);
|
return $this->json($yearLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/year/lastyear/info', name: 'app_year_last_year_info')]
|
||||||
|
public function app_year_last_year_info(Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('plugAccproCloseYear');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
//get all banks for calculate
|
||||||
|
$currentYear = $entityManager->getRepository(Year::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'head' => true
|
||||||
|
]);
|
||||||
|
|
||||||
|
//get all banks for calculate
|
||||||
|
$banks = $entityManager->getRepository(BankAccount::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
]);
|
||||||
|
$banksBs = 0;
|
||||||
|
$banksBd = 0;
|
||||||
|
foreach ($banks as $item) {
|
||||||
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
'bank' => $item,
|
||||||
|
'year' => $currentYear
|
||||||
|
]);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$banksBd += $row->getBd();
|
||||||
|
$banksBs += $row->getBs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [];
|
||||||
|
$response['banks'] = [
|
||||||
|
'bs' => $banksBs,
|
||||||
|
'bd' => $banksBd
|
||||||
|
];
|
||||||
|
|
||||||
|
//get all cashdesks for calculate
|
||||||
|
$cashdesks = $entityManager->getRepository(Cashdesk::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
]);
|
||||||
|
$cashdesksBs = 0;
|
||||||
|
$cashdesksBd = 0;
|
||||||
|
foreach ($cashdesks as $item) {
|
||||||
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
'cashdesk' => $item,
|
||||||
|
'year' => $currentYear
|
||||||
|
]);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$cashdesksBd += $row->getBd();
|
||||||
|
$cashdesksBs += $row->getBs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response['cashdesks'] = [
|
||||||
|
'bs' => $cashdesksBs,
|
||||||
|
'bd' => $cashdesksBd
|
||||||
|
];
|
||||||
|
|
||||||
|
//get all salarys for calculate
|
||||||
|
$salarys = $entityManager->getRepository(Salary::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
]);
|
||||||
|
$salarysBs = 0;
|
||||||
|
$salarysBd = 0;
|
||||||
|
foreach ($salarys as $item) {
|
||||||
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
'salary' => $item,
|
||||||
|
'year' => $currentYear
|
||||||
|
]);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$salarysBd += $row->getBd();
|
||||||
|
$salarysBs += $row->getBs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response['salarys'] = [
|
||||||
|
'bs' => $salarysBs,
|
||||||
|
'bd' => $salarysBd
|
||||||
|
];
|
||||||
|
|
||||||
|
//get all debtor for calculate
|
||||||
|
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
]);
|
||||||
|
$debtorsBs = 0;
|
||||||
|
$debtorsBd = 0;
|
||||||
|
foreach ($persons as $item) {
|
||||||
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
'person' => $item,
|
||||||
|
'year' => $currentYear
|
||||||
|
]);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$debtorsBd += $row->getBd();
|
||||||
|
$debtorsBs += $row->getBs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response['persons'] = [
|
||||||
|
'bs' => $debtorsBs,
|
||||||
|
'bd' => $debtorsBd
|
||||||
|
];
|
||||||
|
|
||||||
|
$response['year'] = Explore::ExploreYear($currentYear);
|
||||||
|
return $this->json($response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,8 @@ class PersonRepository extends ServiceEntityRepository
|
||||||
public function searchByNikename(Business $bid,string $search,int $maxResults = 10): array
|
public function searchByNikename(Business $bid,string $search,int $maxResults = 10): array
|
||||||
{
|
{
|
||||||
return $this->createQueryBuilder('p')
|
return $this->createQueryBuilder('p')
|
||||||
->andwhere('p.bid = :val')
|
->where('p.bid = :val')
|
||||||
->andWhere("p.nikename LIKE :search")
|
->andWhere("p.nikename LIKE :search OR p.mobile LIKE :search")
|
||||||
->orWhere("p.mobile LIKE :search")
|
|
||||||
->setParameter('val', $bid)
|
->setParameter('val', $bid)
|
||||||
->setParameter('search', '%' . $search . '%')
|
->setParameter('search', '%' . $search . '%')
|
||||||
->setMaxResults($maxResults)
|
->setMaxResults($maxResults)
|
||||||
|
|
Loading…
Reference in a new issue