some updates
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
import { TspProviderResponseStatus } from '@/generated/prisma/enums'
|
import {
|
||||||
|
InvoiceSettlementType,
|
||||||
|
TspProviderResponseStatus,
|
||||||
|
} from '@/generated/prisma/enums'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
PaymentMethodType: {
|
PaymentMethodType: {
|
||||||
@@ -144,6 +147,11 @@ export default {
|
|||||||
[TspProviderResponseStatus.FISCAL_QUEUED]: 'در انتظار تایید سازمان',
|
[TspProviderResponseStatus.FISCAL_QUEUED]: 'در انتظار تایید سازمان',
|
||||||
[TspProviderResponseStatus.SEND_FAILURE]: 'خطا در ارسال',
|
[TspProviderResponseStatus.SEND_FAILURE]: 'خطا در ارسال',
|
||||||
},
|
},
|
||||||
|
InvoiceSettlementType: {
|
||||||
|
[InvoiceSettlementType.CASH]: 'نقدی',
|
||||||
|
[InvoiceSettlementType.CREDIT]: 'نسیه',
|
||||||
|
[InvoiceSettlementType.MIXED]: 'نقدی / نسیه',
|
||||||
|
},
|
||||||
TspProviderRequestType: {
|
TspProviderRequestType: {
|
||||||
ORIGINAL: 'اصلی',
|
ORIGINAL: 'اصلی',
|
||||||
CORRECTION: 'اصلاح',
|
CORRECTION: 'اصلاح',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const summarySelect: SalesInvoiceSelect = {
|
|||||||
type: true,
|
type: true,
|
||||||
notes: true,
|
notes: true,
|
||||||
created_at: true,
|
created_at: true,
|
||||||
|
settlement_type: true,
|
||||||
customer: {
|
customer: {
|
||||||
select: {
|
select: {
|
||||||
type: true,
|
type: true,
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ export class SalesInvoicesService {
|
|||||||
'TspProviderResponseStatus',
|
'TspProviderResponseStatus',
|
||||||
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
||||||
),
|
),
|
||||||
|
settlement_type: translateEnumValue(
|
||||||
|
'InvoiceSettlementType',
|
||||||
|
invoice.settlement_type,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseMapper.single(mappedInvoice)
|
return ResponseMapper.single(mappedInvoice)
|
||||||
@@ -290,7 +294,9 @@ export class SalesInvoicesService {
|
|||||||
|
|
||||||
if (query.status) {
|
if (query.status) {
|
||||||
if (query.status === TspProviderResponseStatus.NOT_SEND) {
|
if (query.status === TspProviderResponseStatus.NOT_SEND) {
|
||||||
where.tsp_attempts = undefined
|
where.tsp_attempts = {
|
||||||
|
none: {},
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
where.tsp_attempts = {
|
where.tsp_attempts = {
|
||||||
some: {
|
some: {
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ export class StatisticsService {
|
|||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN si.total_amount ELSE 0 END) AS failure_amount_sum,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN si.total_amount ELSE 0 END) AS failure_amount_sum,
|
||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN si.tax_amount ELSE 0 END) AS failure_tax_sum,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN si.tax_amount ELSE 0 END) AS failure_tax_sum,
|
||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN 1 ELSE 0 END) AS failure_count,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FAILURE} THEN 1 ELSE 0 END) AS failure_count,
|
||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.QUEUED} THEN si.total_amount ELSE 0 END) AS pending_amount_sum,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FISCAL_QUEUED} THEN si.total_amount ELSE 0 END) AS pending_amount_sum,
|
||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.QUEUED} THEN si.tax_amount ELSE 0 END) AS pending_tax_sum,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FISCAL_QUEUED} THEN si.tax_amount ELSE 0 END) AS pending_tax_sum,
|
||||||
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.QUEUED} THEN 1 ELSE 0 END) AS pending_count,
|
SUM(CASE WHEN la.status = ${TspProviderResponseStatus.FISCAL_QUEUED} THEN 1 ELSE 0 END) AS pending_count,
|
||||||
SUM(CASE WHEN la.status IS NULL THEN si.total_amount ELSE 0 END) AS not_sended_amount_sum,
|
SUM(CASE WHEN la.status IS NULL THEN si.total_amount ELSE 0 END) AS not_sended_amount_sum,
|
||||||
SUM(CASE WHEN la.status IS NULL THEN si.tax_amount ELSE 0 END) AS not_sended_tax_sum,
|
SUM(CASE WHEN la.status IS NULL THEN si.tax_amount ELSE 0 END) AS not_sended_tax_sum,
|
||||||
SUM(CASE WHEN la.status IS NULL THEN 1 ELSE 0 END) AS not_sended_count,
|
SUM(CASE WHEN la.status IS NULL THEN 1 ELSE 0 END) AS not_sended_count,
|
||||||
@@ -104,7 +104,7 @@ export class StatisticsService {
|
|||||||
tax_amount: Number(item?.pending_tax_sum || 0),
|
tax_amount: Number(item?.pending_tax_sum || 0),
|
||||||
count: Number(item?.pending_count || 0),
|
count: Number(item?.pending_count || 0),
|
||||||
},
|
},
|
||||||
not_sended: {
|
not_send: {
|
||||||
total_amount: Number(item?.not_sended_amount_sum || 0),
|
total_amount: Number(item?.not_sended_amount_sum || 0),
|
||||||
tax_amount: Number(item?.not_sended_tax_sum || 0),
|
tax_amount: Number(item?.not_sended_tax_sum || 0),
|
||||||
count: Number(item?.not_sended_count || 0),
|
count: Number(item?.not_sended_count || 0),
|
||||||
|
|||||||
Reference in New Issue
Block a user