| 
									
										
										
										
											2016-06-13 00:41:33 +02:00
										 |  |  | import { Injectable } from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { TaxRateService } from './tax-rate.service'; | 
					
						
							| 
									
										
										
										
											2015-12-17 13:49:33 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Injectable() | 
					
						
							|  |  |  | export class SalesTaxService { | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  |   constructor(private rateService: TaxRateService) { } | 
					
						
							| 
									
										
										
										
											2016-07-01 08:44:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   getVAT(value: string | number) { | 
					
						
							| 
									
										
										
										
											2016-07-01 08:44:28 -07:00
										 |  |  |     let amount = (typeof value === 'string') ? | 
					
						
							|  |  |  |       parseFloat(value) : value; | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  |     return (amount || 0) * this.rateService.getRate('VAT'); | 
					
						
							| 
									
										
										
										
											2015-12-17 13:49:33 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | } |