var tipoCambioService = function($filter, $http, $q){
	return{
		
		obtenerAnniosPaises : function() {		
			
			var defered = $q.defer();
			
			$http({
				method : "POST",
	            url : contextPath + '/catalogos/tipoCambio/tipoCambio.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(annio, pais) {
			
			var defered = $q.defer();
			var mydata = {"annio":annio, "pais":pais};
			
			$http({
				method : "POST",
	            url : contextPath + '/catalogos/tipoCambio/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/tipoCambio/' + action + '.action',
	            data : mydata
			}).then(function mySucces(response) {
				defered.resolve(response.data);
			}, function myError(response) {
				console.log("Error : ");
			});
			
			return defered.promise;
		}
	};
};

registraService("tipoCambioService", tipoCambioService);