<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\IncomingInvoiceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
#[ORM\Entity(repositoryClass: IncomingInvoiceRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['incoming_invoice:read']],
denormalizationContext: ['groups' => ['incoming_invoice:write']],
order: ['id' => 'DESC'],
)]
// 'account.manager.id' => 'exact',
class IncomingInvoice
{
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateEntered = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateModified = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateIncoming = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\ManyToOne]
private ?User $modified_user = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\ManyToOne]
private ?User $assignedUser = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $status = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $invoiceType = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(nullable: true)]
private ?int $invoiceNumber = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\ManyToOne(inversedBy: 'invoice_supplier')]
private ?Accounts $supplier = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 20, nullable: true)]
private ?string $iddoc = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(nullable: true)]
private ?bool $synced = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 20, nullable: true)]
private ?string $currency = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(nullable: true)]
private ?float $currency_rate = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(nullable: true)]
private ?float $total = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(nullable: true)]
private ?float $total_nds = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $code_1c = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\ManyToOne(inversedBy: 'incomingInvoices')]
private ?Storage $storage = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\OneToOne(mappedBy: 'c', cascade: ['persist', 'remove'])]
private ?IncomingInvoiceCstm $incomingInvoiceCstm = null;
#[Groups(['incoming_invoice:read', 'incoming_invoice:write'])]
#[ORM\OneToMany(mappedBy: 'incoming_invoice', targetEntity: IncomingInvoiceProduct::class)]
private Collection $incomingInvoiceProducts;
public function __construct()
{
$this->incomingInvoiceProducts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->dateEntered;
}
public function setDateEntered(?\DateTimeInterface $dateEntered): self
{
$this->dateEntered = $dateEntered;
return $this;
}
public function getDateModified(): ?\DateTimeInterface
{
return $this->dateModified;
}
public function setDateModified(?\DateTimeInterface $dateModified): self
{
$this->dateModified = $dateModified;
return $this;
}
public function getDateIncoming(): ?\DateTimeInterface
{
return $this->dateIncoming;
}
public function setDateIncoming(?\DateTimeInterface $dateIncoming): self
{
$this->dateIncoming = $dateIncoming;
return $this;
}
public function getModifiedUser(): ?User
{
return $this->modified_user;
}
public function setModifiedUser(?User $modified_user_id): self
{
$this->modified_user = $modified_user_id;
return $this;
}
public function getAssignedUser(): ?User
{
return $this->assignedUser;
}
public function setAssignedUse(?User $assignedUser_id): self
{
$this->assignedUser = $assignedUser_id;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getInvoiceType(): ?string
{
return $this->invoiceType;
}
public function setInvoiceType(?string $invoiceType): self
{
$this->invoiceType = $invoiceType;
return $this;
}
public function getInvoiceNumber(): ?int
{
return $this->invoiceNumber;
}
public function setInvoiceNumber(?int $invoiceNumber): self
{
$this->invoiceNumber = $invoiceNumber;
return $this;
}
public function getSupplier(): ?Accounts
{
return $this->supplier;
}
public function setSupplier(?Accounts $supplier): self
{
$this->supplier = $supplier;
return $this;
}
public function getIddoc(): ?string
{
return $this->iddoc;
}
public function setIddoc(?string $iddoc): self
{
$this->iddoc = $iddoc;
return $this;
}
public function isSynced(): ?bool
{
return $this->synced;
}
public function setSynced(?bool $synced): self
{
$this->synced = $synced;
return $this;
}
public function getCurrency(): ?string
{
return $this->currency;
}
public function setCurrency(?string $currency): self
{
$this->currency = $currency;
return $this;
}
public function getCurrencyRate(): ?float
{
return $this->currency_rate;
}
public function setCurrencyRate(?float $currency_rate): self
{
$this->currency_rate = $currency_rate;
return $this;
}
public function getTotal(): ?float
{
return $this->total;
}
public function setTotal(?float $total): self
{
$this->total = $total;
return $this;
}
public function getTotalNds(): ?float
{
return $this->total_nds;
}
public function setTotalNds(?float $total_nds): self
{
$this->total_nds = $total_nds;
return $this;
}
public function getCode1c(): ?string
{
return $this->code_1c;
}
public function setCode1c(?string $code_1c): self
{
$this->code_1c = $code_1c;
return $this;
}
public function getStorage(): ?Storage
{
return $this->storage;
}
public function setStorage(?Storage $storage): self
{
$this->storage = $storage;
return $this;
}
public function getIncomingInvoiceCstm(): ?IncomingInvoiceCstm
{
return $this->incomingInvoiceCstm;
}
public function setIncomingInvoiceCstm(?IncomingInvoiceCstm $incomingInvoiceCstm): self
{
// unset the owning side of the relation if necessary
if ($incomingInvoiceCstm === null && $this->incomingInvoiceCstm !== null) {
$this->incomingInvoiceCstm->setC(null);
}
// set the owning side of the relation if necessary
if ($incomingInvoiceCstm !== null && $incomingInvoiceCstm->getC() !== $this) {
$incomingInvoiceCstm->setC($this);
}
$this->incomingInvoiceCstm = $incomingInvoiceCstm;
return $this;
}
/**
* @return Collection<int, IncomingInvoiceProduct>
*/
public function getIncomingInvoiceProducts(): Collection
{
return $this->incomingInvoiceProducts;
}
public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
{
if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
$this->incomingInvoiceProducts->add($incomingInvoiceProduct);
$incomingInvoiceProduct->setIncomingInvoice($this);
}
return $this;
}
public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
{
if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
// set the owning side to null (unless already changed)
if ($incomingInvoiceProduct->getIncomingInvoice() === $this) {
$incomingInvoiceProduct->setIncomingInvoice(null);
}
}
return $this;
}
}