feat(tahesab): sales report snapshot with org-module gate
Sync linked asnad into CRM, filter by group/kind/metal, and require the tahesab superadmin module plus reports role access.
This commit is contained in:
@@ -226,7 +226,7 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
loyalty: "باشگاه مشتریان",
|
||||
reports: "گزارشها",
|
||||
notes: "یادداشتها",
|
||||
tahesab: "تهحساب",
|
||||
tahesab: "تهحساب (اتصال و گزارش فروش)",
|
||||
custom_fields: "فیلدهای سفارشی",
|
||||
currencies: "ارزها",
|
||||
team_settings: "تیم و تنظیمات سازمان",
|
||||
@@ -4061,6 +4061,110 @@ export interface PersonAccountingLinkDto {
|
||||
isDefaultConnection?: boolean;
|
||||
}
|
||||
|
||||
/** طبقهبندی تقریبی نوع سند از روی متن NO تهحساب */
|
||||
export const TAHESAB_ASNAD_KINDS = [
|
||||
"sale",
|
||||
"return",
|
||||
"purchase",
|
||||
"other",
|
||||
] as const;
|
||||
export type TahesabAsnadKind = (typeof TAHESAB_ASNAD_KINDS)[number];
|
||||
|
||||
export const TAHESAB_ASNAD_KIND_LABELS: Record<TahesabAsnadKind, string> = {
|
||||
sale: "فروش",
|
||||
return: "مرجوعی",
|
||||
purchase: "خرید",
|
||||
other: "سایر",
|
||||
};
|
||||
|
||||
export const TAHESAB_JENS_FELEZ_LABELS: Record<number, string> = {
|
||||
0: "طلا",
|
||||
1: "پلاتین",
|
||||
2: "نقره",
|
||||
};
|
||||
|
||||
export interface TahesabAsnadSyncRequest {
|
||||
connectionId?: string;
|
||||
/** شمسی YYYY-MM-DD */
|
||||
from: string;
|
||||
/** شمسی YYYY-MM-DD */
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadSyncJobDto {
|
||||
id: string;
|
||||
status: "pending" | "running" | "done" | "failed" | string;
|
||||
connectionId: string | null;
|
||||
from: string;
|
||||
to: string;
|
||||
processed: number;
|
||||
total: number;
|
||||
linesUpserted: number;
|
||||
truncatedPersonIds: string[];
|
||||
errorMessage: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadLineDto {
|
||||
id: string;
|
||||
connectionId: string;
|
||||
personId: string | null;
|
||||
personName: string | null;
|
||||
moshtariCode: number;
|
||||
tarikh: string;
|
||||
noRaw: string;
|
||||
kind: TahesabAsnadKind | string;
|
||||
jensFelez: number | null;
|
||||
noKar: string | null;
|
||||
vazn: number | null;
|
||||
tabdilVazn: number | null;
|
||||
mali: number | null;
|
||||
count: number | null;
|
||||
shFactor: number | null;
|
||||
factorCode: string | null;
|
||||
groups: CustomerGroupSummaryDto[];
|
||||
syncedAt: string;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadReportQuery {
|
||||
connectionId?: string;
|
||||
from: string;
|
||||
to: string;
|
||||
groupIds?: string[];
|
||||
personId?: string;
|
||||
kinds?: TahesabAsnadKind[];
|
||||
jensFelez?: number;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadReportPageDto {
|
||||
items: TahesabAsnadLineDto[];
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadSummaryBucketDto {
|
||||
key: string;
|
||||
label: string;
|
||||
lineCount: number;
|
||||
maliSum: number;
|
||||
vaznSum: number;
|
||||
}
|
||||
|
||||
export interface TahesabAsnadSummaryDto {
|
||||
totalLines: number;
|
||||
maliSum: number;
|
||||
vaznSum: number;
|
||||
byKind: TahesabAsnadSummaryBucketDto[];
|
||||
byMetal: TahesabAsnadSummaryBucketDto[];
|
||||
byGroup: TahesabAsnadSummaryBucketDto[];
|
||||
distinctNos: string[];
|
||||
lastSyncedAt: string | null;
|
||||
}
|
||||
|
||||
export interface MandehValueDto {
|
||||
amount: string | number;
|
||||
unit: string;
|
||||
|
||||
Reference in New Issue
Block a user