bug fix in business calendar info
This commit is contained in:
parent
3c50c28d27
commit
fbd1a904f2
|
@ -236,8 +236,12 @@ class BusinessController extends AbstractController
|
||||||
$year->setBid($business);
|
$year->setBid($business);
|
||||||
$year->setHead(true);
|
$year->setHead(true);
|
||||||
$startYearArray = explode('-', $params['year']['start']);
|
$startYearArray = explode('-', $params['year']['start']);
|
||||||
|
if(count($startYearArray) == 1) $startYearArray = explode('/', $params['year']['start']);
|
||||||
|
|
||||||
$year->setStart($jdate->jmktime(0, 0, 0, $startYearArray[1], $startYearArray[2], $startYearArray[0]));
|
$year->setStart($jdate->jmktime(0, 0, 0, $startYearArray[1], $startYearArray[2], $startYearArray[0]));
|
||||||
$endYearArray = explode('-', $params['year']['end']);
|
$endYearArray = explode('-', $params['year']['end']);
|
||||||
|
if(count($endYearArray) == 1) $startYearArray = explode('/', $params['year']['end']);
|
||||||
|
|
||||||
$year->setEnd($jdate->jmktime(0, 0, 0, $endYearArray[1], $endYearArray[2], $endYearArray[0]));
|
$year->setEnd($jdate->jmktime(0, 0, 0, $endYearArray[1], $endYearArray[2], $endYearArray[0]));
|
||||||
$year->setLabel($params['year']['label']);
|
$year->setLabel($params['year']['label']);
|
||||||
$entityManager->persist($year);
|
$entityManager->persist($year);
|
||||||
|
@ -248,9 +252,13 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $business,
|
'bid' => $business,
|
||||||
'head' => true
|
'head' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$startYearArray = explode('-', $params['year']['startShamsi']);
|
$startYearArray = explode('-', $params['year']['startShamsi']);
|
||||||
|
if(count($startYearArray) == 1) $startYearArray = explode('/', $params['year']['startShamsi']);
|
||||||
|
|
||||||
$year->setStart($jdate->jmktime(0, 0, 0, $startYearArray[1], $startYearArray[2], $startYearArray[0]));
|
$year->setStart($jdate->jmktime(0, 0, 0, $startYearArray[1], $startYearArray[2], $startYearArray[0]));
|
||||||
$endYearArray = explode('-', $params['year']['endShamsi']);
|
$endYearArray = explode('-', $params['year']['endShamsi']);
|
||||||
|
if(count($endYearArray) == 1) $endYearArray = explode('/', $params['year']['endShamsi']);
|
||||||
$year->setEnd($jdate->jmktime(0, 0, 0, $endYearArray[1], $endYearArray[2], $endYearArray[0]));
|
$year->setEnd($jdate->jmktime(0, 0, 0, $endYearArray[1], $endYearArray[2], $endYearArray[0]));
|
||||||
$year->setLabel($params['year']['label']);
|
$year->setLabel($params['year']['label']);
|
||||||
$entityManager->persist($year);
|
$entityManager->persist($year);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\PriceListDetail;
|
||||||
use App\Service\Explore;
|
use App\Service\Explore;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Service\Jdate;
|
use App\Service\Jdate;
|
||||||
|
@ -14,6 +15,7 @@ use App\Entity\CommodityCat;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
use App\Entity\CommodityDrop;
|
use App\Entity\CommodityDrop;
|
||||||
use App\Entity\CommodityUnit;
|
use App\Entity\CommodityUnit;
|
||||||
|
use App\Entity\PriceList;
|
||||||
use App\Entity\StoreroomItem;
|
use App\Entity\StoreroomItem;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
@ -240,8 +242,7 @@ class CommodityController extends AbstractController
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $code
|
'code' => $code
|
||||||
]);
|
]);
|
||||||
$data->setUnit($data->getUnit()->getName());
|
$res = Explore::ExploreCommodity($data);
|
||||||
$res = $provider->Entity2ArrayJustIncludes($data, ['isSpeedAccess', 'isCommodityCountCheck', 'getName', 'getUnit', 'getPriceBuy', 'getPriceSell', 'getCat', 'getOrderPoint', 'getdes', 'getId', 'getDayLoading', 'isKhadamat', 'getCode', 'getMinOrderCount', 'getLabel', 'isWithoutTax','getBarcodes'], 1);
|
|
||||||
$res['cat'] = '';
|
$res['cat'] = '';
|
||||||
if ($data->getCat())
|
if ($data->getCat())
|
||||||
$res['cat'] = $data->getCat()->getId();
|
$res['cat'] = $data->getCat()->getId();
|
||||||
|
@ -337,6 +338,28 @@ class CommodityController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$entityManager->persist($data);
|
$entityManager->persist($data);
|
||||||
|
if (array_key_exists('prices', $params)) {
|
||||||
|
foreach ($params['prices'] as $item) {
|
||||||
|
$priceList = $entityManager->getRepository(PriceList::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'id' => $item['list']['id']
|
||||||
|
]);
|
||||||
|
if ($priceList) {
|
||||||
|
$detail = $entityManager->getRepository(PriceListDetail::class)->findOneBy([
|
||||||
|
'list' => $priceList,
|
||||||
|
]);
|
||||||
|
if (!$detail) {
|
||||||
|
$detail = new PriceListDetail;
|
||||||
|
}
|
||||||
|
$detail->setList($priceList);
|
||||||
|
$detail->setCommodity($data);
|
||||||
|
$detail->setPriceSell($item['priceSell']);
|
||||||
|
$detail->setPriceBuy(0);
|
||||||
|
$detail->setMoney($acc['bid']->getMoney());
|
||||||
|
$entityManager->persist($detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('کالا و خدمات', 'کالا / خدمات با نام ' . $params['name'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid'));
|
$log->insert('کالا و خدمات', 'کالا / خدمات با نام ' . $params['name'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
return $this->json(['result' => 1]);
|
return $this->json(['result' => 1]);
|
||||||
|
@ -699,4 +722,88 @@ class CommodityController extends AbstractController
|
||||||
$log->insert('کالا/خدمات', ' کالا / خدمات با نام ' . $comName . ' حذف شد. ', $this->getUser(), $acc['bid']->getId());
|
$log->insert('کالا/خدمات', ' کالا / خدمات با نام ' . $comName . ' حذف شد. ', $this->getUser(), $acc['bid']->getId());
|
||||||
return $this->json(['result' => 1]);
|
return $this->json(['result' => 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/commodity/pricelist/list', name: 'app_commodity_pricelist_list')]
|
||||||
|
public function app_commodity_pricelist_list(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('commodity');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$items = $entityManager->getRepository(PriceList::class)->findBy([
|
||||||
|
'bid' => $acc['bid']
|
||||||
|
]);
|
||||||
|
return $this->json(Explore::ExploreCommodityPriceList($items));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/commodity/pricelist/mod/{code}', name: 'app_commodity_pricelist_mod')]
|
||||||
|
public function app_commodity_pricelist_mod(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('commodity');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if (!array_key_exists('label', $params))
|
||||||
|
return $this->json(['result' => -1]);
|
||||||
|
if (count_chars(trim($params['label'])) == 0)
|
||||||
|
return $this->json(['result' => 3]);
|
||||||
|
if ($code == 0) {
|
||||||
|
$data = $entityManager->getRepository(PriceList::class)->findOneBy([
|
||||||
|
'label' => $params['label'],
|
||||||
|
'bid' => $acc['bid']
|
||||||
|
]);
|
||||||
|
//check exist before
|
||||||
|
if ($data)
|
||||||
|
return $this->json(['result' => 2]);
|
||||||
|
$data = new PriceList();
|
||||||
|
} else {
|
||||||
|
$data = $entityManager->getRepository(PriceList::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'id' => $code
|
||||||
|
]);
|
||||||
|
if (!$data)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
}
|
||||||
|
$data->setLabel($params['label']);
|
||||||
|
$data->setBid($acc['bid']);
|
||||||
|
$entityManager->persist($data);
|
||||||
|
$entityManager->flush();
|
||||||
|
$log->insert('کالا و خدمات', 'فهرست قیمت کالا / خدمات با نام ' . $params['label'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
|
return $this->json(['result' => 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
#[Route('/api/commodity/pricelist/info/{code}', name: 'app_commodity_pricelist_info')]
|
||||||
|
public function app_commodity_pricelist_info($code, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('commodity');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$data = $entityManager->getRepository(PriceList::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'id' => $code
|
||||||
|
]);
|
||||||
|
return $this->json($provider->Entity2Array($data, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/commodity/pricelist/delete/{code}', name: 'app_commodity_pricelist_delete')]
|
||||||
|
public function app_commodity_pricelist_delete(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $code = 0): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('commodity');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
$item = $entityManager->getRepository(PriceList::class)->findOneBy(['bid' => $acc['bid'], 'id' => $code]);
|
||||||
|
if (!$item)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
|
||||||
|
$comName = $item->getLabel();
|
||||||
|
$entityManager->remove($item);
|
||||||
|
$log->insert('کالا/خدمات', 'فهرست قیمت کالا و خدمات با نام ' . $comName . ' حذف شد. ', $this->getUser(), $acc['bid']->getId());
|
||||||
|
return $this->json(['result' => 1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/card/list/print', name: 'app_persons_card_list_print')]
|
#[Route('/api/person/card/list/print', name: 'app_persons_card_list_print')]
|
||||||
public function app_persons_card_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_persons_card_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_receive');
|
$acc = $access->hasRole('person');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -693,7 +693,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/receive/list/print', name: 'app_persons_receive_list_print')]
|
#[Route('/api/person/receive/list/print', name: 'app_persons_receive_list_print')]
|
||||||
public function app_persons_receive_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_persons_receive_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_receive');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -734,7 +734,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/receive/list/search', name: 'app_persons_receive_list_search')]
|
#[Route('/api/person/receive/list/search', name: 'app_persons_receive_list_search')]
|
||||||
public function app_persons_receive_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_persons_receive_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_receive');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -778,7 +778,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/receive/list/excel', name: 'app_persons_receive_list_excel')]
|
#[Route('/api/person/receive/list/excel', name: 'app_persons_receive_list_excel')]
|
||||||
public function app_persons_receive_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse | JsonResponse | StreamedResponse
|
public function app_persons_receive_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse | JsonResponse | StreamedResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_receive');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -810,7 +810,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/send/list/print', name: 'app_persons_send_list_print')]
|
#[Route('/api/person/send/list/print', name: 'app_persons_send_list_print')]
|
||||||
public function app_persons_send_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_persons_send_list_print(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_send');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -851,7 +851,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/send/list/search', name: 'app_persons_send_list_search')]
|
#[Route('/api/person/send/list/search', name: 'app_persons_send_list_search')]
|
||||||
public function app_persons_send_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_persons_send_list_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_send');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -895,7 +895,7 @@ class PersonsController extends AbstractController
|
||||||
#[Route('/api/person/send/list/excel', name: 'app_persons_send_list_excel')]
|
#[Route('/api/person/send/list/excel', name: 'app_persons_send_list_excel')]
|
||||||
public function app_persons_send_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse | JsonResponse | StreamedResponse
|
public function app_persons_send_list_excel(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): BinaryFileResponse | JsonResponse | StreamedResponse
|
||||||
{
|
{
|
||||||
$acc = $access->hasRole('person_send');
|
$acc = $access->hasRole('getpay');
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
$params = [];
|
$params = [];
|
||||||
|
|
|
@ -228,6 +228,9 @@ class Business
|
||||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Note::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Note::class, orphanRemoval: true)]
|
||||||
private Collection $notes;
|
private Collection $notes;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: PriceList::class, orphanRemoval: true)]
|
||||||
|
private Collection $priceLists;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -260,6 +263,7 @@ class Business
|
||||||
$this->printers = new ArrayCollection();
|
$this->printers = new ArrayCollection();
|
||||||
$this->printTemplates = new ArrayCollection();
|
$this->printTemplates = new ArrayCollection();
|
||||||
$this->notes = new ArrayCollection();
|
$this->notes = new ArrayCollection();
|
||||||
|
$this->priceLists = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1622,4 +1626,34 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PriceList>
|
||||||
|
*/
|
||||||
|
public function getPriceLists(): Collection
|
||||||
|
{
|
||||||
|
return $this->priceLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPriceList(PriceList $priceList): static
|
||||||
|
{
|
||||||
|
if (!$this->priceLists->contains($priceList)) {
|
||||||
|
$this->priceLists->add($priceList);
|
||||||
|
$priceList->setBid($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePriceList(PriceList $priceList): static
|
||||||
|
{
|
||||||
|
if ($this->priceLists->removeElement($priceList)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($priceList->getBid() === $this) {
|
||||||
|
$priceList->setBid(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,9 @@ class Commodity
|
||||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||||
private ?string $barcodes = null;
|
private ?string $barcodes = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'commodity', targetEntity: PriceListDetail::class, orphanRemoval: true)]
|
||||||
|
private Collection $priceListDetails;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->setPriceBuy(0);
|
$this->setPriceBuy(0);
|
||||||
|
@ -91,6 +94,7 @@ class Commodity
|
||||||
$this->commodityDropLinks = new ArrayCollection();
|
$this->commodityDropLinks = new ArrayCollection();
|
||||||
$this->storeroomItems = new ArrayCollection();
|
$this->storeroomItems = new ArrayCollection();
|
||||||
$this->plugRepserviceOrders = new ArrayCollection();
|
$this->plugRepserviceOrders = new ArrayCollection();
|
||||||
|
$this->priceListDetails = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -409,4 +413,34 @@ class Commodity
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PriceListDetail>
|
||||||
|
*/
|
||||||
|
public function getPriceListDetails(): Collection
|
||||||
|
{
|
||||||
|
return $this->priceListDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if (!$this->priceListDetails->contains($priceListDetail)) {
|
||||||
|
$this->priceListDetails->add($priceListDetail);
|
||||||
|
$priceListDetail->setCommodity($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if ($this->priceListDetails->removeElement($priceListDetail)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($priceListDetail->getCommodity() === $this) {
|
||||||
|
$priceListDetail->setCommodity(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,13 @@ class Money
|
||||||
#[ORM\OneToMany(mappedBy: 'money', targetEntity: Business::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'money', targetEntity: Business::class, orphanRemoval: true)]
|
||||||
private Collection $businesses;
|
private Collection $businesses;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'money', targetEntity: PriceListDetail::class, orphanRemoval: true)]
|
||||||
|
private Collection $priceListDetails;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->businesses = new ArrayCollection();
|
$this->businesses = new ArrayCollection();
|
||||||
|
$this->priceListDetails = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -87,4 +91,34 @@ class Money
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PriceListDetail>
|
||||||
|
*/
|
||||||
|
public function getPriceListDetails(): Collection
|
||||||
|
{
|
||||||
|
return $this->priceListDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if (!$this->priceListDetails->contains($priceListDetail)) {
|
||||||
|
$this->priceListDetails->add($priceListDetail);
|
||||||
|
$priceListDetail->setMoney($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if ($this->priceListDetails->removeElement($priceListDetail)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($priceListDetail->getMoney() === $this) {
|
||||||
|
$priceListDetail->setMoney(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
91
hesabixCore/src/Entity/PriceList.php
Normal file
91
hesabixCore/src/Entity/PriceList.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\PriceListRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: PriceListRepository::class)]
|
||||||
|
class PriceList
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'priceLists')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?business $bid = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $label = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'list', targetEntity: PriceListDetail::class, orphanRemoval: true)]
|
||||||
|
private Collection $priceListDetails;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->priceListDetails = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBid(): ?business
|
||||||
|
{
|
||||||
|
return $this->bid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBid(?business $bid): static
|
||||||
|
{
|
||||||
|
$this->bid = $bid;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLabel(string $label): static
|
||||||
|
{
|
||||||
|
$this->label = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PriceListDetail>
|
||||||
|
*/
|
||||||
|
public function getPriceListDetails(): Collection
|
||||||
|
{
|
||||||
|
return $this->priceListDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if (!$this->priceListDetails->contains($priceListDetail)) {
|
||||||
|
$this->priceListDetails->add($priceListDetail);
|
||||||
|
$priceListDetail->setList($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePriceListDetail(PriceListDetail $priceListDetail): static
|
||||||
|
{
|
||||||
|
if ($this->priceListDetails->removeElement($priceListDetail)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($priceListDetail->getList() === $this) {
|
||||||
|
$priceListDetail->setList(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
98
hesabixCore/src/Entity/PriceListDetail.php
Normal file
98
hesabixCore/src/Entity/PriceListDetail.php
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\PriceListDetailRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: PriceListDetailRepository::class)]
|
||||||
|
class PriceListDetail
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'priceListDetails')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?PriceList $list = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'priceListDetails')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Commodity $commodity = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'priceListDetails')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Money $money = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $priceBuy = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $priceSell = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getList(): ?PriceList
|
||||||
|
{
|
||||||
|
return $this->list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setList(?PriceList $list): static
|
||||||
|
{
|
||||||
|
$this->list = $list;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommodity(): ?Commodity
|
||||||
|
{
|
||||||
|
return $this->commodity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCommodity(?Commodity $commodity): static
|
||||||
|
{
|
||||||
|
$this->commodity = $commodity;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMoney(): ?Money
|
||||||
|
{
|
||||||
|
return $this->money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMoney(?Money $money): static
|
||||||
|
{
|
||||||
|
$this->money = $money;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriceBuy(): ?string
|
||||||
|
{
|
||||||
|
return $this->priceBuy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPriceBuy(?string $priceBuy): static
|
||||||
|
{
|
||||||
|
$this->priceBuy = $priceBuy;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriceSell(): ?string
|
||||||
|
{
|
||||||
|
return $this->priceSell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPriceSell(?string $priceSell): static
|
||||||
|
{
|
||||||
|
$this->priceSell = $priceSell;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
48
hesabixCore/src/Repository/PriceListDetailRepository.php
Normal file
48
hesabixCore/src/Repository/PriceListDetailRepository.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\PriceListDetail;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<PriceListDetail>
|
||||||
|
*
|
||||||
|
* @method PriceListDetail|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method PriceListDetail|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method PriceListDetail[] findAll()
|
||||||
|
* @method PriceListDetail[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class PriceListDetailRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, PriceListDetail::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return PriceListDetail[] Returns an array of PriceListDetail objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('p.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?PriceListDetail
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
48
hesabixCore/src/Repository/PriceListRepository.php
Normal file
48
hesabixCore/src/Repository/PriceListRepository.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\PriceList;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<PriceList>
|
||||||
|
*
|
||||||
|
* @method PriceList|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method PriceList|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method PriceList[] findAll()
|
||||||
|
* @method PriceList[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class PriceListRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, PriceList::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return PriceList[] Returns an array of PriceList objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('p.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?PriceList
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
|
@ -15,10 +15,25 @@ use App\Entity\HesabdariTable;
|
||||||
use App\Entity\Money;
|
use App\Entity\Money;
|
||||||
use App\Entity\Person;
|
use App\Entity\Person;
|
||||||
use App\Entity\PersonType;
|
use App\Entity\PersonType;
|
||||||
|
use App\Entity\PriceListDetail;
|
||||||
use App\Entity\Salary;
|
use App\Entity\Salary;
|
||||||
|
|
||||||
class Explore
|
class Explore
|
||||||
{
|
{
|
||||||
|
public static function ExploreCommodityPriceList($items)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
foreach ($items as $item)
|
||||||
|
$result[] = self::ExploreCommodityPriceListOne($item);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
public static function ExploreCommodityPriceListOne($item)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $item->getId(),
|
||||||
|
'label' => $item->getLabel()
|
||||||
|
];
|
||||||
|
}
|
||||||
public static function ExplorePersonType(PersonType $type)
|
public static function ExplorePersonType(PersonType $type)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -162,29 +177,53 @@ class Explore
|
||||||
|
|
||||||
public static function ExploreCommodity(Commodity | null $item, int | null $count = 0, string | null $des = '')
|
public static function ExploreCommodity(Commodity | null $item, int | null $count = 0, string | null $des = '')
|
||||||
{
|
{
|
||||||
if ($item)
|
if ($item){
|
||||||
return [
|
$result = [
|
||||||
'id' => $item->getId(),
|
'id' => $item->getId(),
|
||||||
'code' => $item->getCode(),
|
'code' => $item->getCode(),
|
||||||
'name' => $item->getName(),
|
'name' => $item->getName(),
|
||||||
'des' => $item->getDes(),
|
'des' => $item->getDes(),
|
||||||
'price_buy' => $item->getPriceBuy(),
|
'priceBuy' => $item->getPriceBuy(),
|
||||||
'price_sell' => $item->getPriceSell(),
|
'priceSell' => $item->getPriceSell(),
|
||||||
'khadamat' => $item->isKhadamat(),
|
'khadamat' => $item->isKhadamat(),
|
||||||
'speed_access' => $item->isSpeedAccess(),
|
|
||||||
//most be completed
|
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'unit' => $item->getUnit()->getName(),
|
'unit' => $item->getUnit()->getName(),
|
||||||
'des' => $des,
|
'withoutTax' => $item->isWithoutTax(),
|
||||||
'withoutTax' => $item->isWithoutTax(),
|
'barcodes' => $item->getBarcodes(),
|
||||||
|
'commodityCountCheck' => $item->isCommodityCountCheck(),
|
||||||
|
'speedAccess' => $item->isSpeedAccess(),
|
||||||
|
'orderPoint' =>$item->getOrderPoint(),
|
||||||
|
'dayLoading' =>$item->getDayLoading(),
|
||||||
|
'minOrderCount' =>$item->getMinOrderCount(),
|
||||||
'unitData' => [
|
'unitData' => [
|
||||||
'name' => $item->getUnit()->getName(),
|
'name' => $item->getUnit()->getName(),
|
||||||
'floatNumber' => $item->getUnit()->getFloatNumber(),
|
'floatNumber' => $item->getUnit()->getFloatNumber(),
|
||||||
]
|
],
|
||||||
|
'prices'=>self::ExploreCommodityPriceListDetails($item->getPriceListDetails())
|
||||||
];
|
];
|
||||||
|
if($des){ $result['des'] = $des;}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ExploreCommodityPriceListDetail(PriceListDetail | null $item)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $item->getId(),
|
||||||
|
'list' => self::ExploreCommodityPriceListOne($item->getList()),
|
||||||
|
'priceBuy' => $item->getPriceBuy(),
|
||||||
|
'priceSell' => $item->getPriceSell(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
public static function ExploreCommodityPriceListDetails($items)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
foreach ($items as $item)
|
||||||
|
$result[] = self::ExploreCommodityPriceListDetail($item);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
public static function ExploreBank(BankAccount | null $item)
|
public static function ExploreBank(BankAccount | null $item)
|
||||||
{
|
{
|
||||||
if ($item)
|
if ($item)
|
||||||
|
@ -192,7 +231,6 @@ class Explore
|
||||||
'id' => $item->getId(),
|
'id' => $item->getId(),
|
||||||
'code' => $item->getCode(),
|
'code' => $item->getCode(),
|
||||||
'name' => $item->getName(),
|
'name' => $item->getName(),
|
||||||
//most be completed
|
|
||||||
];
|
];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue