- added between dates when exporting excel transaction history

This commit is contained in:
Muhammad Fadli 2023-05-04 00:22:54 +07:00
parent 8e9295a806
commit dbb363983b
3 changed files with 8 additions and 6 deletions

View File

@ -1,8 +1,9 @@
import { IsNotEmpty, IsOptional } from 'class-validator';
export class ExportTransactionDto {
@IsNotEmpty()
dateStart: string;
@IsNotEmpty()
dateStart: string;
@IsNotEmpty()
dateEnd: string;
}

View File

@ -30,6 +30,7 @@ export class ExcelController {
) {
const result = await this.transactionService.exportDataExcel(
exportTransactionDto.dateStart,
exportTransactionDto.dateEnd,
id,
req.user,
);

View File

@ -2208,7 +2208,7 @@ export class TransactionService {
});
}
async exportDataExcel(startDate, user: any, currentUser: any) {
async exportDataExcel(startDate, endDate, user: any, currentUser: any) {
const userData = await this.userService.findExist(user);
let userBySupperior = [];
@ -2285,7 +2285,7 @@ export class TransactionService {
'transaction.created_at between :startDate and :enDate',
{
startDate: new Date (`${startDate} 00:00:00`),
enDate: new Date (`${startDate} 23:59:59`),
enDate: new Date (`${endDate} 23:59:59`),
},
);
}
@ -2413,7 +2413,7 @@ export class TransactionService {
tmp.file(
{
discardDescriptor: true,
prefix: `Mutasi Transaksi ${userData?.partner.name} ${startDate}`,
prefix: `Mutasi Transaksi ${userData?.partner.name} ${startDate} - ${endDate}`,
postfix: '.xlsx',
mode: parseInt('0600', 8),
},