Report Profit Loss
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user