forked from chapzin/parse-efd-fiscal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegH005.go
55 lines (48 loc) · 1.31 KB
/
RegH005.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package BlocoH
import (
"github.com/bussoladesenvolvimento/parse-efd-fiscal/Models/Bloco0"
"github.com/bussoladesenvolvimento/parse-efd-fiscal/tools"
"github.com/jinzhu/gorm"
"time"
)
// Estrutura criada usando layout Guia Prático EFD-ICMS/IPI – Versão 2.0.20 Atualização: 07/12/2016
// Estrutura do Registro H005
type RegH005 struct {
gorm.Model
Reg string `gorm:"type:varchar(4)"`
DtInv time.Time `gorm:"type:date"`
VlInv float64 `gorm:"type:decimal(19,2)"`
MotInv string `gorm:"type:varchar(2)"`
DtIni time.Time `gorm:"type:date"`
DtFin time.Time `gorm:"type:date"`
Cnpj string `gorm:"type:varchar(14)"`
}
// Metodo define nome da Tabela no banco
func (RegH005) TableName() string {
return "reg_h005"
}
// Implementando Interface do Sped RegH005
type RegH005Sped struct {
Ln []string
Reg0000 Bloco0.Reg0000
}
type iRegH005 interface {
GetRegH005() RegH005
}
// Metodo que popula o H005 do arquivo de sped
func (s RegH005Sped) GetRegH005() RegH005 {
regH005 := RegH005{
Reg: s.Ln[1],
DtInv: tools.ConvertData(s.Ln[2]),
VlInv: tools.ConvFloat(s.Ln[3]),
MotInv: s.Ln[4],
DtIni: s.Reg0000.DtIni,
DtFin: s.Reg0000.DtFin,
Cnpj: s.Reg0000.Cnpj,
}
return regH005
}
// Metodo que criar a struct
func CreateRegH005(read iRegH005) RegH005 {
return read.GetRegH005()
}