progress in cheque
This commit is contained in:
parent
ebca717c49
commit
9945c8bb05
123
hesabixCore/src/Controller/ChequeController.php
Normal file
123
hesabixCore/src/Controller/ChequeController.php
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\BankAccount;
|
||||||
|
use App\Entity\Cheque;
|
||||||
|
use App\Entity\HesabdariDoc;
|
||||||
|
use App\Entity\HesabdariRow;
|
||||||
|
use App\Entity\HesabdariTable;
|
||||||
|
use App\Service\Log;
|
||||||
|
use App\Service\Jdate;
|
||||||
|
use App\Service\Access;
|
||||||
|
use App\Service\Explore;
|
||||||
|
use App\Service\JsonResp;
|
||||||
|
use App\Service\Provider;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
class ChequeController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/api/cheque/list', name: 'app_cheque_list')]
|
||||||
|
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('cheque');
|
||||||
|
if(!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$chequesInput = $entityManager->getRepository(Cheque::class)->findBy([
|
||||||
|
'bid'=>$acc['bid'],
|
||||||
|
'type'=>'input'
|
||||||
|
]);
|
||||||
|
return $this->json([
|
||||||
|
'input'=>Explore::SerializeCheques(array_reverse($chequesInput))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/api/cheque/pass/{id}', name: 'app_cheque_pass')]
|
||||||
|
public function app_cheque_pass(string $id,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('cheque');
|
||||||
|
if(!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if(! array_key_exists('bank',$params) || ! array_key_exists('date',$params))
|
||||||
|
$this->createNotFoundException();
|
||||||
|
$cheque = $entityManager->getRepository(Cheque::class)->findOneBy([
|
||||||
|
'bid'=>$acc['bid'],
|
||||||
|
'type'=>'input',
|
||||||
|
'id' => $id
|
||||||
|
]);
|
||||||
|
$bank = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||||
|
'bid'=>$acc['bid'],
|
||||||
|
'code' => $params['bank']['code']
|
||||||
|
]);
|
||||||
|
if(!$cheque || !$bank)
|
||||||
|
throw $this->createNotFoundException();
|
||||||
|
if($cheque->isLocked())
|
||||||
|
throw $this->createAccessDeniedException('cheque operation not permitted');
|
||||||
|
|
||||||
|
//edit cheque info
|
||||||
|
$cheque->setBank($bank);
|
||||||
|
$cheque->setStatus('پاس شده');
|
||||||
|
$cheque->setDate($params['date']);
|
||||||
|
$cheque->setLocked(true);
|
||||||
|
$entityManager->persist($cheque);
|
||||||
|
|
||||||
|
//create cheque document
|
||||||
|
$hesabdariDoc = new HesabdariDoc;
|
||||||
|
$hesabdariDoc->setBid($acc['bid']);
|
||||||
|
$hesabdariDoc->setSubmitter($this->getUser());
|
||||||
|
$hesabdariDoc->setYear($acc['year']);
|
||||||
|
$hesabdariDoc->setMoney($acc['bid']->getMoney());
|
||||||
|
$hesabdariDoc->setDateSubmit(time());
|
||||||
|
$hesabdariDoc->setDate($params['date']);
|
||||||
|
$hesabdariDoc->setType('pass_cheque');
|
||||||
|
$hesabdariDoc->setCode($provider->getAccountingCode($acc['bid'],'accounting'));
|
||||||
|
$hesabdariDoc->setDes($params['des']);
|
||||||
|
$hesabdariDoc->setAmount($cheque->getAmount());
|
||||||
|
$entityManager->persist($hesabdariDoc);
|
||||||
|
|
||||||
|
//cheate hesabdari rows
|
||||||
|
$hesabdariRow1 = new HesabdariRow();
|
||||||
|
$hesabdariRow1->setDoc($hesabdariDoc);
|
||||||
|
$hesabdariRow1->setCheque($cheque);
|
||||||
|
$hesabdariRow1->setPerson($cheque->getPerson());
|
||||||
|
$hesabdariRow1->setYear($acc['year']);
|
||||||
|
$hesabdariRow1->setBs($cheque->getAmount());
|
||||||
|
$hesabdariRow1->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>3]));
|
||||||
|
$hesabdariRow1->setBd(0);
|
||||||
|
$hesabdariRow1->setBid($acc['bid']);
|
||||||
|
$hesabdariRow1->setDes('پاس شدن چک و انتقال به بانک');
|
||||||
|
$entityManager->persist($hesabdariRow1);
|
||||||
|
|
||||||
|
$hesabdariRow2 = new HesabdariRow();
|
||||||
|
$hesabdariRow2->setDoc($hesabdariDoc);
|
||||||
|
$hesabdariRow2->setCheque($cheque);
|
||||||
|
$hesabdariRow2->setBank($bank);
|
||||||
|
$hesabdariRow2->setYear($acc['year']);
|
||||||
|
$hesabdariRow2->setBs(0);
|
||||||
|
$hesabdariRow2->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>5]));
|
||||||
|
$hesabdariRow2->setBd($cheque->getAmount());
|
||||||
|
$hesabdariRow2->setBid($acc['bid']);
|
||||||
|
$hesabdariRow2->setDes('پاس شدن چک و انتقال به بانک');
|
||||||
|
$entityManager->persist($hesabdariRow2);
|
||||||
|
$entityManager->flush();
|
||||||
|
$log->insert(
|
||||||
|
'حسابداری','ثبت چک پاس شده شماره ' . $cheque->getNumber() . ' و ثبت واریز به بانک ' . $bank->getName(),
|
||||||
|
$this->getUser(),
|
||||||
|
$acc['bid']->getId(),
|
||||||
|
$hesabdariDoc
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->json([
|
||||||
|
'result'=>'ok'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\BankAccount;
|
use App\Entity\BankAccount;
|
||||||
use App\Entity\Cashdesk;
|
use App\Entity\Cashdesk;
|
||||||
|
use App\Entity\Cheque;
|
||||||
use App\Entity\Commodity;
|
use App\Entity\Commodity;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
|
@ -20,6 +21,7 @@ use App\Service\Jdate;
|
||||||
use App\Service\JsonResp;
|
use App\Service\JsonResp;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
@ -244,7 +246,7 @@ class HesabdariController extends AbstractController
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
||||||
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
||||||
{
|
{
|
||||||
$params = [];
|
$params = [];
|
||||||
if ($content = $request->getContent()) {
|
if ($content = $request->getContent()) {
|
||||||
|
@ -328,6 +330,13 @@ class HesabdariController extends AbstractController
|
||||||
$hesabdariRow->setDoc($doc);
|
$hesabdariRow->setDoc($doc);
|
||||||
$hesabdariRow->setBs($row['bs']);
|
$hesabdariRow->setBs($row['bs']);
|
||||||
$hesabdariRow->setBd($row['bd']);
|
$hesabdariRow->setBd($row['bd']);
|
||||||
|
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||||
|
'code'=>$row['table']
|
||||||
|
]);
|
||||||
|
$hesabdariRow->setRef($ref);
|
||||||
|
|
||||||
|
$entityManager->persist($hesabdariRow);
|
||||||
|
|
||||||
if(array_key_exists('referral',$row))
|
if(array_key_exists('referral',$row))
|
||||||
$hesabdariRow->setReferral($row['referral']);
|
$hesabdariRow->setReferral($row['referral']);
|
||||||
$amount += $row['bs'];
|
$amount += $row['bs'];
|
||||||
|
@ -338,6 +347,37 @@ class HesabdariController extends AbstractController
|
||||||
elseif ($person->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('person is not in this business');
|
elseif ($person->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('person is not in this business');
|
||||||
$hesabdariRow->setPerson($person);
|
$hesabdariRow->setPerson($person);
|
||||||
}
|
}
|
||||||
|
if($row['type'] == 'cheque'){
|
||||||
|
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||||
|
'bid'=> $acc['bid'],
|
||||||
|
'id'=>$row['person']
|
||||||
|
]);
|
||||||
|
$cheque = new Cheque();
|
||||||
|
$cheque->setBid($acc['bid']);
|
||||||
|
$cheque->setSubmitter($this->getUser());
|
||||||
|
$cheque->setPayDate($row['chequeDate']);
|
||||||
|
$cheque->setBankOncheque($row['chequeBank']);
|
||||||
|
$cheque->setRef($hesabdariRow->getRef());
|
||||||
|
$cheque->setNumber($row['chequeNum']);
|
||||||
|
$cheque->setSayadNum($row['chequeSayadNum']);
|
||||||
|
$cheque->setDateSubmit(time());
|
||||||
|
$cheque->setDes($row['des']);
|
||||||
|
$dateArray = explode('-',$row['chequeDate']);
|
||||||
|
$dateGre = strtotime($jdate->jalali_to_gregorian($dateArray['0'],$dateArray['1'],$dateArray['2'],'/'));
|
||||||
|
$cheque->setDateStamp($dateGre);
|
||||||
|
$cheque->setPerson($person);
|
||||||
|
$cheque->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>$row['table']]));
|
||||||
|
$cheque->setType($row['chequeType']);
|
||||||
|
if($cheque->getType() == 'input')
|
||||||
|
$cheque->setAmount($hesabdariRow->getBd());
|
||||||
|
else
|
||||||
|
$cheque->setAmount($hesabdariRow->getBs());
|
||||||
|
$cheque->setLocked(false);
|
||||||
|
$cheque->setStatus('پاس نشده');
|
||||||
|
$entityManager->persist($cheque);
|
||||||
|
$entityManager->flush();
|
||||||
|
$hesabdariRow->setCheque($cheque);
|
||||||
|
}
|
||||||
elseif ($row['type'] == 'bank'){
|
elseif ($row['type'] == 'bank'){
|
||||||
$bank = $entityManager->getRepository(BankAccount::class)->find($row['id']);
|
$bank = $entityManager->getRepository(BankAccount::class)->find($row['id']);
|
||||||
if(!$bank) throw $this->createNotFoundException('bank not found');
|
if(!$bank) throw $this->createNotFoundException('bank not found');
|
||||||
|
@ -364,16 +404,13 @@ class HesabdariController extends AbstractController
|
||||||
$hesabdariRow->setCommodity($commodity);
|
$hesabdariRow->setCommodity($commodity);
|
||||||
$hesabdariRow->setCommdityCount($row['count']);
|
$hesabdariRow->setCommdityCount($row['count']);
|
||||||
}
|
}
|
||||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
|
||||||
'code'=>$row['table']
|
|
||||||
]);
|
|
||||||
|
|
||||||
if(array_key_exists('plugin',$row))
|
if(array_key_exists('plugin',$row))
|
||||||
$hesabdariRow->setPlugin($row['plugin']);
|
$hesabdariRow->setPlugin($row['plugin']);
|
||||||
if(array_key_exists('refData',$row))
|
if(array_key_exists('refData',$row))
|
||||||
$hesabdariRow->setRefData($row['refData']);
|
$hesabdariRow->setRefData($row['refData']);
|
||||||
|
|
||||||
$hesabdariRow->setRef($ref);
|
|
||||||
$hesabdariRow->setDes($row['des']);
|
$hesabdariRow->setDes($row['des']);
|
||||||
$entityManager->persist($hesabdariRow);
|
$entityManager->persist($hesabdariRow);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
@ -441,8 +478,22 @@ class HesabdariController extends AbstractController
|
||||||
$tickets = $entityManager->getRepository(StoreroomTicket::class)->findBy(['doc'=>$doc]);
|
$tickets = $entityManager->getRepository(StoreroomTicket::class)->findBy(['doc'=>$doc]);
|
||||||
foreach ($tickets as $ticket)
|
foreach ($tickets as $ticket)
|
||||||
$entityManager->remove($ticket);
|
$entityManager->remove($ticket);
|
||||||
foreach ($rows as $row)
|
//remove rows and check sub systems
|
||||||
|
foreach ($rows as $row){
|
||||||
|
if($row->getCheque()){
|
||||||
|
if($row->getCheque()->isLocked()){
|
||||||
|
//doc has transaction
|
||||||
|
return $this->json([
|
||||||
|
'result'=>2,
|
||||||
|
'message'=>'سند به دلیل داشتن تراکنش مرتبط با چک بانکی قابل حذف نیست.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$log->insert('بانکداری','چک شماره شماره ' . $row->getCheque()->getNumber() . ' حذف شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||||
|
$entityManager->remove($row->getCheque());
|
||||||
|
}
|
||||||
$entityManager->remove($row);
|
$entityManager->remove($row);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($doc->getRelatedDocs() as $relatedDoc){
|
foreach ($doc->getRelatedDocs() as $relatedDoc){
|
||||||
if($relatedDoc->getType() != 'walletPay'){
|
if($relatedDoc->getType() != 'walletPay'){
|
||||||
$items = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc'=>$relatedDoc]);
|
$items = $entityManager->getRepository(HesabdariRow::class)->findBy(['doc'=>$relatedDoc]);
|
||||||
|
|
|
@ -58,9 +58,13 @@ class BankAccount
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $balance = null;
|
private ?string $balance = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bank', targetEntity: Cheque::class)]
|
||||||
|
private Collection $cheques;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
$this->cheques = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -241,4 +245,34 @@ class BankAccount
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cheque>
|
||||||
|
*/
|
||||||
|
public function getCheques(): Collection
|
||||||
|
{
|
||||||
|
return $this->cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if (!$this->cheques->contains($cheque)) {
|
||||||
|
$this->cheques->add($cheque);
|
||||||
|
$cheque->setBank($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if ($this->cheques->removeElement($cheque)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cheque->getBank() === $this) {
|
||||||
|
$cheque->setBank(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,9 @@ class Business
|
||||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Hook::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Hook::class, orphanRemoval: true)]
|
||||||
private Collection $hooks;
|
private Collection $hooks;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Cheque::class, orphanRemoval: true)]
|
||||||
|
private Collection $cheques;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -227,6 +230,7 @@ class Business
|
||||||
$this->archiveOrders = new ArrayCollection();
|
$this->archiveOrders = new ArrayCollection();
|
||||||
$this->shareholders = new ArrayCollection();
|
$this->shareholders = new ArrayCollection();
|
||||||
$this->hooks = new ArrayCollection();
|
$this->hooks = new ArrayCollection();
|
||||||
|
$this->cheques = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1355,4 +1359,34 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cheque>
|
||||||
|
*/
|
||||||
|
public function getCheques(): Collection
|
||||||
|
{
|
||||||
|
return $this->cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if (!$this->cheques->contains($cheque)) {
|
||||||
|
$this->cheques->add($cheque);
|
||||||
|
$cheque->setBid($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if ($this->cheques->removeElement($cheque)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cheque->getBid() === $this) {
|
||||||
|
$cheque->setBid(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
318
hesabixCore/src/Entity/Cheque.php
Normal file
318
hesabixCore/src/Entity/Cheque.php
Normal file
|
@ -0,0 +1,318 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ChequeRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ChequeRepository::class)]
|
||||||
|
class Cheque
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'cheques')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Business $bid = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'cheques')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?User $submitter = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50)]
|
||||||
|
private ?string $dateSubmit = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 20)]
|
||||||
|
private ?string $type = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'cheques')]
|
||||||
|
private ?BankAccount $bank = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'cheques')]
|
||||||
|
private ?Person $person = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
|
private ?string $sayadNum = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $des = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50)]
|
||||||
|
private ?string $dateStamp = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
|
private ?string $payDate = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne]
|
||||||
|
private ?HesabdariTable $ref = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $number = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'cheque', targetEntity: HesabdariRow::class)]
|
||||||
|
private Collection $hesabdariRows;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $bankOncheque = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $amount = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $status = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $locked = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $date = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->hesabdariRows = 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 getSubmitter(): ?User
|
||||||
|
{
|
||||||
|
return $this->submitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSubmitter(?User $submitter): static
|
||||||
|
{
|
||||||
|
$this->submitter = $submitter;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateSubmit(): ?string
|
||||||
|
{
|
||||||
|
return $this->dateSubmit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateSubmit(string $dateSubmit): static
|
||||||
|
{
|
||||||
|
$this->dateSubmit = $dateSubmit;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType(): ?string
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType(string $type): static
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBank(): ?BankAccount
|
||||||
|
{
|
||||||
|
return $this->bank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBank(?BankAccount $bank): static
|
||||||
|
{
|
||||||
|
$this->bank = $bank;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPerson(): ?Person
|
||||||
|
{
|
||||||
|
return $this->person;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPerson(?Person $person): static
|
||||||
|
{
|
||||||
|
$this->person = $person;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSayadNum(): ?string
|
||||||
|
{
|
||||||
|
return $this->sayadNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSayadNum(?string $sayadNum): static
|
||||||
|
{
|
||||||
|
$this->sayadNum = $sayadNum;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDes(): ?string
|
||||||
|
{
|
||||||
|
return $this->des;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDes(?string $des): static
|
||||||
|
{
|
||||||
|
$this->des = $des;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateStamp(): ?string
|
||||||
|
{
|
||||||
|
return $this->dateStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateStamp(string $dateStamp): static
|
||||||
|
{
|
||||||
|
$this->dateStamp = $dateStamp;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPayDate(): ?string
|
||||||
|
{
|
||||||
|
return $this->payDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPayDate(?string $payDate): static
|
||||||
|
{
|
||||||
|
$this->payDate = $payDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRef(): ?HesabdariTable
|
||||||
|
{
|
||||||
|
return $this->ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRef(?HesabdariTable $ref): static
|
||||||
|
{
|
||||||
|
$this->ref = $ref;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumber(): ?string
|
||||||
|
{
|
||||||
|
return $this->number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumber(string $number): static
|
||||||
|
{
|
||||||
|
$this->number = $number;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, HesabdariRow>
|
||||||
|
*/
|
||||||
|
public function getHesabdariRows(): Collection
|
||||||
|
{
|
||||||
|
return $this->hesabdariRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addHesabdariRow(HesabdariRow $hesabdariRow): static
|
||||||
|
{
|
||||||
|
if (!$this->hesabdariRows->contains($hesabdariRow)) {
|
||||||
|
$this->hesabdariRows->add($hesabdariRow);
|
||||||
|
$hesabdariRow->setCheque($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeHesabdariRow(HesabdariRow $hesabdariRow): static
|
||||||
|
{
|
||||||
|
if ($this->hesabdariRows->removeElement($hesabdariRow)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($hesabdariRow->getCheque() === $this) {
|
||||||
|
$hesabdariRow->setCheque(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBankOncheque(): ?string
|
||||||
|
{
|
||||||
|
return $this->bankOncheque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBankOncheque(string $bankOncheque): static
|
||||||
|
{
|
||||||
|
$this->bankOncheque = $bankOncheque;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAmount(): ?string
|
||||||
|
{
|
||||||
|
return $this->amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAmount(string $amount): static
|
||||||
|
{
|
||||||
|
$this->amount = $amount;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(): ?string
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(?string $status): static
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isLocked(): ?bool
|
||||||
|
{
|
||||||
|
return $this->locked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLocked(?bool $locked): static
|
||||||
|
{
|
||||||
|
$this->locked = $locked;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDate(): ?string
|
||||||
|
{
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDate(?string $date): static
|
||||||
|
{
|
||||||
|
$this->date = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -82,6 +82,11 @@ class HesabdariRow
|
||||||
#[ORM\Column(type: Types::ARRAY, nullable: true)]
|
#[ORM\Column(type: Types::ARRAY, nullable: true)]
|
||||||
private ?array $tempData = null;
|
private ?array $tempData = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'hesabdariRows')]
|
||||||
|
private ?Cheque $cheque = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -296,4 +301,16 @@ class HesabdariRow
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCheque(): ?Cheque
|
||||||
|
{
|
||||||
|
return $this->cheque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCheque(?Cheque $cheque): static
|
||||||
|
{
|
||||||
|
$this->cheque = $cheque;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,9 @@ class Person
|
||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?bool $speedAccess = null;
|
private ?bool $speedAccess = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'person', targetEntity: Cheque::class)]
|
||||||
|
private Collection $cheques;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -123,6 +126,7 @@ class Person
|
||||||
$this->ordersFromCustomer = new ArrayCollection();
|
$this->ordersFromCustomer = new ArrayCollection();
|
||||||
$this->storeroomTickets = new ArrayCollection();
|
$this->storeroomTickets = new ArrayCollection();
|
||||||
$this->shareholders = new ArrayCollection();
|
$this->shareholders = new ArrayCollection();
|
||||||
|
$this->cheques = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -591,4 +595,34 @@ class Person
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cheque>
|
||||||
|
*/
|
||||||
|
public function getCheques(): Collection
|
||||||
|
{
|
||||||
|
return $this->cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if (!$this->cheques->contains($cheque)) {
|
||||||
|
$this->cheques->add($cheque);
|
||||||
|
$cheque->setPerson($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if ($this->cheques->removeElement($cheque)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cheque->getPerson() === $this) {
|
||||||
|
$cheque->setPerson(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Hook::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Hook::class, orphanRemoval: true)]
|
||||||
private Collection $hooks;
|
private Collection $hooks;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Cheque::class, orphanRemoval: true)]
|
||||||
|
private Collection $cheques;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userTokens = new ArrayCollection();
|
$this->userTokens = new ArrayCollection();
|
||||||
|
@ -121,6 +124,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
$this->archiveFiles = new ArrayCollection();
|
$this->archiveFiles = new ArrayCollection();
|
||||||
$this->archiveOrders = new ArrayCollection();
|
$this->archiveOrders = new ArrayCollection();
|
||||||
$this->hooks = new ArrayCollection();
|
$this->hooks = new ArrayCollection();
|
||||||
|
$this->cheques = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -804,4 +808,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cheque>
|
||||||
|
*/
|
||||||
|
public function getCheques(): Collection
|
||||||
|
{
|
||||||
|
return $this->cheques;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if (!$this->cheques->contains($cheque)) {
|
||||||
|
$this->cheques->add($cheque);
|
||||||
|
$cheque->setSubmitter($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCheque(Cheque $cheque): static
|
||||||
|
{
|
||||||
|
if ($this->cheques->removeElement($cheque)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cheque->getSubmitter() === $this) {
|
||||||
|
$cheque->setSubmitter(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
40
hesabixCore/src/Repository/ChequeRepository.php
Normal file
40
hesabixCore/src/Repository/ChequeRepository.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Cheque;
|
||||||
|
use App\Entity\HesabdariRow;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Cheque>
|
||||||
|
*
|
||||||
|
* @method Cheque|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Cheque|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Cheque[] findAll()
|
||||||
|
* @method Cheque[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class ChequeRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Cheque::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Cheque[] Returns an array of Cheque objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('c')
|
||||||
|
// ->andWhere('c.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('c.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ use App\Entity\User;
|
||||||
use App\Entity\Year;
|
use App\Entity\Year;
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
use App\Entity\Cashdesk;
|
use App\Entity\Cashdesk;
|
||||||
|
use App\Entity\Cheque;
|
||||||
use App\Entity\Commodity;
|
use App\Entity\Commodity;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\HesabdariRow;
|
use App\Entity\HesabdariRow;
|
||||||
|
@ -205,4 +206,33 @@ class Explore{
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SerializeCheque(Cheque | null $cheque){
|
||||||
|
if(!$cheque)
|
||||||
|
return null;
|
||||||
|
$jdate = new Jdate;
|
||||||
|
return [
|
||||||
|
'id' => $cheque->getId(),
|
||||||
|
'number'=> $cheque->getNumber(),
|
||||||
|
'sayadNum'=>$cheque->getSayadNum(),
|
||||||
|
'chequeBank'=>$cheque->getBankOncheque(),
|
||||||
|
'person'=>self::ExplorePerson($cheque->getPerson()),
|
||||||
|
'bank'=>self::ExploreBank($cheque->getBank()),
|
||||||
|
'des'=>$cheque->getDes(),
|
||||||
|
'datePay'=>$cheque->getPayDate(),
|
||||||
|
'type'=>$cheque->getType(),
|
||||||
|
'amount'=>$cheque->getAmount(),
|
||||||
|
'status'=>$cheque->getStatus(),
|
||||||
|
'date'=>$cheque->getDate(),
|
||||||
|
'locked'=>$cheque->isLocked()
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SerializeCheques(array $cheques){
|
||||||
|
$result = [];
|
||||||
|
foreach($cheques as $cheque)
|
||||||
|
$result[] = self::SerializeCheque($cheque);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue