src/Entity/SriInfo.php line 19

  1. <?php
  2. /*
  3.  *  @author Guerby Duval <info@tranzaksyon.com>
  4.  *  @link https://tranzaksyon.com
  5.  *  @copyright You are not allowed to remove this author "Guerby Duval <info@tranzaksyon.com>", the link "https://tranzaksyon.com" neither this copyright.
  6.  */
  7. namespace App\Entity;
  8. use App\Repository\SriInfoRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Component\Validator\Constraints\Length;
  14. use Symfony\Component\Validator\Constraints\NotBlank;
  15. #[ORM\Entity(repositoryClassSriInfoRepository::class)]
  16. class SriInfo
  17. {
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(length150)]
  23.     #[NotBlank(message'No se pudo recuperar la razón social del SRI.')]
  24.     #[Length(min3)]
  25.     private ?string $razonSocial null;
  26.     #[ORM\Column(length20)]
  27.     #[Length(min6max10)]
  28.     #[NotBlank(message'Por favor ingrese el RUC de la empresa o el Ruc es invalido.')]
  29.     private ?string $ruc null;
  30.     #[ORM\Column(length150nullabletrue)]
  31. //    #[NotBlank]
  32. //    #[Length(min: 3)]
  33.     private ?string $direction null;
  34.     #[ORM\Column(length60nullabletrue)]
  35. //    #[NotBlank]
  36. //    #[Length(min: 3)]
  37. //    #[Email]
  38.     private ?string $email null;
  39.     #[ORM\Column(length3nullabletrue)]
  40. //    #[NotBlank]
  41. //    #[Length(min: 3, max: 3)]
  42.     private ?string $serie1 null;
  43.     #[ORM\Column(length3nullabletrue)]
  44. //    #[NotBlank]
  45. //    #[Length(min: 3, max: 3)]
  46.     private ?string $serie2 null;
  47.     #[ORM\ManyToOne(cascade: ['remove'], inversedBy'sriInfos')]
  48.     #[ORM\JoinColumn(nullablefalse)]
  49.     private ?User $user null;
  50.     #[ORM\Column(nullabletrue)]
  51. //    #[NotNull(message: 'No se pudo recuperar si es obligado llevar contabilidad del SRI.')]
  52.     private ?bool $obligadoContabilidad null;
  53.     #[ORM\ManyToOne(cascade: ['remove'], fetch'LAZY'inversedBy'sriInfos')]
  54.     private ?Certificate $certificate null;
  55.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntitySequence::class, cascade: ['persist'], orphanRemovaltrue)]
  56.     private Collection $sequences;
  57.     #[ORM\Column(length255nullabletrue)]
  58.     private ?string $logo null;
  59.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntityInvoice::class, orphanRemovaltrue)]
  60.     private Collection $invoices;
  61.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntityTax::class, orphanRemovaltrue)]
  62.     private Collection $taxes;
  63.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntityProduct::class, orphanRemovaltrue)]
  64.     private Collection $products;
  65.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntityClient::class, orphanRemovaltrue)]
  66.     private Collection $clients;
  67.     #[ORM\OneToOne(mappedBy'SriInfo'cascade: ['persist''remove'])]
  68.     private ?EmailConfiguration $emailConfiguration null;
  69.     #[ORM\Column(nullabletrue)]
  70.     private ?int $agenteRetencion null;
  71.     #[ORM\Column(nullabletrue)]
  72.     private ?bool $contribuyenteRimpe null;
  73.     #[ORM\Column(length20nullabletrue)]
  74.     private ?string $contribuyenteEspecial null;
  75.     #[ORM\OneToOne(mappedBy'company'cascade: ['persist''remove'])]
  76.     private ?SaasConfiguration $limits null;
  77.     #[ORM\OneToMany(mappedBy'company'targetEntitySucursal::class, orphanRemovaltrue)]
  78.     private Collection $sucursals;
  79.     #[ORM\ManyToOne(inversedBy'disableCompanies')]
  80.     private ?User $disabledBy null;
  81.     #[ORM\Column(length255nullabletrue)]
  82.     private ?string $contribuyenteRimpeText null;
  83.     #[ORM\Column(length15nullabletrue)]
  84.     private ?string $phone null;
  85.     #[ORM\OneToOne(mappedBy'company'cascade: ['persist''remove'])]
  86.     private ?AppConfig $appConfig null;
  87.     #[ORM\Column(length255nullabletrue)]
  88.     private ?string $leyenda null;
  89.     #[ORM\Column(length255nullabletrue)]
  90.     private ?string $commercialName null;
  91.     #[ORM\Column(nullabletrueoptions: ['default' => '0'])]
  92.     private ?bool $useCommercialName null;
  93.     #[ORM\OneToOne(inversedBy'sriInfo'cascade: ['persist''remove'])]
  94.     private ?Company $company null;
  95.     #[ORM\Column(length5nullabletrue)]
  96.     #[NotBlank]
  97.     #[Length(exactly4exactMessage'Tiene que ser 4 dígitos. Usar 0 como prefijo. Ejemplo: 0001')]
  98.     private ?string $idCSC null;
  99.     #[ORM\Column(length150nullabletrue)]
  100.     #[NotBlank]
  101.     private ?string $csc null;
  102.     #[ORM\Column(length60)]
  103.     #[NotBlank]
  104.     private ?string $timbrado null;
  105.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  106.     #[NotBlank]
  107.     private ?\DateTimeInterface $fechaTimbrado null;
  108.     #[ORM\Column(length10)]
  109.     #[NotBlank]
  110.     private ?string $tipoContribuyente null;
  111.     #[ORM\Column(length10)]
  112.     #[NotBlank]
  113.     private ?string $tipoRegimen null;
  114.     #[ORM\OneToMany(mappedBy'sriInfo'targetEntityActividadEconomica::class, orphanRemovaltrue)]
  115.     private Collection $actividadEconomicas;
  116.     #[ORM\OneToMany(mappedBy'company'targetEntitySriPayment::class)]
  117.     private Collection $sriPayments;
  118.     #[ORM\OneToMany(mappedBy'company'targetEntityPaymentCredit::class, orphanRemovaltrue)]
  119.     private Collection $paymentCredits;
  120.     #[ORM\Column(nullabletrue)]
  121.     private ?bool $demo null;
  122.     public function __construct()
  123.     {
  124.         $this->sequences = new ArrayCollection();
  125.         $this->invoices = new ArrayCollection();
  126.         $this->taxes = new ArrayCollection();
  127.         $this->products = new ArrayCollection();
  128.         $this->clients = new ArrayCollection();
  129.         $this->sucursals = new ArrayCollection();
  130.         $this->actividadEconomicas = new ArrayCollection();
  131.         $this->sriPayments = new ArrayCollection();
  132.         $this->paymentCredits = new ArrayCollection();
  133.     }
  134.     public function getId(): ?int
  135.     {
  136.         return $this->id;
  137.     }
  138.     public function getRazonSocial(): ?string
  139.     {
  140.         return $this->razonSocial;
  141.     }
  142.     public function setRazonSocial(string $razonSocial): self
  143.     {
  144.         $this->razonSocial $razonSocial;
  145.         return $this;
  146.     }
  147.     public function getRuc(): ?string
  148.     {
  149.         return $this->ruc;
  150.     }
  151.     public function setRuc(string $ruc): self
  152.     {
  153.         $this->ruc $ruc;
  154.         return $this;
  155.     }
  156.     public function getDirection(): ?string
  157.     {
  158.         return $this->direction;
  159.     }
  160.     public function setDirection(string $direction): self
  161.     {
  162.         $this->direction $direction;
  163.         return $this;
  164.     }
  165.     public function getEmail(): ?string
  166.     {
  167.         return $this->email;
  168.     }
  169.     public function setEmail(?string $email): self
  170.     {
  171.         $this->email $email;
  172.         return $this;
  173.     }
  174.     public function getSerie1(): ?string
  175.     {
  176.         return $this->serie1;
  177.     }
  178.     public function setSerie1(string $serie1): self
  179.     {
  180.         $this->serie1 $serie1;
  181.         return $this;
  182.     }
  183.     public function getSerie2(): ?string
  184.     {
  185.         return $this->serie2;
  186.     }
  187.     public function setSerie2(string $serie2): self
  188.     {
  189.         $this->serie2 $serie2;
  190.         return $this;
  191.     }
  192.     public function getUser(): ?User
  193.     {
  194.         return $this->user;
  195.     }
  196.     public function setUser(?User $user): self
  197.     {
  198.         $this->user $user;
  199.         return $this;
  200.     }
  201.     public function isObligadoContabilidad(): ?bool
  202.     {
  203.         return $this->obligadoContabilidad;
  204.     }
  205.     public function setObligadoContabilidad(bool $obligadoContabilidad): self
  206.     {
  207.         $this->obligadoContabilidad $obligadoContabilidad;
  208.         return $this;
  209.     }
  210.     public function getCertificate(): ?Certificate
  211.     {
  212.         return $this->certificate;
  213.     }
  214.     public function setCertificate(?Certificate $certificate): self
  215.     {
  216.         $this->certificate $certificate;
  217.         return $this;
  218.     }
  219.     /**
  220.      * @return Collection<int, Sequence>
  221.      */
  222.     public function getSequences(): Collection
  223.     {
  224.         return $this->sequences;
  225.     }
  226.     public function addSequence(Sequence $sequence): self
  227.     {
  228.         if (!$this->sequences->contains($sequence)) {
  229.             $this->sequences->add($sequence);
  230.             $sequence->setSriInfo($this);
  231.         }
  232.         return $this;
  233.     }
  234.     public function removeSequence(Sequence $sequence): self
  235.     {
  236.         if ($this->sequences->removeElement($sequence)) {
  237.             // set the owning side to null (unless already changed)
  238.             if ($sequence->getSriInfo() === $this) {
  239.                 $sequence->setSriInfo(null);
  240.             }
  241.         }
  242.         return $this;
  243.     }
  244.     public function getLogo(): ?string
  245.     {
  246.         return $this->logo;
  247.     }
  248.     public function setLogo(?string $logo): self
  249.     {
  250.         $this->logo $logo;
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection<int, Invoice>
  255.      */
  256.     public function getInvoices(): Collection
  257.     {
  258.         return $this->invoices;
  259.     }
  260.     public function addInvoice(Invoice $invoice): self
  261.     {
  262.         if (!$this->invoices->contains($invoice)) {
  263.             $this->invoices->add($invoice);
  264.             $invoice->setSriInfo($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeInvoice(Invoice $invoice): self
  269.     {
  270.         if ($this->invoices->removeElement($invoice)) {
  271.             // set the owning side to null (unless already changed)
  272.             if ($invoice->getSriInfo() === $this) {
  273.                 $invoice->setSriInfo(null);
  274.             }
  275.         }
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return Collection<int, Tax>
  280.      */
  281.     public function getTaxes(): Collection
  282.     {
  283.         return $this->taxes;
  284.     }
  285.     public function addTax(Tax $tax): self
  286.     {
  287.         if (!$this->taxes->contains($tax)) {
  288.             $this->taxes->add($tax);
  289.             $tax->setSriInfo($this);
  290.         }
  291.         return $this;
  292.     }
  293.     public function removeTax(Tax $tax): self
  294.     {
  295.         if ($this->taxes->removeElement($tax)) {
  296.             // set the owning side to null (unless already changed)
  297.             if ($tax->getSriInfo() === $this) {
  298.                 $tax->setSriInfo(null);
  299.             }
  300.         }
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection<int, Product>
  305.      */
  306.     public function getProducts(): Collection
  307.     {
  308.         return $this->products;
  309.     }
  310.     public function addProduct(Product $product): self
  311.     {
  312.         if (!$this->products->contains($product)) {
  313.             $this->products->add($product);
  314.             $product->setSriInfo($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removeProduct(Product $product): self
  319.     {
  320.         if ($this->products->removeElement($product)) {
  321.             // set the owning side to null (unless already changed)
  322.             if ($product->getSriInfo() === $this) {
  323.                 $product->setSriInfo(null);
  324.             }
  325.         }
  326.         return $this;
  327.     }
  328.     /**
  329.      * @return Collection<int, Client>
  330.      */
  331.     public function getClients(): Collection
  332.     {
  333.         return $this->clients;
  334.     }
  335.     public function addClient(Client $client): self
  336.     {
  337.         if (!$this->clients->contains($client)) {
  338.             $this->clients->add($client);
  339.             $client->setSriInfo($this);
  340.         }
  341.         return $this;
  342.     }
  343.     public function removeClient(Client $client): self
  344.     {
  345.         if ($this->clients->removeElement($client)) {
  346.             // set the owning side to null (unless already changed)
  347.             if ($client->getSriInfo() === $this) {
  348.                 $client->setSriInfo(null);
  349.             }
  350.         }
  351.         return $this;
  352.     }
  353.     public function getEmailConfiguration(): ?EmailConfiguration
  354.     {
  355.         return $this->emailConfiguration;
  356.     }
  357.     public function setEmailConfiguration(EmailConfiguration $emailConfiguration): self
  358.     {
  359.         // set the owning side of the relation if necessary
  360.         if ($emailConfiguration->getSriInfo() !== $this) {
  361.             $emailConfiguration->setSriInfo($this);
  362.         }
  363.         $this->emailConfiguration $emailConfiguration;
  364.         return $this;
  365.     }
  366.     public function getAgenteRetencion(): ?int
  367.     {
  368.         return $this->agenteRetencion;
  369.     }
  370.     public function setAgenteRetencion(?int $agenteRetencion): self
  371.     {
  372.         $this->agenteRetencion $agenteRetencion;
  373.         return $this;
  374.     }
  375.     public function isContribuyenteRimpe(): ?bool
  376.     {
  377.         return $this->contribuyenteRimpe;
  378.     }
  379.     public function setContribuyenteRimpe(?bool $contribuyenteRimpe): self
  380.     {
  381.         $this->contribuyenteRimpe $contribuyenteRimpe;
  382.         return $this;
  383.     }
  384.     public function getContribuyenteEspecial(): ?string
  385.     {
  386.         return $this->contribuyenteEspecial;
  387.     }
  388.     public function setContribuyenteEspecial(?string $contribuyenteEspecial): self
  389.     {
  390.         $this->contribuyenteEspecial $contribuyenteEspecial;
  391.         return $this;
  392.     }
  393.     public function getLimits(): ?SaasConfiguration
  394.     {
  395.         return $this->limits;
  396.     }
  397.     public function setLimits(SaasConfiguration $limits): self
  398.     {
  399.         // set the owning side of the relation if necessary
  400.         if ($limits->getCompany() !== $this) {
  401.             $limits->setCompany($this);
  402.         }
  403.         $this->limits $limits;
  404.         return $this;
  405.     }
  406.     /**
  407.      * @return Collection<int, Sucursal>
  408.      */
  409.     public function getSucursals(): Collection
  410.     {
  411.         return $this->sucursals;
  412.     }
  413.     public function addSucursal(Sucursal $sucursal): self
  414.     {
  415.         if (!$this->sucursals->contains($sucursal)) {
  416.             $this->sucursals->add($sucursal);
  417.             $sucursal->setCompany($this);
  418.         }
  419.         return $this;
  420.     }
  421.     public function removeSucursal(Sucursal $sucursal): self
  422.     {
  423.         if ($this->sucursals->removeElement($sucursal)) {
  424.             // set the owning side to null (unless already changed)
  425.             if ($sucursal->getCompany() === $this) {
  426.                 $sucursal->setCompany(null);
  427.             }
  428.         }
  429.         return $this;
  430.     }
  431.     public function getDisabledBy(): ?User
  432.     {
  433.         return $this->disabledBy;
  434.     }
  435.     public function setDisabledBy(?User $disabledBy): self
  436.     {
  437.         $this->disabledBy $disabledBy;
  438.         return $this;
  439.     }
  440.     public function getContribuyenteRimpeText(): ?string
  441.     {
  442.         return $this->contribuyenteRimpeText;
  443.     }
  444.     public function setContribuyenteRimpeText(?string $contribuyenteRimpeText): self
  445.     {
  446.         $this->contribuyenteRimpeText $contribuyenteRimpeText;
  447.         return $this;
  448.     }
  449.     public function getPhone(): ?string
  450.     {
  451.         return $this->phone;
  452.     }
  453.     public function setPhone(?string $phone): self
  454.     {
  455.         $this->phone $phone;
  456.         return $this;
  457.     }
  458.     public function getAppConfig(): ?AppConfig
  459.     {
  460.         return $this->appConfig;
  461.     }
  462.     public function setAppConfig(AppConfig $appConfig): self
  463.     {
  464.         // set the owning side of the relation if necessary
  465.         if ($appConfig->getCompany() !== $this) {
  466.             $appConfig->setCompany($this);
  467.         }
  468.         $this->appConfig $appConfig;
  469.         return $this;
  470.     }
  471.     public function getLeyenda(): ?string
  472.     {
  473.         return $this->leyenda;
  474.     }
  475.     public function setLeyenda(?string $leyenda): self
  476.     {
  477.         $this->leyenda $leyenda;
  478.         return $this;
  479.     }
  480.     public function getCommercialName(): ?string
  481.     {
  482.         return $this->commercialName;
  483.     }
  484.     public function setCommercialName(?string $commercialName): static
  485.     {
  486.         $this->commercialName $commercialName;
  487.         return $this;
  488.     }
  489.     public function isUseCommercialName(): ?bool
  490.     {
  491.         return $this->useCommercialName;
  492.     }
  493.     public function setUseCommercialName(bool $useCommercialName): static
  494.     {
  495.         $this->useCommercialName $useCommercialName;
  496.         return $this;
  497.     }
  498.     public function getCompany(): ?Company
  499.     {
  500.         return $this->company;
  501.     }
  502.     public function setCompany(?Company $company): static
  503.     {
  504.         $this->company $company;
  505.         return $this;
  506.     }
  507.     public function __toString(): string
  508.     {
  509.         return $this->getRazonSocial() . ' - ' $this->getRuc();
  510.     }
  511.     public function getIdCSC(): ?string
  512.     {
  513.         return $this->idCSC;
  514.     }
  515.     public function setIdCSC(?string $idCSC): static
  516.     {
  517.         $this->idCSC $idCSC;
  518.         return $this;
  519.     }
  520.     public function getCsc(): ?string
  521.     {
  522.         return $this->csc;
  523.     }
  524.     public function setCsc(?string $csc): static
  525.     {
  526.         $this->csc $csc;
  527.         return $this;
  528.     }
  529.     public function getTimbrado(): ?string
  530.     {
  531.         return $this->timbrado;
  532.     }
  533.     public function setTimbrado(?string $timbrado): static
  534.     {
  535.         $this->timbrado $timbrado;
  536.         return $this;
  537.     }
  538.     public function getFechaTimbrado(): ?\DateTimeInterface
  539.     {
  540.         return $this->fechaTimbrado;
  541.     }
  542.     public function setFechaTimbrado(?\DateTimeInterface $fechaTimbrado): static
  543.     {
  544.         $this->fechaTimbrado $fechaTimbrado;
  545.         return $this;
  546.     }
  547.     public function getTipoContribuyente(): ?string
  548.     {
  549.         return $this->tipoContribuyente;
  550.     }
  551.     public function setTipoContribuyente(?string $tipoContribuyente): static
  552.     {
  553.         $this->tipoContribuyente $tipoContribuyente;
  554.         return $this;
  555.     }
  556.     public function getTipoRegimen(): ?string
  557.     {
  558.         return $this->tipoRegimen;
  559.     }
  560.     public function setTipoRegimen(?string $tipoRegimen): static
  561.     {
  562.         $this->tipoRegimen $tipoRegimen;
  563.         return $this;
  564.     }
  565.     /**
  566.      * @return Collection<int, ActividadEconomica>
  567.      */
  568.     public function getActividadEconomicas(): Collection
  569.     {
  570.         return $this->actividadEconomicas;
  571.     }
  572.     public function addActividadEconomica(ActividadEconomica $actividadEconomica): static
  573.     {
  574.         if (!$this->actividadEconomicas->contains($actividadEconomica)) {
  575.             $this->actividadEconomicas->add($actividadEconomica);
  576.             $actividadEconomica->setSriInfo($this);
  577.         }
  578.         return $this;
  579.     }
  580.     public function removeActividadEconomica(ActividadEconomica $actividadEconomica): static
  581.     {
  582.         if ($this->actividadEconomicas->removeElement($actividadEconomica)) {
  583.             // set the owning side to null (unless already changed)
  584.             if ($actividadEconomica->getSriInfo() === $this) {
  585.                 $actividadEconomica->setSriInfo(null);
  586.             }
  587.         }
  588.         return $this;
  589.     }
  590.     /**
  591.      * @return Collection<int, SriPayment>
  592.      */
  593.     public function getSriPayments(): Collection
  594.     {
  595.         return $this->sriPayments;
  596.     }
  597.     public function addSriPayment(SriPayment $sriPayment): static
  598.     {
  599.         if (!$this->sriPayments->contains($sriPayment)) {
  600.             $this->sriPayments->add($sriPayment);
  601.             $sriPayment->setCompany($this);
  602.         }
  603.         return $this;
  604.     }
  605.     public function removeSriPayment(SriPayment $sriPayment): static
  606.     {
  607.         if ($this->sriPayments->removeElement($sriPayment)) {
  608.             // set the owning side to null (unless already changed)
  609.             if ($sriPayment->getCompany() === $this) {
  610.                 $sriPayment->setCompany(null);
  611.             }
  612.         }
  613.         return $this;
  614.     }
  615.     /**
  616.      * @return Collection<int, PaymentCredit>
  617.      */
  618.     public function getPaymentCredits(): Collection
  619.     {
  620.         return $this->paymentCredits;
  621.     }
  622.     public function addPaymentCredit(PaymentCredit $paymentCredit): static
  623.     {
  624.         if (!$this->paymentCredits->contains($paymentCredit)) {
  625.             $this->paymentCredits->add($paymentCredit);
  626.             $paymentCredit->setCompany($this);
  627.         }
  628.         return $this;
  629.     }
  630.     public function removePaymentCredit(PaymentCredit $paymentCredit): static
  631.     {
  632.         if ($this->paymentCredits->removeElement($paymentCredit)) {
  633.             // set the owning side to null (unless already changed)
  634.             if ($paymentCredit->getCompany() === $this) {
  635.                 $paymentCredit->setCompany(null);
  636.             }
  637.         }
  638.         return $this;
  639.     }
  640.     public function isDemo(): ?bool
  641.     {
  642.         return $this->demo;
  643.     }
  644.     public function setDemo(?bool $demo): static
  645.     {
  646.         $this->demo $demo;
  647.         return $this;
  648.     }
  649. }