start working on print templates
This commit is contained in:
parent
b8ea6f054e
commit
c42c5e8fed
|
@ -580,8 +580,9 @@ class BusinessController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/business/stat', name: 'api_business_stat')]
|
#[Route('/api/business/stat', name: 'api_business_stat')]
|
||||||
public function api_business_stat(Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response
|
public function api_business_stat(Jdate $jdate,Request $request, #[CurrentUser] ?User $user, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$dateNow = $jdate->jdate('Y/m/d',time());
|
||||||
$buss = $entityManager->getRepository(Business::class)->find(
|
$buss = $entityManager->getRepository(Business::class)->find(
|
||||||
$request->headers->get('activeBid')
|
$request->headers->get('activeBid')
|
||||||
);
|
);
|
||||||
|
@ -618,6 +619,7 @@ class BusinessController extends AbstractController
|
||||||
'type' => 'buy',
|
'type' => 'buy',
|
||||||
]);
|
]);
|
||||||
$buysTotal = 0;
|
$buysTotal = 0;
|
||||||
|
$buysToday = 0;
|
||||||
foreach ($buys as $item) {
|
foreach ($buys as $item) {
|
||||||
$canAdd = false;
|
$canAdd = false;
|
||||||
foreach ($item->getHesabdariRows() as $row) {
|
foreach ($item->getHesabdariRows() as $row) {
|
||||||
|
@ -626,16 +628,19 @@ class BusinessController extends AbstractController
|
||||||
}
|
}
|
||||||
if ($canAdd) {
|
if ($canAdd) {
|
||||||
$buysTotal += $item->getAmount();
|
$buysTotal += $item->getAmount();
|
||||||
|
if($item->getDate() == $dateNow){
|
||||||
|
$buysToday += $item->getAmount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
$sells = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||||
'bid' => $buss,
|
'bid' => $buss,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'type' => 'sell',
|
'type' => 'sell',
|
||||||
]);
|
]);
|
||||||
$sellsTotal = 0;
|
$sellsTotal = 0;
|
||||||
|
$sellsToday = 0;
|
||||||
foreach ($sells as $item) {
|
foreach ($sells as $item) {
|
||||||
$canAdd = false;
|
$canAdd = false;
|
||||||
foreach ($item->getHesabdariRows() as $row) {
|
foreach ($item->getHesabdariRows() as $row) {
|
||||||
|
@ -644,6 +649,9 @@ class BusinessController extends AbstractController
|
||||||
}
|
}
|
||||||
if ($canAdd) {
|
if ($canAdd) {
|
||||||
$sellsTotal += $item->getAmount();
|
$sellsTotal += $item->getAmount();
|
||||||
|
if($item->getDate() == $dateNow){
|
||||||
|
$sellsToday += $item->getAmount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response = [
|
$response = [
|
||||||
|
@ -655,7 +663,9 @@ class BusinessController extends AbstractController
|
||||||
'bid' => $buss
|
'bid' => $buss
|
||||||
])),
|
])),
|
||||||
'buys_total' => $buysTotal,
|
'buys_total' => $buysTotal,
|
||||||
|
'buys_today' => $buysToday,
|
||||||
'sells_total' => $sellsTotal,
|
'sells_total' => $sellsTotal,
|
||||||
|
'sells_today' => $sellsToday
|
||||||
];
|
];
|
||||||
return $this->json($response);
|
return $this->json($response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,9 @@ class Business
|
||||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Printer::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Printer::class, orphanRemoval: true)]
|
||||||
private Collection $printers;
|
private Collection $printers;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: PrintTemplate::class, orphanRemoval: true)]
|
||||||
|
private Collection $printTemplates;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -249,6 +252,7 @@ class Business
|
||||||
$this->mostDes = new ArrayCollection();
|
$this->mostDes = new ArrayCollection();
|
||||||
$this->plugRepserviceOrders = new ArrayCollection();
|
$this->plugRepserviceOrders = new ArrayCollection();
|
||||||
$this->printers = new ArrayCollection();
|
$this->printers = new ArrayCollection();
|
||||||
|
$this->printTemplates = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1539,4 +1543,34 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PrintTemplate>
|
||||||
|
*/
|
||||||
|
public function getPrintTemplates(): Collection
|
||||||
|
{
|
||||||
|
return $this->printTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPrintTemplate(PrintTemplate $printTemplate): static
|
||||||
|
{
|
||||||
|
if (!$this->printTemplates->contains($printTemplate)) {
|
||||||
|
$this->printTemplates->add($printTemplate);
|
||||||
|
$printTemplate->setBid($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePrintTemplate(PrintTemplate $printTemplate): static
|
||||||
|
{
|
||||||
|
if ($this->printTemplates->removeElement($printTemplate)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($printTemplate->getBid() === $this) {
|
||||||
|
$printTemplate->setBid(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
67
hesabixCore/src/Entity/PrintTemplate.php
Normal file
67
hesabixCore/src/Entity/PrintTemplate.php
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\PrintTemplateRepository;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: PrintTemplateRepository::class)]
|
||||||
|
class PrintTemplate
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'printTemplates')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Business $bid = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||||
|
private ?string $fastSellInvoice = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||||
|
private ?string $cashdeskTicket = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBid(): ?Business
|
||||||
|
{
|
||||||
|
return $this->bid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBid(?Business $bid): static
|
||||||
|
{
|
||||||
|
$this->bid = $bid;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFastSellInvoice(): ?string
|
||||||
|
{
|
||||||
|
return $this->fastSellInvoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFastSellInvoice(?string $fastSellInvoice): static
|
||||||
|
{
|
||||||
|
$this->fastSellInvoice = $fastSellInvoice;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCashdeskTicket(): ?string
|
||||||
|
{
|
||||||
|
return $this->cashdeskTicket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCashdeskTicket(?string $cashdeskTicket): static
|
||||||
|
{
|
||||||
|
$this->cashdeskTicket = $cashdeskTicket;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Constraints\File;
|
use Symfony\Component\Validator\Constraints\File;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
class BlogPostType extends AbstractType
|
class BlogPostType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -22,7 +23,21 @@ class BlogPostType extends AbstractType
|
||||||
$builder
|
$builder
|
||||||
->add('title',TextType::class)
|
->add('title',TextType::class)
|
||||||
->add('intero',TextareaType::class)
|
->add('intero',TextareaType::class)
|
||||||
->add('body',CKEditorType::class)
|
->add(
|
||||||
|
'body',
|
||||||
|
CKEditorType::class,
|
||||||
|
[
|
||||||
|
'filebrowsers' => [
|
||||||
|
'VideoUpload',
|
||||||
|
'VideoBrowse',
|
||||||
|
],
|
||||||
|
'config' => array(
|
||||||
|
'filebrowserBrowseRoute' => 'my_route',
|
||||||
|
'filebrowserBrowseRouteParameters' => array('slug' => 'my-slug'),
|
||||||
|
'filebrowserBrowseRouteType' => UrlGeneratorInterface::ABSOLUTE_URL,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
->add('img', FileType::class, [
|
->add('img', FileType::class, [
|
||||||
'label' => 'Img',
|
'label' => 'Img',
|
||||||
|
|
||||||
|
|
48
hesabixCore/src/Repository/PrintTemplateRepository.php
Normal file
48
hesabixCore/src/Repository/PrintTemplateRepository.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\PrintTemplate;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<PrintTemplate>
|
||||||
|
*
|
||||||
|
* @method PrintTemplate|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method PrintTemplate|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method PrintTemplate[] findAll()
|
||||||
|
* @method PrintTemplate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class PrintTemplateRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, PrintTemplate::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return PrintTemplate[] Returns an array of PrintTemplate objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('p.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?PrintTemplate
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('p')
|
||||||
|
// ->andWhere('p.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
Loading…
Reference in a new issue