start working on pre invoices

This commit is contained in:
Hesabix 2024-11-09 09:40:49 +00:00
parent a106075b25
commit f85d73e195
15 changed files with 200 additions and 112 deletions

View file

@ -147,6 +147,37 @@ class AdminController extends AbstractController
return $this->json($resp); return $this->json($resp);
} }
#[Route('/api/admin/business/count', name: 'admin_business_count')]
public function admin_business_count(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
return $this->json($entityManager->getRepository(Business::class)->countAll());
}
#[Route('/api/admin/business/search', name: 'admin_business_list_search')]
public function admin_business_list_search(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
$params = json_decode($content, true);
}
$items = $entityManager->getRepository(Business::class)->findByPage($params['options']['page'],$params['options']['rowsPerPage'],$params['search']);
$resp = [];
foreach ($items as $item) {
$temp = [];
$temp['id'] = $item->getId();
$temp['name'] = $item->getName();
$temp['owner'] = $item->getOwner()->getFullName();
$temp['ownerMobile'] = $item->getOwner()->getMobile();
$temp['dateRegister'] = $jdate->jdate('Y/n/d', $item->getDateSubmit());
$temp['commodityCount'] = count($entityManager->getRepository(Commodity::class)->findBy(['bid' => $item]));
$temp['personsCount'] = count($entityManager->getRepository(Person::class)->findBy(['bid' => $item]));
$temp['hesabdariDocsCount'] = count($entityManager->getRepository(HesabdariDoc::class)->findBy(['bid' => $item]));
$temp['StoreroomDocsCount'] = count($entityManager->getRepository(StoreroomTicket::class)->findBy(['bid' => $item]));
$resp[] = $temp;
}
return $this->json($resp);
}
#[Route('/api/admin/settings/sms/info', name: 'admin_settings_sms_info')] #[Route('/api/admin/settings/sms/info', name: 'admin_settings_sms_info')]
public function admin_settings_sms_info(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response public function admin_settings_sms_info(Jdate $jdate, #[CurrentUser] ?User $user, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, Request $request): Response
{ {

View file

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class PreinvoiceController extends AbstractController
{
#[Route('/preinvoice', name: 'app_preinvoice')]
public function index(): Response
{
return $this->render('preinvoice/index.html.twig', [
'controller_name' => 'PreinvoiceController',
]);
}
}

View file

@ -39,22 +39,36 @@ class BusinessRepository extends ServiceEntityRepository
} }
} }
// /** /**
// * @return Business[] Returns an array of Business objects * @return Business[] Returns an array of Business objects
// */ */
// public function findByExampleField($value): array public function findByPage($page = 0, $take = 25, $search = ''): array
// { {
// return $this->createQueryBuilder('b') $query = $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val') ->setFirstResult($page * $take)
// ->setParameter('val', $value) ->orderBy('b.id', 'DESC')
// ->orderBy('b.id', 'ASC') ->setMaxResults($take);
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Business if ($search != '') {
$query->andWhere("b.name LIKE :search")
->setParameter('search', '%' . $search . '%');
}
return $query->getQuery()->getResult();
}
/**
* @return integer Returns an integer of Business objects
*/
public function countAll(): int
{
return $this->createQueryBuilder('b')
->select('count(b.id)')
->getQuery()
->getSingleScalarResult()
;
}
// public function findOneBySomeField($value): ?Business
// { // {
// return $this->createQueryBuilder('b') // return $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val') // ->andWhere('b.exampleField = :val')
@ -64,14 +78,15 @@ class BusinessRepository extends ServiceEntityRepository
// ; // ;
// } // }
public function findLast(){ public function findLast()
{
$res = $this->createQueryBuilder('p') $res = $this->createQueryBuilder('p')
->orderBy('p.id', 'ASC') ->orderBy('p.id', 'ASC')
->getQuery() ->getQuery()
->getResult() ->getResult()
; ;
if(count($res) > 0) if (count($res) > 0)
return $res[count($res) -1]; return $res[count($res) - 1];
return null; return null;
} }
} }

View file

@ -74,7 +74,7 @@
مشاهده لیست دستگاه های تعمیری مشاهده لیست دستگاه های تعمیری
</li> </li>
<li> <li>
درج سریال/پلاک دستگاه های تعمیری درقبض پذیرش درج س{{doc.money.shortName}}/پلاک دستگاه های تعمیری درقبض پذیرش
</li> </li>
<li> <li>
ارسال پیامک خودکار هنگام تغییر وضعیت دستگاه به آماده تحویل ارسال پیامک خودکار هنگام تغییر وضعیت دستگاه به آماده تحویل

View file

