2017-02-22 18:13:21 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
|
|
|
|
|
import { TaxRateService } from './tax-rate.service';
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class SalesTaxService {
|
|
|
|
|
constructor(private rateService: TaxRateService) { }
|
|
|
|
|
|
|
|
|
|
getVAT(value: string | number) {
|
2020-07-30 13:03:19 +03:00
|
|
|
const amount = (typeof value === 'string') ?
|
2017-02-22 18:13:21 +00:00
|
|
|
parseFloat(value) : value;
|
|
|
|
|
return (amount || 0) * this.rateService.getRate('VAT');
|
|
|
|
|
}
|
|
|
|
|
}
|