<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\CommandeRepository")
*/
class Commande
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Agent", inversedBy="agent")
*/
private $IdAg;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Agent", inversedBy="agent")
*/
private $IdCl;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ProgrammeContenaire", inversedBy="$commandes")
*/
private $IdCtPr;
/**
* @ORM\Column(type="date")
*/
private $DateCommande;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Paiement", mappedBy="IdCmd", orphanRemoval=true, cascade={"persist"})
*/
private $paiements;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $AliasClient;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $RecuCargo;
/**
* @ORM\Column(type="integer")
*/
private $QtePrint;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contact;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $facturehors;
/**
* @ORM\Column(type="boolean")
*/
private $NouvelleFacture;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $factureMarchandiseAbscent;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TmpMarchandise", mappedBy="commande", cascade={"persist", "remove"})
*/
private $tmpMarchandises;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TmpVolume", mappedBy="commande", cascade={"persist", "remove"})
*/
private $tmpVolumes;
/**
* @ORM\OneToMany(targetEntity="App\Entity\AutreFrais", mappedBy="commande", cascade={"persist", "remove"})
*/
private $autreFrais;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Reduction", mappedBy="IdCmd", cascade={"persist", "remove"})
*/
private $reduction;
/**
* @ORM\Column(type="boolean")
*/
private $isPaid;
/**
* @ORM\Column(type="boolean")
*/
private $modification;
/**
* @var mixed
*/
private $reductionTotal;
/**
* @var mixed
*/
private $paiementAvance;
/**
* @var mixed
*/
private $totalAPaiyer;
/**
* @var mixed
*/
private $balance;
/**
* @var mixed
*/
private $cbm;
/**
* @var mixed
*/
private $kg;
/**
* @var mixed
*/
private $tonne;
/**
* @var mixed
*/
private $AutresFr;
/**
* @var mixed
*/
private $fret;
/**
* @var mixed
*/
private $netDejaPaie;
/**
* @ORM\Column(type="string", length=8000, nullable=true)
*/
private $remarque;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Remarque", mappedBy="commande", cascade={"persist", "remove"})
*/
private $remarques;
/**
* @ORM\Column(type="boolean")
*/
private $flagflutterNotification;
/**
* @ORM\OneToMany(targetEntity=Depot::class, mappedBy="commande")
*/
private $depots;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $pkg;
/**
* @ORM\Column(type="string", length=25, nullable=true)
*/
private $ville;
/**
* @ORM\Column(type="boolean")
*/
private $isNumberVerified;
/**
* @ORM\Column(type="string", length=1500, nullable=true)
*/
private $remarqueDepot;
/**
* @ORM\Column(type="boolean")
*/
private $isScanned;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p1;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p2;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p3;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p4;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p5;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $p6;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP1;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP2;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP3;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP4;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP5;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateP6;
public function __construct()
{
$this->DateCommande = new \DateTime();
$this->paiements = new ArrayCollection();
$this->QtePrint = 0;
$this->modification = 0;
$this->isNumberVerified = false;
$this->isScanned = false;
$this->NouvelleFacture = true;
$this->factureMarchandiseAbscent = false;
$this->facturehors = false;
$this->tmpMarchandises = new ArrayCollection();
$this->tmpVolumes = new ArrayCollection();
$this->autreFrais = new ArrayCollection();
$this->reduction = new ArrayCollection();
$this->remarques = new ArrayCollection();
$this->depots = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getIdCtPr(): ?ProgrammeContenaire
{
return $this->IdCtPr;
}
public function setIdCtPr(?ProgrammeContenaire $IdCtPr): self
{
$this->IdCtPr = $IdCtPr;
return $this;
}
public function getIdCl(): ?Agent
{
return $this->IdCl;
}
public function setIdCl(?Agent $IdCl): self
{
$this->IdCl = $IdCl;
return $this;
}
public function getIdAg(): ?Agent
{
return $this->IdCl;
}
public function setIdAg(?Agent $IdAg): self
{
$this->IdAg = $IdAg;
return $this;
}
public function getDateCommande(): ?\DateTimeInterface
{
return $this->DateCommande;
}
public function setDateCommande(\DateTimeInterface $DateCommande): self
{
$this->DateCommande = $DateCommande;
return $this;
}
/**
* @return Collection|Paiement[]
*/
public function getPaiements(): Collection
{
return $this->paiements;
}
public function addPaiement(Paiement $paiement): self
{
if (!$this->paiements->contains($paiement)) {
$this->paiements[] = $paiement;
$paiement->setIdCmd($this);
}
return $this;
}
public function removePaiement(Paiement $paiement): self
{
if ($this->paiements->contains($paiement)) {
$this->paiements->removeElement($paiement);
if ($paiement->getIdCmd() === $this) {
$paiement->setIdCmd(null);
}
}
return $this;
}
public function __toString()
{
return (string) $this->id;
}
public function getAliasClient(): ?string
{
return $this->AliasClient;
}
public function setAliasClient(?string $AliasClient): self
{
$this->AliasClient = $AliasClient;
return $this;
}
public function getRecuCargo(): ?string
{
return $this->RecuCargo;
}
public function setRecuCargo(?string $RecuCargo): self
{
$this->RecuCargo = $RecuCargo;
return $this;
}
public function getQtePrint(): ?int
{
return $this->QtePrint;
}
public function setQtePrint(int $QtePrint): self
{
$this->QtePrint = $QtePrint;
return $this;
}
public function getContact(): ?string
{
return $this->contact;
}
public function setContact(?string $contact): self
{
$this->contact = $contact;
return $this;
}
public function getFacturehors(): ?bool
{
return $this->facturehors;
}
public function setFacturehors(?bool $facturehors): self
{
$this->facturehors = $facturehors;
return $this;
}
public function getNouvelleFacture(): ?bool
{
return $this->NouvelleFacture;
}
public function setNouvelleFacture(bool $NouvelleFacture): self
{
$this->NouvelleFacture = $NouvelleFacture;
return $this;
}
public function getFactureMarchandiseAbscent(): ?bool
{
return $this->factureMarchandiseAbscent;
}
public function setFactureMarchandiseAbscent(?bool $factureMarchandiseAbscent): self
{
$this->factureMarchandiseAbscent = $factureMarchandiseAbscent;
return $this;
}
/**
* @return Collection|TmpMarchandise[]
*/
public function getTmpMarchandises(): Collection
{
return $this->tmpMarchandises;
}
public function addTmpMarchandise(TmpMarchandise $tmpMarchandise): self
{
if (!$this->tmpMarchandises->contains($tmpMarchandise)) {
$this->tmpMarchandises[] = $tmpMarchandise;
$tmpMarchandise->setCommande($this);
}
return $this;
}
public function removeTmpMarchandise(TmpMarchandise $tmpMarchandise): self
{
if ($this->tmpMarchandises->contains($tmpMarchandise)) {
$this->tmpMarchandises->removeElement($tmpMarchandise);
if ($tmpMarchandise->getCommande() === $this) {
$tmpMarchandise->setCommande(null);
}
}
return $this;
}
/**
* @return Collection|TmpVolume[]
*/
public function getTmpVolumes(): Collection
{
return $this->tmpVolumes;
}
public function addTmpVolume(TmpVolume $tmpVolume): self
{
if (!$this->tmpVolumes->contains($tmpVolume)) {
$this->tmpVolumes[] = $tmpVolume;
$tmpVolume->setCommande($this);
}
return $this;
}
public function removeTmpVolume(TmpVolume $tmpVolume): self
{
if ($this->tmpVolumes->contains($tmpVolume)) {
$this->tmpVolumes->removeElement($tmpVolume);
if ($tmpVolume->getCommande() === $this) {
$tmpVolume->setCommande(null);
}
}
return $this;
}
/**
* @return Collection|AutreFrais[]
*/
public function getAutreFrais(): Collection
{
return $this->autreFrais;
}
public function addAutreFrai(AutreFrais $autreFrai): self
{
if (!$this->autreFrais->contains($autreFrai)) {
$this->autreFrais[] = $autreFrai;
$autreFrai->setCommande($this);
}
return $this;
}
public function removeAutreFrai(AutreFrais $autreFrai): self
{
if ($this->autreFrais->contains($autreFrai)) {
$this->autreFrais->removeElement($autreFrai);
if ($autreFrai->getCommande() === $this) {
$autreFrai->setCommande(null);
}
}
return $this;
}
public function getModification(): ?bool
{
return $this->modification;
}
public function setModification(bool $modification): self
{
$this->modification = $modification;
return $this;
}
public function getNomAgent(Commande $commande): string
{
return $this;
}
public function getTotalAPaiyerVolume()
{
$somme1 = 0;
$Tab = $this->getTmpVolumes();
for ($i = 0; $i < count($Tab); $i++) {
$somme = $Tab[$i]->getVolume() * $Tab[$i]->getPrixUnit();
$somme1 = round($somme) + $somme1;
}
return round($somme1);
}
public function getTotalAPaiyerAutraiFrais()
{
$somme = 0;
$Tab = $this->getAutreFrais();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getMontant();
}
return $somme;
}
/**
* @return float
*/
public function getTotalPaiement()
{
$somme = 0;
$Tab = $this->getPaiements();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getMontant();
}
return $somme;
}
/**
* @return float
*/
public function getTotalPaiementPaiement()
{
$somme = 0;
$Tab = $this->getPaiements();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getFlagEnAvance() === '0') {
$somme += $Tab[$i]->getMontant();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalPaiementAvance()
{
$somme = 0;
$Tab = $this->getPaiements();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getFlagEnAvance() === true) {
$somme += $Tab[$i]->getMontant();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalReduction()
{
$somme = 0;
$Tab = $this->getReduction();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getMontant();
}
return $this->reductionTotal = $somme;
}
/**
* @return float
*/
public function getTotalReductionReduction()
{
$somme = 0;
$Tab = $this->getReduction();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getFlagCompassation() === '0') {
$somme += $Tab[$i]->getMontant();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalCompassation()
{
$somme = 0;
$Tab = $this->getReduction();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getFlagCompassation() === '1') {
$somme += $Tab[$i]->getMontant();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalBanque()
{
$somme = 0;
$Tab = $this->getReduction();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getFlagCompassation() === '2') {
$somme += $Tab[$i]->getMontant();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalCBM()
{
$somme = 0;
$Tab = $this->getTmpVolumes();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getUnite() === 'CBM') {
$somme += $Tab[$i]->getVolume();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalKG()
{
$somme = 0;
$Tab = $this->getTmpVolumes();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getUnite() === 'KG') {
$somme += $Tab[$i]->getVolume();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalCOLIS()
{
$somme = 0;
$Tab = $this->getTmpMarchandises();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getQte();
}
return $somme;
}
/**
* @return float
*/
public function getTotalSortieDepot()
{
$somme = 0;
$Tab = $this->getDepots();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getQuantite();
}
return $somme;
}
/**
* @return float
*/
public function getTotalTONNE()
{
$somme = 0;
$Tab = $this->getTmpVolumes();
for ($i = 0; $i < count($Tab); $i++) {
if ($Tab[$i]->getUnite() === 'TONNE') {
$somme += $Tab[$i]->getVolume();
}
}
return $somme;
}
/**
* @return float
*/
public function getTotalAF()
{
$somme = 0;
$Tab = $this->getAutreFrais();
for ($i = 0; $i < count($Tab); $i++) {
$somme += $Tab[$i]->getMontant();
}
return $somme;
}
/**
* @return float
*/
public function getTotalAPaiyer()
{
return $this->totalAPaiyer = $this->getTotalAPaiyerVolume() + $this->getTotalAPaiyerAutraiFrais();
}
/**
* @return float
*/
public function getBalance()
{
$this->balance = $this->getTotalAPaiyer() - $this->getTotalReduction() - $this->getTotalPaiement();
return $this->balance;
}
/**
* @return float
*/
public function getNetDejaPaie()
{
$this->netDejaPaie = $this->getTotalReduction() + $this->getTotalPaiement();
return $this->netDejaPaie;
}
/**
* @return Collection|Reduction[]
*/
public function getReduction(): Collection
{
return $this->reduction;
}
public function addReduction(Reduction $reduction): self
{
if (!$this->reduction->contains($reduction)) {
$this->reduction[] = $reduction;
$reduction->setIdCmd($this);
}
return $this;
}
public function removeReduction(Reduction $reduction): self
{
if ($this->reduction->contains($reduction)) {
$this->reduction->removeElement($reduction);
if ($reduction->getIdCmd() === $this) {
$reduction->setIdCmd(null);
}
}
return $this;
}
public function getRemarque(): ?string
{
return $this->remarque;
}
public function setRemarque(?string $remarque): self
{
$this->remarque = $remarque;
return $this;
}
public function getPaiementAvance()
{
return $this->paiementAvance = $this->getTotalPaiementAvance();
}
public function getReductionTotal()
{
return $this->reductionTotal = $this->getTotalReductionReduction();
}
/**
* @return Collection|Remarque[]
*/
public function getRemarques(): Collection
{
return $this->remarques;
}
public function addRemarque(Remarque $remarque): self
{
if (!$this->remarques->contains($remarque)) {
$this->remarques[] = $remarque;
$remarque->setCommande($this);
}
return $this;
}
public function removeRemarque(Remarque $remarque): self
{
if ($this->remarques->contains($remarque)) {
$this->remarques->removeElement($remarque);
if ($remarque->getCommande() === $this) {
$remarque->setCommande(null);
}
}
return $this;
}
public function getCbm()
{
return $this->cbm = $this->getTotalCBM() / 1;
}
public function getKg()
{
return $this->kg = $this->getTotalKG() / 1;
}
public function getTonne()
{
return $this->tonne = $this->getTotalTONNE() / 1;
}
public function getAutresFr()
{
return $this->AutresFr = $this->getTotalAF();
}
public function getFret()
{
return $this->fret = $this->getTotalAPaiyerVolume();
}
public function getFlagflutterNotification(): ?bool
{
return $this->flagflutterNotification;
}
public function setFlagflutterNotification(bool $flagflutterNotification): self
{
$this->flagflutterNotification = $flagflutterNotification;
return $this;
}
/**
* @return Collection<int, Depot>
*/
public function getDepots(): Collection
{
return $this->depots;
}
public function addDepot(Depot $depot): self
{
if (!$this->depots->contains($depot)) {
$this->depots[] = $depot;
$depot->setCommande($this);
}
return $this;
}
public function removeDepot(Depot $depot): self
{
if ($this->depots->removeElement($depot)) {
if ($depot->getCommande() === $this) {
$depot->setCommande(null);
}
}
return $this;
}
public function isIsPaid(): ?bool
{
return $this->isPaid;
}
public function setIsPaid(bool $isPaid): self
{
$this->isPaid = $isPaid;
return $this;
}
public function getPkg(): ?string
{
return $this->pkg;
}
public function setPkg(?string $pkg): self
{
$this->pkg = $pkg;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function isIsNumberVerified(): ?bool
{
return $this->isNumberVerified;
}
public function setIsNumberVerified(bool $isNumberVerified): self
{
$this->isNumberVerified = $isNumberVerified;
return $this;
}
public function getRemarqueDepot(): ?string
{
return $this->remarqueDepot;
}
public function setRemarqueDepot(?string $remarqueDepot): self
{
$this->remarqueDepot = $remarqueDepot;
return $this;
}
public function isIsScanned(): ?bool
{
return $this->isScanned;
}
public function setIsScanned(bool $isScanned): self
{
$this->isScanned = $isScanned;
return $this;
}
public function isP1(): ?bool
{
return $this->p1 ?? false;
}
public function setP1(bool $p1): self
{
$this->p1 = $p1;
$this->dateP1 = $p1 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function isP2(): ?bool
{
return $this->p2 ?? false;
}
public function setP2(bool $p2): self
{
$this->p2 = $p2;
$this->dateP2 = $p2 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function isP3(): ?bool
{
return $this->p3 ?? false;
}
public function setP3(bool $p3): self
{
$this->p3 = $p3;
$this->dateP3 = $p3 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function isP4(): ?bool
{
return $this->p4 ?? false;
}
public function setP4(bool $p4): self
{
$this->p4 = $p4;
$this->dateP4 = $p4 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function isP5(): ?bool
{
return $this->p5 ?? false;
}
public function setP5(bool $p5): self
{
$this->p5 = $p5;
$this->dateP5 = $p5 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function isP6(): ?bool
{
return $this->p6 ?? false;
}
public function setP6(bool $p6): self
{
$this->p6 = $p6;
$this->dateP6 = $p6 ? new \DateTime('now', new \DateTimeZone('Africa/Lubumbashi')) : null;
return $this;
}
public function getDateP1(): ?\DateTimeInterface
{
return $this->dateP1;
}
public function setDateP1(?\DateTimeInterface $dateP1): self
{
$this->dateP1 = $dateP1;
return $this;
}
public function getDateP2(): ?\DateTimeInterface
{
return $this->dateP2;
}
public function setDateP2(?\DateTimeInterface $dateP2): self
{
$this->dateP2 = $dateP2;
return $this;
}
public function getDateP3(): ?\DateTimeInterface
{
return $this->dateP3;
}
public function setDateP3(?\DateTimeInterface $dateP3): self
{
$this->dateP3 = $dateP3;
return $this;
}
public function getDateP4(): ?\DateTimeInterface
{
return $this->dateP4;
}
public function setDateP4(?\DateTimeInterface $dateP4): self
{
$this->dateP4 = $dateP4;
return $this;
}
public function getDateP5(): ?\DateTimeInterface
{
return $this->dateP5;
}
public function setDateP5(?\DateTimeInterface $dateP5): self
{
$this->dateP5 = $dateP5;
return $this;
}
public function getDateP6(): ?\DateTimeInterface
{
return $this->dateP6;
}
public function setDateP6(?\DateTimeInterface $dateP6): self
{
$this->dateP5 = $dateP6;
return $this;
}
public function getTotalCOLISNature()
{
$nature = '';
$Tab = $this->getTmpMarchandises();
for ($i = 0; $i < count($Tab); $i++) {
$nature .= $Tab[$i]->getLibelle();
}
return $nature;
}
}