src/Entity/Documento.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Ramsey\Uuid\UuidInterface;
  7. use Ramsey\Uuid\Doctrine\UuidGenerator;
  8. /**
  9.  * @ORM\Entity()
  10.  */
  11. class Documento
  12. {
  13.     public const TYPE_INVOICE 'invoice';
  14.     public const TYPE_PROFORMA 'pro forma';
  15.     public const TYPE_ORDER 'order';
  16.     public const TYPE_QUOTATION 'quotation';
  17.     /**
  18.      * @var UuidInterface
  19.      *
  20.      * @ORM\Id()
  21.      * @ORM\Column(type="uuid", unique=true)
  22.      * @ORM\GeneratedValue(strategy="CUSTOM")
  23.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  24.      */
  25.     private $uid;
  26.     /**
  27.      * Tipologia del documento = ['fattura' o 'proforma' o 'ordine' o 'preventivo' o 'ndc'],
  28.      *
  29.      * @var string
  30.      *
  31.      * @ORM\Column(type="string")
  32.      */
  33.     private $type self::TYPE_INVOICE;
  34.     /**
  35.      * @var User
  36.      *
  37.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="documents")
  38.      */
  39.     private $issuer;
  40.     /**
  41.      * @var Cliente
  42.      *
  43.      * @ORM\ManyToOne(targetEntity=Cliente::class, inversedBy="documenti")
  44.      */
  45.     private $client;
  46.     /**
  47.      * @var string
  48.      *
  49.      * @ORM\Column(type="string")
  50.      */
  51.     private $issuerName;
  52.     /**
  53.      * @var string
  54.      *
  55.      * @ORM\Column(type="string")
  56.      */
  57.     private $issuerAddress;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(type="string")
  62.      */
  63.     private $issuerAddress2;
  64.     /**
  65.      * @var string
  66.      *
  67.      * @ORM\Column(type="string")
  68.      */
  69.     private $issuerZip;
  70.     /**
  71.      * @var string
  72.      *
  73.      * @ORM\Column(type="string")
  74.      */
  75.     private $issuerCity;
  76.     /**
  77.      * @var string
  78.      *
  79.      * @ORM\Column(type="string")
  80.      */
  81.     private $issuerState;
  82.     /**
  83.      * @var string
  84.      *
  85.      * @ORM\Column(type="string")
  86.      */
  87.     private $issuerCountry;
  88.     /**
  89.      * Partita IVA cliente/fornitore
  90.      *
  91.      * @var string
  92.      *
  93.      * @ORM\Column(type="string")
  94.      */
  95.     private $issuerVat;
  96.     /**
  97.      * @var string
  98.      *
  99.      * @ORM\Column(type="string")
  100.      */
  101.     private $issuerFiscalCode;
  102.     /**
  103.      * @var string
  104.      *
  105.      * @ORM\Column(type="string")
  106.      */
  107.     private $clientName;
  108.     /**
  109.      * @var string
  110.      *
  111.      * @ORM\Column(type="string")
  112.      */
  113.     private $clientAddress;
  114.     /**
  115.      * @var string
  116.      *
  117.      * @ORM\Column(type="string")
  118.      */
  119.     private $clientAddress2;
  120.     /**
  121.      * @var string
  122.      *
  123.      * @ORM\Column(type="string")
  124.      */
  125.     private $clientZip;
  126.     /**
  127.      * @var string
  128.      *
  129.      * @ORM\Column(type="string")
  130.      */
  131.     private $clientCity;
  132.     /**
  133.      * @var string
  134.      *
  135.      * @ORM\Column(type="string")
  136.      */
  137.     private $clientState;
  138.     /**
  139.      * @var string
  140.      *
  141.      * @ORM\Column(type="string")
  142.      */
  143.     private $clientCountry;
  144.     /**
  145.      * Partita IVA cliente/fornitore
  146.      *
  147.      * @var string
  148.      *
  149.      * @ORM\Column(type="string")
  150.      */
  151.     private $clientVat;
  152.     /**
  153.      * @var string
  154.      *
  155.      * @ORM\Column(type="string")
  156.      */
  157.     private $clientFiscalCode;
  158.     /**
  159.      * @var string
  160.      *
  161.      * @ORM\Column(type="string")
  162.      */
  163.     private $number;
  164.     /**
  165.      * @var string
  166.      *
  167.      * @ORM\Column(type="string")
  168.      */
  169.     private $sectional;
  170.     /**
  171.      * @var \DateTime
  172.      *
  173.      * @ORM\Column(type="date")
  174.      */
  175.     private $date;
  176.     /**
  177.      * @var \DateTime|null
  178.      *
  179.      * @ORM\Column(type="date", nullable=true)
  180.      */
  181.     private $nextDueDate;
  182.     /**
  183.      * Importo netto del documento (competenze)
  184.      *
  185.      * @var double
  186.      *
  187.      * @ORM\Column(type="float")
  188.      */
  189.     private $subtotal;
  190.     /**
  191.      * Importo dell'IVA del documento (competenze)
  192.      *
  193.      * @var double
  194.      *
  195.      * @ORM\Column(type="float")
  196.      */
  197.     private $totalVat;
  198.     /**
  199.      * Importo lordo del documento (totale da pagare)
  200.      *
  201.      * @var double
  202.      *
  203.      * @ORM\Column(type="float")
  204.      */
  205.     private $total;
  206.     /**
  207.      * @var bool
  208.      *
  209.      * @ORM\Column(type="boolean")
  210.      */
  211.     private $socialSecurityContribution;
  212.     /**
  213.      * Percentuale Rivalsa INPS
  214.      *
  215.      * @var double|null
  216.      *
  217.      * @ORM\Column(type="float", nullable=true)
  218.      */
  219.     private $socialSecurityContributionRate;
  220.     /**
  221.      * Imponibile Rivalsa INPS
  222.      *
  223.      * @var double|null
  224.      *
  225.      * @ORM\Column(type="float", nullable=true)
  226.      */
  227.     private $socialSecurityContributionSubtotal;
  228.     /**
  229.      * Totale Rivalsa INPS
  230.      *
  231.      * @var double|null
  232.      *
  233.      * @ORM\Column(type="float", nullable=true)
  234.      */
  235.     private $socialSecurityContributionAmount;
  236.     /**
  237.      * @var bool
  238.      *
  239.      * @ORM\Column(type="boolean")
  240.      */
  241.     private $withholding;
  242.     /**
  243.      * Tipologia ritenuta
  244.      *
  245.      * @var string
  246.      *
  247.      * @ORM\Column(type="string", nullable=true)
  248.      */
  249.     private $withholdingType;
  250.     /**
  251.      * Percentuale ritenuta
  252.      *
  253.      * @var double|null
  254.      *
  255.      * @ORM\Column(type="float", nullable=true)
  256.      */
  257.     private $withholdingRate;
  258.     /**
  259.      * Imponibile ritenuta
  260.      *
  261.      * @var double|null
  262.      *
  263.      * @ORM\Column(type="float", nullable=true)
  264.      */
  265.     private $withholdingSubtotal;
  266.     /**
  267.      * Importo ritenuta
  268.      *
  269.      * @var double|null
  270.      *
  271.      * @ORM\Column(type="float", nullable=true)
  272.      */
  273.     private $withholdingAmount;
  274.     /**
  275.      * @var bool
  276.      *
  277.      * @ORM\Column(type="boolean")
  278.      */
  279.     private $pensionFund;
  280.     /**
  281.      * Tipologia cassa pensionistica
  282.      *
  283.      * @var string
  284.      *
  285.      * @ORM\Column(type="string", nullable=true)
  286.      */
  287.     private $pensionFundType;
  288.     /**
  289.      * Percentuale cassa pensionistica
  290.      *
  291.      * @var double|null
  292.      *
  293.      * @ORM\Column(type="float", nullable=true)
  294.      */
  295.     private $pensionFundRate;
  296.     /**
  297.      * Imponibile cassa pensionistica
  298.      *
  299.      * @var double|null
  300.      *
  301.      * @ORM\Column(type="float", nullable=true)
  302.      */
  303.     private $pensionFundSubtotal;
  304.     /**
  305.      * Importo cassa pensionistica
  306.      *
  307.      * @var double|null
  308.      *
  309.      * @ORM\Column(type="float", nullable=true)
  310.      */
  311.     private $pensionFundAmount;
  312.     /**
  313.      * @var string|null
  314.      *
  315.      * @ORM\Column(type="string", nullable=true)
  316.      */
  317.     private $reason;
  318.     /**
  319.      * @var string|null
  320.      *
  321.      * @ORM\Column(type="string", nullable=true)
  322.      */
  323.     private $internalReason;
  324.     /**
  325.      * @var string|null
  326.      *
  327.      * @ORM\Column(type="text", nullable=true)
  328.      */
  329.     private $notes;
  330.     /**
  331.      * @var string|null
  332.      *
  333.      * @ORM\Column(type="text", nullable=true)
  334.      */
  335.     private $internalNotes;
  336.     /**
  337.      * Lista degli articoli/righe del documento
  338.      *
  339.      * @var DocumentoRiga[]|null
  340.      *
  341.      * @ORM\OneToMany(targetEntity="DocumentoRiga", mappedBy="document", cascade={"persist"})
  342.      * @ORM\JoinColumn(referencedColumnName="uid")
  343.      */
  344.     private $rows;
  345.     /**
  346.      * @var DocumentoScadenza[]|null
  347.      *
  348.      * @ORM\OneToMany(targetEntity="DocumentoScadenza", mappedBy="document", cascade={"persist"})
  349.      * @ORM\JoinColumn(referencedColumnName="uid")
  350.      */
  351.     private $dueDates;
  352.     public function __toString(): string
  353.     {
  354.         return 'yeppah';
  355.     }
  356.     public function __construct()
  357.     {
  358. //        $this->rows  = new ArrayCollection();
  359.         $this->dueDates = new ArrayCollection();
  360.     }
  361.     public function getUid(): UuidInterface
  362.     {
  363.         return $this->uid;
  364.     }
  365.     public function setUid(UuidInterface $uid): Documento
  366.     {
  367.         $this->uid $uid;
  368.         return $this;
  369.     }
  370.     public function getType(): string
  371.     {
  372.         return $this->type;
  373.     }
  374.     public function setType(string $type): Documento
  375.     {
  376.         $this->type $type;
  377.         return $this;
  378.     }
  379.     public function getIssuer(): User
  380.     {
  381.         return $this->issuer;
  382.     }
  383.     public function setIssuer(User $issuer): Documento
  384.     {
  385.         $this->issuer $issuer;
  386.         return $this;
  387.     }
  388.     public function getClient():? Cliente
  389.     {
  390.         return $this->client;
  391.     }
  392.     public function setClient(Cliente $client): Documento
  393.     {
  394.         $this->client $client;
  395.         return $this;
  396.     }
  397.     public function getIssuerName(): string
  398.     {
  399.         return $this->issuerName;
  400.     }
  401.     public function setIssuerName(string $issuerName): Documento
  402.     {
  403.         $this->issuerName $issuerName;
  404.         return $this;
  405.     }
  406.     public function getIssuerAddress(): string
  407.     {
  408.         return $this->issuerAddress;
  409.     }
  410.     public function setIssuerAddress(string $issuerAddress): Documento
  411.     {
  412.         $this->issuerAddress $issuerAddress;
  413.         return $this;
  414.     }
  415.     public function getIssuerAddress2(): string
  416.     {
  417.         return $this->issuerAddress2;
  418.     }
  419.     public function setIssuerAddress2(string $issuerAddress2): Documento
  420.     {
  421.         $this->issuerAddress2 $issuerAddress2;
  422.         return $this;
  423.     }
  424.     public function getIssuerZip(): string
  425.     {
  426.         return $this->issuerZip;
  427.     }
  428.     public function setIssuerZip(string $issuerZip): Documento
  429.     {
  430.         $this->issuerZip $issuerZip;
  431.         return $this;
  432.     }
  433.     public function getIssuerCity(): string
  434.     {
  435.         return $this->issuerCity;
  436.     }
  437.     public function setIssuerCity(string $issuerCity): Documento
  438.     {
  439.         $this->issuerCity $issuerCity;
  440.         return $this;
  441.     }
  442.     public function getIssuerState(): string
  443.     {
  444.         return $this->issuerState;
  445.     }
  446.     public function setIssuerState(string $issuerState): Documento
  447.     {
  448.         $this->issuerState $issuerState;
  449.         return $this;
  450.     }
  451.     public function getIssuerCountry(): string
  452.     {
  453.         return $this->issuerCountry;
  454.     }
  455.     public function setIssuerCountry(string $issuerCountry): Documento
  456.     {
  457.         $this->issuerCountry $issuerCountry;
  458.         return $this;
  459.     }
  460.     public function getIssuerVat(): string
  461.     {
  462.         return $this->issuerVat;
  463.     }
  464.     public function setIssuerVat(string $issuerVat): Documento
  465.     {
  466.         $this->issuerVat $issuerVat;
  467.         return $this;
  468.     }
  469.     public function getIssuerFiscalCode(): string
  470.     {
  471.         return $this->issuerFiscalCode;
  472.     }
  473.     public function setIssuerFiscalCode(string $issuerFiscalCode): Documento
  474.     {
  475.         $this->issuerFiscalCode $issuerFiscalCode;
  476.         return $this;
  477.     }
  478.     public function getClientName(): string
  479.     {
  480.         return $this->clientName;
  481.     }
  482.     public function setClientName(string $clientName): Documento
  483.     {
  484.         $this->clientName $clientName;
  485.         return $this;
  486.     }
  487.     public function getClientAddress(): string
  488.     {
  489.         return $this->clientAddress;
  490.     }
  491.     public function setClientAddress(string $clientAddress): Documento
  492.     {
  493.         $this->clientAddress $clientAddress;
  494.         return $this;
  495.     }
  496.     public function getClientAddress2(): string
  497.     {
  498.         return $this->clientAddress2;
  499.     }
  500.     public function setClientAddress2(string $clientAddress2): Documento
  501.     {
  502.         $this->clientAddress2 $clientAddress2;
  503.         return $this;
  504.     }
  505.     public function getClientZip(): string
  506.     {
  507.         return $this->clientZip;
  508.     }
  509.     public function setClientZip(string $clientZip): Documento
  510.     {
  511.         $this->clientZip $clientZip;
  512.         return $this;
  513.     }
  514.     public function getClientCity(): string
  515.     {
  516.         return $this->clientCity;
  517.     }
  518.     public function setClientCity(string $clientCity): Documento
  519.     {
  520.         $this->clientCity $clientCity;
  521.         return $this;
  522.     }
  523.     public function getClientState(): string
  524.     {
  525.         return $this->clientState;
  526.     }
  527.     public function setClientState(string $clientState): Documento
  528.     {
  529.         $this->clientState $clientState;
  530.         return $this;
  531.     }
  532.     public function getClientCountry(): string
  533.     {
  534.         return $this->clientCountry;
  535.     }
  536.     public function setClientCountry(string $clientCountry): Documento
  537.     {
  538.         $this->clientCountry $clientCountry;
  539.         return $this;
  540.     }
  541.     public function getClientVat(): string
  542.     {
  543.         return $this->clientVat;
  544.     }
  545.     public function setClientVat(string $clientVat): Documento
  546.     {
  547.         $this->clientVat $clientVat;
  548.         return $this;
  549.     }
  550.     public function getClientFiscalCode(): string
  551.     {
  552.         return $this->clientFiscalCode;
  553.     }
  554.     public function setClientFiscalCode(string $clientFiscalCode): Documento
  555.     {
  556.         $this->clientFiscalCode $clientFiscalCode;
  557.         return $this;
  558.     }
  559.     public function getNumber(): string
  560.     {
  561.         return $this->number;
  562.     }
  563.     public function setNumber(string $number): Documento
  564.     {
  565.         $this->number $number;
  566.         return $this;
  567.     }
  568.     public function getSectional(): string
  569.     {
  570.         return $this->sectional;
  571.     }
  572.     public function setSectional(string $sectional): Documento
  573.     {
  574.         $this->sectional $sectional;
  575.         return $this;
  576.     }
  577.     public function getDate():? \DateTime
  578.     {
  579.         return $this->date;
  580.     }
  581.     public function setDate(\DateTime $date): Documento
  582.     {
  583.         $this->date $date;
  584.         return $this;
  585.     }
  586.     public function getNextDueDate(): ?\DateTime
  587.     {
  588.         return $this->nextDueDate;
  589.     }
  590.     public function setNextDueDate(?\DateTime $nextDueDate): Documento
  591.     {
  592.         $this->nextDueDate $nextDueDate;
  593.         return $this;
  594.     }
  595.     public function getSubtotal(): float
  596.     {
  597.         return $this->subtotal;
  598.     }
  599.     public function setSubtotal(float $subtotal): Documento
  600.     {
  601.         $this->subtotal $subtotal;
  602.         return $this;
  603.     }
  604.     public function getTotalVat(): float
  605.     {
  606.         return $this->totalVat;
  607.     }
  608.     public function setTotalVat(float $totalVat): Documento
  609.     {
  610.         $this->totalVat $totalVat;
  611.         return $this;
  612.     }
  613.     public function getTotal(): float
  614.     {
  615.         return $this->total;
  616.     }
  617.     public function setTotal(float $total): Documento
  618.     {
  619.         $this->total $total;
  620.         return $this;
  621.     }
  622.     public function isSocialSecurityContribution(): bool
  623.     {
  624.         return $this->socialSecurityContribution;
  625.     }
  626.     public function setSocialSecurityContribution(bool $socialSecurityContribution): Documento
  627.     {
  628.         $this->socialSecurityContribution $socialSecurityContribution;
  629.         return $this;
  630.     }
  631.     public function getSocialSecurityContributionRate(): ?float
  632.     {
  633.         return $this->socialSecurityContributionRate;
  634.     }
  635.     public function setSocialSecurityContributionRate(?float $socialSecurityContributionRate): Documento
  636.     {
  637.         $this->socialSecurityContributionRate $socialSecurityContributionRate;
  638.         return $this;
  639.     }
  640.     public function getSocialSecurityContributionSubtotal(): ?float
  641.     {
  642.         return $this->socialSecurityContributionSubtotal;
  643.     }
  644.     public function setSocialSecurityContributionSubtotal(?float $socialSecurityContributionSubtotal): Documento
  645.     {
  646.         $this->socialSecurityContributionSubtotal $socialSecurityContributionSubtotal;
  647.         return $this;
  648.     }
  649.     public function getSocialSecurityContributionAmount(): ?float
  650.     {
  651.         return $this->socialSecurityContributionAmount;
  652.     }
  653.     public function setSocialSecurityContributionAmount(?float $socialSecurityContributionAmount): Documento
  654.     {
  655.         $this->socialSecurityContributionAmount $socialSecurityContributionAmount;
  656.         return $this;
  657.     }
  658.     public function isWithholding(): bool
  659.     {
  660.         return $this->withholding;
  661.     }
  662.     public function setWithholding(bool $withholding): Documento
  663.     {
  664.         $this->withholding $withholding;
  665.         return $this;
  666.     }
  667.     public function getWithholdingType(): string
  668.     {
  669.         return $this->withholdingType;
  670.     }
  671.     public function setWithholdingType(string $withholdingType): Documento
  672.     {
  673.         $this->withholdingType $withholdingType;
  674.         return $this;
  675.     }
  676.     public function getWithholdingRate(): ?float
  677.     {
  678.         return $this->withholdingRate;
  679.     }
  680.     public function setWithholdingRate(?float $withholdingRate): Documento
  681.     {
  682.         $this->withholdingRate $withholdingRate;
  683.         return $this;
  684.     }
  685.     public function getWithholdingSubtotal(): ?float
  686.     {
  687.         return $this->withholdingSubtotal;
  688.     }
  689.     public function setWithholdingSubtotal(?float $withholdingSubtotal): Documento
  690.     {
  691.         $this->withholdingSubtotal $withholdingSubtotal;
  692.         return $this;
  693.     }
  694.     public function getWithholdingAmount(): ?float
  695.     {
  696.         return $this->withholdingAmount;
  697.     }
  698.     public function setWithholdingAmount(?float $withholdingAmount): Documento
  699.     {
  700.         $this->withholdingAmount $withholdingAmount;
  701.         return $this;
  702.     }
  703.     public function isPensionFund(): bool
  704.     {
  705.         return $this->pensionFund;
  706.     }
  707.     public function setPensionFund(bool $pensionFund): Documento
  708.     {
  709.         $this->pensionFund $pensionFund;
  710.         return $this;
  711.     }
  712.     public function getPensionFundType(): string
  713.     {
  714.         return $this->pensionFundType;
  715.     }
  716.     public function setPensionFundType(string $pensionFundType): Documento
  717.     {
  718.         $this->pensionFundType $pensionFundType;
  719.         return $this;
  720.     }
  721.     public function getPensionFundRate(): ?float
  722.     {
  723.         return $this->pensionFundRate;
  724.     }
  725.     public function setPensionFundRate(?float $pensionFundRate): Documento
  726.     {
  727.         $this->pensionFundRate $pensionFundRate;
  728.         return $this;
  729.     }
  730.     public function getPensionFundSubtotal(): ?float
  731.     {
  732.         return $this->pensionFundSubtotal;
  733.     }
  734.     public function setPensionFundSubtotal(?float $pensionFundSubtotal): Documento
  735.     {
  736.         $this->pensionFundSubtotal $pensionFundSubtotal;
  737.         return $this;
  738.     }
  739.     public function getPensionFundAmount(): ?float
  740.     {
  741.         return $this->pensionFundAmount;
  742.     }
  743.     public function setPensionFundAmount(?float $pensionFundAmount): Documento
  744.     {
  745.         $this->pensionFundAmount $pensionFundAmount;
  746.         return $this;
  747.     }
  748.     public function getReason(): ?string
  749.     {
  750.         return $this->reason;
  751.     }
  752.     public function setReason(?string $reason): Documento
  753.     {
  754.         $this->reason $reason;
  755.         return $this;
  756.     }
  757.     public function getInternalReason(): ?string
  758.     {
  759.         return $this->internalReason;
  760.     }
  761.     public function setInternalReason(?string $internalReason): Documento
  762.     {
  763.         $this->internalReason $internalReason;
  764.         return $this;
  765.     }
  766.     public function getNotes(): ?string
  767.     {
  768.         return $this->notes;
  769.     }
  770.     public function setNotes(?string $notes): Documento
  771.     {
  772.         $this->notes $notes;
  773.         return $this;
  774.     }
  775.     public function getInternalNotes(): ?string
  776.     {
  777.         return $this->internalNotes;
  778.     }
  779.     public function setInternalNotes(?string $internalNotes): Documento
  780.     {
  781.         $this->internalNotes $internalNotes;
  782.         return $this;
  783.     }
  784.     public function getRows():? Collection
  785.     {
  786.         return $this->rows;
  787.     }
  788.     public function setRows(Collection $rows): Documento
  789.     {
  790.         $this->rows $rows;
  791.         return $this;
  792.     }
  793.     public function getDueDates(): Collection
  794.     {
  795.         return $this->dueDates;
  796.     }
  797.     public function setDueDates(Collection $dueDates): Documento
  798.     {
  799.         $this->dueDates $dueDates;
  800.         return $this;
  801.     }
  802.     public function getName()
  803.     {
  804.         return $this->getType().' '.$this->getNumber().'-'.$this->getSectional().'/'.$this->getDate()->format('Y');
  805.     }
  806. }