fix(SPG-600) Filter Sumber, Tipe, Kontak pada index booking belum berjalan
parent
2a8d5e87cf
commit
001f371244
|
@ -33,4 +33,6 @@ export interface FilterTransactionEntity extends BaseFilterEntity {
|
|||
invoice_date_to?: Date;
|
||||
settlement_date_from?: Date;
|
||||
settlement_date_to?: Date;
|
||||
request_refund_date_from?: Date;
|
||||
request_refund_date_to?: Date;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
Param,
|
||||
RelationParam,
|
||||
} from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
import { BetweenQueryHelper } from 'src/core/helpers/query/between-query.helper';
|
||||
|
||||
@Injectable()
|
||||
export class IndexTransactionManager extends BaseIndexManager<TransactionEntity> {
|
||||
|
@ -75,14 +76,43 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
|
|||
`refund.id`,
|
||||
`refund.code`,
|
||||
`refund.refund_date`,
|
||||
`refund.request_date`,
|
||||
];
|
||||
}
|
||||
|
||||
get specificFilter(): Param[] {
|
||||
return [
|
||||
{
|
||||
cols: `${this.tableName}.name`,
|
||||
data: this.filterParam.names,
|
||||
cols: `${this.tableName}.invoice_code`,
|
||||
data: this.filterParam.invoice_codes,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.type`,
|
||||
data: this.filterParam.types,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.customer_type`,
|
||||
data: this.filterParam.customer_types,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.customer_name`,
|
||||
data: this.filterParam.customer_names,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.payment_type`,
|
||||
data: this.filterParam.payment_types,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.payment_bank`,
|
||||
data: this.filterParam.payment_banks,
|
||||
},
|
||||
{
|
||||
cols: `refund.code`,
|
||||
data: this.filterParam.refund_codes,
|
||||
},
|
||||
{
|
||||
cols: `${this.tableName}.creator_name`,
|
||||
data: this.filterParam.creator_names,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
@ -90,6 +120,49 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
|
|||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<TransactionEntity>,
|
||||
): SelectQueryBuilder<TransactionEntity> {
|
||||
if (this.filterParam.booking_date_from) {
|
||||
new BetweenQueryHelper(
|
||||
queryBuilder,
|
||||
this.tableName,
|
||||
'booking_date',
|
||||
this.filterParam.booking_date_from,
|
||||
this.filterParam.booking_date_to,
|
||||
'booking_date',
|
||||
).getQuery();
|
||||
}
|
||||
|
||||
if (this.filterParam.invoice_date_from) {
|
||||
new BetweenQueryHelper(
|
||||
queryBuilder,
|
||||
this.tableName,
|
||||
'invoice_date',
|
||||
this.filterParam.invoice_date_from,
|
||||
this.filterParam.invoice_date_to,
|
||||
'invoice_date',
|
||||
).getQuery();
|
||||
}
|
||||
|
||||
if (this.filterParam.settlement_date_from) {
|
||||
new BetweenQueryHelper(
|
||||
queryBuilder,
|
||||
this.tableName,
|
||||
'settlement_date',
|
||||
this.filterParam.settlement_date_from,
|
||||
this.filterParam.settlement_date_to,
|
||||
'settlement_date',
|
||||
).getQuery();
|
||||
}
|
||||
|
||||
if (this.filterParam.request_refund_date_from) {
|
||||
new BetweenQueryHelper(
|
||||
queryBuilder,
|
||||
this.tableName,
|
||||
'request_refund_date',
|
||||
this.filterParam.request_refund_date_from,
|
||||
this.filterParam.request_refund_date_to,
|
||||
'request_refund',
|
||||
).getQuery();
|
||||
}
|
||||
queryBuilder.andWhere(`${this.tableName}.is_recap_transaction is false`);
|
||||
return queryBuilder;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue