SudoSOS Back-end API / catalogue/vat / VatGroupService
Class: VatGroupService ​
Constructors ​
Constructor ​
new VatGroupService(): VatGroupService;Returns ​
VatGroupService
Methods ​
calculateVatDeclaration() ​
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 ​
| Parameter | Type | Description |
|---|---|---|
params | VatDeclarationParams | - |
Returns ​
Promise<VatDeclarationResponse>
createVatGroup() ​
static createVatGroup(vatGroupReq): Promise<VatGroup>;Save a new VAT group to the database
Parameters ​
| Parameter | Type | Description |
|---|---|---|
vatGroupReq | VatGroupRequest | - |
Returns ​
Promise<VatGroup>
getOptions() ​
static getOptions(params?): FindManyOptions<VatGroup>;Build FindManyOptions for VatGroup queries based on the given filter parameters.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
params | VatGroupFilterParameters | The filtering parameters. |
Returns ​
FindManyOptions<VatGroup>
getVatGroups() ​
static getVatGroups(filters, pagination?): Promise<[VatGroup[], number]>;Returns all VAT groups with options.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
filters | VatGroupFilterParameters | The filtering parameters. |
pagination | PaginationParameters | The pagination options. |
Returns ​
Promise<[VatGroup[], number]>
toBaseResponse() ​
static toBaseResponse(vatGroup): BaseVatGroupResponse;Parameters ​
| Parameter | Type |
|---|---|
vatGroup | VatGroup |
Returns ​
toResponse() ​
static toResponse(vatGroup): VatGroupResponse;Parameters ​
| Parameter | Type |
|---|---|
vatGroup | VatGroup |
Returns ​
updateVatGroup() ​
static updateVatGroup(id, vatGroupReq): Promise<VatGroup>;Update a VAT group
Parameters ​
| Parameter | Type | Description |
|---|---|---|
id | number | - |
vatGroupReq | UpdateVatGroupRequest | - |
Returns ​
Promise<VatGroup>