vendor/crosiersource/crosierlib-radx/src/Entity/Financeiro/Saldo.php line 23

Open in your IDE?
  1. <?php
  2. namespace CrosierSource\CrosierLibRadxBundle\Entity\Financeiro;
  3. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  4. use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
  5. use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
  6. use DateTime;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Serializer\Annotation\SerializedName;
  10. /**
  11.  * Não é um endpoint normal. Verificar o SaldoController.
  12.  *
  13.  * @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibRadxBundle\EntityHandler\Financeiro\SaldoEntityHandler")
  14.  *
  15.  * @ORM\Entity(repositoryClass="CrosierSource\CrosierLibRadxBundle\Repository\Financeiro\SaldoRepository")
  16.  * @ORM\Table(name="fin_saldo")
  17.  *
  18.  * @author Carlos Eduardo Pauluk
  19.  */
  20. class Saldo implements EntityId
  21. {
  22.     use EntityIdTrait;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Financeiro\Carteira")
  25.      * @ORM\JoinColumn(name="carteira_id")
  26.      * @Groups("saldo")
  27.      */
  28.     public ?Carteira $carteira null;
  29.     /**
  30.      * @ORM\Column(name="dt_saldo", type="datetime")
  31.      * @Groups("saldo")
  32.      */
  33.     public ?DateTime $dtSaldo null;
  34.     /**
  35.      * @ORM\Column(name="total_realizadas", type="decimal", precision=15, scale=2)
  36.      * @Groups("saldo")
  37.      */
  38.     public ?string $totalRealizadas null;
  39.     /**
  40.      * @ORM\Column(name="total_pendencias", type="decimal", precision=15, scale=2)
  41.      * @Groups("saldo")
  42.      */
  43.     public ?string $totalPendencias null;
  44.     /**
  45.      * Para aceitar tanto em string quanto em double.
  46.      * @Groups("saldo")
  47.      * @SerializedName("totalRealizadas")
  48.      * @return float
  49.      */
  50.     public function getTotalRealizadasFormatted(): float
  51.     {
  52.         return (float)$this->totalRealizadas;
  53.     }
  54.     /**
  55.      * Para aceitar tanto em string quanto em double.
  56.      * @Groups("saldo")
  57.      * @SerializedName("totalRealizadas")
  58.      * @param float $totalRealizadas
  59.      */
  60.     public function setTotalRealizadasFormatted(float $totalRealizadas)
  61.     {
  62.         $this->totalRealizadas $totalRealizadas;
  63.     }
  64.     /**
  65.      * Para aceitar tanto em string quanto em double.
  66.      * @Groups("saldo")
  67.      * @SerializedName("totalPendencias")
  68.      * @return float
  69.      */
  70.     public function getTotalPendenciasFormatted(): float
  71.     {
  72.         return (float)$this->totalPendencias;
  73.     }
  74.     /**
  75.      * Para aceitar tanto em string quanto em double.
  76.      * @Groups("saldo")
  77.      * @SerializedName("totalPendencias")
  78.      * @param float $totalPendencias
  79.      */
  80.     public function setTotalPendenciasFormatted(float $totalPendencias)
  81.     {
  82.         $this->totalPendencias $totalPendencias;
  83.     }
  84.     /**
  85.      * @Groups("saldo")
  86.      * @SerializedName("totalComPendentes")
  87.      * @return float
  88.      */
  89.     public function getTotalComPendentes(): float
  90.     {
  91.         return (float)(bcsub($this->getTotalRealizadasFormatted(), $this->getTotalPendenciasFormatted(), 2));
  92.     }
  93. }