<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\UuidInterface;
use Ramsey\Uuid\Doctrine\UuidGenerator;
/**
* @ORM\Entity()
*/
class Documento
{
public const TYPE_INVOICE = 'invoice';
public const TYPE_PROFORMA = 'pro forma';
public const TYPE_ORDER = 'order';
public const TYPE_QUOTATION = 'quotation';
/**
* @var UuidInterface
*
* @ORM\Id()
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private $uid;
/**
* Tipologia del documento = ['fattura' o 'proforma' o 'ordine' o 'preventivo' o 'ndc'],
*
* @var string
*
* @ORM\Column(type="string")
*/
private $type = self::TYPE_INVOICE;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="documents")
*/
private $issuer;
/**
* @var Cliente
*
* @ORM\ManyToOne(targetEntity=Cliente::class, inversedBy="documenti")
*/
private $client;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerName;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerAddress;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerAddress2;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerZip;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerCity;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerState;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerCountry;
/**
* Partita IVA cliente/fornitore
*
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerVat;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $issuerFiscalCode;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientName;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientAddress;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientAddress2;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientZip;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientCity;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientState;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientCountry;
/**
* Partita IVA cliente/fornitore
*
* @var string
*
* @ORM\Column(type="string")
*/
private $clientVat;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $clientFiscalCode;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $number;
/**
* @var string
*
* @ORM\Column(type="string")
*/
private $sectional;
/**
* @var \DateTime
*
* @ORM\Column(type="date")
*/
private $date;
/**
* @var \DateTime|null
*
* @ORM\Column(type="date", nullable=true)
*/
private $nextDueDate;
/**
* Importo netto del documento (competenze)
*
* @var double
*
* @ORM\Column(type="float")
*/
private $subtotal;
/**
* Importo dell'IVA del documento (competenze)
*
* @var double
*
* @ORM\Column(type="float")
*/
private $totalVat;
/**
* Importo lordo del documento (totale da pagare)
*
* @var double
*
* @ORM\Column(type="float")
*/
private $total;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $socialSecurityContribution;
/**
* Percentuale Rivalsa INPS
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $socialSecurityContributionRate;
/**
* Imponibile Rivalsa INPS
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $socialSecurityContributionSubtotal;
/**
* Totale Rivalsa INPS
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $socialSecurityContributionAmount;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $withholding;
/**
* Tipologia ritenuta
*
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $withholdingType;
/**
* Percentuale ritenuta
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $withholdingRate;
/**
* Imponibile ritenuta
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $withholdingSubtotal;
/**
* Importo ritenuta
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $withholdingAmount;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $pensionFund;
/**
* Tipologia cassa pensionistica
*
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $pensionFundType;
/**
* Percentuale cassa pensionistica
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $pensionFundRate;
/**
* Imponibile cassa pensionistica
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $pensionFundSubtotal;
/**
* Importo cassa pensionistica
*
* @var double|null
*
* @ORM\Column(type="float", nullable=true)
*/
private $pensionFundAmount;
/**
* @var string|null
*
* @ORM\Column(type="string", nullable=true)
*/
private $reason;
/**
* @var string|null
*
* @ORM\Column(type="string", nullable=true)
*/
private $internalReason;
/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
private $notes;
/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
private $internalNotes;
/**
* Lista degli articoli/righe del documento
*
* @var DocumentoRiga[]|null
*
* @ORM\OneToMany(targetEntity="DocumentoRiga", mappedBy="document", cascade={"persist"})
* @ORM\JoinColumn(referencedColumnName="uid")
*/
private $rows;
/**
* @var DocumentoScadenza[]|null
*
* @ORM\OneToMany(targetEntity="DocumentoScadenza", mappedBy="document", cascade={"persist"})
* @ORM\JoinColumn(referencedColumnName="uid")
*/
private $dueDates;
public function __toString(): string
{
return 'yeppah';
}
public function __construct()
{
// $this->rows = new ArrayCollection();
$this->dueDates = new ArrayCollection();
}
public function getUid(): UuidInterface
{
return $this->uid;
}
public function setUid(UuidInterface $uid): Documento
{
$this->uid = $uid;
return $this;
}
public function getType(): string
{
return $this->type;
}
public function setType(string $type): Documento
{
$this->type = $type;
return $this;
}
public function getIssuer(): User
{
return $this->issuer;
}
public function setIssuer(User $issuer): Documento
{
$this->issuer = $issuer;
return $this;
}
public function getClient():? Cliente
{
return $this->client;
}
public function setClient(Cliente $client): Documento
{
$this->client = $client;
return $this;
}
public function getIssuerName(): string
{
return $this->issuerName;
}
public function setIssuerName(string $issuerName): Documento
{
$this->issuerName = $issuerName;
return $this;
}
public function getIssuerAddress(): string
{
return $this->issuerAddress;
}
public function setIssuerAddress(string $issuerAddress): Documento
{
$this->issuerAddress = $issuerAddress;
return $this;
}
public function getIssuerAddress2(): string
{
return $this->issuerAddress2;
}
public function setIssuerAddress2(string $issuerAddress2): Documento
{
$this->issuerAddress2 = $issuerAddress2;
return $this;
}
public function getIssuerZip(): string
{
return $this->issuerZip;
}
public function setIssuerZip(string $issuerZip): Documento
{
$this->issuerZip = $issuerZip;
return $this;
}
public function getIssuerCity(): string
{
return $this->issuerCity;
}
public function setIssuerCity(string $issuerCity): Documento
{
$this->issuerCity = $issuerCity;
return $this;
}
public function getIssuerState(): string
{
return $this->issuerState;
}
public function setIssuerState(string $issuerState): Documento
{
$this->issuerState = $issuerState;
return $this;
}
public function getIssuerCountry(): string
{
return $this->issuerCountry;
}
public function setIssuerCountry(string $issuerCountry): Documento
{
$this->issuerCountry = $issuerCountry;
return $this;
}
public function getIssuerVat(): string
{
return $this->issuerVat;
}
public function setIssuerVat(string $issuerVat): Documento
{
$this->issuerVat = $issuerVat;
return $this;
}
public function getIssuerFiscalCode(): string
{
return $this->issuerFiscalCode;
}
public function setIssuerFiscalCode(string $issuerFiscalCode): Documento
{
$this->issuerFiscalCode = $issuerFiscalCode;
return $this;
}
public function getClientName(): string
{
return $this->clientName;
}
public function setClientName(string $clientName): Documento
{
$this->clientName = $clientName;
return $this;
}
public function getClientAddress(): string
{
return $this->clientAddress;
}
public function setClientAddress(string $clientAddress): Documento
{
$this->clientAddress = $clientAddress;
return $this;
}
public function getClientAddress2(): string
{
return $this->clientAddress2;
}
public function setClientAddress2(string $clientAddress2): Documento
{
$this->clientAddress2 = $clientAddress2;
return $this;
}
public function getClientZip(): string
{
return $this->clientZip;
}
public function setClientZip(string $clientZip): Documento
{
$this->clientZip = $clientZip;
return $this;
}
public function getClientCity(): string
{
return $this->clientCity;
}
public function setClientCity(string $clientCity): Documento
{
$this->clientCity = $clientCity;
return $this;
}
public function getClientState(): string
{
return $this->clientState;
}
public function setClientState(string $clientState): Documento
{
$this->clientState = $clientState;
return $this;
}
public function getClientCountry(): string
{
return $this->clientCountry;
}
public function setClientCountry(string $clientCountry): Documento
{
$this->clientCountry = $clientCountry;
return $this;
}
public function getClientVat(): string
{
return $this->clientVat;
}
public function setClientVat(string $clientVat): Documento
{
$this->clientVat = $clientVat;
return $this;
}
public function getClientFiscalCode(): string
{
return $this->clientFiscalCode;
}
public function setClientFiscalCode(string $clientFiscalCode): Documento
{
$this->clientFiscalCode = $clientFiscalCode;
return $this;
}
public function getNumber(): string
{
return $this->number;
}
public function setNumber(string $number): Documento
{
$this->number = $number;
return $this;
}
public function getSectional(): string
{
return $this->sectional;
}
public function setSectional(string $sectional): Documento
{
$this->sectional = $sectional;
return $this;
}
public function getDate():? \DateTime
{
return $this->date;
}
public function setDate(\DateTime $date): Documento
{
$this->date = $date;
return $this;
}
public function getNextDueDate(): ?\DateTime
{
return $this->nextDueDate;
}
public function setNextDueDate(?\DateTime $nextDueDate): Documento
{
$this->nextDueDate = $nextDueDate;
return $this;
}
public function getSubtotal(): float
{
return $this->subtotal;
}
public function setSubtotal(float $subtotal): Documento
{
$this->subtotal = $subtotal;
return $this;
}
public function getTotalVat(): float
{
return $this->totalVat;
}
public function setTotalVat(float $totalVat): Documento
{
$this->totalVat = $totalVat;
return $this;
}
public function getTotal(): float
{
return $this->total;
}
public function setTotal(float $total): Documento
{
$this->total = $total;
return $this;
}
public function isSocialSecurityContribution(): bool
{
return $this->socialSecurityContribution;
}
public function setSocialSecurityContribution(bool $socialSecurityContribution): Documento
{
$this->socialSecurityContribution = $socialSecurityContribution;
return $this;
}
public function getSocialSecurityContributionRate(): ?float
{
return $this->socialSecurityContributionRate;
}
public function setSocialSecurityContributionRate(?float $socialSecurityContributionRate): Documento
{
$this->socialSecurityContributionRate = $socialSecurityContributionRate;
return $this;
}
public function getSocialSecurityContributionSubtotal(): ?float
{
return $this->socialSecurityContributionSubtotal;
}
public function setSocialSecurityContributionSubtotal(?float $socialSecurityContributionSubtotal): Documento
{
$this->socialSecurityContributionSubtotal = $socialSecurityContributionSubtotal;
return $this;
}
public function getSocialSecurityContributionAmount(): ?float
{
return $this->socialSecurityContributionAmount;
}
public function setSocialSecurityContributionAmount(?float $socialSecurityContributionAmount): Documento
{
$this->socialSecurityContributionAmount = $socialSecurityContributionAmount;
return $this;
}
public function isWithholding(): bool
{
return $this->withholding;
}
public function setWithholding(bool $withholding): Documento
{
$this->withholding = $withholding;
return $this;
}
public function getWithholdingType(): string
{
return $this->withholdingType;
}
public function setWithholdingType(string $withholdingType): Documento
{
$this->withholdingType = $withholdingType;
return $this;
}
public function getWithholdingRate(): ?float
{
return $this->withholdingRate;
}
public function setWithholdingRate(?float $withholdingRate): Documento
{
$this->withholdingRate = $withholdingRate;
return $this;
}
public function getWithholdingSubtotal(): ?float
{
return $this->withholdingSubtotal;
}
public function setWithholdingSubtotal(?float $withholdingSubtotal): Documento
{
$this->withholdingSubtotal = $withholdingSubtotal;
return $this;
}
public function getWithholdingAmount(): ?float
{
return $this->withholdingAmount;
}
public function setWithholdingAmount(?float $withholdingAmount): Documento
{
$this->withholdingAmount = $withholdingAmount;
return $this;
}
public function isPensionFund(): bool
{
return $this->pensionFund;
}
public function setPensionFund(bool $pensionFund): Documento
{
$this->pensionFund = $pensionFund;
return $this;
}
public function getPensionFundType(): string
{
return $this->pensionFundType;
}
public function setPensionFundType(string $pensionFundType): Documento
{
$this->pensionFundType = $pensionFundType;
return $this;
}
public function getPensionFundRate(): ?float
{
return $this->pensionFundRate;
}
public function setPensionFundRate(?float $pensionFundRate): Documento
{
$this->pensionFundRate = $pensionFundRate;
return $this;
}
public function getPensionFundSubtotal(): ?float
{
return $this->pensionFundSubtotal;
}
public function setPensionFundSubtotal(?float $pensionFundSubtotal): Documento
{
$this->pensionFundSubtotal = $pensionFundSubtotal;
return $this;
}
public function getPensionFundAmount(): ?float
{
return $this->pensionFundAmount;
}
public function setPensionFundAmount(?float $pensionFundAmount): Documento
{
$this->pensionFundAmount = $pensionFundAmount;
return $this;
}
public function getReason(): ?string
{
return $this->reason;
}
public function setReason(?string $reason): Documento
{
$this->reason = $reason;
return $this;
}
public function getInternalReason(): ?string
{
return $this->internalReason;
}
public function setInternalReason(?string $internalReason): Documento
{
$this->internalReason = $internalReason;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): Documento
{
$this->notes = $notes;
return $this;
}
public function getInternalNotes(): ?string
{
return $this->internalNotes;
}
public function setInternalNotes(?string $internalNotes): Documento
{
$this->internalNotes = $internalNotes;
return $this;
}
public function getRows():? Collection
{
return $this->rows;
}
public function setRows(Collection $rows): Documento
{
$this->rows = $rows;
return $this;
}
public function getDueDates(): Collection
{
return $this->dueDates;
}
public function setDueDates(Collection $dueDates): Documento
{
$this->dueDates = $dueDates;
return $this;
}
public function getName()
{
return $this->getType().' '.$this->getNumber().'-'.$this->getSectional().'/'.$this->getDate()->format('Y');
}
}