some progress
This commit is contained in:
parent
880078da43
commit
d7982f5471
BIN
hesabixCore/55.zip
Normal file
BIN
hesabixCore/55.zip
Normal file
Binary file not shown.
|
@ -38,4 +38,21 @@ class AdminController extends AbstractController
|
||||||
'message' => $content,
|
'message' => $content,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
#[Route('/api/admin/has/role/{role}', name: 'app_admin_has_role')]
|
||||||
|
public function app_admin_has_role($role): JsonResponse
|
||||||
|
{
|
||||||
|
if(!is_bool(array_search($role,$this->getUser()->getRoles())))
|
||||||
|
{
|
||||||
|
return $this->json([
|
||||||
|
'result' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->json([
|
||||||
|
'result' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,19 @@ class PayController extends AbstractController
|
||||||
$doc->setDes($wt->getDes());
|
$doc->setDes($wt->getDes());
|
||||||
$doc->setAmount($wt->getAmount());
|
$doc->setAmount($wt->getAmount());
|
||||||
$doc->setCode($provider->getAccountingCode($wt->getBid(),'accounting'));
|
$doc->setCode($provider->getAccountingCode($wt->getBid(),'accounting'));
|
||||||
$doc->setSubmitter($entityManager->getRepository(User::class)->findOneBy(['email'=>'wallet@hesabix.ir']));
|
$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->persist($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$originalDoc->addRelatedDoc($doc);
|
$originalDoc->addRelatedDoc($doc);
|
||||||
|
@ -182,7 +194,7 @@ class PayController extends AbstractController
|
||||||
$row->setBank($doc->getBid()->getWalletMatchBank());
|
$row->setBank($doc->getBid()->getWalletMatchBank());
|
||||||
$row->setBd($doc->getAmount());
|
$row->setBd($doc->getAmount());
|
||||||
$row->setBs(0);
|
$row->setBs(0);
|
||||||
$row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $doc->getCode());
|
$row->setDes('دریافت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
|
||||||
//get table ref
|
//get table ref
|
||||||
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]);
|
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]);
|
||||||
$row->setRef($table);
|
$row->setRef($table);
|
||||||
|
@ -196,8 +208,8 @@ class PayController extends AbstractController
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]);
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc' => $originalDoc]);
|
||||||
$person = null;
|
$person = null;
|
||||||
foreach ($rows as $oldRow) {
|
foreach ($rows as $oldRow) {
|
||||||
if ($row->getPerson())
|
if ($oldRow->getPerson())
|
||||||
$person = $row->getPerson();
|
$person = $oldRow->getPerson();
|
||||||
}
|
}
|
||||||
$row = new HesabdariRow();
|
$row = new HesabdariRow();
|
||||||
$row->setBid($originalDoc->getBid());
|
$row->setBid($originalDoc->getBid());
|
||||||
|
@ -205,7 +217,7 @@ class PayController extends AbstractController
|
||||||
$row->setPerson($person);
|
$row->setPerson($person);
|
||||||
$row->setBs($doc->getAmount());
|
$row->setBs($doc->getAmount());
|
||||||
$row->setBd(0);
|
$row->setBd(0);
|
||||||
$row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $doc->getCode());
|
$row->setDes('پرداخت وجه فاکتور آنلاین شماره ' . $originalDoc->getCode());
|
||||||
//get table ref
|
//get table ref
|
||||||
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]);
|
$table = $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]);
|
||||||
$row->setRef($table);
|
$row->setRef($table);
|
||||||
|
|
|
@ -214,6 +214,8 @@ class HesabdariController extends AbstractController
|
||||||
];
|
];
|
||||||
if($params['type'] == 'buy' || $params['type'] == 'sell'){
|
if($params['type'] == 'buy' || $params['type'] == 'sell'){
|
||||||
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item,'person');
|
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item,'person');
|
||||||
|
$temp['person'] = '';
|
||||||
|
if($mainRow)
|
||||||
$temp['person'] = $mainRow->getPerson()->getNikename();
|
$temp['person'] = $mainRow->getPerson()->getNikename();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,6 +234,9 @@ class HesabdariController extends AbstractController
|
||||||
return $this->json($dataTemp);
|
return $this->json($dataTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
||||||
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -374,7 +379,10 @@ class HesabdariController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||||
|
|
||||||
return $this->json(['result'=>1]);
|
return $this->json([
|
||||||
|
'result'=>1,
|
||||||
|
'doc'=>$provider->Entity2Array($doc,0)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/accounting/remove', name: 'app_accounting_remove_doc')]
|
#[Route('/api/accounting/remove', name: 'app_accounting_remove_doc')]
|
||||||
|
@ -410,8 +418,17 @@ class HesabdariController extends AbstractController
|
||||||
}
|
}
|
||||||
foreach ($rows as $row)
|
foreach ($rows as $row)
|
||||||
$entityManager->remove($row);
|
$entityManager->remove($row);
|
||||||
|
foreach ($doc->getRelatedDocs() as $relatedDoc){
|
||||||
|
if($relatedDoc->getType() != 'walletPay'){
|
||||||
|
$items = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc'=>$relatedDoc]);
|
||||||
|
foreach ($items as $item)
|
||||||
|
$entityManager->remove($item);
|
||||||
|
$entityManager->remove($relatedDoc);
|
||||||
|
$log->insert('حسابداری','سند حسابداری شماره ' . $relatedDoc->getCode() . ' حذف شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||||
|
}
|
||||||
|
}
|
||||||
$entityManager->remove($doc);
|
$entityManager->remove($doc);
|
||||||
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' حذف شد.',$this->getUser(),$request->headers->get('activeBid'));
|
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' حذف شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||||
|
|
||||||
return $this->json(['result'=>1]);
|
return $this->json(['result'=>1]);
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Support;
|
use App\Entity\Support;
|
||||||
use App\Service\Jdate;
|
use App\Service\Jdate;
|
||||||
|
use App\Service\Provider;
|
||||||
use App\Service\SMS;
|
use App\Service\SMS;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
@ -15,6 +16,16 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
class SupportController extends AbstractController
|
class SupportController extends AbstractController
|
||||||
{
|
{
|
||||||
|
#[Route('/api/admin/support/list', name: 'app_admin_support_list')]
|
||||||
|
public function app_admin_support_list(Provider $provider,Jdate $jdate,EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$items = $entityManager->getRepository(Support::class)->findBy(['main' => 0],['id'=>'DESC']);
|
||||||
|
foreach ($items as $item){
|
||||||
|
$item->setDateSubmit($jdate->jdate('Y/n/d H:i',$item->getDateSubmit()));
|
||||||
|
}
|
||||||
|
return $this->json($provider->ArrayEntity2Array($items,1));
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/api/support/list', name: 'app_support_list')]
|
#[Route('/api/support/list', name: 'app_support_list')]
|
||||||
public function app_support_list(Jdate $jdate,EntityManagerInterface $entityManager): JsonResponse
|
public function app_support_list(Jdate $jdate,EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ class SMS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendByBalance(array $params,$bodyID,$to,Business $business,User $user,$balance = 450): int
|
public function sendByBalance(array $params,$bodyID,$to,Business $business,User $user,$balance = 500): int
|
||||||
{
|
{
|
||||||
if($business->getSmsCharge() < ($balance * $this->smsPrice))
|
if($business->getSmsCharge() < ($balance * $this->smsPrice))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
Loading…
Reference in a new issue