add notes to sell and buy invoice
This commit is contained in:
parent
d76f1fe80a
commit
55350beaa5
|
@ -219,7 +219,9 @@ class AdminController extends AbstractController
|
||||||
'get' => $registryMGR->get('sms', 'plugRepserviceStateGet'),
|
'get' => $registryMGR->get('sms', 'plugRepserviceStateGet'),
|
||||||
'getback' => $registryMGR->get('sms', 'plugRepserviceStateGetback'),
|
'getback' => $registryMGR->get('sms', 'plugRepserviceStateGetback'),
|
||||||
'repired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'),
|
'repired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'),
|
||||||
'unrepaired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired')
|
'unrepaired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired'),
|
||||||
|
'creating' => $registryMGR->get('sms', 'plugRepserviceStateCreating'),
|
||||||
|
'created' => $registryMGR->get('sms', 'plugRepserviceStateCreated')
|
||||||
];
|
];
|
||||||
return $this->json($resp);
|
return $this->json($resp);
|
||||||
}
|
}
|
||||||
|
@ -267,6 +269,10 @@ class AdminController extends AbstractController
|
||||||
$registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired']);
|
$registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired']);
|
||||||
if (array_key_exists('getback', $params['plugRepservice']))
|
if (array_key_exists('getback', $params['plugRepservice']))
|
||||||
$registryMGR->update('sms', 'plugRepserviceStateGetback', $params['plugRepservice']['getback']);
|
$registryMGR->update('sms', 'plugRepserviceStateGetback', $params['plugRepservice']['getback']);
|
||||||
|
if (array_key_exists('creating', $params['plugRepservice']))
|
||||||
|
$registryMGR->update('sms', 'plugRepserviceStateCreating', $params['plugRepservice']['creating']);
|
||||||
|
if (array_key_exists('created', $params['plugRepservice']))
|
||||||
|
$registryMGR->update('sms', 'plugRepserviceStateCreated', $params['plugRepservice']['created']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -494,4 +500,24 @@ class AdminController extends AbstractController
|
||||||
'filename' => 'Hesabix-' . $time . '.sql',
|
'filename' => 'Hesabix-' . $time . '.sql',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
#[Route('/api/admin/logs/last', name: 'api_admin_logs_last')]
|
||||||
|
public function api_admin_logs_last(Jdate $jdate, EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy([], ['id' => 'DESC'], 250);
|
||||||
|
$temps = [];
|
||||||
|
foreach ($logs as $log) {
|
||||||
|
$temp = [];
|
||||||
|
if ($log->getUser())
|
||||||
|
$temp['user'] = $log->getUser()->getFullName();
|
||||||
|
else
|
||||||
|
$temp['user'] = '';
|
||||||
|
$temp['des'] = $log->getDes();
|
||||||
|
$temp['part'] = $log->getPart();
|
||||||
|
$temp['bid'] = $log->getBid()->getName();
|
||||||
|
$temp['date'] = $jdate->jdate('Y/n/d H:i', $log->getDateSubmit());
|
||||||
|
$temp['ipaddress'] = $log->getIpaddress();
|
||||||
|
$temps[] = $temp;
|
||||||
|
}
|
||||||
|
return $this->json(array_reverse($temps));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -654,6 +654,48 @@ class BusinessController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sends = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $buss,
|
||||||
|
'year' => $year,
|
||||||
|
'type' => 'person_send',
|
||||||
|
]);
|
||||||
|
$sendsTotal = 0;
|
||||||
|
$sendsToday = 0;
|
||||||
|
foreach ($sends as $item) {
|
||||||
|
$canAdd = false;
|
||||||
|
foreach ($item->getHesabdariRows() as $row) {
|
||||||
|
if ($row->getPerson())
|
||||||
|
$canAdd = true;
|
||||||
|
}
|
||||||
|
if ($canAdd) {
|
||||||
|
$sendsTotal += $item->getAmount();
|
||||||
|
if($item->getDate() == $dateNow){
|
||||||
|
$sendsToday += $item->getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$recs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
|
'bid' => $buss,
|
||||||
|
'year' => $year,
|
||||||
|
'type' => 'person_receive',
|
||||||
|
]);
|
||||||
|
$recsTotal = 0;
|
||||||
|
$recsToday = 0;
|
||||||
|
foreach ($recs as $item) {
|
||||||
|
$canAdd = false;
|
||||||
|
foreach ($item->getHesabdariRows() as $row) {
|
||||||
|
if ($row->getPerson())
|
||||||
|
$canAdd = true;
|
||||||
|
}
|
||||||
|
if ($canAdd) {
|
||||||
|
$recsTotal += $item->getAmount();
|
||||||
|
if($item->getDate() == $dateNow){
|
||||||
|
$recsToday += $item->getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$response = [
|
$response = [
|
||||||
'personCount' => count($persons),
|
'personCount' => count($persons),
|
||||||
'bankCount' => count($banks),
|
'bankCount' => count($banks),
|
||||||
|
@ -665,7 +707,11 @@ class BusinessController extends AbstractController
|
||||||
'buys_total' => $buysTotal,
|
'buys_total' => $buysTotal,
|
||||||
'buys_today' => $buysToday,
|
'buys_today' => $buysToday,
|
||||||
'sells_total' => $sellsTotal,
|
'sells_total' => $sellsTotal,
|
||||||
'sells_today' => $sellsToday
|
'sells_today' => $sellsToday,
|
||||||
|
'sends_total' => $sendsTotal,
|
||||||
|
'sends_today' => $sendsToday,
|
||||||
|
'recs_total' => $recsTotal,
|
||||||
|
'recs_today' => $recsToday,
|
||||||
];
|
];
|
||||||
return $this->json($response);
|
return $this->json($response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,6 +523,7 @@ class HesabdariController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
$code = $doc->getCode();
|
$code = $doc->getCode();
|
||||||
|
foreach($doc->getNotes() as $note){ $entityManager->remove($note);}
|
||||||
$entityManager->remove($doc);
|
$entityManager->remove($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
|
@ -618,6 +619,7 @@ class HesabdariController extends AbstractController
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
$code = $doc->getCode();
|
$code = $doc->getCode();
|
||||||
|
foreach($doc->getNotes() as $note){ $entityManager->remove($note);}
|
||||||
$entityManager->remove($doc);
|
$entityManager->remove($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
$log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid'));
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\Log as EntityLog;
|
use App\Entity\Log as EntityLog;
|
||||||
|
use App\Entity\PlugRepserviceOrder;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
use App\Service\Jdate;
|
use App\Service\Jdate;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
|
@ -82,4 +83,33 @@ class LogController extends AbstractController
|
||||||
}
|
}
|
||||||
return $this->json($temps);
|
return $this->json($temps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/plug/repservice/order/logs/{id}', name: 'api_business_repservice_order_logs')]
|
||||||
|
public function api_business_repservice_order_logs(Access $access,String $id, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('plugRepservice');
|
||||||
|
if(!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$order = $entityManager->getRepository(PlugRepserviceOrder::class)->findOneBy(['bid'=>$acc['bid'], 'code'=>$id]);
|
||||||
|
if(!$order)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
if($order->getBid()->getId() != $acc['bid']->getId())
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
$logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy(['bid'=>$acc['bid'],'repserviceOrder'=>$order],['id'=>'DESC']);
|
||||||
|
|
||||||
|
$temps = [];
|
||||||
|
foreach ($logs as $log){
|
||||||
|
$temp = [];
|
||||||
|
if($log->getUser())
|
||||||
|
$temp['user'] = $log->getUser()->getFullName();
|
||||||
|
else
|
||||||
|
$temp['user'] = '';
|
||||||
|
$temp['des'] = $log->getDes();
|
||||||
|
$temp['part'] = $log->getPart();
|
||||||
|
$temp['date'] = $jdate->jdate('Y/n/d H:i',$log->getDateSubmit());
|
||||||
|
$temps[] = $temp;
|
||||||
|
}
|
||||||
|
return $this->json($temps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
136
hesabixCore/src/Controller/NotesController.php
Normal file
136
hesabixCore/src/Controller/NotesController.php
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\HesabdariDoc;
|
||||||
|
use App\Service\Extractor;
|
||||||
|
use App\Service\Log;
|
||||||
|
use App\Service\Jdate;
|
||||||
|
use App\Entity\Note;
|
||||||
|
use App\Service\Access;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class NotesController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/api/notes/list', name: 'api_notes_list')]
|
||||||
|
public function api_notes_list(Extractor $extractor,Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if($params['code'] != 0){
|
||||||
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'code' => $params['code'],
|
||||||
|
|
||||||
|
]);
|
||||||
|
if(!$doc) return $this->json($extractor->notFound());
|
||||||
|
}
|
||||||
|
$items = $entityManager->getRepository(Note::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'type' => $params['type'],
|
||||||
|
'doc' => $doc
|
||||||
|
]);
|
||||||
|
$result = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$result[] = [
|
||||||
|
'id'=>$item->getId(),
|
||||||
|
'des'=>$item->getDes(),
|
||||||
|
'submitter'=>$item->getSubmitter()->getFullName(),
|
||||||
|
'date' => $jdate->jdate('Y/n/d',$item->getDate())
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $this->json($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/notes/count', name: 'api_notes_count')]
|
||||||
|
public function api_notes_count(Extractor $extractor,Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if($params['code'] != 0){
|
||||||
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'code' => $params['code'],
|
||||||
|
|
||||||
|
]);
|
||||||
|
if(!$doc) return $this->json($extractor->notFound());
|
||||||
|
}
|
||||||
|
$items = $entityManager->getRepository(Note::class)->findBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'type' => $params['type'],
|
||||||
|
'doc' => $doc
|
||||||
|
]);
|
||||||
|
return $this->json(count($items));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/notes/add', name: 'api_notes_add')]
|
||||||
|
public function api_notes_add(Request $request, Access $access, Extractor $extractor, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'code' => $params['code'],
|
||||||
|
|
||||||
|
]);
|
||||||
|
if(!$doc) return $this->json($extractor->notFound());
|
||||||
|
$note = new Note();
|
||||||
|
$note->setDoc($doc);
|
||||||
|
$note->setBid($acc['bid']);
|
||||||
|
$note->setSubmitter($this->getUser());
|
||||||
|
$note->setType($params['type']);
|
||||||
|
$note->setDes($params['des']);
|
||||||
|
$note->setDate(time());
|
||||||
|
$entityManager->persist($note);
|
||||||
|
$entityManager->flush();
|
||||||
|
$log->insert(
|
||||||
|
'حسابداری',
|
||||||
|
' افزودن یاداشت به فاکتور شماره ' . $doc->getCode(),
|
||||||
|
$this->getUser(),
|
||||||
|
$acc['bid']->getId(),
|
||||||
|
$doc
|
||||||
|
);
|
||||||
|
return $this->json(['result' => 1]);
|
||||||
|
}
|
||||||
|
#[Route('/api/notes/remove/{id}', name: 'api_notes_remove')]
|
||||||
|
public function api_notes_remove(string $id, Access $access, EntityManagerInterface $entityManager, Log $log): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('join');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$item = $entityManager->getRepository(Note::class)->findOneBy([
|
||||||
|
'bid' => $acc['bid'],
|
||||||
|
'submitter' => $this->getUser(),
|
||||||
|
'id' => $id
|
||||||
|
]);
|
||||||
|
$entityManager->remove($item);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
$log->insert(
|
||||||
|
'حسابداری',
|
||||||
|
' حذف یاداشت از فاکتور شماره ' . $item->getDoc()->getCode(),
|
||||||
|
$this->getUser(),
|
||||||
|
$acc['bid']->getId(),
|
||||||
|
$item->getDoc()
|
||||||
|
);
|
||||||
|
return $this->json(['result' => 1]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -104,7 +104,7 @@ class PlugRepserviceController extends AbstractController
|
||||||
$order->setState($entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findOneBy(['code' => 'get']));
|
$order->setState($entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findOneBy(['code' => 'get']));
|
||||||
$entityManagerInterface->persist($order);
|
$entityManagerInterface->persist($order);
|
||||||
$entityManagerInterface->flush();
|
$entityManagerInterface->flush();
|
||||||
$log->insert('افزونه تعمیرکاران', ' رسید دریافت کالا با نام ' . $person->getNikename() . ' افزوده/ویرایش شد.', $this->getUser(), $acc['bid']->getId());
|
$log->insert('افزونه تعمیرکاران', ' رسید دریافت کالا با نام ' . $person->getNikename() . ' افزوده/ویرایش شد.', $this->getUser(), $acc['bid']->getId(),null,$order);
|
||||||
|
|
||||||
if (array_key_exists('sms', $params)) {
|
if (array_key_exists('sms', $params)) {
|
||||||
if ($params['sms'] == true) {
|
if ($params['sms'] == true) {
|
||||||
|
@ -174,13 +174,15 @@ class PlugRepserviceController extends AbstractController
|
||||||
}
|
}
|
||||||
$entityManagerInterface->persist($order);
|
$entityManagerInterface->persist($order);
|
||||||
$entityManagerInterface->flush();
|
$entityManagerInterface->flush();
|
||||||
$log->insert('افزونه تعمیرکاران', ' وضعیت کالا با کد ' . $order->getCode() . ' به ' . $state->getLabel() . ' تغییر یافت. ', $this->getUser(), $acc['bid']->getId());
|
$log->insert('افزونه تعمیرکاران', ' وضعیت کالا با کد ' . $order->getCode() . ' به ' . $state->getLabel() . ' تغییر یافت. ', $this->getUser(), $acc['bid']->getId(),null,$order);
|
||||||
|
|
||||||
if (array_key_exists('sms', $params)) {
|
if (array_key_exists('sms', $params)) {
|
||||||
//get state sms code
|
//get state sms code
|
||||||
if($params['state']['code'] == 'get') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGet');
|
if($params['state']['code'] == 'get') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGet');
|
||||||
elseif($params['state']['code'] == 'repaired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateRepaired');
|
elseif($params['state']['code'] == 'repaired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateRepaired');
|
||||||
elseif($params['state']['code'] == 'unrepired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateUnrepired');
|
elseif($params['state']['code'] == 'unrepired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateUnrepired');
|
||||||
|
elseif($params['state']['code'] == 'creating') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateCreating');
|
||||||
|
elseif($params['state']['code'] == 'created') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateCreated');
|
||||||
else $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGetback');
|
else $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGetback');
|
||||||
if ($params['sms'] == true) {
|
if ($params['sms'] == true) {
|
||||||
//going to send sms
|
//going to send sms
|
||||||
|
|
|
@ -225,6 +225,9 @@ class Business
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $avatar = null;
|
private ?string $avatar = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Note::class, orphanRemoval: true)]
|
||||||
|
private Collection $notes;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -256,6 +259,7 @@ class Business
|
||||||
$this->plugRepserviceOrders = new ArrayCollection();
|
$this->plugRepserviceOrders = new ArrayCollection();
|
||||||
$this->printers = new ArrayCollection();
|
$this->printers = new ArrayCollection();
|
||||||
$this->printTemplates = new ArrayCollection();
|
$this->printTemplates = new ArrayCollection();
|
||||||
|
$this->notes = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1588,4 +1592,34 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Note>
|
||||||
|
*/
|
||||||
|
public function getNotes(): Collection
|
||||||
|
{
|
||||||
|
return $this->notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addNote(Note $note): static
|
||||||
|
{
|
||||||
|
if (!$this->notes->contains($note)) {
|
||||||
|
$this->notes->add($note);
|
||||||
|
$note->setBid($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeNote(Note $note): static
|
||||||
|
{
|
||||||
|
if ($this->notes->removeElement($note)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($note->getBid() === $this) {
|
||||||
|
$note->setBid(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ class HesabdariDoc
|
||||||
#[ORM\ManyToOne(inversedBy: 'hesabdariDocs')]
|
#[ORM\ManyToOne(inversedBy: 'hesabdariDocs')]
|
||||||
private ?InvoiceType $InvoiceLabel = null;
|
private ?InvoiceType $InvoiceLabel = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'doc', targetEntity: Note::class)]
|
||||||
|
private Collection $notes;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -105,6 +108,7 @@ class HesabdariDoc
|
||||||
$this->relatedDocs = new ArrayCollection();
|
$this->relatedDocs = new ArrayCollection();
|
||||||
$this->storeroomTickets = new ArrayCollection();
|
$this->storeroomTickets = new ArrayCollection();
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
$this->notes = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -471,4 +475,34 @@ class HesabdariDoc
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Note>
|
||||||
|
*/
|
||||||
|
public function getNotes(): Collection
|
||||||
|
{
|
||||||
|
return $this->notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addNote(Note $note): static
|
||||||
|
{
|
||||||
|
if (!$this->notes->contains($note)) {
|
||||||
|
$this->notes->add($note);
|
||||||
|
$note->setDoc($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeNote(Note $note): static
|
||||||
|
{
|
||||||
|
if ($this->notes->removeElement($note)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($note->getDoc() === $this) {
|
||||||
|
$note->setDoc(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@ class Log
|
||||||
#[ORM\ManyToOne(inversedBy: 'logs')]
|
#[ORM\ManyToOne(inversedBy: 'logs')]
|
||||||
private ?HesabdariDoc $doc = null;
|
private ?HesabdariDoc $doc = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'logs')]
|
||||||
|
private ?PlugRepserviceOrder $repserviceOrder = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
@ -122,4 +125,16 @@ class Log
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRepserviceOrder(): ?PlugRepserviceOrder
|
||||||
|
{
|
||||||
|
return $this->repserviceOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRepserviceOrder(?PlugRepserviceOrder $repserviceOrder): static
|
||||||
|
{
|
||||||
|
$this->repserviceOrder = $repserviceOrder;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
113
hesabixCore/src/Entity/Note.php
Normal file
113
hesabixCore/src/Entity/Note.php
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\NoteRepository;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: NoteRepository::class)]
|
||||||
|
class Note
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'notes')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?User $submitter = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT)]
|
||||||
|
private ?string $des = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50)]
|
||||||
|
private ?string $date = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'notes')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Business $bid = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'notes')]
|
||||||
|
private ?HesabdariDoc $doc = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $type = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubmitter(): ?User
|
||||||
|
{
|
||||||
|
return $this->submitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSubmitter(?User $submitter): static
|
||||||
|
{
|
||||||
|
$this->submitter = $submitter;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDes(): ?string
|
||||||
|
{
|
||||||
|
return $this->des;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDes(string $des): static
|
||||||
|
{
|
||||||
|
$this->des = $des;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDate(): ?string
|
||||||
|
{
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDate(string $date): static
|
||||||
|
{
|
||||||
|
$this->date = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBid(): ?Business
|
||||||
|
{
|
||||||
|
return $this->bid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBid(?Business $bid): static
|
||||||
|
{
|
||||||
|
$this->bid = $bid;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDoc(): ?HesabdariDoc
|
||||||
|
{
|
||||||
|
return $this->doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDoc(?HesabdariDoc $doc): static
|
||||||
|
{
|
||||||
|
$this->doc = $doc;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType(): ?string
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType(?string $type): static
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Repository\PlugRepserviceOrderRepository;
|
use App\Repository\PlugRepserviceOrderRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: PlugRepserviceOrderRepository::class)]
|
#[ORM\Entity(repositoryClass: PlugRepserviceOrderRepository::class)]
|
||||||
|
@ -66,6 +68,14 @@ class PlugRepserviceOrder
|
||||||
#[ORM\Column(length: 50, nullable: true)]
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
private ?string $dateOut = null;
|
private ?string $dateOut = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'repserviceOrder', targetEntity: Log::class)]
|
||||||
|
private Collection $logs;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->logs = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
@ -262,4 +272,34 @@ class PlugRepserviceOrder
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Log>
|
||||||
|
*/
|
||||||
|
public function getLogs(): Collection
|
||||||
|
{
|
||||||
|
return $this->logs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addLog(Log $log): static
|
||||||
|
{
|
||||||
|
if (!$this->logs->contains($log)) {
|
||||||
|
$this->logs->add($log);
|
||||||
|
$log->setRepserviceOrder($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeLog(Log $log): static
|
||||||
|
{
|
||||||
|
if ($this->logs->removeElement($log)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($log->getRepserviceOrder() === $this) {
|
||||||
|
$log->setRepserviceOrder(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: PlugRepserviceOrder::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: PlugRepserviceOrder::class, orphanRemoval: true)]
|
||||||
private Collection $plugRepserviceOrders;
|
private Collection $plugRepserviceOrders;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Note::class, orphanRemoval: true)]
|
||||||
|
private Collection $notes;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userTokens = new ArrayCollection();
|
$this->userTokens = new ArrayCollection();
|
||||||
|
@ -133,6 +136,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
$this->cheques = new ArrayCollection();
|
$this->cheques = new ArrayCollection();
|
||||||
$this->mostDes = new ArrayCollection();
|
$this->mostDes = new ArrayCollection();
|
||||||
$this->plugRepserviceOrders = new ArrayCollection();
|
$this->plugRepserviceOrders = new ArrayCollection();
|
||||||
|
$this->notes = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -906,4 +910,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Note>
|
||||||
|
*/
|
||||||
|
public function getNotes(): Collection
|
||||||
|
{
|
||||||
|
return $this->notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addNote(Note $note): static
|
||||||
|
{
|
||||||
|
if (!$this->notes->contains($note)) {
|
||||||
|
$this->notes->add($note);
|
||||||
|
$note->setSubmitter($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeNote(Note $note): static
|
||||||
|
{
|
||||||
|
if ($this->notes->removeElement($note)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($note->getSubmitter() === $this) {
|
||||||
|
$note->setSubmitter(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
48
hesabixCore/src/Repository/NoteRepository.php
Normal file
48
hesabixCore/src/Repository/NoteRepository.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Note;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Note>
|
||||||
|
*
|
||||||
|
* @method Note|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Note|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Note[] findAll()
|
||||||
|
* @method Note[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class NoteRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Note::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Note[] Returns an array of Note objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('n')
|
||||||
|
// ->andWhere('n.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('n.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?Note
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('n')
|
||||||
|
// ->andWhere('n.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ namespace App\Service;
|
||||||
|
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
|
use App\Entity\PlugRepserviceOrder;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Module\RemoteAddress;
|
use App\Module\RemoteAddress;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -19,7 +20,7 @@ class Log
|
||||||
$this->remoteAddress = new RemoteAddress();
|
$this->remoteAddress = new RemoteAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insert(string $part,string $des, User | null $user = null, Business | string | null $bid = null , HesabdariDoc | null $hesabdariDoc = null): void
|
public function insert(string $part,string $des, User | null $user = null, Business | string | null $bid = null , HesabdariDoc | null $hesabdariDoc = null, PlugRepserviceOrder | null $plugRepserviceOrder = null): void
|
||||||
{
|
{
|
||||||
if(is_string($bid))
|
if(is_string($bid))
|
||||||
$bid = $this->em->getRepository(Business::class)->find($bid);
|
$bid = $this->em->getRepository(Business::class)->find($bid);
|
||||||
|
@ -30,6 +31,7 @@ class Log
|
||||||
$log->setUser($user);
|
$log->setUser($user);
|
||||||
$log->setBid($bid);
|
$log->setBid($bid);
|
||||||
$log->setDoc($hesabdariDoc);
|
$log->setDoc($hesabdariDoc);
|
||||||
|
$log->setRepserviceOrder($plugRepserviceOrder);
|
||||||
$log->setIpaddress($this->remoteAddress->getIpAddress());
|
$log->setIpaddress($this->remoteAddress->getIpAddress());
|
||||||
$this->em->persist($log);
|
$this->em->persist($log);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
20
hesabixCore/templates/notes/index.html.twig
Normal file
20
hesabixCore/templates/notes/index.html.twig
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Hello NotesController!{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<style>
|
||||||
|
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||||
|
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="example-wrapper">
|
||||||
|
<h1>Hello {{ controller_name }}! ✅</h1>
|
||||||
|
|
||||||
|
This friendly message is coming from:
|
||||||
|
<ul>
|
||||||
|
<li>Your controller at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/src/Controller/NotesController.php'|file_link(0) }}">src/Controller/NotesController.php</a></code></li>
|
||||||
|
<li>Your template at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/templates/notes/index.html.twig'|file_link(0) }}">templates/notes/index.html.twig</a></code></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue