almost minish multi currency
This commit is contained in:
parent
66fbd127bd
commit
a106075b25
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||||
use App\Entity\BankAccount;
|
use App\Entity\BankAccount;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
|
use App\Service\Explore;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -18,10 +19,25 @@ class BankController extends AbstractController
|
||||||
#[Route('/api/bank/list', name: 'app_bank_list')]
|
#[Route('/api/bank/list', name: 'app_bank_list')]
|
||||||
public function app_bank_list(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_bank_list(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
if (!$access->hasRole('banks'))
|
$acc = $access->hasRole('banks');
|
||||||
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
//bug fix for bank with no money type
|
||||||
$datas = $entityManager->getRepository(BankAccount::class)->findBy([
|
$datas = $entityManager->getRepository(BankAccount::class)->findBy([
|
||||||
'bid' => $request->headers->get('activeBid')
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money'=>null
|
||||||
|
]);
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
$data->setMoney($acc['bid']->getMoney());
|
||||||
|
$entityManager->persist($data);
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
|
//end of bug fix
|
||||||
|
|
||||||
|
$datas = $entityManager->getRepository(BankAccount::class)->findBy([
|
||||||
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money'=>$acc['money']
|
||||||
]);
|
]);
|
||||||
foreach ($datas as $data) {
|
foreach ($datas as $data) {
|
||||||
$bs = 0;
|
$bs = 0;
|
||||||
|
@ -46,9 +62,10 @@ class BankController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
'money'=>$acc['money'],
|
||||||
'code' => $code
|
'code' => $code
|
||||||
]);
|
]);
|
||||||
return $this->json($provider->Entity2Array($data, 0));
|
return $this->json(data: Explore::ExploreBank($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/bank/mod/{code}', name: 'app_bank_mod')]
|
#[Route('/api/bank/mod/{code}', name: 'app_bank_mod')]
|
||||||
|
@ -75,6 +92,7 @@ class BankController extends AbstractController
|
||||||
return $this->json(['result' => 2]);
|
return $this->json(['result' => 2]);
|
||||||
$data = new BankAccount();
|
$data = new BankAccount();
|
||||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'bank'));
|
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'bank'));
|
||||||
|
$data->setMoney($acc['money']);
|
||||||
} else {
|
} else {
|
||||||
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
|
|
@ -70,19 +70,13 @@ class BusinessController extends AbstractController
|
||||||
return $this->json($extractor->operationSuccess());
|
return $this->json($extractor->operationSuccess());
|
||||||
}
|
}
|
||||||
#[Route('/api/business/list', name: 'api_bussiness_list')]
|
#[Route('/api/business/list', name: 'api_bussiness_list')]
|
||||||
public function api_bussiness_list(#[CurrentUser] ?User $user, Access $access, EntityManagerInterface $entityManager, Provider $provider): Response
|
public function api_bussiness_list(#[CurrentUser] ?User $user, Access $access,Explore $explore, EntityManagerInterface $entityManager, Provider $provider): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
$buss = $entityManager->getRepository(Permission::class)->findBy(['user' => $user]);
|
$buss = $entityManager->getRepository(Permission::class)->findBy(['user' => $user]);
|
||||||
$response = [];
|
$response = [];
|
||||||
foreach ($buss as $bus) {
|
foreach ($buss as $bus) {
|
||||||
//echo $bus->getBid()->getId();
|
$response[] = Explore::ExploreBusiness($bus->getBid());
|
||||||
$temp = [];
|
|
||||||
$temp['id'] = $bus->getBid()->getId();
|
|
||||||
$temp['owner'] = $bus->getBid()->getOwner()->getFullName();
|
|
||||||
$temp['name'] = $bus->getBid()->getName();
|
|
||||||
$temp['legal_name'] = $bus->getBid()->getLegalName();
|
|
||||||
$response[] = $temp;
|
|
||||||
}
|
}
|
||||||
return $this->json($response);
|
return $this->json($response);
|
||||||
}
|
}
|
||||||
|
@ -102,48 +96,7 @@ class BusinessController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$perms)
|
if (!$perms)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$response = [];
|
return $this->json(Explore::ExploreBusiness($bus));
|
||||||
$response['id'] = $bus->getId();
|
|
||||||
$response['name'] = $bus->getName();
|
|
||||||
$response['owner'] = $bus->getOwner()->getFullName();
|
|
||||||
$response['legal_name'] = $bus->getLegalName();
|
|
||||||
$response['field'] = $bus->getField();
|
|
||||||
$response['shenasemeli'] = $bus->getShenasemeli();
|
|
||||||
$response['codeeqtesadi'] = $bus->getCodeeghtesadi();
|
|
||||||
$response['shomaresabt'] = $bus->getShomaresabt();
|
|
||||||
$response['country'] = $bus->getCountry();
|
|
||||||
$response['ostan'] = $bus->getOstan();
|
|
||||||
$response['shahrestan'] = $bus->getShahrestan();
|
|
||||||
$response['postalcode'] = $bus->getPostalcode();
|
|
||||||
$response['tel'] = $bus->getTel();
|
|
||||||
$response['mobile'] = $bus->getMobile();
|
|
||||||
$response['address'] = $bus->getAddress();
|
|
||||||
$response['website'] = $bus->getWesite();
|
|
||||||
$response['email'] = $bus->getEmail();
|
|
||||||
$response['maliyatafzode'] = $bus->getMaliyatafzode();
|
|
||||||
$response['arzmain'] = Explore::ExploreMoney($bus->getMoney());
|
|
||||||
$response['type'] = $bus->getType();
|
|
||||||
$response['zarinpalCode'] = $bus->getZarinpalCode();
|
|
||||||
$response['smsCharge'] = $bus->getSmsCharge();
|
|
||||||
$response['shortlinks'] = $bus->isShortLinks();
|
|
||||||
$response['walletEnabled'] = $bus->isWalletEnable();
|
|
||||||
$response['walletMatchBank'] = null;
|
|
||||||
$response['updateSellPrice'] = $bus->isCommodityUpdateSellPriceAuto();
|
|
||||||
$response['updateBuyPrice'] = $bus->isCommodityUpdateBuyPriceAuto();
|
|
||||||
if (!$bus->getProfitCalctype()) {
|
|
||||||
$response['profitCalcType'] = 'lis';
|
|
||||||
} else {
|
|
||||||
$response['profitCalcType'] = $bus->getProfitCalctype();
|
|
||||||
}
|
|
||||||
if ($bus->isWalletEnable())
|
|
||||||
$response['walletMatchBank'] = $provider->Entity2Array($bus->getWalletMatchBank(), 0);
|
|
||||||
$year = $entityManager->getRepository(Year::class)->findOneBy([
|
|
||||||
'bid' => $bus,
|
|
||||||
'head' => true
|
|
||||||
]);
|
|
||||||
$response['year'] = Explore::ExploreYear($year);
|
|
||||||
|
|
||||||
return $this->json($response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/business/list/count', name: 'api_bussiness_list_count')]
|
#[Route('/api/business/list/count', name: 'api_bussiness_list_count')]
|
||||||
|
@ -669,8 +622,12 @@ class BusinessController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/business/stat', name: 'api_business_stat')]
|
#[Route('/api/business/stat', name: 'api_business_stat')]
|
||||||
public function api_business_stat(Jdate $jdate, Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response
|
public function api_business_stat(Access $access,Jdate $jdate, Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if(!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
$dateNow = $jdate->jdate('Y/m/d', time());
|
$dateNow = $jdate->jdate('Y/m/d', time());
|
||||||
$buss = $entityManager->getRepository(Business::class)->find(
|
$buss = $entityManager->getRepository(Business::class)->find(
|
||||||
$request->headers->get('activeBid')
|
$request->headers->get('activeBid')
|
||||||
|
@ -693,6 +650,7 @@ class BusinessController extends AbstractController
|
||||||
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
@ -706,6 +664,8 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'buy',
|
'type' => 'buy',
|
||||||
|
'money'=> $acc['money']
|
||||||
|
|
||||||
]);
|
]);
|
||||||
$buysTotal = 0;
|
$buysTotal = 0;
|
||||||
$buysToday = 0;
|
$buysToday = 0;
|
||||||
|
@ -727,6 +687,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'sell',
|
'type' => 'sell',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$sellsTotal = 0;
|
$sellsTotal = 0;
|
||||||
$sellsToday = 0;
|
$sellsToday = 0;
|
||||||
|
@ -748,6 +709,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$sendsTotal = 0;
|
$sendsTotal = 0;
|
||||||
$sendsToday = 0;
|
$sendsToday = 0;
|
||||||
|
@ -769,6 +731,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$recsTotal = 0;
|
$recsTotal = 0;
|
||||||
$recsToday = 0;
|
$recsToday = 0;
|
||||||
|
|
|
@ -76,7 +76,8 @@ class BuyController extends AbstractController
|
||||||
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid'=>$acc['bid'],
|
'bid'=>$acc['bid'],
|
||||||
'year'=>$acc['year'],
|
'year'=>$acc['year'],
|
||||||
'type'=>'buy'
|
'type'=>'buy',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
return $this->json(Explore::ExploreBuyDocsList($invoices));
|
return $this->json(Explore::ExploreBuyDocsList($invoices));
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,8 @@ class BuyController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ class BuyController extends AbstractController
|
||||||
$doc->setDateSubmit(time());
|
$doc->setDateSubmit(time());
|
||||||
$doc->setType('buy');
|
$doc->setType('buy');
|
||||||
$doc->setSubmitter($this->getUser());
|
$doc->setSubmitter($this->getUser());
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||||
}
|
}
|
||||||
if($params['transferCost'] != 0){
|
if($params['transferCost'] != 0){
|
||||||
|
@ -243,7 +245,8 @@ class BuyController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $item['code']
|
'code' => $item['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
if ($params['label'] != 'clear') {
|
if ($params['label'] != 'clear') {
|
||||||
|
@ -286,7 +289,8 @@ class BuyController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'type' => 'buy'
|
'type' => 'buy',
|
||||||
|
'money'=> $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -350,7 +354,8 @@ class BuyController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$pdfPid = 0;
|
$pdfPid = 0;
|
||||||
|
@ -413,7 +418,8 @@ class BuyController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$person = null;
|
$person = null;
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||||
use App\Entity\Cashdesk;
|
use App\Entity\Cashdesk;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
|
use App\Service\Explore;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -19,11 +20,26 @@ class CashdeskController extends AbstractController
|
||||||
#[Route('/api/cashdesk/list', name: 'app_cashdesk_list')]
|
#[Route('/api/cashdesk/list', name: 'app_cashdesk_list')]
|
||||||
public function app_cashdesk_list(Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_cashdesk_list(Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
if (!$access->hasRole('cashdesk'))
|
$acc = $access->hasRole('cashdesk');
|
||||||
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
//bug fix for bank with no money type
|
||||||
$datas = $entityManager->getRepository(Cashdesk::class)->findBy([
|
$datas = $entityManager->getRepository(Cashdesk::class)->findBy([
|
||||||
'bid' => $request->headers->get('activeBid')
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money' => null
|
||||||
]);
|
]);
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
$data->setMoney($acc['bid']->getMoney());
|
||||||
|
$entityManager->persist($data);
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
|
//end of bug fix
|
||||||
|
|
||||||
|
$datas = $entityManager->getRepository(Cashdesk::class)->findBy([
|
||||||
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money' => $acc['money']
|
||||||
|
]);
|
||||||
|
$resp = [];
|
||||||
foreach ($datas as $data) {
|
foreach ($datas as $data) {
|
||||||
$bs = 0;
|
$bs = 0;
|
||||||
$bd = 0;
|
$bd = 0;
|
||||||
|
@ -35,8 +51,9 @@ class CashdeskController extends AbstractController
|
||||||
$bd += $item->getBd();
|
$bd += $item->getBd();
|
||||||
}
|
}
|
||||||
$data->setBalance($bd - $bs);
|
$data->setBalance($bd - $bs);
|
||||||
|
$resp[] = Explore::ExploreCashdesk($data);
|
||||||
}
|
}
|
||||||
return $this->json($datas);
|
return $this->json($resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/cashdesk/info/{code}', name: 'app_cashdesk_info')]
|
#[Route('/api/cashdesk/info/{code}', name: 'app_cashdesk_info')]
|
||||||
|
@ -47,9 +64,10 @@ class CashdeskController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code,
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
return $this->json($data);
|
return $this->json(Explore::ExploreCashdesk($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/cashdesk/mod/{code}', name: 'app_cashdesk_mod')]
|
#[Route('/api/cashdesk/mod/{code}', name: 'app_cashdesk_mod')]
|
||||||
|
@ -76,6 +94,7 @@ class CashdeskController extends AbstractController
|
||||||
return $this->json(['result' => 2]);
|
return $this->json(['result' => 2]);
|
||||||
$data = new Cashdesk();
|
$data = new Cashdesk();
|
||||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'cashdesk'));
|
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'cashdesk'));
|
||||||
|
$data->setMoney($acc['money']);
|
||||||
} else {
|
} else {
|
||||||
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
@ -83,6 +102,9 @@ class CashdeskController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$data)
|
if (!$data)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
if (!$data->getMoney()) {
|
||||||
|
$data->setMoney($acc['money']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data->setBid($acc['bid']);
|
$data->setBid($acc['bid']);
|
||||||
$data->setname($params['name']);
|
$data->setname($params['name']);
|
||||||
|
|
|
@ -132,7 +132,7 @@ class ChequeController extends AbstractController
|
||||||
$hesabdariDoc->setBid($acc['bid']);
|
$hesabdariDoc->setBid($acc['bid']);
|
||||||
$hesabdariDoc->setSubmitter($this->getUser());
|
$hesabdariDoc->setSubmitter($this->getUser());
|
||||||
$hesabdariDoc->setYear($acc['year']);
|
$hesabdariDoc->setYear($acc['year']);
|
||||||
$hesabdariDoc->setMoney($acc['bid']->getMoney());
|
$hesabdariDoc->setMoney($acc['money']);
|
||||||
$hesabdariDoc->setDateSubmit(time());
|
$hesabdariDoc->setDateSubmit(time());
|
||||||
$hesabdariDoc->setDate($params['date']);
|
$hesabdariDoc->setDate($params['date']);
|
||||||
$hesabdariDoc->setType('pass_cheque');
|
$hesabdariDoc->setType('pass_cheque');
|
||||||
|
|
|
@ -229,7 +229,7 @@ class CommodityController extends AbstractController
|
||||||
} else {
|
} else {
|
||||||
$spd = new PriceListDetail;
|
$spd = new PriceListDetail;
|
||||||
$spd->setList($list);
|
$spd->setList($list);
|
||||||
$spd->setMoney($acc['bid']->getMoney());
|
$spd->setMoney($acc['money']);
|
||||||
$spd->setCommodity($item);
|
$spd->setCommodity($item);
|
||||||
$spd->setPriceBuy(0);
|
$spd->setPriceBuy(0);
|
||||||
$spd->setPriceSell(0);
|
$spd->setPriceSell(0);
|
||||||
|
@ -362,7 +362,7 @@ class CommodityController extends AbstractController
|
||||||
} else {
|
} else {
|
||||||
$spd = new PriceListDetail;
|
$spd = new PriceListDetail;
|
||||||
$spd->setList($item);
|
$spd->setList($item);
|
||||||
$spd->setMoney($acc['bid']->getMoney());
|
$spd->setMoney($acc['money']);
|
||||||
$spd->setCommodity($data);
|
$spd->setCommodity($data);
|
||||||
$spd->setPriceBuy(0);
|
$spd->setPriceBuy(0);
|
||||||
$spd->setPriceSell(0);
|
$spd->setPriceSell(0);
|
||||||
|
@ -496,7 +496,7 @@ class CommodityController extends AbstractController
|
||||||
$detail->setCommodity($data);
|
$detail->setCommodity($data);
|
||||||
$detail->setPriceSell($item['priceSell']);
|
$detail->setPriceSell($item['priceSell']);
|
||||||
$detail->setPriceBuy(0);
|
$detail->setPriceBuy(0);
|
||||||
$detail->setMoney($acc['bid']->getMoney());
|
$detail->setMoney($acc['money']);
|
||||||
$entityManager->persist($detail);
|
$entityManager->persist($detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ class CommodityController extends AbstractController
|
||||||
$detail->setCommodity($data);
|
$detail->setCommodity($data);
|
||||||
$detail->setPriceSell($item['priceSell']);
|
$detail->setPriceSell($item['priceSell']);
|
||||||
$detail->setPriceBuy(0);
|
$detail->setPriceBuy(0);
|
||||||
$detail->setMoney($acc['bid']->getMoney());
|
$detail->setMoney($acc['money']);
|
||||||
$entityManager->persist($detail);
|
$entityManager->persist($detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,9 +49,11 @@ class HesabdariController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$rowsObj = $entityManager->getRepository(HesabdariRow::class)->findBy(
|
$rowsObj = $entityManager->getRepository(HesabdariRow::class)->findBy(
|
||||||
['doc' => $doc]
|
['doc' => $doc]
|
||||||
|
@ -176,15 +178,24 @@ class HesabdariController extends AbstractController
|
||||||
if (!array_key_exists('type', $params))
|
if (!array_key_exists('type', $params))
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send') $roll = 'person';
|
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send')
|
||||||
elseif ($params['type'] == 'cost') $roll = 'cost';
|
$roll = 'person';
|
||||||
elseif ($params['type'] == 'income') $roll = 'income';
|
elseif ($params['type'] == 'cost')
|
||||||
elseif ($params['type'] == 'buy') $roll = 'buy';
|
$roll = 'cost';
|
||||||
elseif ($params['type'] == 'rfbuy') $roll = 'plugAccproRfbuy';
|
elseif ($params['type'] == 'income')
|
||||||
elseif ($params['type'] == 'transfer') $roll = 'transfer';
|
$roll = 'income';
|
||||||
elseif ($params['type'] == 'sell') $roll = 'sell';
|
elseif ($params['type'] == 'buy')
|
||||||
elseif ($params['type'] == 'rfsell') $roll = 'plugAccproRfsell';
|
$roll = 'buy';
|
||||||
elseif ($params['type'] == 'all') $roll = 'accounting';
|
elseif ($params['type'] == 'rfbuy')
|
||||||
|
$roll = 'plugAccproRfbuy';
|
||||||
|
elseif ($params['type'] == 'transfer')
|
||||||
|
$roll = 'transfer';
|
||||||
|
elseif ($params['type'] == 'sell')
|
||||||
|
$roll = 'sell';
|
||||||
|
elseif ($params['type'] == 'rfsell')
|
||||||
|
$roll = 'plugAccproRfsell';
|
||||||
|
elseif ($params['type'] == 'all')
|
||||||
|
$roll = 'accounting';
|
||||||
else
|
else
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
|
|
||||||
|
@ -195,6 +206,7 @@ class HesabdariController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
|
'money' => $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -202,7 +214,8 @@ class HesabdariController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'type' => $params['type']
|
'type' => $params['type'],
|
||||||
|
'money' => $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -260,9 +273,12 @@ class HesabdariController extends AbstractController
|
||||||
if (!array_key_exists('type', $params))
|
if (!array_key_exists('type', $params))
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send') $roll = 'person';
|
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send')
|
||||||
elseif ($params['type'] == 'sell_receive') $roll = 'sell';
|
$roll = 'person';
|
||||||
elseif ($params['type'] == 'buy_send') $roll = 'buy';
|
elseif ($params['type'] == 'sell_receive')
|
||||||
|
$roll = 'sell';
|
||||||
|
elseif ($params['type'] == 'buy_send')
|
||||||
|
$roll = 'buy';
|
||||||
else
|
else
|
||||||
$roll = $params['type'];
|
$roll = $params['type'];
|
||||||
|
|
||||||
|
@ -278,12 +294,14 @@ class HesabdariController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException('document not found.');
|
if (!$doc)
|
||||||
|
throw $this->createNotFoundException('document not found.');
|
||||||
$doc->setDes($params['des']);
|
$doc->setDes($params['des']);
|
||||||
$doc->setDate($params['date']);
|
$doc->setDate($params['date']);
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
if (array_key_exists('refData', $params))
|
if (array_key_exists('refData', $params))
|
||||||
$doc->setRefData($params['refData']);
|
$doc->setRefData($params['refData']);
|
||||||
if (array_key_exists('plugin', $params))
|
if (array_key_exists('plugin', $params))
|
||||||
|
@ -305,7 +323,7 @@ class HesabdariController extends AbstractController
|
||||||
$doc->setType($params['type']);
|
$doc->setType($params['type']);
|
||||||
$doc->setDate($params['date']);
|
$doc->setDate($params['date']);
|
||||||
$doc->setSubmitter($this->getUser());
|
$doc->setSubmitter($this->getUser());
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||||
if (array_key_exists('refData', $params))
|
if (array_key_exists('refData', $params))
|
||||||
$doc->setRefData($params['refData']);
|
$doc->setRefData($params['refData']);
|
||||||
|
@ -317,7 +335,11 @@ class HesabdariController extends AbstractController
|
||||||
|
|
||||||
//add document to related docs
|
//add document to related docs
|
||||||
if (array_key_exists('related', $params)) {
|
if (array_key_exists('related', $params)) {
|
||||||
$relatedDoc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy(['code' => $params['related'], 'bid' => $doc->getBid()]);
|
$relatedDoc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
'code' => $params['related'],
|
||||||
|
'bid' => $doc->getBid(),
|
||||||
|
'money' => $acc['money']
|
||||||
|
]);
|
||||||
if ($relatedDoc) {
|
if ($relatedDoc) {
|
||||||
$relatedDoc->addRelatedDoc($doc);
|
$relatedDoc->addRelatedDoc($doc);
|
||||||
$entityManager->persist($relatedDoc);
|
$entityManager->persist($relatedDoc);
|
||||||
|
@ -349,8 +371,10 @@ class HesabdariController extends AbstractController
|
||||||
//check is type is person
|
//check is type is person
|
||||||
if ($row['type'] == 'person') {
|
if ($row['type'] == 'person') {
|
||||||
$person = $entityManager->getRepository(Person::class)->find($row['id']);
|
$person = $entityManager->getRepository(Person::class)->find($row['id']);
|
||||||
if (!$person) throw $this->createNotFoundException('person not found');
|
if (!$person)
|
||||||
elseif ($person->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('person is not in this business');
|
throw $this->createNotFoundException('person not found');
|
||||||
|
elseif ($person->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException('person is not in this business');
|
||||||
$hesabdariRow->setPerson($person);
|
$hesabdariRow->setPerson($person);
|
||||||
} elseif ($row['type'] == 'cheque') {
|
} elseif ($row['type'] == 'cheque') {
|
||||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||||
|
@ -386,24 +410,32 @@ class HesabdariController extends AbstractController
|
||||||
$hesabdariRow->setCheque($cheque);
|
$hesabdariRow->setCheque($cheque);
|
||||||
} elseif ($row['type'] == 'bank') {
|
} elseif ($row['type'] == 'bank') {
|
||||||
$bank = $entityManager->getRepository(BankAccount::class)->find($row['id']);
|
$bank = $entityManager->getRepository(BankAccount::class)->find($row['id']);
|
||||||
if (!$bank) throw $this->createNotFoundException('bank not found');
|
if (!$bank)
|
||||||
elseif ($bank->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
throw $this->createNotFoundException('bank not found');
|
||||||
|
elseif ($bank->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException('bank is not in this business');
|
||||||
$hesabdariRow->setBank($bank);
|
$hesabdariRow->setBank($bank);
|
||||||
} elseif ($row['type'] == 'salary') {
|
} elseif ($row['type'] == 'salary') {
|
||||||
$salary = $entityManager->getRepository(Salary::class)->find($row['id']);
|
$salary = $entityManager->getRepository(Salary::class)->find($row['id']);
|
||||||
if (!$salary) throw $this->createNotFoundException('salary not found');
|
if (!$salary)
|
||||||
elseif ($salary->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
throw $this->createNotFoundException('salary not found');
|
||||||
|
elseif ($salary->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException('bank is not in this business');
|
||||||
$hesabdariRow->setSalary($salary);
|
$hesabdariRow->setSalary($salary);
|
||||||
} elseif ($row['type'] == 'cashdesk') {
|
} elseif ($row['type'] == 'cashdesk') {
|
||||||
$cashdesk = $entityManager->getRepository(Cashdesk::class)->find($row['id']);
|
$cashdesk = $entityManager->getRepository(Cashdesk::class)->find($row['id']);
|
||||||
if (!$cashdesk) throw $this->createNotFoundException('cashdesk not found');
|
if (!$cashdesk)
|
||||||
elseif ($cashdesk->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
throw $this->createNotFoundException('cashdesk not found');
|
||||||
|
elseif ($cashdesk->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException('bank is not in this business');
|
||||||
$hesabdariRow->setCashdesk($cashdesk);
|
$hesabdariRow->setCashdesk($cashdesk);
|
||||||
} elseif ($row['type'] == 'commodity') {
|
} elseif ($row['type'] == 'commodity') {
|
||||||
$row['count'] = str_replace(',', '', $row['count']);
|
$row['count'] = str_replace(',', '', $row['count']);
|
||||||
$commodity = $entityManager->getRepository(Commodity::class)->find($row['commodity']['id']);
|
$commodity = $entityManager->getRepository(Commodity::class)->find($row['commodity']['id']);
|
||||||
if (!$commodity) throw $this->createNotFoundException('commodity not found');
|
if (!$commodity)
|
||||||
elseif ($commodity->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('$commodity is not in this business');
|
throw $this->createNotFoundException('commodity not found');
|
||||||
|
elseif ($commodity->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException('$commodity is not in this business');
|
||||||
$hesabdariRow->setCommodity($commodity);
|
$hesabdariRow->setCommodity($commodity);
|
||||||
$hesabdariRow->setCommdityCount($row['count']);
|
$hesabdariRow->setCommdityCount($row['count']);
|
||||||
}
|
}
|
||||||
|
@ -448,11 +480,15 @@ class HesabdariController extends AbstractController
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'bid' => $request->headers->get('activeBid')
|
'bid' => $request->headers->get('activeBid')
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($doc->getType() == 'person_receive' || $doc->getType() == 'person_send') $roll = 'person';
|
if ($doc->getType() == 'person_receive' || $doc->getType() == 'person_send')
|
||||||
elseif ($doc->getType() == 'sell_receive') $roll = 'sell';
|
$roll = 'person';
|
||||||
elseif ($doc->getType() == 'buy_send') $roll = 'buy';
|
elseif ($doc->getType() == 'sell_receive')
|
||||||
|
$roll = 'sell';
|
||||||
|
elseif ($doc->getType() == 'buy_send')
|
||||||
|
$roll = 'buy';
|
||||||
else
|
else
|
||||||
$roll = $doc->getType();
|
$roll = $doc->getType();
|
||||||
$acc = $access->hasRole($roll);
|
$acc = $access->hasRole($roll);
|
||||||
|
@ -523,7 +559,9 @@ class HesabdariController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
$code = $doc->getCode();
|
$code = $doc->getCode();
|
||||||
foreach($doc->getNotes() as $note){ $entityManager->remove($note);}
|
foreach ($doc->getNotes() as $note) {
|
||||||
|
$entityManager->remove($note);
|
||||||
|
}
|
||||||
$entityManager->remove($doc);
|
$entityManager->remove($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
|
@ -539,16 +577,20 @@ class HesabdariController extends AbstractController
|
||||||
}
|
}
|
||||||
if (!array_key_exists('items', $params))
|
if (!array_key_exists('items', $params))
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
foreach($params['items'] as $item){
|
foreach ($params['items'] as $item) {
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'code' => $item['code'],
|
'code' => $item['code'],
|
||||||
'bid' => $request->headers->get('activeBid')
|
'bid' => $request->headers->get('activeBid')
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($doc->getType() == 'person_receive' || $doc->getType() == 'person_send') $roll = 'person';
|
if ($doc->getType() == 'person_receive' || $doc->getType() == 'person_send')
|
||||||
elseif ($doc->getType() == 'sell_receive') $roll = 'sell';
|
$roll = 'person';
|
||||||
elseif ($doc->getType() == 'buy_send') $roll = 'buy';
|
elseif ($doc->getType() == 'sell_receive')
|
||||||
|
$roll = 'sell';
|
||||||
|
elseif ($doc->getType() == 'buy_send')
|
||||||
|
$roll = 'buy';
|
||||||
else
|
else
|
||||||
$roll = $doc->getType();
|
$roll = $doc->getType();
|
||||||
$acc = $access->hasRole($roll);
|
$acc = $access->hasRole($roll);
|
||||||
|
@ -619,7 +661,9 @@ class HesabdariController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
$code = $doc->getCode();
|
$code = $doc->getCode();
|
||||||
foreach($doc->getNotes() as $note){ $entityManager->remove($note);}
|
foreach ($doc->getNotes() as $note) {
|
||||||
|
$entityManager->remove($note);
|
||||||
|
}
|
||||||
$entityManager->remove($doc);
|
$entityManager->remove($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
|
@ -638,8 +682,10 @@ class HesabdariController extends AbstractController
|
||||||
if (!array_key_exists('type', $params))
|
if (!array_key_exists('type', $params))
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($params['type'] == 'person') $roll = 'person';
|
if ($params['type'] == 'person')
|
||||||
elseif ($params['type'] == 'all') $roll = 'accounting';
|
$roll = 'person';
|
||||||
|
elseif ($params['type'] == 'all')
|
||||||
|
$roll = 'accounting';
|
||||||
else
|
else
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
|
|
||||||
|
@ -762,7 +808,7 @@ class HesabdariController extends AbstractController
|
||||||
|
|
||||||
private function getChildsLabel(EntityManagerInterface $entityManager, mixed $node)
|
private function getChildsLabel(EntityManagerInterface $entityManager, mixed $node)
|
||||||
{
|
{
|
||||||
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||||
'upper' => $node
|
'upper' => $node
|
||||||
]);
|
]);
|
||||||
$temp = [];
|
$temp = [];
|
||||||
|
@ -774,16 +820,18 @@ class HesabdariController extends AbstractController
|
||||||
|
|
||||||
private function hasChild(EntityManagerInterface $entityManager, mixed $node)
|
private function hasChild(EntityManagerInterface $entityManager, mixed $node)
|
||||||
{
|
{
|
||||||
if (count($entityManager->getRepository(HesabdariTable::class)->findBy([
|
if (
|
||||||
'upper' => $node
|
count($entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||||
])) != 0)
|
'upper' => $node
|
||||||
|
])) != 0
|
||||||
|
)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getChilds(EntityManagerInterface $entityManager, mixed $node)
|
private function getChilds(EntityManagerInterface $entityManager, mixed $node)
|
||||||
{
|
{
|
||||||
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||||
'upper' => $node
|
'upper' => $node
|
||||||
]);
|
]);
|
||||||
$temp = [];
|
$temp = [];
|
||||||
|
|
|
@ -2,10 +2,17 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Business;
|
||||||
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\Money;
|
use App\Entity\Money;
|
||||||
|
use App\Service\Access;
|
||||||
|
use App\Service\Explore;
|
||||||
|
use App\Service\Log;
|
||||||
|
use App\Service\Extractor;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class MoneyController extends AbstractController
|
class MoneyController extends AbstractController
|
||||||
|
@ -15,7 +22,7 @@ class MoneyController extends AbstractController
|
||||||
{
|
{
|
||||||
$result = $entityManager->getRepository(Money::class)->findAll();
|
$result = $entityManager->getRepository(Money::class)->findAll();
|
||||||
$out = [];
|
$out = [];
|
||||||
foreach ($result as $item){
|
foreach ($result as $item) {
|
||||||
$temp = [];
|
$temp = [];
|
||||||
$temp['name'] = $item->getName();
|
$temp['name'] = $item->getName();
|
||||||
$temp['label'] = $item->getLabel();
|
$temp['label'] = $item->getLabel();
|
||||||
|
@ -23,4 +30,103 @@ class MoneyController extends AbstractController
|
||||||
}
|
}
|
||||||
return $this->json($out);
|
return $this->json($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/money/get/info', name: 'app_money_get_info')]
|
||||||
|
public function app_money_get_info(Log $log, Request $request, Extractor $extractor, EntityManagerInterface $entityManager, Access $access): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if (!array_key_exists('name', $params))
|
||||||
|
return $this->json($extractor->paramsNotSend());
|
||||||
|
$money = $entityManager->getRepository(Money::class)->findOneBy([
|
||||||
|
'name' => $params['name']
|
||||||
|
]);
|
||||||
|
if (!$money)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
return $this->json(Explore::ExploreMoney($money));
|
||||||
|
|
||||||
|
}
|
||||||
|
#[Route('/api/money/remove', name: 'app_money_remove')]
|
||||||
|
public function app_money_remove(Log $log, Request $request, Extractor $extractor, EntityManagerInterface $entityManager, Access $access): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('owner');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if (!array_key_exists('name', $params))
|
||||||
|
return $this->json($extractor->paramsNotSend());
|
||||||
|
|
||||||
|
$money = $entityManager->getRepository(Money::class)->findOneBy([
|
||||||
|
'name' => $params['name']
|
||||||
|
]);
|
||||||
|
if (!$money)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
|
||||||
|
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'money' => $money
|
||||||
|
]);
|
||||||
|
if (count($docs) != 0) {
|
||||||
|
return $this->json($extractor->operationFail('این ارز دارای تاریخچه اسناد حسابداری است.'));
|
||||||
|
}
|
||||||
|
if ($acc['bid']->getMoney()->getId() == $money->getId()) {
|
||||||
|
return $this->json($extractor->operationFail('ارز پیشفرض کسب و کار قابل حذف نیست.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$bid = $entityManager->getRepository(Business::class)->findOneBy([
|
||||||
|
'id' => $acc['bid']->getId(),
|
||||||
|
]);
|
||||||
|
$bid->removeExtraMoney($money);
|
||||||
|
$entityManager->persist($bid);
|
||||||
|
$entityManager->flush();
|
||||||
|
//add log to system
|
||||||
|
$log->insert('تنظیمات پایه', 'یک ارز جانبی با نام ' . $money->getLabel() . ' حذف شد.', $this->getUser(), $acc['bid']);
|
||||||
|
|
||||||
|
return $this->json($extractor->operationSuccess());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/money/add/to/business', name: 'app_money_ad_to_business')]
|
||||||
|
public function app_money_ad_to_business(Log $log, Request $request, Extractor $extractor, EntityManagerInterface $entityManager, Access $access): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('owner');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if (!array_key_exists('name', $params))
|
||||||
|
return $this->json($extractor->paramsNotSend());
|
||||||
|
|
||||||
|
$money = $entityManager->getRepository(Money::class)->findOneBy([
|
||||||
|
'name' => $params['name']
|
||||||
|
]);
|
||||||
|
if (!$money)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
|
||||||
|
foreach ($acc['bid']->getExtraMoney() as $mo) {
|
||||||
|
if ($money->getName() == $mo->getName() || $acc['bid']->getMoney()->getName() == $mo->getName()) {
|
||||||
|
//added before
|
||||||
|
return $this->json($extractor->operationFail('این ارز قبلا افزوده شده است.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$bid = $entityManager->getRepository(Business::class)->findOneBy([
|
||||||
|
'id' => $acc['bid']->getId(),
|
||||||
|
]);
|
||||||
|
$bid->addExtraMoney($money);
|
||||||
|
$entityManager->persist($bid);
|
||||||
|
$entityManager->flush();
|
||||||
|
//add log to system
|
||||||
|
$log->insert('تنظیمات پایه', 'یک ارز جانبی با نام ' . $money->getLabel() . ' افزوده شد.', $this->getUser(), $acc['bid']);
|
||||||
|
|
||||||
|
return $this->json($extractor->operationSuccess());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
class NotesController extends AbstractController
|
class NotesController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/api/notes/list', name: 'api_notes_list')]
|
#[Route('/api/notes/list', name: 'api_notes_list')]
|
||||||
public function api_notes_list(Extractor $extractor,Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
public function api_notes_list(Extractor $extractor, Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('join');
|
$acc = $access->hasRole('join');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
|
@ -25,13 +25,14 @@ class NotesController extends AbstractController
|
||||||
if ($content = $request->getContent()) {
|
if ($content = $request->getContent()) {
|
||||||
$params = json_decode($content, true);
|
$params = json_decode($content, true);
|
||||||
}
|
}
|
||||||
if($params['code'] != 0){
|
if ($params['code'] != 0) {
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc) return $this->json($extractor->notFound());
|
if (!$doc)
|
||||||
|
return $this->json($extractor->notFound());
|
||||||
}
|
}
|
||||||
$items = $entityManager->getRepository(Note::class)->findBy([
|
$items = $entityManager->getRepository(Note::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
@ -41,17 +42,17 @@ class NotesController extends AbstractController
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id'=>$item->getId(),
|
'id' => $item->getId(),
|
||||||
'des'=>$item->getDes(),
|
'des' => $item->getDes(),
|
||||||
'submitter'=>$item->getSubmitter()->getFullName(),
|
'submitter' => $item->getSubmitter()->getFullName(),
|
||||||
'date' => $jdate->jdate('Y/n/d',$item->getDate())
|
'date' => $jdate->jdate('Y/n/d', $item->getDate())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $this->json($result);
|
return $this->json($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/notes/count', name: 'api_notes_count')]
|
#[Route('/api/notes/count', name: 'api_notes_count')]
|
||||||
public function api_notes_count(Extractor $extractor,Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
public function api_notes_count(Extractor $extractor, Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('join');
|
$acc = $access->hasRole('join');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
|
@ -60,13 +61,14 @@ class NotesController extends AbstractController
|
||||||
if ($content = $request->getContent()) {
|
if ($content = $request->getContent()) {
|
||||||
$params = json_decode($content, true);
|
$params = json_decode($content, true);
|
||||||
}
|
}
|
||||||
if($params['code'] != 0){
|
if ($params['code'] != 0) {
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc) return $this->json($extractor->notFound());
|
if (!$doc)
|
||||||
|
return $this->json($extractor->notFound());
|
||||||
}
|
}
|
||||||
$items = $entityManager->getRepository(Note::class)->findBy([
|
$items = $entityManager->getRepository(Note::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
@ -89,9 +91,10 @@ class NotesController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc) return $this->json($extractor->notFound());
|
if (!$doc)
|
||||||
|
return $this->json($extractor->notFound());
|
||||||
$note = new Note();
|
$note = new Note();
|
||||||
$note->setDoc($doc);
|
$note->setDoc($doc);
|
||||||
$note->setBid($acc['bid']);
|
$note->setBid($acc['bid']);
|
||||||
|
|
|
@ -892,7 +892,8 @@ class PersonsController extends AbstractController
|
||||||
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -901,7 +902,8 @@ class PersonsController extends AbstractController
|
||||||
'id' => $param['id'],
|
'id' => $param['id'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -934,7 +936,8 @@ class PersonsController extends AbstractController
|
||||||
[
|
[
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
],
|
],
|
||||||
['id' => 'DESC']
|
['id' => 'DESC']
|
||||||
);
|
);
|
||||||
|
@ -977,7 +980,8 @@ class PersonsController extends AbstractController
|
||||||
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -986,7 +990,8 @@ class PersonsController extends AbstractController
|
||||||
'id' => $param['id'],
|
'id' => $param['id'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -1009,7 +1014,8 @@ class PersonsController extends AbstractController
|
||||||
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -1018,7 +1024,8 @@ class PersonsController extends AbstractController
|
||||||
'id' => $param['id'],
|
'id' => $param['id'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -1051,7 +1058,8 @@ class PersonsController extends AbstractController
|
||||||
[
|
[
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
],
|
],
|
||||||
['id' => 'DESC']
|
['id' => 'DESC']
|
||||||
);
|
);
|
||||||
|
@ -1094,7 +1102,8 @@ class PersonsController extends AbstractController
|
||||||
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -1103,7 +1112,8 @@ class PersonsController extends AbstractController
|
||||||
'id' => $param['id'],
|
'id' => $param['id'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'year' => $acc['year']
|
'year' => $acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
|
|
@ -114,7 +114,8 @@ class PlugNoghreController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'code'=>$id,
|
'code'=>$id,
|
||||||
'bid'=>$acc['bid']
|
'bid'=>$acc['bid'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc)
|
if(!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
@ -267,7 +268,7 @@ class PlugNoghreController extends AbstractController
|
||||||
$doc->setDes('سفارش ساخت منسوجات نقره: ' . $params['des']);
|
$doc->setDes('سفارش ساخت منسوجات نقره: ' . $params['des']);
|
||||||
$doc->setBid($acc['bid']);
|
$doc->setBid($acc['bid']);
|
||||||
$doc->setPlugin('plugNoghreOrder');
|
$doc->setPlugin('plugNoghreOrder');
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setDate($params['dateSubmit']);
|
$doc->setDate($params['dateSubmit']);
|
||||||
$doc->setYear($acc['year']);
|
$doc->setYear($acc['year']);
|
||||||
$doc->setType('plug_noghre_order');
|
$doc->setType('plug_noghre_order');
|
||||||
|
@ -561,7 +562,8 @@ class PlugNoghreController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'code'=>$code,
|
'code'=>$code,
|
||||||
'plugin'=>'plugNoghrePay',
|
'plugin'=>'plugNoghrePay',
|
||||||
'bid'=>$acc['bid']
|
'bid'=>$acc['bid'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc)
|
if(!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
|
|
@ -36,13 +36,15 @@ class ReportController extends AbstractController
|
||||||
if ($params['type'] == 'all') {
|
if ($params['type'] == 'all') {
|
||||||
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
//filter docs by date
|
//filter docs by date
|
||||||
|
@ -52,18 +54,21 @@ class ReportController extends AbstractController
|
||||||
foreach ($docs as $doc) {
|
foreach ($docs as $doc) {
|
||||||
$canAdd = true;
|
$canAdd = true;
|
||||||
if ($dateStart) {
|
if ($dateStart) {
|
||||||
if ($provider->shamsiDateToTimestamp($doc->getDate()) < $dateStart) $canAdd = false;
|
if ($provider->shamsiDateToTimestamp($doc->getDate()) < $dateStart)
|
||||||
|
$canAdd = false;
|
||||||
}
|
}
|
||||||
if ($dateEnd) {
|
if ($dateEnd) {
|
||||||
if ($provider->shamsiDateToTimestamp($doc->getDate()) > $dateEnd) $canAdd = false;
|
if ($provider->shamsiDateToTimestamp($doc->getDate()) > $dateEnd)
|
||||||
|
$canAdd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($canAdd) $result[] = $doc;
|
if ($canAdd)
|
||||||
|
$result[] = $doc;
|
||||||
}
|
}
|
||||||
$docs = $result;
|
$docs = $result;
|
||||||
|
|
||||||
$person = $entityManagerInterface->getRepository(Person::class)->findOneBy([
|
$person = $entityManagerInterface->getRepository(Person::class)->findOneBy([
|
||||||
'bid' => $acc['bid']->getId(),
|
'bid' => $acc['bid']->getId(),
|
||||||
'code' => $params['person'],
|
'code' => $params['person'],
|
||||||
]);
|
]);
|
||||||
$result = [];
|
$result = [];
|
||||||
|
@ -119,7 +124,7 @@ class ReportController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/report/person/buysell/export/excel', name: 'app_report_person_buysell_export_excell')]
|
#[Route('/api/report/person/buysell/export/excel', name: 'app_report_person_buysell_export_excell')]
|
||||||
public function app_report_person_buysell_export_excell(Provider $provider, Access $access, Request $request, EntityManagerInterface $entityManagerInterface): BinaryFileResponse | JsonResponse | StreamedResponse
|
public function app_report_person_buysell_export_excell(Provider $provider, Access $access, Request $request, EntityManagerInterface $entityManagerInterface): BinaryFileResponse|JsonResponse|StreamedResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('report');
|
$acc = $access->hasRole('report');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
|
@ -186,19 +191,21 @@ class ReportController extends AbstractController
|
||||||
if ($params['type'] == 'all') {
|
if ($params['type'] == 'all') {
|
||||||
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
$docs = $entityManagerInterface->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$commodity = $entityManagerInterface->getRepository(Commodity::class)->findOneBy([
|
$commodity = $entityManagerInterface->getRepository(Commodity::class)->findOneBy([
|
||||||
'bid' => $acc['bid']->getId(),
|
'bid' => $acc['bid']->getId(),
|
||||||
'code' => $params['commodity'],
|
'code' => $params['commodity'],
|
||||||
]);
|
]);
|
||||||
//filter docs by date
|
//filter docs by date
|
||||||
|
@ -208,13 +215,16 @@ class ReportController extends AbstractController
|
||||||
foreach ($docs as $doc) {
|
foreach ($docs as $doc) {
|
||||||
$canAdd = true;
|
$canAdd = true;
|
||||||
if ($dateStart) {
|
if ($dateStart) {
|
||||||
if ($provider->shamsiDateToTimestamp($doc->getDate()) < $dateStart) $canAdd = false;
|
if ($provider->shamsiDateToTimestamp($doc->getDate()) < $dateStart)
|
||||||
|
$canAdd = false;
|
||||||
}
|
}
|
||||||
if ($dateEnd) {
|
if ($dateEnd) {
|
||||||
if ($provider->shamsiDateToTimestamp($doc->getDate()) > $dateEnd) $canAdd = false;
|
if ($provider->shamsiDateToTimestamp($doc->getDate()) > $dateEnd)
|
||||||
|
$canAdd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($canAdd) $result[] = $doc;
|
if ($canAdd)
|
||||||
|
$result[] = $doc;
|
||||||
}
|
}
|
||||||
$docs = $result;
|
$docs = $result;
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
|
@ -35,7 +35,8 @@ class RfbuyController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
//check related documents
|
//check related documents
|
||||||
if (count($doc->getRelatedDocs()) != 0)
|
if (count($doc->getRelatedDocs()) != 0)
|
||||||
|
@ -58,7 +59,8 @@ class RfbuyController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
@ -85,7 +87,8 @@ class RfbuyController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
|
|
||||||
|
@ -101,7 +104,7 @@ class RfbuyController extends AbstractController
|
||||||
$doc->setDateSubmit(time());
|
$doc->setDateSubmit(time());
|
||||||
$doc->setType('rfbuy');
|
$doc->setType('rfbuy');
|
||||||
$doc->setSubmitter($this->getUser());
|
$doc->setSubmitter($this->getUser());
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||||
}
|
}
|
||||||
if($params['transferCost'] != 0){
|
if($params['transferCost'] != 0){
|
||||||
|
@ -222,7 +225,8 @@ class RfbuyController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $item['code']
|
'code' => $item['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
if ($params['label'] != 'clear') {
|
if ($params['label'] != 'clear') {
|
||||||
|
@ -265,7 +269,8 @@ class RfbuyController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'type' => 'rfbuy'
|
'type' => 'rfbuy',
|
||||||
|
'money'=> $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -329,7 +334,8 @@ class RfbuyController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$pdfPid = 0;
|
$pdfPid = 0;
|
||||||
|
@ -392,7 +398,8 @@ class RfbuyController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$person = null;
|
$person = null;
|
||||||
|
|
|
@ -36,7 +36,8 @@ class RfsellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid'=>$acc['bid'],
|
'bid'=>$acc['bid'],
|
||||||
'code'=>$code
|
'code'=>$code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
//check related documents
|
//check related documents
|
||||||
if(count($doc->getRelatedDocs()) != 0)
|
if(count($doc->getRelatedDocs()) != 0)
|
||||||
|
@ -59,7 +60,8 @@ class RfsellController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid'=>$acc['bid'],
|
'bid'=>$acc['bid'],
|
||||||
'code'=>$code
|
'code'=>$code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if(!$doc)
|
if(!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
@ -76,7 +78,8 @@ class RfsellController extends AbstractController
|
||||||
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$invoices = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid'=>$acc['bid'],
|
'bid'=>$acc['bid'],
|
||||||
'year'=>$acc['year'],
|
'year'=>$acc['year'],
|
||||||
'type'=>'rfsell'
|
'type'=>'rfsell',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
return $this->json(Explore::ExploreBuyDocsList($invoices));
|
return $this->json(Explore::ExploreBuyDocsList($invoices));
|
||||||
}
|
}
|
||||||
|
@ -100,7 +103,8 @@ class RfsellController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
|
|
||||||
|
@ -116,7 +120,7 @@ class RfsellController extends AbstractController
|
||||||
$doc->setDateSubmit(time());
|
$doc->setDateSubmit(time());
|
||||||
$doc->setType('rfsell');
|
$doc->setType('rfsell');
|
||||||
$doc->setSubmitter($this->getUser());
|
$doc->setSubmitter($this->getUser());
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||||
}
|
}
|
||||||
if($params['transferCost'] != 0){
|
if($params['transferCost'] != 0){
|
||||||
|
@ -237,7 +241,8 @@ class RfsellController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $item['code']
|
'code' => $item['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) return $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
if ($params['label'] != 'clear') {
|
if ($params['label'] != 'clear') {
|
||||||
|
@ -280,7 +285,8 @@ class RfsellController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'type' => 'rfsell'
|
'type' => 'rfsell',
|
||||||
|
'money'=> $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -344,7 +350,8 @@ class RfsellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$pdfPid = 0;
|
$pdfPid = 0;
|
||||||
|
@ -407,7 +414,8 @@ class RfsellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$person = null;
|
$person = null;
|
||||||
|
|
|
@ -237,7 +237,8 @@ class SMSController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'bid' => $bid,
|
'bid' => $bid,
|
||||||
'type' => 'sell'
|
'type' => 'sell',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
return $this->json(['result' => 3]);
|
return $this->json(['result' => 3]);
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
use App\Entity\Salary;
|
use App\Entity\Salary;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
|
use App\Service\Explore;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -19,12 +20,26 @@ class SalaryController extends AbstractController
|
||||||
#[Route('/api/salary/list', name: 'app_salary_list')]
|
#[Route('/api/salary/list', name: 'app_salary_list')]
|
||||||
public function app_salary_list(Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_salary_list(Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
//باگ دارد تمام سال مالی برگشت داده می شود
|
$acc = $access->hasRole('salary');
|
||||||
if (!$access->hasRole('salary'))
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
//bug fix for bank with no money type
|
||||||
$datas = $entityManager->getRepository(Salary::class)->findBy([
|
$datas = $entityManager->getRepository(Salary::class)->findBy([
|
||||||
'bid' => $request->headers->get('activeBid')
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money' => null
|
||||||
]);
|
]);
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
$data->setMoney($acc['bid']->getMoney());
|
||||||
|
$entityManager->persist($data);
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
|
//end of bug fix
|
||||||
|
|
||||||
|
$datas = $entityManager->getRepository(Salary::class)->findBy([
|
||||||
|
'bid' => $request->headers->get('activeBid'),
|
||||||
|
'money' => $acc['money']
|
||||||
|
]);
|
||||||
|
$resp = [];
|
||||||
foreach ($datas as $data) {
|
foreach ($datas as $data) {
|
||||||
$bs = 0;
|
$bs = 0;
|
||||||
$bd = 0;
|
$bd = 0;
|
||||||
|
@ -36,8 +51,9 @@ class SalaryController extends AbstractController
|
||||||
$bd += $item->getBd();
|
$bd += $item->getBd();
|
||||||
}
|
}
|
||||||
$data->setBalance($bd - $bs);
|
$data->setBalance($bd - $bs);
|
||||||
|
$resp[] = Explore::ExploreSalary($data);
|
||||||
}
|
}
|
||||||
return $this->json($datas);
|
return $this->json($resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/salary/info/{code}', name: 'app_salary_info')]
|
#[Route('/api/salary/info/{code}', name: 'app_salary_info')]
|
||||||
|
@ -50,7 +66,7 @@ class SalaryController extends AbstractController
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code
|
||||||
]);
|
]);
|
||||||
return $this->json($data);
|
return $this->json(Explore::ExploreSalary($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/salary/mod/{code}', name: 'app_salary_mod')]
|
#[Route('/api/salary/mod/{code}', name: 'app_salary_mod')]
|
||||||
|
@ -77,6 +93,7 @@ class SalaryController extends AbstractController
|
||||||
return $this->json(['result' => 2]);
|
return $this->json(['result' => 2]);
|
||||||
$data = new Salary();
|
$data = new Salary();
|
||||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'salary'));
|
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'), 'salary'));
|
||||||
|
$data->setMoney($acc['money']);
|
||||||
} else {
|
} else {
|
||||||
$data = $entityManager->getRepository(Salary::class)->findOneBy([
|
$data = $entityManager->getRepository(Salary::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
|
@ -84,6 +101,9 @@ class SalaryController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$data)
|
if (!$data)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
if (!$data->getMoney()) {
|
||||||
|
$data->setMoney($acc['money']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data->setBid($acc['bid']);
|
$data->setBid($acc['bid']);
|
||||||
$data->setname($params['name']);
|
$data->setname($params['name']);
|
||||||
|
|
|
@ -38,7 +38,8 @@ class SellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
//check related documents
|
//check related documents
|
||||||
if (count($doc->getRelatedDocs()) != 0)
|
if (count($doc->getRelatedDocs()) != 0)
|
||||||
|
@ -61,7 +62,8 @@ class SellController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
@ -133,14 +135,13 @@ class SellController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
return $this->json($extractor->notFound());
|
return $this->json($extractor->notFound());
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$rows = $doc->getHesabdariRows();
|
||||||
'doc' => $doc
|
|
||||||
]);
|
|
||||||
foreach ($rows as $row)
|
foreach ($rows as $row)
|
||||||
$entityManager->remove($row);
|
$entityManager->remove($row);
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +151,7 @@ class SellController extends AbstractController
|
||||||
$doc->setDateSubmit(time());
|
$doc->setDateSubmit(time());
|
||||||
$doc->setType('sell');
|
$doc->setType('sell');
|
||||||
$doc->setSubmitter($this->getUser());
|
$doc->setSubmitter($this->getUser());
|
||||||
$doc->setMoney($acc['bid']->getMoney());
|
$doc->setMoney($acc['money']);
|
||||||
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
$doc->setCode($provider->getAccountingCode($acc['bid'], 'accounting'));
|
||||||
}
|
}
|
||||||
if ($params['transferCost'] != 0) {
|
if ($params['transferCost'] != 0) {
|
||||||
|
@ -245,6 +246,12 @@ class SellController extends AbstractController
|
||||||
|
|
||||||
$entityManager->persist($doc);
|
$entityManager->persist($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
if(!$doc->getShortlink()){
|
||||||
|
$doc->setShortlink($doc->getId());
|
||||||
|
}
|
||||||
|
$entityManager->persist($doc);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
$log->insert(
|
$log->insert(
|
||||||
'حسابداری',
|
'حسابداری',
|
||||||
'سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',
|
'سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',
|
||||||
|
@ -259,7 +266,7 @@ class SellController extends AbstractController
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'result' =>
|
'result' =>
|
||||||
$SMS->sendByBalance(
|
$SMS->sendByBalance(
|
||||||
[$person->getnikename(), 'sell/' . $acc['bid']->getId() . '/' . $doc->getShortLink(), $acc['bid']->getName(), $acc['bid']->getTel()],
|
[$person->getnikename(), 'sell/' . $acc['bid']->getId() . '/' . $doc->getId(), $acc['bid']->getName(), $acc['bid']->getTel()],
|
||||||
$registryMGR->get('sms', 'plugAccproSharefaktor'),
|
$registryMGR->get('sms', 'plugAccproSharefaktor'),
|
||||||
$person->getMobile(),
|
$person->getMobile(),
|
||||||
$acc['bid'],
|
$acc['bid'],
|
||||||
|
@ -271,7 +278,7 @@ class SellController extends AbstractController
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'result' =>
|
'result' =>
|
||||||
$SMS->sendByBalance(
|
$SMS->sendByBalance(
|
||||||
[$acc['bid']->getName(), 'sell/' . $acc['bid']->getId() . '/' . $doc->getShortLink()],
|
[$acc['bid']->getName(), 'sell/' . $acc['bid']->getId() . '/' . $doc->getId()],
|
||||||
$registryMGR->get('sms', 'sharefaktor'),
|
$registryMGR->get('sms', 'sharefaktor'),
|
||||||
$person->getMobile(),
|
$person->getMobile(),
|
||||||
$acc['bid'],
|
$acc['bid'],
|
||||||
|
@ -308,7 +315,8 @@ class SellController extends AbstractController
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $item['code']
|
'code' => $item['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
return $this->json($extractor->notFound());
|
return $this->json($extractor->notFound());
|
||||||
|
@ -352,7 +360,8 @@ class SellController extends AbstractController
|
||||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'type' => 'sell'
|
'type' => 'sell',
|
||||||
|
'money'=> $acc['money']
|
||||||
], [
|
], [
|
||||||
'id' => 'DESC'
|
'id' => 'DESC'
|
||||||
]);
|
]);
|
||||||
|
@ -462,7 +471,8 @@ class SellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
@ -527,7 +537,8 @@ class SellController extends AbstractController
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
|
|
@ -121,7 +121,8 @@ class StoreroomController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$buys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$buys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'buy'
|
'type' => 'buy',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$buysForExport = [];
|
$buysForExport = [];
|
||||||
foreach ($buys as $buy) {
|
foreach ($buys as $buy) {
|
||||||
|
@ -141,7 +142,8 @@ class StoreroomController extends AbstractController
|
||||||
|
|
||||||
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'sell'
|
'type' => 'sell',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$sellsForExport = [];
|
$sellsForExport = [];
|
||||||
foreach ($sells as $sell) {
|
foreach ($sells as $sell) {
|
||||||
|
@ -161,7 +163,8 @@ class StoreroomController extends AbstractController
|
||||||
|
|
||||||
$rfsells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$rfsells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'rfsell'
|
'type' => 'rfsell',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$rfsellsForExport = [];
|
$rfsellsForExport = [];
|
||||||
foreach ($rfsells as $sell) {
|
foreach ($rfsells as $sell) {
|
||||||
|
@ -181,7 +184,8 @@ class StoreroomController extends AbstractController
|
||||||
|
|
||||||
$rfbuys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$rfbuys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'type' => 'rfbuy'
|
'type' => 'rfbuy',
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$rfbuysForExport = [];
|
$rfbuysForExport = [];
|
||||||
foreach ($rfbuys as $buy) {
|
foreach ($rfbuys as $buy) {
|
||||||
|
@ -238,7 +242,8 @@ class StoreroomController extends AbstractController
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $id
|
'code' => $id,
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException('سند یافت نشد.');
|
throw $this->createNotFoundException('سند یافت نشد.');
|
||||||
|
@ -351,7 +356,8 @@ class StoreroomController extends AbstractController
|
||||||
//going to save
|
//going to save
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'id' => $params['doc']['id'],
|
'id' => $params['doc']['id'],
|
||||||
'bid' => $acc['bid']
|
'bid' => $acc['bid'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException('سند یافت نشد');
|
throw $this->createNotFoundException('سند یافت نشد');
|
||||||
|
|
|
@ -25,7 +25,8 @@ class TransferController extends AbstractController
|
||||||
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$items = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid'=>$acc['bid'],
|
'bid'=>$acc['bid'],
|
||||||
'type'=>'transfer',
|
'type'=>'transfer',
|
||||||
'year'=>$acc['year']
|
'year'=>$acc['year'],
|
||||||
|
'money'=> $acc['money']
|
||||||
]);
|
]);
|
||||||
$resp = [];
|
$resp = [];
|
||||||
foreach ($items as $item){
|
foreach ($items as $item){
|
||||||
|
|
|
@ -61,6 +61,9 @@ class BankAccount
|
||||||
#[ORM\OneToMany(mappedBy: 'bank', targetEntity: Cheque::class)]
|
#[ORM\OneToMany(mappedBy: 'bank', targetEntity: Cheque::class)]
|
||||||
private Collection $cheques;
|
private Collection $cheques;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne]
|
||||||
|
private ?Money $money = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -275,4 +278,16 @@ class BankAccount
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMoney(): ?Money
|
||||||
|
{
|
||||||
|
return $this->money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMoney(?Money $money): static
|
||||||
|
{
|
||||||
|
$this->money = $money;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,12 @@ class Business
|
||||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Project::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Project::class, orphanRemoval: true)]
|
||||||
private Collection $projects;
|
private Collection $projects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Money>
|
||||||
|
*/
|
||||||
|
#[ORM\ManyToMany(targetEntity: Money::class, inversedBy: 'bids')]
|
||||||
|
private Collection $extraMoney;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -287,6 +293,7 @@ class Business
|
||||||
$this->priceLists = new ArrayCollection();
|
$this->priceLists = new ArrayCollection();
|
||||||
$this->printOptions = new ArrayCollection();
|
$this->printOptions = new ArrayCollection();
|
||||||
$this->projects = new ArrayCollection();
|
$this->projects = new ArrayCollection();
|
||||||
|
$this->extraMoney = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1787,4 +1794,28 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Money>
|
||||||
|
*/
|
||||||
|
public function getExtraMoney(): Collection
|
||||||
|
{
|
||||||
|
return $this->extraMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addExtraMoney(Money $extraMoney): static
|
||||||
|
{
|
||||||
|
if (!$this->extraMoney->contains($extraMoney)) {
|
||||||
|
$this->extraMoney->add($extraMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeExtraMoney(Money $extraMoney): static
|
||||||
|
{
|
||||||
|
$this->extraMoney->removeElement($extraMoney);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ class Cashdesk
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $balance = null;
|
private ?string $balance = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'cashdesks')]
|
||||||
|
private ?Money $money = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -136,4 +139,16 @@ class Cashdesk
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMoney(): ?Money
|
||||||
|
{
|
||||||
|
return $this->money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMoney(?Money $money): static
|
||||||
|
{
|
||||||
|
$this->money = $money;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,37 @@ class Money
|
||||||
#[ORM\OneToMany(mappedBy: 'money', targetEntity: PriceListDetail::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'money', targetEntity: PriceListDetail::class, orphanRemoval: true)]
|
||||||
private Collection $priceListDetails;
|
private Collection $priceListDetails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Business>
|
||||||
|
*/
|
||||||
|
#[ORM\ManyToMany(targetEntity: Business::class, mappedBy: 'extraMoney')]
|
||||||
|
private Collection $bids;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $symbol = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $shortName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Cashdesk>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(mappedBy: 'money', targetEntity: Cashdesk::class)]
|
||||||
|
private Collection $cashdesks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Salary>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(mappedBy: 'money', targetEntity: Salary::class)]
|
||||||
|
private Collection $salaries;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->businesses = new ArrayCollection();
|
$this->businesses = new ArrayCollection();
|
||||||
$this->priceListDetails = new ArrayCollection();
|
$this->priceListDetails = new ArrayCollection();
|
||||||
|
$this->bids = new ArrayCollection();
|
||||||
|
$this->cashdesks = new ArrayCollection();
|
||||||
|
$this->salaries = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -121,4 +148,115 @@ class Money
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Business>
|
||||||
|
*/
|
||||||
|
public function getBids(): Collection
|
||||||
|
{
|
||||||
|
return $this->bids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addBid(Business $bid): static
|
||||||
|
{
|
||||||
|
if (!$this->bids->contains($bid)) {
|
||||||
|
$this->bids->add($bid);
|
||||||
|
$bid->addExtraMoney($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeBid(Business $bid): static
|
||||||
|
{
|
||||||
|
if ($this->bids->removeElement($bid)) {
|
||||||
|
$bid->removeExtraMoney($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSymbol(): ?string
|
||||||
|
{
|
||||||
|
return $this->symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSymbol(string $symbol): static
|
||||||
|
{
|
||||||
|
$this->symbol = $symbol;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShortName(): ?string
|
||||||
|
{
|
||||||
|
return $this->shortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShortName(string $shortName): static
|
||||||
|
{
|
||||||
|
$this->shortName = $shortName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cashdesk>
|
||||||
|
*/
|
||||||
|
public function getCashdesks(): Collection
|
||||||
|
{
|
||||||
|
return $this->cashdesks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCashdesk(Cashdesk $cashdesk): static
|
||||||
|
{
|
||||||
|
if (!$this->cashdesks->contains($cashdesk)) {
|
||||||
|
$this->cashdesks->add($cashdesk);
|
||||||
|
$cashdesk->setMoney($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCashdesk(Cashdesk $cashdesk): static
|
||||||
|
{
|
||||||
|
if ($this->cashdesks->removeElement($cashdesk)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cashdesk->getMoney() === $this) {
|
||||||
|
$cashdesk->setMoney(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Salary>
|
||||||
|
*/
|
||||||
|
public function getSalaries(): Collection
|
||||||
|
{
|
||||||
|
return $this->salaries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addSalary(Salary $salary): static
|
||||||
|
{
|
||||||
|
if (!$this->salaries->contains($salary)) {
|
||||||
|
$this->salaries->add($salary);
|
||||||
|
$salary->setMoney($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeSalary(Salary $salary): static
|
||||||
|
{
|
||||||
|
if ($this->salaries->removeElement($salary)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($salary->getMoney() === $this) {
|
||||||
|
$salary->setMoney(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ class Salary
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $balance = null;
|
private ?string $balance = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'salaries')]
|
||||||
|
private ?Money $money = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -137,4 +140,16 @@ class Salary
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMoney(): ?Money
|
||||||
|
{
|
||||||
|
return $this->money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMoney(?Money $money): static
|
||||||
|
{
|
||||||
|
$this->money = $money;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Service;
|
||||||
|
|
||||||
use App\Entity\APIToken;
|
use App\Entity\APIToken;
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
|
use App\Entity\Money;
|
||||||
use App\Entity\Permission;
|
use App\Entity\Permission;
|
||||||
use App\Entity\UserToken;
|
use App\Entity\UserToken;
|
||||||
use App\Entity\Year;
|
use App\Entity\Year;
|
||||||
|
@ -69,12 +70,27 @@ class Access
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->request->headers->get('activeMoney')) {
|
||||||
|
$money = $this->em->getRepository(Money::class)->findOneBy([
|
||||||
|
'name' => $this->request->headers->get('activeMoney'),
|
||||||
|
]);
|
||||||
|
if (!$money) { return false; }
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$money = $this->em->getRepository(Money::class)->findOneBy([
|
||||||
|
'name' => $bid->getMoney(),
|
||||||
|
]);
|
||||||
|
if (!$money) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
$accessArray = [
|
$accessArray = [
|
||||||
'bid'=>$bid,
|
'bid'=>$bid,
|
||||||
'user'=>$this->user,
|
'user'=>$this->user,
|
||||||
'year'=>$year,
|
'year'=>$year,
|
||||||
'access'=>true
|
'access'=>true,
|
||||||
|
'money'=>$money
|
||||||
];
|
];
|
||||||
|
|
||||||
if($bid->getOwner()->getEmail() === $this->user->getUserIdentifier()){
|
if($bid->getOwner()->getEmail() === $this->user->getUserIdentifier()){
|
||||||
//user is owner
|
//user is owner
|
||||||
return $accessArray;
|
return $accessArray;
|
||||||
|
|
|
@ -236,6 +236,16 @@ class Explore
|
||||||
'id' => $item->getId(),
|
'id' => $item->getId(),
|
||||||
'code' => $item->getCode(),
|
'code' => $item->getCode(),
|
||||||
'name' => $item->getName(),
|
'name' => $item->getName(),
|
||||||
|
'cardNum' => $item->getCardNum(),
|
||||||
|
'shaba' => $item->getShaba(),
|
||||||
|
'accountNum' => $item->getAccountNum(),
|
||||||
|
'owner' => $item->getOwner(),
|
||||||
|
'shobe' => $item->getShobe(),
|
||||||
|
'posNum' => $item->getPosNum(),
|
||||||
|
'des' => $item->getDes(),
|
||||||
|
'mobileInternetBank' => $item->getMobileInternetBank(),
|
||||||
|
'balance' => null,
|
||||||
|
'money' => self::ExploreMoney($item->getMoney())
|
||||||
];
|
];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +257,9 @@ class Explore
|
||||||
'id' => $item->getId(),
|
'id' => $item->getId(),
|
||||||
'code' => $item->getCode(),
|
'code' => $item->getCode(),
|
||||||
'name' => $item->getName(),
|
'name' => $item->getName(),
|
||||||
'des' => $item->getDes()
|
'des' => $item->getDes(),
|
||||||
|
'balance' => $item->getBalance(),
|
||||||
|
'money' => self::ExploreMoney($item->getMoney())
|
||||||
];
|
];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +270,9 @@ class Explore
|
||||||
'id' => $item->getId(),
|
'id' => $item->getId(),
|
||||||
'code' => $item->getCode(),
|
'code' => $item->getCode(),
|
||||||
'name' => $item->getName(),
|
'name' => $item->getName(),
|
||||||
'des' => $item->getDes()
|
'des' => $item->getDes(),
|
||||||
|
'balance' => $item->getBalance(),
|
||||||
|
'money' => self::ExploreMoney($item->getMoney())
|
||||||
];
|
];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -341,6 +355,8 @@ class Explore
|
||||||
'id' => $money->getId(),
|
'id' => $money->getId(),
|
||||||
'label' => $money->getLabel(),
|
'label' => $money->getLabel(),
|
||||||
'name' => $money->getName(),
|
'name' => $money->getName(),
|
||||||
|
'shortName' => $money->getShortName(),
|
||||||
|
'symbol' => $money->getSymbol()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public static function ExploreYear(Year|null $year)
|
public static function ExploreYear(Year|null $year)
|
||||||
|
@ -467,4 +483,55 @@ class Explore
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ExploreBusiness(Business $item)
|
||||||
|
{
|
||||||
|
$res = [
|
||||||
|
'id' => $item->getId(),
|
||||||
|
'owner' => $item->getOwner()->getFullName(),
|
||||||
|
'name' => $item->getName(),
|
||||||
|
'legal_name' => $item->getLegalName(),
|
||||||
|
'field' => $item->getField(),
|
||||||
|
'shenasemeli' => $item->getShenasemeli(),
|
||||||
|
'codeeqtesadi' => $item->getCodeeghtesadi(),
|
||||||
|
'shomaresabt' => $item->getShomaresabt(),
|
||||||
|
'country' => $item->getCountry(),
|
||||||
|
'ostan' => $item->getOstan(),
|
||||||
|
'shahrestan' => $item->getShahrestan(),
|
||||||
|
'postalcode' => $item->getPostalcode(),
|
||||||
|
'tel' => $item->getTel(),
|
||||||
|
'mobile' => $item->getMobile(),
|
||||||
|
'address' => $item->getAddress(),
|
||||||
|
'website' => $item->getWesite(),
|
||||||
|
'maliyatafzode' => $item->getMaliyatafzode(),
|
||||||
|
'arzmain' => self::ExploreMoney($item->getMoney()),
|
||||||
|
'zarinpalCode' => $item->getZarinpalCode(),
|
||||||
|
'smsCharge' => $item->getSmsCharge(),
|
||||||
|
'shortlinks' => $item->isShortlinks(),
|
||||||
|
'walletEnabled' => $item->isWalletEnable(),
|
||||||
|
'walletMatchBank' => null,
|
||||||
|
'updateSellPrice' => $item->isCommodityUpdateSellPriceAuto(),
|
||||||
|
'updateBuyPrice' => $item->isCommodityUpdateBuyPriceAuto(),
|
||||||
|
];
|
||||||
|
if (!$item->getProfitCalctype()) {
|
||||||
|
$res['profitCalcType'] = 'lis';
|
||||||
|
} else {
|
||||||
|
$res['profitCalcType'] = $item->getProfitCalctype();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($item->getYears() as $year) {
|
||||||
|
if ($year->isHead()) {
|
||||||
|
$res['year'] = Explore::ExploreYear($year);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$res['moneys'] = [
|
||||||
|
self::ExploreMoney($item->getMoney())
|
||||||
|
];
|
||||||
|
foreach ($item->getExtraMoney() as $money) {
|
||||||
|
$res['moneys'][] = self::ExploreMoney($money);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,15 @@ class Extractor
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
public function operationFail($message='operaition fail',$code=404, $data = ''){
|
||||||
|
return [
|
||||||
|
'Success'=>false,
|
||||||
|
'code' => $code,
|
||||||
|
'data' =>$data,
|
||||||
|
'message'=>$message,
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
public function notFound($data = ''){
|
public function notFound($data = ''){
|
||||||
return [
|
return [
|
||||||
'code' => 404,
|
'code' => 404,
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="column_attr clearfix mobile_align_center" style="padding: 0 4%;">
|
<div class="column_attr clearfix mobile_align_center" style="padding: 0 4%;">
|
||||||
<h6 style="margin-bottom: 0px;">تلفن</h6>
|
<h6 style="margin-bottom: 0px;">تلفن</h6>
|
||||||
<h4><a class="themecolor" href="tel:02191031705">021-9103-1705 داخلی ۳</a></h4>
|
<h4><a class="themecolor" href="tel:08345323211">083-4532-3211</a></h4>
|
||||||
<hr class="no_line" style="margin: 0 auto 15px auto;">
|
<hr class="no_line" style="margin: 0 auto 15px auto;">
|
||||||
<h6 style="margin-bottom: 0px;">پشتیبانی از طریق شبکههای اجتماعی</h6>
|
<h6 style="margin-bottom: 0px;">پشتیبانی از طریق شبکههای اجتماعی</h6>
|
||||||
<h4>
|
<h4>
|
||||||
|
|
Loading…
Reference in a new issue