итого в отчете
This commit is contained in:
parent
c4c941c0c9
commit
f11ebc82f5
@ -134,6 +134,7 @@ fun CardScreen(report: ReportRemote?) {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
}
|
||||
Text(text = "Итого: ")
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
@ -20,6 +20,9 @@ module.exports = (req, res, next) => {
|
||||
sessionDate.setHours(4, 0, 0, 0);
|
||||
return sessionDate >= start && sessionDate <= end;
|
||||
});
|
||||
const report = { "report_data": [],
|
||||
"total_revenue": 0.0,
|
||||
"total_purchased_tickets": 0 }
|
||||
|
||||
// Обрабатываем отфильтрованные сеансы для аналитики
|
||||
const reportData = filteredSessions.map(session => {
|
||||
@ -43,6 +46,8 @@ module.exports = (req, res, next) => {
|
||||
}, { totalTicketsSold: 0, revenue: 0 });
|
||||
|
||||
const cinema = cinemas.find(cinema => cinema.id === session.cinemaId)
|
||||
report.total_revenue += revenue
|
||||
report.total_purchased_tickets += totalTicketsSold
|
||||
return {
|
||||
cinema_name: cinema ? cinema.name : "Неизвестно",
|
||||
current_ticket_date_time: session.dateTime,
|
||||
@ -53,10 +58,8 @@ module.exports = (req, res, next) => {
|
||||
};
|
||||
});
|
||||
|
||||
const sortedReportData = reportData.sort((a, b) => b.revenue - a.revenue);
|
||||
const report = { "sortedReportData": sortedReportData,
|
||||
"total_revenue": sortedReportData.reduce((a, b) => a + b.revenue, 0),
|
||||
"total_purchased_tickets": sortedReportData.reduce((a, b) => a + b.purchased_tickets, 0) }
|
||||
report.report_data = reportData.sort((a, b) => b.revenue - a.revenue)
|
||||
|
||||
res.json(report);
|
||||
} catch (error) {
|
||||
console.error('Error processing report: ', error);
|
||||
|
Loading…
Reference in New Issue
Block a user