bug fix in create business

This commit is contained in:
Hesabix 2024-11-11 15:41:27 +00:00
parent 5343345f15
commit 5dd4818f63
4 changed files with 52 additions and 44 deletions

View file

@ -70,7 +70,7 @@ class BusinessController extends AbstractController
return $this->json($extractor->operationSuccess());
}
#[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]);
@ -197,11 +197,15 @@ class BusinessController extends AbstractController
if ($params['profitCalcType'] == 'lis' || $params['profitCalcType'] == 'avgis') {
$business->setProfitCalcType($params['profitCalcType']);
}
}
else{
} else {
$business->setProfitCalcType('lis');
}
if (array_key_exists('commodityUpdateSellPriceAuto', $params)) {
$business->setCommodityUpdateSellPriceAuto($params['commodityUpdateSellPriceAuto']);
}
else{
$business->setCommodityUpdateSellPriceAuto(true);
}
if (array_key_exists('walletEnabled', $params)) {
if ($params['walletEnabled']) {
if (array_key_exists('walletMatchBank', $params)) {
@ -622,10 +626,10 @@ class BusinessController extends AbstractController
}
#[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');
if(!$acc)
if (!$acc)
throw $this->createAccessDeniedException();
$dateNow = $jdate->jdate('Y/m/d', time());
@ -650,7 +654,7 @@ class BusinessController extends AbstractController
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
'bid' => $buss,
'year' => $year,
'money'=> $acc['money']
'money' => $acc['money']
]);
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
@ -664,7 +668,7 @@ class BusinessController extends AbstractController
'bid' => $buss,
'year' => $year,
'type' => 'buy',
'money'=> $acc['money']
'money' => $acc['money']
]);
$buysTotal = 0;
@ -687,7 +691,7 @@ class BusinessController extends AbstractController
'bid' => $buss,
'year' => $year,
'type' => 'sell',
'money'=> $acc['money']
'money' => $acc['money']
]);
$sellsTotal = 0;
$sellsToday = 0;
@ -709,7 +713,7 @@ class BusinessController extends AbstractController
'bid' => $buss,
'year' => $year,
'type' => 'person_send',
'money'=> $acc['money']
'money' => $acc['money']
]);
$sendsTotal = 0;
$sendsToday = 0;
@ -731,7 +735,7 @@ class BusinessController extends AbstractController
'bid' => $buss,
'year' => $year,
'type' => 'person_receive',
'money'=> $acc['money']
'money' => $acc['money']
]);
$recsTotal = 0;
$recsToday = 0;

View file

@ -34,17 +34,17 @@ class UiGeneralController extends AbstractController
$lastBusiness = $entityManager->getRepository(Business::class)->findLast();
if($lastBusiness)
return $this->render('general/home.html.twig',[
'business' => $busCount + 11405,
'users' => $users + 29471,
'docs' => $docs + 105412,
'business' => $busCount,
'users' => $users,
'docs' => $docs,
'lastBusinessName' => $lastBusiness->getname(),
'lastBusinessOwner' => $lastBusiness->getOwner()->getFullName(),
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
]);
return $this->render('general/home.html.twig',[
'business' => $busCount + 11405,
'users' => $users + 29471,
'docs' => $docs + 105412,
'business' => $busCount,
'users' => $users,
'docs' => $docs,
'lastBusinessName' => 'ثبت نشده',
'lastBusinessOwner' => 'ثبت نشده',
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)

View file

@ -382,7 +382,6 @@ class HesabdariController extends AbstractController
'id' => $row['chequeOwner']
]);
$cheque = new Cheque();
echo $hesabdariRow->getRef();
$cheque->setBid($acc['bid']);
$cheque->setSubmitter($this->getUser());
$cheque->setPayDate($row['chequeDate']);
@ -392,7 +391,7 @@ class HesabdariController extends AbstractController
$cheque->setSayadNum($row['chequeSayadNum']);
$cheque->setDateSubmit(time());
$cheque->setDes($row['des']);
$dateArray = explode('-', $row['chequeDate']);
$dateArray = explode('/', $row['chequeDate']);
$dateGre = strtotime($jdate->jalali_to_gregorian($dateArray['0'], $dateArray['1'], $dateArray['2'], '/'));
$cheque->setDateStamp($dateGre);
$cheque->setPerson($person);

View file

@ -76,9 +76,11 @@ class PersonsController extends AbstractController
$bs = 0;
$bd = 0;
foreach ($rows as $row) {
if ($row->getDoc()->getMoney() == $acc['money']) {
$bs += $row->getBs();
$bd += $row->getBd();
}
}
$response['bs'] = $bs;
$response['bd'] = $bd;
$response['balance'] = $bs - $bd;
@ -379,14 +381,17 @@ class PersonsController extends AbstractController
'mobile' => $person->getMobile()
];
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
'person' => $person
'person' => $person,
]);
$bs = 0;
$bd = 0;
foreach ($rows as $row) {
//check for that calulate is in match money type
if ($row->getDoc()->getMoney() == $acc['money']) {
$bs += $row->getBs();
$bd += $row->getBd();
}
}
$temp['bs'] = $bs;
$temp['bd'] = $bd;
$temp['balance'] = $bs - $bd;
@ -625,8 +630,8 @@ class PersonsController extends AbstractController
]);
$res = [];
foreach ($persons as $key => $person) {
foreach($person->getType() as $type){
if($type->getCode() == $personType->getCode()){
foreach ($person->getType() as $type) {
if ($type->getCode() == $personType->getCode()) {
$res[] = $person;
}
}
@ -893,7 +898,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_receive',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
} else {
$items = [];
@ -903,7 +908,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_receive',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
if ($prs)
$items[] = $prs;
@ -937,7 +942,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_receive',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
],
['id' => 'DESC']
);
@ -981,7 +986,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_receive',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
} else {
$items = [];
@ -991,7 +996,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_receive',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
if ($prs)
$items[] = $prs;
@ -1015,7 +1020,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_send',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
} else {
$items = [];
@ -1025,7 +1030,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_send',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
if ($prs)
$items[] = $prs;
@ -1059,7 +1064,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_send',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
],
['id' => 'DESC']
);
@ -1103,7 +1108,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_send',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
} else {
$items = [];
@ -1113,7 +1118,7 @@ class PersonsController extends AbstractController
'bid' => $acc['bid'],
'type' => 'person_send',
'year' => $acc['year'],
'money'=> $acc['money']
'money' => $acc['money']
]);
if ($prs)
$items[] = $prs;