some progress
This commit is contained in:
parent
01f5c8a9f2
commit
2276754e39
|
@ -62,7 +62,9 @@ class CommodityController extends AbstractController
|
||||||
$temp['khadamat'] = false;
|
$temp['khadamat'] = false;
|
||||||
if ($item->isKhadamat())
|
if ($item->isKhadamat())
|
||||||
$temp['khadamat'] = true;
|
$temp['khadamat'] = true;
|
||||||
|
$temp['withoutTax'] = false;
|
||||||
|
if ($item->isWithoutTax())
|
||||||
|
$temp['withoutTax'] = true;
|
||||||
$temp['commodityCountCheck'] = $item->isCommodityCountCheck();
|
$temp['commodityCountCheck'] = $item->isCommodityCountCheck();
|
||||||
$temp['minOrderCount'] = $item->getMinOrderCount();
|
$temp['minOrderCount'] = $item->getMinOrderCount();
|
||||||
$temp['dayLoading'] = $item->getDayLoading();
|
$temp['dayLoading'] = $item->getDayLoading();
|
||||||
|
@ -232,7 +234,7 @@ class CommodityController extends AbstractController
|
||||||
'code' => $code
|
'code' => $code
|
||||||
]);
|
]);
|
||||||
$data->setUnit($data->getUnit()->getName());
|
$data->setUnit($data->getUnit()->getName());
|
||||||
$res = $provider->Entity2ArrayJustIncludes($data, ['isSpeedAccess', 'isCommodityCountCheck', 'getName', 'getUnit', 'getPriceBuy', 'getPriceSell', 'getCat', 'getOrderPoint', 'getdes', 'getId', 'getDayLoading', 'isKhadamat', 'getCode', 'getMinOrderCount', 'getLabel'], 1);
|
$res = $provider->Entity2ArrayJustIncludes($data, ['isSpeedAccess', 'isCommodityCountCheck', 'getName', 'getUnit', 'getPriceBuy', 'getPriceSell', 'getCat', 'getOrderPoint', 'getdes', 'getId', 'getDayLoading', 'isKhadamat', 'getCode', 'getMinOrderCount', 'getLabel', 'isWithoutTax'], 1);
|
||||||
$res['cat'] = '';
|
$res['cat'] = '';
|
||||||
if ($data->getCat())
|
if ($data->getCat())
|
||||||
$res['cat'] = $data->getCat()->getId();
|
$res['cat'] = $data->getCat()->getId();
|
||||||
|
@ -297,6 +299,8 @@ class CommodityController extends AbstractController
|
||||||
$data->setname($params['name']);
|
$data->setname($params['name']);
|
||||||
if ($params['khadamat'] == 'true') $data->setKhadamat(true);
|
if ($params['khadamat'] == 'true') $data->setKhadamat(true);
|
||||||
else $data->setKhadamat(false);
|
else $data->setKhadamat(false);
|
||||||
|
if ($params['withoutTax'] == 'true') $data->setWithoutTax(true);
|
||||||
|
else $data->setWithoutTax(false);
|
||||||
$data->setDes($params['des']);
|
$data->setDes($params['des']);
|
||||||
$data->setPriceSell($params['priceSell']);
|
$data->setPriceSell($params['priceSell']);
|
||||||
$data->setPriceBuy($params['priceBuy']);
|
$data->setPriceBuy($params['priceBuy']);
|
||||||
|
|
|
@ -11,6 +11,7 @@ use App\Service\Extractor;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
use App\Entity\HesabdariTable;
|
use App\Entity\HesabdariTable;
|
||||||
|
use App\Entity\InvoiceType;
|
||||||
use App\Entity\Person;
|
use App\Entity\Person;
|
||||||
use App\Entity\StoreroomTicket;
|
use App\Entity\StoreroomTicket;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -84,7 +85,7 @@ class SellController extends AbstractController
|
||||||
'year' => $acc['year'],
|
'year' => $acc['year'],
|
||||||
'code' => $params['update']
|
'code' => $params['update']
|
||||||
]);
|
]);
|
||||||
if (!$doc) $this->json($extractor->notFound());
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
|
|
||||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
'doc' => $doc
|
'doc' => $doc
|
||||||
|
@ -168,4 +169,110 @@ class SellController extends AbstractController
|
||||||
);
|
);
|
||||||
return $this->json($extractor->operationSuccess());
|
return $this->json($extractor->operationSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/sell/label/change', name: 'app_sell_label_change')]
|
||||||
|
public function app_sell_label_change(Request $request, Access $access, Extractor $extractor, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$acc = $access->hasRole('sell');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
if ($params['label'] != 'clear') {
|
||||||
|
$label = $entityManager->getRepository(InvoiceType::class)->findOneBy([
|
||||||
|
'code' => $params['label']['code'],
|
||||||
|
'type' => 'sell'
|
||||||
|
]);
|
||||||
|
if (!$label) return $this->json($extractor->notFound());
|
||||||
|
}
|
||||||
|
foreach ($params['items'] as $item) {
|
||||||
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'year' => $acc['year'],
|
||||||
|
'code' => $item['code']
|
||||||
|
]);
|
||||||
|
if (!$doc) return $this->json($extractor->notFound());
|
||||||
|
if ($params['label'] != 'clear') {
|
||||||
|
$doc->setInvoiceLabel($label);
|
||||||
|
$entityManager->persist($doc);
|
||||||
|
$log->insert(
|
||||||
|
'حسابداری',
|
||||||
|
' تغییر برچسب فاکتور شماره ' . $doc->getCode() . ' به ' . $label->getLabel(),
|
||||||
|
$this->getUser(),
|
||||||
|
$acc['bid']->getId(),
|
||||||
|
$doc
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$doc->setInvoiceLabel(null);
|
||||||
|
$entityManager->persist($doc);
|
||||||
|
$log->insert(
|
||||||
|
'حسابداری',
|
||||||
|
' حذف برچسب فاکتور شماره ' . $doc->getCode(),
|
||||||
|
$this->getUser(),
|
||||||
|
$acc['bid']->getId(),
|
||||||
|
$doc
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
|
return $this->json($extractor->operationSuccess());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/sell/docs/search', name: 'app_sell_docs_search')]
|
||||||
|
public function app_sell_docs_search(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('sell');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'year' => $acc['year'],
|
||||||
|
'type' => 'sell'
|
||||||
|
], [
|
||||||
|
'id' => 'DESC'
|
||||||
|
]);
|
||||||
|
$dataTemp = [];
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$temp = [
|
||||||
|
'id' => $item->getId(),
|
||||||
|
'dateSubmit' => $item->getDateSubmit(),
|
||||||
|
'date' => $item->getDate(),
|
||||||
|
'type' => $item->getType(),
|
||||||
|
'code' => $item->getCode(),
|
||||||
|
'des' => $item->getDes(),
|
||||||
|
'amount' => $item->getAmount(),
|
||||||
|
'submitter' => $item->getSubmitter()->getFullName(),
|
||||||
|
];
|
||||||
|
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item, 'person');
|
||||||
|
$temp['person'] = '';
|
||||||
|
if ($mainRow)
|
||||||
|
$temp['person'] = Explore::ExplorePerson($mainRow->getPerson());
|
||||||
|
|
||||||
|
$temp['label'] = null;
|
||||||
|
if ($item->getInvoiceLabel()) {
|
||||||
|
$temp['label'] = [
|
||||||
|
'code' => $item->getInvoiceLabel()->getCode(),
|
||||||
|
'label' => $item->getInvoiceLabel()->getLabel()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp['relatedDocsCount'] = count($item->getRelatedDocs());
|
||||||
|
$pays = 0;
|
||||||
|
foreach ($item->getRelatedDocs() as $relatedDoc) {
|
||||||
|
$pays += $relatedDoc->getAmount();
|
||||||
|
}
|
||||||
|
$temp['relatedDocsPays'] = $pays;
|
||||||
|
$dataTemp[] = $temp;
|
||||||
|
}
|
||||||
|
return $this->json($dataTemp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,9 @@ class Commodity
|
||||||
#[ORM\OneToMany(mappedBy: 'commodity', targetEntity: PlugRepserviceOrder::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'commodity', targetEntity: PlugRepserviceOrder::class, orphanRemoval: true)]
|
||||||
private Collection $plugRepserviceOrders;
|
private Collection $plugRepserviceOrders;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $withoutTax = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->setPriceBuy(0);
|
$this->setPriceBuy(0);
|
||||||
|
@ -378,4 +381,16 @@ class Commodity
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isWithoutTax(): ?bool
|
||||||
|
{
|
||||||
|
return $this->withoutTax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setWithoutTax(?bool $withoutTax): static
|
||||||
|
{
|
||||||
|
$this->withoutTax = $withoutTax;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,8 @@ class Explore
|
||||||
//most be completed
|
//most be completed
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'unit' => $item->getUnit()->getName(),
|
'unit' => $item->getUnit()->getName(),
|
||||||
'des' => $des
|
'des' => $des,
|
||||||
|
'withoutTax' => $item->isWithoutTax()
|
||||||
];
|
];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue