bug fix in create business
This commit is contained in:
parent
5343345f15
commit
5dd4818f63
|
@ -70,7 +70,7 @@ 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,Explore $explore, 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]);
|
||||||
|
@ -197,11 +197,15 @@ class BusinessController extends AbstractController
|
||||||
if ($params['profitCalcType'] == 'lis' || $params['profitCalcType'] == 'avgis') {
|
if ($params['profitCalcType'] == 'lis' || $params['profitCalcType'] == 'avgis') {
|
||||||
$business->setProfitCalcType($params['profitCalcType']);
|
$business->setProfitCalcType($params['profitCalcType']);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$business->setProfitCalcType('lis');
|
$business->setProfitCalcType('lis');
|
||||||
}
|
}
|
||||||
|
if (array_key_exists('commodityUpdateSellPriceAuto', $params)) {
|
||||||
$business->setCommodityUpdateSellPriceAuto($params['commodityUpdateSellPriceAuto']);
|
$business->setCommodityUpdateSellPriceAuto($params['commodityUpdateSellPriceAuto']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$business->setCommodityUpdateSellPriceAuto(true);
|
||||||
|
}
|
||||||
if (array_key_exists('walletEnabled', $params)) {
|
if (array_key_exists('walletEnabled', $params)) {
|
||||||
if ($params['walletEnabled']) {
|
if ($params['walletEnabled']) {
|
||||||
if (array_key_exists('walletMatchBank', $params)) {
|
if (array_key_exists('walletMatchBank', $params)) {
|
||||||
|
@ -622,10 +626,10 @@ 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(Access $access,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');
|
$acc = $access->hasRole('join');
|
||||||
if(!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
$dateNow = $jdate->jdate('Y/m/d', time());
|
$dateNow = $jdate->jdate('Y/m/d', time());
|
||||||
|
@ -650,7 +654,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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
|
@ -664,7 +668,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'buy',
|
'type' => 'buy',
|
||||||
'money'=> $acc['money']
|
'money' => $acc['money']
|
||||||
|
|
||||||
]);
|
]);
|
||||||
$buysTotal = 0;
|
$buysTotal = 0;
|
||||||
|
@ -687,7 +691,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'sell',
|
'type' => 'sell',
|
||||||
'money'=> $acc['money']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
$sellsTotal = 0;
|
$sellsTotal = 0;
|
||||||
$sellsToday = 0;
|
$sellsToday = 0;
|
||||||
|
@ -709,7 +713,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'person_send',
|
'type' => 'person_send',
|
||||||
'money'=> $acc['money']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
$sendsTotal = 0;
|
$sendsTotal = 0;
|
||||||
$sendsToday = 0;
|
$sendsToday = 0;
|
||||||
|
@ -731,7 +735,7 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'person_receive',
|
'type' => 'person_receive',
|
||||||
'money'=> $acc['money']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
$recsTotal = 0;
|
$recsTotal = 0;
|
||||||
$recsToday = 0;
|
$recsToday = 0;
|
||||||
|
|
|
@ -34,17 +34,17 @@ class UiGeneralController extends AbstractController
|
||||||
$lastBusiness = $entityManager->getRepository(Business::class)->findLast();
|
$lastBusiness = $entityManager->getRepository(Business::class)->findLast();
|
||||||
if($lastBusiness)
|
if($lastBusiness)
|
||||||
return $this->render('general/home.html.twig',[
|
return $this->render('general/home.html.twig',[
|
||||||
'business' => $busCount + 11405,
|
'business' => $busCount,
|
||||||
'users' => $users + 29471,
|
'users' => $users,
|
||||||
'docs' => $docs + 105412,
|
'docs' => $docs,
|
||||||
'lastBusinessName' => $lastBusiness->getname(),
|
'lastBusinessName' => $lastBusiness->getname(),
|
||||||
'lastBusinessOwner' => $lastBusiness->getOwner()->getFullName(),
|
'lastBusinessOwner' => $lastBusiness->getOwner()->getFullName(),
|
||||||
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
|
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
|
||||||
]);
|
]);
|
||||||
return $this->render('general/home.html.twig',[
|
return $this->render('general/home.html.twig',[
|
||||||
'business' => $busCount + 11405,
|
'business' => $busCount,
|
||||||
'users' => $users + 29471,
|
'users' => $users,
|
||||||
'docs' => $docs + 105412,
|
'docs' => $docs,
|
||||||
'lastBusinessName' => 'ثبت نشده',
|
'lastBusinessName' => 'ثبت نشده',
|
||||||
'lastBusinessOwner' => 'ثبت نشده',
|
'lastBusinessOwner' => 'ثبت نشده',
|
||||||
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
|
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
|
||||||
|
|
|
@ -382,7 +382,6 @@ class HesabdariController extends AbstractController
|
||||||
'id' => $row['chequeOwner']
|
'id' => $row['chequeOwner']
|
||||||
]);
|
]);
|
||||||
$cheque = new Cheque();
|
$cheque = new Cheque();
|
||||||
echo $hesabdariRow->getRef();
|
|
||||||
$cheque->setBid($acc['bid']);
|
$cheque->setBid($acc['bid']);
|
||||||
$cheque->setSubmitter($this->getUser());
|
$cheque->setSubmitter($this->getUser());
|
||||||
$cheque->setPayDate($row['chequeDate']);
|
$cheque->setPayDate($row['chequeDate']);
|
||||||
|
@ -392,7 +391,7 @@ class HesabdariController extends AbstractController
|
||||||
$cheque->setSayadNum($row['chequeSayadNum']);
|
$cheque->setSayadNum($row['chequeSayadNum']);
|
||||||
$cheque->setDateSubmit(time());
|
$cheque->setDateSubmit(time());
|
||||||
$cheque->setDes($row['des']);
|
$cheque->setDes($row['des']);
|
||||||
$dateArray = explode('-', $row['chequeDate']);
|
$dateArray = explode('/', $row['chequeDate']);
|
||||||
$dateGre = strtotime($jdate->jalali_to_gregorian($dateArray['0'], $dateArray['1'], $dateArray['2'], '/'));
|
$dateGre = strtotime($jdate->jalali_to_gregorian($dateArray['0'], $dateArray['1'], $dateArray['2'], '/'));
|
||||||
$cheque->setDateStamp($dateGre);
|
$cheque->setDateStamp($dateGre);
|
||||||
$cheque->setPerson($person);
|
$cheque->setPerson($person);
|
||||||
|
|
|
@ -76,9 +76,11 @@ class PersonsController extends AbstractController
|
||||||
$bs = 0;
|
$bs = 0;
|
||||||
$bd = 0;
|
$bd = 0;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
if ($row->getDoc()->getMoney() == $acc['money']) {
|
||||||
$bs += $row->getBs();
|
$bs += $row->getBs();
|
||||||
$bd += $row->getBd();
|
$bd += $row->getBd();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$response['bs'] = $bs;
|
$response['bs'] = $bs;
|
||||||
$response['bd'] = $bd;
|
$response['bd'] = $bd;
|
||||||
$response['balance'] = $bs - $bd;
|
$response['balance'] = $bs - $bd;
|
||||||
|
@ -379,14 +381,17 @@ class PersonsController extends AbstractController
|
||||||
'mobile' => $person->getMobile()
|
'mobile' => $person->getMobile()
|
||||||
];
|
];
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
'person' => $person
|
'person' => $person,
|
||||||
]);
|
]);
|
||||||
$bs = 0;
|
$bs = 0;
|
||||||
$bd = 0;
|
$bd = 0;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
//check for that calulate is in match money type
|
||||||
|
if ($row->getDoc()->getMoney() == $acc['money']) {
|
||||||
$bs += $row->getBs();
|
$bs += $row->getBs();
|
||||||
$bd += $row->getBd();
|
$bd += $row->getBd();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$temp['bs'] = $bs;
|
$temp['bs'] = $bs;
|
||||||
$temp['bd'] = $bd;
|
$temp['bd'] = $bd;
|
||||||
$temp['balance'] = $bs - $bd;
|
$temp['balance'] = $bs - $bd;
|
||||||
|
@ -625,8 +630,8 @@ class PersonsController extends AbstractController
|
||||||
]);
|
]);
|
||||||
$res = [];
|
$res = [];
|
||||||
foreach ($persons as $key => $person) {
|
foreach ($persons as $key => $person) {
|
||||||
foreach($person->getType() as $type){
|
foreach ($person->getType() as $type) {
|
||||||
if($type->getCode() == $personType->getCode()){
|
if ($type->getCode() == $personType->getCode()) {
|
||||||
$res[] = $person;
|
$res[] = $person;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,7 +898,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -903,7 +908,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -937,7 +942,7 @@ 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']
|
'money' => $acc['money']
|
||||||
],
|
],
|
||||||
['id' => 'DESC']
|
['id' => 'DESC']
|
||||||
);
|
);
|
||||||
|
@ -981,7 +986,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -991,7 +996,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -1015,7 +1020,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -1025,7 +1030,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
@ -1059,7 +1064,7 @@ 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']
|
'money' => $acc['money']
|
||||||
],
|
],
|
||||||
['id' => 'DESC']
|
['id' => 'DESC']
|
||||||
);
|
);
|
||||||
|
@ -1103,7 +1108,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -1113,7 +1118,7 @@ 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']
|
'money' => $acc['money']
|
||||||
]);
|
]);
|
||||||
if ($prs)
|
if ($prs)
|
||||||
$items[] = $prs;
|
$items[] = $prs;
|
||||||
|
|
Loading…
Reference in a new issue