add accounting export pdf document
This commit is contained in:
parent
73344b2c75
commit
fe80f0cf9b
|
@ -20,6 +20,7 @@ use App\Entity\StoreroomTicket;
|
|||
use App\Service\Access;
|
||||
use App\Service\AccountingPermissionService;
|
||||
use App\Service\Explore;
|
||||
use App\Service\Extractor;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\JsonResp;
|
||||
use App\Service\Log;
|
||||
|
@ -1091,5 +1092,46 @@ class HesabdariController extends AbstractController
|
|||
|
||||
return $this->json(['result' => 1, 'id' => $code]);
|
||||
}
|
||||
#[Route('/api/hesabdari/print/{id}', name: 'app_hesabdari_print', methods: ['POST'])]
|
||||
public function app_hesabdari_print(Request $request, Provider $provider, Extractor $extractor, Access $access, EntityManagerInterface $entityManager, $id): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('accounting');
|
||||
if (!$acc) {
|
||||
throw $this->createAccessDeniedException();
|
||||
}
|
||||
|
||||
$params = $request->getPayload()->all();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy(['bid' => $acc['bid'], 'code' => $id]);
|
||||
if (!$doc) {
|
||||
return $this->json($extractor->notFound());
|
||||
}
|
||||
|
||||
$printOptions = [
|
||||
'paper' => 'A4-L'
|
||||
];
|
||||
if (array_key_exists('printOptions', $params)) {
|
||||
if (array_key_exists('paper', $params['printOptions'])) {
|
||||
$printOptions['paper'] = $params['printOptions']['paper'];
|
||||
}
|
||||
}
|
||||
|
||||
$pdfPid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/printers/doc.html.twig', [
|
||||
'doc' => $doc,
|
||||
'bid' => $acc['bid'],
|
||||
'page_title' => 'سند حسابداری',
|
||||
'rows' => $doc->getHesabdariRows(),
|
||||
'printOptions' => $printOptions,
|
||||
'invoiceDate' => $doc->getDate(),
|
||||
]),
|
||||
false,
|
||||
$printOptions['paper']
|
||||
);
|
||||
|
||||
return $this->json($extractor->operationSuccess($pdfPid));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,11 @@
|
|||
<td style="width:20%; text-align:center">
|
||||
<p class="">
|
||||
تاریخ:
|
||||
{{ Jdate.GetTodayDate() }}
|
||||
{% if invoiceDate is defined %}
|
||||
{{ invoiceDate }}
|
||||
{% else %}
|
||||
{{ Jdate.GetTodayDate() }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
126
hesabixCore/templates/pdf/printers/doc.html.twig
Normal file
126
hesabixCore/templates/pdf/printers/doc.html.twig
Normal file
|
@ -0,0 +1,126 @@
|
|||
{% extends 'pdf/base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<div style="width:100%;margin-top:20px;text-align:center;">
|
||||
<div style="width:100%;margin-top:5px;margin-bottom:10px;text-align:center;">
|
||||
<table style="width:100%; border-radius: 8px;">
|
||||
<tbody>
|
||||
<tr style="font-size:12px;">
|
||||
<td class="right" style="border: 1px solid black;">
|
||||
<p>
|
||||
<b>شماره سند:</b>
|
||||
{{ doc.code }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="right" style="border: 1px solid black;">
|
||||
<p>
|
||||
<b>نوع سند:</b>
|
||||
{% if doc.type == 'cost' %}
|
||||
هزینه
|
||||
{% elseif doc.type == 'income' %}
|
||||
درآمد
|
||||
{% elseif doc.type == 'sell' %}
|
||||
فروش
|
||||
{% elseif doc.type == 'buy' %}
|
||||
خرید
|
||||
{% elseif doc.type == 'rfbuy' %}
|
||||
برگشت از خرید
|
||||
{% elseif doc.type == 'rfsell' %}
|
||||
برگشت از فروش
|
||||
{% else %}
|
||||
سند پایه
|
||||
{% endif %}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="font-size:12px;">
|
||||
<td class="right" colspan="2" style="border: 1px solid black;">
|
||||
<p>
|
||||
<b>توضیحات:</b>
|
||||
{{ doc.des }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:100%;margin-top:0px;text-align:center;">
|
||||
<table style="width:100%;">
|
||||
<thead>
|
||||
<tr class="stimol" style="background-color:gray;">
|
||||
<th class="text-white">ردیف</th>
|
||||
<th class="text-white">جدول حساب</th>
|
||||
<th class="text-white">مرجع</th>
|
||||
<th class="text-white">تفضیل</th>
|
||||
<th class="text-white">بستانکار</th>
|
||||
<th class="text-white">بدهکار</th>
|
||||
<th class="text-white">توضیحات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set rowIndex = 0 %}
|
||||
{% for item in rows%}
|
||||
{% set rowIndex = rowIndex + 1 %}
|
||||
<tr class="stimol">
|
||||
<td class="center item">{{ rowIndex }}</td>
|
||||
<td class="center item">{{ item.ref.name }}</td>
|
||||
<td class="center item">
|
||||
{% if item.person %}
|
||||
شخص
|
||||
{% elseif item.commodity %}
|
||||
کالا و خدمات
|
||||
{% elseif item.bank %}
|
||||
بانک
|
||||
{% elseif item.cashdesk %}
|
||||
تنخواه گردان
|
||||
{% elseif item.salary %}
|
||||
صندوق
|
||||
{% else %}
|
||||
حسابها
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="center item">
|
||||
{% if item.person %}
|
||||
{{item.person.nikename}}
|
||||
{% elseif item.commodity %}
|
||||
{{item.commodity.name}}
|
||||
{% elseif item.bank %}
|
||||
{{item.bank.name}}
|
||||
{% elseif item.cashdesk %}
|
||||
{{item.salary.name}}
|
||||
{% elseif item.salary %}
|
||||
{{item.cashdesk.name}}
|
||||
{% else %}
|
||||
{{item.ref.name}}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="center item">{{ item.bs | number_format(0, '.', ',') }}</td>
|
||||
<td class="center item">{{ item.bd | number_format(0, '.', ',') }}</td>
|
||||
<td class="center item">{{ item.des }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:40%;margin-top:0px;text-align:center;float:left;">
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr class="">
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا حسابدار
|
||||
</h4>
|
||||
</td>
|
||||
<td class="center" style="height:90px">
|
||||
<h4>
|
||||
مهر و امضا مدیر مالی
|
||||
</h4>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -45,15 +45,8 @@
|
|||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="item.rows"
|
||||
:loading="isLoading"
|
||||
class="mt-4"
|
||||
:header-props="{ class: 'custom-header' }"
|
||||
hide-default-footer
|
||||
:items-per-page="-1"
|
||||
>
|
||||
<v-data-table :headers="headers" :items="item.rows" :loading="isLoading" class="mt-4"
|
||||
:header-props="{ class: 'custom-header' }" hide-default-footer :items-per-page="-1">
|
||||
<template v-slot:item="{ item, index }">
|
||||
<tr>
|
||||
<td class="text-center">{{ index + 1 }}</td>
|
||||
|
@ -77,6 +70,7 @@ import ArchiveUpload from '../component/archive/archiveUpload.vue'
|
|||
import DocumentLogButton from '../component/documentLogButton.vue'
|
||||
import Notes from '../component/notes.vue'
|
||||
import { getCurrentInstance } from 'vue'
|
||||
import { getApiUrl } from '@/hesabixConfig'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const route = useRoute()
|
||||
|
@ -112,7 +106,10 @@ const loadData = async () => {
|
|||
}
|
||||
|
||||
const print = () => {
|
||||
window.print()
|
||||
|
||||
axios.post('/api/hesabdari/print/' + route.params.id).then((response) => {
|
||||
window.open(getApiUrl() + '/front/print/' + response.data.data, '_blank', 'noreferrer');
|
||||
});
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
Loading…
Reference in a new issue