src/AtechNet/CoreBundle/Entity/StockMovementLog.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping\Column;
  4. use Doctrine\ORM\Mapping\Entity;
  5. use Doctrine\ORM\Mapping\JoinColumn;
  6. use Doctrine\ORM\Mapping\ManyToOne;
  7. use Doctrine\ORM\Mapping\Table as Table;
  8. /**
  9.  * StockMovementLog
  10.  *
  11.  * @Table(name="stock_movement_log")
  12.  * @Entity
  13.  */
  14. class StockMovementLog extends AbstractSignedEntity
  15. {
  16.     public const LOG_AVAILABLE_FOR_SUB_TYPES = [
  17.         StockMovement::SUB_TYPE_IN_SHIPMENT,
  18.         StockMovement::SUB_TYPE_IN_EXCESS_AT_INVENTORY,
  19.         StockMovement::SUB_TYPE_IN_CONFIG_CHANGE,
  20.         StockMovement::SUB_TYPE_IN_ORDER_CONFIG_CHANGE,
  21.         StockMovement::SUB_TYPE_OUT_BASIC,
  22.         StockMovement::SUB_TYPE_OUT_SHORTAGE_AT_INVENTORY,
  23.         StockMovement::SUB_TYPE_OUT_REMOVED_FROM_STOCK,
  24.         StockMovement::SUB_TYPE_OUT_CONSUMPTION,
  25.         StockMovement::SUB_TYPE_OUT_CONFIG_CHANGE,
  26.         StockMovement::SUB_TYPE_OUT_ORDER_CONFIG_CHANGE,
  27.         StockMovement::SUB_TYPE_NEUTRAL_COMMISSION,
  28.         StockMovement::SUB_TYPE_NEUTRAL_USED_WITHIN_COMPANY,
  29.     ];
  30.     /**
  31.      * @var string
  32.      *
  33.      * @Column(name="changeId", type="string", length=255, nullable=false)
  34.      */
  35.     private $changeId;
  36.     /**
  37.      * @var StockMovement
  38.      *
  39.      * @ManyToOne(targetEntity="StockMovement", inversedBy="logs")
  40.      * @JoinColumn(name="stock_movement_id", referencedColumnName="id", nullable=true)
  41.      */
  42.     private $stockMovement;
  43.     /**
  44.      * @var int|null
  45.      *
  46.      * @Column(name="deleted_stock_movement_id", type="integer", nullable=true)
  47.      */
  48.     private $deletedStockMovementId = null;
  49.     /**
  50.      * @var int|null
  51.      *
  52.      * @Column(name="deleted_stock_movement_type_id", type="integer", nullable=true)
  53.      */
  54.     private $deletedStockMovementTypeId = null;
  55.     /**
  56.      * @var int|null
  57.      *
  58.      * @Column(name="deleted_stock_movement_sub_type_id", type="integer", nullable=true)
  59.      */
  60.     private $deletedStockMovementSubTypeId = null;
  61.     /**
  62.      * @var string|null
  63.      *
  64.      * @Column(name="deleted_stock_movement_exchange_rate", type="string", length=255, nullable=true)
  65.      */
  66.     private $deletedStockMovementExhangeRate = null;
  67.     /**
  68.      * @var int
  69.      *
  70.      * @Column(name="stock_movement_item_id", type="integer", nullable=false)
  71.      */
  72.     private $stockMovementItemId;
  73.     /**
  74.      * @var Product|null
  75.      *
  76.      * @ManyToOne(targetEntity="Product")
  77.      * @JoinColumn(name="source_product_id", referencedColumnName="id", nullable=true)
  78.      */
  79.     private $sourceProduct = null;
  80.     /**
  81.      * @var Product|null
  82.      *
  83.      * @ManyToOne(targetEntity="Product")
  84.      * @JoinColumn(name="current_product_id", referencedColumnName="id", nullable=true)
  85.      */
  86.     private $currentProduct = null;
  87.     /**
  88.      * @var int|null
  89.      *
  90.      * @Column(name="sourceQuantity", type="integer", nullable=true)
  91.      */
  92.     private $sourceQuantity = null;
  93.     /**
  94.      * @var int|null
  95.      *
  96.      * @Column(name="currentQuantity", type="integer", nullable=true)
  97.      */
  98.     private $currentQuantity = null;
  99.     /**
  100.      * @var float|null
  101.      *
  102.      * @Column(name="sourcePrice", type="decimal", precision=10, scale=2, nullable=true)
  103.      */
  104.     private $sourcePrice = null;
  105.     /**
  106.      * @var float|null
  107.      *
  108.      * @Column(name="currentPrice", type="decimal", precision=10, scale=2, nullable=true)
  109.      */
  110.     private $currentPrice = null;
  111.     /**
  112.      * @var float|null
  113.      *
  114.      * @Column(name="source_purchase_price", type="decimal", precision=10, scale=2, nullable=true)
  115.      */
  116.     private $sourcePurchasePrice = null;
  117.     /**
  118.      * @var float|null
  119.      *
  120.      * @Column(name="current_purchase_price", type="decimal", precision=10, scale=2, nullable=true)
  121.      */
  122.     private $currentPurchasePrice = null;
  123.     /**
  124.      * @param string $changeId
  125.      * @return $this
  126.      */
  127.     public function setChangeId(string $changeId): StockMovementLog
  128.     {
  129.         $this->changeId = $changeId;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return string
  134.      */
  135.     public function getChangeId(): string
  136.     {
  137.         return $this->changeId;
  138.     }
  139.     /**
  140.      * @param StockMovement|null $stockMovement
  141.      * @return $this
  142.      */
  143.     public function setStockMovement(?StockMovement $stockMovement): StockMovementLog
  144.     {
  145.         $this->stockMovement = $stockMovement;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return StockMovement|null
  150.      */
  151.     public function getStockMovement(): ?StockMovement
  152.     {
  153.         return $this->stockMovement;
  154.     }
  155.     /**
  156.      * @param int $stockMovementItemId
  157.      * @return $this
  158.      */
  159.     public function setStockMovementItemId(int $stockMovementItemId): StockMovementLog
  160.     {
  161.         $this->stockMovementItemId = $stockMovementItemId;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return int
  166.      */
  167.     public function getStockMovementItemId(): int
  168.     {
  169.         return $this->stockMovementItemId;
  170.     }
  171.     /**
  172.      * @param Product|null $sourceProduct
  173.      * @return $this
  174.      */
  175.     public function setSourceProduct(Product $sourceProduct = null): StockMovementLog
  176.     {
  177.         $this->sourceProduct = $sourceProduct;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Product|null
  182.      */
  183.     public function getSourceProduct(): ?Product
  184.     {
  185.         return $this->sourceProduct;
  186.     }
  187.     /**
  188.      * @param Product|null $currentProduct
  189.      * @return $this
  190.      */
  191.     public function setCurrentProduct(Product $currentProduct = null): StockMovementLog
  192.     {
  193.         $this->currentProduct = $currentProduct;
  194.         return $this;
  195.     }
  196.     /**
  197.      * @return Product|null
  198.      */
  199.     public function getCurrentProduct(): ?Product
  200.     {
  201.         return $this->currentProduct;
  202.     }
  203.     /**
  204.      * @param int|null $sourceQuantity
  205.      * @return $this
  206.      */
  207.     public function setSourceQuantity(int $sourceQuantity = null): StockMovementLog
  208.     {
  209.         $this->sourceQuantity = $sourceQuantity;
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return int|null
  214.      */
  215.     public function getSourceQuantity(): ?int
  216.     {
  217.         return $this->sourceQuantity;
  218.     }
  219.     /**
  220.      * @param int|null $currentQuantity
  221.      * @return $this
  222.      */
  223.     public function setCurrentQuantity(int $currentQuantity = null): StockMovementLog
  224.     {
  225.         $this->currentQuantity = $currentQuantity;
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return int|null
  230.      */
  231.     public function getCurrentQuantity(): ?int
  232.     {
  233.         return $this->currentQuantity;
  234.     }
  235.     /**
  236.      * @param float|null $sourcePrice
  237.      * @return $this
  238.      */
  239.     public function setSourcePrice(float $sourcePrice = null): StockMovementLog
  240.     {
  241.         $this->sourcePrice = $sourcePrice;
  242.         return $this;
  243.     }
  244.     /**
  245.      * @return float|null
  246.      */
  247.     public function getSourcePrice(): ?float
  248.     {
  249.         return $this->sourcePrice;
  250.     }
  251.     /**
  252.      * @param float|null $currentPrice
  253.      * @return $this
  254.      */
  255.     public function setCurrentPrice(float $currentPrice = null): StockMovementLog
  256.     {
  257.         $this->currentPrice = $currentPrice;
  258.         return $this;
  259.     }
  260.     /**
  261.      * @return float|null
  262.      */
  263.     public function getCurrentPrice(): ?float
  264.     {
  265.         return $this->currentPrice;
  266.     }
  267.     /**
  268.      * @return bool
  269.      */
  270.     public function isAmazon(): bool
  271.     {
  272.         if (
  273.             !is_null($this->getStockMovement()) &&
  274.             ($this->getStockMovement()->getMerchant()->getId() == 33977 ||
  275.             $this->getStockMovement()->getMerchant()->getId() == 33978)
  276.         ) {
  277.             return true;
  278.         }
  279.         return false;
  280.     }
  281.     /**
  282.      * @return int|null
  283.      */
  284.     public function getDeletedStockMovementId(): ?int
  285.     {
  286.         return $this->deletedStockMovementId;
  287.     }
  288.     /**
  289.      * @param int|null $deletedStockMovementId
  290.      */
  291.     public function setDeletedStockMovementId(?int $deletedStockMovementId): void
  292.     {
  293.         $this->deletedStockMovementId = $deletedStockMovementId;
  294.     }
  295.     /**
  296.      * @return int|null
  297.      */
  298.     public function getDeletedStockMovementTypeId(): ?int
  299.     {
  300.         return $this->deletedStockMovementTypeId;
  301.     }
  302.     /**
  303.      * @param int|null $deletedStockMovementTypeId
  304.      */
  305.     public function setDeletedStockMovementTypeId(?int $deletedStockMovementTypeId): void
  306.     {
  307.         $this->deletedStockMovementTypeId = $deletedStockMovementTypeId;
  308.     }
  309.     /**
  310.      * @return int|null
  311.      */
  312.     public function getDeletedStockMovementSubTypeId(): ?int
  313.     {
  314.         return $this->deletedStockMovementSubTypeId;
  315.     }
  316.     /**
  317.      * @param int|null $deletedStockMovementSubTypeId
  318.      */
  319.     public function setDeletedStockMovementSubTypeId(?int $deletedStockMovementSubTypeId): void
  320.     {
  321.         $this->deletedStockMovementSubTypeId = $deletedStockMovementSubTypeId;
  322.     }
  323.     /**
  324.      * @return string|null
  325.      */
  326.     public function getDeletedStockMovementExhangeRate(): ?string
  327.     {
  328.         return $this->deletedStockMovementExhangeRate;
  329.     }
  330.     /**
  331.      * @param string|null $deletedStockMovementExhangeRate
  332.      */
  333.     public function setDeletedStockMovementExhangeRate(?string $deletedStockMovementExhangeRate): void
  334.     {
  335.         $this->deletedStockMovementExhangeRate = $deletedStockMovementExhangeRate;
  336.     }
  337.     /**
  338.      * @return float|null
  339.      */
  340.     public function getSourcePurchasePrice(): ?float
  341.     {
  342.         return $this->sourcePurchasePrice;
  343.     }
  344.     /**
  345.      * @param float|null $sourcePurchasePrice
  346.      */
  347.     public function setSourcePurchasePrice(?float $sourcePurchasePrice): void
  348.     {
  349.         $this->sourcePurchasePrice = $sourcePurchasePrice;
  350.     }
  351.     /**
  352.      * @return float|null
  353.      */
  354.     public function getCurrentPurchasePrice(): ?float
  355.     {
  356.         return $this->currentPurchasePrice;
  357.     }
  358.     /**
  359.      * @param float|null $currentPurchasePrice
  360.      */
  361.     public function setCurrentPurchasePrice(?float $currentPurchasePrice): void
  362.     {
  363.         $this->currentPurchasePrice = $currentPurchasePrice;
  364.     }
  365. }