getID(); } /** * Check if the current part lot is expired. * This is the case, if the expiration date is greater the the current date. * * @return bool|null True, if the part lot is expired. Returns null, if no expiration date was set. * * @throws \Exception If an error with the DateTime occurs */ public function isExpired(): ?bool { if (null === $this->expiration_date) { return null; } //Check if the expiration date is bigger then current time return $this->expiration_date < new \DateTime('now'); } /** * Gets the description of the part lot. Similar to a "name" of the part lot. * * @return string */ public function getDescription(): string { return $this->description; } /** * Sets the description of the part lot. * * @return PartLot */ public function setDescription(string $description): self { $this->description = $description; return $this; } /** * Gets the comment for this part lot. * * @return string */ public function getComment(): string { return $this->comment; } /** * Sets the comment for this part lot. * * @return PartLot */ public function setComment(string $comment): self { $this->comment = $comment; return $this; } /** * Gets the expiration date for the part lot. Returns null, if no expiration date was set. * * @return \DateTime|null */ public function getExpirationDate(): ?\DateTime { return $this->expiration_date; } /** * Sets the expiration date for the part lot. Set to null, if the part lot does not expires. * * @param \DateTime $expiration_date * * @return PartLot */ public function setExpirationDate(?\DateTime $expiration_date): self { $this->expiration_date = $expiration_date; return $this; } /** * Gets the storage location, where this part lot is stored. * * @return Storelocation|null The store location where this part is stored */ public function getStorageLocation(): ?Storelocation { return $this->storage_location; } /** * Sets the storage location, where this part lot is stored. * * @return PartLot */ public function setStorageLocation(?Storelocation $storage_location): self { $this->storage_location = $storage_location; return $this; } /** * Return the part that is stored in this part lot. * * @return Part */ public function getPart(): Part { return $this->part; } /** * Sets the part that is stored in this part lot. * * @param Part|InstockTrait $part * * @return PartLot */ public function setPart(Part $part): self { $this->part = $part; return $this; } /** * Checks if the instock value in the part lot is unknown. * * @return bool */ public function isInstockUnknown(): bool { return $this->instock_unknown; } /** * Set the unknown instock status of this part lot. * * @return PartLot */ public function setInstockUnknown(bool $instock_unknown): self { $this->instock_unknown = $instock_unknown; return $this; } /** * @return float */ public function getAmount(): float { if ($this->part instanceof Part && !$this->part->useFloatAmount()) { return round($this->amount); } return (float) $this->amount; } public function setAmount(float $new_amount): self { $this->amount = $new_amount; return $this; } /** * @return bool */ public function isNeedsRefill(): bool { return $this->needs_refill; } /** * @return PartLot */ public function setNeedsRefill(bool $needs_refill): self { $this->needs_refill = $needs_refill; return $this; } }