<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use RxConnexionBundle\Entity\Base\BaseEntity;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\PatientBillingBreakdownRepository")
 * @ORM\Table(name="patient_billing_breakdown")
 */

class PatientBillingBreakdownEntity extends BaseEntity
{
    const TYPE_CHART_PROCEDURE = 'Chart Procedure';
    const TYPE_ITEM = 'Item';
    const TYPE_OTHER = 'Other';

    const ITEM_TYPE_ACCESSORY = 'Accessory';
    const ITEM_TYPE_CPAP_PACKAGE = 'CPAP Package';
    const ITEM_TYPE_MEDICAL_SUPPLIES = 'Medical Supplies';
    const ITEM_TYPE_PART_OF_CPAP_PACKAGE = 'Part of CPAP Package';

    const TERM_LONG_TERM_RENTAL = 'Long Term Rental';
    const TERM_WARRANTY = 'Warranty';
    const TERM_RENT_TO_OWN = 'Rent to Own';

    const BENEFIT_PERIOD_CALENDAR_YEAR = 'Calendar Year';
    const BENEFIT_PERIOD_BENEFIT_YEAR = 'Benefit Year';

    const STATUS_RETURN = 'Return';

    /**
     * @ORM\Column(name="serial_number", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $serialNumber;

    /**
     * @ORM\Column(name="type", type="string", length=20)
     * @Groups("forAudit")
     */
    protected $type;

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

    /**
     * @ORM\Column(name="quantity", type="integer", nullable=true)
     * @Groups("forAudit")
     */
    protected $quantity;

    /**
     * @ORM\Column(name="price", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $price;

    /**
     * @ORM\Column(name="price_covered", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $priceCovered;

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

    /**
     * @ORM\Column(name="amount_paid", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $amountPaid;

    /**
     * @ORM\Column(name="amount_balance", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $amountBalance;

    /**
     * @ORM\Column(name="amount_refunded", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $amountRefunded;

    /**
     * @ORM\Column(name="amount_covered", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $amountCovered;

    /**
     * @ORM\Column(name="invoice_quantity", type="integer", nullable=true)
     * @Groups("forAudit")
     */
    protected $invoiceQuantity;

    /**
     * @ORM\Column(name="invoice_price", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $invoicePrice;

    /**
     * @ORM\Column(name="invoice_amount", type="decimal", precision=12, scale=2, nullable=true)
     * @Groups("forAudit")
     */
    protected $invoiceAmount;

    /**
     * @ORM\Column(name="tran_date_for_other", type="datetime", nullable=true)
     * @Groups("forAudit")
     */
    protected $tranDateForOther;

    /**
     * @ORM\Column(name="item_type", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $itemType;

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * @ORM\Column(name="term", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $term;

    /**
     * @ORM\Column(name="frequency", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $frequency;

    /**
     * @ORM\Column(name="benefit_period", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $benefitPeriod;

    /**
     * @ORM\Column(name="is_accessory", type="boolean", nullable=true)
     */
    protected $isAccessory;
//
//    /**
//     * @ORM\Column(name="is_cpap_package", type="boolean", nullable=true)
//     */
//    protected $isCpapPackage;

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientBillingEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="patient_billing_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientBilling;

    /**
     * @ORM\ManyToOne(targetEntity="PatientRentalEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="patient_rental_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientRental;

    /**
     * @ORM\ManyToOne(targetEntity="PatientChartEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="patient_chart_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientChart;

    /**
     * @ORM\ManyToOne(targetEntity="ChartProcedureEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="chart_procedure_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $chartProcedure;

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\InventorySerialNoEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="inventory_serial_no_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $inventorySerialNo;

    /**
     * @ORM\ManyToOne(targetEntity="ItemEntity", inversedBy="patientBillingBreakdowns")
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $item;

    /**
     * @ORM\OneToMany(targetEntity="PatientPaymentBreakdownEntity", mappedBy="patientBillingBreakdown")
     */
    protected $patientPaymentBreakdowns;

