src/Entity/Reception.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReceptionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ReceptionRepository::class)
  9.  */
  10. class Reception
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="receptions")
  20.      */
  21.     private $client;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="receptions")
  24.      */
  25.     private $user;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $recunumero;
  30.     /**
  31.      * @ORM\Column(type="datetime_immutable")
  32.      */
  33.     private $dateOperation;
  34.     /**
  35.      * @ORM\Column(type="string", length=50, nullable=true)
  36.      */
  37.     private $truckingNumber;
  38.     /**
  39.      * @ORM\Column(type="string", length=50, nullable=true)
  40.      */
  41.     private $supplier;
  42.     /**
  43.      * @ORM\Column(type="string", length=100)
  44.      */
  45.     private $destination;
  46.     /**
  47.      * @ORM\Column(type="string", length=10)
  48.      */
  49.     private $alert;
  50.     /**
  51.      * @ORM\Column(type="string", length=14)
  52.      */
  53.     private $type;
  54.     /**
  55.      * @ORM\Column(type="boolean")
  56.      */
  57.     private $isCharge;
  58.     /**
  59.      * @ORM\Column(type="boolean")
  60.      */
  61.     private $isCalcule;
  62.     /**
  63.      * @ORM\Column(type="string", length=20)
  64.      */
  65.     private $conteneurtype;
  66.     /**
  67.      * @ORM\Column(type="string", length=400)
  68.      */
  69.     private $imageBon;
  70.     /**
  71.      * @ORM\Column(type="string", length=400)
  72.      */
  73.     private $imageColis;
  74.     private $days;
  75.     /**
  76.      * @ORM\Column(type="string", length=20)
  77.      */
  78.     private $fret;
  79.     /**
  80.      * @ORM\Column(type="string", length=100, nullable=true)
  81.      */
  82.     private $alias;
  83.     /**
  84.      * @ORM\Column(type="string", length=20, nullable=true)
  85.      */
  86.     private $numero;
  87.     /**
  88.      * @ORM\Column(type="string", length=10)
  89.      */
  90.     private $werehouse;
  91.     /**
  92.      * @ORM\Column(type="string", length=100, nullable=true)
  93.      */
  94.     private $fournisseur;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity=TmpReception::class, mappedBy="reception",cascade={"persist"})
  97.      */
  98.     private $tmpReceptions;
  99.     private $totalCBM;
  100.     private $totalTONNE;
  101.     private $totalKG;
  102.     private $totalColis;
  103.     private $totalNatureColis;
  104.     private $totalCBMVille;
  105.     private $totalTonneVille;
  106.     private $totalKGVille;
  107.     /**
  108.      * @ORM\Column(type="string", length=100)
  109.      */
  110.     private $flutterid;
  111.     /**
  112.      * @ORM\Column(type="string", length=20)
  113.      */
  114.     private $provenance;
  115.     /**
  116.      * @ORM\Column(type="string", length=20, nullable=true)
  117.      */
  118.     private $numeroRecuStore;
  119.     /**
  120.      * @ORM\Column(type="string", length=20)
  121.      */
  122.     private $montantValeur;
  123.     /**
  124.      * @ORM\Column(type="string", length=10)
  125.      */
  126.     private $charge;
  127.     /**
  128.      * @ORM\Column(type="string", length=20)
  129.      */
  130.     private $quantite;
  131.     /**
  132.      * @ORM\Column(type="string", length=20)
  133.      */
  134.     private $quantiteCharge;
  135.     /**
  136.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="receptions")
  137.      * @ORM\JoinColumn(nullable=false)
  138.      */
  139.     private $ville;
  140.     /**
  141.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="destville")
  142.      */
  143.     private $destville;
  144.     public function __construct()
  145.     {
  146.         $this->isCharge false;
  147.         $this->isCalcule false;
  148.         $this->numeroRecuStore 'AFI-';
  149.         $this->fournisseur '#######';
  150.         $this->montantValeur '0';
  151.         $this->type 'LEGER';
  152.         $this->fret '400';
  153.         $this->charge '1';
  154.         $this->quantite '0';
  155.         $this->quantiteCharge '0';
  156.         $this->flutterid md5($this->recunumero 1).$this->truckingNumber;
  157.         $this->dateOperation = new \DateTimeImmutable();
  158.         $this->tmpConteneurReceptions = new ArrayCollection();
  159.         $this->tmpReceptions = new ArrayCollection();
  160.     }
  161.     public function getDays()
  162.     {
  163.         $create $this->getDateOperation();
  164.         $later = new \DateTime(date('Y-m-d'));
  165.         $this->days $later->diff($create)->format("%a");
  166.         return $this->days;
  167.     }
  168.     public function getId(): ?int
  169.     {
  170.         return $this->id;
  171.     }
  172.     public function getClient(): ?agent
  173.     {
  174.         return $this->client;
  175.     }
  176.     public function setClient(?agent $client): self
  177.     {
  178.         $this->client $client;
  179.         return $this;
  180.     }
  181.     public function getUser(): ?utilisateur
  182.     {
  183.         return $this->user;
  184.     }
  185.     public function setUser(?utilisateur $user): self
  186.     {
  187.         $this->user $user;
  188.         return $this;
  189.     }
  190.     public function getRecunumero(): ?string
  191.     {
  192.         return $this->recunumero;
  193.     }
  194.     public function setRecunumero(string $recunumero): self
  195.     {
  196.         $this->recunumero $recunumero;
  197.         return $this;
  198.     }
  199.     public function getDateOperation(): ?\DateTimeImmutable
  200.     {
  201.         return $this->dateOperation;
  202.     }
  203.     public function setDateOperation(\DateTimeImmutable $dateOperation): self
  204.     {
  205.         $this->dateOperation $dateOperation;
  206.         return $this;
  207.     }
  208.     public function getSupplier(): ?string
  209.     {
  210.         return $this->supplier;
  211.     }
  212.     public function setSupplier(?string $supplier): self
  213.     {
  214.         $this->supplier $supplier;
  215.         return $this;
  216.     }
  217.     public function getTruckingNumber(): ?string
  218.     {
  219.         return $this->truckingNumber;
  220.     }
  221.     public function setTruckingNumber(?string $truckingNumber): self
  222.     {
  223.         $this->truckingNumber $truckingNumber;
  224.         return $this;
  225.     }
  226.     public function getDestination(): ?string
  227.     {
  228.         return $this->destination;
  229.     }
  230.     public function setDestination(string $destination): self
  231.     {
  232.         $this->destination $destination;
  233.         return $this;
  234.     }
  235.     public function getAlert(): ?string
  236.     {
  237.         return $this->alert;
  238.     }
  239.     public function setAlert(string $alert): self
  240.     {
  241.         $this->alert $alert;
  242.         return $this;
  243.     }
  244.     public function getType(): ?string
  245.     {
  246.         return $this->type;
  247.     }
  248.     public function setType(string $type): self
  249.     {
  250.         $this->type $type;
  251.         return $this;
  252.     }
  253.     public function isIsCharge(): ?bool
  254.     {
  255.         return $this->isCharge;
  256.     }
  257.     public function setIsCharge(bool $isCharge): self
  258.     {
  259.         $this->isCharge $isCharge;
  260.         return $this;
  261.     }
  262.     public function isIsCalcule(): ?bool
  263.     {
  264.         return $this->isCalcule;
  265.     }
  266.     public function setIsCalcule(bool $isCalcule): self
  267.     {
  268.         $this->isCalcule $isCalcule;
  269.         return $this;
  270.     }
  271.     public function getConteneurtype(): ?string
  272.     {
  273.         return $this->conteneurtype;
  274.     }
  275.     public function setConteneurtype(string $conteneurtype): self
  276.     {
  277.         $this->conteneurtype $conteneurtype;
  278.         return $this;
  279.     }
  280.     public function getImageBon(): ?string
  281.     {
  282.         return $this->imageBon;
  283.     }
  284.     public function setImageBon(string $imageBon): self
  285.     {
  286.         $this->imageBon $imageBon;
  287.         return $this;
  288.     }
  289.     public function getImageColis(): ?string
  290.     {
  291.         return $this->imageColis;
  292.     }
  293.     public function setImageColis(string $imageColis): self
  294.     {
  295.         $this->imageColis $imageColis;
  296.         return $this;
  297.     }
  298.     public function getFret(): ?string
  299.     {
  300.         return $this->fret;
  301.     }
  302.     public function setFret(string $fret): self
  303.     {
  304.         $this->fret $fret;
  305.         return $this;
  306.     }
  307.     public function getAlias(): ?string
  308.     {
  309.         return $this->alias;
  310.     }
  311.     public function setAlias(?string $alias): self
  312.     {
  313.         $this->alias $alias;
  314.         return $this;
  315.     }
  316.     public function getNumero(): ?string
  317.     {
  318.         return $this->numero;
  319.     }
  320.     public function setNumero(?string $numero): self
  321.     {
  322.         $this->numero $numero;
  323.         return $this;
  324.     }
  325.     public function getWerehouse(): ?string
  326.     {
  327.         return $this->werehouse;
  328.     }
  329.     public function setWerehouse(string $werehouse): self
  330.     {
  331.         $this->werehouse $werehouse;
  332.         return $this;
  333.     }
  334.     public function getFournisseur(): ?string
  335.     {
  336.         return $this->fournisseur;
  337.     }
  338.     public function setFournisseur(?string $fournisseur): self
  339.     {
  340.         $this->fournisseur $fournisseur;
  341.         return $this;
  342.     }
  343.     public function getTotalCBM()
  344.     {
  345.         $total 0;
  346.         foreach($this->getTmpReceptions() as $v){
  347.             if($v->getUnite() == 'CBM'){
  348.                 if($this->isCalcule){
  349.                     $total $total + ($v->getVolume() * $v->getQuantite());
  350.                 }else{
  351.                     $total $total $v->getVolume();
  352.                 }
  353.             }
  354.         }
  355.         return  $this->totalCBM $total;
  356.     }
  357.     public function getTotalTONNE()
  358.     {
  359.         $total 0;
  360.         foreach($this->getTmpReceptions() as $v){
  361.             if($v->getUnite() == 'TONNE'){
  362.                 if($this->isCalcule){
  363.                     $total $total + ($v->getTonne() * $v->getQuantite());
  364.                 }else{
  365.                     $total $total $v->getTonne();
  366.                 }
  367.             }
  368.         }
  369.         return  $this->totalTONNE $total;
  370.     }
  371.     /**
  372.      * @return mixed
  373.      */
  374.     public function getTotalKG()
  375.     {
  376.         $total 0;
  377.         foreach($this->getTmpReceptions() as $v){
  378.             if($v->getUnite() == 'KG'){
  379.                 if($this->isCalcule){
  380.                     $total $total + ($v->getVolume() * $v->getQuantite());
  381.                 }else{
  382.                     $total $total $v->getVolume();
  383.                 }
  384.             }
  385.         }
  386.         return $this->totalKG $total;
  387.     }
  388.     /**
  389.      * @return mixed
  390.      */
  391.     public function getTotalColis()
  392.     {
  393.         $total 0;
  394.         foreach($this->getTmpReceptions() as $v){
  395.                 $total $total $v->getQuantite();
  396.         }
  397.         return $this->totalColis $total;
  398.     }
  399.     /**
  400.      * @return mixed
  401.      */
  402.     public function getTotalNatureColis()
  403.     {
  404.         $total '';
  405.         foreach($this->getTmpReceptions() as $v){
  406.             $total $total.' '.$v->getQuantite().' '.$v->getNature().', ';
  407.         }
  408.         return $this->totalNatureColis $total;
  409.     }
  410.     /**
  411.      * @return Collection<int, TmpReception>
  412.      */
  413.     public function getTmpReceptions(): Collection
  414.     {
  415.         return $this->tmpReceptions;
  416.     }
  417.     public function addTmpReception(TmpReception $tmpReception): self
  418.     {
  419.         if (!$this->tmpReceptions->contains($tmpReception)) {
  420.             $this->tmpReceptions[] = $tmpReception;
  421.             $tmpReception->setReception($this);
  422.         }
  423.         return $this;
  424.     }
  425.     public function removeTmpReception(TmpReception $tmpReception): self
  426.     {
  427.         if ($this->tmpReceptions->removeElement($tmpReception)) {
  428.             // set the owning side to null (unless already changed)
  429.             if ($tmpReception->getReception() === $this) {
  430.                 $tmpReception->setReception(null);
  431.             }
  432.         }
  433.         return $this;
  434.     }
  435.     public function getFlutterid(): ?string
  436.     {
  437.         return $this->flutterid;
  438.     }
  439.     public function setFlutterid(string $flutterid): self
  440.     {
  441.         $this->flutterid $flutterid;
  442.         return $this;
  443.     }
  444.     public function getProvenance(): ?string
  445.     {
  446.         return $this->provenance;
  447.     }
  448.     public function setProvenance(string $provenance): self
  449.     {
  450.         $this->provenance $provenance;
  451.         return $this;
  452.     }
  453.     public function getNumeroRecuStore(): ?string
  454.     {
  455.         return $this->numeroRecuStore;
  456.     }
  457.     public function setNumeroRecuStore(?string $numeroRecuStore): self
  458.     {
  459.         $this->numeroRecuStore $numeroRecuStore;
  460.         return $this;
  461.     }
  462.     public function getMontantValeur(): ?string
  463.     {
  464.         return $this->montantValeur;
  465.     }
  466.     public function setMontantValeur(string $montantValeur): self
  467.     {
  468.         $this->montantValeur $montantValeur;
  469.         return $this;
  470.     }
  471.     public function getCharge(): ?string
  472.     {
  473.         return $this->charge;
  474.     }
  475.     public function setCharge(string $charge): self
  476.     {
  477.         $this->charge $charge;
  478.         return $this;
  479.     }
  480.     public function getQuantite(): ?string
  481.     {
  482.         return $this->quantite;
  483.     }
  484.     public function setQuantite(string $quantite): self
  485.     {
  486.         $this->quantite $quantite;
  487.         return $this;
  488.     }
  489.     public function getQuantiteCharge(): ?string
  490.     {
  491.         return $this->quantiteCharge;
  492.     }
  493.     public function setQuantiteCharge(string $quantiteCharge): self
  494.     {
  495.         $this->quantiteCharge $quantiteCharge;
  496.         return $this;
  497.     }
  498.     public function getVille(): ?Ville
  499.     {
  500.         return $this->ville;
  501.     }
  502.     public function setVille(?Ville $ville): self
  503.     {
  504.         $this->ville $ville;
  505.         return $this;
  506.     }
  507.     public function getDestville(): ?Ville
  508.     {
  509.         return $this->destville;
  510.     }
  511.     public function setDestville(?Ville $destville): self
  512.     {
  513.         $this->destville $destville;
  514.         return $this;
  515.     }
  516.     public function getTotalCBMVille() : ?string
  517.     {
  518.         $total 0;
  519.             foreach ($this->getDestville() as $vv) {
  520.                 if ($vv->getUnite() == 'CBM') {
  521.                     $total $total $this->getTotalCBM();
  522.                 }
  523.         }
  524.         return $this->totalCBMVille $total;
  525.     }
  526.     /**
  527.      * @return mixed
  528.      */
  529.     public function getTotalTONNEVille() : ?string
  530.     {
  531.         $total 0;
  532.         foreach ($this->getDestville() as $v) {
  533.             foreach ($v->getTmpReceptions() as $vv) {
  534.                 if ($vv->getUnite() == 'TONNE') {
  535.                     $total $total + ($vv->getTonne() * $vv->getQuantite());
  536.                 }
  537.             }
  538.         }
  539.         $this->totalTonneVille $total;
  540.         return $this->totalTonneVille;
  541.     }
  542.     public function getTotalKGVille() : ?string
  543.     {
  544.         $total 0;
  545.         foreach ($this->getDestville() as $v) {
  546.             foreach ($v->getTmpReceptions() as $vv) {
  547.                 if ($vv->getUnite() == 'KG') {
  548.                     $total $total + ($vv->getVolume() * $vv->getQuantite());
  549.                 }
  550.             }
  551.         }
  552.         return $this->totalKGVille $total;
  553.     }
  554. }