Skip to content

SudoSOS Back-end API / catalogue/vat / VatGroupService

Class: VatGroupService ​

Constructors ​

Constructor ​

ts
new VatGroupService(): VatGroupService;

Returns ​

VatGroupService

Methods ​

calculateVatDeclaration() ​

ts
static calculateVatDeclaration(params): Promise<VatDeclarationResponse>;

Calculate the collected VAT for the periodic declaration at the tax authorization. The values are calculated as follows (based on rules of the Dutch tax athorization (De Belastingdienst): Every product has a VAT-included price. From this price (e.g. including 21% VAT), we derive the absolute VAT amount by multiplying this incl-price by 21 and then dividing by 121. Of course, we also multiply this number by the number of times this product has been bought in a single SubTransactionRow. We round this number on cents. We add up all these VAT-amounts for every SubTransactionRow and we sum everything up based on the year and the period in the year.

Parameters ​

ParameterTypeDescription
paramsVatDeclarationParams-

Returns ​

Promise<VatDeclarationResponse>


createVatGroup() ​

ts
static createVatGroup(vatGroupReq): Promise<VatGroup>;

Save a new VAT group to the database

Parameters ​

ParameterTypeDescription
vatGroupReqVatGroupRequest-

Returns ​

Promise<VatGroup>


getOptions() ​

ts
static getOptions(params?): FindManyOptions<VatGroup>;

Build FindManyOptions for VatGroup queries based on the given filter parameters.

Parameters ​

ParameterTypeDescription
paramsVatGroupFilterParametersThe filtering parameters.

Returns ​

FindManyOptions<VatGroup>


getVatGroups() ​

ts
static getVatGroups(filters, pagination?): Promise<[VatGroup[], number]>;

Returns all VAT groups with options.

Parameters ​

ParameterTypeDescription
filtersVatGroupFilterParametersThe filtering parameters.
paginationPaginationParametersThe pagination options.

Returns ​

Promise<[VatGroup[], number]>


toBaseResponse() ​

ts
static toBaseResponse(vatGroup): BaseVatGroupResponse;

Parameters ​

ParameterType
vatGroupVatGroup

Returns ​

BaseVatGroupResponse


toResponse() ​

ts
static toResponse(vatGroup): VatGroupResponse;

Parameters ​

ParameterType
vatGroupVatGroup

Returns ​

VatGroupResponse


updateVatGroup() ​

ts
static updateVatGroup(id, vatGroupReq): Promise<VatGroup>;

Update a VAT group

Parameters ​

ParameterTypeDescription
idnumber-
vatGroupReqUpdateVatGroupRequest-

Returns ​

Promise<VatGroup>