    /**
     * @ORM\OneToMany(targetEntity="PatientRefundBreakdownEntity", mappedBy="patientBillingBreakdown")
     */
    protected $patientRefundBreakdowns;

    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->isDeleted = 0;
        $this->amountBalance = $this->amount;
        $this->invoiceQuantity = $this->quantity;
        $this->invoicePrice = $this->price;
        $this->invoiceAmount = $this->amount;
    }

    /*--------------------------------------------------------------------------------------------------------*/
    /*					Use Defined Setters and Getters														  */
    /*--------------------------------------------------------------------------------------------------------*/

    /**
     * Get displayItemDescription
     *
     * @return string
    */
    public function getDisplayItemDescription(){
        $str = "";
        if($this->type == self::TYPE_CHART_PROCEDURE){
            $str .= $this->getPatientChart()->getIdAndChartDateAndChartType();
        } elseif($this->type == self::TYPE_ITEM){
            $str .= $this->getItem()->getDescription();
        } elseif($this->type == self::TYPE_OTHER){
            $str .= $this->getDescription();
        }
        return $str;
    }

    /**
     * Set amountValue
     */
    public function setAmountValue(){
        /**@var PatientPaymentBreakdownEntity $patientPaymentBreakdown*/
        $amountPaid = 0;

        foreach($this->getPatientPaymentBreakdowns() as $patientPaymentBreakdown){
            if(!$patientPaymentBreakdown->getPatientPayment()->getIsDeleted() && $patientPaymentBreakdown->getPatientPayment()->getPaymentStatus() !== PatientPaymentEntity::PAYMENT_STATUS_VOID && $patientPaymentBreakdown->getIsRefunded() == false){
                $amountPaid += floatval($patientPaymentBreakdown->getAmount());
            }
        }

        $this->amountPaid = $amountPaid;
        $this->amountBalance = ($this->amount - $this->amountPaid);

    }

    /**
     * Set amountRefundValue
     */
    public function setRefundAmountValue(){
        /**@var PatientRefundBreakdownEntity $patientRefundBreakdown*/
        $amountBalance = 0;
        $amountRefunded = 0;
        foreach($this->getPatientRefundBreakdowns() as $patientRefundBreakdown){
            if(!$patientRefundBreakdown->getPatientBillingRefund()->getIsDeleted()){
                foreach($this->getPatientPaymentBreakdowns() as $patientPaymentBreakdown){
//                    if(!$patientPaymentBreakdown->getPatientPayment()->getIsDeleted() && $patientPaymentBreakdown->getPatientPayment()->getPaymentStatus() !== PatientPaymentEntity::PAYMENT_STATUS_VOID){
                        if ($patientRefundBreakdown->getAmount() != "") {
                            $patientPaymentBreakdown->setIsRefunded(true);
                        }
//                    }
                }

                $amountBalance += floatval($patientRefundBreakdown->getAmount());
                $amountRefunded += floatval($patientRefundBreakdown->getAmount());
            }
        }

        $this->amountRefunded = $amountRefunded;
        $this->amountBalance = $amountBalance;
        $this->amountPaid = $this->amountPaid - $amountRefunded;

    }

    /**
     * Set initialInvoiceAmountValues
     * @return boolean
     */
    public function setInitialInvoiceAmountValues(){
        if(empty($this->invoiceQuantity) || is_null($this->invoiceQuantity)){
            $this->invoiceQuantity = $this->quantity;
        }
        if(empty($this->invoicePrice) || is_null($this->invoicePrice)){
            $this->invoicePrice = $this->price;
        }
        if(empty($this->invoiceAmount) || is_null($this->invoiceAmount)){
            $this->invoiceAmount = $this->amount;
        }
        return true;
    }

    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/

    /**
     * Set type
     *
     * @param string $type
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

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

    /**
     * Set description
     *
     * @param string $description
     *
     * @return PatientBillingBreakdownEntity
     */
    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 PatientBillingBreakdownEntity
     */
    public function setAmount($amount)
    {
        $this->amount = str_replace(',', '', $amount);

        return $this;
    }

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

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

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

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedBy
     *
     * @param string $updatedBy
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

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

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set patientBilling
     *
     * @param \RxConnexionBundle\Entity\PatientBillingEntity $patientBilling
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setPatientBilling(\RxConnexionBundle\Entity\PatientBillingEntity $patientBilling = null)
    {
        $this->patientBilling = $patientBilling;

        return $this;
    }

    /**
     * Get patientBilling
     *
     * @return \RxConnexionBundle\Entity\PatientBillingEntity
     */
    public function getPatientBilling()
    {
        return $this->patientBilling;
    }

    /**
     * Set patientChart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientChart
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setPatientChart(\RxConnexionBundle\Entity\PatientChartEntity $patientChart = null)
    {
        $this->patientChart = $patientChart;

        return $this;
    }

    /**
     * Get patientChart
     *
     * @return \RxConnexionBundle\Entity\PatientChartEntity
     */
    public function getPatientChart()
    {
        return $this->patientChart;
    }

    /**
     * Set chartProcedure
     *
     * @param \RxConnexionBundle\Entity\ChartProcedureEntity $chartProcedure
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setChartProcedure(\RxConnexionBundle\Entity\ChartProcedureEntity $chartProcedure = null)
    {
        $this->chartProcedure = $chartProcedure;

        return $this;
    }

    /**
     * Get chartProcedure
     *
     * @return \RxConnexionBundle\Entity\ChartProcedureEntity
     */
    public function getChartProcedure()
    {
        return $this->chartProcedure;
    }

    /**
     * Set quantity
     *
     * @param integer $quantity
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setQuantity($quantity)
    {
        $this->quantity = str_replace(',', '', $quantity);

        return $this;
    }

    /**
     * Get quantity
     *
     * @return integer
     */
    public function getQuantity()
    {
        return $this->quantity;
    }

    /**
     * Set price
     *
     * @param string $price
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setPrice($price)
    {
        $this->price = str_replace(',', '', $price);

        return $this;
    }

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

    /**
     * Set item
     *
     * @param \RxConnexionBundle\Entity\ItemEntity $item
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setItem(\RxConnexionBundle\Entity\ItemEntity $item = null)
    {
        $this->item = $item;

        return $this;
    }

    /**
     * Get item
     *
     * @return \RxConnexionBundle\Entity\ItemEntity
     */
    public function getItem()
    {
        return $this->item;
    }

    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Set tranDateForOther
     *
     * @param \DateTime $tranDateForOther
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setTranDateForOther($tranDateForOther)
    {
        $this->tranDateForOther = $tranDateForOther;

        return $this;
    }

    /**
     * Get tranDateForOther
     *
     * @return \DateTime
     */
    public function getTranDateForOther()
    {
        return $this->tranDateForOther;
    }

    /**
     * Set itemType
     *
     * @param string $itemType
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setItemType($itemType)
    {
        $this->itemType = $itemType;

        return $this;
    }

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


    /**
     * Set status
     *
     * @param string $status
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

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

    /**
     * Set term
     *
     * @param string $term
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setTerm($term)
    {
        $this->term = $term;

        return $this;
    }

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

    /**
     * Set isAccessory
     *
     * @param boolean $isAccessory
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setIsAccessory($isAccessory)
    {
        $this->isAccessory = $isAccessory;

        return $this;
    }

    /**
     * Get isAccessory
     *
     * @return boolean
     */
    public function getIsAccessory()
    {
        return $this->isAccessory;
    }

    /**
     * Set patientRental
     *
     * @param \RxConnexionBundle\Entity\PatientRentalEntity $patientRental
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setPatientRental(\RxConnexionBundle\Entity\PatientRentalEntity $patientRental = null)
    {
        $this->patientRental = $patientRental;

        return $this;
    }

    /**
     * Get patientRental
     *
     * @return \RxConnexionBundle\Entity\PatientRentalEntity
     */
    public function getPatientRental()
    {
        return $this->patientRental;
    }

    /**
     * Set serialNumber
     *
     * @param string $serialNumber
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setSerialNumber($serialNumber)
    {
        $this->serialNumber = $serialNumber;

        return $this;
    }

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

    /**
     * Set invoiceQuantity
     *
     * @param integer $invoiceQuantity
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setInvoiceQuantity($invoiceQuantity)
    {
        $this->invoiceQuantity = $invoiceQuantity;

        return $this;
    }

    /**
     * Get invoiceQuantity
     *
     * @return integer
     */
    public function getInvoiceQuantity()
    {
        return $this->invoiceQuantity;
    }

    /**
     * Set invoicePrice
     *
     * @param string $invoicePrice
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setInvoicePrice($invoicePrice)
    {
        $this->invoicePrice = $invoicePrice;

        return $this;
    }

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

    /**
     * Set invoiceAmount
     *
     * @param string $invoiceAmount
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setInvoiceAmount($invoiceAmount)
    {
        $this->invoiceAmount = $invoiceAmount;

        return $this;
    }

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

    /**
     * Set amountPaid
     *
     * @param string $amountPaid
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setAmountPaid($amountPaid)
    {
        $this->amountPaid = str_replace(',', '', $amountPaid);

        return $this;
    }

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

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->patientPaymentBreakdowns = new \Doctrine\Common\Collections\ArrayCollection();
        $this->patientRefundBreakdowns = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add patientPaymentBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientPaymentBreakdownEntity $patientPaymentBreakdown
     *
     * @return PatientBillingBreakdownEntity
     */
    public function addPatientPaymentBreakdown(\RxConnexionBundle\Entity\PatientPaymentBreakdownEntity $patientPaymentBreakdown)
    {
        $this->patientPaymentBreakdowns[] = $patientPaymentBreakdown;

        return $this;
    }

    /**
     * Remove patientPaymentBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientPaymentBreakdownEntity $patientPaymentBreakdown
     */
    public function removePatientPaymentBreakdown(\RxConnexionBundle\Entity\PatientPaymentBreakdownEntity $patientPaymentBreakdown)
    {
        $this->patientPaymentBreakdowns->removeElement($patientPaymentBreakdown);
    }

    /**
     * Get patientPaymentBreakdowns
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientPaymentBreakdowns()
    {
        return $this->patientPaymentBreakdowns;
    }

    /**
     * Set amountBalance
     *
     * @param string $amountBalance
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setAmountBalance($amountBalance)
    {
        $this->amountBalance = str_replace(',','',$amountBalance);

        return $this;
    }

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

    /**
     * Set amountCovered
     *
     * @param string $amountCovered
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setAmountCovered($amountCovered)
    {
        $this->amountCovered = str_replace(',', '', $amountCovered);

        return $this;
    }

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

    /**
     * Set priceCovered
     *
     * @param string $priceCovered
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setPriceCovered($priceCovered)
    {
        $this->priceCovered = str_replace(',','',$priceCovered);

        return $this;
    }

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

    /**
     * Set frequency
     *
     * @param string $frequency
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setFrequency($frequency)
    {
        $this->frequency = $frequency;

        return $this;
    }

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

    /**
     * Set benefitPeriod
     *
     * @param string $benefitPeriod
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setBenefitPeriod($benefitPeriod)
    {
        $this->benefitPeriod = $benefitPeriod;

        return $this;
    }

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

    /**
     * Add patientRefundBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientRefundBreakdownEntity $patientRefundBreakdown
     *
     * @return PatientBillingBreakdownEntity
     */
    public function addPatientRefundBreakdown(\RxConnexionBundle\Entity\PatientRefundBreakdownEntity $patientRefundBreakdown)
    {
        $this->patientRefundBreakdowns[] = $patientRefundBreakdown;

        return $this;
    }

    /**
     * Remove patientRefundBreakdown
     *
     * @param \RxConnexionBundle\Entity\PatientRefundBreakdownEntity $patientRefundBreakdown
     */
    public function removePatientRefundBreakdown(\RxConnexionBundle\Entity\PatientRefundBreakdownEntity $patientRefundBreakdown)
    {
        $this->patientRefundBreakdowns->removeElement($patientRefundBreakdown);
    }

    /**
     * Get patientRefundBreakdowns
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientRefundBreakdowns()
    {
        return $this->patientRefundBreakdowns;
    }

    /**
     * Set amountRefunded
     *
     * @param string $amountRefunded
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setAmountRefunded($amountRefunded)
    {
        $this->amountRefunded = $amountRefunded;

        return $this;
    }

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

    /**
     * Set inventorySerialNo
     *
     * @param \RxConnexionBundle\Entity\InventorySerialNoEntity $inventorySerialNo
     *
     * @return PatientBillingBreakdownEntity
     */
    public function setInventorySerialNo(\RxConnexionBundle\Entity\InventorySerialNoEntity $inventorySerialNo = null)
    {
        $this->inventorySerialNo = $inventorySerialNo;

        return $this;
    }

    /**
     * Get inventorySerialNo
     *
     * @return \RxConnexionBundle\Entity\InventorySerialNoEntity
     */
    public function getInventorySerialNo()
    {
        return $this->inventorySerialNo;
    }

}
