Documentation
¶
Index ¶
- Constants
- func GetUuid() string
- func InteractiveNewGenericExpenseCategory(arg interface{}) interface{}
- func InteractiveNewGenericParty(arg interface{}) interface{}
- func OpenYamlHashed(data interface{}, path, dataType string) string
- func SaveYamlOnChange(data interface{}, path, dataType, oldHash string)
- func SuggestNextIdentifier(idt []Identifiable, prefix string) string
- type Company
- type Completable
- type Expense
- func (e Expense) AccrualDateTime() time.Time
- func (e Expense) AssistedCompletion(s *Schema, doAll, autoSave, openAttachment, retainFocus bool) Expense
- func (e Expense) Conditions() util.Conditions
- func (e Expense) FileString() string
- func (e Expense) GetDate() *time.Time
- func (e Expense) GetId() string
- func (e Expense) GetIdentifier() string
- func (e Expense) Match(from *time.Time, to *time.Time, identifier string) (bool, error)
- func (e *Expense) Repopulate(s Schema)
- func (e Expense) SearchItem() util.SearchItem
- func (e *Expense) SetId()
- func (e Expense) Short() string
- func (e Expense) String() string
- func (e Expense) Type() string
- type ExpenseCategories
- func (e ExpenseCategories) CategoryByName(name string) (*ExpenseCategory, error)
- func (e ExpenseCategories) Conditions() util.Conditions
- func (e ExpenseCategories) SearchItems() util.SearchItems
- func (e ExpenseCategories) String() string
- func (e ExpenseCategories) Type() string
- func (e ExpenseCategories) Validate() util.ValidateResults
- type ExpenseCategory
- type Expenses
- func (e Expenses) AssistedCompletion(s *Schema, doAll, autoSave, openAttachment, retainFocus bool)
- func (e Expenses) ExpenseById(id string) (*Expense, error)
- func (e Expenses) ExpenseByIdent(ident string) (*Expense, error)
- func (e Expenses) Filter(from *time.Time, to *time.Time, identifier string) (Expenses, error)
- func (e Expenses) GetIdentifiables() []Identifiable
- func (e Expenses) Len() int
- func (e Expenses) Less(i, j int) bool
- func (e Expenses) Repopulate(s Schema)
- func (e Expenses) Save(s *Schema, path string)
- func (e Expenses) SearchItems() util.SearchItems
- func (e Expenses) SetId()
- func (e Expenses) SortByYear() map[int]Expenses
- func (e Expenses) Swap(i, j int)
- func (e Expenses) Validate() util.ValidateResults
- type Identifiable
- type Invoice
- func (i Invoice) AssistedCompletion(s Schema, doAll, openAttachment, retainFocus bool) Invoice
- func (i Invoice) Conditions() util.Conditions
- func (i Invoice) FileString() string
- func (i Invoice) GetDate() *time.Time
- func (i Invoice) GetId() string
- func (i Invoice) GetIdentifier() string
- func (i *Invoice) Repopulate(s Schema)
- func (i Invoice) SearchItem(s Schema) util.SearchItem
- func (i Invoice) SendDateTime() time.Time
- func (i *Invoice) SetId()
- func (i Invoice) Short() string
- func (i Invoice) String() string
- func (i Invoice) Type() string
- type Invoices
- func (i Invoices) AssistedCompletion(s Schema, doAll, autoSave, openAttachment, retainFocus bool)
- func (i Invoices) Filter(from *time.Time, to *time.Time) (Invoices, error)
- func (i Invoices) GetIdentifiables() []Identifiable
- func (i Invoices) InvoiceById(id string) (*Invoice, error)
- func (i Invoices) InvoiceByIdent(ident string) (*Invoice, error)
- func (i Invoices) Len() int
- func (i Invoices) Less(j, k int) bool
- func (i Invoices) Repopulate(s Schema)
- func (i *Invoices) Save(path string)
- func (i Invoices) SearchItems(s Schema) util.SearchItems
- func (i Invoices) SetId()
- func (i Invoices) Swap(j, k int)
- func (i Invoices) Validate() util.ValidateResults
- type JournalConfig
- type JournalMode
- type MiscRecord
- func (m MiscRecord) Conditions() util.Conditions
- func (m MiscRecord) FileString() string
- func (m MiscRecord) GetDate() *time.Time
- func (m MiscRecord) GetId() string
- func (m MiscRecord) GetIdentifier() string
- func (m *MiscRecord) Repopulate(s Schema)
- func (m MiscRecord) SearchItem() util.SearchItem
- func (m *MiscRecord) SetId()
- func (m MiscRecord) Short() string
- func (m MiscRecord) String() string
- func (m MiscRecord) Type() string
- type MiscRecords
- func (m MiscRecords) GetIdentifiables() []Identifiable
- func (m MiscRecords) MiscRecordById(id string) (*MiscRecord, error)
- func (m MiscRecords) MiscRecordByIdent(ident string) (*MiscRecord, error)
- func (m MiscRecords) Repopulate(s Schema)
- func (m MiscRecords) Save(path string)
- func (m MiscRecords) SearchItems() util.SearchItems
- func (m MiscRecords) Validate() util.ValidateResults
- type Parties
- func (p Parties) CustomerById(id string) (*Party, error)
- func (p Parties) CustomerByIdent(ident string) (*Party, error)
- func (p Parties) CustomerByIdentifier(ident string) (*Party, error)
- func (p Parties) CustomerStringById(id string) string
- func (p Parties) CustomersSearchItems() util.SearchItems
- func (p Parties) EmployeeById(id string) (*Party, error)
- func (p Parties) EmployeeByIdent(ident string) (*Party, error)
- func (p Parties) EmployeeByIdentifier(ident string) (*Party, error)
- func (p Parties) EmployeeStringById(id string) string
- func (p Parties) EmployeesSearchItems() util.SearchItems
- func (p Parties) GetCustomerIdentifiables() []Identifiable
- func (p Parties) GetEmployeeIdentifiables() []Identifiable
- func (p Parties) Save(path string)
- func (p Parties) SetId()
- func (p Parties) Validate() util.ValidateResults
- type Party
- func (p Party) AddressLines() string
- func (p Party) Conditions() util.Conditions
- func (p Party) GetId() string
- func (p Party) GetIdentifier() string
- func (p Party) SearchItem(typ string) util.SearchItem
- func (p *Party) SetId()
- func (p Party) Short() string
- func (p Party) String() string
- func (p Party) Type() string
- type PartyType
- type Project
- type Projects
- func (p Projects) GetIdentifiables() []Identifiable
- func (p Projects) ProjectById(id string) (*Project, error)
- func (p Projects) ProjectByIdent(ident string) (*Project, error)
- func (p Projects) Save(path string)
- func (p Projects) SearchItems() util.SearchItems
- func (p Projects) Validate() util.ValidateResults
- type Schema
- type Statement
- func (t *Statement) AddTransaction(trn []Transaction)
- func (t *Statement) AssistedCompletion(s Schema, doAll, autoSave, autoMode, askSkip, documentsOnly bool)
- func (t Statement) Conditions() util.Conditions
- func (t Statement) FilterTransactions(from *time.Time, to *time.Time) ([]Transaction, error)
- func (t Statement) GetIdentifiables() []Identifiable
- func (t Statement) Save(path string)
- func (t Statement) SetId()
- func (t Statement) String() string
- func (t Statement) TransactionById(id string) (*Transaction, error)
- func (t Statement) TransactionForDocument(id string) (*Transaction, error)
- func (t Statement) TransactionSearchItems() util.SearchItems
- func (t Statement) Type() string
- func (t Statement) Validate() util.ValidateResults
- type Transaction
- func (t Transaction) AssistedCompletion(s Schema, doAll, autoMode, askSkip, documentsOnly bool) Transaction
- func (t Transaction) Conditions() util.Conditions
- func (t Transaction) DateTime() time.Time
- func (t Transaction) GetDate() *time.Time
- func (t Transaction) GetId() string
- func (t Transaction) GetIdentifier() string
- func (t Transaction) SearchItem() util.SearchItem
- func (t *Transaction) SetId()
- func (t Transaction) Short() string
- func (t Transaction) String() string
- func (Transaction) Type() string
- func (t Transaction) Validate() util.ValidateResults
Constants ¶
const DefaultCustomerPrefix = "c-"
const DefaultEmployeePrefix = "y-"
const DefaultExpensePrefix = "e-"
const DefaultExpensesFile = "expenses.yaml"
const DefaultInvoicesFile = "invoices.yaml"
const DefaultInvoicesPrefix = "i-"
const DefaultMiscRecordPrefix = "m-"
const DefaultMiscRecordsFile = "misc.yaml"
const DefaultPartiesFile = "parties.yaml"
const DefaultProjectPrefix = "p-"
const DefaultProjectsFile = "projects.yaml"
const DefaultStatementFile = "bank-statement.yaml"
const DefaultTransactionPrefix = "t-"
Variables ¶
This section is empty.
Functions ¶
func InteractiveNewGenericExpenseCategory ¶
func InteractiveNewGenericExpenseCategory(arg interface{}) interface{}
func InteractiveNewGenericParty ¶
func InteractiveNewGenericParty(arg interface{}) interface{}
func OpenYamlHashed ¶
OpenYaml does the same as util.OpenYaml but returns the hash of the file.
func SaveYamlOnChange ¶
func SaveYamlOnChange(data interface{}, path, dataType, oldHash string)
func SuggestNextIdentifier ¶
func SuggestNextIdentifier(idt []Identifiable, prefix string) string
Types ¶
type Company ¶
type Company struct { Name string `yaml:"name" default:"Fortuna Inc."` Street string `yaml:"street" default:"Main Street"` StreetNr int `yaml:"streetNr" default:"1"` PostalCode int `yaml:"postalCode" default:"8000"` Place string `yaml:"place" default:"Zurich"` Phone string `yaml:"phone" default:"+41 78 000 00 00"` Mail string `yaml:"mail" default:"info@fortuna.com"` Url string `yaml:"url" default:"https://fortuna.com"` Logo string `yaml:"logo" default:"/path/to/logo.png"` }
func InteractiveNewCompany ¶
func NewCompany ¶
func (Company) Conditions ¶
func (c Company) Conditions() util.Conditions
type Completable ¶
type Completable interface {
// SetId sets a unique id (UUID-4) for the object.
SetId()
}
Completable describes types which automatically can resolve some missing information atomically. Example is the setting of a unique Id.
type Expense ¶
type Expense struct { // Id is the internal unique identifier of the Expense. Id string `yaml:"id" default:"1"` // Value is a unique user chosen identifier, has to be the same in all source files (bank statements, bimpf dumps...). Identifier string `yaml:"identifier" default:"e-19-1"` // Name describes meaningful the kind of the Expense. Name string `yaml:"name" default:"Expense Name"` // Amount states the amount of the Expense. Amount util.Money `yaml:"amount" default:"" query:"amount"` // Path is the full path to the business record document. Path string `yaml:"path" default:"/path/to/expense.pdf" query:"path"` // DateOfAccrual represents the day the obligation emerged. DateOfAccrual string `yaml:"dateOfAccrual" default:"2019-12-20"` // Billable states if the costs for the Expense will be forwarded to the customer. Billable bool `yaml:"billable" default:"false"` // ObligedCustomerId refers to the customer which have to pay the Expense. ObligedCustomerId string `yaml:"obligedCustomerId" default:"" query:"customer"` // AdvancedByThirdParty states if a third party (employee, etc.) advanced the payment of this expense for the company. AdvancedByThirdParty bool `yaml:"advancedByThirdParty" default:"false"` // AdvancePartyId refers to the third party which advanced the payment. AdvancedThirdPartyId string `yaml:"advancedThirdPartyId" default:"" query:"emplyee"` // DateOfSettlement states the date of the settlement of the expense (the company has not to take further actions). DateOfSettlement string `yaml:"dateOfSettlement" default:"2019-12-25"` // SettlementTransactionId refers to a possible bank transaction which settled the Expense for the company. SettlementTransactionId string `yaml:"settlementTransactionId" default:"" query:"transaction"` // ExpenseCategory gives additional info for the categorization of the expense in the journal. ExpenseCategory string `yaml:"expenseCategory" default:""` // Debit Payment states whether the expense was directly paid with the main account debithether the expense was directly paid with the main account debit card. PaidWithDebit bool `yaml:"paidWithDebit" default:"false"` // Internal states whether this expense is for an internal purpose or not. Internal bool `yaml:"internal" default:"true"` // ProjectName refers to the associated project of the expense. Depreciated. ProjectName string `yaml:"projectName" default:""` // ProjectId refers to the associated project. ProjectId string `yaml:"projectId" default:""` }
Expense represents a payment done by the company or a third party to assure the ongoing of the business.
func InteractiveNewExpense ¶
InteractiveNewExpense returns a new Expense based on the user input.
func NewExpense ¶
func NewExpense() Expense
NewExpense returns a new Expense element with the default values.
func NewExpenseWithUuid ¶
func NewExpenseWithUuid() Expense
func (Expense) AccrualDateTime ¶
func (Expense) AssistedCompletion ¶
func (Expense) Conditions ¶
func (e Expense) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Expense) FileString ¶
FileString returns the file name for exporting the expense as a document.
func (Expense) GetIdentifier ¶
func (*Expense) Repopulate ¶
func (Expense) SearchItem ¶
func (e Expense) SearchItem() util.SearchItem
func (*Expense) SetId ¶
func (e *Expense) SetId()
SetId generates a unique id for the element if there isn't already one defined.
type ExpenseCategories ¶
type ExpenseCategories []ExpenseCategory
func InteractiveNewExpenseCategories ¶
func InteractiveNewExpenseCategories(multiple bool) ExpenseCategories
func (ExpenseCategories) CategoryByName ¶
func (e ExpenseCategories) CategoryByName(name string) (*ExpenseCategory, error)
func (ExpenseCategories) Conditions ¶
func (e ExpenseCategories) Conditions() util.Conditions
func (ExpenseCategories) SearchItems ¶
func (e ExpenseCategories) SearchItems() util.SearchItems
func (ExpenseCategories) String ¶
func (e ExpenseCategories) String() string
func (ExpenseCategories) Type ¶
func (e ExpenseCategories) Type() string
func (ExpenseCategories) Validate ¶
func (e ExpenseCategories) Validate() util.ValidateResults
type ExpenseCategory ¶
type ExpenseCategory struct { Name string `yaml:"name" default:"Material Costs"` Account string `yaml:"account" default:"expenses:Betrieblicher Aufwand:Materialaufwand"` }
func InteractiveNewExpenseCategory ¶
func InteractiveNewExpenseCategory() ExpenseCategory
func NewExpenseCategory ¶
func NewExpenseCategory() ExpenseCategory
func (ExpenseCategory) Conditions ¶
func (e ExpenseCategory) Conditions() util.Conditions
func (ExpenseCategory) SearchItem ¶
func (e ExpenseCategory) SearchItem() util.SearchItem
func (ExpenseCategory) String ¶
func (e ExpenseCategory) String() string
func (ExpenseCategory) Type ¶
func (e ExpenseCategory) Type() string
type Expenses ¶
type Expenses []Expense
Expenses is a slice of multiple expenses.
func NewExpenses ¶
NewExpenses returns a new Expense slice with the one Expense in it.
func OpenExpenses ¶
OpenExpenses opens a Expenses saved in the YAML file given by the path.
func (Expenses) AssistedCompletion ¶
func (Expenses) GetIdentifiables ¶
func (e Expenses) GetIdentifiables() []Identifiable
func (Expenses) Repopulate ¶
func (Expenses) Save ¶
Save writes the element as a YAML to the given path. If s is not nil, the id fields will be commented with the linked element.
func (Expenses) SearchItems ¶
func (e Expenses) SearchItems() util.SearchItems
func (Expenses) SetId ¶
func (e Expenses) SetId()
SetId sets a unique id to all elements in the slice.
func (Expenses) SortByYear ¶
SortByYear returns a map with the given elements sorted by year.
func (Expenses) Validate ¶
func (e Expenses) Validate() util.ValidateResults
type Identifiable ¶
Identifiable describes types which are uniquely identifiable trough out the utils structure.
type Invoice ¶
type Invoice struct { // Id is the internal unique identifier of the Expense. Id string `yaml:"id" default:"1"` // Value is a unique user chosen identifier, has to be the same in all source files (bank statements, bimpf dumps...). Identifier string `yaml:"identifier" default:"i-19-1"` // Name describes meaningful the kind of the Expense. Name string `yaml:"name" default:"Expense Name"` // Amount states the amount of the Expense. Amount util.Money `yaml:"amount" default:"-" query:"amount"` // Path is the full path to the voucher utils. Path string `yaml:"path" default:"/path/to/file.utils" query:"path"` // Revoked invoices are disabled an no longer taken into account. Revoked bool `yaml:"revoked" default:"false"` // CustomerId refers to the customer the invoice was sent to. CustomerId string `yaml:"customerId" default:"" query:"customer"` // SendDate states the date, the invoice was sent to the customer. SendDate string `yaml:"sendDate" default:"2019-12-20"` // DateOfSettlement states the date the customer paid the outstanding amount. DateOfSettlement string `yaml:"dateOfSettlement" default:"2019-12-25"` // SettlementTransactionId refers to a possible bank transaction which settled the Expense for the company. SettlementTransactionId string `yaml:"settlementTransactionId" default:"" query:"transaction"` // ProjectName refers to the associated project of the expense. Depreciated. ProjectName string `yaml:"projectName" default:""` // ProjectId refers to the associated project. ProjectId string `yaml:"projectId" default:""` }
Invoice represents an invoice sent to a customer for some services.
func InteractiveNewInvoice ¶
func NewInvoice ¶
func NewInvoice() Invoice
NewInvoice returns a new Acc element with the default values.
func NewInvoiceWithUuid ¶
func NewInvoiceWithUuid() Invoice
func (Invoice) AssistedCompletion ¶
func (Invoice) Conditions ¶
func (i Invoice) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Invoice) FileString ¶
func (Invoice) GetIdentifier ¶
func (*Invoice) Repopulate ¶
func (Invoice) SearchItem ¶
func (i Invoice) SearchItem(s Schema) util.SearchItem
func (Invoice) SendDateTime ¶
func (*Invoice) SetId ¶
func (i *Invoice) SetId()
SetId generates a unique id for the element if there isn't already one defined.
type Invoices ¶
type Invoices []Invoice
Invoices is a slice of invoices.
func NewInvoices ¶
NewInvoices returns a new Expense slice with the one Expense in it.
func OpenInvoices ¶
OpenInvoices opens a Expenses saved in the json file given by the path.
func (Invoices) AssistedCompletion ¶
func (Invoices) GetIdentifiables ¶
func (i Invoices) GetIdentifiables() []Identifiable
func (Invoices) Repopulate ¶
func (*Invoices) Save ¶
Save writes the element as a json to the given path. Indented states whether «prettify» the json output.
func (Invoices) SearchItems ¶
func (i Invoices) SearchItems(s Schema) util.SearchItems
func (Invoices) SetId ¶
func (i Invoices) SetId()
SetId sets a unique id to all elements in the slice.
func (Invoices) Validate ¶
func (i Invoices) Validate() util.ValidateResults
type JournalConfig ¶
type JournalConfig struct { Currency string `yaml:"currency" default:"SFr."` BankAccount string `yaml:"bankAccount" default:"assets:Umlaufvermögen:Flüssige Mittel:Raiffeisenbank Bern"` ReceivableAccount string `yaml:"receivableAccount" default:"assets:Umlaufvermögen:Debitoren"` RevenueAccount string `yaml:"revenueAccount" default:"revenues:Betrieblicher Ertrag:Dienstleistungserlös"` PayableAccount string `yaml:"payableAccount" default:"liabilities:Kurzfristiges Fremdkapital:Kreditoren"` EmployeeLiabilitiesAccount string `` /* 129-byte string literal not displayed */ InvoicingTransactionDescription string `yaml:"invoicingTransactionDescription" default:"Rechnungsstellung {{ .Identifier }} an {{ .Party }}"` InvoiceSettlementTransactionDescription string `yaml:"invoiceSettlementTransactionDescription" default:"Erhalt Zahlung für die Rechnung {{ .Identifier }} von {{ .Party }}"` ExpenseAdvancedByEmployeeDescription string `` /* 133-byte string literal not displayed */ InternalExpenseOccurenceDescription string `yaml:"internalExpenseOccurenceDescription" default:"Aufwand für {{.Name}} ({{.Identifier}})"` ProductionExpenseOccurenceDescription string `yaml:"productionExpenseOccurenceDescription" default:"Einkauf von {{.Name}} ({{.Identifier}}) für Projekt {{.Project}}"` InternalExpenseTransactionDescription string `yaml:"internalExpenseTransactionDescription" default:"Bezahlung der Rechnung {{.Identifier}}"` AdvancedExpenseSettlementDescription string `yaml:"advancedExpenseSettlementDescription" default:"Rückerstattung der Zahlung von {{.Party}} für {{.Identifier}}"` CompanyPaidExpenseSettlementDescription string `yaml:"companyPaidExpenseSettlementDescription" default:"Bezahlen des Aufwands {{.Identifier}}"` AccountAliases []string `yaml:"accountAliases" default:"[]"` ExpenseCategories ExpenseCategories `yaml:"expenseCategories" default:"[]"` }
func InteractiveNewJournalConfig ¶
func InteractiveNewJournalConfig() JournalConfig
func NewJournalConfig ¶
func NewJournalConfig() JournalConfig
func (JournalConfig) Aliases ¶
func (c JournalConfig) Aliases() [][]string
func (JournalConfig) Conditions ¶
func (c JournalConfig) Conditions() util.Conditions
func (JournalConfig) String ¶
func (c JournalConfig) String() string
func (JournalConfig) Type ¶
func (JournalConfig) Type() string
func (JournalConfig) Validate ¶
func (c JournalConfig) Validate() util.ValidateResults
type JournalMode ¶
type JournalMode int
const ( UnknownJournalMode JournalMode = iota ManualJournalMode AutoJournalMode )
type MiscRecord ¶
type MiscRecord struct { Id string `yaml:"id" default:"1"` Identifier string `yaml:"identifier" default:"m-19-1"` Name string `yaml:"name" default:""` Path string `yaml:"path" default:"/path/to/record.pdf" query:"path"` Date string `yaml:"date" default:"2019-12-20"` TransactionId string `yaml:"settlementTransactionId" default:"" query:"transaction"` }
MiscRecord represents business records which are not invoices or expenses but still important for accounting. Example: A credit note from an insurance.
func InteractiveNewMiscRecord ¶
func InteractiveNewMiscRecord(s Schema, asset string) MiscRecord
InteractiveNewMiscRecord returns a new MiscRecord based on the user input.
func NewMiscRecord ¶
func NewMiscRecord() MiscRecord
NewMiscRecord returns a new MiscRecord element with the default values.
func (MiscRecord) Conditions ¶
func (m MiscRecord) Conditions() util.Conditions
Conditions returns the validation conditions.
func (MiscRecord) FileString ¶
func (m MiscRecord) FileString() string
FileString returns the file name for exporting the misc record as a document.
func (MiscRecord) GetDate ¶
func (m MiscRecord) GetDate() *time.Time
GetDate returns the date of the misc-records as a time.Time struct.
func (MiscRecord) GetId ¶
func (m MiscRecord) GetId() string
GetId returns the id of the MiscRecord.
func (MiscRecord) GetIdentifier ¶
func (m MiscRecord) GetIdentifier() string
GetIdentifier return the identifier of the MiscRecord.
func (*MiscRecord) Repopulate ¶
func (m *MiscRecord) Repopulate(s Schema)
Repopulate MiscRecord based on the transactions.
func (MiscRecord) SearchItem ¶
func (m MiscRecord) SearchItem() util.SearchItem
SearchItem returns a searchable representation of the MiscRecord.
func (*MiscRecord) SetId ¶
func (m *MiscRecord) SetId()
SetId generates a unique id for the element if there isn't already one defined.
func (MiscRecord) Short ¶
func (m MiscRecord) Short() string
Short returns a short representation of the element.
func (MiscRecord) String ¶
func (m MiscRecord) String() string
String returns a human readable representation of the element.
func (MiscRecord) Type ¶
func (m MiscRecord) Type() string
Type returns a string with the type name of the element.
type MiscRecords ¶
type MiscRecords []MiscRecord
MiscRecord is a collection of Miscellaneous Record elements.
func NewMiscRecords ¶
func NewMiscRecords() MiscRecords
NewMiscRecords returns an empty new MiscRecords collection.
func OpenMiscRecords ¶
func OpenMiscRecords(path string) MiscRecords
OpenMiscRecords opens the MiscRecords saved in the YAML file given by the path.
func (MiscRecords) GetIdentifiables ¶
func (m MiscRecords) GetIdentifiables() []Identifiable
GetIdentifiables returns the a sliche of all identifiers. This is used for the identifier suggestion while interactively adding a new MiscRecord.
func (MiscRecords) MiscRecordById ¶
func (m MiscRecords) MiscRecordById(id string) (*MiscRecord, error)
MiscRecordById returns the MiscRecord with the given id. If no record could be found an error will be returned.
func (MiscRecords) MiscRecordByIdent ¶
func (m MiscRecords) MiscRecordByIdent(ident string) (*MiscRecord, error)
MiscRecordByIdent returns the MiscRecord with the given identifier. If no record could be found an error will be returned.
func (MiscRecords) Repopulate ¶
func (m MiscRecords) Repopulate(s Schema)
Repopulate all MiscRecords based on the transactions.
func (MiscRecords) Save ¶
func (m MiscRecords) Save(path string)
Save writes the element as YAML file to the given path.
func (MiscRecords) SearchItems ¶
func (m MiscRecords) SearchItems() util.SearchItems
SearchItems returns a searchable structure of the MiscRecords. So the user can search for MiscRecords in the interactive mode.
func (MiscRecords) Validate ¶
func (m MiscRecords) Validate() util.ValidateResults
Validate all MiscRecords.
type Parties ¶
func NewParties ¶
NewParties returns a new Parties struct with the one Expense in it.
func OpenParties ¶
OpenParties opens a Parties element saved in the json file given by the path.
func (Parties) CustomerByIdentifier ¶
CustomerByIdentifier returns a Customer if there is one with the given identifier. Otherwise an error will be returned.
func (Parties) CustomerStringById ¶
func (Parties) CustomersSearchItems ¶
func (p Parties) CustomersSearchItems() util.SearchItems
func (Parties) EmployeeByIdentifier ¶
EmployeeByIdentifier returns a Employee if there is one with the given identifier. Otherwise an error will be returned.
func (Parties) EmployeeStringById ¶
func (Parties) EmployeesSearchItems ¶
func (p Parties) EmployeesSearchItems() util.SearchItems
func (Parties) GetCustomerIdentifiables ¶
func (p Parties) GetCustomerIdentifiables() []Identifiable
func (Parties) GetEmployeeIdentifiables ¶
func (p Parties) GetEmployeeIdentifiables() []Identifiable
func (Parties) SetId ¶
func (p Parties) SetId()
SetId sets a unique id to all elements in the struct.
func (Parties) Validate ¶
func (p Parties) Validate() util.ValidateResults
type Party ¶
type Party struct { // Id is the internal unique identifier of the Expense. Id string `yaml:"id" default:""` // Value is a unique user chosen identifier, has to be the same in all source files (bank statements, bimpf dumps...). Identifier string `yaml:"identifier" default:"?-1"` Name string `yaml:"name" default:"Max Mustermann"` Street string `yaml:"street" default:"Main Street"` StreetNr int `yaml:"streetNr" default:"1"` PostalCode int `yaml:"postalCode" default:"8000"` Place string `yaml:"place" default:"Zurich"` PartyType PartyType `yaml:"partyType" default:"0"` }
Party represents some person or organisation.
func InteractiveNewCustomer ¶
func InteractiveNewEmployee ¶
func InteractiveNewParty ¶
func NewPartyWithUuid ¶
func NewPartyWithUuid() Party
func (Party) AddressLines ¶
func (Party) Conditions ¶
func (p Party) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Party) GetIdentifier ¶
func (Party) SearchItem ¶
func (p Party) SearchItem(typ string) util.SearchItem
func (*Party) SetId ¶
func (p *Party) SetId()
SetId generates a unique id for the element if there isn't already one defined.
type Project ¶
type Project struct { Id string `yaml:"id" default:"1"` Identifier string `yaml:"identifier" default:"p-1"` Name string `yaml:"name" default:"Building a space rocket"` CustomerId string `yaml:"customerId" default:""` }
Project represents a project for a customer.
func InteractiveNewProject ¶
InteractiveNewProject returns a new Project based on the user input.
func NewProject ¶
func NewProject() Project
NewProject returns a new Project element with the default values.
func (Project) Conditions ¶
func (p Project) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Project) GetIdentifier ¶
GetIdentifier return the identifier of the Project.
func (Project) SearchItem ¶
func (p Project) SearchItem() util.SearchItem
SearchItem returns a searchable representation of the Project.
func (*Project) SetId ¶
func (p *Project) SetId()
SetId generates a unique id for the element if there isn't already one defined.
type Projects ¶
type Projects []Project
Projects represents a collection of multiple Project elements.
func OpenProjects ¶
OpenProjects opens the Projects saved in the YAML file given by the path.
func (Projects) GetIdentifiables ¶
func (p Projects) GetIdentifiables() []Identifiable
GetIdentifiables returns the a sliche of all identifiers. This is used for the identifier suggestion while interactively adding a new Project.
func (Projects) ProjectById ¶
ProjectById returns the Project with the given id. If no record could be found an error will be returned.
func (Projects) ProjectByIdent ¶
ProjectByIdent returns the Project with the given identifier. If no record could be found an error will be returned.
func (Projects) SearchItems ¶
func (p Projects) SearchItems() util.SearchItems
SearchItems returns a searchable structure of the Projects. So the user can search for Projects in the interactive mode.
type Schema ¶
type Schema struct { Company Company Expenses Expenses Invoices Invoices JournalConfig JournalConfig Currency string MiscRecords MiscRecords Parties Parties Projects Projects Statement Statement AppendExpenseSuffix func(suffix string, overwrite bool) AppendInvoiceSuffix func(suffix string, overwrite bool) SaveFunc func(s Schema) FileHashes map[string]string BaseFolder string }
func (Schema) FilterYear ¶
func (Schema) ValidateAndReportProject ¶
ValidateAndReportProject validates the Schema and saves the report to the given path.
func (Schema) ValidateProject ¶
func (s Schema) ValidateProject() util.ValidateResults
type Statement ¶
type Statement struct { Name string `yaml:"name" default:"e-19-01"` Period string `yaml:"period" default:"2019"` Transactions []Transaction `yaml:"transactions" default:"[]"` }
BankStatement represents a bank statement.
func NewBankStatement ¶
NewBankStatement returns a new BankStatement struct with the one Expense in it.
func OpenBankStatement ¶
OpenBankStatement opens a BankStatement struct saved in the json file given by the path.
func (*Statement) AddTransaction ¶
func (t *Statement) AddTransaction(trn []Transaction)
func (*Statement) AssistedCompletion ¶
func (Statement) Conditions ¶
func (t Statement) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Statement) FilterTransactions ¶
func (Statement) GetIdentifiables ¶
func (t Statement) GetIdentifiables() []Identifiable
func (Statement) Save ¶
Save writes the element as a json to the given path. Indented states whether «prettify» the json output.
func (Statement) SetId ¶
func (t Statement) SetId()
SetId sets a unique id to all elements in the slice.
func (Statement) TransactionById ¶
func (t Statement) TransactionById(id string) (*Transaction, error)
func (Statement) TransactionForDocument ¶
func (t Statement) TransactionForDocument(id string) (*Transaction, error)
func (Statement) TransactionSearchItems ¶
func (t Statement) TransactionSearchItems() util.SearchItems
func (Statement) Validate ¶
func (t Statement) Validate() util.ValidateResults
Validate the element and return the result.
type Transaction ¶
type Transaction struct { Id string `yaml:"id" default:""` Identifier string `yaml:"identifier" default:""` Amount util.Money `yaml:"amount" default:"-" query:"amount"` Description string `yaml:"description" default:""` TransactionType util.TransactionType `yaml:"transactionType" default:"0"` AssociatedPartyId string `yaml:"associatedPartyId" default:"" query:"customer,employee"` AssociatedDocumentId string `yaml:"associatedDocumentId" default:"" query:"expense,invoice"` Date string `yaml:"date" default:""` JournalMode JournalMode `yaml:"journalMode" default:"0"` }
Transaction represents a single transaction of a bank statement.
func InteractiveNewTransaction ¶
func InteractiveNewTransaction(s Statement, currency string) Transaction
func NewTransaction ¶
func NewTransaction() Transaction
func NewTransactionWithUuid ¶
func NewTransactionWithUuid() Transaction
func (Transaction) AssistedCompletion ¶
func (t Transaction) AssistedCompletion(s Schema, doAll, autoMode, askSkip, documentsOnly bool) Transaction
func (Transaction) Conditions ¶
func (t Transaction) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Transaction) DateTime ¶
func (t Transaction) DateTime() time.Time
func (Transaction) GetDate ¶
func (t Transaction) GetDate() *time.Time
func (Transaction) GetId ¶
func (t Transaction) GetId() string
GetId returns the unique id of the element.
func (Transaction) GetIdentifier ¶
func (t Transaction) GetIdentifier() string
func (Transaction) SearchItem ¶
func (t Transaction) SearchItem() util.SearchItem
func (*Transaction) SetId ¶
func (t *Transaction) SetId()
SetId generates a unique id for the element if there isn't already one defined.
func (Transaction) Short ¶
func (t Transaction) Short() string
Short returns a short representation of the element.
func (Transaction) String ¶
func (t Transaction) String() string
String returns a human readable representation of the element.
func (Transaction) Type ¶
func (Transaction) Type() string
Type returns a string with the type name of the element.
func (Transaction) Validate ¶
func (t Transaction) Validate() util.ValidateResults
Validate the element and return the result.