Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
/ Lexoffice.NET Public archive

.NET library for the accounting software lexoffice

License

Notifications You must be signed in to change notification settings

co-IT/Lexoffice.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is archived as of 12.08.2024. You can find the newest version here

Lexoffice.NET

.NET library for the accounting software lexoffice

Features

Lexoffice.NET does currently support the following lexoffice API endpoints:

Getting Started

To use this library you have to generate an API Key for your lexoffice Account.

You can generate an API Key here. If you have any problems getting the key you can follow the steps in these instructions by lexoffice.

Usage

First you have to create a new instance of LexofficeService with your API token like this:

var token = "Your-Api-Token";
var lexofficeService = new LexofficeService(token);

Getting all invoice vouchers

var vouchers = await lexOfficeService.GetAllInvoiceVouchersAsync();

Getting all invoices

To get all invoices all vouchers have to be loaded first. Then the invoice can be queried for each voucher like this:

var vouchers = await lexOfficeService.GetAllInvoiceVouchersAsync();
var invoices = await lexOfficeService.GetInvoicesAsync(vouchers);

Further Functions

Lexoffice.NET also provides filter and group functionality to allow for easy statistical analysis of invoices. The following code examples assume that you have already loaded all invoices.

Getting and working with the revenue grouped by year, customer and employee

Grouping

The following code will sum the revenue for each employee for a given customer in a given year

// Extract all the lines from each invoice
var invoiceItems = invoices.GetInvoiceItems();

// Group each line by year, customer and employee. Sum the revenue
var customerEmployeeRevenueData = CustomerEmployeeRevenueData.FromInvoiceItems(invoiceItems.ToList());
var groupedCustomerEmployeeRevenueData = customerEmployeeRevenueData.GroupByCustomerAndEmployee();

Filters

The library offers 3 filters to more easily work with CustomerEmployeeRevenueData:

  • YearFilter
  • EmployeeFilter
  • CustomerFilter

You can use and combine these filters for detailed analyzations. In this example we want the revenue John made for Example Ltd. in 2020:

var filters = new List<IFilterCustomerEmployeeRevenueData>
{
    new EmployeeFilter("John"),
    new CustomerFilter("Example Ltd."),
    new YearFilter("2020")
};

var filteredData = groupedCustomerEmployeeRevenueData.ApplyAllFilters(filters);

Releases

No releases published

Packages

No packages published

Languages