<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use RxConnexionBundle\Entity\Base\BaseEntity;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\PurchaseInvoiceOtherCostRepository")
 * @ORM\Table(name="purchase_invoice_other_cost")
 * @ORM\HasLifecycleCallbacks()
 */

class PurchaseInvoiceOtherCostEntity extends BaseEntity
{

    /**
     * @ORM\Column(name="description", type="string")
     */
    protected $description;

    /**
     * @ORM\Column(name="amount",type="decimal", precision=12, scale=2)
     */
    protected $amount;

    /**
     * @ORM\ManyToOne(targetEntity="PurchaseInvoiceEntity", inversedBy="purchaseInvoiceOtherCosts")
     * @ORM\JoinColumn(name="purchase_invoice_id", referencedColumnName="id")
     */
    protected $purchaseInvoice;

    /*--------------------------------------------------------------------------------------------------------*/
    /*					User Defined Setters and Getters													  */
    /*--------------------------------------------------------------------------------------------------------*/


    /**
     * Set description
     *
     * @param string $description
     *
     * @return PurchaseInvoiceOtherCostEntity
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set amount
     *
     * @param string $amount
     *
     * @return PurchaseInvoiceOtherCostEntity
     */
    public function setAmount($amount)
    {
        $this->amount = floatval(str_replace(',', '', $amount));

        return $this;
    }

    /**
     * Get amount
     *
     * @return string
     */
    public function getAmount()
    {
        return $this->amount;
    }

    /**
     * Set purchaseInvoice
     *
     * @param \RxConnexionBundle\Entity\PurchaseInvoiceEntity $purchaseInvoice
     *
     * @return PurchaseInvoiceOtherCostEntity
     */
    public function setPurchaseInvoice(\RxConnexionBundle\Entity\PurchaseInvoiceEntity $purchaseInvoice = null)
    {
        $this->purchaseInvoice = $purchaseInvoice;

        return $this;
    }

    /**
     * Get purchaseInvoice
     *
     * @return \RxConnexionBundle\Entity\PurchaseInvoiceEntity
     */
    public function getPurchaseInvoice()
    {
        return $this->purchaseInvoice;
    }
}
