MonthlyInventory report

This commit is contained in:
2016-09-19 10:22:53 -04:00
parent 679ef75152
commit d242fea781
23 changed files with 448 additions and 65 deletions
@@ -6,6 +6,7 @@
DistributionReportController.$inject = ['$scope', 'reportSvc'];
function DistributionReportController($scope, reportSvc) {
var vm = this;
vm.loadData = reportSvc.loadDistributionReport;
vm.distributionData = reportSvc.distributionData;
}
})();
@@ -1,33 +0,0 @@
(function() {
'use strict';
window.app.directive('distributionReportQuery', distributionReportQuery);
function distributionReportQuery() {
return {
scope: true,
templateUrl: '/report/template/distributionReportQuery.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', 'reportSvc'];
function controller($scope, reportSvc) {
var vm = this;
vm.query = {};
vm.submitting = false;
vm.errorMessages = [];
vm.submit = submit;
function submit() {
vm.submitting = true;
reportSvc.loadDistributionReport(vm.query)
.error(function (data) {
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
})
.finally(function () {
vm.submitting = false;
});
}
}
})();
@@ -6,6 +6,7 @@
MonthlyInventoryReportController.$inject = ['$scope', 'reportSvc'];
function MonthlyInventoryReportController($scope, reportSvc) {
var vm = this;
vm.loadData = reportSvc.loadMonthlyInventoryData;
vm.monthlyInventoryData = reportSvc.monthlyInventoryData;
}
})();
@@ -0,0 +1,29 @@
(function() {
'use strict';
window.app.directive('monthlyInventoryReport', monthlyInventoryReport);
function monthlyInventoryReport() {
return {
scope: { monthlyInventoryData: "=" },
templateUrl: '/report/template/monthlyInventoryReport.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', '$uibModal', 'inventorySvc'];
function controller($scope, $uibModal, inventorySvc) {
var vm = this;
vm.monthlyInventoryData = $scope.monthlyInventoryData;
vm.editInventory = function (inventoryId) {
inventorySvc.find(inventoryId)
.success(function (inventory) {
$uibModal.open({
template: '<edit-inventory inventory="inventory" />',
scope: angular.extend($scope.$new(true), { inventory: inventory })
});
});
}
}
})();
+3 -3
View File
@@ -4,15 +4,15 @@
reportSvc.$inject = ['$http'];
function reportSvc($http) {
var distributionData = [];
var monthlyInventoryData = [];
var monthlyInventoryData = {};
var svc = {
distributionData: distributionData,
loadDistributionReport: loadDistributionReport,
monthlyInventoryData: monthlyInventoryData,
loadDistributionReport: loadDistributionReport
loadMonthlyInventoryData: loadMonthlyInventoryData
};
loadDistributionReport({ startDate: '2015-05-01', endDate: '2016-01-01' });
return svc;
function loadDistributionReport(query) {
@@ -1,7 +1,7 @@
<div ng-repeat="distribution in vm.distributionData">
<h3>{{distribution.destination}}</h3>
<h4>{{distribution.date | date:'shortDate'}}</h4>
<table class="table">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-3">Name</th>
@@ -1,23 +0,0 @@
@using InventoryTraker.Web.Helpers
@model InventoryTraker.Web.Models.DateRangeQuery
@{
var query = Html.Angular().ModelFor("vm.query");
}
<form novalidate
name="vm.form"
ng-submit="vm.form.$valid && vm.submit()">
<fieldset ng-disabled="vm.submitting">
<error-list errors="vm.errorMessages"></error-list>
<div class="row">
<div class="col-md-6">
@query.FormGroupFor(m => m.StartDate)
</div>
<div class="col-md-6">
@query.FormGroupFor(m => m.EndDate)
</div>
</div>
<button class="btn btn-success pull-right">Submit</button>
</fieldset>
</form>
@@ -0,0 +1,47 @@
<table class="table table-striped">
<thead>
<tr>
@*<th></th>*@
<th class="col-md-2">Name of Commodity</th>
<th class="col-md-1">Pack Size / Units per Case</th>
<th class="col-md-1">Beginning Inventory</th>
<th class="col-md-1">Units Rec'd</th>
<th class="col-md-1">Total Units Available</th>
<th class="col-md-1">Adjustments (show + or -)</th>
<th class="col-md-1">Units Distributed</th>
<th class="col-md-1">Ending Inventory</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in vm.monthlyInventoryData.items | orderBy:'inventoryType.name'">
@*<td><a href="" ng-click="vm.editInventory(item.inventory.id)"><i class="fa fa-edit"></i></a> </td>*@
<td>{{item.inventoryType.name}}</td>
<td>{{item.inventoryType.unitsPerCase}} / {{item.inventoryType.containerType}}</td>
<td>
{{item.beginningQuantity | toUnits:item.inventoryType.unitsPerCase}}
{{item.beginningQuantity | formatCases}}
</td>
<td>
{{item.addedQuantity | hideZero | toUnits:item.inventoryType.unitsPerCase}}
{{item.addedQuantity | hideZero | formatCases}}
</td>
<td>
{{item.totalAvailableQuantity | hideZero | toUnits:item.inventoryType.unitsPerCase}}
{{item.totalAvailableQuantity | hideZero | formatCases}}
</td>
<td>
{{item.adjustmentQuantity ? '-' : ''}}
{{item.adjustmentQuantity | hideZero | toUnits:item.inventoryType.unitsPerCase}}
{{item.adjustmentQuantity | hideZero | formatCases}}
</td>
<td>
{{item.distributedQuantity | hideZero | toUnits:item.inventoryType.unitsPerCase}}
{{item.distributedQuantity | hideZero | formatCases}}
</td>
<td>
{{item.endingQuantity | toUnits:item.inventoryType.unitsPerCase}}
{{item.endingQuantity | formatCases}}
</td>
</tr>
</tbody>
</table>