Make treasury report periods Jalali-aware with full previous month and custom range.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,6 +3,15 @@ import { Cron } from '@nestjs/schedule';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import ExcelJS from 'exceljs';
|
||||
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||||
import {
|
||||
addJalaliMonths,
|
||||
dateToJalali,
|
||||
endOfJalaliMonth,
|
||||
formatTehranJalali,
|
||||
jalaliMonthKey,
|
||||
jalaliMonthName,
|
||||
startOfJalaliMonth,
|
||||
} from '../common/jalali';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import type { Actor } from '../common/record-scope';
|
||||
import { invoiceSalesInPeriod } from './invoice-ledger';
|
||||
@@ -22,6 +31,29 @@ function parseDate(iso?: string | null) {
|
||||
const d = new Date(iso);
|
||||
return Number.isNaN(d.getTime()) ? null : d;
|
||||
}
|
||||
/** روز محلی از YYYY-MM-DD (بدون جابهجایی UTC) */
|
||||
function parseDay(iso?: string | null) {
|
||||
if (!iso) return null;
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(iso.trim());
|
||||
if (match) {
|
||||
return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
||||
}
|
||||
return parseDate(iso);
|
||||
}
|
||||
function startOfDay(d: Date) {
|
||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);
|
||||
}
|
||||
function endOfDay(d: Date) {
|
||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
|
||||
}
|
||||
function faDigits(value: string | number) {
|
||||
return String(value).replace(/\d/g, (d) => '۰۱۲۳۴۵۶۷۸۹'[Number(d)] ?? d);
|
||||
}
|
||||
function jalaliMonthLabel(key: string) {
|
||||
const match = /^(\d{4})-(\d{2})$/.exec(key);
|
||||
if (!match) return key;
|
||||
return `${jalaliMonthName(Number(match[2]))} ${faDigits(match[1])}`;
|
||||
}
|
||||
function payrollStatus(payable: Prisma.Decimal, paid: Prisma.Decimal) {
|
||||
if (paid.lessThanOrEqualTo(0)) return 'open';
|
||||
if (paid.greaterThanOrEqualTo(payable)) return 'settled';
|
||||
@@ -449,15 +481,32 @@ export class TreasuryOpsService {
|
||||
}
|
||||
|
||||
async report(actor: Actor, fromIso?: string, toIso?: string) {
|
||||
const to = parseDate(toIso) ?? new Date();
|
||||
const from = parseDate(fromIso) ?? new Date(to.getFullYear(), to.getMonth(), 1);
|
||||
const span = to.getTime() - from.getTime();
|
||||
const prevTo = new Date(from.getTime() - 1);
|
||||
const prevFrom = new Date(prevTo.getTime() - span);
|
||||
const now = new Date();
|
||||
const jalaliNow = dateToJalali(now);
|
||||
const to = endOfDay(parseDay(toIso) ?? now);
|
||||
const from = startOfDay(
|
||||
parseDay(fromIso) ?? startOfJalaliMonth(jalaliNow.jy, jalaliNow.jm),
|
||||
);
|
||||
if (from.getTime() > to.getTime()) {
|
||||
throw new BadRequestException('بازهٔ تاریخ نامعتبر است.');
|
||||
}
|
||||
// دوره قبل = ماه شمسی کاملِ قبل از ماهی که «از تاریخ» در آن است
|
||||
const fromJalali = dateToJalali(from);
|
||||
const prevMonth = addJalaliMonths(fromJalali.jy, fromJalali.jm, -1);
|
||||
const prevFrom = startOfDay(startOfJalaliMonth(prevMonth.jy, prevMonth.jm));
|
||||
const prevTo = endOfDay(endOfJalaliMonth(prevMonth.jy, prevMonth.jm));
|
||||
const current = await this.period(actor.organizationId, from, to);
|
||||
const previous = await this.period(actor.organizationId, prevFrom, prevTo);
|
||||
const breakdown = await this.breakdown(actor.organizationId);
|
||||
return { from: from.toISOString(), to: to.toISOString(), current, previous, ...breakdown };
|
||||
return {
|
||||
from: from.toISOString(),
|
||||
to: to.toISOString(),
|
||||
previousFrom: prevFrom.toISOString(),
|
||||
previousTo: prevTo.toISOString(),
|
||||
current,
|
||||
previous,
|
||||
...breakdown,
|
||||
};
|
||||
}
|
||||
|
||||
async reportExcel(
|
||||
@@ -469,6 +518,15 @@ export class TreasuryOpsService {
|
||||
const data = await this.report(actor, from, to);
|
||||
const book = new ExcelJS.Workbook();
|
||||
const sheet = book.addWorksheet('گزارش مالی');
|
||||
sheet.addRow([
|
||||
'بازه این دوره',
|
||||
`${formatTehranJalali(new Date(data.from))} تا ${formatTehranJalali(new Date(data.to))}`,
|
||||
]);
|
||||
sheet.addRow([
|
||||
'بازه دوره قبل',
|
||||
`${formatTehranJalali(new Date(data.previousFrom))} تا ${formatTehranJalali(new Date(data.previousTo))}`,
|
||||
]);
|
||||
sheet.addRow([]);
|
||||
sheet.addRow(['شاخص', 'این دوره', 'دوره قبل']);
|
||||
const rows: Array<[string, string, string]> = [
|
||||
['درآمد ثبتشده', data.current.bookedIncome, data.previous.bookedIncome],
|
||||
@@ -591,7 +649,7 @@ export class TreasuryOpsService {
|
||||
]);
|
||||
const payablesByMonth = new Map<string, Prisma.Decimal>();
|
||||
const addMonth = (date: Date, amount: Prisma.Decimal) => {
|
||||
const key = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
|
||||
const key = jalaliMonthKey(date);
|
||||
payablesByMonth.set(key, (payablesByMonth.get(key) ?? new Prisma.Decimal(0)).plus(amount));
|
||||
};
|
||||
for (const doc of docs) {
|
||||
@@ -611,8 +669,17 @@ export class TreasuryOpsService {
|
||||
receivablesByParty.set(name, (receivablesByParty.get(name) ?? new Prisma.Decimal(0)).plus(left));
|
||||
}
|
||||
return {
|
||||
payablesByMonth: [...payablesByMonth.entries()].map(([month, amount]) => ({ month, amount: money(amount) })),
|
||||
receivablesByParty: [...receivablesByParty.entries()].map(([name, amount]) => ({ name, amount: money(amount) })),
|
||||
payablesByMonth: [...payablesByMonth.entries()]
|
||||
.sort((a, b) => b[0].localeCompare(a[0]))
|
||||
.map(([month, amount]) => ({
|
||||
month,
|
||||
label: jalaliMonthLabel(month),
|
||||
amount: money(amount),
|
||||
})),
|
||||
receivablesByParty: [...receivablesByParty.entries()].map(([name, amount]) => ({
|
||||
name,
|
||||
amount: money(amount),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,23 +5,38 @@ import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Divider as ADivider,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
List as AList,
|
||||
Descriptions as ADescriptions,
|
||||
DescriptionsItem as ADescriptionsItem,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Table as ATable,
|
||||
Tabs as ATabs,
|
||||
Typography,
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { DownloadOutlined } from '@ant-design/icons-vue';
|
||||
import { DownloadOutlined, SearchOutlined } from '@ant-design/icons-vue';
|
||||
import * as XLSX from 'xlsx';
|
||||
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||||
import { api } from '@/lib/api';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
|
||||
import {
|
||||
dateToJalali,
|
||||
formatJalaliNumeric,
|
||||
formatLocalDateInput,
|
||||
jalaliMonthName,
|
||||
jalaliToDate,
|
||||
toFaDigits,
|
||||
} from '@/lib/jalali';
|
||||
import { toman } from './treasury-format';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
import { useTreasuryMobile } from './useTreasuryMobile';
|
||||
@@ -51,13 +66,23 @@ type MetricRow = {
|
||||
previous: string;
|
||||
};
|
||||
|
||||
type PayableMonth = { month: string; label?: string; amount: string };
|
||||
|
||||
const todayJalali = dateToJalali(new Date());
|
||||
const fromDate = ref(formatLocalDateInput(jalaliToDate(todayJalali.jy, todayJalali.jm, 1)));
|
||||
const toDate = ref(formatLocalDateInput(new Date()));
|
||||
const rangeFrom = ref('');
|
||||
const rangeTo = ref('');
|
||||
const previousFrom = ref('');
|
||||
const previousTo = ref('');
|
||||
const current = ref<Period | null>(null);
|
||||
const previous = ref<Period | null>(null);
|
||||
const payablesByMonth = ref<Array<{ month: string; amount: string }>>([]);
|
||||
const payablesByMonth = ref<PayableMonth[]>([]);
|
||||
const receivablesByParty = ref<Array<{ name: string; amount: string }>>([]);
|
||||
const debtors = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const creditors = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const reportTab = ref('periods');
|
||||
const loading = ref(false);
|
||||
const error = ref('');
|
||||
const balanceError = ref('');
|
||||
|
||||
@@ -78,11 +103,30 @@ const lines = [
|
||||
['خالص جریان نقدی', 'cashNet'],
|
||||
] as const;
|
||||
|
||||
const metricColumns: TableColumnsType<MetricRow> = [
|
||||
const currentRangeLabel = computed(() =>
|
||||
rangeFrom.value && rangeTo.value
|
||||
? `${formatJalaliNumeric(new Date(rangeFrom.value))} تا ${formatJalaliNumeric(new Date(rangeTo.value))}`
|
||||
: '—',
|
||||
);
|
||||
const previousRangeLabel = computed(() =>
|
||||
previousFrom.value && previousTo.value
|
||||
? `${formatJalaliNumeric(new Date(previousFrom.value))} تا ${formatJalaliNumeric(new Date(previousTo.value))}`
|
||||
: '—',
|
||||
);
|
||||
|
||||
const metricColumns = computed<TableColumnsType<MetricRow>>(() => [
|
||||
{ title: 'شاخص', dataIndex: 'label', key: 'label' },
|
||||
{ title: 'این دوره', dataIndex: 'current', key: 'current' },
|
||||
{ title: 'دوره قبل', dataIndex: 'previous', key: 'previous' },
|
||||
];
|
||||
{
|
||||
title: `این دوره (${currentRangeLabel.value})`,
|
||||
dataIndex: 'current',
|
||||
key: 'current',
|
||||
},
|
||||
{
|
||||
title: `دوره قبل (${previousRangeLabel.value})`,
|
||||
dataIndex: 'previous',
|
||||
key: 'previous',
|
||||
},
|
||||
]);
|
||||
|
||||
const metricRows = computed<MetricRow[]>(() => {
|
||||
if (!current.value || !previous.value) return [];
|
||||
@@ -127,17 +171,84 @@ const {
|
||||
'treasury.reports-expense-cats',
|
||||
);
|
||||
|
||||
function monthTitle(item: PayableMonth) {
|
||||
if (item.label) return item.label;
|
||||
const match = /^(\d{4})-(\d{2})$/.exec(item.month);
|
||||
if (!match) return item.month;
|
||||
const year = Number(match[1]);
|
||||
const month = Number(match[2]);
|
||||
if (year > 1700) {
|
||||
const j = dateToJalali(new Date(year, month - 1, 15));
|
||||
return `${jalaliMonthName(j.jm)} ${toFaDigits(j.jy)}`;
|
||||
}
|
||||
return `${jalaliMonthName(month)} ${toFaDigits(year)}`;
|
||||
}
|
||||
|
||||
async function load() {
|
||||
const { data } = await api.get<{
|
||||
current: Period;
|
||||
previous: Period;
|
||||
payablesByMonth: Array<{ month: string; amount: string }>;
|
||||
receivablesByParty: Array<{ name: string; amount: string }>;
|
||||
}>('/treasury/reports');
|
||||
current.value = data.current;
|
||||
previous.value = data.previous;
|
||||
payablesByMonth.value = data.payablesByMonth;
|
||||
receivablesByParty.value = data.receivablesByParty;
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const { data } = await api.get<{
|
||||
from?: string;
|
||||
to?: string;
|
||||
previousFrom?: string;
|
||||
previousTo?: string;
|
||||
current: Period;
|
||||
previous: Period;
|
||||
payablesByMonth: PayableMonth[];
|
||||
receivablesByParty: Array<{ name: string; amount: string }>;
|
||||
}>('/treasury/reports', {
|
||||
params: {
|
||||
from: fromDate.value || undefined,
|
||||
to: toDate.value || undefined,
|
||||
},
|
||||
});
|
||||
const fromIso = data.from || `${fromDate.value}T00:00:00`;
|
||||
const toIso = data.to || `${toDate.value}T23:59:59`;
|
||||
const fromJ = dateToJalali(new Date(fromIso));
|
||||
const prevMonth = {
|
||||
jy: fromJ.jm === 1 ? fromJ.jy - 1 : fromJ.jy,
|
||||
jm: fromJ.jm === 1 ? 12 : fromJ.jm - 1,
|
||||
};
|
||||
const fallbackPrevFrom = jalaliToDate(prevMonth.jy, prevMonth.jm, 1);
|
||||
const nextOfPrev = jalaliToDate(
|
||||
prevMonth.jm === 12 ? prevMonth.jy + 1 : prevMonth.jy,
|
||||
prevMonth.jm === 12 ? 1 : prevMonth.jm + 1,
|
||||
1,
|
||||
);
|
||||
const fallbackPrevTo = new Date(nextOfPrev.getTime() - 1);
|
||||
rangeFrom.value = fromIso;
|
||||
rangeTo.value = toIso;
|
||||
previousFrom.value = data.previousFrom || fallbackPrevFrom.toISOString();
|
||||
previousTo.value = data.previousTo || fallbackPrevTo.toISOString();
|
||||
current.value = data.current;
|
||||
previous.value = data.previous;
|
||||
payablesByMonth.value = data.payablesByMonth;
|
||||
receivablesByParty.value = data.receivablesByParty;
|
||||
} catch {
|
||||
error.value = 'گزارش بارگذاری نشد.';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function applyRange() {
|
||||
if (!fromDate.value || !toDate.value) {
|
||||
message.warning('از تاریخ و تا تاریخ را مشخص کنید.');
|
||||
return;
|
||||
}
|
||||
if (fromDate.value > toDate.value) {
|
||||
message.warning('بازهٔ تاریخ نامعتبر است.');
|
||||
return;
|
||||
}
|
||||
void load();
|
||||
}
|
||||
|
||||
function resetToCurrentJalaliMonth() {
|
||||
const today = dateToJalali(new Date());
|
||||
fromDate.value = formatLocalDateInput(jalaliToDate(today.jy, today.jm, 1));
|
||||
toDate.value = formatLocalDateInput(new Date());
|
||||
void load();
|
||||
}
|
||||
|
||||
function sumRemaining(rows: TreasuryPartyBalanceDto[]) {
|
||||
@@ -185,7 +296,13 @@ async function loadBalances() {
|
||||
}
|
||||
|
||||
async function download() {
|
||||
const { data } = await api.get<Blob>('/treasury/reports/export', { responseType: 'blob' });
|
||||
const { data } = await api.get<Blob>('/treasury/reports/export', {
|
||||
responseType: 'blob',
|
||||
params: {
|
||||
from: fromDate.value || undefined,
|
||||
to: toDate.value || undefined,
|
||||
},
|
||||
});
|
||||
const url = URL.createObjectURL(data);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
@@ -195,9 +312,7 @@ async function download() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load().catch(() => {
|
||||
error.value = 'گزارش بارگذاری نشد.';
|
||||
});
|
||||
void load();
|
||||
void loadBalances().catch((e: unknown) => {
|
||||
if (axios.isAxiosError(e) && (e.response?.status === 404 || e.response?.status === 403)) {
|
||||
debtors.value = [];
|
||||
@@ -211,152 +326,206 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-flex justify="flex-end">
|
||||
<a-button @click="download">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-flex>
|
||||
<a-card :bordered="false">
|
||||
<a-form layout="vertical" @finish="applyRange">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="از تاریخ">
|
||||
<JalaliDateInput v-model="fromDate" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="تا تاریخ">
|
||||
<JalaliDateInput v-model="toDate" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label=" ">
|
||||
<a-space :size="8" wrap>
|
||||
<a-button type="primary" html-type="submit" :loading="loading">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
اعمال بازه
|
||||
</a-button>
|
||||
<a-button :disabled="loading" @click="resetToCurrentJalaliMonth">
|
||||
ماه جاری شمسی
|
||||
</a-button>
|
||||
<a-button :disabled="loading" @click="download">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<a-typography-text type="secondary">
|
||||
پیشفرض: از اول ماه شمسی جاری تا امروز. «دوره قبل» همیشه ماه شمسی کاملِ قبل (اول تا آخر ماه) است.
|
||||
</a-typography-text>
|
||||
</a-card>
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="balanceError" type="error" show-icon :message="balanceError" />
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="balanceError" type="error" show-icon :message="balanceError" />
|
||||
|
||||
<a-card :bordered="false">
|
||||
<a-tabs v-model:activeKey="reportTab">
|
||||
<a-tab-pane key="periods" tab="مقایسه دورهها">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-list v-if="isMobile && metricRows.length" :data-source="metricRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<a-card :title="item.label" style="width: 100%">
|
||||
<a-descriptions :column="1" bordered>
|
||||
<a-descriptions-item label="این دوره">{{ item.current }}</a-descriptions-item>
|
||||
<a-descriptions-item label="دوره قبل">{{ item.previous }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<a-table
|
||||
v-else-if="metricRows.length"
|
||||
:columns="metricColumns"
|
||||
:data-source="metricRows"
|
||||
:pagination="false"
|
||||
row-key="key"
|
||||
/>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." />
|
||||
<a-card :bordered="false">
|
||||
<a-tabs v-model:activeKey="reportTab">
|
||||
<a-tab-pane key="periods" tab="مقایسه دورهها">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-descriptions bordered :column="isMobile ? 1 : 2">
|
||||
<a-descriptions-item label="این دوره">{{ currentRangeLabel }}</a-descriptions-item>
|
||||
<a-descriptions-item label="دوره قبل">{{ previousRangeLabel }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<a-divider orientation="right">مطالبات به تفکیک طرف حساب</a-divider>
|
||||
<a-empty v-if="!receivablesByParty.length" description="مورد بازی نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedPartyRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>{{ toman(item.amount) }}</a-typography-text>
|
||||
<a-list v-if="isMobile && metricRows.length" :data-source="metricRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<a-card :title="item.label" style="width: 100%">
|
||||
<a-descriptions :column="1" bordered>
|
||||
<a-descriptions-item :label="`این دوره (${currentRangeLabel})`">
|
||||
{{ item.current }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item :label="`دوره قبل (${previousRangeLabel})`">
|
||||
{{ item.previous }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
</a-list-item>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ item.name }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="partyPage"
|
||||
:total="partyTotal"
|
||||
:page-size="partyPageSize"
|
||||
:page-size-options="partyPageSizeOptions"
|
||||
:show-total="partyShowTotal"
|
||||
@update:page-size="onPartyPageSizeChange"
|
||||
/>
|
||||
</a-list>
|
||||
<a-table
|
||||
v-else-if="metricRows.length"
|
||||
:columns="metricColumns"
|
||||
:data-source="metricRows"
|
||||
:pagination="false"
|
||||
:loading="loading"
|
||||
row-key="key"
|
||||
/>
|
||||
<a-empty v-else description="دادهای برای نمایش نیست." />
|
||||
|
||||
<a-divider orientation="right">تعهدات به تفکیک ماه</a-divider>
|
||||
<a-empty v-if="!payablesByMonth.length" description="تعهد بازی نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedMonthRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>{{ toman(item.amount) }}</a-typography-text>
|
||||
<a-divider orientation="right">مطالبات به تفکیک طرف حساب</a-divider>
|
||||
<a-empty v-if="!receivablesByParty.length" description="مورد بازی نیست." />
|
||||
<a-list
|
||||
v-else
|
||||
:item-layout="isMobile ? 'vertical' : 'horizontal'"
|
||||
:data-source="pagedPartyRows"
|
||||
>
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>{{ toman(item.amount) }}</a-typography-text>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ item.name }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ item.month }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="monthPage"
|
||||
:total="monthTotal"
|
||||
:page-size="monthPageSize"
|
||||
:page-size-options="monthPageSizeOptions"
|
||||
:show-total="monthShowTotal"
|
||||
@update:page-size="onMonthPageSizeChange"
|
||||
/>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="partyPage"
|
||||
:total="partyTotal"
|
||||
:page-size="partyPageSize"
|
||||
:page-size-options="partyPageSizeOptions"
|
||||
:show-total="partyShowTotal"
|
||||
@update:page-size="onPartyPageSizeChange"
|
||||
/>
|
||||
|
||||
<template v-if="current">
|
||||
<a-divider orientation="right">سهم هزینهها</a-divider>
|
||||
<a-empty v-if="!current.expenseCategories.length" description="دستهای نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedExpenseCats">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>
|
||||
{{ toman(item.amount) }} · {{ item.share }}٪
|
||||
</a-typography-text>
|
||||
<a-divider orientation="right">تعهدات به تفکیک ماه شمسی</a-divider>
|
||||
<a-empty v-if="!payablesByMonth.length" description="تعهد بازی نیست." />
|
||||
<a-list
|
||||
v-else
|
||||
:item-layout="isMobile ? 'vertical' : 'horizontal'"
|
||||
:data-source="pagedMonthRows"
|
||||
>
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>{{ toman(item.amount) }}</a-typography-text>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ monthTitle(item) }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="monthPage"
|
||||
:total="monthTotal"
|
||||
:page-size="monthPageSize"
|
||||
:page-size-options="monthPageSizeOptions"
|
||||
:show-total="monthShowTotal"
|
||||
@update:page-size="onMonthPageSizeChange"
|
||||
/>
|
||||
|
||||
<template v-if="current">
|
||||
<a-divider orientation="right">سهم هزینهها (این دوره)</a-divider>
|
||||
<a-empty v-if="!current.expenseCategories.length" description="دستهای نیست." />
|
||||
<a-list
|
||||
v-else
|
||||
:item-layout="isMobile ? 'vertical' : 'horizontal'"
|
||||
:data-source="pagedExpenseCats"
|
||||
>
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-typography-text strong>
|
||||
{{ toman(item.amount) }} · {{ item.share }}٪
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ item.name }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>{{ item.name }}</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="expenseCatPage"
|
||||
:total="expenseCatTotal"
|
||||
:page-size="expenseCatPageSize"
|
||||
:page-size-options="expenseCatPageSizeOptions"
|
||||
:show-total="expenseCatShowTotal"
|
||||
@update:page-size="onExpenseCatPageSizeChange"
|
||||
/>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="expenseCatPage"
|
||||
:total="expenseCatTotal"
|
||||
:page-size="expenseCatPageSize"
|
||||
:page-size-options="expenseCatPageSizeOptions"
|
||||
:show-total="expenseCatShowTotal"
|
||||
@update:page-size="onExpenseCatPageSizeChange"
|
||||
/>
|
||||
</template>
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="debtors" tab="بدهکاران">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-tab-pane key="debtors" tab="بدهکاران">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-typography-text type="secondary">
|
||||
ماندهٔ فاکتور صادرشده و اسناد دریافتِ باز. صدور فاکتور سند درآمد جدا نمیسازد.
|
||||
</a-typography-text>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<a-typography-text type="secondary">
|
||||
ماندهٔ فاکتور صادرشده و اسناد دریافتِ باز. صدور فاکتور سند درآمد جدا نمیسازد.
|
||||
{{ debtors.length }} طرف حساب · جمع مانده {{ toman(sumRemaining(debtors)) }}
|
||||
</a-typography-text>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<a-typography-text type="secondary">
|
||||
{{ debtors.length }} طرف حساب · جمع مانده {{ toman(sumRemaining(debtors)) }}
|
||||
</a-typography-text>
|
||||
<a-button @click="exportParties(debtors, 'بدهکاران', 'دریافتشده', 'debtors.xlsx')">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-flex>
|
||||
<TreasuryPartyBalanceTable :rows="debtors" settled-label="دریافتشده" />
|
||||
<a-button @click="exportParties(debtors, 'بدهکاران', 'دریافتشده', 'debtors.xlsx')">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
<TreasuryPartyBalanceTable :rows="debtors" settled-label="دریافتشده" />
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="creditors" tab="بستانکاران">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-tab-pane key="creditors" tab="بستانکاران">
|
||||
<a-flex vertical :gap="16">
|
||||
<a-typography-text type="secondary">
|
||||
ماندهٔ فاکتور برگشتی و اسناد هزینهٔ باز. برگشتی سند هزینهٔ جدا نمیسازد.
|
||||
</a-typography-text>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<a-typography-text type="secondary">
|
||||
ماندهٔ فاکتور برگشتی و اسناد هزینهٔ باز. برگشتی سند هزینهٔ جدا نمیسازد.
|
||||
{{ creditors.length }} طرف حساب · جمع مانده {{ toman(sumRemaining(creditors)) }}
|
||||
</a-typography-text>
|
||||
<a-flex justify="space-between" align="center">
|
||||
<a-typography-text type="secondary">
|
||||
{{ creditors.length }} طرف حساب · جمع مانده {{ toman(sumRemaining(creditors)) }}
|
||||
</a-typography-text>
|
||||
<a-button @click="exportParties(creditors, 'بستانکاران', 'پرداختشده', 'creditors.xlsx')">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-flex>
|
||||
<TreasuryPartyBalanceTable :rows="creditors" settled-label="پرداختشده" />
|
||||
<a-button
|
||||
@click="exportParties(creditors, 'بستانکاران', 'پرداختشده', 'creditors.xlsx')"
|
||||
>
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
خروجی اکسل
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
<TreasuryPartyBalanceTable :rows="creditors" settled-label="پرداختشده" />
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user