import { useState } from "react";
import { Button } from "@/Components/ui/button";
import { Input } from "@/Components/ui/input";
import {
BarChart3,
Download,
Calendar,
Filter,
ArrowUpRight,
TrendingDown,
FileSpreadsheet,
Package,
Pocket
} from 'lucide-react';
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout";
import { Head, router } from "@inertiajs/react";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/Components/ui/table";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/Components/ui/card";
interface Record {
id: string;
date: string;
source: string;
category: string;
item: string;
reference: string;
invoice_number?: string;
amount: number | string;
}
interface PageProps {
records: Record[];
summary: {
total_amount: number;
purchase_total: number;
utility_total: number;
record_count: number;
};
filters: {
date_start: string;
date_end: string;
};
}
export default function AccountingReport({ records, summary, filters }: PageProps) {
const [dateStart, setDateStart] = useState(filters.date_start);
const [dateEnd, setDateEnd] = useState(filters.date_end);
const handleFilter = () => {
router.get(
route("accounting.report"),
{
date_start: dateStart,
date_end: dateEnd,
},
{ preserveState: true }
);
};
const handleExport = () => {
window.location.href = route("accounting.export", {
date_start: dateStart,
date_end: dateEnd,
});
};
return (
彙整採購支出與各項公用事業費用
共有 {summary.record_count} 筆紀錄
採購單彙整
水、電、瓦斯、電信等費項