feat: 经理看板按归属日期汇总
This commit is contained in:
@@ -108,7 +108,8 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
void_fill = PatternFill(fill_type="solid", fgColor="FFD9D9D9")
|
||||
sheet.append([
|
||||
"考勤点",
|
||||
"报工日期",
|
||||
"统计归属日期",
|
||||
"原始报工日期",
|
||||
"员工姓名",
|
||||
"员工电话",
|
||||
"工种",
|
||||
@@ -138,6 +139,13 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
])
|
||||
wage_summary: dict[tuple[str, str, str], dict[str, float | str]] = {}
|
||||
for row_index, row in enumerate(rows, start=2):
|
||||
source_dates = getattr(row, "source_report_dates", []) or [
|
||||
getattr(row, "source_report_date", None) or row.report_date
|
||||
]
|
||||
source_dates = sorted({item for item in source_dates if item})
|
||||
source_date_text = "、".join(
|
||||
item.isoformat() for item in source_dates
|
||||
)
|
||||
report_flags = []
|
||||
if getattr(row, "is_voided", False):
|
||||
report_flags.append("作废")
|
||||
@@ -152,6 +160,7 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
sheet.append([
|
||||
row.attendance_point_name,
|
||||
row.report_date.isoformat(),
|
||||
source_date_text,
|
||||
row.employee_name,
|
||||
row.employee_phone,
|
||||
row.worker_type,
|
||||
@@ -199,9 +208,11 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
total_good_qty = as_float(row.total_good_qty)
|
||||
expected_workload = as_float(row.expected_workload)
|
||||
if standard_beat > 0 and (actual_beat > standard_beat or actual_beat < standard_beat * 0.7):
|
||||
sheet.cell(row=row_index, column=14).fill = warn_fill
|
||||
if expected_workload > 0 and (total_good_qty < expected_workload or total_good_qty > expected_workload * 1.3):
|
||||
sheet.cell(row=row_index, column=11).fill = warn_fill
|
||||
sheet.cell(row=row_index, column=15).fill = warn_fill
|
||||
if expected_workload > 0 and (
|
||||
total_good_qty < expected_workload or total_good_qty > expected_workload * 1.3
|
||||
):
|
||||
sheet.cell(row=row_index, column=12).fill = warn_fill
|
||||
if getattr(row, "is_voided", False):
|
||||
for cell in sheet[row_index]:
|
||||
cell.fill = void_fill
|
||||
|
||||
Reference in New Issue
Block a user