bug fix in repservice plugin
This commit is contained in:
parent
d98c08c6f1
commit
eb9dcf07cf
|
@ -8,6 +8,7 @@ use App\Service\SMS;
|
||||||
use App\Entity\Person;
|
use App\Entity\Person;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
use App\Entity\Commodity;
|
use App\Entity\Commodity;
|
||||||
|
use App\Entity\Log as EntityLog;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
use App\Service\Extractor;
|
use App\Service\Extractor;
|
||||||
use App\Service\registryMGR;
|
use App\Service\registryMGR;
|
||||||
|
@ -272,6 +273,13 @@ class PlugRepserviceController extends AbstractController
|
||||||
if (!$item)
|
if (!$item)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
$code = $item->getCode();
|
$code = $item->getCode();
|
||||||
|
// remove logs
|
||||||
|
$logs = $entityManager->getRepository(EntityLog::class)->findBy(['repserviceOrder' => $item]);
|
||||||
|
foreach($logs as $lg){
|
||||||
|
$lg->setRepserviceOrder(null);
|
||||||
|
$entityManager->persist($lg);
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
$entityManager->remove($item);
|
$entityManager->remove($item);
|
||||||
$log->insert('افزونه تعمیرکاران', 'درخواست با شماره قبض' . $code . 'حذف شد.', $this->getUser(), $acc['bid']->getId());
|
$log->insert('افزونه تعمیرکاران', 'درخواست با شماره قبض' . $code . 'حذف شد.', $this->getUser(), $acc['bid']->getId());
|
||||||
return $this->json(['result' => 1]);
|
return $this->json(['result' => 1]);
|
||||||
|
|
|
@ -153,9 +153,50 @@ class StoreroomController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rfsells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'type' => 'rfsell'
|
||||||
|
]);
|
||||||
|
$rfsellsForExport = [];
|
||||||
|
foreach ($rfsells as $sell) {
|
||||||
|
$temp = $provider->Entity2Array($sell, 0);
|
||||||
|
$person = $this->getPerson($sell);
|
||||||
|
$temp['person'] = $provider->Entity2ArrayJustIncludes($person, ['getCode', 'getNikename', 'getDes']);
|
||||||
|
$temp['person']['des'] = ' # ' . $person->getCode() . ' ' . $person->getNikename();
|
||||||
|
$temp['commodities'] = $this->getCommodities($sell, $provider);
|
||||||
|
//check storeroom exist
|
||||||
|
$this->calcStoreRemaining($temp, $sell, $entityManager);
|
||||||
|
$temp['des'] = 'فاکتور برگشت از فروش شماره # ' . $sell->getCode();
|
||||||
|
if (array_key_exists('storeroomComplete', $temp))
|
||||||
|
if (!$temp['storeroomComplete']) {
|
||||||
|
$rfsellsForExport[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rfbuys = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'type' => 'rfbuy'
|
||||||
|
]);
|
||||||
|
$rfbuysForExport = [];
|
||||||
|
foreach ($rfbuys as $buy) {
|
||||||
|
$temp = $provider->Entity2Array($buy, 0);
|
||||||
|
$person = $this->getPerson($buy);
|
||||||
|
$temp['person'] = $provider->Entity2ArrayJustIncludes($person, ['getCode', 'getNikename', 'getDes']);
|
||||||
|
$temp['person']['des'] = ' # ' . $person->getCode() . ' ' . $person->getNikename();
|
||||||
|
$temp['commodities'] = $this->getCommodities($buy, $provider);
|
||||||
|
//check storeroom exist
|
||||||
|
$this->calcStoreRemaining($temp, $buy, $entityManager);
|
||||||
|
$temp['des'] = 'فاکتور برگشت از خرید شماره # ' . $buy->getCode();
|
||||||
|
if (array_key_exists('storeroomComplete', $temp))
|
||||||
|
if (!$temp['storeroomComplete']) {
|
||||||
|
$rfbuysForExport[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'buys' => $buysForExport,
|
'buys' => $buysForExport,
|
||||||
'sells' => $sellsForExport
|
'sells' => $sellsForExport,
|
||||||
|
'rfsells' => $rfsellsForExport,
|
||||||
|
'rfbuys' => $rfbuysForExport
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue