<?php
namespace AdminBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Company Invoice
*/
#[ORM\Table(name: 'company_invoice')]
#[ORM\Entity(repositoryClass: \AdminBundle\Repository\CompanyInvoiceRepository::class)]
class CompanyInvoice extends BaseEntity
{
const PAYMENT_STATUS_PENDING = 0;
const PAYMENT_STATUS_PAID = 1;
const INVOICE_PENDING_APPROVAL = 0;
const INVOICE_APPROVED = 1;
public static $invoiceApproval = array(
self::INVOICE_PENDING_APPROVAL => 'Pending',
self::INVOICE_APPROVED => 'Approved',
);
public static $paymentStatuses = array(
self::PAYMENT_STATUS_PENDING => 'Pending',
self::PAYMENT_STATUS_PAID => 'Paid',
);
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var integer
*/
#[ORM\Column(name: 'week', type: 'integer')]
protected $week;
/**
* @var integer
*/
#[ORM\Column(name: 'invoice_month', type: 'integer')]
protected $invoiceMonth;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'creation_date', type: 'datetime', nullable: true)]
protected $creationDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)]
protected $startDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)]
protected $endDate;
/**
* @var double
*/
#[ORM\Column(name: 'total_invoice_balance', type: 'decimal', scale: 2)]
protected $totalInvoiceBalance=0;
/**
* @var double
*/
#[ORM\Column(name: 'total_general_adjustment_amount', type: 'decimal', scale: 2)]
protected $totalGeneralAdjustmentAmount=0;
/**
* @var string
*/
#[ORM\Column(name: 'pdf_file', type: 'string', length: 255, nullable: true)]
protected $pdfFile;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'pdf_gen_date', type: 'datetime', nullable: true)]
protected $pdfGenDate;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\CompanyInvoiceItem::class, mappedBy: 'invoice')]
public $invoiceItems;
/**
* @var Company
*/
#[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Company::class, inversedBy: 'companyInvoices')]
private $company;
/**
* @var integer
*/
#[ORM\Column(name: 'payment_status', type: 'integer')]
protected $status = self::PAYMENT_STATUS_PENDING;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'sent_date', type: 'datetime', nullable: true)]
protected $sentDate;
/**
* @var boolean
*/
#[ORM\Column(name: 'ready_to_send', type: 'boolean', options: ['default' => false])]
protected $readyToSend = false;
/**
* @var integer
*/
#[ORM\Column(name: 'approval', type: 'integer')]
protected $approval = self::INVOICE_PENDING_APPROVAL;
/**
* Constructor
*/
public function __construct()
{
$this->invoiceItems = new \Doctrine\Common\Collections\ArrayCollection();
$this->creationDate = new \DateTime();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return \DateTime
*/
public function getCreationDate(): \DateTime
{
return $this->creationDate;
}
/**
* @param \DateTime $creationDate
*/
public function setCreationDate(\DateTime $creationDate)
{
$this->creationDate = $creationDate;
}
/**
* @return float
*/
public function getTotalInvoiceBalance(): float
{
return $this->totalInvoiceBalance;
}
/**
* @param float $totalInvoiceBalance
*/
public function setTotalInvoiceBalance(float $totalInvoiceBalance)
{
$this->totalInvoiceBalance = $totalInvoiceBalance;
}
/**
* @return float
*/
public function getTotalGeneralAdjustmentAmount()
{
return $this->totalGeneralAdjustmentAmount;
}
/**
* @param float $totalGeneralAdjustmentAmount
*/
public function setTotalGeneralAdjustmentAmount(float $totalGeneralAdjustmentAmount)
{
$this->totalGeneralAdjustmentAmount = $totalGeneralAdjustmentAmount;
}
/**
* @return string
*/
public function getPdfFile()
{
return $this->pdfFile;
}
/**
* @param string $pdfFile
*/
public function setPdfFile(string $pdfFile)
{
$this->pdfFile = $pdfFile;
}
/**
* @return \DateTime
*/
public function getPdfGenDate()
{
return $this->pdfGenDate;
}
/**
* @param \DateTime $pdfGenDate
*/
public function setPdfGenDate(\DateTime $pdfGenDate)
{
$this->pdfGenDate = $pdfGenDate;
}
/**
* Set company
*
* @param \AdminBundle\Entity\Company $company
*
* @return CompanyInvoice
*/
public function setCompany(\AdminBundle\Entity\Company $company = null)
{
$this->company = $company;
return $this;
}
/**
* Get Company
*
* @return \AdminBundle\Entity\Company
*/
public function getCompany()
{
return $this->company;
}
/**
* Add invoiceItem
*
* @param \AdminBundle\Entity\CompanyInvoiceItem $invoiceItem
*
* @return CompanyInvoice
*/
public function addInvoiceItem(\AdminBundle\Entity\CompanyInvoiceItem $invoiceItem)
{
$this->invoiceItems[] = $invoiceItem;
return $this;
}
/**
* Remove invoiceItem
*
* @param \AdminBundle\Entity\CompanyInvoiceItem $invoiceItem
*/
public function removeInvoiceItem(\AdminBundle\Entity\CompanyInvoiceItem $invoiceItem)
{
$this->invoiceItems->removeElement($invoiceItem);
}
/**
* Get invoiceItems
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getInvoiceItems()
{
return $this->invoiceItems;
}
/**
* @return int
*/
public function getWeek()
{
return $this->week;
}
/**
* @param int $week
*/
public function setWeek(int $week)
{
$this->week = $week;
}
/**
* @return int
*/
public function getInvoiceMonth()
{
return $this->invoiceMonth;
}
/**
* @param int $invoiceMonth
*/
public function setInvoiceMonth(int $invoiceMonth)
{
$this->invoiceMonth = $invoiceMonth;
}
/**
* @return \DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* @param \DateTime $startDate
*/
public function setStartDate(\DateTime $startDate)
{
$this->startDate = $startDate;
}
/**
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @param \DateTime $endDate
*/
public function setEndDate(\DateTime $endDate)
{
$this->endDate = $endDate;
}
/**
* @return int
*/
public function getStatus(): int
{
return $this->status;
}
/**
* @param int $status
*/
public function setStatus(int $status)
{
$this->status = $status;
}
public function getStringStatus($status)
{
return self::$paymentStatuses[$status];
}
/**
* @return \DateTime
*/
public function getSentDate(): \DateTime
{
return $this->sentDate;
}
/**
* @param \DateTime $sentDate
*/
public function setSentDate(\DateTime $sentDate)
{
$this->sentDate = $sentDate;
}
/**
* @return bool
*/
public function isReadyToSend(): bool
{
return $this->readyToSend;
}
/**
* @param bool $readyToSend
*/
public function setReadyToSend(bool $readyToSend)
{
$this->readyToSend = $readyToSend;
}
/**
* @return int
*/
public function getApproval(): int
{
return $this->approval;
}
/**
* @param int $approval
*/
public function setApproval(int $approval)
{
$this->approval = $approval;
}
}