# Requirements Document ## Introduction 本功能扩展现有的仪表盘和导出报表功能,增加结算状态(已结算/未结算)的显示和统计。系统已有 `is_settled` 字段用于标记工作记录的结算状态,本需求将在仪表盘和导出报表中展示这些信息。 **注意**: 数据库中 `work_records` 表已存在 `is_settled` 字段,无需新增数据库迁移。 ## Glossary - **Dashboard**: 仪表盘组件,显示日统计、月度报告和年度汇总 - **Monthly_Report**: 月度报告,显示当月的工作记录统计 - **Yearly_Summary**: 年度汇总,显示全年按月的人员收入统计 - **Export_Service**: 导出服务,生成Excel格式的月度和年度报表 - **Settlement_Status**: 结算状态,标识工作记录是否已结算(is_settled字段) - **Settled_Income**: 已结算收入,is_settled为true的工作记录总金额 - **Unsettled_Income**: 未结算收入,is_settled为false的工作记录总金额 ## Requirements ### Requirement 1: 月度报告增加结算收入统计 **User Story:** As a user, I want to see settled and unsettled income in the monthly report, so that I can track payment status at a glance. #### Acceptance Criteria 1. WHEN the monthly report is displayed, THE Dashboard SHALL show a "已结算收入" statistic card with the total settled income for the month 2. WHEN the monthly report is displayed, THE Dashboard SHALL show a "未结算收入" statistic card with the total unsettled income for the month 3. WHEN the monthly summary API is called, THE Work_Record_Service SHALL return settled_earnings and unsettled_earnings fields ### Requirement 2: 人员按供应商收入明细增加结算状态 **User Story:** As a user, I want to see settlement status in the person-by-supplier breakdown, so that I can identify which earnings are pending payment. #### Acceptance Criteria 1. WHEN the person-by-supplier breakdown is displayed, THE Dashboard SHALL show a "结算状态" column indicating settled or unsettled status 2. WHEN a row has unsettled earnings, THE Dashboard SHALL highlight the row with a distinct background color 3. WHEN the monthly summary API is called, THE Work_Record_Service SHALL return is_settled field for each supplier_breakdown entry ### Requirement 3: 年度汇总增加结算状态 **User Story:** As a user, I want to see settled and unsettled income breakdown in the yearly summary, so that I can track annual payment status by person. #### Acceptance Criteria 1. WHEN the yearly summary is displayed, THE Dashboard SHALL show both settled and unsettled income for each person 2. WHEN the yearly summary API is called, THE Work_Record_Service SHALL return settled_total and unsettled_total for each person 3. WHEN the yearly summary is displayed, THE Dashboard SHALL show grand totals for settled and unsettled income ### Requirement 4: 年度汇总位置调整 **User Story:** As a user, I want the yearly summary to appear at the bottom of the dashboard, so that the most frequently used monthly data is more accessible. #### Acceptance Criteria 1. WHEN the dashboard is rendered, THE Dashboard SHALL display the yearly summary section after all other sections (at the bottom) ### Requirement 5: 月度报表导出增加结算状态 **User Story:** As a user, I want the exported monthly report to include settlement status, so that I can track payment status in offline reports. #### Acceptance Criteria 1. WHEN a monthly report is exported, THE Export_Service SHALL include a "结算状态" column in the detail sheet 2. WHEN a monthly report is exported, THE Export_Service SHALL include a "结算状态" column in the monthly summary sheet 3. WHEN displaying settlement status, THE Export_Service SHALL show "已结算" for settled records and "未结算" for unsettled records ### Requirement 6: 年度报表导出增加结算状态 **User Story:** As a user, I want the exported yearly report to include settlement status, so that I can track annual payment status in offline reports. #### Acceptance Criteria 1. WHEN a yearly report is exported, THE Export_Service SHALL include a "结算状态" column in the detail sheet 2. WHEN a yearly report is exported, THE Export_Service SHALL include settlement status breakdown in the yearly summary sheet 3. WHEN displaying settlement status, THE Export_Service SHALL show "已结算" for settled records and "未结算" for unsettled records