src/Entity/MouvementCaisse.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MouvementCaisseRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassMouvementCaisseRepository::class)]
  7. #[ORM\Index(columns: ['date_mouvement'], name'idx_mouvement_date')]
  8. #[ORM\Index(columns: ['type_mouvement'], name'idx_mouvement_type')]
  9. class MouvementCaisse
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(inversedBy'mouvements')]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?Caisse $caisse null;
  18.     #[ORM\ManyToOne(inversedBy'mouvements')]
  19.     #[ORM\JoinColumn(nullabletrue)]
  20.     private ?SessionCaisse $session null;
  21.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  22.     private ?\DateTimeInterface $dateMouvement null;
  23.     #[ORM\Column(length50)]
  24.     private ?string $typeMouvement null// entree, sortie
  25.     #[ORM\Column(length100)]
  26.     private ?string $natureMouvement null
  27.     // vente, paiement_dette_client, remboursement_client, versement_initial,
  28.     // achat_fournisseur, paiement_dette_fournisseur, depense, 
  29.     // versement_banque, prelevement, regularisation
  30.     #[ORM\Column(typeTypes::DECIMALprecision15scale2)]
  31.     private ?string $montant null;
  32.     #[ORM\Column(typeTypes::DECIMALprecision15scale2)]
  33.     private ?string $soldeAvant null;
  34.     #[ORM\Column(typeTypes::DECIMALprecision15scale2)]
  35.     private ?string $soldeApres null;
  36.     #[ORM\Column(length255)]
  37.     private ?string $libelle null;
  38.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  39.     private ?string $description null;
  40.     // Références vers les entités sources
  41.     #[ORM\Column(length50nullabletrue)]
  42.     private ?string $typeReference null// vente, echeance, paiement_dette, paiement_fournisseur, depense, manuel
  43.     #[ORM\Column(nullabletrue)]
  44.     private ?int $idReference null;
  45.     #[ORM\ManyToOne(targetEntityVente::class)]
  46.     private ?Vente $vente null;
  47.     #[ORM\ManyToOne(targetEntityEcheance::class)]
  48.     private ?Echeance $echeance null;
  49.     #[ORM\ManyToOne(targetEntityPaiementDette::class)]
  50.     private ?PaiementDette $paiementDette null;
  51.     #[ORM\ManyToOne(targetEntityPaiementFournisseur::class)]
  52.     private ?PaiementFournisseur $paiementFournisseur null;
  53.     #[ORM\ManyToOne(targetEntityDepense::class)]
  54.     private ?Depense $depense null;
  55.     #[ORM\ManyToOne(targetEntityUser::class)]
  56.     #[ORM\JoinColumn(nullablefalse)]
  57.     private ?User $createdBy null;
  58.     #[ORM\Column]
  59.     private ?\DateTimeImmutable $createdAt null;
  60.     #[ORM\ManyToOne(targetEntityBoutique::class)]
  61.     private ?Boutique $boutique null;
  62.     public function __construct()
  63.     {
  64.         $this->createdAt = new \DateTimeImmutable();
  65.         $this->dateMouvement = new \DateTime();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getCaisse(): ?Caisse
  72.     {
  73.         return $this->caisse;
  74.     }
  75.     public function setCaisse(?Caisse $caisse): static
  76.     {
  77.         $this->caisse $caisse;
  78.         return $this;
  79.     }
  80.     public function getSession(): ?SessionCaisse
  81.     {
  82.         return $this->session;
  83.     }
  84.     public function setSession(?SessionCaisse $session): static
  85.     {
  86.         $this->session $session;
  87.         return $this;
  88.     }
  89.     public function getDateMouvement(): ?\DateTimeInterface
  90.     {
  91.         return $this->dateMouvement;
  92.     }
  93.     public function setDateMouvement(\DateTimeInterface $dateMouvement): static
  94.     {
  95.         $this->dateMouvement $dateMouvement;
  96.         return $this;
  97.     }
  98.     public function getTypeMouvement(): ?string
  99.     {
  100.         return $this->typeMouvement;
  101.     }
  102.     public function setTypeMouvement(string $typeMouvement): static
  103.     {
  104.         $this->typeMouvement $typeMouvement;
  105.         return $this;
  106.     }
  107.     public function getNatureMouvement(): ?string
  108.     {
  109.         return $this->natureMouvement;
  110.     }
  111.     public function setNatureMouvement(string $natureMouvement): static
  112.     {
  113.         $this->natureMouvement $natureMouvement;
  114.         return $this;
  115.     }
  116.     public function getMontant(): ?string
  117.     {
  118.         return $this->montant;
  119.     }
  120.     public function setMontant(string $montant): static
  121.     {
  122.         $this->montant $montant;
  123.         return $this;
  124.     }
  125.     public function getSoldeAvant(): ?string
  126.     {
  127.         return $this->soldeAvant;
  128.     }
  129.     public function setSoldeAvant(string $soldeAvant): static
  130.     {
  131.         $this->soldeAvant $soldeAvant;
  132.         return $this;
  133.     }
  134.     public function getSoldeApres(): ?string
  135.     {
  136.         return $this->soldeApres;
  137.     }
  138.     public function setSoldeApres(string $soldeApres): static
  139.     {
  140.         $this->soldeApres $soldeApres;
  141.         return $this;
  142.     }
  143.     public function getLibelle(): ?string
  144.     {
  145.         return $this->libelle;
  146.     }
  147.     public function setLibelle(string $libelle): static
  148.     {
  149.         $this->libelle $libelle;
  150.         return $this;
  151.     }
  152.     public function getDescription(): ?string
  153.     {
  154.         return $this->description;
  155.     }
  156.     public function setDescription(?string $description): static
  157.     {
  158.         $this->description $description;
  159.         return $this;
  160.     }
  161.     public function getTypeReference(): ?string
  162.     {
  163.         return $this->typeReference;
  164.     }
  165.     public function setTypeReference(?string $typeReference): static
  166.     {
  167.         $this->typeReference $typeReference;
  168.         return $this;
  169.     }
  170.     public function getIdReference(): ?int
  171.     {
  172.         return $this->idReference;
  173.     }
  174.     public function setIdReference(?int $idReference): static
  175.     {
  176.         $this->idReference $idReference;
  177.         return $this;
  178.     }
  179.     public function getVente(): ?Vente
  180.     {
  181.         return $this->vente;
  182.     }
  183.     public function setVente(?Vente $vente): static
  184.     {
  185.         $this->vente $vente;
  186.         return $this;
  187.     }
  188.     public function getEcheance(): ?Echeance
  189.     {
  190.         return $this->echeance;
  191.     }
  192.     public function setEcheance(?Echeance $echeance): static
  193.     {
  194.         $this->echeance $echeance;
  195.         return $this;
  196.     }
  197.     public function getPaiementDette(): ?PaiementDette
  198.     {
  199.         return $this->paiementDette;
  200.     }
  201.     public function setPaiementDette(?PaiementDette $paiementDette): static
  202.     {
  203.         $this->paiementDette $paiementDette;
  204.         return $this;
  205.     }
  206.     public function getPaiementFournisseur(): ?PaiementFournisseur
  207.     {
  208.         return $this->paiementFournisseur;
  209.     }
  210.     public function setPaiementFournisseur(?PaiementFournisseur $paiementFournisseur): static
  211.     {
  212.         $this->paiementFournisseur $paiementFournisseur;
  213.         return $this;
  214.     }
  215.     public function getDepense(): ?Depense
  216.     {
  217.         return $this->depense;
  218.     }
  219.     public function setDepense(?Depense $depense): static
  220.     {
  221.         $this->depense $depense;
  222.         return $this;
  223.     }
  224.     public function getCreatedBy(): ?User
  225.     {
  226.         return $this->createdBy;
  227.     }
  228.     public function setCreatedBy(?User $createdBy): static
  229.     {
  230.         $this->createdBy $createdBy;
  231.         return $this;
  232.     }
  233.     public function getCreatedAt(): ?\DateTimeImmutable
  234.     {
  235.         return $this->createdAt;
  236.     }
  237.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  238.     {
  239.         $this->createdAt $createdAt;
  240.         return $this;
  241.     }
  242.     public function getBoutique(): ?Boutique
  243.     {
  244.         return $this->boutique;
  245.     }
  246.     public function setBoutique(?Boutique $boutique): static
  247.     {
  248.         $this->boutique $boutique;
  249.         return $this;
  250.     }
  251.     public function __toString(): string
  252.     {
  253.         $type $this->typeMouvement === 'entree' '+' '-';
  254.         return sprintf(
  255.             '%s %s FCFA - %s',
  256.             $type,
  257.             number_format(floatval($this->montant), 0','' '),
  258.             $this->libelle
  259.         );
  260.     }
  261. }