src/V4/Model/QuoteLine/QuoteLine.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\V4\Model\QuoteLine;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use App\Model\IriNormalizableInterface;
  5. use App\Model\NormalizeAsIRITrait;
  6. use App\Model\Traits\BlamableTrait;
  7. use App\Model\Traits\ImportableObjectTrait;
  8. use App\Model\Traits\TimestampableTrait;
  9. use App\V4\Model\FormatNumberTrait;
  10. use App\V4\Model\Quote\Quote;
  11. use App\V4\Model\QuoteLineInfo\QuoteLineInfo;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. use Symfony\Component\Validator\Constraints as Assert;
  14. class QuoteLine implements IriNormalizableInterface
  15. {
  16.     public const DEFAULT_VAT_RATE_VALUE '20.00';
  17.     public const DISCOUNT_TYPE_PERCENTAGE 'percentage';
  18.     public const DISCOUNT_TYPE_AMOUNT 'amount';
  19.     use TimestampableTrait;
  20.     use BlamableTrait;
  21.     use ImportableObjectTrait;
  22.     use NormalizeAsIRITrait;
  23.     use FormatNumberTrait;
  24.     /**
  25.      * @ApiProperty(identifier=true)
  26.      *
  27.      * @var string|null
  28.      *
  29.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update", "quote:regenerate"})
  30.      */
  31.     private $id;
  32.     /**
  33.      * @var Quote|null
  34.      *
  35.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  36.      */
  37.     private $quote;
  38.     /**
  39.      * @var QuoteLineInfo|null
  40.      *
  41.      * @Groups({"list", "new", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  42.      */
  43.     private $quoteLineInfo;
  44.     /**
  45.      * @var string|null
  46.      *
  47.      * @Assert\NotBlank(
  48.      *     message="validation_required"
  49.      * )
  50.      *
  51.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  52.      */
  53.     private $name;
  54.     /**
  55.      * @var string|null
  56.      *
  57.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  58.      */
  59.     private $reference;
  60.     /**
  61.      * @var string|null
  62.      *
  63.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  64.      */
  65.     private $comment;
  66.     /**
  67.      * @var string
  68.      *
  69.      * @Assert\GreaterThanOrEqual(0)
  70.      *
  71.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update", "quote:regenerate"})
  72.      */
  73.     private $unitPriceExclVat '0.00';
  74.     /**
  75.      * @var int
  76.      *
  77.      * @Assert\GreaterThan(0)
  78.      *
  79.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  80.      */
  81.     private $quantity 0;
  82.     /**
  83.      * @var string|null
  84.      *
  85.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  86.      */
  87.     private $discountType;
  88.     /**
  89.      * @var string
  90.      *
  91.      * @Assert\GreaterThanOrEqual(0)
  92.      *
  93.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  94.      */
  95.     private $discountValue '0.00';
  96.     /**
  97.      * @var string
  98.      */
  99.     private $discountAmount '0.00';
  100.     /**
  101.      * @var string
  102.      *
  103.      * @Groups({"list", "new", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  104.      */
  105.     private $vatRate self::DEFAULT_VAT_RATE_VALUE;
  106.     /**
  107.      * @var string
  108.      *
  109.      * @Groups({"list", "new", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  110.      */
  111.     private $vatAmount '0.00';
  112.     /**
  113.      * @var string
  114.      *
  115.      * @Groups({"quote:regenerate"})
  116.      */
  117.     private $totalExclDiscountAndVat '0.00';
  118.     /**
  119.      * @var string
  120.      *
  121.      * @Groups({"quote:regenerate"})
  122.      */
  123.     private $totalExclDiscount '0.00';
  124.     /**
  125.      * @var string
  126.      *
  127.      * @Groups({"quote:regenerate"})
  128.      */
  129.     private $totalExclVat '0.00';
  130.     /**
  131.      * @var string
  132.      *
  133.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  134.      */
  135.     private $vatAmountExclDiscount '0.00';
  136.     /**
  137.      * @var string
  138.      *
  139.      * @Groups({"quote:regenerate"})
  140.      */
  141.     private $total '0.00';
  142.     /**
  143.      * @var bool
  144.      *
  145.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  146.      */
  147.     private $isOptional false;
  148.     /**
  149.      * @var string|null
  150.      *
  151.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  152.      */
  153.     private $sectionName;
  154.     /**
  155.      * @var int|null
  156.      *
  157.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  158.      */
  159.     private $position;
  160.     /**
  161.      * @var string|null
  162.      *
  163.      * @Groups({"list", "write_post_quote", "quote:write", "quote:read", "quote:update"})
  164.      */
  165.     private $description;
  166.     /**
  167.      * @return string
  168.      */
  169.     public function __toString(): string
  170.     {
  171.         return $this->id ?? '';
  172.     }
  173.     /**
  174.      * @return string|null
  175.      */
  176.     public function getId(): ?string
  177.     {
  178.         return $this->id;
  179.     }
  180.     /**
  181.      * @param string|null $id
  182.      *
  183.      * @return self
  184.      */
  185.     public function setId(?string $id): self
  186.     {
  187.         $this->id $id;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Quote|null
  192.      */
  193.     public function getQuote(): ?Quote
  194.     {
  195.         return $this->quote;
  196.     }
  197.     /**
  198.      * @param Quote|null $quote
  199.      *
  200.      * @return self
  201.      */
  202.     public function setQuote(?Quote $quote): self
  203.     {
  204.         $this->quote $quote;
  205.         return $this;
  206.     }
  207.     /**
  208.      * @return QuoteLineInfo|null
  209.      */
  210.     public function getQuoteLineInfo(): ?QuoteLineInfo
  211.     {
  212.         return $this->quoteLineInfo;
  213.     }
  214.     /**
  215.      * @param QuoteLineInfo|null $quoteLineInfo
  216.      *
  217.      * @return self
  218.      */
  219.     public function setQuoteLineInfo(?QuoteLineInfo $quoteLineInfo): self
  220.     {
  221.         $this->quoteLineInfo $quoteLineInfo;
  222.         return $this;
  223.     }
  224.     /**
  225.      * @return string|null
  226.      */
  227.     public function getName(): ?string
  228.     {
  229.         return $this->name;
  230.     }
  231.     /**
  232.      * @param string|null $name
  233.      *
  234.      * @return self
  235.      */
  236.     public function setName(?string $name): self
  237.     {
  238.         $this->name $name;
  239.         return $this;
  240.     }
  241.     /**
  242.      * @return string|null
  243.      */
  244.     public function getReference(): ?string
  245.     {
  246.         return $this->reference;
  247.     }
  248.     /**
  249.      * @param string|null $reference
  250.      *
  251.      * @return self
  252.      */
  253.     public function setReference(?string $reference): self
  254.     {
  255.         $this->reference $reference;
  256.         return $this;
  257.     }
  258.     /**
  259.      * @return string|null
  260.      */
  261.     public function getComment(): ?string
  262.     {
  263.         return $this->comment;
  264.     }
  265.     /**
  266.      * @param string|null $comment
  267.      *
  268.      * @return self
  269.      */
  270.     public function setComment(?string $comment): self
  271.     {
  272.         $this->comment $comment;
  273.         return $this;
  274.     }
  275.     /**
  276.      * @return string
  277.      */
  278.     public function getUnitPriceExclVat(): string
  279.     {
  280.         return $this->formatNumber($this->unitPriceExclVat2);
  281.     }
  282.     /**
  283.      * @param string $unitPriceExclVat
  284.      *
  285.      * @return self
  286.      */
  287.     public function setUnitPriceExclVat(string $unitPriceExclVat): self
  288.     {
  289.         $this->unitPriceExclVat $unitPriceExclVat;
  290.         return $this;
  291.     }
  292.     /**
  293.      * @return int
  294.      */
  295.     public function getQuantity(): int
  296.     {
  297.         return $this->quantity;
  298.     }
  299.     /**
  300.      * @param int $quantity
  301.      *
  302.      * @return self
  303.      */
  304.     public function setQuantity(int $quantity): self
  305.     {
  306.         $this->quantity $quantity;
  307.         return $this;
  308.     }
  309.     /**
  310.      * @return string|null
  311.      */
  312.     public function getDiscountType(): ?string
  313.     {
  314.         return $this->discountType;
  315.     }
  316.     /**
  317.      * @param string|null $discountType
  318.      *
  319.      * @return self
  320.      */
  321.     public function setDiscountType(?string $discountType): self
  322.     {
  323.         $this->discountType $discountType;
  324.         return $this;
  325.     }
  326.     /**
  327.      * @return string
  328.      */
  329.     public function getDiscountValue(): string
  330.     {
  331.         return $this->formatNumber($this->discountValue2);
  332.     }
  333.     /**
  334.      * @param string $discountValue
  335.      *
  336.      * @return self
  337.      */
  338.     public function setDiscountValue(string $discountValue): self
  339.     {
  340.         $this->discountValue $discountValue;
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return string
  345.      */
  346.     public function getDiscountAmount(): string
  347.     {
  348.         return $this->formatNumber($this->discountAmount2);
  349.     }
  350.     /**
  351.      * @param string $discountAmount
  352.      *
  353.      * @return self
  354.      */
  355.     public function setDiscountAmount(string $discountAmount): self
  356.     {
  357.         $this->discountAmount $discountAmount;
  358.         return $this;
  359.     }
  360.     public function getVatRate(): string
  361.     {
  362.         return $this->vatRate;
  363.     }
  364.     public function setVatRate(string $vatRate): self
  365.     {
  366.         $this->vatRate $vatRate;
  367.         return $this;
  368.     }
  369.     public function getVatAmount(): string
  370.     {
  371.         return $this->formatNumber($this->vatAmount2);
  372.     }
  373.     public function setVatAmount(string $vatAmount): self
  374.     {
  375.         $this->vatAmount $vatAmount;
  376.         return $this;
  377.     }
  378.     /**
  379.      * @return string
  380.      */
  381.     public function getTotalExclDiscountAndVat(): string
  382.     {
  383.         return $this->formatNumber($this->totalExclDiscountAndVat2);
  384.     }
  385.     /**
  386.      * @param string $totalExclDiscountAndVat
  387.      *
  388.      * @return self
  389.      */
  390.     public function setTotalExclDiscountAndVat(string $totalExclDiscountAndVat): self
  391.     {
  392.         $this->totalExclDiscountAndVat $totalExclDiscountAndVat;
  393.         return $this;
  394.     }
  395.     /**
  396.      * @return string
  397.      */
  398.     public function getTotalExclDiscount(): string
  399.     {
  400.         return $this->formatNumber($this->totalExclDiscount2);
  401.     }
  402.     /**
  403.      * @param string $totalExclDiscount
  404.      *
  405.      * @return self
  406.      */
  407.     public function setTotalExclDiscount(string $totalExclDiscount): self
  408.     {
  409.         $this->totalExclDiscount $totalExclDiscount;
  410.         return $this;
  411.     }
  412.     /**
  413.      * @return string
  414.      */
  415.     public function getTotalExclVat(): string
  416.     {
  417.         return $this->formatNumber($this->totalExclVat2);
  418.     }
  419.     /**
  420.      * @param string $totalExclVat
  421.      *
  422.      * @return self
  423.      */
  424.     public function setTotalExclVat(string $totalExclVat): self
  425.     {
  426.         $this->totalExclVat $totalExclVat;
  427.         return $this;
  428.     }
  429.     /**
  430.      * @return string
  431.      */
  432.     public function getVatAmountExclDiscount(): string
  433.     {
  434.         return $this->formatNumber($this->vatAmountExclDiscount2);
  435.     }
  436.     /**
  437.      * @param string $vatAmountExclDiscount
  438.      *
  439.      * @return $this
  440.      */
  441.     public function setVatAmountExclDiscount(string $vatAmountExclDiscount): self
  442.     {
  443.         $this->vatAmountExclDiscount $vatAmountExclDiscount;
  444.         return $this;
  445.     }
  446.     /**
  447.      * @return string
  448.      */
  449.     public function getTotal(): string
  450.     {
  451.         return $this->formatNumber($this->total2);
  452.     }
  453.     /**
  454.      * @param string $total
  455.      *
  456.      * @return self
  457.      */
  458.     public function setTotal(string $total): self
  459.     {
  460.         $this->total $total;
  461.         return $this;
  462.     }
  463.     /**
  464.      * @return bool
  465.      */
  466.     public function getIsOptional(): bool
  467.     {
  468.         return $this->isOptional;
  469.     }
  470.     /**
  471.      * @param bool $isOptional
  472.      *
  473.      * @return self
  474.      */
  475.     public function setIsOptional(bool $isOptional): self
  476.     {
  477.         $this->isOptional $isOptional;
  478.         return $this;
  479.     }
  480.     /**
  481.      * @return string|null
  482.      */
  483.     public function getSectionName(): ?string
  484.     {
  485.         return $this->sectionName;
  486.     }
  487.     /**
  488.      * @param string|null $sectionName
  489.      *
  490.      * @return QuoteLine
  491.      */
  492.     public function setSectionName(?string $sectionName): self
  493.     {
  494.         $this->sectionName $sectionName;
  495.         return $this;
  496.     }
  497.     /**
  498.      * @return string|null
  499.      */
  500.     public function getDescription(): ?string
  501.     {
  502.         return $this->description;
  503.     }
  504.     /**
  505.      * @param string|null $description
  506.      *
  507.      * @return $this
  508.      */
  509.     public function setDescription(?string $description): self
  510.     {
  511.         $this->description $description;
  512.         return $this;
  513.     }
  514.     public function getPosition(): ?int
  515.     {
  516.         return $this->position;
  517.     }
  518.     public function setPosition(int $position): self
  519.     {
  520.         $this->position $position;
  521.         return $this;
  522.     }
  523. }