bug fix in buy pdf export and start working on dashboard customizition

This commit is contained in:
Hesabix 2025-01-12 11:00:34 +00:00
parent ca64caeace
commit 6f30c0b11a
5 changed files with 291 additions and 2 deletions

View file

@ -270,6 +270,12 @@ class Business
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: PreInvoiceItem::class, orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'bid', targetEntity: PreInvoiceItem::class, orphanRemoval: true)]
private Collection $preInvoiceItems; private Collection $preInvoiceItems;
/**
* @var Collection<int, DashboardSettings>
*/
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: DashboardSettings::class, orphanRemoval: true)]
private Collection $dashboardSettings;
public function __construct() public function __construct()
{ {
$this->logs = new ArrayCollection(); $this->logs = new ArrayCollection();
@ -308,6 +314,7 @@ class Business
$this->extraMoney = new ArrayCollection(); $this->extraMoney = new ArrayCollection();
$this->preInvoiceDocs = new ArrayCollection(); $this->preInvoiceDocs = new ArrayCollection();
$this->preInvoiceItems = new ArrayCollection(); $this->preInvoiceItems = new ArrayCollection();
$this->dashboardSettings = new ArrayCollection();
} }
public function getId(): ?int public function getId(): ?int
@ -1892,4 +1899,34 @@ class Business
return $this; return $this;
} }
/**
* @return Collection<int, DashboardSettings>
*/
public function getDashboardSettings(): Collection
{
return $this->dashboardSettings;
}
public function addDashboardSetting(DashboardSettings $dashboardSetting): static
{
if (!$this->dashboardSettings->contains($dashboardSetting)) {
$this->dashboardSettings->add($dashboardSetting);
$dashboardSetting->setBid($this);
}
return $this;
}
public function removeDashboardSetting(DashboardSettings $dashboardSetting): static
{
if ($this->dashboardSettings->removeElement($dashboardSetting)) {
// set the owning side to null (unless already changed)
if ($dashboardSetting->getBid() === $this) {
$dashboardSetting->setBid(null);
}
}
return $this;
}
} }

View file

@ -0,0 +1,172 @@
<?php
namespace App\Entity;
use App\Repository\DashboardSettingsRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DashboardSettingsRepository::class)]
class DashboardSettings
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'dashboardSettings')]
#[ORM\JoinColumn(nullable: false)]
private ?User $submitter = null;
#[ORM\ManyToOne(inversedBy: 'dashboardSettings')]
#[ORM\JoinColumn(nullable: false)]
private ?Business $bid = null;
#[ORM\Column(nullable: true)]
private ?bool $wallet = null;
#[ORM\Column(nullable: true)]
private ?bool $banks = null;
#[ORM\Column(nullable: true)]
private ?bool $accDocs = null;
#[ORM\Column(nullable: true)]
private ?bool $commodities = null;
#[ORM\Column(nullable: true)]
private ?bool $persons = null;
#[ORM\Column(nullable: true)]
private ?bool $buys = null;
#[ORM\Column(nullable: true)]
private ?bool $sells = null;
#[ORM\Column(nullable: true)]
private ?bool $accountingTotal = null;
public function getId(): ?int
{
return $this->id;
}
public function getSubmitter(): ?User
{
return $this->submitter;
}
public function setSubmitter(?User $submitter): static
{
$this->submitter = $submitter;
return $this;
}
public function getBid(): ?Business
{
return $this->bid;
}
public function setBid(?Business $bid): static
{
$this->bid = $bid;
return $this;
}
public function isWallet(): ?bool
{
return $this->wallet;
}
public function setWallet(?bool $wallet): static
{
$this->wallet = $wallet;
return $this;
}
public function isBanks(): ?bool
{
return $this->banks;
}
public function setBanks(?bool $banks): static
{
$this->banks = $banks;
return $this;
}
public function isAccDocs(): ?bool
{
return $this->accDocs;
}
public function setAccDocs(?bool $accDocs): static
{
$this->accDocs = $accDocs;
return $this;
}
public function isCommodities(): ?bool
{
return $this->commodities;
}
public function setCommodities(?bool $commodities): static
{
$this->commodities = $commodities;
return $this;
}
public function isPersons(): ?bool
{
return $this->persons;
}
public function setPersons(?bool $persons): static
{
$this->persons = $persons;
return $this;
}
public function isBuys(): ?bool
{
return $this->buys;
}
public function setBuys(?bool $buys): static
{
$this->buys = $buys;
return $this;
}
public function isSells(): ?bool
{
return $this->sells;
}
public function setSells(?bool $sells): static
{
$this->sells = $sells;
return $this;
}
public function isAccountingTotal(): ?bool
{
return $this->accountingTotal;
}
public function setAccountingTotal(?bool $accountingTotal): static
{
$this->accountingTotal = $accountingTotal;
return $this;
}
}

View file

@ -107,6 +107,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: PreInvoiceDoc::class, orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'submitter', targetEntity: PreInvoiceDoc::class, orphanRemoval: true)]
private Collection $preInvoiceDocs; private Collection $preInvoiceDocs;
/**
* @var Collection<int, DashboardSettings>
*/
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: DashboardSettings::class, orphanRemoval: true)]
private Collection $dashboardSettings;
public function __construct() public function __construct()
{ {
$this->userTokens = new ArrayCollection(); $this->userTokens = new ArrayCollection();
@ -128,6 +134,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
$this->plugRepserviceOrders = new ArrayCollection(); $this->plugRepserviceOrders = new ArrayCollection();
$this->notes = new ArrayCollection(); $this->notes = new ArrayCollection();
$this->preInvoiceDocs = new ArrayCollection(); $this->preInvoiceDocs = new ArrayCollection();
$this->dashboardSettings = new ArrayCollection();
} }
public function getId(): ?int public function getId(): ?int
@ -819,4 +826,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this; return $this;
} }
/**
* @return Collection<int, DashboardSettings>
*/
public function getDashboardSettings(): Collection
{
return $this->dashboardSettings;
}
public function addDashboardSetting(DashboardSettings $dashboardSetting): static
{
if (!$this->dashboardSettings->contains($dashboardSetting)) {
$this->dashboardSettings->add($dashboardSetting);
$dashboardSetting->setSubmitter($this);
}
return $this;
}
public function removeDashboardSetting(DashboardSettings $dashboardSetting): static
{
if ($this->dashboardSettings->removeElement($dashboardSetting)) {
// set the owning side to null (unless already changed)
if ($dashboardSetting->getSubmitter() === $this) {
$dashboardSetting->setSubmitter(null);
}
}
return $this;
}
} }

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\DashboardSettings;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<DashboardSettings>
*/
class DashboardSettingsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, DashboardSettings::class);
}
// /**
// * @return DashboardSettings[] Returns an array of DashboardSettings objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?DashboardSettings
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -213,14 +213,14 @@
{{ item.commdityCount }} {{ item.commdityCount }}
{{ item.commodity.unit.name }} {{ item.commodity.unit.name }}
</td> </td>
<td class="center item">{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td> <td class="center item">{{ ((item.bd - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
{% if printOptions.discountInfo %} {% if printOptions.discountInfo %}
<td class="center item">{{ item.discount | number_format }}</td> <td class="center item">{{ item.discount | number_format }}</td>
{% endif %} {% endif %}
{% if printOptions.taxInfo %} {% if printOptions.taxInfo %}
<td class="center item">{{ item.tax | number_format}}</td> <td class="center item">{{ item.tax | number_format}}</td>
{% endif %} {% endif %}
<td class="center item">{{ item.bs| number_format }}</td> <td class="center item">{{ item.bd| number_format }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}