Documentation ¶
Overview ¶
Provides functionality to validate and import Bimpf json dumps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Customer ¶
type Customer struct { Id int `json:"id"` SbId string `json:"sb_id"` Name string `json:"name"` Comment string `json:"comment"` NcFolderName string `json:"nc_folder_name"` Recipient1 string `json:"recipient_1"` Recipient2 string `json:"recipient_2"` Recipient3 string `json:"recipient_3"` Recipient4 string `json:"recipient_4"` Email string `json:"email"` Projects []Project `json:"projects"` }
Customer reassembles the structure of a Customer TimeUnit in a Bimpf json dump file.
func (Customer) Conditions ¶
func (c Customer) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Customer) Validate ¶
func (c Customer) Validate() util.ValidateResults
Validate the element and return the result.
type Customers ¶
type Customers []Customer
Customers represents a slice of Customer slices
func (Customers) ConvertExpenses ¶
func (c Customers) ConvertExpenses(folderPrefix string, parties schema.Parties, bimpfEmployees Employees) schema.Expenses
ConvertExpenses cycles trough the Customers and returns all expenses found as a acc Expenses. As the expenses in Bimpf only contain a relative path to receipts the nextcloud prefix has to be provided.
func (Customers) ConvertInvoices ¶
ConvertInvoices cycles trough the Customers and returns all invoices found as a acc Invoice. As the expenses in Bimpf only contain a relative path to receipts the nextcloud prefix has to be provided.
type Document ¶
type Document struct { Id int `json:"id"` SbId string `json:"sb_id"` Name string `json:"name"` Description string `json:"description"` Path string `json:"path"` CustomerId int `json:"customer_id"` CustomerName string `json:"customer_name"` ProjectId int `json:"project_id"` ProjectName string `json:"project_name"` SendDate string `json:"send_date"` DaysOfGrace int `json:"days_of_grace"` IsStalled bool `json:"is_stalled"` }
Document reassembles the structure of a Doc in a Bimpf json dump file.
func (Document) Conditions ¶
func (d Document) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Document) ConvertAsInvoice ¶
func (d Document) ConvertAsInvoice(pathPrefix, customerId, projectName string, parties schema.Parties) schema.Invoice
ConvertAsInvoice converts the document to a Bimpf Invoice. Amount is set to -1 as Bimpf does not provide such information.
func (Document) Validate ¶
func (d Document) Validate() util.ValidateResults
Validate the element and return the result.
type Dump ¶
type Dump struct { TimeUnits []TimeUnit `json:"time_units"` Customers Customers `json:"customers"` Employees Employees `json:"employees"` Expenses []Expense `json:"expenses"` }
Dump reassembles the structure of a Bimpf json dump file.
func (Dump) Convert ¶
Convert returns the bimpf dump as an Acc struct. Needs a project path and a Nextcloud Bimpf folder path.
func (Dump) Validate ¶
func (d Dump) Validate() util.ValidateResults
Validate the element and return the result.
func (Dump) ValidateAndReport ¶
ValidateAndReportProject validates the bimpf dump and saves the report to the given path.
type Employee ¶
type Employee struct { Id int `json:"id"` SbId string `json:"sb_id"` FirstName string `json:"first_name"` Name string `json:"name"` Username string `json:"username"` }
Employee reassembles the structure of a Employee in a Bimpf json dump file.
func (Employee) Conditions ¶
func (e Employee) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Employee) Validate ¶
func (e Employee) Validate() util.ValidateResults
Validate the element and return the result.
type Expense ¶
type Expense struct { Id int `json:"id"` SbId string `json:"sb_id"` Name string `json:"name"` Comment string `json:"comment"` Path string `json:"path"` Amount float64 `json:"amount"` DateOfAccrual string `json:"date_of_accrual"` AdvancedByEmployee bool `json:"advance_by_employee"` PaidByCustomer bool `json:"paid_by_customer"` IsPaid bool `json:"is_paid"` Billable bool `json:"billable"` EmployeeId int `json:"advanced_employee"` }
Expense reassembles the structure of a Expense in a Bimpf json dump file.
func (Expense) Conditions ¶
func (e Expense) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Expense) Convert ¶
func (e Expense) Convert(pathPrefix, obligedCustomerId, project string, parties schema.Parties, bimpfEmployees Employees) schema.Expense
Convert returns the bimpf Expense as a acc Expense. As the path in the Bimpf Expense structure is not absolute (is relative to project folder in a nextcloud folder), a folder prefix is needed.
func (Expense) Validate ¶
func (e Expense) Validate() util.ValidateResults
Validate the element and return the result.
type Project ¶
type Project struct { Id int `json:"id"` SbId string `json:"sb_id"` Name string `json:"name"` NcFolderName string `json:"nc_folder_name"` CustomerId int `json:"customer"` CustomerName string `json:"customer_name"` IsArchived bool `json:"is_archived"` Quotes []Document `json:"quotes"` Invoices []Document `json:"invoices"` Reminders []Document `json:"reminders"` Expenses []Expense `json:"expenses"` }
Project reassembles the structure of a Project in a Bimpf json dump files.
func (Project) Conditions ¶
func (p Project) Conditions() util.Conditions
Conditions returns the validation conditions.
func (Project) ShortDescription ¶
ShortDescription returns the SbId and the name as a string
func (Project) Validate ¶
func (p Project) Validate() []util.ValidateResult
Validate the element and return the result.
type TimeUnit ¶
type TimeUnit struct { Id int `json:"id"` Description string `json:"description"` StartDate string `json:"start_date"` StartTime string `json:"start_time"` EndDate string `json:"end_date"` EndTime string `json:"end_time"` Billable bool `json:"billable"` }
TimeUnit reassembles the structure of a TimeUnit in a Bimpf json dump file.
func (TimeUnit) Conditions ¶
func (t TimeUnit) Conditions() util.Conditions
Conditions returns the validation conditions.
func (TimeUnit) Validate ¶
func (t TimeUnit) Validate() util.ValidateResults
Validate the element and return the result.