diff --git a/hesabixCore/src.zip b/hesabixCore/src.zip new file mode 100644 index 0000000..b38c4d3 Binary files /dev/null and b/hesabixCore/src.zip differ diff --git a/hesabixCore/src/Controller/HesabdariController.php b/hesabixCore/src/Controller/HesabdariController.php index 59975f8..e814a84 100644 --- a/hesabixCore/src/Controller/HesabdariController.php +++ b/hesabixCore/src/Controller/HesabdariController.php @@ -226,6 +226,13 @@ class HesabdariController extends AbstractController $temp['person'] = Explore::ExplorePerson($mainRow->getPerson()); } + $temp['label'] = null; + if ($item->getInvoiceLabel()) { + $temp['label'] = [ + 'code' => $item->getInvoiceLabel()->getCode(), + 'label' => $item->getInvoiceLabel()->getLabel() + ]; + } //get status of doc $temp['status'] = 'تسویه نشده'; $pays = 0; diff --git a/hesabixCore/src/Controller/InvoiceController.php b/hesabixCore/src/Controller/InvoiceController.php new file mode 100644 index 0000000..cf17c49 --- /dev/null +++ b/hesabixCore/src/Controller/InvoiceController.php @@ -0,0 +1,33 @@ +getContent()) { + $params = json_decode($content, true); + } + $items = $entityManagerInterface->getRepository(InvoiceType::class)->findBy(['type' => $params['type']]); + $res = []; + foreach ($items as $item) { + $res[] = [ + 'label' => $item->getlabel(), + 'code' => $item->getCode(), + 'checked' => false + ]; + } + return $this->json($res); + } +} diff --git a/hesabixCore/src/Entity/HesabdariDoc.php b/hesabixCore/src/Entity/HesabdariDoc.php index ba6dbf7..0362ef3 100644 --- a/hesabixCore/src/Entity/HesabdariDoc.php +++ b/hesabixCore/src/Entity/HesabdariDoc.php @@ -95,6 +95,9 @@ class HesabdariDoc #[ORM\OneToMany(mappedBy: 'doc', targetEntity: Log::class)] private Collection $logs; + #[ORM\ManyToOne(inversedBy: 'hesabdariDocs')] + private ?InvoiceType $InvoiceLabel = null; + public function __construct() { $this->hesabdariRows = new ArrayCollection(); @@ -456,4 +459,16 @@ class HesabdariDoc return $this; } + + public function getInvoiceLabel(): ?InvoiceType + { + return $this->InvoiceLabel; + } + + public function setInvoiceLabel(?InvoiceType $InvoiceLabel): static + { + $this->InvoiceLabel = $InvoiceLabel; + + return $this; + } } diff --git a/hesabixCore/src/Entity/InvoiceType.php b/hesabixCore/src/Entity/InvoiceType.php new file mode 100644 index 0000000..432aff7 --- /dev/null +++ b/hesabixCore/src/Entity/InvoiceType.php @@ -0,0 +1,120 @@ +hesabdariDocs = 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; + } + + public function getChecked(): ?string + { + return $this->checked; + } + + public function setChecked(?string $checked): static + { + $this->checked = $checked; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(string $type): static + { + $this->type = $type; + + return $this; + } + + /** + * @return Collection + */ + public function getHesabdariDocs(): Collection + { + return $this->hesabdariDocs; + } + + public function addHesabdariDoc(HesabdariDoc $hesabdariDoc): static + { + if (!$this->hesabdariDocs->contains($hesabdariDoc)) { + $this->hesabdariDocs->add($hesabdariDoc); + $hesabdariDoc->setInvoiceLabel($this); + } + + return $this; + } + + public function removeHesabdariDoc(HesabdariDoc $hesabdariDoc): static + { + if ($this->hesabdariDocs->removeElement($hesabdariDoc)) { + // set the owning side to null (unless already changed) + if ($hesabdariDoc->getInvoiceLabel() === $this) { + $hesabdariDoc->setInvoiceLabel(null); + } + } + + return $this; + } +} diff --git a/hesabixCore/src/Repository/InvoiceTypeRepository.php b/hesabixCore/src/Repository/InvoiceTypeRepository.php new file mode 100644 index 0000000..dc8b1c5 --- /dev/null +++ b/hesabixCore/src/Repository/InvoiceTypeRepository.php @@ -0,0 +1,48 @@ + + * + * @method InvoiceType|null find($id, $lockMode = null, $lockVersion = null) + * @method InvoiceType|null findOneBy(array $criteria, array $orderBy = null) + * @method InvoiceType[] findAll() + * @method InvoiceType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class InvoiceTypeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, InvoiceType::class); + } + +// /** +// * @return InvoiceType[] Returns an array of InvoiceType objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('i') +// ->andWhere('i.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('i.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?InvoiceType +// { +// return $this->createQueryBuilder('i') +// ->andWhere('i.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/hesabixCore/templates.zip b/hesabixCore/templates.zip new file mode 100644 index 0000000..6ac0aea Binary files /dev/null and b/hesabixCore/templates.zip differ