bug fix in incomes. add code to accounting table
This commit is contained in:
parent
72e2065544
commit
263e5e6046
|
@ -819,11 +819,13 @@ class HesabdariController extends AbstractController
|
|||
if ($this->hasChild($entityManager, $node)) {
|
||||
$temp[$node->getCode()] = [
|
||||
'text' => $node->getName(),
|
||||
'id' => $node->getCode(),
|
||||
'children' => $this->getFilteredChildsLabel($entityManager, $node, $business),
|
||||
];
|
||||
} else {
|
||||
$temp[$node->getCode()] = [
|
||||
'text' => $node->getName(),
|
||||
'id' => $node->getCode(),
|
||||
];
|
||||
}
|
||||
$temp[$node->getCode()]['is_public'] = $nodeBid === null;
|
||||
|
|
68
hesabixCore/templates/pdf/incomes.html.twig
Normal file
68
hesabixCore/templates/pdf/incomes.html.twig
Normal file
|
@ -0,0 +1,68 @@
|
|||
{% extends 'pdf/base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<table class="table" style="border:2px solid black; width:100%; border-collapse: collapse; margin-top: 20px;">
|
||||
<tbody>
|
||||
<tr style="text-align: center; background-color: #6B7280; color: #ffffff; height: 45px; font-weight: bold;">
|
||||
<td style="width: 5%; border:1px solid black;">ردیف</td>
|
||||
<th style="width: 10%; border:1px solid black;">شماره سند</th>
|
||||
<th style="width: 10%; border:1px solid black;">تاریخ</th>
|
||||
<th style="width: 25%; border:1px solid black;">شرح</th>
|
||||
<th style="width: 20%; border:1px solid black;">مرکز درآمد</th>
|
||||
<th style="width: 15%; border:1px solid black;">مرکز دریافت</th>
|
||||
<th style="width: 15%; border:1px solid black;">مبلغ (ریال)</th>
|
||||
</tr>
|
||||
{% for item in items %}
|
||||
<tr style="border:1px solid black; height: 35px;" {% if loop.index is even %}style="background-color: #f8f9fa;"{% endif %}>
|
||||
<td style="border:1px solid black; text-align: center;">{{ loop.index }}</td>
|
||||
<td style="border:1px solid black; text-align: center;">{{ item.code }}</td>
|
||||
<td style="border:1px solid black; text-align: center;">{{ item.date }}</td>
|
||||
<td style="border:1px solid black; padding: 5px 10px;">{{ item.des }}</td>
|
||||
<td style="border:1px solid black; padding: 5px 10px;">
|
||||
{% set incomeCenters = [] %}
|
||||
{% for row in item.hesabdariRows %}
|
||||
{% if row.ref and row.bs != 0 %}
|
||||
{% set incomeCenters = incomeCenters|merge([row.ref.name]) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ incomeCenters|join('، ') }}
|
||||
</td>
|
||||
<td style="border:1px solid black; padding: 5px 10px;">
|
||||
{% set receiveCenter = null %}
|
||||
{% for row in item.hesabdariRows %}
|
||||
{% if not receiveCenter %}
|
||||
{% if row.bank %}
|
||||
{% set receiveCenter = row.bank.name %}
|
||||
{% elseif row.cashdesk %}
|
||||
{% set receiveCenter = row.cashdesk.name %}
|
||||
{% elseif row.salary %}
|
||||
{% set receiveCenter = row.salary.name %}
|
||||
{% elseif row.person %}
|
||||
{% set receiveCenter = row.person.nikename %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ receiveCenter }}
|
||||
</td>
|
||||
<td style="border:1px solid black; text-align: left; padding-left: 10px;">{{ item.amount|number_format }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{# جمع کل #}
|
||||
<tr style="background-color: #6B7280; color: #ffffff; height: 45px; font-weight: bold;">
|
||||
<td colspan="6" style="border:1px solid black; text-align: left; padding-left: 15px;">جمع کل:</td>
|
||||
<td style="border:1px solid black; text-align: left; padding-left: 10px;">
|
||||
{{ items|reduce((sum, item) => sum + item.amount, 0)|number_format }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{# اطلاعات تکمیلی #}
|
||||
<div style="margin-top: 20px; font-size: 12px;">
|
||||
<p>تعداد اسناد: {{ items|length }} مورد</p>
|
||||
{% if items|length > 0 %}
|
||||
<p>از تاریخ: {{ items|first.date }} تا تاریخ: {{ items|last.date }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -13,6 +13,12 @@
|
|||
<loading color="blue" loader="dots" v-model:active="isLoading" :is-full-page="false" class="text-center" />
|
||||
|
||||
<Tree :nodes="tree" :config="config" class="tree-view-style">
|
||||
<template #label="{ node }">
|
||||
<span class="node-label">
|
||||
{{ node.text }}
|
||||
<span class="account-code">({{ node.id }})</span>
|
||||
</span>
|
||||
</template>
|
||||
<template #after-input="{ node }">
|
||||
<div class="node-actions" v-if="isAccproActive">
|
||||
<v-icon small color="success" class="mx-1" @click.stop="openAddDialog(node)">
|
||||
|
@ -195,7 +201,19 @@ export default {
|
|||
const loadData = async () => {
|
||||
try {
|
||||
const response = await axios.post("/api/accounting/table/get");
|
||||
tree.value = response.data;
|
||||
const data = response.data;
|
||||
|
||||
// تبدیل دادهها به فرمت مناسب برای درخت
|
||||
const treeData = {};
|
||||
Object.keys(data).forEach(key => {
|
||||
const node = data[key];
|
||||
treeData[key] = {
|
||||
...node,
|
||||
text: `(${node.id}) ${node.text}`
|
||||
};
|
||||
});
|
||||
|
||||
tree.value = treeData;
|
||||
config.value.roots = tree.value["1"]?.children || [];
|
||||
if (!tree.value["1"]) console.warn("ردیف حساب ریشه '1' پیدا نشد!");
|
||||
} catch (error) {
|
||||
|
@ -363,4 +381,16 @@ export default {
|
|||
:deep(.tree-node:hover) .node-actions {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.node-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.account-code {
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
Loading…
Reference in a new issue