Report Profit Loss

This commit is contained in:
efrilm
2025-09-25 15:45:49 +07:00
parent 79cd4f9dcb
commit dc32c8553b
4 changed files with 404 additions and 5 deletions
@@ -2,6 +2,7 @@
import DateRangePicker from '@/components/RangeDatePicker'
import { ReportItem, ReportItemFooter, ReportItemHeader, ReportItemSubheader } from '@/components/report/ReportItem'
import { ExcelExportProfitLossService } from '@/services/export/excel/ExcelExportProfitLossService'
import { ProfitLossReport } from '@/types/services/analytic'
import { Button, Card, CardContent, Box } from '@mui/material'
@@ -30,9 +31,24 @@ const ReportProfitLossContent = ({
onStartDateChange,
onEndDateChange
}: ReportProfitLossContentProps) => {
const handleExport = () => {
// TODO: Implement export functionality
console.log('Export data:', profitData)
const handleExport = async () => {
if (!profitData) return
try {
const result = await ExcelExportProfitLossService.exportProfitLossToExcel(profitData)
if (result.success) {
// Optional: Show success notification
console.log('Export successful:', result.filename)
// You can add toast notification here
} else {
console.error('Export failed:', result.error)
alert('Export gagal. Silakan coba lagi.')
}
} catch (error) {
console.error('Export error:', error)
alert('Terjadi kesalahan saat export.')
}
}
return (