@ -96,7 +96,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -98,7 +98,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -98,7 +98,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -98,7 +98,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -98,7 +98,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -98,7 +98,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -96,7 +96,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -96,7 +96,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -96,7 +96,7 @@
text-align: right; text-align: right;
} }
.total.price::after { .total.price::after {
content: " ریال "; content: " {{doc.money.shortName}} ";
} }
.line { .line {
border-top: 1px solid black !important; border-top: 1px solid black !important;

View file

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello PreinvoiceController!{% 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>/var/www/next.hesabix.ir/hesabixCore/src/Controller/PreinvoiceController.php</code></li>
<li>Your template at <code>/var/www/next.hesabix.ir/hesabixCore/templates/preinvoice/index.html.twig</code></li>
</ul>
</div>
{% endblock %}

View file

@ -31,18 +31,19 @@
{{doc.code}} {{doc.code}}
</span> </span>
</h3> </h3>
<div class="block-options"> <div
class="block-options">
<!-- Print Page functionality is initialized dmPrint() --> <!-- Print Page functionality is initialized dmPrint() -->
<a class="btn btn-sm btn-alt-secondary me-3" type="button" target="_blank" href="{{path('shortlinks_pdf',{bid:bid.id,link:link})}}"> <a class="btn btn-sm btn-alt-secondary me-3" type="button" target="_blank" href="{{path('shortlinks_pdf',{bid:bid.id,link:link})}}">
<i class="si si-printer me-1"></i> <i class="si si-printer me-1"></i>
چاپ فاکتور چاپ فاکتور
</a> </a>
{% if (totalPays < doc.amount) and bid.walletEnable %} {% if (totalPays < doc.amount) and bid.walletEnable and doc.money.name == 'IRR' %}
<a href="{{ path('pay_sell',{'id':doc.id}) }}" class="btn btn-sm btn-success"> <a href="{{ path('pay_sell',{'id':doc.id}) }}" class="btn btn-sm btn-success">
<i class="fa fa-credit-card"></i> <i class="fa fa-credit-card"></i>
پرداخت آنلاین مبلغ پرداخت آنلاین مبلغ
{{ (doc.amount - totalPays) | number_format }} {{ (doc.amount - totalPays) | number_format }}
ریال {{doc.money.shortName}}
</a> </a>
{% endif %} {% endif %}
</div> </div>
@ -65,7 +66,8 @@
<p class="mb-0">پرداخت فاکتور ناموفق بود. برای پرداخت مجدد می‌توانید دوباره سعی نمایید.</p> <p class="mb-0">پرداخت فاکتور ناموفق بود. برای پرداخت مجدد می‌توانید دوباره سعی نمایید.</p>
</div> </div>
{% endif %} {% endif %}
<div class="p-sm-2 p-xl-1"> <div
class="p-sm-2 p-xl-1">
<!-- Invoice Info --> <!-- Invoice Info -->
<div <div
class="row mb-5"> class="row mb-5">
@ -152,20 +154,20 @@
{% set taxAll = taxAll + item.tax %} {% set taxAll = taxAll + item.tax %}
{% set rowIndex = rowIndex + 1 %} {% set rowIndex = rowIndex + 1 %}
<tr> <tr>
<td >{{rowIndex}}</td> <td>{{rowIndex}}</td>
<td > <td>
{{ item.commodity.code }} {{ item.commodity.code }}
- -
{{ item.commodity.name }}</td> {{ item.commodity.name }}</td>
<td >{{ item.des }}</td> <td>{{ item.des }}</td>
<td > <td>
{{ item.commdityCount }} {{ item.commdityCount }}
{{ item.commodity.unit.name }} {{ item.commodity.unit.name }}
</td> </td>
<td >{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td> <td>{{ ((item.bs - item.tax + item.discount) / item.commdityCount) | number_format }}</td>
<td >{{ item.discount | number_format }}</td> <td>{{ item.discount | number_format }}</td>
<td >{{ item.tax | number_format}}</td> <td>{{ item.tax | number_format}}</td>
<td >{{ item.bs| number_format }}</td> <td>{{ item.bs| number_format }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -213,9 +215,11 @@
<tr> <tr>
<td>{{ loop.index }}</td> <td>{{ loop.index }}</td>
{% if item.type == 'walletPay' %} {% if item.type == 'walletPay' %}
<td class="text-success"><i class="fa fa-wallet"></i>پرداخت آنلاین</td> <td class="text-success">
<i class="fa fa-wallet"></i>پرداخت آنلاین</td>
{% else %} {% else %}
<td class="text-primary"><i class="fa fa-file"></i>سند حسابداری</td> <td class="text-primary">
<i class="fa fa-file"></i>سند حسابداری</td>
{% endif %} {% endif %}
<td>{{ item.date}}</td> <td>{{ item.date}}</td>
<td>{{ item.amount | number_format }}</td> <td>{{ item.amount | number_format }}</td>
@ -226,7 +230,7 @@
<tr class=""> <tr class="">
<td class="fw-bold text-uppercase text-end bg-body-light" colspan="5">جمع کل</td> <td class="fw-bold text-uppercase text-end bg-body-light" colspan="5">جمع کل</td>
<td class="fw-bold text-end bg-body-light">{{ totalPays | number_format }} <td class="fw-bold text-end bg-body-light">{{ totalPays | number_format }}
ریال {{doc.money.shortName}}
</td> </td>
</tr> </tr>
</tbody> </tbody>