32 lines
818 B
JavaScript
32 lines
818 B
JavaScript
(function () {
|
|
window.app.factory('reportSvc', reportSvc);
|
|
|
|
reportSvc.$inject = ['$http'];
|
|
function reportSvc($http) {
|
|
var distributionData = [];
|
|
var monthlyInventoryData = [];
|
|
|
|
var svc = {
|
|
distributionData: distributionData,
|
|
monthlyInventoryData: monthlyInventoryData,
|
|
loadDistributionReport: loadDistributionReport
|
|
};
|
|
|
|
loadDistributionReport({ startDate: '2015-05-01', endDate: '2016-01-01' });
|
|
return svc;
|
|
|
|
function loadDistributionReport(query) {
|
|
return $http.post('/Report/Distribution', query)
|
|
.success(function (data) {
|
|
angular.copy(data, distributionData);
|
|
});
|
|
}
|
|
|
|
function loadMonthlyInventoryData(query) {
|
|
return $http.post('/Report/MonthlyInventory', query)
|
|
.success(function (data) {
|
|
angular.copy(data, monthlyInventoryData);
|
|
});
|
|
}
|
|
}
|
|
})(); |