add prelabel to persons and some bug fix in labels
This commit is contained in:
parent
b62ec65209
commit
37cacfbd3f
|
@ -192,6 +192,7 @@ class BankController extends AbstractController
|
||||||
'شماره تراکنش',
|
'شماره تراکنش',
|
||||||
'تاریخ',
|
'تاریخ',
|
||||||
'توضیحات',
|
'توضیحات',
|
||||||
|
'شرح سند',
|
||||||
'تفضیل',
|
'تفضیل',
|
||||||
'بستانکار',
|
'بستانکار',
|
||||||
'بدهکار',
|
'بدهکار',
|
||||||
|
@ -203,6 +204,7 @@ class BankController extends AbstractController
|
||||||
$transaction->getId(),
|
$transaction->getId(),
|
||||||
$transaction->getDoc()->getDate(),
|
$transaction->getDoc()->getDate(),
|
||||||
$transaction->getDes(),
|
$transaction->getDes(),
|
||||||
|
$transaction->getDoc()->getDes(),
|
||||||
$transaction->getRef()->getName(),
|
$transaction->getRef()->getName(),
|
||||||
$transaction->getBs(),
|
$transaction->getBs(),
|
||||||
$transaction->getBd(),
|
$transaction->getBd(),
|
||||||
|
|
|
@ -11,6 +11,7 @@ use App\Service\Jdate;
|
||||||
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;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use App\Entity\Business;
|
use App\Entity\Business;
|
||||||
|
@ -21,49 +22,54 @@ use App\Service\Provider;
|
||||||
class GeneralController extends AbstractController
|
class GeneralController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/api/general/stat', name: 'general_stat')]
|
#[Route('/api/general/stat', name: 'general_stat')]
|
||||||
public function general_stat(EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
public function general_stat(EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
||||||
//get last version number
|
//get last version number
|
||||||
$version = '0.0.1';
|
$version = '0.0.1';
|
||||||
$lastUpdateDate = '1399';
|
$lastUpdateDate = '1399';
|
||||||
$lastUpdateDes = '';
|
$lastUpdateDes = '';
|
||||||
$last = $entityManager->getRepository(ChangeReport::class)->findOneBy([],['id'=>'DESC']);
|
$last = $entityManager->getRepository(ChangeReport::class)->findOneBy([], ['id' => 'DESC']);
|
||||||
if($last){
|
if ($last) {
|
||||||
$version = $last->getVersion();
|
$version = $last->getVersion();
|
||||||
$lastUpdateDate = $jdate->jdate('Y/n/d',$last->getDateSubmit());
|
$lastUpdateDate = $jdate->jdate('Y/n/d', $last->getDateSubmit());
|
||||||
$lastUpdateDes = $last->getBody();
|
$lastUpdateDes = $last->getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'version'=>$version,
|
'version' => $version,
|
||||||
'lastUpdateDate'=>$lastUpdateDate,
|
'lastUpdateDate' => $lastUpdateDate,
|
||||||
'lastUpdateDes'=>$lastUpdateDes,
|
'lastUpdateDes' => $lastUpdateDes,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/general/statements', name: 'general_statement')]
|
#[Route('/api/general/statements', name: 'general_statement')]
|
||||||
public function general_statement(EntityManagerInterface $entityManager,Jdate $jdate): JsonResponse
|
public function general_statement(EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->json($entityManager->getRepository(Statment::class)->findBy([],['id'=>'DESC']));
|
return $this->json($entityManager->getRepository(Statment::class)->findBy([], ['id' => 'DESC']));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/general/get/time', name: 'general_get_time')]
|
#[Route('/api/general/get/time', name: 'general_get_time')]
|
||||||
public function general_get_time(Jdate $jdate): JsonResponse
|
public function general_get_time(Jdate $jdate, Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->json(['timeNow'=>$jdate->jdate('Y/n/d',time())]);
|
$params = [];
|
||||||
|
if ($content = $request->getContent()) {
|
||||||
|
$params = json_decode($content, true);
|
||||||
|
}
|
||||||
|
if (array_key_exists('format', $params))
|
||||||
|
return $this->json(['timeNow' => $jdate->jdate($params['format'], time()), 'ts' => time()]);
|
||||||
|
return $this->json(['timeNow' => $jdate->jdate('Y/n/d', time()), 'ts' => time()]);
|
||||||
}
|
}
|
||||||
#[Route('/front/print/{id}', name: 'app_front_print')]
|
#[Route('/front/print/{id}', name: 'app_front_print')]
|
||||||
public function app_front_print(Provider $provider,EntityManagerInterface $entityManager,pdfMGR $pdfMGR,String $id)
|
public function app_front_print(Provider $provider, EntityManagerInterface $entityManager, pdfMGR $pdfMGR, string $id)
|
||||||
{
|
{
|
||||||
$print = $entityManager->getRepository(PrinterQueue::class)->findOneBy(['pid'=>$id]);
|
$print = $entityManager->getRepository(PrinterQueue::class)->findOneBy(['pid' => $id]);
|
||||||
if(!$print)
|
if (!$print)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
if($print->isPosprint()){
|
if ($print->isPosprint()) {
|
||||||
$pdfMGR->streamTwig2PDFInvoiceType($print);
|
$pdfMGR->streamTwig2PDFInvoiceType($print);
|
||||||
}
|
} else {
|
||||||
else{
|
$pdfMGR->streamTwig2PDF($print);
|
||||||
$pdfMGR->streamTwig2PDF($print);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response('');
|
return new Response('');
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\PersonPrelabel;
|
||||||
use App\Service\Extractor;
|
use App\Service\Extractor;
|
||||||
use App\Service\Log;
|
use App\Service\Log;
|
||||||
use App\Entity\Person;
|
use App\Entity\Person;
|
||||||
|
@ -239,6 +240,7 @@ class PersonsController extends AbstractController
|
||||||
return $this->json(['result' => -1]);
|
return $this->json(['result' => -1]);
|
||||||
if (count_chars(trim($params['nikename'])) == 0)
|
if (count_chars(trim($params['nikename'])) == 0)
|
||||||
return $this->json(['result' => 3]);
|
return $this->json(['result' => 3]);
|
||||||
|
|
||||||
if ($code == 0) {
|
if ($code == 0) {
|
||||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||||
'nikename' => $params['nikename'],
|
'nikename' => $params['nikename'],
|
||||||
|
@ -298,7 +300,14 @@ class PersonsController extends AbstractController
|
||||||
$person->setShenasemeli($params['shenasemeli']);
|
$person->setShenasemeli($params['shenasemeli']);
|
||||||
if (array_key_exists('company', $params))
|
if (array_key_exists('company', $params))
|
||||||
$person->setCompany($params['company']);
|
$person->setCompany($params['company']);
|
||||||
|
if (array_key_exists('prelabel', $params)) {
|
||||||
|
if ($params['prelabel'] != '') {
|
||||||
|
$prelabel = $entityManager->getRepository(PersonPrelabel::class)->findOneBy(['code' => $params['prelabel']['code']]);
|
||||||
|
if ($prelabel) {
|
||||||
|
$person->setPrelabel($prelabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//inset cards
|
//inset cards
|
||||||
if (array_key_exists('accounts', $params)) {
|
if (array_key_exists('accounts', $params)) {
|
||||||
foreach ($params['accounts'] as $item) {
|
foreach ($params['accounts'] as $item) {
|
||||||
|
@ -1233,4 +1242,22 @@ class PersonsController 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/person/prelabels/list', name: 'app_persons_prelabels_list')]
|
||||||
|
public function app_persons_prelabels_list(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('person');
|
||||||
|
if (!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
$labels = $entityManager->getRepository(PersonPrelabel::class)->findAll();
|
||||||
|
$rows = [];
|
||||||
|
foreach ($labels as $key => $label) {
|
||||||
|
$rows[] = [
|
||||||
|
'label' => $label->getLabel(),
|
||||||
|
'code' => $label->getCode(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return new Response(json_encode($rows));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,9 @@ class Person
|
||||||
#[ORM\OneToMany(mappedBy: 'salesman', targetEntity: PreInvoiceDoc::class)]
|
#[ORM\OneToMany(mappedBy: 'salesman', targetEntity: PreInvoiceDoc::class)]
|
||||||
private Collection $preinvoiceDocsSalemans;
|
private Collection $preinvoiceDocsSalemans;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'people')]
|
||||||
|
private ?PersonPrelabel $prelabel = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->hesabdariRows = new ArrayCollection();
|
$this->hesabdariRows = new ArrayCollection();
|
||||||
|
@ -847,4 +850,16 @@ class Person
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPrelabel(): ?PersonPrelabel
|
||||||
|
{
|
||||||
|
return $this->prelabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPrelabel(?PersonPrelabel $prelabel): static
|
||||||
|
{
|
||||||
|
$this->prelabel = $prelabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
93
hesabixCore/src/Entity/PersonPrelabel.php
Normal file
93
hesabixCore/src/Entity/PersonPrelabel.php
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\PersonPrelabelRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: PersonPrelabelRepository::class)]
|
||||||
|
class PersonPrelabel
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $label = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $code = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Person>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(mappedBy: 'prelabel', targetEntity: Person::class)]
|
||||||
|
private Collection $people;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->people = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLabel(string $label): static
|
||||||
|
{
|
||||||
|
$this->label = $label;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCode(): ?string
|
||||||
|
{
|
||||||
|
return $this->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCode(string $code): static
|
||||||
|
{
|
||||||
|
$this->code = $code;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Person>
|
||||||
|
*/
|
||||||
|
public function getPeople(): Collection
|
||||||
|
{
|
||||||
|
return $this->people;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPerson(Person $person): static
|
||||||
|
{
|
||||||
|
if (!$this->people->contains($person)) {
|
||||||
|
$this->people->add($person);
|
||||||
|
$person->setPrelabel($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePerson(Person $person): static
|
||||||
|
{
|
||||||
|
if ($this->people->removeElement($person)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($person->getPrelabel() === $this) {
|
||||||
|
$person->setPrelabel(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
43
hesabixCore/src/Repository/PersonPrelabelRepository.php
Normal file
43
hesabixCore/src/Repository/PersonPrelabelRepository.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\PersonPrelabel;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<PersonPrelabel>
|
||||||
|
*/
|
||||||
|
class PersonPrelabelRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, PersonPrelabel::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return PersonPrelabel[] Returns an array of PersonPrelabel 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): ?PersonPrelabel
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
|
@ -312,7 +312,11 @@ class Explore
|
||||||
'birthday' => $person->getBirthday(),
|
'birthday' => $person->getBirthday(),
|
||||||
'speedAccess' => $person->isSpeedAccess(),
|
'speedAccess' => $person->isSpeedAccess(),
|
||||||
'address' => $person->getAddress(),
|
'address' => $person->getAddress(),
|
||||||
|
'prelabel' => '',
|
||||||
];
|
];
|
||||||
|
if ($person->getPrelabel()) {
|
||||||
|
$res['prelabel'] = $person->getPrelabel()->getLabel();
|
||||||
|
}
|
||||||
$res['accounts'] = self::ExplorePersonCards($person);
|
$res['accounts'] = self::ExplorePersonCards($person);
|
||||||
if (count($typesAll) != 0) {
|
if (count($typesAll) != 0) {
|
||||||
$res['types'] = self::ExplorePersonTypes($typesAll);
|
$res['types'] = self::ExplorePersonTypes($typesAll);
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<td class="center item">فاکتور/سند</td>
|
<td class="center item">فاکتور/سند</td>
|
||||||
<td class="center item">تاریخ</td>
|
<td class="center item">تاریخ</td>
|
||||||
<td class="center item">توضیحات</td>
|
<td class="center item">توضیحات</td>
|
||||||
|
<td class="center item">شرح سند</td>
|
||||||
<td class="center item">تفضیل</td>
|
<td class="center item">تفضیل</td>
|
||||||
<td class="center item">بدهکار</td>
|
<td class="center item">بدهکار</td>
|
||||||
<td class="center item">بستانکار</td>
|
<td class="center item">بستانکار</td>
|
||||||
|
@ -63,6 +64,7 @@
|
||||||
<td class="center item">{{ item.doc.code }}</td>
|
<td class="center item">{{ item.doc.code }}</td>
|
||||||
<td class="center item">{{ item.doc.date }}</td>
|
<td class="center item">{{ item.doc.date }}</td>
|
||||||
<td class="center item">{{ item.des }}</td>
|
<td class="center item">{{ item.des }}</td>
|
||||||
|
<td class="center item">{{ item.doc.des }}</td>
|
||||||
<td class="center item">{{ item.ref.name }}</td>
|
<td class="center item">{{ item.ref.name }}</td>
|
||||||
<td class="center item">{{ item.bd | number_format }}</td>
|
<td class="center item">{{ item.bd | number_format }}</td>
|
||||||
<td class="center item">{{ item.bs | number_format }}</td>
|
<td class="center item">{{ item.bs | number_format }}</td>
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
<p>
|
<p>
|
||||||
<b>نام:
|
<b>نام:
|
||||||
</b>
|
</b>
|
||||||
|
{% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %}
|
||||||
{{ person.nikename }}
|
{{ person.nikename }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
<p>
|
<p>
|
||||||
<b>نام:
|
<b>نام:
|
||||||
</b>
|
</b>
|
||||||
|
{% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %}
|
||||||
{{ person.nikename }}
|
{{ person.nikename }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
<p>
|
<p>
|
||||||
<b>نام:
|
<b>نام:
|
||||||
</b>
|
</b>
|
||||||
|
{% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %}
|
||||||
{{ person.nikename }}
|
{{ person.nikename }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
<p>
|
<p>
|
||||||
<b>نام:
|
<b>نام:
|
||||||
</b>
|
</b>
|
||||||
|
{% if person.prelabel is not null %}{{ person.prelabel.label }}{% endif %}
|
||||||
{{ person.nikename }}
|
{{ person.nikename }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in a new issue