some progress in repservice plugin and add footer output on api
This commit is contained in:
parent
d109fde79f
commit
943ad9f831
|
@ -9,11 +9,13 @@ use App\Entity\ChangeReport;
|
||||||
use App\Entity\HesabdariDoc;
|
use App\Entity\HesabdariDoc;
|
||||||
use App\Entity\PrinterQueue;
|
use App\Entity\PrinterQueue;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
|
use App\Entity\Settings;
|
||||||
use App\Service\pdfMGR;
|
use App\Service\pdfMGR;
|
||||||
use App\Service\Provider;
|
use App\Service\Provider;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
use Symfony\Component\Mailer\MailerInterface;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
@ -148,4 +150,13 @@ class UiGeneralController extends AbstractController
|
||||||
return $this->render('general/hesabixbox.html.twig',);
|
return $this->render('general/hesabixbox.html.twig',);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/api/system/get/data', name: 'general_apps_get_data')]
|
||||||
|
public function general_apps_get_data(EntityManagerInterface $entityManager): JsonResponse
|
||||||
|
{
|
||||||
|
$settings = $entityManager->getRepository(Settings::class)->findAll()[0];
|
||||||
|
return $this->json([
|
||||||
|
'footer' => $settings->getFooter()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,8 +287,8 @@ class PlugRepserviceController extends AbstractController
|
||||||
return $this->json(['result' => 1]);
|
return $this->json(['result' => 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/repservice/print/invoice', name: 'app_sell_print_invoice')]
|
#[Route('/api/repservice/print/invoice', name: 'app_repservice_print_invoice')]
|
||||||
public function app_sell_print_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
public function app_repservice_print_invoice(Printers $printers, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): JsonResponse
|
||||||
{
|
{
|
||||||
$params = [];
|
$params = [];
|
||||||
if ($content = $request->getContent()) {
|
if ($content = $request->getContent()) {
|
||||||
|
@ -298,43 +298,26 @@ class PlugRepserviceController extends AbstractController
|
||||||
$acc = $access->hasRole('plugRepservice');
|
$acc = $access->hasRole('plugRepservice');
|
||||||
if (!$acc) throw $this->createAccessDeniedException();
|
if (!$acc) throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(PlugRepserviceOrder::class)->findOneBy([
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'code' => $params['code']
|
'code' => $params['code']
|
||||||
]);
|
]);
|
||||||
if (!$doc) throw $this->createNotFoundException();
|
if (!$doc) throw $this->createNotFoundException();
|
||||||
$person = null;
|
|
||||||
$discount = 0;
|
|
||||||
$transfer = 0;
|
|
||||||
foreach ($doc->getHesabdariRows() as $item) {
|
|
||||||
if ($item->getPerson()) {
|
|
||||||
$person = $item->getPerson();
|
|
||||||
} elseif ($item->getRef()->getCode() == 104) {
|
|
||||||
$discount = $item->getBd();
|
|
||||||
} elseif ($item->getRef()->getCode() == 61) {
|
|
||||||
$transfer = $item->getBs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$pdfPid = 0;
|
$pdfPid = 0;
|
||||||
$note = '';
|
|
||||||
$printSettings = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$acc['bid']]);
|
$printOptions = $entityManager->getRepository(PrintOptions::class)->findOneBy(['bid'=>$acc['bid']]);
|
||||||
if($printSettings){$note = $printSettings->getSellNoteString();}
|
|
||||||
$pdfPid = $provider->createPrint(
|
$pdfPid = $provider->createPrint(
|
||||||
$acc['bid'],
|
$acc['bid'],
|
||||||
$this->getUser(),
|
$this->getUser(),
|
||||||
$this->renderView('pdf/printers/sell.html.twig', [
|
$this->renderView('pdf/printers/repservice/invoice.html.twig', [
|
||||||
'bid' => $acc['bid'],
|
'bid' => $acc['bid'],
|
||||||
'doc' => $doc,
|
'doc' => $doc,
|
||||||
'rows' => $doc->getHesabdariRows(),
|
|
||||||
'person' => $person,
|
|
||||||
'printInvoice' => $params['printers'],
|
|
||||||
'discount' => $discount,
|
|
||||||
'transfer' => $transfer,
|
|
||||||
'printOptions'=> $printOptions,
|
'printOptions'=> $printOptions,
|
||||||
'note'=> $note
|
|
||||||
]),
|
]),
|
||||||
false,
|
false,
|
||||||
$printOptions['paper']
|
$printOptions->getRepservicePaper(),
|
||||||
|
false
|
||||||
);
|
);
|
||||||
return $this->json(['id' => $pdfPid]);
|
return $this->json(['id' => $pdfPid]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ class PrinterQueue
|
||||||
#[ORM\Column(length: 50, nullable: true)]
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
private ?string $paperSize = null;
|
private ?string $paperSize = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $footer = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
@ -124,4 +127,16 @@ class PrinterQueue
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isFooter(): ?bool
|
||||||
|
{
|
||||||
|
return $this->footer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFooter(?bool $footer): static
|
||||||
|
{
|
||||||
|
$this->footer = $footer;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Provider
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createPrint(Business $bid, User $user, String $data,$posPrint = false,$paperSize = 'A4-L')
|
public function createPrint(Business $bid, User $user, String $data,$posPrint = false,$paperSize = 'A4-L',$footer = true)
|
||||||
{
|
{
|
||||||
$print = new PrinterQueue();
|
$print = new PrinterQueue();
|
||||||
$print->setDateSubmit(time());
|
$print->setDateSubmit(time());
|
||||||
|
@ -156,6 +156,7 @@ class Provider
|
||||||
$print->setPaperSize($paperSize);
|
$print->setPaperSize($paperSize);
|
||||||
$print->setView($data);
|
$print->setView($data);
|
||||||
$print->setPosprint($posPrint);
|
$print->setPosprint($posPrint);
|
||||||
|
$print->setFooter($footer);
|
||||||
$print->setPid($this->RandomString(128));
|
$print->setPid($this->RandomString(128));
|
||||||
$this->entityManager->persist($print);
|
$this->entityManager->persist($print);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
|
@ -48,10 +48,14 @@ class pdfMGR
|
||||||
'tempDir' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mpdf',
|
'tempDir' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mpdf',
|
||||||
'autoArabic' => true,
|
'autoArabic' => true,
|
||||||
]);
|
]);
|
||||||
$mpdf->SetHTMLFooter($footer);
|
if($printQueue->isFooter()){
|
||||||
|
$mpdf->SetHTMLFooter($footer);
|
||||||
|
}
|
||||||
|
|
||||||
$mpdf->WriteHTML($printQueue->getView());
|
$mpdf->WriteHTML($printQueue->getView());
|
||||||
$mpdf->SetAutoPageBreak(true);
|
$mpdf->SetAutoPageBreak(true);
|
||||||
$mpdf->Output();
|
$mpdf->SetTitle('حسابیکس');
|
||||||
|
$mpdf->Output('Hesabix PrintOut.pdf', 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function streamTwig2PDFInvoiceType(PrinterQueue $printQueue, $configs = [])
|
public function streamTwig2PDFInvoiceType(PrinterQueue $printQueue, $configs = [])
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Hello AvatarController!{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<style>
|
|
||||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
|
||||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="example-wrapper">
|
|
||||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
|
||||||
|
|
||||||
This friendly message is coming from:
|
|
||||||
<ul>
|
|
||||||
<li>Your controller at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/src/Controller/AvatarController.php'|file_link(0) }}">src/Controller/AvatarController.php</a></code></li>
|
|
||||||
<li>Your template at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/templates/avatar/index.html.twig'|file_link(0) }}">templates/avatar/index.html.twig</a></code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -148,7 +148,7 @@
|
||||||
<img class="scale-with-grid" src="{{ asset('betheme/wallet2/images/wallet2-icon1.svg') }}">
|
<img class="scale-with-grid" src="{{ asset('betheme/wallet2/images/wallet2-icon1.svg') }}">
|
||||||
<hr class="no_line" style="margin: 0 auto 15px auto;">
|
<hr class="no_line" style="margin: 0 auto 15px auto;">
|
||||||
<p>
|
<p>
|
||||||
حسابیکس به صورت متنباز ارايه شده و دسترسی به کد منبع محصولات از طریق GitHub در دسترس میباشد.
|
حسابیکس به صورت متنباز ارائه شده و دسترسی به کد منبع محصولات از طریق GitHub در دسترس میباشد.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Hello HookController!{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<style>
|
|
||||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
|
||||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="example-wrapper">
|
|
||||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
|
||||||
|
|
||||||
This friendly message is coming from:
|
|
||||||
<ul>
|
|
||||||
<li>Your controller at <code><a href="{{ '/var/www/next.hesabix.ir/hesabixCore/src/Controller/HookController.php'|file_link(0) }}">src/Controller/HookController.php</a></code></li>
|
|
||||||
<li>Your template at <code><a href="{{ '/var/www/next.hesabix.ir/hesabixCore/templates/hook/index.html.twig'|file_link(0) }}">templates/hook/index.html.twig</a></code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,20 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Hello NotesController!{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<style>
|
|
||||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
|
||||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="example-wrapper">
|
|
||||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
|
||||||
|
|
||||||
This friendly message is coming from:
|
|
||||||
<ul>
|
|
||||||
<li>Your controller at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/src/Controller/NotesController.php'|file_link(0) }}">src/Controller/NotesController.php</a></code></li>
|
|
||||||
<li>Your template at <code><a href="{{ 'C:/xampp/htdocs/hesabixCore/templates/notes/index.html.twig'|file_link(0) }}">templates/notes/index.html.twig</a></code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
194
hesabixCore/templates/pdf/printers/repservice/invoice.html.twig
Normal file
194
hesabixCore/templates/pdf/printers/repservice/invoice.html.twig
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fa" direction="rtl"></html>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.text-white {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.stimol td,
|
||||||
|
.stimol th {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.det tr {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body style="direction:rtl; width:100%">
|
||||||
|
<div class="block-content pt-1 pb-3 d-none d-sm-block">
|
||||||
|
<div class="c-print container-xl">
|
||||||
|
<div class="tg-wrap" style="width:100%; border:1px solid black;border-radius: 8px;">
|
||||||
|
<table class="rounded" style="width:100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td style="width:20%">
|
||||||
|
<img src="{{ "/api/avatar/get/file/" ~ bid.avatar}}" width="65"/>
|
||||||
|
</td>
|
||||||
|
<td style="width:60%; text-align:center">
|
||||||
|
<h3 class="">{{ bid.name }}</h3>
|
||||||
|
<br/>
|
||||||
|
<h4 class="">رسید تحویل کالا</h4>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%">
|
||||||
|
<h4>
|
||||||
|
<b>تاریخ:</b>
|
||||||
|
{{ doc.date }}</h4>
|
||||||
|
<br/>
|
||||||
|
<h4>
|
||||||
|
<b>شماره:</b>
|
||||||
|
{{ doc.code }}</h4>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:100%" colspan="3">
|
||||||
|
<p>
|
||||||
|
<b>آدرس:
|
||||||
|
</b>
|
||||||
|
استان
|
||||||
|
{{ bid.ostan }}، شهر
|
||||||
|
{{ bid.shahrestan }}،
|
||||||
|
{{ bid.address }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>تلفن تماس:</b>{{ bid.tel }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||||
|
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||||
|
<b style="color:white;">مشتری</b>
|
||||||
|
</div>
|
||||||
|
<table style="width:100%;">
|
||||||
|
<tbody>
|
||||||
|
<tr style="text-align:center;">
|
||||||
|
<td class="">
|
||||||
|
<p>
|
||||||
|
<b>نام:
|
||||||
|
</b>
|
||||||
|
{{ doc.person.nikename }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<p>
|
||||||
|
<b>تلفن همراه</b>
|
||||||
|
{{ doc.person.mobile }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="" colspan="2">
|
||||||
|
<p>
|
||||||
|
<b>آدرس:
|
||||||
|
</b>
|
||||||
|
{{ doc.person.address }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div style="width:100%; border:1px solid black;border-radius: 8px;margin-top:5px;text-align:center;">
|
||||||
|
<div class="tg-wrap" style="width:100%;border-radius: 8px 8px 0px 0px;text-align:center;background-color:gray">
|
||||||
|
<b style="color:white;">اطلاعات</b>
|
||||||
|
</div>
|
||||||
|
<table style="width:100%;">
|
||||||
|
<tbody class="det">
|
||||||
|
<tr style="text-align:center;">
|
||||||
|
<td class="">
|
||||||
|
<p>
|
||||||
|
<b>نام کالا:
|
||||||
|
</b>
|
||||||
|
{{ doc.commodity.name }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<p>
|
||||||
|
<b> مدل:
|
||||||
|
</b>
|
||||||
|
{{ doc.model }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<p>
|
||||||
|
<b> رنگ:
|
||||||
|
</b>
|
||||||
|
{{ doc.color }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<p>
|
||||||
|
<b> سریال:
|
||||||
|
</b>
|
||||||
|
{{ doc.serial }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<p>
|
||||||
|
<b> پلاک:
|
||||||
|
</b>
|
||||||
|
{{ doc.pelak }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="" colspan="4">
|
||||||
|
<p>
|
||||||
|
<b>شرح:
|
||||||
|
</b>
|
||||||
|
{{ doc.des }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="" colspan="1">
|
||||||
|
<p>
|
||||||
|
<b>متعلقات:
|
||||||
|
</b>
|
||||||
|
{{ doc.motaleghat }}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div style="width:40%;margin-top:20px;text-align:center;float:left;">
|
||||||
|
<table style="width:100%;">
|
||||||
|
<tbody>
|
||||||
|
<tr class="">
|
||||||
|
<td class="center" style="height:90px">
|
||||||
|
<h4>
|
||||||
|
مهر و امضا تحویل گیرنده
|
||||||
|
<br>
|
||||||
|
<b>{{ doc.submitter.fullname }}</b>
|
||||||
|
</h4>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width:60%;margin-top:5px;text-align:left;float:right;">
|
||||||
|
<table style="width:100%;">
|
||||||
|
<tbody>
|
||||||
|
<tr class="">
|
||||||
|
<td class="" style="">
|
||||||
|
{{ printOptions.repserviceNoteString}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in a new issue