Chase.Works
系統Systems2026

員工請假單生成系統Leave Application Form Generator

以 Python + Tkinter 製作的桌面工具:從員工名單 Excel 選人、選假別與起訖時間,自動計算工時,套用請假單 Excel 範本一次產生「人事部留存」與「申請人留存」兩份檔案,不用手動編輯 Excel。A Python + Tkinter desktop tool: pick an employee from an Excel roster, choose the leave type and start / end time, and it calculates working hours automatically, then fills the Excel leave-form template to produce an HR copy and an Applicant copy at once, with no manual Excel editing.

如何運作How it works

  1. 載入設定與員工名單

    啟動時讀取 Leave_Application_Form_config.txt(不存在則自動建立預設值),以 openpyxl 讀員工名單 Excel 的部門、姓名、工號欄。
  2. 選人與假別

    下拉選姓名後自動帶出部門與工號;假別提供 12 種中英對照,並可選本人簽名或代理人簽名、填寫請假說明,也可上傳簽名圖片(內建圖片轉 PNG 工具)。
  3. 日曆選時間並計算工時

    以 tkcalendar 選起訖日期、下拉選時與分(00/15/30/45);只計算週一至週五的 08:30–12:30、13:30–17:30,8 小時內顯示小時、超過顯示天加小時。
  4. 套用範本填欄位

    按「生成請假單」後檢查已選員工、假別與範本是否存在,對兩份輸出各自 shutil.copy2 複製範本,再用 openpyxl 寫入姓名、工號、部門、假別、說明、請假期間與合計。
  5. 輸出兩份 Excel

    插入簽名圖、清除第 37 列以下格式後,存成 人事部留存 與 申請人留存 兩份 .xlsx,檔名含姓名與當天日期。

架構Architecture

flowchart LR
    C[設定檔 config.txt] --> A[LeaveApplicationSystem Tkinter GUI]
    E[(員工名單 xlsx)] -- openpyxl 讀取 --> A
    U[使用者 選人 假別 時間 簽名] --> A
    A -- 複製範本並填欄位 --> T[(請假單範本 xlsx)]
    T --> O1[人事部留存 xlsx]
    T --> O2[申請人留存 xlsx]

技術Tech stack

PythonTkintertkcalendaropenpyxlPillowPyInstallerWindows .exe