diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php index 4754c2f..dc4dafc 100644 --- a/hesabixCore/src/Controller/AdminController.php +++ b/hesabixCore/src/Controller/AdminController.php @@ -147,6 +147,37 @@ class AdminController extends AbstractController return $this->json($resp); } + #[Route('/api/admin/business/count', name: 'admin_business_count')] + public function admin_business_count(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response + { + return $this->json($entityManager->getRepository(Business::class)->countAll()); + } + + #[Route('/api/admin/business/search', name: 'admin_business_list_search')] + public function admin_business_list_search(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response + { + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + $items = $entityManager->getRepository(Business::class)->findByPage($params['options']['page'],$params['options']['rowsPerPage'],$params['search']); + $resp = []; + foreach ($items as $item) { + $temp = []; + $temp['id'] = $item->getId(); + $temp['name'] = $item->getName(); + $temp['owner'] = $item->getOwner()->getFullName(); + $temp['ownerMobile'] = $item->getOwner()->getMobile(); + $temp['dateRegister'] = $jdate->jdate('Y/n/d', $item->getDateSubmit()); + $temp['commodityCount'] = count($entityManager->getRepository(Commodity::class)->findBy(['bid' => $item])); + $temp['personsCount'] = count($entityManager->getRepository(Person::class)->findBy(['bid' => $item])); + $temp['hesabdariDocsCount'] = count($entityManager->getRepository(HesabdariDoc::class)->findBy(['bid' => $item])); + $temp['StoreroomDocsCount'] = count($entityManager->getRepository(StoreroomTicket::class)->findBy(['bid' => $item])); + $resp[] = $temp; + } + return $this->json($resp); + } + #[Route('/api/admin/settings/sms/info', name: 'admin_settings_sms_info')] public function admin_settings_sms_info(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response { diff --git a/hesabixCore/src/Controller/PreinvoiceController.php b/hesabixCore/src/Controller/PreinvoiceController.php new file mode 100644 index 0000000..fb06ea9 --- /dev/null +++ b/hesabixCore/src/Controller/PreinvoiceController.php @@ -0,0 +1,18 @@ +render('preinvoice/index.html.twig', [ + 'controller_name' => 'PreinvoiceController', + ]); + } +} diff --git a/hesabixCore/src/Repository/BusinessRepository.php b/hesabixCore/src/Repository/BusinessRepository.php index fe93f4c..d7c6b94 100644 --- a/hesabixCore/src/Repository/BusinessRepository.php +++ b/hesabixCore/src/Repository/BusinessRepository.php @@ -39,22 +39,36 @@ class BusinessRepository extends ServiceEntityRepository } } -// /** -// * @return Business[] Returns an array of Business objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('b') -// ->andWhere('b.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('b.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + /** + * @return Business[] Returns an array of Business objects + */ + public function findByPage($page = 0, $take = 25, $search = ''): array + { + $query = $this->createQueryBuilder('b') + ->setFirstResult($page * $take) + ->orderBy('b.id', 'DESC') + ->setMaxResults($take); + + if ($search != '') { + $query->andWhere("b.name LIKE :search") + ->setParameter('search', '%' . $search . '%'); + } + return $query->getQuery()->getResult(); + } -// public function findOneBySomeField($value): ?Business + /** + * @return integer Returns an integer of Business objects + */ + public function countAll(): int + { + return $this->createQueryBuilder('b') + ->select('count(b.id)') + ->getQuery() + ->getSingleScalarResult() + ; + } + + // public function findOneBySomeField($value): ?Business // { // return $this->createQueryBuilder('b') // ->andWhere('b.exampleField = :val') @@ -64,14 +78,15 @@ class BusinessRepository extends ServiceEntityRepository // ; // } - public function findLast(){ - $res = $this->createQueryBuilder('p') + public function findLast() + { + $res = $this->createQueryBuilder('p') ->orderBy('p.id', 'ASC') ->getQuery() ->getResult() ; - if(count($res) > 0) - return $res[count($res) -1]; + if (count($res) > 0) + return $res[count($res) - 1]; return null; } } diff --git a/hesabixCore/templates/general/repservice.html.twig b/hesabixCore/templates/general/repservice.html.twig index dcff379..5d073e1 100644 --- a/hesabixCore/templates/general/repservice.html.twig +++ b/hesabixCore/templates/general/repservice.html.twig @@ -74,7 +74,7 @@ مشاهده لیست دستگاه های تعمیری
/var/www/next.hesabix.ir/hesabixCore/src/Controller/PreinvoiceController.php
/var/www/next.hesabix.ir/hesabixCore/templates/preinvoice/index.html.twig
پرداخت فاکتور با موفقیت انجام شد. هماکنون میتوانید شماره پیگیری را از بخش پرداختها مشاهده نمایید
-پرداخت فاکتور با موفقیت انجام شد. هماکنون میتوانید شماره پیگیری را از بخش پرداختها مشاهده نمایید
+پرداخت فاکتور ناموفق بود. برای پرداخت مجدد میتوانید دوباره سعی نمایید.
ردیف | -کالا/خدمات | -شرح | -تعداد / مقدار | -مبلغ واحد | -تخفیف | -مالیات | -مبلغ کل | -
---|---|---|---|---|---|---|---|
{{rowIndex}} | -- {{ item.commodity.code }} - - - {{ item.commodity.name }} | -{{ item.des }} | -- {{ item.commdityCount }} - {{ item.commodity.unit.name }} - | -{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }} | -{{ item.discount | number_format }} | -{{ item.tax | number_format}} | -{{ item.bs| number_format }} | -
ردیف | +کالا/خدمات | +شرح | +تعداد / مقدار | +مبلغ واحد | +تخفیف | +مالیات | +مبلغ کل | +
{{rowIndex}} | ++ {{ item.commodity.code }} + - + {{ item.commodity.name }} | +{{ item.des }} | ++ {{ item.commdityCount }} + {{ item.commodity.unit.name }} + | +{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }} | +{{ item.discount | number_format }} | +{{ item.tax | number_format}} | +{{ item.bs| number_format }} | +
ردیف | -روش پرداخت | -تاریخ | -مبلغ | -شماره پیگیری/سند | -توضیحات | -|
---|---|---|---|---|---|---|
ردیف | +روش پرداخت | +تاریخ | +مبلغ | +شماره پیگیری/سند | +توضیحات | +|
{{ loop.index }} | - {% if item.type == 'walletPay' %} -پرداخت آنلاین | - {% else %} -سند حسابداری | - {% endif %} -{{ item.date}} | -{{ item.amount | number_format }} | -{{ item.code }} | -{{ item.des }} | + {% for item in doc.relatedDocs %} +
{{ loop.index }} | + {% if item.type == 'walletPay' %} ++ پرداخت آنلاین | + {% else %} ++ سند حسابداری | + {% endif %} +{{ item.date}} | +{{ item.amount | number_format }} | +{{ item.code }} | +{{ item.des }} | +
جمع کل | +{{ totalPays | number_format }} + {{doc.money.shortName}} + | |||||
جمع کل | -{{ totalPays | number_format }} - ریال - | -