feat: csv sale export
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
db4d21bb62
commit
a979c60143
1 changed files with 41 additions and 0 deletions
|
|
@ -284,6 +284,47 @@ export class StatsController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get("sale/by-product-group/download")
|
||||||
|
async downloadSaleByProductGroupReport(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Query() limit?: number,
|
||||||
|
@Query() startDate?: Date,
|
||||||
|
@Query() endDate?: Date,
|
||||||
|
) {
|
||||||
|
this.setHeader("Content-Type", "text/csv");
|
||||||
|
return json2csv(
|
||||||
|
await this.saleReport(req, limit, startDate, endDate).then((v) => v.byProductGroup),
|
||||||
|
{ useDateIso8601Format: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get("sale/by-sale/download")
|
||||||
|
async downloadSaleBySaleReport(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Query() limit?: number,
|
||||||
|
@Query() startDate?: Date,
|
||||||
|
@Query() endDate?: Date,
|
||||||
|
) {
|
||||||
|
this.setHeader("Content-Type", "text/csv");
|
||||||
|
return json2csv(await this.saleReport(req, limit, startDate, endDate).then((v) => v.bySale), {
|
||||||
|
useDateIso8601Format: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get("sale/by-customer/download")
|
||||||
|
async downloadSaleByCustomerReport(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Query() limit?: number,
|
||||||
|
@Query() startDate?: Date,
|
||||||
|
@Query() endDate?: Date,
|
||||||
|
) {
|
||||||
|
this.setHeader("Content-Type", "text/csv");
|
||||||
|
return json2csv(
|
||||||
|
await this.saleReport(req, limit, startDate, endDate).then((v) => v.byCustomer),
|
||||||
|
{ useDateIso8601Format: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Get("sale")
|
@Get("sale")
|
||||||
async saleReport(
|
async saleReport(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue