-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stock): add option to view AMC calcs
Adds the ability to view the AMC/CMM calculations in the Articles in Stock Registry. A summary of the information is presented for the user to examine and the explicit formula used to calculate the AMC is shown for the user to validate. Closes #5291.
- Loading branch information
Showing
11 changed files
with
221 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
client/src/modules/stock/inventories/modals/amc.modal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<div class="modal-header"> | ||
<ol class="headercrumb"> | ||
<li class="static">{{ModalCtrl.depot.text}}</li> | ||
<li class="static">{{ModalCtrl.inventory.groupName}}</li> | ||
<li class="title">{{ModalCtrl.inventory.code}} - {{ModalCtrl.inventory.label}}</li> | ||
</ol> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
|
||
<p class="alert alert-info"> | ||
<i class="fa fa-info-circle"></i> | ||
<span ng-show="ModalCtrl.isAlgo1"> | ||
<strong translate>STOCK.MONTHLY_CONSUMPTION.ALGO_1</strong> | ||
<br /> | ||
<span translate>STOCK.MONTHLY_CONSUMPTION.ALGO_1_COMMENT</span> | ||
</span> | ||
|
||
<span ng-show="ModalCtrl.isAlgo2"> | ||
<strong translate>STOCK.MONTHLY_CONSUMPTION.ALGO_2</strong> | ||
<br /> | ||
<span translate>STOCK.MONTHLY_CONSUMPTION.ALGO_2_COMMENT</span> | ||
</span> | ||
|
||
<span ng-show="ModalCtrl.isAlgo3"> | ||
<strong translate>STOCK.MONTHLY_CONSUMPTION.ALGO_3</strong> | ||
<br /> | ||
<span translate>STOCK.MONTHLY_CONSUMPTION.ALGO_3_COMMENT</span> | ||
</span> | ||
|
||
<span ng-show="ModalCtrl.isAlgo4"> | ||
<strong translate>STOCK.MONTHLY_CONSUMPTION.ALGO_4</strong> | ||
<br /> | ||
<span translate>STOCK.MONTHLY_CONSUMPTION.ALGO_4_COMMENT</span> | ||
</span> | ||
</p> | ||
|
||
<div class="row"> | ||
<!-- left hand side --> | ||
<div class="col-sm-6 col-xs-12"> | ||
<dl> | ||
<dt translate>STOCK.INVENTORY</dt> | ||
<dd>{{ModalCtrl.inventory.code}} - {{ModalCtrl.inventory.label}}</dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.NUMBER_OF_MONTHS</dt> | ||
<dd> | ||
{{ModalCtrl.data.start_date | date }} − {{ModalCtrl.data.end_date | date}} | ||
(<span class="text-warning">{{ModalCtrl.data.number_of_month}} <span translate>STOCK.MONTHLY_CONSUMPTION.MONTHS</span></span>) | ||
</dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.FIRST_INVENTORY_MOVEMENT_DATE</dt> | ||
<dd>{{ModalCtrl.data.first_inventory_movement_date | date }}</dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.LAST_INVENTORY_MOVEMENT_DATE</dt> | ||
<dd>{{ModalCtrl.data.last_inventory_movement_date | date }}</dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.SUM_CONSUMED_QUANTITY</dt> | ||
<dd class="text-primary">{{ModalCtrl.data.sum_consumed_quantity }} {{ModalCtrl.inventory.unit}}</dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.SUM_CONSUMPTION_DAY</dt> | ||
<dd class="text-info">{{ModalCtrl.data.sum_consumption_day}} <span translate>STOCK.MONTHLY_CONSUMPTION.DAYS</span></dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.SUM_STOCK_DAY</dt> | ||
<dd class="text-success">{{ModalCtrl.data.sum_stock_day}} <span translate>STOCK.MONTHLY_CONSUMPTION.DAYS</span></dd> | ||
|
||
<dt translate>STOCK.MONTHLY_CONSUMPTION.SUM_STOCK_OUT_DAYS</dt> | ||
<dd class="text-danger">{{ModalCtrl.data.sum_stock_out_days}} <span translate>STOCK.MONTHLY_CONSUMPTION.DAYS</span></dd> | ||
</dl> | ||
</div> | ||
|
||
<!-- right hand side --> | ||
<div class="col-sm-6 col-xs-12"> | ||
<table class="table table-condensed table-bordered"> | ||
<thead> | ||
<tr> | ||
<th translate translate-attr="{ 'title' : 'STOCK.MONTHLY_CONSUMPTION.ALGO_1_COMMENT' }">STOCK.MONTHLY_CONSUMPTION.ALGO_1</th> | ||
<th translate translate-attr="{ 'title' : 'STOCK.MONTHLY_CONSUMPTION.ALGO_1_COMMENT' }">STOCK.MONTHLY_CONSUMPTION.ALGO_2</th> | ||
<th translate translate-attr="{ 'title' : 'STOCK.MONTHLY_CONSUMPTION.ALGO_1_COMMENT' }">STOCK.MONTHLY_CONSUMPTION.ALGO_3</th> | ||
<th translate translate-attr="{ 'title' : 'STOCK.MONTHLY_CONSUMPTION.ALGO_1_COMMENT' }">STOCK.MONTHLY_CONSUMPTION.ALGO_4</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr class="text-right"> | ||
<td ng-class="{ 'bg-success text-success' : ModalCtrl.isAlgo1 }">{{ModalCtrl.data.algo1}}</td> | ||
<td ng-class="{ 'bg-success text-success' : ModalCtrl.isAlgo2 }">{{ModalCtrl.data.algo2}}</td> | ||
<td ng-class="{ 'bg-success text-success' : ModalCtrl.isAlgo3 }">{{ModalCtrl.data.algo3}}</td> | ||
<td ng-class="{ 'bg-success text-success' : ModalCtrl.isAlgo4 }">{{ModalCtrl.data.algo_msh}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<hr /> | ||
|
||
<dl> | ||
<dt ng-show="ModalCtrl.isAlgo1" translate>STOCK.MONTHLY_CONSUMPTION.ALGO_1</dt> | ||
<dd ng-show="ModalCtrl.isAlgo1">30.5 × (<span class="text-primary">{{ModalCtrl.data.sum_consumed_quantity}}</span> / <span class="text-success">{{ModalCtrl.data.sum_stock_day}}</span>) = <u>{{ModalCtrl.data.avg_consumption}}</u> </dd> | ||
|
||
<dt ng-show="ModalCtrl.isAlgo2" translate>STOCK.MONTHLY_CONSUMPTION.ALGO_2</dt> | ||
<dd ng-show="ModalCtrl.isAlgo2">30.5 × (<span class="text-primary">{{ModalCtrl.data.sum_consumed_quantity}}</span> / <span class="text-info">{{ModalCtrl.data.sum_consumption_day}}</span>) = <u>{{ModalCtrl.data.avg_consumption}}</u></dd> | ||
|
||
<dt ng-show="ModalCtrl.isAlgo3" translate>STOCK.MONTHLY_CONSUMPTION.ALGO_3</dt> | ||
<dd ng-show="ModalCtrl.isAlgo3">30.5 × (<span class="text-primary">{{ModalCtrl.data.sum_consumed_quantity}}</span> / {{ModalCtrl.data.sum_days}}) = <u>{{ModalCtrl.data.avg_consumption}}</u> </dd> | ||
|
||
<dt ng-show="ModalCtrl.isAlgo4" translate>STOCK.MONTHLY_CONSUMPTION.ALGO_4</dt> | ||
<dd ng-show="ModalCtrl.isAlgo4"><span class="text-primary">{{ModalCtrl.data.sum_consumed_quantity}}</span> / (<span class="text-warning">{{ModalCtrl.data.number_of_month}}</span> − (<span class="text-danger">{{ModalCtrl.data.sum_stock_out_days}}</span> / 30.5)) = <u>{{ModalCtrl.data.avg_consumption}}</u></dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="ModalCtrl.close()"> | ||
<span translate>FORM.BUTTONS.CLOSE</span> | ||
</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
angular.module('bhima.controllers') | ||
.controller('StockAMCModalController', StockAMCModalController); | ||
|
||
StockAMCModalController.$inject = [ | ||
'StockService', 'NotifyService', '$uibModalInstance', 'data', | ||
]; | ||
|
||
function StockAMCModalController(Stock, Notify, Instance, data) { | ||
const vm = this; | ||
|
||
vm.close = () => Instance.dismiss(); | ||
|
||
Stock.inventories.loadAMCForInventory(data.inventory_uuid, data.depot_uuid) | ||
.then(items => { | ||
vm.data = items; | ||
|
||
vm.settings = vm.data.settings; | ||
vm.inventory = items.inventory; | ||
vm.depot = items.depot; | ||
|
||
vm.data.avg_consumption = vm.data[vm.settings.average_consumption_algo]; | ||
|
||
// nicer aliases to use in the HTML | ||
vm.isAlgo1 = vm.settings.average_consumption_algo === 'algo1'; | ||
vm.isAlgo2 = vm.settings.average_consumption_algo === 'algo2'; | ||
vm.isAlgo3 = vm.settings.average_consumption_algo === 'algo3'; | ||
vm.isAlgo4 = vm.settings.average_consumption_algo === 'algo_msh'; | ||
}) | ||
.catch(Notify.handleError); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters