feat(SPG-737): fix filter reconciliation

pull/57/head
Firman Ramdhani 2024-08-07 14:47:19 +07:00
parent 0658b503bd
commit ba6ee4a408
1 changed files with 13 additions and 10 deletions

View File

@ -130,18 +130,18 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
if (this.filterParam.payment_via) { if (this.filterParam.payment_via) {
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.payment_type::text In (:...type)`, `${this.tableName}.payment_type_method_name::text LIKE :type`,
{ {
type: [`%${this.filterParam.payment_via}%`], type: `%${this.filterParam.payment_via}%`,
}, },
); );
} }
if (this.filterParam.payment_bank) { if (this.filterParam.payment_bank) {
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.payment_type_method_name::text In (:...banks)`, `${this.tableName}.payment_type_method_name::text LIKE :banks`,
{ {
banks: [`%${this.filterParam.payment_bank}%`], banks: `%${this.filterParam.payment_bank}%`,
}, },
); );
} }
@ -164,12 +164,15 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
).getQuery(); ).getQuery();
} }
if (!this.filterParam.statuses || this.filterParam.statuses?.length === 0) {
queryBuilder.andWhere( queryBuilder.andWhere(
`${this.tableName}.reconciliation_status Not In (:...statuses)`, `${this.tableName}.reconciliation_status Not In (:...statuses)`,
{ {
statuses: [STATUS.DRAFT], statuses: [STATUS.DRAFT],
}, },
); );
}
console.log(queryBuilder.getQueryAndParameters());
return queryBuilder; return queryBuilder;
} }
} }