<?php
namespace App\Entity;
use App\Repository\StockMovementRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* Historique des mouvements de stock.
*
* @ORM\Entity(repositoryClass=StockMovementRepository::class)
* @ORM\Table(name="stock_movement")
*/
class StockMovement
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private int $id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $produit_id = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $declination_produit_id = null;
/**
* @ORM\ManyToOne(targetEntity=Warehouse::class, inversedBy="stockMovements")
* @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private ?Warehouse $warehouse = null;
/**
* @ORM\Column(type="datetime")
*/
private \DateTimeInterface $created_at;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private ?string $source_type = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $source_id = null;
/**
* @ORM\Column(type="decimal", precision=18, scale=3)
*/
private string $delta_available;
/**
* @ORM\Column(type="decimal", precision=18, scale=3, options={"default":"0.000"})
*/
private string $delta_reserved = '0.000';
/**
* @ORM\Column(type="decimal", precision=18, scale=3)
*/
private string $qty_before_available;
/**
* @ORM\Column(type="decimal", precision=18, scale=3)
*/
private string $qty_after_available;
/**
* @ORM\Column(type="decimal", precision=18, scale=3)
*/
private string $qty_before_reserved;
/**
* @ORM\Column(type="decimal", precision=18, scale=3)
*/
private string $qty_after_reserved;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $reason = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $actor_id = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $note = null;
/**
* @ORM\Column(name="unit_cost_ttc", type="decimal", precision=12, scale=3, nullable=true)
*/
private ?string $unit_cost_ttc = null;
public function getId(): ?int
{
return $this->id;
}
public function getProduitId(): ?int
{
return $this->produit_id;
}
public function setProduitId(?int $produit_id): self
{
$this->produit_id = $produit_id;
return $this;
}
public function getDeclinationProduitId(): ?int
{
return $this->declination_produit_id;
}
public function setDeclinationProduitId(?int $declination_produit_id): self
{
$this->declination_produit_id = $declination_produit_id;
return $this;
}
public function getWarehouse(): ?Warehouse
{
return $this->warehouse;
}
public function setWarehouse(?Warehouse $warehouse): self
{
$this->warehouse = $warehouse;
return $this;
}
public function getResolvedStorehouseName(): ?string
{
return $this->warehouse?->getName();
}
public function getCreatedAt(): \DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getSourceType(): ?string
{
return $this->source_type;
}
public function setSourceType(?string $source_type): self
{
$this->source_type = $source_type;
return $this;
}
public function getSourceId(): ?int
{
return $this->source_id;
}
public function setSourceId(?int $source_id): self
{
$this->source_id = $source_id;
return $this;
}
public function getDeltaAvailable(): string
{
return $this->delta_available;
}
public function setDeltaAvailable(string $delta_available): self
{
$this->delta_available = $delta_available;
return $this;
}
public function getDeltaReserved(): string
{
return $this->delta_reserved;
}
public function setDeltaReserved(string $delta_reserved): self
{
$this->delta_reserved = $delta_reserved;
return $this;
}
public function getQtyBeforeAvailable(): string
{
return $this->qty_before_available;
}
public function setQtyBeforeAvailable(string $qty_before_available): self
{
$this->qty_before_available = $qty_before_available;
return $this;
}
public function getQtyAfterAvailable(): string
{
return $this->qty_after_available;
}
public function setQtyAfterAvailable(string $qty_after_available): self
{
$this->qty_after_available = $qty_after_available;
return $this;
}
public function getQtyBeforeReserved(): string
{
return $this->qty_before_reserved;
}
public function setQtyBeforeReserved(string $qty_before_reserved): self
{
$this->qty_before_reserved = $qty_before_reserved;
return $this;
}
public function getQtyAfterReserved(): string
{
return $this->qty_after_reserved;
}
public function setQtyAfterReserved(string $qty_after_reserved): self
{
$this->qty_after_reserved = $qty_after_reserved;
return $this;
}
public function getReason(): ?string
{
return $this->reason;
}
public function setReason(?string $reason): self
{
$this->reason = $reason;
return $this;
}
public function getActorId(): ?int
{
return $this->actor_id;
}
public function setActorId(?int $actor_id): self
{
$this->actor_id = $actor_id;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getUnitCostTtc(): ?float
{
return $this->unit_cost_ttc !== null ? (float) $this->unit_cost_ttc : null;
}
public function setUnitCostTtc(?float $unitCostTtc): self
{
$this->unit_cost_ttc = $unitCostTtc !== null
? number_format((float) $unitCostTtc, 3, '.', '')
: null;
return $this;
}
}