| 
									
										
										
										
											2015-12-17 13:49:33 -08:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  | import {Injectable, Inject}     from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2015-12-17 13:49:33 -08:00
										 |  |  | import {TaxRateService} from './tax-rate.service'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion class
 | 
					
						
							|  |  |  | @Injectable() | 
					
						
							|  |  |  | export class SalesTaxService { | 
					
						
							|  |  |  |   constructor(private _rateService: TaxRateService) { } | 
					
						
							|  |  |  |   getVAT(value:string | number){ | 
					
						
							|  |  |  |     let amount:number; | 
					
						
							|  |  |  |     if (typeof value === "string"){ | 
					
						
							|  |  |  |       amount = parseFloat(value); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       amount = value; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return (amount || 0) * this._rateService.getRate('VAT'); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion class
 |