var tipoCambioAddOnService = function($filter, $http, $q){
	return{
		
		obtenerAnniosPaises : function() {
			
			var defered = $q.defer();
			
			$http({
				method : "POST",
	            url : contextPath + '/catalogos/tipoCambioAddOns/tipoCambioAddOns.action',
	            data : {}
			}).then(function mySucces(response) {
				defered.resolve(response.data);
			}, function myError(response) {
				console.log("Error : ");
			});
			//console.log(JSON.stringify(defered.promise));
	    	return defered.promise;
		},
		obtenerMesTipo : function() {
			
			var anio= $("#myannio").val().split(":");
			
			var defered = $q.defer();
			var mydata = {"annio":parseInt(anio[1]), "estudio":$("#mystdio").val()};
			
			$http({
				method : "POST",
	            url : contextPath + '/catalogos/tipoCambioAddOns/mesTipo.action',
	            data : mydata
			}).then(function mySucces(response) {
				defered.resolve(response.data);
			}, function myError(response) {
				console.log("Error : ");
			});
			
	    	return defered.promise;
		},
		llamarAction : function(mydata, action) {
			
			var defered = $q.defer();
			
			$http({
				method : "POST",
	            url : contextPath + '/catalogos/tipoCambioAddOns/' + action + '.action',
	            data : mydata
			}).then(function mySucces(response) {
				defered.resolve(response.data);
			}, function myError(response) {
				console.log("Error : ");
			});
			
			return defered.promise;
		}
	};
};

registraService("tipoCambioAddOnService", tipoCambioAddOnService);