This commit is contained in:
Muhammad Fadli 2023-05-04 02:45:19 +07:00
commit cc39fdc26c
3 changed files with 8 additions and 6 deletions

View File

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

View File

@ -30,6 +30,7 @@ export class ExcelController {
) { ) {
const result = await this.transactionService.exportDataExcel( const result = await this.transactionService.exportDataExcel(
exportTransactionDto.dateStart, exportTransactionDto.dateStart,
exportTransactionDto.dateEnd,
id, id,
req.user, 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); const userData = await this.userService.findExist(user);
let userBySupperior = []; let userBySupperior = [];
@ -2285,7 +2285,7 @@ export class TransactionService {
'transaction.created_at between :startDate and :enDate', 'transaction.created_at between :startDate and :enDate',
{ {
startDate: new Date (`${startDate} 00:00:00`), 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( tmp.file(
{ {
discardDescriptor: true, discardDescriptor: true,
prefix: `Mutasi Transaksi ${userData?.partner.name} ${startDate}`, prefix: `Mutasi Transaksi ${userData?.partner.name} ${startDate} - ${endDate}`,
postfix: '.xlsx', postfix: '.xlsx',
mode: parseInt('0600', 8), mode: parseInt('0600', 8),
}, },