Skip to content

Commit

Permalink
增加一點說明
Browse files Browse the repository at this point in the history
  • Loading branch information
PichuChen committed Mar 2, 2024
1 parent e3ce264 commit d8956e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mig/invoice_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

// Mig 4.0 的圖 5-1, 5-3, 15-1 和 15-3 少放一個 ZeroTaxRateReason, GroupMark

// InvoiceMain represents the main information of an invoice.
type InvoiceMain struct {
InvoiceNumber string `xml:"InvoiceNumber"`
InvoiceDate string `xml:"InvoiceDate"`
Expand All @@ -30,10 +31,12 @@ type InvoiceMain struct {
Reserved2 string `xml:"Reserved2,omitempty"`
}

// A0101InvoiceMain represents the main information of an A0101 invoice.
type A0101InvoiceMain struct {
InvoiceMain
}

// F0401InvoiceMain represents the main information of an F0401 invoice.
type F0401InvoiceMain struct {
InvoiceMain

Expand All @@ -46,6 +49,7 @@ type F0401InvoiceMain struct {
BondedAreaConfirm string `xml:"BondedAreaConfirm,omitempty"`
}

// C0401InvoiceMain represents the main information of a C0401 invoice.
type C0401InvoiceMain struct {
InvoiceMain

Expand All @@ -58,6 +62,7 @@ type C0401InvoiceMain struct {
BondedAreaConfirm string `xml:"BondedAreaConfirm,omitempty"`
}

// Validate checks the validity of the InvoiceMain block.
func (block *InvoiceMain) Validate() error {
if block.InvoiceNumber == "" {
return fmt.Errorf("發票號碼 (InvoiceNumber) 為必填")
Expand Down Expand Up @@ -134,6 +139,7 @@ func (block *InvoiceMain) Validate() error {
return nil
}

// Validate checks the validity of the A0101InvoiceMain block.
func (block *A0101InvoiceMain) Validate() error {
err := block.InvoiceMain.Validate()
if err != nil {
Expand All @@ -142,6 +148,7 @@ func (block *A0101InvoiceMain) Validate() error {
return nil
}

// Validate checks the validity of the F0401InvoiceMain block.
func (block *F0401InvoiceMain) Validate() error {
err := block.InvoiceMain.Validate()
if err != nil {
Expand Down Expand Up @@ -204,6 +211,7 @@ func (block *F0401InvoiceMain) Validate() error {
return nil
}

// Validate checks the validity of the C0401InvoiceMain block.
func (block *C0401InvoiceMain) Validate() error {
err := block.InvoiceMain.Validate()
if err != nil {
Expand Down

0 comments on commit d8956e4

Please sign in to comment.