bug fin in person card

This commit is contained in:
Hesabix 2025-07-04 08:39:44 +00:00
parent 748001b9fa
commit dad184671b
3 changed files with 149 additions and 51 deletions

View file

@ -1938,4 +1938,5 @@ class PersonsController extends AbstractController
return new JsonResponse(['error' => $e->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR); return new JsonResponse(['error' => $e->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR);
} }
} }
} }

View file

@ -81,7 +81,7 @@
<td class="center item">تفضیل</td> <td class="center item">تفضیل</td>
<td class="center item">بدهکار</td> <td class="center item">بدهکار</td>
<td class="center item">بستانکار</td> <td class="center item">بستانکار</td>
<td class="center item">سال مالی</td> <td class="center item">شرح سند</td>
</tr> </tr>
{% set sumBs = 0 %} {% set sumBs = 0 %}
{% set sumBd = 0 %} {% set sumBd = 0 %}
@ -96,7 +96,7 @@
<td class="center item">{{ item.ref.name }}</td> <td class="center item">{{ item.ref.name }}</td>
<td class="center item">{{ item.bd | number_format }}</td> <td class="center item">{{ item.bd | number_format }}</td>
<td class="center item">{{ item.bs | number_format }}</td> <td class="center item">{{ item.bs | number_format }}</td>
<td class="center item">{{ item.year.label }}</td> <td class="center item">{{ item.doc.des }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -1,67 +1,164 @@
<template> <template>
<div class="sticky-container">
<v-toolbar color="toolbar" :title="$t('dialog.person_with_det_report')"> <v-toolbar color="toolbar" :title="$t('dialog.person_with_det_report')">
<template v-slot:prepend> <template v-slot:prepend>
<v-tooltip :text="$t('dialog.back')" location="bottom"> <v-tooltip :text="$t('dialog.back')" location="bottom">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn v-bind="props" @click="$router.back()" class="d-none d-sm-flex" variant="text" <v-btn v-bind="props" @click="$router.back()" class="d-none d-sm-flex" variant="text" icon="mdi-arrow-right" />
icon="mdi-arrow-right" /> </template>
</template> </v-tooltip>
</v-tooltip> </template>
</template>
</v-toolbar> </v-toolbar>
<v-container fluid> <v-container fluid>
<v-row> <v-row>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<Hpersonsearch <Hpersonsearch
v-model="selectedPerson" v-model="selectedPerson"
label="شخص" label="شخص"
:rules="[v => !!v || 'انتخاب شخص الزامی است']" :rules="[v => !!v || 'انتخاب شخص الزامی است']"
/> />
</v-col> </v-col>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<Hdatepicker <Hdatepicker
v-model="startDate" v-model="startDate"
label="تاریخ شروع" label="تاریخ شروع"
:rules="[v => !!v || 'تاریخ شروع الزامی است']" :rules="[v => !!v || 'تاریخ شروع الزامی است']"
/> />
</v-col> </v-col>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<Hdatepicker <Hdatepicker
v-model="endDate" v-model="endDate"
label="تاریخ پایان" label="تاریخ پایان"
:rules="[v => !!v || 'تاریخ پایان الزامی است']" :rules="[v => !!v || 'تاریخ پایان الزامی است']"
/> />
</v-col> </v-col>
</v-row> </v-row>
<v-row>
<v-col cols="12" md="12">
<v-data-table-server
v-model:items-per-page="serverOptions.rowsPerPage"
v-model:page="serverOptions.page"
:headers="tableHeaders"
:items="items"
:items-length="totalItems"
:loading="loading"
class="elevation-1"
:items-per-page-options="[5, 10, 20, 50]"
item-value="id"
no-data-text="اطلاعاتی برای نمایش وجود ندارد"
:header-props="{ class: 'custom-header' }"
>
<template v-slot:item.index="{ index }">
{{ (serverOptions.page - 1) * serverOptions.rowsPerPage + index + 1 }}
</template>
<template v-slot:item.actions="{ item }">
<v-btn icon size="small" color="primary">
<v-icon>mdi-eye</v-icon>
</v-btn>
</template>
<template v-slot:item.docType="{ item }">
{{ item.docType || '-' }}
</template>
<template v-slot:item.debit="{ item }">
{{ formatNumber(item.debit) }}
</template>
<template v-slot:item.credit="{ item }">
{{ formatNumber(item.credit) }}
</template>
<template v-slot:item.description="{ item }">
{{ item.description }}
</template>
</v-data-table-server>
</v-col>
</v-row>
</v-container> </v-container>
</div>
</template> </template>
<script> <script>
import Hpersonsearch from '@/components/forms/Hpersonsearch.vue' import Hpersonsearch from '@/components/forms/Hpersonsearch.vue';
import Hdatepicker from '@/components/forms/Hdatepicker.vue' import Hdatepicker from '@/components/forms/Hdatepicker.vue';
import axios from 'axios';
export default { export default {
name: 'PersonWithDetReport', name: 'PersonWithDetReport',
components: { components: {
Hpersonsearch, Hpersonsearch,
Hdatepicker Hdatepicker
},
data() {
return {
selectedPerson: null,
startDate: '',
endDate: '',
loading: false,
items: [],
totalItems: 0,
serverOptions: {
page: 1,
rowsPerPage: 10,
sortBy: [],
},
tableHeaders: [
{ text: 'ردیف', value: 'index', align: 'center', sortable: false },
{ text: 'عملیات', value: 'actions', align: 'center', sortable: false },
{ text: 'نوع سند', value: 'docType', align: 'center' },
{ text: 'بدهکار', value: 'debit', align: 'center' },
{ text: 'بستانکار', value: 'credit', align: 'center' },
{ text: 'شرح', value: 'description', align: 'center' },
],
};
},
methods: {
formatNumber(num) {
if (!num) return '0';
return Number(num).toLocaleString('fa-IR');
}, },
data() { async fetchData() {
return { if (!this.selectedPerson) {
selectedPerson: null, this.items = [];
startDate: '', this.totalItems = 0;
endDate: '' return;
} }
this.loading = true;
try {
const response = await axios.post('/api/persons/listwithdet', {
person: this.selectedPerson.code,
startDate: this.startDate,
endDate: this.endDate,
page: this.serverOptions.page,
itemsPerPage: this.serverOptions.rowsPerPage,
});
this.items = response.data.items || [];
this.totalItems = response.data.total || this.items.length;
} catch (error) {
this.items = [];
this.totalItems = 0;
} finally {
this.loading = false;
}
}, },
methods: { },
// متدهای مورد نیاز گزارش watch: {
selectedPerson: 'fetchData',
startDate: 'fetchData',
endDate: 'fetchData',
serverOptions: {
handler: 'fetchData',
deep: true,
}, },
mounted() { },
// کدهای اجرایی در زمان بارگذاری کامپوننت mounted() {
// بارگذاری اولیه اگر شخص انتخاب شده باشد
if (this.selectedPerson) {
this.fetchData();
} }
} },
};
</script> </script>
<style scoped> <style scoped>
/* استایل‌های مورد نیاز */ .sticky-container {
position: relative;
}
</style> </style>