diff --git a/hesabixCore/src/Controller/ArchiveController.php b/hesabixCore/src/Controller/ArchiveController.php index 6e54653..52b0784 100644 --- a/hesabixCore/src/Controller/ArchiveController.php +++ b/hesabixCore/src/Controller/ArchiveController.php @@ -93,6 +93,7 @@ class ArchiveController extends AbstractController $result = $payMGR->createRequest($order->getPrice(), $this->generateUrl('api_archive_buy_verify', ["id"=>$order->getId()], UrlGeneratorInterface::ABSOLUTE_URL), 'خرید فضای ابری'); if ($result['Success']) { $order->setGatePay($result['gate']); + $order->setVerifyCode($result['authkey']); $entityManager->persist($order); $entityManager->flush(); $log->insert('سرویس فضای ابری', 'صدور فاکتور سرویس فضای ابری به مقدار ' . $params['space'] . ' گیگابایت به مدت ' . $params['month'] . ' ماه ', $this->getUser(), $acc['bid']); @@ -107,7 +108,7 @@ class ArchiveController extends AbstractController if (!$req) throw $this->createNotFoundException(''); - $res = $payMGR->verify($req->getPrice(), $id, $request); + $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request); if ($res['Success'] == false) { $log->insert('سرویس فضای ابری', 'پرداخت ناموفق سرویس فضای ابری', $this->getUser(), $req->getBid()); return $this->render('buy/fail.html.twig', ['results' => $res]); diff --git a/hesabixCore/src/Controller/BankController.php b/hesabixCore/src/Controller/BankController.php index 290e38f..e6fd3e3 100644 --- a/hesabixCore/src/Controller/BankController.php +++ b/hesabixCore/src/Controller/BankController.php @@ -13,7 +13,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; - +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Writer\Exception; +use Symfony\Component\Serializer\SerializerInterface; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpFoundation\BinaryFileResponse; class BankController extends AbstractController { #[Route('/api/bank/list', name: 'app_bank_list')] @@ -141,4 +146,123 @@ class BankController extends AbstractController $log->insert('بانکداری', ' حساب بانکی با نام ' . $name . ' حذف شد. ', $this->getUser(), $acc['bid']->getId()); return $this->json(['result' => 1]); } + + /** + * @throws Exception + */ + #[Route('/api/bank/card/list/excel', name: 'app_bank_card_list_excel')] + public function app_bank_card_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse|JsonResponse|StreamedResponse + { + $acc = $access->hasRole('banks'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + if (!array_key_exists('code', $params)) + throw $this->createNotFoundException(); + $bank = $entityManager->getRepository(BankAccount::class)->findOneBy(['bid' => $acc['bid'], 'code' => $params['code']]); + if (!$bank) + throw $this->createNotFoundException(); + if (!array_key_exists('items', $params)) { + $transactions = $entityManager->getRepository(HesabdariRow::class)->findBy([ + 'bid' => $acc['bid'], + 'bank' => $bank, + 'year'=>$acc['year'] + ]); + } else { + $transactions = []; + foreach ($params['items'] as $param) { + $prs = $entityManager->getRepository(HesabdariRow::class)->findOneBy([ + 'id' => $param['id'], + 'bid' => $acc['bid'], + 'bank' => $bank, + 'year' => $acc['year'] + ]); + if ($prs) { + $transactions[] = $prs; + } + } + } + $spreadsheet = new Spreadsheet(); + $activeWorksheet = $spreadsheet->getActiveSheet(); + $arrayEntity = [ + [ + 'شماره تراکنش', + 'تاریخ', + 'توضیحات', + 'تفضیل', + 'بستانکار', + 'بدهکار', + 'سال مالی', + ] + ]; + foreach ($transactions as $transaction) { + $arrayEntity[] = [ + $transaction->getId(), + $transaction->getDoc()->getDate(), + $transaction->getDes(), + $transaction->getRef()->getName(), + $transaction->getBs(), + $transaction->getBd(), + $transaction->getYear()->getlabel() + ]; + } + $activeWorksheet->fromArray($arrayEntity, null, 'A1'); + $activeWorksheet->setRightToLeft(true); + $writer = new Xlsx($spreadsheet); + $filePath = __DIR__ . '/../../var/' . $provider->RandomString(12) . '.xlsx'; + $writer->save($filePath); + return new BinaryFileResponse($filePath); + } + + #[Route('/api/bank/card/list/print', name: 'app_bank_card_list_print')] + public function app_bank_card_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse + { + $acc = $access->hasRole('banks'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + if (!array_key_exists('code', $params)) + throw $this->createNotFoundException(); + $bank = $entityManager->getRepository(BankAccount::class)->findOneBy(['bid' => $acc['bid'], 'code' => $params['code']]); + if (!$bank) + throw $this->createNotFoundException(); + + if (!array_key_exists('items', $params)) { + $transactions = $entityManager->getRepository(HesabdariRow::class)->findBy([ + 'bid' => $acc['bid'], + 'bank' => $bank, + 'year'=>$acc['year'] + ]); + } else { + $transactions = []; + foreach ($params['items'] as $param) { + $prs = $entityManager->getRepository(HesabdariRow::class)->findOneBy([ + 'id' => $param['id'], + 'bid' => $acc['bid'], + 'bank' => $bank, + 'year'=>$acc['year'] + ]); + if ($prs) { + $transactions[] = $prs; + } + } + } + $pid = $provider->createPrint( + $acc['bid'], + $this->getUser(), + $this->renderView('pdf/bank_card.html.twig', [ + 'page_title' => 'کارت حساب' . ' ' . $bank->getName(), + 'bid' => $acc['bid'], + 'items' => $transactions, + 'bank' => $bank + ]) + ); + return $this->json(['id' => $pid]); + } } diff --git a/hesabixCore/src/Controller/Front/PayController.php b/hesabixCore/src/Controller/Front/PayController.php index 4fffbef..ad7779d 100644 --- a/hesabixCore/src/Controller/Front/PayController.php +++ b/hesabixCore/src/Controller/Front/PayController.php @@ -13,7 +13,9 @@ use App\Entity\Year; use App\Service\Jdate; use App\Service\Log; use App\Service\Notification; +use App\Service\PayMGR; use App\Service\Provider; +use App\Service\twigFunctions; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -24,213 +26,162 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class PayController extends AbstractController { #[Route('/pay/sell/{id}', name: 'pay_sell')] - public function pay_sell(String $id,EntityManagerInterface $entityManager,Log $log): Response + public function pay_sell(string $id, PayMGR $payMGR, twigFunctions $twigFunctions, EntityManagerInterface $entityManager, Log $log): Response { $doc = $entityManager->getRepository(HesabdariDoc::class)->find($id); - if(!$doc) + if (!$doc) throw $this->createNotFoundException(); //calculate total pays $totalPays = 0; - if($doc->getWalletTransaction()) + if ($doc->getWalletTransaction()) $totalPays += $doc->getWalletTransaction()->getAmount(); foreach ($doc->getRelatedDocs() as $relatedDoc) $totalPays += $relatedDoc->getAmount(); $amountPay = $doc->getAmount() - $totalPays; - //get system settings - $settings = $entityManager->getRepository(Settings::class)->findAll()[0]; - $data = array("merchant_id" => $settings->getZarinpalMerchant(), - "amount" => $amountPay, - "callback_url" => $this->generateUrl('pay_sell_verify',['id'=>$doc->getId()],UrlGeneratorInterface::ABSOLUTE_URL), - "description" => 'پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' .$doc->getBid()->getLegalName(), - ); - $jsonData = json_encode($data); - $ch = curl_init('https://api.zarinpal.com/pg/v4/payment/request.json'); - curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v1'); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen($jsonData) - )); - - $result = curl_exec($ch); - $err = curl_error($ch); - $result = json_decode($result, true, JSON_PRETTY_PRINT); - curl_close($ch); - if ($err) { - throw $this->createAccessDeniedException($err); - } else { - if (empty($result['errors'])) { - if ($result['data']['code'] == 100) { - $tempPay = new PayInfoTemp(); - $tempPay->setBid($doc->getBid()); - $tempPay->setDateSubmit(time()); - $tempPay->setDes('پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' .$doc->getBid()->getLegalName()); - $tempPay->setPrice($amountPay); - $tempPay->setStatus(0); - $tempPay->setDoc($doc); - $tempPay->setVerifyCode($result['data']['authority']); - $tempPay->setGatePay('zarinpal'); - $entityManager->persist($tempPay); - $entityManager->flush(); - $log->insert('کیف پول','ایجاد تراکنش پرداخت برای فاکتور فروش ' . $doc->getCode() ,$this->getUser(),$doc->getBid()); - return $this->redirect('https://www.zarinpal.com/pg/StartPay/' . $result['data']["authority"]); - } - } + $tempPay = new PayInfoTemp(); + $tempPay->setBid($doc->getBid()); + $tempPay->setDateSubmit(time()); + $tempPay->setDes('پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' . $doc->getBid()->getLegalName()); + $tempPay->setPrice($amountPay); + $tempPay->setStatus(0); + $tempPay->setDoc($doc); + $entityManager->persist($tempPay); + $entityManager->flush(); + $result = $payMGR->createRequest($amountPay, $this->generateUrl('pay_sell_verify', ["id" => $doc->getId()], UrlGeneratorInterface::ABSOLUTE_URL), 'پرداخت فاکتور شماره ' . $doc->getCode() . ' کسب و کار ' . $doc->getBid()->getLegalName()); + if ($result['Success']) { + $tempPay->setGatePay($result['gate']); + $tempPay->setVerifyCode($result['authkey']); + $entityManager->persist($tempPay); + $entityManager->flush(); + $log->insert('کیف پول', 'ایجاد تراکنش پرداخت برای فاکتور فروش ' . $doc->getCode(), $this->getUser(), $doc->getBid()); + return $this->redirect($result['targetURL']); } - return $this->render('pay/fail.html.twig',[ - 'type'=>'sell', - 'doc'=>$doc + return $this->render('pay/fail.html.twig', [ + 'type' => 'sell', + 'doc' => $doc ]); } #[Route('pay/sell/verify/{id}', name: 'pay_sell_verify')] - public function pay_sell_verify(String $id, Notification $notification,Provider $provider,Jdate $jdate,Request $request,EntityManagerInterface $entityManager,Log $log): Response + public function pay_sell_verify(string $id, PayMGR $payMGR, Notification $notification, Provider $provider, Jdate $jdate, Request $request, EntityManagerInterface $entityManager, Log $log): Response { - $doc = $entityManager->getRepository(HesabdariDoc::class)->find($id); - if(!$doc) + $req = $entityManager->getRepository(PayInfoTemp::class)->find($id); + if (!$req) + throw $this->createNotFoundException(''); + $doc = $req->getDoc(); + if (!$doc) throw $this->createNotFoundException(); - $Authority = $request->get('Authority'); - $status = $request->get('Status'); - $req = $entityManager->getRepository(PayInfoTemp::class)->findOneBy(['verifyCode'=>$Authority]); - //get system settings - $settings = $entityManager->getRepository(Settings::class)->findAll()[0]; - $data = array("merchant_id" => $settings->getZarinpalMerchant(), "authority" => $Authority, "amount" => $req->getPrice()); - $jsonData = json_encode($data); - $ch = curl_init('https://api.zarinpal.com/pg/v4/payment/verify.json'); - curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v4'); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); - curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen($jsonData) - )); - - $result = curl_exec($ch); - $err = curl_error($ch); - curl_close($ch); - $result = json_decode($result, true); - - //----------------------------------- - $originalDoc = $req->getDoc(); - //----------------------------------- - if ($err) { - $log->insert('کیف پول','خطا در پرداخت فاکتور فروش ' . $doc->getCode() ,$this->getUser(),$doc->getBid()); - return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'fail']); + $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request); + if ($res['Success'] == false) { + $log->insert('کیف پول', 'خطا در پرداخت فاکتور فروش ' . $doc->getCode(), $this->getUser(), $doc->getBid()); + return $this->redirectToRoute('shortlinks_show', ['type' => 'sell', 'bid' => $doc->getBid()->getId(), 'link' => $doc->getId(), 'msg' => 'fail']); } else { - if(array_key_exists('code',$result['data'])){ - if ($result['data']['code'] == 100) { - $req->setStatus(100); - $req->setRefID($result['data']['ref_id']); - $req->setCardPan($result['data']['card_pan']); - $entityManager->persist($req); - $entityManager->flush(); + $req->setStatus(100); + $req->setRefID($res['refID']); + $req->setCardPan($res['card_pan']); + $entityManager->persist($req); + $entityManager->flush(); + $originalDoc = $req->getDoc(); + + //create wallet transaction + $wt = new WalletTransaction(); + $wt->setBid($req->getBid()); + $wt->setDes($req->getDes()); + $wt->setDateSubmit($req->getDateSubmit()); + $wt->setGatePay($req->getGatePay()); + $wt->setStatus($req->getStatus()); + $wt->setVerifyCode($req->getVerifyCode()); + $wt->setRefID($req->getRefID()); + $wt->setCardPan($req->getCardPan()); + $wt->setAmount($req->getPrice()); + $wt->setType('sell'); + $entityManager->persist($wt); + $entityManager->flush(); + $doc->setWalletTransaction($wt); + $entityManager->persist($doc); + $entityManager->flush(); + $entityManager->persist($originalDoc); + $entityManager->flush(); - //create wallet transaction - $wt = new WalletTransaction(); - $wt->setBid($req->getBid()); - $wt->setDes($req->getDes()); - $wt->setDateSubmit($req->getDateSubmit()); - $wt->setGatePay($req->getGatePay()); - $wt->setStatus($req->getStatus()); - $wt->setVerifyCode($req->getVerifyCode()); - $wt->setRefID($req->getRefID()); - $wt->setCardPan($req->getCardPan()); - $wt->setAmount($req->getPrice()); - $wt->setType('sell'); - $entityManager->persist($wt); - $entityManager->flush(); - $doc->setWalletTransaction($wt); - $entityManager->persist($doc); - $entityManager->flush(); - $entityManager->persist($originalDoc); - $entityManager->flush(); - - //create hesabdariDoc - $doc = new HesabdariDoc(); - $doc->setBid($wt->getBid()); - $doc->setDateSubmit(time()); - $doc->setDate($jdate->jdate('Y/n/d',time())); - $doc->setType('walletPay'); - $doc->setMoney($wt->getBid()->getMoney()); - //get default year - $year = $entityManager->getRepository(Year::class)->findOneBy([ - 'bid'=>$originalDoc->getBid(), - 'head'=>true - ]); - $doc->setYear($year); - $doc->setDes($wt->getDes()); - $doc->setAmount($wt->getAmount()); - $doc->setCode($provider->getAccountingCode($wt->getBid(),'accounting')); - $walletUser = $entityManager->getRepository(User::class)->findOneBy(['email'=>'wallet@hesabix.ir']); - if($walletUser) - $doc->setSubmitter($walletUser); - else{ - $wu = new User(); - $wu->setFullName('کیف پول حسابیکس'); - $wu->setEmail('wallet@hesabix.ir'); - $wu->setRoles([]); - $wu->setActive(true); - $entityManager->persist($wu); - $entityManager->flush(); - $doc->setSubmitter($wu); - } - $entityManager->persist($doc); - $entityManager->flush(); - $originalDoc->addRelatedDoc($doc); - $originalDoc->setWalletTransaction($wt); - $entityManager->persist($originalDoc); - $entityManager->flush(); - - //create rows bank - $row = new HesabdariRow(); - $row->setBid($originalDoc->getBid()); - $row->setDoc($doc); - $row->setBank($doc->getBid()->getWalletMatchBank()); - $row->setBd($doc->getAmount()); - $row->setBs(0); - $row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode()); - //get table ref - $table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]); - $row->setRef($table); - $row->setYear($year); - $entityManager->persist($row); - $entityManager->flush(); - - - //create rows person - //get person - $rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]); - $person = null; - foreach ($rows as $oldRow) { - if ($oldRow->getPerson()) - $person = $oldRow->getPerson(); - } - $row = new HesabdariRow(); - $row->setBid($originalDoc->getBid()); - $row->setDoc($doc); - $row->setPerson($person); - $row->setBs($doc->getAmount()); - $row->setBd(0); - $row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode()); - //get table ref - $table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]); - $row->setRef($table); - $row->setYear($year); - $entityManager->persist($row); - $entityManager->flush(); - - $log->insert('کیف پول','پرداخت موفق فاکتور فروش ' . $originalDoc->getCode() ,$this->getUser(),$doc->getBid()); - return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'success']); - } + //create hesabdariDoc + $doc = new HesabdariDoc(); + $doc->setBid($wt->getBid()); + $doc->setDateSubmit(time()); + $doc->setDate($jdate->jdate('Y/n/d', time())); + $doc->setType('walletPay'); + $doc->setMoney($wt->getBid()->getMoney()); + //get default year + $year = $entityManager->getRepository(Year::class)->findOneBy([ + 'bid' => $originalDoc->getBid(), + 'head' => true + ]); + $doc->setYear($year); + $doc->setDes($wt->getDes()); + $doc->setAmount($wt->getAmount()); + $doc->setCode($provider->getAccountingCode($wt->getBid(), 'accounting')); + $walletUser = $entityManager->getRepository(User::class)->findOneBy(['email' => 'wallet@hesabix.ir']); + if ($walletUser) + $doc->setSubmitter($walletUser); + else { + $wu = new User(); + $wu->setFullName('کیف پول حسابیکس'); + $wu->setEmail('wallet@hesabix.ir'); + $wu->setRoles([]); + $wu->setActive(true); + $entityManager->persist($wu); + $entityManager->flush(); + $doc->setSubmitter($wu); } - $log->insert('کیف پول','خطا در پرداخت فاکتور فروش ' . $originalDoc->getCode() ,$this->getUser(),$doc->getBid()); - return $this->redirectToRoute('shortlinks_show',['type'=>'sell','bid'=>$originalDoc->getBid()->getId(),'link'=>$originalDoc->getId(),'msg'=>'fail']); + $entityManager->persist($doc); + $entityManager->flush(); + $originalDoc->addRelatedDoc($doc); + $originalDoc->setWalletTransaction($wt); + $entityManager->persist($originalDoc); + $entityManager->flush(); + + //create rows bank + $row = new HesabdariRow(); + $row->setBid($originalDoc->getBid()); + $row->setDoc($doc); + $row->setBank($doc->getBid()->getWalletMatchBank()); + $row->setBd($doc->getAmount()); + $row->setBs(0); + $row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode()); + //get table ref + $table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 5]); + $row->setRef($table); + $row->setYear($year); + $entityManager->persist($row); + $entityManager->flush(); + + + //create rows person + //get person + $rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]); + $person = null; + foreach ($rows as $oldRow) { + if ($oldRow->getPerson()) + $person = $oldRow->getPerson(); + } + $row = new HesabdariRow(); + $row->setBid($originalDoc->getBid()); + $row->setDoc($doc); + $row->setPerson($person); + $row->setBs($doc->getAmount()); + $row->setBd(0); + $row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode()); + //get table ref + $table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code' => 3]); + $row->setRef($table); + $row->setYear($year); + $entityManager->persist($row); + $entityManager->flush(); + + $log->insert('کیف پول', 'پرداخت موفق فاکتور فروش ' . $originalDoc->getCode(), $this->getUser(), $doc->getBid()); + return $this->redirectToRoute('shortlinks_show', ['type' => 'sell', 'bid' => $originalDoc->getBid()->getId(), 'link' => $originalDoc->getId(), 'msg' => 'success']); } } } diff --git a/hesabixCore/src/Controller/PluginController.php b/hesabixCore/src/Controller/PluginController.php index 8103adb..5ad4664 100644 --- a/hesabixCore/src/Controller/PluginController.php +++ b/hesabixCore/src/Controller/PluginController.php @@ -72,7 +72,9 @@ class PluginController extends AbstractController public function api_plugin_buy_verify(string $id, twigFunctions $twigFunctions, PayMGR $payMGR, Request $request, EntityManagerInterface $entityManager, Log $log): Response { $req = $entityManager->getRepository(Plugin::class)->find($id); - $res = $payMGR->verify($req->getPrice(), $id, $request); + if (!$req) + throw $this->createNotFoundException(''); + $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request); if ($res['Success'] == false) { $log->insert( 'بازار افزونهها' . $req->getName(), diff --git a/hesabixCore/src/Controller/SMSController.php b/hesabixCore/src/Controller/SMSController.php index 1cb4114..3336135 100644 --- a/hesabixCore/src/Controller/SMSController.php +++ b/hesabixCore/src/Controller/SMSController.php @@ -143,7 +143,10 @@ class SMSController extends AbstractController public function api_sms_buy_verify(string $id, PayMGR $payMGR, twigFunctions $twigFunctions, Notification $notification, Request $request, EntityManagerInterface $entityManager, Log $log): Response { $req = $entityManager->getRepository(SMSPays::class)->find($id); - $res = $payMGR->verify($req->getPrice(), $id, $request); + if (!$req) + throw $this->createNotFoundException(''); + + $res = $payMGR->verify($req->getPrice(), $req->getVerifyCode(), $request); if ($res['Success'] == false) { $log->insert('سرویس پیامک', 'پرداخت ناموفق شارژ سرویس پیامک', $this->getUser(), $req->getBid()); return $this->render('buy/fail.html.twig', ['results' => $res]); diff --git a/hesabixCore/src/Entity/PayInfoTemp.php b/hesabixCore/src/Entity/PayInfoTemp.php index 091f8b5..fc18e65 100644 --- a/hesabixCore/src/Entity/PayInfoTemp.php +++ b/hesabixCore/src/Entity/PayInfoTemp.php @@ -32,7 +32,7 @@ class PayInfoTemp #[ORM\Column(length: 255, nullable: true)] private ?string $verifyCode = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] private ?string $gatePay = null; #[ORM\ManyToOne] diff --git a/hesabixCore/src/Entity/Settings.php b/hesabixCore/src/Entity/Settings.php index c20ee98..7c6e113 100644 --- a/hesabixCore/src/Entity/Settings.php +++ b/hesabixCore/src/Entity/Settings.php @@ -18,9 +18,6 @@ class Settings #[ORM\Column(nullable: true)] private ?bool $activeSendSms = null; - #[ORM\Column(length: 255, nullable: true)] - private ?string $zarinpalMerchant = null; - #[ORM\Column(length: 255, nullable: true)] private ?string $appSite = null; @@ -62,18 +59,6 @@ class Settings return $this; } - public function getZarinpalMerchant(): ?string - { - return $this->zarinpalMerchant; - } - - public function setZarinpalMerchant(?string $zarinpalMerchant): static - { - $this->zarinpalMerchant = $zarinpalMerchant; - - return $this; - } - public function getAppSite(): ?string { return $this->appSite; diff --git a/hesabixCore/templates/pdf/bank_card.html.twig b/hesabixCore/templates/pdf/bank_card.html.twig new file mode 100644 index 0000000..d556904 --- /dev/null +++ b/hesabixCore/templates/pdf/bank_card.html.twig @@ -0,0 +1,121 @@ +{% extends "pdf/base.html.twig" %} +{% block body %} +
+ + نام: + + {{ bank.name }} + + |
+
+ + + شماره حساب: + + {{ bank.accountNum }} + + |
+
+ + شماره شبا: + + {{ bank.shaba }} + + |
+
+ + شماره کارت: + + {{ bank.cardNum }} + + |
+
ردیف | +فاکتور/سند | +تاریخ | +توضیحات | +تفضیل | +بدهکار | +بستانکار | +سال مالی | +
{{ loop.index }} | +{{ item.doc.code }} | +{{ item.doc.date }} | +{{ item.des }} | +{{ item.ref.name }} | +{{ item.bd | number_format }} | +{{ item.bs | number_format }} | +{{ item.year.label }} | +
+ + جمع بستانکار: + + {{ sumBs | number_format }} + + |
+
+ + جمع بدهکار: + + {{ sumBd | number_format }} + + |
+
+ + تراز حساب: + + {{ (sumBs - sumBd) | abs |number_format }} + + |
+
+ + وضعیت: + + {% if sumBs > sumBd%} + بستانکار + {% elseif sumBs == sumBd %} + تسویه شده + {% else %} + بدهکار + {% endif %} + + |
+