<?php
namespace App\AtechNet\CoreBundle\Entity;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\Table as Table;
/**
* StockMovementLog
*
* @Table(name="stock_movement_log")
* @Entity
*/
class StockMovementLog extends AbstractSignedEntity
{
public const LOG_AVAILABLE_FOR_SUB_TYPES = [
StockMovement::SUB_TYPE_IN_SHIPMENT,
StockMovement::SUB_TYPE_IN_EXCESS_AT_INVENTORY,
StockMovement::SUB_TYPE_IN_CONFIG_CHANGE,
StockMovement::SUB_TYPE_IN_ORDER_CONFIG_CHANGE,
StockMovement::SUB_TYPE_OUT_BASIC,
StockMovement::SUB_TYPE_OUT_SHORTAGE_AT_INVENTORY,
StockMovement::SUB_TYPE_OUT_REMOVED_FROM_STOCK,
StockMovement::SUB_TYPE_OUT_CONSUMPTION,
StockMovement::SUB_TYPE_OUT_CONFIG_CHANGE,
StockMovement::SUB_TYPE_OUT_ORDER_CONFIG_CHANGE,
StockMovement::SUB_TYPE_NEUTRAL_COMMISSION,
StockMovement::SUB_TYPE_NEUTRAL_USED_WITHIN_COMPANY,
];
/**
* @var string
*
* @Column(name="changeId", type="string", length=255, nullable=false)
*/
private $changeId;
/**
* @var StockMovement
*
* @ManyToOne(targetEntity="StockMovement", inversedBy="logs")
* @JoinColumn(name="stock_movement_id", referencedColumnName="id", nullable=true)
*/
private $stockMovement;
/**
* @var int|null
*
* @Column(name="deleted_stock_movement_id", type="integer", nullable=true)
*/
private $deletedStockMovementId = null;
/**
* @var int|null
*
* @Column(name="deleted_stock_movement_type_id", type="integer", nullable=true)
*/
private $deletedStockMovementTypeId = null;
/**
* @var int|null
*
* @Column(name="deleted_stock_movement_sub_type_id", type="integer", nullable=true)
*/
private $deletedStockMovementSubTypeId = null;
/**
* @var string|null
*
* @Column(name="deleted_stock_movement_exchange_rate", type="string", length=255, nullable=true)
*/
private $deletedStockMovementExhangeRate = null;
/**
* @var int
*
* @Column(name="stock_movement_item_id", type="integer", nullable=false)
*/
private $stockMovementItemId;
/**
* @var Product|null
*
* @ManyToOne(targetEntity="Product")
* @JoinColumn(name="source_product_id", referencedColumnName="id", nullable=true)
*/
private $sourceProduct = null;
/**
* @var Product|null
*
* @ManyToOne(targetEntity="Product")
* @JoinColumn(name="current_product_id", referencedColumnName="id", nullable=true)
*/
private $currentProduct = null;
/**
* @var int|null
*
* @Column(name="sourceQuantity", type="integer", nullable=true)
*/
private $sourceQuantity = null;
/**
* @var int|null
*
* @Column(name="currentQuantity", type="integer", nullable=true)
*/
private $currentQuantity = null;
/**
* @var float|null
*
* @Column(name="sourcePrice", type="decimal", precision=10, scale=2, nullable=true)
*/
private $sourcePrice = null;
/**
* @var float|null
*
* @Column(name="currentPrice", type="decimal", precision=10, scale=2, nullable=true)
*/
private $currentPrice = null;
/**
* @var float|null
*
* @Column(name="source_purchase_price", type="decimal", precision=10, scale=2, nullable=true)
*/
private $sourcePurchasePrice = null;
/**
* @var float|null
*
* @Column(name="current_purchase_price", type="decimal", precision=10, scale=2, nullable=true)
*/
private $currentPurchasePrice = null;
/**
* @param string $changeId
* @return $this
*/
public function setChangeId(string $changeId): StockMovementLog
{
$this->changeId = $changeId;
return $this;
}
/**
* @return string
*/
public function getChangeId(): string
{
return $this->changeId;
}
/**
* @param StockMovement|null $stockMovement
* @return $this
*/
public function setStockMovement(?StockMovement $stockMovement): StockMovementLog
{
$this->stockMovement = $stockMovement;
return $this;
}
/**
* @return StockMovement|null
*/
public function getStockMovement(): ?StockMovement
{
return $this->stockMovement;
}
/**
* @param int $stockMovementItemId
* @return $this
*/
public function setStockMovementItemId(int $stockMovementItemId): StockMovementLog
{
$this->stockMovementItemId = $stockMovementItemId;
return $this;
}
/**
* @return int
*/
public function getStockMovementItemId(): int
{
return $this->stockMovementItemId;
}
/**
* @param Product|null $sourceProduct
* @return $this
*/
public function setSourceProduct(Product $sourceProduct = null): StockMovementLog
{
$this->sourceProduct = $sourceProduct;
return $this;
}
/**
* @return Product|null
*/
public function getSourceProduct(): ?Product
{
return $this->sourceProduct;
}
/**
* @param Product|null $currentProduct
* @return $this
*/
public function setCurrentProduct(Product $currentProduct = null): StockMovementLog
{
$this->currentProduct = $currentProduct;
return $this;
}
/**
* @return Product|null
*/
public function getCurrentProduct(): ?Product
{
return $this->currentProduct;
}
/**
* @param int|null $sourceQuantity
* @return $this
*/
public function setSourceQuantity(int $sourceQuantity = null): StockMovementLog
{
$this->sourceQuantity = $sourceQuantity;
return $this;
}
/**
* @return int|null
*/
public function getSourceQuantity(): ?int
{
return $this->sourceQuantity;
}
/**
* @param int|null $currentQuantity
* @return $this
*/
public function setCurrentQuantity(int $currentQuantity = null): StockMovementLog
{
$this->currentQuantity = $currentQuantity;
return $this;
}
/**
* @return int|null
*/
public function getCurrentQuantity(): ?int
{
return $this->currentQuantity;
}
/**
* @param float|null $sourcePrice
* @return $this
*/
public function setSourcePrice(float $sourcePrice = null): StockMovementLog
{
$this->sourcePrice = $sourcePrice;
return $this;
}
/**
* @return float|null
*/
public function getSourcePrice(): ?float
{
return $this->sourcePrice;
}
/**
* @param float|null $currentPrice
* @return $this
*/
public function setCurrentPrice(float $currentPrice = null): StockMovementLog
{
$this->currentPrice = $currentPrice;
return $this;
}
/**
* @return float|null
*/
public function getCurrentPrice(): ?float
{
return $this->currentPrice;
}
/**
* @return bool
*/
public function isAmazon(): bool
{
if (
!is_null($this->getStockMovement()) &&
($this->getStockMovement()->getMerchant()->getId() == 33977 ||
$this->getStockMovement()->getMerchant()->getId() == 33978)
) {
return true;
}
return false;
}
/**
* @return int|null
*/
public function getDeletedStockMovementId(): ?int
{
return $this->deletedStockMovementId;
}
/**
* @param int|null $deletedStockMovementId
*/
public function setDeletedStockMovementId(?int $deletedStockMovementId): void
{
$this->deletedStockMovementId = $deletedStockMovementId;
}
/**
* @return int|null
*/
public function getDeletedStockMovementTypeId(): ?int
{
return $this->deletedStockMovementTypeId;
}
/**
* @param int|null $deletedStockMovementTypeId
*/
public function setDeletedStockMovementTypeId(?int $deletedStockMovementTypeId): void
{
$this->deletedStockMovementTypeId = $deletedStockMovementTypeId;
}
/**
* @return int|null
*/
public function getDeletedStockMovementSubTypeId(): ?int
{
return $this->deletedStockMovementSubTypeId;
}
/**
* @param int|null $deletedStockMovementSubTypeId
*/
public function setDeletedStockMovementSubTypeId(?int $deletedStockMovementSubTypeId): void
{
$this->deletedStockMovementSubTypeId = $deletedStockMovementSubTypeId;
}
/**
* @return string|null
*/
public function getDeletedStockMovementExhangeRate(): ?string
{
return $this->deletedStockMovementExhangeRate;
}
/**
* @param string|null $deletedStockMovementExhangeRate
*/
public function setDeletedStockMovementExhangeRate(?string $deletedStockMovementExhangeRate): void
{
$this->deletedStockMovementExhangeRate = $deletedStockMovementExhangeRate;
}
/**
* @return float|null
*/
public function getSourcePurchasePrice(): ?float
{
return $this->sourcePurchasePrice;
}
/**
* @param float|null $sourcePurchasePrice
*/
public function setSourcePurchasePrice(?float $sourcePurchasePrice): void
{
$this->sourcePurchasePrice = $sourcePurchasePrice;
}
/**
* @return float|null
*/
public function getCurrentPurchasePrice(): ?float
{
return $this->currentPurchasePrice;
}
/**
* @param float|null $currentPurchasePrice
*/
public function setCurrentPurchasePrice(?float $currentPurchasePrice): void
{
$this->currentPurchasePrice = $currentPurchasePrice;
}
}