跳至主要内容

資料結構說明

本文件詳細說明 SoA(Statement of Account)功能所需的資料結構調整,包含新增欄位、View 設計與資料表結構。


1. Partner(來源:CRM)

系統沿用既有 Partner 資料中的 Closing Date 欄位, 作為每個 Partner 的「關帳日規則(Closing Term)」來源。

Closing Date 為單選欄位,用於定義該 Partner 的月結截止方式,例如:

  • 20th of each month
  • 25th of each month

本專案 不調整、不新增 Partner 主資料欄位, 僅於財務模組中引用此欄位作為 Billing Month 與帳期計算的依據。


2. Debit Notes(FIN)— 結構調整說明(含必要新增欄位)

為支援 Statement of Account(SoA)月結請款流程
本專案需對既有的 Debit Notes(FIN)資料表進行結構補強

以下以 ❇️ 標示之欄位,原本並不存在於現行 Debit Note 表中
但若未新增,將無法正確且可控地完成 SoA 的判斷、彙總與防呆機制。

此調整屬於「為支援新功能而必要的資料結構擴充」,
並非對既有帳務資料的任意改動。


新增/調整欄位說明(❇️ 為必要新增)

❇️ 1. Display Name

顯示用組合欄位,由系統自動組合以下資訊:

  • Debit Note No.
  • Bill to(請款對象)

目的說明:

  • 提升 Interface 與 Link record 選擇時的可讀性
  • 避免僅顯示單一編號,造成使用者誤選或判讀困難

此欄位僅用於顯示,不影響原始帳務資料。


❇️ 2. SoA?

使用者操作欄位,用於標示該筆 Debit Note 是否計畫納入 SoA 月結流程

目的說明:

  • 明確區分單筆請款與月結請款資料
  • 作為後續 SoA 彙整流程的第一道判斷條件

此欄位僅代表「是否納入規劃」,不代表實際已結帳。


❇️ 3. Included in Statement

系統判斷欄位,用於標示該筆 Debit Note 是否已實際被納入某一張 SoA

目的說明(關鍵):

  • 防止同一筆 Debit Note 被重複加入不同 SoA
  • 提供清楚、不可誤判的帳務狀態指示

此欄位不由使用者編輯,而是由 Automation 自動控制:

  • Statement No. 為空 → 不勾選
  • Statement No. 有值 → 自動勾選

❇️ 4. Billing Month

公式欄位,用於判定該筆 Debit Note 實際歸屬的請款月份(帳期)

目的說明:

  • 支援不同 Partner 不同關帳日的月結邏輯
  • 避免僅依 Invoice Date 判斷而造成帳期錯置

此欄位依據以下資料計算:

  • Invoice Date
  • Partner 的 Closing Date

為 SoA 分組與篩選的核心依據。


❇️ 5. Closing Date

同步自 Partner(CRM)資料表的關帳規則欄位
(例如:20th of each month、25th of each month)。

目的說明:

  • 作為 Billing Month 與帳期計算的基礎來源
  • 避免在 FIN 端重複維護 Partner 的結帳規則

此欄位於 FIN 中僅作為唯讀使用。


❇️ 6. Closing Days

由 Closing Date 轉換而來的數值欄位(如:20、25)。

目的說明:

  • 將文字型關帳規則轉為可計算數值
  • 作為帳期公式(Billing Month、Period Start、Period End)的計算基礎

屬於系統計算輔助欄位,不提供人工操作。


❇️ 7. Bill to

Link to record 欄位,用於指定該筆 Debit Note 的請款對象(Partner)。

調整目的:

  • 作為 SoA 彙總與分組的依據
  • 作為關帳規則與帳期計算的來源

❇️ 8. Statement No.

Link to record 欄位,指向 Statement of Account(SoA)資料表。

目的說明(核心關聯):

  • 明確記錄該筆 Debit Note 被納入哪一張 SoA
  • 作為 Included in Statement 自動判斷的依據
  • 建立 Debit Note 與 SoA 之間的資料關聯關係

補充說明

上述 ❇️ 欄位為 SoA 月結功能能穩定運作的必要結構
若未補齊,將可能產生以下風險:

  • 帳期歸屬判斷不一致
  • 同筆 Debit Note 重複請款
  • Interface 操作缺乏防呆機制
  • 帳務狀態需人工判讀,增加作業風險

因此,本次調整屬於為支援 Partner 月結請款流程所必須進行的資料結構擴充。


Debit Notes(FIN)— View 設計說明(Interface 專用)

為配合 SoA(Statement of Account)在 Interface 中的操作流程,
本專案將於 Debit Notes 資料表中新增兩個專用 View

⚠️ 此兩個 View 並非單純為資料檢視用途建立,
而是作為 Interface 操作邏輯與防呆機制的基礎來源


1. Ready for Statement

此 View 用於 Interface 中「可加入 SoA 的 Debit Notes」來源,篩選條件如下:

  • SoA? = 勾選
  • Received ≠ 勾選
  • Included in Statement ≠ 勾選

目的在於確保:

  • 僅顯示允許列帳
  • 尚未被納入任何 Statement
  • 且尚未完成收款的 Debit Notes
    以避免重複列帳或已結清資料被誤選。

2. Included in Statement

此 View 顯示所有 已被正式納入 Statement of Account 的 Debit Notes,其篩選條件如下:

  • SoA? = 勾選
  • Received ≠ 勾選
  • Included in Statement = 勾選

此 View 的用途為:

  • 明確區分「尚未列帳」與「已列帳」的 Debit Notes
  • 作為帳務追蹤與查核依據
  • 避免已列帳資料再次出現在可選清單中

Included in Statement 欄位本身不由人工操作,
而是透過 Automation 依據 Statement No. 是否存在自動維護,
確保帳務狀態與資料關聯的一致性。


設計補充說明

這兩個 View 的存在,目的在於:

  • 「可操作資料」與「已處理資料」明確分離
  • 降低 Interface 中誤選、重選、重複請款的風險
  • 讓 SoA 流程可以在不依賴人工判斷的情況下穩定運作

因此,這兩個 View 為 SoA 功能在 Interface 中正常運作的必要結構,而非單純的顯示用 View。


3. Statement of Account(SoA)

新增獨立的 Statement 表,用於承載「彙總請款」本身,而非取代 Debit Note。

主要欄位包含:

  • Statement Date

    • 該份對帳單成立日期(由使用者明確指定)
  • Billing Month

    • 本份 Statement 所對應的請款月份
    • 作為彙整與選擇 Debit Note 的依據
  • Period Start / Period End(Formula)

    • 依 Billing Month 與 Closing Term 計算實際帳期範圍
    • 明確定義「這張 Statement 涵蓋哪些日期」
  • Debit Notes(Link to Debit Note)

    • 手動選入、經系統篩選後的費用明細

資料關聯架構

Partner (CRM)
└─ Closing Date ──┐

Debit Notes (FIN) │
├─ Bill to ───────┘ (Link to Partner)
├─ Closing Date (同步自 Partner)
├─ Billing Month (依 Invoice Date + Closing Date 計算)
├─ SoA? (使用者標記)
├─ Statement No. (Link to Statement)
└─ Included in Statement (自動更新)

Statement of Account (FIN)
├─ Bill to (Link to Partner)
├─ Billing Month
├─ Period Start / Period End (Formula)
└─ Debit Notes (Link to Debit Note)

此架構確保:

  • Partner 主資料單一來源(CRM)
  • Debit Note 與 Statement 的明確關聯
  • 帳期計算的一致性
  • 防呆機制的有效性