PCE 銷項欄位對照 — MIG 4.1 中介文字檔
狀態:SDF 已建;部分 MIG 欄位已自銷項主檔移除(見 §7)
來源:docs/reference/電子發票B2BB2C中介文字檔MIG4.1說明.pdf(汎宇 MIG 4.1,2025/02/19)
範圍:發票表頭/表身、折讓單表頭/表身 →
文件日期:2026-09-13
來源:docs/reference/電子發票B2BB2C中介文字檔MIG4.1說明.pdf(汎宇 MIG 4.1,2025/02/19)
範圍:發票表頭/表身、折讓單表頭/表身 →
customrecord_pce_ar_invoice+customrecord_pce_ar_invoice_line 文件日期:2026-09-13
1. 設計原則
- 完整對齊:主檔/子明細欄位以 MIG 表頭/表身為準(§9.1);之後再刪減。
- 單一銷項主檔:發票與折讓共用
customrecord_pce_ar_invoice,以custrecord_pce_ar_doc_kind區分(invoice/allowance)。 - 單一商品子明細:共用
customrecord_pce_ar_invoice_line;折讓專屬欄位(原發票號等)僅在折讓時必填。 - 中介匯出欄:
資料代碼(I/ID/A/AD)、MIG訊息編號於匯出/上傳時組裝;主檔仍保留供追蹤。 - PCE 擴充:子公司、Customer、來源交易、發票本、Feature flag 等不在 MIG 列者,標為 PCE。
- 必要欄位:表內 M/O 以 MIG「開立」為準;作廢/註銷另見各節備註。
分隔符號與檔案格式(@|@|、UTF-8、INVTEXT_…)屬匯出層,不進 Custom Record。同一 INVTEXT 檔只含一筆主檔、且僅能含同一賣方統編。見 ar-phase3.md §7.4。
2. 銷項主檔 customrecord_pce_ar_invoice
對應 MIG:發票表頭(I)+折讓單表頭(A)。
2.1 PCE/系統欄位
| 建議 scriptid | 顯示名 | 型別 | 必要 | 說明 |
|---|---|---|---|---|
custrecord_pce_ar_doc_kind | 憑證種類 | List | M | invoice=發票;allowance=折讓單 |
custrecord_pce_ar_doc_format_code | 格式代號 | List/Record | M | 關聯 customrecord_pce_doc_format_code,過濾進銷項別=銷項;電子發票選 35-銷項一般稅額計算之電子發票 |
custrecord_pce_ar_subsidiary | 子公司 | List/Record | M | 對應 PCE 營業人;賣方帶入用(§9.3) |
custrecord_pce_ar_customer | 客戶 | List/Record | M | 買方 custentity_pce_cust_* 來源(§9.4) |
custrecord_pce_ar_transaction | 來源交易 | List/Record | O | 開立 Suitelet 帶入;非 AP 式交易 1:N 子列表 |
custrecord_pce_ar_status | 狀態 | List | M | customlist_pce_ar_status:草稿/已開立/已作廢/已註銷。Suitelet 開立成功寫 已開立(非草稿) |
custrecord_pce_ar_upload_status | 上傳狀態 | List | M | 開立時:vacUpload=上傳 → 待上傳;否則 → 不上傳。作廢前須 上傳成功 或 不上傳;作廢後若原為 不上傳 則維持,否則 → 待上傳 |
custrecord_pce_ar_upload_error_msg | 上傳錯誤訊息 | Long Text | O | 上傳失敗說明;開立成功時清空 |
name | 名稱 | String | — | NS 標準;建議=發票號碼或折讓單號 |
\*開立銷項發票且需字軌時為 M。格式 36 由系統產生 SEUI+時間戳 10 碼(共 14 字,亦作為 Name);35+加值中心上傳由系統配號;其餘紙本/35 不上傳為手填必填。詳見藍圖 §9.5。
2.2 共用:賣方/買方(發票+折讓)
| MIG# | 中文名稱 | 建議 scriptid | 型態/長度 | 開立 | 適用 | 備註 |
|---|---|---|---|---|---|---|
| I6/A5 | 賣方統編 | custrecord_pce_ar_seller_tax_id | Text 8 | M | 共 | 由營業人帶入,不可覆寫(§9.3) |
| I7/A6 | 賣方名稱 | custrecord_pce_ar_seller_name | Text 60 | M | 共 | 同上 |
| I8/A7 | 賣方地址 | custrecord_pce_ar_seller_addr | Text 100 | M | 共 | |
| I10/A9 | 賣方電話 | custrecord_pce_ar_seller_phone | Text 26 | O | 共 | |
| I12/A11 | 賣方 Email | custrecord_pce_ar_seller_email | Text 400† | O | 共 | †折讓 MIG 寫 80;主檔採較長 400 |
| I15/A14 | 買方統編 | custrecord_pce_ar_buyer_tax_id | Text 10 | M | 共 | B2C=0000000000(§9.4);折讓須與原發票一致 |
| I16/A15 | 買方名稱 | custrecord_pce_ar_buyer_name | Text 60 | M | 共 | B2C 個人識別碼規則見 MIG |
| I17/A16 | 買方地址 | custrecord_pce_ar_buyer_addr | Text 100 | O | 共 | |
| I19/A18 | 買方電話 | custrecord_pce_ar_buyer_phone | Text 26 | O | 共 | |
| I21/A20 | 買方 Email | custrecord_pce_ar_buyer_email | Text 400 | O | 共 |
2.3 發票專屬(doc_kind=invoice)
| MIG# | 中文名稱 | 建議 scriptid | 型態/長度 | 開立 | 作廢/註銷 | 備註 |
|---|---|---|---|---|---|---|
| I1 | 資料代碼 | (匯出) | — | M | M | 固定 I |
| I2 | MIG訊息編號 | custrecord_pce_ar_mig_msg | Text 5 | M | M | 開立 A0101/F0401…;作廢/註銷另碼 |
| I3 | 發票號碼 | custrecord_pce_ar_invoice_no | Text 14 | M* | M | 一般為字軌 2+流水 8。36=SEUI+時間戳 10 碼(共 14 字,亦寫入 Name);35+上傳自動取號;其餘手填。銷項主檔不連發票本 |
| I4 | 發票日期 | custrecord_pce_ar_doc_date | Date | M | M | MIG:YYYYMMDD |
| I5 | 發票時間 | custrecord_pce_ar_doc_time | Text 8 | M | — | HH:MM:SS |
| I26 | 總備註 | custrecord_pce_ar_main_remark | Long Text | O | — | MIG 長度 200 字元 |
| I27 | 通關方式註記 | custrecord_pce_ar_customs_mark | Text 1 | O* | — | 零稅率時必填;1/2 |
| I29 | 相關號碼 | custrecord_pce_ar_relate_number | Text 20 | O | — | |
| I30 | 發票類別 | custrecord_pce_ar_einvoice_type | Text 2 | M | — | 07/08;一般稅額電子發票對應格式代碼 35(見藍圖 §7.1) |
| I32 | 捐贈註記 | custrecord_pce_ar_donate_mark | Text 1 | M | — | 0/1 |
| I34 | 載具類別號碼 | custrecord_pce_ar_carrier_type | Text 6 | O | — | 如 3J0002 |
| I35 | 載具顯碼 id | custrecord_pce_ar_carrier_id1 | Text 400 | O | — | PrintMark=Y 須空白 |
| I36 | 載具隱碼 id | custrecord_pce_ar_carrier_id2 | Text 400 | O | — | 同上 |
| I37 | 紙本電子發票已列印註記 | custrecord_pce_ar_print_mark | Text 1 | O* | — | Y/N;C0401 必填 |
| I38 | 發票捐贈對象 | custrecord_pce_ar_donate_to | Text 10 | O* | — | 捐贈=1 時必填 |
| I39 | 發票防偽隨機碼 | custrecord_pce_ar_random_number | Text 4 | O* | — | C0401 必填 |
| I40/A25 | 應稅銷售額合計/折讓未稅合計 | custrecord_pce_ar_sales_amt_taxable | Integer | M | — | 發票:非應稅填 0;折讓:A25 金額(不含稅)合計 |
| I41 | 免稅銷售額合計 | custrecord_pce_ar_sales_amt_free | Integer | M | — | |
| I42 | 零稅率銷售額合計 | custrecord_pce_ar_sales_amt_zero | Integer | M | — | |
| I43 | 課稅別 | custrecord_pce_ar_tax_type | Text/List 1 | M | — | 1/2/3/9 |
| I44 | 稅率 | custrecord_pce_ar_tax_rate | Decimal | M | — | 例 0.05 |
| I45 | 營業稅額 | custrecord_pce_ar_tax_amount | Integer | M | — | B2C 消費者可為 0 |
| I46 | 總計 | custrecord_pce_ar_total_amount | Integer | M | — | |
| I48 | 原幣金額 | custrecord_pce_ar_fc_amount | Currency | O | — | |
| I49 | 匯率 | custrecord_pce_ar_exchange_rate | Decimal | O | — | |
| I50 | 幣別 | custrecord_pce_ar_currency | Text 3 | O | — | TWD 可不填;人民幣=CNY |
| I51 | 作廢、註銷日期 | custrecord_pce_ar_void_date | Date | — | M | |
| I52 | 作廢、註銷時間 | custrecord_pce_ar_void_time | Text 8 | — | M | |
| I53 | 作廢、註銷原因 | custrecord_pce_ar_void_reason | Text 20 | — | M | |
| — | 作廢換開 | custrecord_pce_ar_void_reissue | Check Box | — | O | 非 MIG。作廢換開時勾選。ACK 只更新主檔,不回寫來源交易 |
| I56 | 零稅率原因 | custrecord_pce_ar_zero_tax_reason | Text 2 | O* | — | 課稅別=2 必填;71–79 |
2.4 折讓專屬(doc_kind=allowance)
| MIG# | 中文名稱 | 建議 scriptid | 型態/長度 | 開立 | 作廢 | 備註 |
|---|---|---|---|---|---|---|
| A1 | 資料代碼 | (匯出) | — | M | M | 固定 A |
| A2 | MIG訊息編號 | custrecord_pce_ar_mig_msg | Text 5 | M | M | 開立 B0101/B0401…;與發票共用欄 |
| A3 | 折讓證明單號碼 | custrecord_pce_ar_allowance_no | Text 16 | M | M | 跨年不可重複 |
| A4 | 折讓證明單日期 | custrecord_pce_ar_doc_date | Date | M | M | 與發票共用「憑證日期」欄 |
| A23 | 折讓種類 | custrecord_pce_ar_allowance_type | Text 1 | M | M | 固定 2(賣方折讓證明單通知) |
| A24 | 營業稅額合計 | custrecord_pce_ar_tax_amount | Integer | M | — | 與發票共用稅額欄 |
| A26 | 作廢日期 | custrecord_pce_ar_void_date | Date | — | M | 共用作廢欄 |
| A27 | 作廢時間 | custrecord_pce_ar_void_time | Text 8 | — | M | |
| A28 | 作廢原因 | custrecord_pce_ar_void_reason | Text 20 | — | M |
折讓無發票之載具/捐贈/隨機碼/三類銷售額等欄;UI 依 doc_kind 顯示。
3. 商品子明細 customrecord_pce_ar_invoice_line
對應 MIG:發票表身(ID)+折讓單表身(AD)。Parent:custrecord_pce_ar_line_parent → 銷項主檔。
| MIG# | 中文名稱 | 建議 scriptid | 型態/長度 | 發票開立 | 折讓開立 | 備註 |
|---|---|---|---|---|---|---|
| — | Parent | custrecord_pce_ar_line_parent | List/Record | M | M | PCE |
| ID1/AD1 | 資料代碼 | (匯出) | — | M | M | ID/AD |
| ID2/AD2 | 明細排列序號 | custrecord_pce_ar_line_seq | Text 4 | M | M | 建議補零,如 0001 |
| AD3 | 原發票日期 | custrecord_pce_ar_line_orig_inv_date | Date | — | M | 僅折讓 |
| AD4 | 原發票號碼 | custrecord_pce_ar_line_orig_inv_no | Text 10 | — | M | 僅折讓 |
| ID3/AD6 | 品名/原品名 | custrecord_pce_ar_line_description | Text 500 | M | M | |
| ID4/AD7 | 數量 | custrecord_pce_ar_line_qty | Decimal 14,6 | M | M | 可負數 |
| ID5/AD8 | 單位 | custrecord_pce_ar_line_unit | Text 6 | O | O | |
| ID6/AD9 | 單價 | custrecord_pce_ar_line_unit_price | Decimal 21,6† | M | M | †折讓 MIG 為 21,7;採 21,6 或對齊較嚴;折讓=不含稅 |
| ID7 | 金額 | custrecord_pce_ar_line_amount | Decimal 21,6 | M | — | 發票表身 |
| AD10 | 金額(不含稅之進貨額) | custrecord_pce_ar_line_amount | Decimal 21,7 | — | M | 與上列共用;折讓語意=未稅 |
| AD11 | 營業稅額 | custrecord_pce_ar_line_tax_amount | Currency | — | M | 僅折讓;金額×稅率四捨五入 |
| ID8 | 單一欄位備註 | custrecord_pce_ar_line_remark | Text 120 | O | — | 發票 |
| ID9 | 相關號碼 | custrecord_pce_ar_line_relate_no | Text 50 | O | — | 參考用 |
| ID10/AD12 | 課稅別 | custrecord_pce_ar_line_tax_type | Text 1 | O* | M | 主檔混合稅時發票明細必填且不可為 9 |
可選 PCE 擴充(非 MIG):custrecord_pce_ar_line_item(NS Item)、來源交易列號。
4. 發票本(獨立主檔,非 MIG 正文)
customrecord_pce_ar_invoice_book 已建;開立取配號見藍圖 §9.5。與 MIG 分支機構配號概念對照:
| 概念 | MIG(R) | 實作欄位 |
|---|---|---|
| 統編 | HeadBan | custrecord_pce_ar_book_tax_id(綁營業人) |
| 格式/發票類別 | InvoiceType 等 | custrecord_pce_ar_book_doc_format、custrecord_pce_ar_book_inv_cat_code |
| 期別 | YearMonth | custrecord_pce_ar_book_period(民國雙月) |
| 字軌 | InvoiceTrack | custrecord_pce_ar_book_track |
| 起迄號 | Begin/End | custrecord_pce_ar_book_begin_no/custrecord_pce_ar_book_end_no |
| 最後取用號 | — | custrecord_pce_ar_book_last_no(下一號=last+1;空白則從起號) |
| 最新取號日 | — | custrecord_pce_ar_book_last_issue_dt |
| 狀態 | — | custrecord_pce_ar_book_status(0/1/2/9) |
| 配號 | — | 部門/類別/custrecord_pce_ar_book_profile |
5. 與 §9 決策對照
| 決策 | 本表體現 |
|---|---|
| 9-1 完整對齊 | 表頭/表身欄位全列;未刪減 |
| 9-2 A | 主檔+customrecord_pce_ar_invoice_line |
| 9-3 賣方 | seller_* 由子公司↔營業人帶入,不可覆寫 |
| 9-4 買方 | buyer_* 自 Customer;B2C 統編 10 個 0 |
| 9-5 字軌 | invoice_no 依格式:36 空白;35+上傳自動取最小 id 本;其餘手填反查。主檔不連發票本 |
| 9-6 同 SuiteApp | 物件命名 pce_ar_* |
6. 後續
- Phase 3:零稅率開立(通關方式 I27、零稅率原因 I56)已實作:課稅別=2 時必填,寫入主檔並帶入上傳 TXT。出口報單類別(代碼對照下拉)、出口報單號碼、輸出或結匯日期、證明文件名稱、證明文件號碼為主檔選填,不進上傳 TXT。其餘條件必填(捐贈、PrintMark、混合稅明細)仍待排。
- 發票本配號已實作:
customrecord_pce_ar_invoice_book獨立主檔;銷項主檔不連結發票本欄位。規則見藍圖 §9.5、使用說明 §5.5。 - MIG 4.1 備註已寫入 SDF 欄位
<help>(UI 說明;MIG 欄位以MIG …。開頭,第二行 長度/格式、第三行 發票開立/折讓開立/作廢註銷 必填選填(含「不適用」、條件必填),第四行起為業務說明;非 MIG 欄位第二行寫 必填/選填,不加PCE。前綴);List/Record 型別另加Source from …。;<description>保留 PCE 內部摘要。表單custform_pce_ar_invoice:基本資訊含 Date Created、Last Modified;已折讓群組為已折讓未稅/稅額/總計與可折餘額;作廢/註銷含作廢換開。
7. 已自銷項主檔移除的 MIG 欄位
以下欄位已自 customrecord_pce_ar_invoice SDF 刪除(匯出時若仍需要可於匯出層組裝或留空):
custrecord_pce_ar_invoice_book(發票本連結;發票本改為獨立主檔)custrecord_pce_ar_seller_person、custrecord_pce_ar_seller_faxcustrecord_pce_ar_void_approve_no(專案作廢准文號)custrecord_pce_ar_sales_amount(併入custrecord_pce_ar_sales_amt_taxable,對應 MIG A25)custrecord_pce_ar_seller_cust_no、custrecord_pce_ar_seller_rolecustrecord_pce_ar_buyer_person、custrecord_pce_ar_buyer_faxcustrecord_pce_ar_buyer_cust_no、custrecord_pce_ar_buyer_rolecustrecord_pce_ar_reserved、custrecord_pce_ar_buyer_remarkcustrecord_pce_ar_clear_type、custrecord_pce_ar_summary_markcustrecord_pce_ar_zero_tax_buyer、custrecord_pce_ar_remarkcustrecord_pce_ar_orig_seller_ban、custrecord_pce_ar_orig_buyer_ban
8. 上傳結果(ACK,非 MIG 列)
加值中心回覆為 ACK01 XML(MessageNo 對發票號/折讓單號),不寫入 MIG 文字檔列。規格見 ar-phase3.md §8、汎宇ACK回覆檔案說明.pdf;範例 XML 見 docs/samples/vac-sftp/ack/。