# Overtime Calculation Script Instructions

This script automatically calculates overtime hours based on your specific rules and populates the "加班總表" sheet.

## How to Install

1.  Open your Google Sheet.
2.  Go to **Extensions** > **Apps Script**.
3.  Delete any code in the `Code.gs` file and paste the content of the `Code.gs` file provided here.
4.  Click the **Save** icon (floppy disk).

## How to Run

1.  In the Apps Script editor, ensure the function `generateOvertimeReport` is selected in the toolbar.
2.  Click **Run**.
3.  Grant the necessary permissions if prompted (Review Permissions > Choose Account > Advanced > Go to Untitled Project (unsafe) > Allow).
4.  Go back to your Google Sheet and check the **加班總表** tab.

## Configuration

You can modify the `CONFIG` object at the top of the script to change:
-   **SOURCE_SHEETS**: The list of sheet names to process.
-   **WEEKDAY_TIERS**: The overtime rates and duration thresholds for weekdays.
-   **WEEKEND_TIERS**: The overtime rates and duration thresholds for weekends.

## Logic Implemented

-   **Weekday**: Overtime starts 9 hours after the "Start Time" (assuming 1 hour break).
    -   0-1 hour overtime: **1.0x**
    -   1-3 hours overtime: **1.34x**
    -   3+ hours overtime: **1.67x**
-   **Weekend**: Overtime starts immediately.
    -   0-2 hours: **1.33x**
    -   2-8 hours: **1.67x**
    -   8+ hours: **2.67x**