Distribution report
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
window.app.controller('DistributionReportController', DistributionReportController);
|
||||
|
||||
DistributionReportController.$inject = ['$scope', 'reportSvc'];
|
||||
function DistributionReportController($scope, reportSvc) {
|
||||
var vm = this;
|
||||
vm.distributionData = reportSvc.distributionData;
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.app.directive('distributionReport', distributionReport);
|
||||
function distributionReport() {
|
||||
return {
|
||||
scope: {distributionData: "="},
|
||||
templateUrl: '/report/template/distributionReport.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
|
||||
controller.$inject = ['$scope'];
|
||||
function controller($scope) {
|
||||
var vm = this;
|
||||
vm.distributionData = $scope.distributionData;
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,33 @@
|
||||
(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;
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,23 @@
|
||||
(function () {
|
||||
window.app.factory('reportSvc', reportSvc);
|
||||
|
||||
reportSvc.$inject = ['$http'];
|
||||
function reportSvc($http) {
|
||||
var distributionData = [];
|
||||
|
||||
var svc = {
|
||||
distributionData: distributionData,
|
||||
loadDistributionReport: loadDistributionReport
|
||||
};
|
||||
|
||||
//loadDistributionReport({ startDate: '2015-06-01', endDate: '2016-01-01' });
|
||||
return svc;
|
||||
|
||||
function loadDistributionReport(query) {
|
||||
return $http.post('/Report/Distribution', query)
|
||||
.success(function (data) {
|
||||
angular.copy(data, distributionData);
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,26 @@
|
||||
<div ng-repeat="distribution in vm.distributionData">
|
||||
<h3>{{distribution.destination}}</h3>
|
||||
<h4>{{distribution.date | date:'shortDate'}}</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">Name</th>
|
||||
<th class="col-md-3">Units per Case</th>
|
||||
<th class="col-md-2">Exp. Date</th>
|
||||
<th class="col-md-1">Case Qty</th>
|
||||
<th class="col-md-1">Unit Qty</th>
|
||||
<th class="col-md-2">Weight</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="transaction in distribution.transactions | orderBy:'name'">
|
||||
<td>{{transaction.name}}</td>
|
||||
<td>{{transaction.unitsPerCase}} / {{transaction.containerType}}</td>
|
||||
<td>{{transaction.expirationDate | date:'shortDate'}}</td>
|
||||
<td>{{transaction.removedQuantity}}</td>
|
||||
<td>{{transaction.removedQuantity * transaction.unitsPerCase}}</td>
|
||||
<td>{{transaction.weightPerCase * transaction.unitsPerCase | number:0 }} lbs</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
@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>
|
||||
Reference in New Issue
Block a user