src/Entity/DocumentProduit.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentProduitRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=DocumentProduitRepository::class)
  7.  */
  8. class DocumentProduit
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=255, nullable=true)
  18.      */
  19.     private $reference;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $description;
  28.     /**
  29.      * @ORM\Column(type="float", nullable=true)
  30.      */
  31.     private $priceHt;
  32.     /**
  33.      * @ORM\Column(type="float", nullable=true)
  34.      */
  35.     private $priceTtc;
  36.     /**
  37.      * @ORM\Column(type="string", length=255)
  38.      */
  39.     private $type;
  40.     /**
  41.      * @ORM\Column(type="float", nullable=true)
  42.      */
  43.     private $discount;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=true)
  46.      */
  47.     private $discountType;
  48.     /**
  49.      * @ORM\Column(type="integer", nullable=true)
  50.      */
  51.     private $quantity;
  52.     /**
  53.      * @ORM\Column(type="integer", options={"default": 0})
  54.      */
  55.     private int $returnedQuantity 0;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $unite;
  60.     /**
  61.      * @ORM\Column(type="datetime")
  62.      */
  63.     private $createdAt;
  64.     /**
  65.      * @ORM\Column(type="text", nullable=true)
  66.      */
  67.     private $comment;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity=Tva::class)
  70.      */
  71.     private $tva;
  72.     /**
  73.      * @ORM\ManyToOne(targetEntity=Produit::class, inversedBy="documentProduits")
  74.      */
  75.     private $produit;
  76.     /**
  77.      * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="documentProduits")
  78.      */
  79.     private $document;
  80.     /**
  81.      * @ORM\ManyToOne(targetEntity=Pack::class, inversedBy="documentPacks")
  82.      */
  83.     private $pack;
  84.     /**
  85.      * @ORM\Column(type="float")
  86.      */
  87.     private $totalAmountTtc;
  88.     /**
  89.      * @ORM\Column(type="float", nullable=true, options={"comment":"Prix revendeur TTC memorise au moment de l ajout"})
  90.      */
  91.     private ?float $resellerPurchasePriceTtc null;
  92.     public function getId(): ?int
  93.     {
  94.         return $this->id;
  95.     }
  96.     public function getReference(): ?string
  97.     {
  98.         return $this->reference;
  99.     }
  100.     public function setReference(?string $reference): self
  101.     {
  102.         $this->reference $reference;
  103.         return $this;
  104.     }
  105.     public function getName(): ?string
  106.     {
  107.         return $this->name;
  108.     }
  109.     public function setName(?string $name): self
  110.     {
  111.         $this->name $name;
  112.         return $this;
  113.     }
  114.     public function getDescription(): ?string
  115.     {
  116.         return $this->description;
  117.     }
  118.     public function setDescription(?string $description): self
  119.     {
  120.         $this->description $description;
  121.         return $this;
  122.     }
  123.     public function getPriceHt(): ?float
  124.     {
  125.         return $this->priceHt;
  126.     }
  127.     public function setPriceHt(?float $priceHt): self
  128.     {
  129.         $this->priceHt $priceHt;
  130.         return $this;
  131.     }
  132.     public function getPriceTtc(): ?float
  133.     {
  134.         return $this->priceTtc;
  135.     }
  136.     public function setPriceTtc(?float $priceTtc): self
  137.     {
  138.         $this->priceTtc $priceTtc;
  139.         return $this;
  140.     }
  141.     public function getType(): ?string
  142.     {
  143.         return $this->type;
  144.     }
  145.     public function setType(string $type): self
  146.     {
  147.         $this->type $type;
  148.         return $this;
  149.     }
  150.     public function getDiscount(): ?float
  151.     {
  152.         return $this->discount;
  153.     }
  154.     public function setDiscount(?float $discount): self
  155.     {
  156.         $this->discount $discount;
  157.         return $this;
  158.     }
  159.     public function getDiscountType(): ?string
  160.     {
  161.         return $this->discountType;
  162.     }
  163.     public function setDiscountType(?string $discountType): self
  164.     {
  165.         $this->discountType $discountType;
  166.         return $this;
  167.     }
  168.     public function getQuantity(): ?int
  169.     {
  170.         return $this->quantity;
  171.     }
  172.     public function setQuantity(?int $quantity): self
  173.     {
  174.         $this->quantity $quantity;
  175.         return $this;
  176.     }
  177.     public function getReturnedQuantity(): int
  178.     {
  179.         return (int) $this->returnedQuantity;
  180.     }
  181.     public function setReturnedQuantity(?int $returnedQuantity): self
  182.     {
  183.         $max = (int) ($this->quantity ?? 0);
  184.         $value max(0, (int) ($returnedQuantity ?? 0));
  185.         $this->returnedQuantity $max min($max$value) : $value;
  186.         return $this;
  187.     }
  188.     public function getRemainingQuantity(): int
  189.     {
  190.         return max(0, (int) ($this->quantity ?? 0) - (int) $this->returnedQuantity);
  191.     }
  192.     public function getUnite(): ?string
  193.     {
  194.         return $this->unite;
  195.     }
  196.     public function setUnite(?string $unite): self
  197.     {
  198.         $this->unite $unite;
  199.         return $this;
  200.     }
  201.     public function getCreatedAt(): ?\DateTimeInterface
  202.     {
  203.         return $this->createdAt;
  204.     }
  205.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  206.     {
  207.         $this->createdAt $createdAt;
  208.         return $this;
  209.     }
  210.     public function getComment(): ?string
  211.     {
  212.         return $this->comment;
  213.     }
  214.     public function setComment(?string $comment): self
  215.     {
  216.         $this->comment $comment;
  217.         return $this;
  218.     }
  219.     public function getTva(): ?Tva
  220.     {
  221.         return $this->tva;
  222.     }
  223.     public function setTva(?Tva $tva): self
  224.     {
  225.         $this->tva $tva;
  226.         return $this;
  227.     }
  228.     public function getProduit(): ?Produit
  229.     {
  230.         return $this->produit;
  231.     }
  232.     public function setProduit(?Produit $produit): self
  233.     {
  234.         $this->produit $produit;
  235.         return $this;
  236.     }
  237.     public function getDocument(): ?Document
  238.     {
  239.         return $this->document;
  240.     }
  241.     public function setDocument(?Document $document): self
  242.     {
  243.         $this->document $document;
  244.         return $this;
  245.     }
  246.     public function getPack(): ?Pack
  247.     {
  248.         return $this->pack;
  249.     }
  250.     public function setPack(?Pack $pack): self
  251.     {
  252.         $this->pack $pack;
  253.         return $this;
  254.     }
  255.     public function getTotalAmountTtc(): ?float
  256.     {
  257.         return $this->totalAmountTtc;
  258.     }
  259.     public function setTotalAmountTtc(float $totalAmountTtc): self
  260.     {
  261.         $this->totalAmountTtc $totalAmountTtc;
  262.         return $this;
  263.     }
  264.     public function getResellerPurchasePriceTtc(): ?float
  265.     {
  266.         return $this->resellerPurchasePriceTtc;
  267.     }
  268.     public function setResellerPurchasePriceTtc(?float $resellerPurchasePriceTtc): self
  269.     {
  270.         $this->resellerPurchasePriceTtc $resellerPurchasePriceTtc;
  271.         return $this;
  272.     }
  273. }