diff --git a/src/admin-orderable-list/admin-orderable-list.scss b/src/admin-orderable-list/admin-orderable-list.scss new file mode 100644 index 0000000..96a2651 --- /dev/null +++ b/src/admin-orderable-list/admin-orderable-list.scss @@ -0,0 +1,6 @@ +.orderable-list-buttons-group { + display: flex !important; + flex-direction: row; + gap: 1rem; + float: right !important; +} diff --git a/src/admin-orderable-list/messages_en.json b/src/admin-orderable-list/messages_en.json index 129199d..c3d1ed5 100644 --- a/src/admin-orderable-list/messages_en.json +++ b/src/admin-orderable-list/messages_en.json @@ -1,5 +1,6 @@ { "adminOrderableList.export": "Export", "adminOrderableList.includeQuarantined": "Include Quarantined Products", - "adminOrderableList.isQuarantined": "Quarantined" + "adminOrderableList.isQuarantined": "Quarantined", + "adminOrderableList.createUnit": "Create unit" } diff --git a/src/admin-orderable-list/orderable-list.controller.js b/src/admin-orderable-list/orderable-list.controller.js index a0fdc72..0e6d2e1 100644 --- a/src/admin-orderable-list/orderable-list.controller.js +++ b/src/admin-orderable-list/orderable-list.controller.js @@ -134,6 +134,10 @@ vm.tableConfig = getTableConfig(); } + vm.addNewUnit = function() { + $state.go('openlmis.administration.orderables.unitAdd'); + }; + /** * @ngdoc method * @methodOf admin-orderable-list.controller:OrderableListController diff --git a/src/admin-orderable-list/orderable-list.html b/src/admin-orderable-list/orderable-list.html index d6633d4..012f35f 100644 --- a/src/admin-orderable-list/orderable-list.html +++ b/src/admin-orderable-list/orderable-list.html @@ -1,25 +1,20 @@

{{'adminOrderableList.products' | message}}

- -
- +
- +
-
@@ -28,8 +23,15 @@

{{'adminOrderableList.products' | message}}

{{:: 'adminOrderableList.includeQuarantined' | message}}
- +
+
+ + + +
- -
+ + \ No newline at end of file diff --git a/src/messages_en.json b/src/messages_en.json index 46e202b..7f7c565 100644 --- a/src/messages_en.json +++ b/src/messages_en.json @@ -48,6 +48,7 @@ "stockAddProductsModal.newLotCode": "Lot Code", "stockAdjustmentCreation.newNotExpirationDate": "Expiration Date", "stockAdjustmentCreation.newLotCode": "Lot Code", + "stockAdjustmentCreation.unit": "Unit of orderable", "orderableGroupService.addMissingLot": "Add lot", "stockPhysicalInventoryDraft.addLotFailed": "Failed to add lot.", "digestConfiguration.requisition-actionRequired": "Requisition - Action Required", @@ -66,7 +67,7 @@ "shipmentView.fillQuantityInPack": "Fill Quantity (in Packs)", "shipmentView.packs": "Packs", "shipmentView.doses": "Doses", - "stockAdjustmentCreation.quantityGreaterThanStockOnHand": "Quantity cannot be greater than stock on hand value.", + "stockAdjustmentCreation.quantityGreaterThanStockOnHand": "Total quantity cannot be greater than stock on hand value.", "adminRoleForm.reportedAndOrderedProducts": "View Reported and Ordered Products Report", "adminRoleForm.submissionOfMonthlyReports": "View Submission of Monthly Reports", "adminRoleForm.aggregateConsumption": "View Aggregate Consumption Report", diff --git a/src/openlmis-unit-add/messages_en.json b/src/openlmis-unit-add/messages_en.json new file mode 100644 index 0000000..1d0c475 --- /dev/null +++ b/src/openlmis-unit-add/messages_en.json @@ -0,0 +1,9 @@ +{ + "openlmisUnitAdd.form.header": "Create unit", + "openlmisUnitAdd.form.label.name": "Name", + "openlmisUnitAdd.form.label.description": "Description", + "openlmisUnitAdd.form.label.displayOrder": "Display order", + "openlmisUnitAdd.form.label.factor": "Factor", + "openlmisUnitAdd.cancel": "Cancel", + "openlmisUnitAdd.save": "Save" +} diff --git a/src/openlmis-unit-add/openlmis-unit-add.component.js b/src/openlmis-unit-add/openlmis-unit-add.component.js new file mode 100644 index 0000000..ec09abd --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.component.js @@ -0,0 +1,34 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc component + * @name openlmis-unit-add.component:openlmisUnitAdd + * + * @description + * Component responsible for displaying modal panel where user can add a new unit + */ + angular + .module('openlmis-unit-add') + .component('openlmisUnitAdd', { + templateUrl: 'openlmis-unit-add/openlmis-unit-add.html', + controller: 'openlmisUnitAddController', + controllerAs: '$ctrl' + }); +})(); diff --git a/src/openlmis-unit-add/openlmis-unit-add.controller.js b/src/openlmis-unit-add/openlmis-unit-add.controller.js new file mode 100644 index 0000000..ef824da --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.controller.js @@ -0,0 +1,57 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc controller + * @name openlmis-unit-add.controller:openlmisUnitAddController * + * @description + * Manages the openlmis-unit-add component + */ + angular + .module('openlmis-unit-add') + .controller('openlmisUnitAddController', openlmisUnitAddController); + + openlmisUnitAddController.$inject = ['openlmisUnitAddService', 'stateTrackerService']; + + function openlmisUnitAddController(openlmisUnitAddService, stateTrackerService) { + var $ctrl = this; + $ctrl.newUnit = { + name: undefined, + description: undefined, + displayOrder: undefined, + factor: undefined + }; + $ctrl.save = save; + $ctrl.goToPreviousState = stateTrackerService.goToPreviousState; + $ctrl.saveDisabled = saveDisabled; + + function saveDisabled() { + return !$ctrl.newUnit.name || + !$ctrl.newUnit.factor || + !$ctrl.newUnit.displayOrder; + } + + function save() { + openlmisUnitAddService.save($ctrl.newUnit) + .then(function() { + $ctrl.goToPreviousState(); + }); + } + } +})(); diff --git a/src/openlmis-unit-add/openlmis-unit-add.html b/src/openlmis-unit-add/openlmis-unit-add.html new file mode 100644 index 0000000..6188513 --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.html @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/src/openlmis-unit-add/openlmis-unit-add.module.js b/src/openlmis-unit-add/openlmis-unit-add.module.js new file mode 100644 index 0000000..db8b9e4 --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.module.js @@ -0,0 +1,26 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + 'use strict'; + + angular.module('openlmis-unit-add', [ + 'openlmis-modal', + 'openlmis-templates', + 'openlmis-state-tracker', + 'openlmis-modal-state', + 'openlmis-pagination' + ]); +})(); \ No newline at end of file diff --git a/src/openlmis-unit-add/openlmis-unit-add.routes.js b/src/openlmis-unit-add/openlmis-unit-add.routes.js new file mode 100644 index 0000000..99d7e4b --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.routes.js @@ -0,0 +1,49 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + angular + .module('openlmis-unit-add') + .config(routes); + + routes.$inject = ['modalStateProvider']; + + function routes(modalStateProvider) { + + modalStateProvider.state('openlmis.stockmanagement.adjustment.creation.unitAdd', { + controller: 'openlmisUnitAddController', + controllerAs: '$ctrl', + templateUrl: 'openlmis-unit-add/openlmis-unit-add.html', + url: '/addUnit' + }); + + modalStateProvider.state('openlmis.stockmanagement.physicalInventory.draft.unitAdd', { + controller: 'openlmisUnitAddController', + controllerAs: '$ctrl', + templateUrl: 'openlmis-unit-add/openlmis-unit-add.html', + url: '/addUnit' + }); + + modalStateProvider.state('openlmis.administration.orderables.unitAdd', { + controller: 'openlmisUnitAddController', + controllerAs: '$ctrl', + templateUrl: 'openlmis-unit-add/openlmis-unit-add.html', + url: '/addUnit' + }); + } +})(); diff --git a/src/openlmis-unit-add/openlmis-unit-add.scss b/src/openlmis-unit-add/openlmis-unit-add.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/openlmis-unit-add/openlmis-unit-add.service.js b/src/openlmis-unit-add/openlmis-unit-add.service.js new file mode 100644 index 0000000..7fc5706 --- /dev/null +++ b/src/openlmis-unit-add/openlmis-unit-add.service.js @@ -0,0 +1,34 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + 'use strict'; + + angular + .module('openlmis-unit-add') + .service('openlmisUnitAddService', openlmisUnitAddService); + + openlmisUnitAddService.$inject = ['unitOfOrderableService']; + + function openlmisUnitAddService(unitOfOrderableService) { + return { + save: save + }; + + function save(unit) { + return unitOfOrderableService.create(unit); + } + } +})(); diff --git a/src/openlmis-unit-add/unit-of-orderable.service.js b/src/openlmis-unit-add/unit-of-orderable.service.js new file mode 100644 index 0000000..57ed779 --- /dev/null +++ b/src/openlmis-unit-add/unit-of-orderable.service.js @@ -0,0 +1,49 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + 'use strict'; + + angular + .module('openlmis-unit-add') + .service('unitOfOrderableService', service); + + service.$inject = ['$resource', 'referencedataUrlFactory']; + + function service($resource, referencedataUrlFactory) { + + var resource = $resource(referencedataUrlFactory('/api/unitOfOrderables'), {}, { + getAll: { + method: 'GET' + }, + create: { + method: 'POST' + } + }); + + return { + getAll: getAll, + create: create + }; + + function getAll() { + return resource.getAll().$promise; + } + + function create(unit) { + return resource.create(unit).$promise; + } + } +})(); \ No newline at end of file diff --git a/src/stock-adjustment-creation/adjustment-creation.controller.js b/src/stock-adjustment-creation/adjustment-creation.controller.js index 7b1bbd1..bb9cdae 100644 --- a/src/stock-adjustment-creation/adjustment-creation.controller.js +++ b/src/stock-adjustment-creation/adjustment-creation.controller.js @@ -39,8 +39,9 @@ 'accessTokenFactory', '$window', 'stockmanagementUrlFactory', // ANGOLASUP-717: ends here // AO-805: Allow users with proper rights to edit product prices - 'OrderableResource', 'permissionService', 'ADMINISTRATION_RIGHTS', 'authorizationService' + 'OrderableResource', 'permissionService', 'ADMINISTRATION_RIGHTS', 'authorizationService', // AO-805: Ends here + 'unitOfOrderableService' ]; function controller($scope, $state, $stateParams, $filter, confirmDiscardService, program, @@ -52,12 +53,12 @@ // ANGOLASUP-717: Create New Issue Report // AO-805: Allow users with proper rights to edit product prices accessTokenFactory, $window, stockmanagementUrlFactory, OrderableResource, permissionService, - ADMINISTRATION_RIGHTS, authorizationService) { + ADMINISTRATION_RIGHTS, authorizationService, unitOfOrderableService) { // ANGOLASUP-717: ends here // AO-805: Ends here - var vm = this, - previousAdded = {}; + var vm = this; + vm.previousAdded = {}; vm.expirationDateChanged = expirationDateChanged; vm.newLotCodeChanged = newLotCodeChanged; vm.validateExpirationDate = validateExpirationDate; @@ -138,6 +139,41 @@ */ vm.newLot = undefined; + /** + * @ngdoc property + * @propertyOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name newItemUnitId + * @type {string} + * + * @description + * Holds id of a unit which is added to a new product + * + */ + vm.newItemUnitId = undefined; + + /** + * @ngdoc property + * @propertyOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name unitsOfOrderable + * @type {Object[]} + * + * @description + * Holds possible units for orderable + */ + vm.unitsOfOrderable = undefined; + + /** + * @ngdoc property + * @propertyOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name lotAlreadyAdded + * @type {boolean} + * + * @description + * flag which specifies if the lot from add product form was already added to table + * if yes then unit for new item is fixed + */ + vm.lotAlreadyAdded = false; + // OAM-5: Lot code filter UI improvements. /** * @ngdoc method @@ -179,6 +215,17 @@ }); }; + vm.getAddedUnitName = function() { + return getUnitOfOrderableById(vm.newItemUnitId).name; + }; + + function getUnitOfOrderableById(unitId) { + var unit = vm.unitsOfOrderable.find(function(unit) { + return unit.id === unitId; + }); + return unit; + } + /** * @ngdoc method * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController @@ -216,34 +263,36 @@ vm.addedLineItems.unshift(_.extend({ $errors: {}, $previewSOH: selectedItem.stockOnHand, + unitOfOrderableId: vm.newItemUnitId, + unit: getUnitOfOrderableById(vm.newItemUnitId), price: getProductPrice(selectedItem), totalPrice: 0 }, selectedItem, copyDefaultValue())); // AO-804: Ends here - previousAdded = vm.addedLineItems[0]; - + vm.previousAdded = vm.addedLineItems[0]; + setLotAlreadyAdded(vm.addedLineItems[0].lot.lotCode); vm.search(); } } function copyDefaultValue() { var defaultDate; - if (previousAdded.occurredDate) { - defaultDate = previousAdded.occurredDate; + if (vm.previousAdded.occurredDate) { + defaultDate = vm.previousAdded.occurredDate; } else { defaultDate = dateUtils.toStringDate(new Date()); } return { - assignment: previousAdded.assignment, - srcDstFreeText: previousAdded.srcDstFreeText, + assignment: vm.previousAdded.assignment, + srcDstFreeText: vm.previousAdded.srcDstFreeText, reason: (adjustmentType.state === ADJUSTMENT_TYPE.KIT_UNPACK.state) ? { id: UNPACK_REASONS.KIT_UNPACK_REASON_ID - } : previousAdded.reason, - reasonFreeText: previousAdded.reasonFreeText, + } : vm.previousAdded.reason, + reasonFreeText: vm.previousAdded.reasonFreeText, occurredDate: defaultDate }; } @@ -281,6 +330,20 @@ }); }; + /** + * @ngdoc method + * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name getLineItemTotalQuantity + * + * @description + * Calculates the total quantity of a line item. (mulitiplied by item quantity) + */ + vm.getLineItemTotalQuantity = function(lineItem) { + var itemQuantity = lineItem.quantity ? lineItem.quantity : 0; + var factor = lineItem.unit ? lineItem.unit.factor : 1; + return itemQuantity * factor; + }; + /** * @ngdoc method * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController @@ -295,13 +358,14 @@ // AO-804: Display product prices on Stock Issues, Adjustments and Receives Page lineItem.totalPrice = 0; // AO-804: Ends here - if (lineItem.quantity > lineItem.$previewSOH && lineItem.reason - && lineItem.reason.reasonType === REASON_TYPES.DEBIT) { + var validatedQuantity = vm.getLineItemTotalQuantity(lineItem); + if (validatedQuantity > lineItem.$previewSOH && ((lineItem.reason + && lineItem.reason.reasonType === REASON_TYPES.DEBIT) || !lineItem.reason)) { lineItem.$errors.quantityInvalid = messageService .get('stockAdjustmentCreation.quantityGreaterThanStockOnHand'); - } else if (lineItem.quantity > MAX_INTEGER_VALUE) { + } else if (validatedQuantity > MAX_INTEGER_VALUE) { lineItem.$errors.quantityInvalid = messageService.get('stockmanagement.numberTooLarge'); - } else if (lineItem.quantity >= 1) { + } else if (validatedQuantity >= 1) { lineItem.$errors.quantityInvalid = false; // AO-804: Display product prices on Stock Issues, Adjustments and Receives Page lineItem.totalPrice = calculateTotalPrice(lineItem); @@ -373,6 +437,27 @@ return lineItem; }; + function setLotAlreadyAdded(lotCode) { + var matchingLineItem = vm.addedLineItems.find(function(item) { + return item.lot.lotCode === lotCode; + }); + + if (!matchingLineItem) { + vm.lotAlreadyAdded = false; + return; + } + + var matchingUnit = vm.unitsOfOrderable.find(function(unit) { + return unit.id === matchingLineItem.unitOfOrderableId; + }); + + if (matchingUnit) { + vm.newItemUnitId = matchingUnit.id; + } + + vm.lotAlreadyAdded = true; + } + /** * @ngdoc method * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController @@ -382,6 +467,8 @@ * Allows inputs to add missing lot to be displayed. */ function lotChanged() { + setLotAlreadyAdded(vm.selectedLot.lotCode); + vm.canAddNewLot = vm.selectedLot && vm.selectedLot.lotCode === messageService.get('orderableGroupService.addMissingLot'); initiateNewLotObject(); @@ -591,6 +678,8 @@ var distinctLots = []; var lotResource = new LotResource(); addedLineItems.forEach(function(lineItem) { + lineItem.quantity = vm.getLineItemTotalQuantity(lineItem); + if (lineItem.lot && lineItem.$isNewItem && _.isUndefined(lineItem.lot.id) && !listContainsTheSameLot(distinctLots, lineItem.lot)) { distinctLots.push(lineItem.lot); @@ -627,6 +716,34 @@ var lastProductWithPriceChanged = productsWithPriceChanged[productsWithPriceChanged.length - 1]; var priceChangesPromises = []; + if (!lastProductWithPriceChanged) { + return stockAdjustmentCreationService.submitAdjustments(program.id, facility.id, + // AO-668: Use username as signature for Issue, Receive and Adjustment + addedLineItems, adjustmentType, user) + // AO-668: ends here + // ANGOLASUP-717: Create New Issue Report + .then(function(stockEventId) { + if (adjustmentType.state === ADJUSTMENT_TYPE.ISSUE.state) { + confirmService.confirm('adjustmentCreation.printModal.label', + 'stockPhysicalInventoryDraft.printModal.yes', + 'stockPhysicalInventoryDraft.printModal.no') + .then(function() { + $window.open(accessTokenFactory.addAccessToken(getPrintUrl(stockEventId)), + '_blank'); + }) + .finally(function() { + goToStockCardSummaries(); + }); + } else { + goToStockCardSummaries(); + } + // ANGOLASUP-717: ends here + }, function(errorResponse) { + loadingModalService.close(); + alertService.error(errorResponse.data.message); + }); + } + setProductPriceForProgram(lastProductWithPriceChanged, program); priceChangesPromises.push(updateProductPrice(lastProductWithPriceChanged.orderable, lastProductWithPriceChanged.price)); @@ -776,6 +893,11 @@ program: program.name }); + unitOfOrderableService.getAll() + .then(function(response) { + vm.unitsOfOrderable = response.content; + }); + initViewModel(); initStateParams(); @@ -905,6 +1027,10 @@ return vm.hasPermissionToAddNewLot && lineItem.lot && lineItem.$isNewItem; }; + vm.addNewUnit = function() { + $state.go('openlmis.stockmanagement.adjustment.creation.unitAdd'); + }; + /** * @ngdoc method * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController @@ -992,7 +1118,8 @@ // AO-805: Allow users with proper rights to edit product prices function calculateTotalPrice(lineItem) { - return lineItem.price && lineItem.quantity ? lineItem.price * lineItem.quantity : 0; + var lineItemTotalQuantity = vm.getLineItemTotalQuantity(lineItem); + return lineItem.price && lineItem.quantity ? lineItem.price * lineItemTotalQuantity : 0; } function hasPermissionToEditProductPrices() { diff --git a/src/stock-adjustment-creation/adjustment-creation.html b/src/stock-adjustment-creation/adjustment-creation.html index a225893..0b1620f 100644 --- a/src/stock-adjustment-creation/adjustment-creation.html +++ b/src/stock-adjustment-creation/adjustment-creation.html @@ -1,5 +1,6 @@

- {{vm.key('title') | message:{'facilityCode': vm.facility.code, 'facilityName': vm.facility.name, 'program': vm.program.name} }} + {{vm.key('title') | message:{'facilityCode': vm.facility.code, 'facilityName': vm.facility.name, 'program': + vm.program.name} }}

@@ -7,10 +8,9 @@

- +
- - +
@@ -26,9 +26,9 @@

+ +

+
+ +
- - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + + +
{{vm.key('noProducts') | message}}
{{vm.key('productCode') | message}}{{vm.key('product') | message}}{{vm.key('lotCode') | message}}{{vm.key('expiryDate') | message}}{{vm.key('soh') | message}}{{vm.key('srcDstLabel') | message}}{{vm.key('srcDstComments') | message}}{{vm.key('reason') | message}}{{vm.key('reasonComments') | message}}{{vm.key('quantity') | message}}{{'adjustmentCreation.price' | message}}{{'adjustmentCreation.totalPrice' | message}}{{vm.key('vvmStatus') | message}}{{vm.key('date') | message}}{{vm.key('actions') | message}}
{{vm.key('productCode') | message}}{{vm.key('product') | message}}{{vm.key('lotCode') | message}}{{vm.key('expiryDate') | message}}{{vm.key('soh') | message}}{{vm.key('srcDstLabel') | message}}{{vm.key('srcDstComments') | message}}{{vm.key('reason') | message}}{{vm.key('reasonComments') | message}}{{:: 'adjustmentCreation.unit' | message}}{{:: 'adjustmentCreation.itemQuantity' | message}}{{:: 'adjustmentCreation.totalQuantity' | message}}{{:: 'adjustmentCreation.price' | message}}{{:: 'adjustmentCreation.totalPrice' | message}}{{vm.key('vvmStatus') | message}}{{vm.key('date') | message}}{{vm.key('actions') | message}}
{{lineItem.orderable.productCode}}{{lineItem.orderable | productName}} -
{{lineItem.orderable.productCode}}{{lineItem.orderable | productName}} + + {{lineItem.displayLotMessage}} - - - {{lineItem.displayLotMessage}} - {{lineItem.lot.expirationDate | openlmisDate}}{{lineItem.$previewSOH}} - {{lineItem.lot.expirationDate | openlmisDate}}{{lineItem.$previewSOH}} + - - - - + + + + - - - - - - {{lineItem.price | openlmisCurrency}} - - - - {{lineItem.totalPrice | openlmisCurrency}} - - + + + {{ lineItem.unit.name}} + + + + {{ vm.getLineItemTotalQuantity(lineItem) }} + + {{lineItem.price | openlmisCurrency}} + + + + {{lineItem.totalPrice | openlmisCurrency}} + + - - - - -
+ + + +
- + diff --git a/src/stock-adjustment-creation/adjustment-creation.module.js b/src/stock-adjustment-creation/adjustment-creation.module.js index 6b4b7d0..3cc60de 100644 --- a/src/stock-adjustment-creation/adjustment-creation.module.js +++ b/src/stock-adjustment-creation/adjustment-creation.module.js @@ -32,6 +32,7 @@ 'referencedata-lot', 'stock-unpack-kit', 'stock-reasons-modal', - 'stock-edit-lot-modal' + 'stock-edit-lot-modal', + 'openlmis-unit-add' ]); -})(); \ No newline at end of file +})(); diff --git a/src/stock-adjustment-creation/adjustment-creation.service.js b/src/stock-adjustment-creation/adjustment-creation.service.js index c98242b..dc42a35 100644 --- a/src/stock-adjustment-creation/adjustment-creation.service.js +++ b/src/stock-adjustment-creation/adjustment-creation.service.js @@ -101,7 +101,8 @@ }, occurredDate: item.occurredDate, reasonId: item.reason ? item.reason.id : null, - reasonFreeText: item.reasonFreeText + reasonFreeText: item.reasonFreeText, + unitOfOrderableId: item.unitOfOrderableId }, buildSourceDestinationInfo(item, adjustmentType)); }); // ANGOLASUP-717: Create New Issue Report diff --git a/src/stock-adjustment-creation/messages_en.json b/src/stock-adjustment-creation/messages_en.json index 05f6c1e..2d1a964 100644 --- a/src/stock-adjustment-creation/messages_en.json +++ b/src/stock-adjustment-creation/messages_en.json @@ -3,5 +3,10 @@ "adjustmentCreation.price": "Unit Price", "adjustmentCreation.totalPrice": "Total Price", "adjustmentCreation.numberEqualOrGreaterThan0": "You must input number equal or greater than 0", - "adjustmentCreation.totalCost": "Total Cost" + "adjustmentCreation.totalCost": "Total Cost", + "adjustmentCreation.addNewUnit": "Create unit", + "adjustmentCreation.addProduct": "Add product", + "adjustmentCreation.unit": "Unit", + "adjustmentCreation.itemQuantity": "Item quantity", + "adjustmentCreation.totalQuantity": "Total quantity" } \ No newline at end of file diff --git a/src/stock-adjustment-creation/stock-adjustment-creation.scss b/src/stock-adjustment-creation/stock-adjustment-creation.scss new file mode 100644 index 0000000..f94edde --- /dev/null +++ b/src/stock-adjustment-creation/stock-adjustment-creation.scss @@ -0,0 +1,8 @@ +.stock-adjustment-creation { + .is-primary { + @include flex-layout(row, $gap: 0.5rem); + .form-inline{ + flex-wrap: wrap; + } + } +} diff --git a/src/stock-card-summary-list/messages_en.json b/src/stock-card-summary-list/messages_en.json index d904733..924dcfb 100644 --- a/src/stock-card-summary-list/messages_en.json +++ b/src/stock-card-summary-list/messages_en.json @@ -3,5 +3,8 @@ "stockCardSummaryList.lotCode": "Lot code", "stockCardSummaryList.productCode": "Product Code", "stockCardSummaryList.unitPrice": "Unit Price", - "stockCardSummaryList.totalPrice": "Total Price" + "stockCardSummaryList.totalPrice": "Total Price", + "stockCardSummaryList.packs": "Packs", + "stockCardSummaryList.doses": "Doses", + "stockCardSummaryList.unit": "Unit" } \ No newline at end of file diff --git a/src/stock-card-summary-list/stock-card-summary-list.controller.js b/src/stock-card-summary-list/stock-card-summary-list.controller.js index 0d1a569..c2f9113 100644 --- a/src/stock-card-summary-list/stock-card-summary-list.controller.js +++ b/src/stock-card-summary-list/stock-card-summary-list.controller.js @@ -30,11 +30,12 @@ controller.$inject = [ 'loadingModalService', '$state', '$stateParams', 'StockCardSummaryRepositoryImpl', 'stockCardSummaries', - 'offlineService', '$scope', 'STOCKCARD_STATUS', 'messageService', 'paginationService' + 'offlineService', '$scope', 'STOCKCARD_STATUS', 'messageService', 'paginationService', 'unitOfOrderableService' ]; function controller(loadingModalService, $state, $stateParams, StockCardSummaryRepositoryImpl, stockCardSummaries, - offlineService, $scope, STOCKCARD_STATUS, messageService, paginationService) { + offlineService, $scope, STOCKCARD_STATUS, messageService, paginationService, + unitOfOrderableService) { var vm = this; vm.$onInit = onInit; @@ -44,6 +45,10 @@ vm.search = search; vm.offline = offlineService.isOffline; vm.goToPendingOfflineEventsPage = goToPendingOfflineEventsPage; + vm.setActiveDisplayType = setActiveDisplayType; + vm.PACKS_DISPLAY_TYPE = 'packs'; + vm.DOSES_DISPLAY_TYPE = 'doses'; + vm.activeDisplayType = vm.DOSES_DISPLAY_TYPE; /** * @ngdoc property @@ -118,6 +123,17 @@ vm.totalCost = 0; // AO-816: Ends here + /** + * @ngdoc property + * @propertyOf stock-card-summary-list.controller:StockCardSummaryListController + * @name allUnitsOfOrderable + * @type {Object[]} + * + * @description + * Holds all available units of orderable + */ + vm.allUnitsOfOrderable = undefined; + /** * @ngdoc method * @methodOf stock-card-summary-list.controller:StockCardSummaryListController @@ -128,11 +144,17 @@ */ function onInit() { // AO-816: Add prices to the Stock On Hand view - stockCardSummaries.forEach(function(stockCardSummary) { - stockCardSummary.orderable.unitPrice = getProductPrice(stockCardSummary); - stockCardSummary.orderable.totalPrice = stockCardSummary.orderable.unitPrice * - stockCardSummary.stockOnHand; + unitOfOrderableService.getAll().then(function(response) { + vm.allUnitsOfOrderable = response.content; + + stockCardSummaries.forEach(function(stockCardSummary) { + stockCardSummary.orderable.unitPrice = getProductPrice(stockCardSummary); + stockCardSummary.orderable.totalPrice = stockCardSummary.orderable.unitPrice * + stockCardSummary.stockOnHand; + stockCardSummary.orderable.unit = getOrderableUnit(stockCardSummary.orderable.unitOfOrderableId); + }); }); + calculateTotalCost(stockCardSummaries); // AO-816: Ends here vm.stockCardSummaries = stockCardSummaries; @@ -152,6 +174,31 @@ }, true); } + vm.getSohForPacks = function(fulfills) { + var factor = fulfills.orderable.unit ? fulfills.orderable.unit.factor : 1; + return fulfills.stockOnHand / factor; + }; + + function getOrderableUnit(orderableUnitId) { + var defaultOrderableUnit = { + name: '', + factor: 1 + }; + + if (!orderableUnitId) { + return angular.copy(defaultOrderableUnit); + } + + var unitOfOrderable = vm.allUnitsOfOrderable.find(function(unit) { + return unit.id === orderableUnitId; + }); + + return unitOfOrderable ? { + name: unitOfOrderable.name, + factor: unitOfOrderable.factor + } : angular.copy(defaultOrderableUnit); + } + /** * @ngdoc method * @methodOf stock-card-summary-list.controller:StockCardSummaryListController @@ -274,6 +321,14 @@ vm.totalCost = sum; } - // AO-816: Ends here + + function setActiveDisplayType(displayType) { + if (displayType === vm.PACKS_DISPLAY_TYPE || displayType === vm.DOSES_DISPLAY_TYPE) { + vm.activeDisplayType = displayType; + } else { + // eslint-disable-next-line no-console + console.error('No such display type: ' + displayType); + } + } } })(); \ No newline at end of file diff --git a/src/stock-card-summary-list/stock-card-summary-list.html b/src/stock-card-summary-list/stock-card-summary-list.html index 9e417f0..3a35dca 100644 --- a/src/stock-card-summary-list/stock-card-summary-list.html +++ b/src/stock-card-summary-list/stock-card-summary-list.html @@ -42,24 +42,43 @@

{{'stockCardSummaryList.stockOnHand' | m - +
+ +
+ + +
+
- - - - - - + + + + + + + - - + + - + @@ -69,6 +88,7 @@

{{'stockCardSummaryList.stockOnHand' | m

+ @@ -84,7 +104,9 @@

{{'stockCardSummaryList.stockOnHand' | m

- + + + diff --git a/src/stock-card-summary-list/stock-card-summary-list.scss b/src/stock-card-summary-list/stock-card-summary-list.scss new file mode 100644 index 0000000..f5979e1 --- /dev/null +++ b/src/stock-card-summary-list/stock-card-summary-list.scss @@ -0,0 +1,10 @@ +.stock-card-buttons-group { + float: right !important; + display: flex !important; + gap: 3rem; + flex-direction: row; + + .units-package-switch { + @include flex-layout(row); + } +} diff --git a/src/stock-event/stock-event-line-item.js b/src/stock-event/stock-event-line-item.js new file mode 100644 index 0000000..88e9399 --- /dev/null +++ b/src/stock-event/stock-event-line-item.js @@ -0,0 +1,63 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc service + * @name stock-event.StockEventLineItem + * + * @description + * Represents a single Stock Event Line Item. + */ + angular + .module('stock-event') + .factory('StockEventLineItem', StockEventLineItem); + + function StockEventLineItem() { + + return StockEventLineItem; + + /** + * @ngdoc method + * @methodOf stock-event.StockEventLineItem + * @name StockEventLineItem + * + * @description + * Creates a new instance of the Stock Event Line Item class. + * + * @param {String} orderableId the orderable id + * @param {String} lotId the lot id + * @param {Number} quantity the quantity + * @param {String} occurredDate the occured date + * @param {Object} extraData the extra data + * @param {Array} stockAdjustments the stock adjustment list + * @param {string} unitOfOrderableId id of a unit + * @return {StockEventLineItem} the Stock Event Line Item object + */ + function StockEventLineItem(orderableId, lotId, quantity, occurredDate, extraData, stockAdjustments, + unitOfOrderableId) { + this.orderableId = orderableId; + this.lotId = lotId; + this.quantity = quantity; + this.occurredDate = occurredDate; + this.extraData = extraData; + this.stockAdjustments = stockAdjustments; + this.unitOfOrderableId = unitOfOrderableId; + } + } +})(); diff --git a/src/stock-event/stock-event.factory.js b/src/stock-event/stock-event.factory.js new file mode 100644 index 0000000..70faabb --- /dev/null +++ b/src/stock-event/stock-event.factory.js @@ -0,0 +1,89 @@ +/* + * This program is part of the OpenLMIS logistics management information system platform software. + * Copyright © 2017 VillageReach + * + * This program is free software: you can redistribute it and/or modify it under the terms + * of the GNU Affero General Public License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + *   + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  + * See the GNU Affero General Public License for more details. You should have received a copy of + * the GNU Affero General Public License along with this program. If not, see + * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc service + * @name stock-event.stockEventFactory + * + * @description + * Allows the user to create new stock event based on passed data. + */ + angular + .module('stock-event') + .factory('stockEventFactory', factory); + + factory.$inject = [ '$filter', 'StockEventAdjustment', 'StockEventLineItem', 'StockEvent' ]; + + function factory($filter, StockEventAdjustment, StockEventLineItem, StockEvent) { + + return { + createFromPhysicalInventory: createFromPhysicalInventory + }; + + /** + * @ngdoc method + * @methodOf stock-event.stockEventFactory + * @name createFromPhysicalInventory + * + * @description + * Creates a stock event based on data from physical Inventory + * + * @param {Object} physicalInventory the physical Inventory + * @return {StockEvent} the new instance of stock event + */ + function createFromPhysicalInventory(physicalInventory) { + var physicalInventoryCopy = angular.copy(physicalInventory); + physicalInventoryCopy.lineItems = physicalInventory.lineItems + .filter(function(item) { + return item.isAdded; + }) + .map(function(item) { + var stockAdjustments = []; + + if (item.stockAdjustments) { + stockAdjustments = _.map(item.stockAdjustments, function(adjustment) { + return new StockEventAdjustment(adjustment.reason.id, adjustment.quantity); + }); + } + + if (!item.quantity && item.active === false) { + item.quantity = 0; + } + + if ((!item.quantity && item.quantity !== 0) && item.active === true) { + throw 'stockPhysicalInventoryDraft.submitInvalidActive'; + } + + if (item.unitOfOrderableId) { + console.log('this one has unit: ' + item); + } + + return new StockEventLineItem( + item.orderable.id, item.lot ? item.lot.id : null, + item.quantity, physicalInventory.occurredDate, + { + vvmStatus: item.vvmStatus + }, stockAdjustments, item.unitOfOrderableId + ); + }); + + return new StockEvent(physicalInventoryCopy); + } + } +})(); diff --git a/src/stock-physical-inventory-draft/_physical-inventory-draft.scss b/src/stock-physical-inventory-draft/_physical-inventory-draft.scss new file mode 100644 index 0000000..19e1264 --- /dev/null +++ b/src/stock-physical-inventory-draft/_physical-inventory-draft.scss @@ -0,0 +1,6 @@ +.buttons-section { + display: flex; + flex-direction: row; + gap: .5rem; + align-items: center; +} diff --git a/src/stock-physical-inventory-draft/messages_en.json b/src/stock-physical-inventory-draft/messages_en.json new file mode 100644 index 0000000..685673d --- /dev/null +++ b/src/stock-physical-inventory-draft/messages_en.json @@ -0,0 +1,5 @@ +{ + "stockPhysicalInventoryDraft.addUnit": "Create unit", + "stockPhysicalInventoryDraft.quantity": "Quantity", + "stockPhysicalInventoryDraft.unit": "Unit" +} \ No newline at end of file diff --git a/src/stock-physical-inventory-draft/physical-inventory-draft-cache.service.js b/src/stock-physical-inventory-draft/physical-inventory-draft-cache.service.js index 87488ac..bbc69b7 100644 --- a/src/stock-physical-inventory-draft/physical-inventory-draft-cache.service.js +++ b/src/stock-physical-inventory-draft/physical-inventory-draft-cache.service.js @@ -91,7 +91,7 @@ return lineItem.lot && (lineItem.lot.lotCode && !lineItem.lot.id) && (existingItemsWithNewLots.filter(function(lineItemWithNewLot) { return lineItemWithNewLot.displayLotMessage === lineItem.displayLotMessage && - lineItemWithNewLot.orderable.id === lineItem.orderable.id; + lineItemWithNewLot.orderable.id === lineItem.orderable.id && lineItemWithNewLot.stockCardId; }).length === 0); }); diff --git a/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js b/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js index fb836a5..c8694e6 100644 --- a/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js +++ b/src/stock-physical-inventory-draft/physical-inventory-draft.controller.js @@ -35,7 +35,7 @@ 'VVM_STATUS', 'reasons', 'stockReasonsCalculations', 'loadingModalService', '$window', 'stockmanagementUrlFactory', 'accessTokenFactory', 'orderableGroupService', '$filter', '$q', 'offlineService', 'physicalInventoryDraftCacheService', 'stockCardService', 'LotResource', - 'editLotModalService']; + 'editLotModalService', 'unitOfOrderableService']; function controller($scope, $state, $stateParams, addProductsModalService, messageService, physicalInventoryFactory, notificationService, alertService, @@ -44,7 +44,7 @@ reasons, stockReasonsCalculations, loadingModalService, $window, stockmanagementUrlFactory, accessTokenFactory, orderableGroupService, $filter, $q, offlineService, physicalInventoryDraftCacheService, stockCardService, - LotResource, editLotModalService) { + LotResource, editLotModalService, unitOfOrderableService) { var vm = this; vm.$onInit = onInit; @@ -246,6 +246,17 @@ */ vm.dataChanged = false; + /** + * @ngdoc property + * @propertyOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController + * @name unitsOfOrderable + * @type {boolean} + * + * @description + * Holds possible units for orderable + */ + vm.unitsOfOrderable = undefined; + /** * @ngdoc method * @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController @@ -427,6 +438,20 @@ }); }; + function multiplyUnitsByFactor(lineItems) { + lineItems.forEach(function(lineItem) { + if (lineItem.unitOfOrderableId) { + var assignedUnit = vm.unitsOfOrderable.find(function(unit) { + return unit.id === lineItem.unitOfOrderableId; + }); + + if (assignedUnit && lineItem.quantity) { + lineItem.quantity *= assignedUnit.factor; + } + } + }); + } + /** * @ngdoc method * @methodOf stock-physical-inventory-draft.controller:PhysicalInventoryDraftController @@ -436,6 +461,7 @@ * Save physical inventory draft. */ vm.saveDraft = function(withNotification) { + multiplyUnitsByFactor(draft.lineItems); loadingModalService.open(); return physicalInventoryFactory.saveDraft(draft).then(function() { if (!withNotification) { @@ -726,6 +752,11 @@ $stateParams.program = undefined; $stateParams.facility = undefined; + unitOfOrderableService.getAll() + .then(function(response) { + vm.unitsOfOrderable = response.content; + }); + // ANGOLASUP-806: Implement adding default reason in physical inventory if (vm.stateParams.defaultReason !== null) { vm.useDefaultReason = true; diff --git a/src/stock-physical-inventory-draft/physical-inventory-draft.html b/src/stock-physical-inventory-draft/physical-inventory-draft.html index 2288e83..b86d42c 100644 --- a/src/stock-physical-inventory-draft/physical-inventory-draft.html +++ b/src/stock-physical-inventory-draft/physical-inventory-draft.html @@ -1,28 +1,21 @@

- {{'stockPhysicalInventoryDraft.title' | message: {'facilityCode': vm.facility.code, 'facilityName': vm.facility.name, 'program': vm.program.name} }} + {{'stockPhysicalInventoryDraft.title' | message: {'facilityCode': vm.facility.code, 'facilityName': + vm.facility.name, 'program': vm.program.name} }}

-
+
-
@@ -32,31 +25,31 @@

- + - +
- - - - +
+ + + +

{{'stockCardSummaryList.noProducts' | message}}
{{'stockCardSummaryList.productCode' | message}}{{'stockCardSummaryList.product' | message}}{{'stockCardSummaryList.lotCode' | message}}{{'stockCardSummaryList.expiryDate' | message}}{{'stockCardSummaryList.lastUpdate' | message}}{{'stockCardSummaryList.stockOnHand' | message}}{{:: 'stockCardSummaryList.productCode' | message}}{{:: 'stockCardSummaryList.product' | message}}{{:: 'stockCardSummaryList.lotCode' | message}}{{:: 'stockCardSummaryList.expiryDate' | message}}{{:: 'stockCardSummaryList.lastUpdate' | message}}{{:: 'stockCardSummaryList.unit' | message }}{{:: 'stockCardSummaryList.stockOnHand' | message}} {{'stockCardSummaryList.unitPrice' | message}}{{'stockCardSummaryList.totalPrice' | message}}{{:: 'stockCardSummaryList.unitPrice' | message}}{{:: 'stockCardSummaryList.totalPrice' | message}} {{'stockCardSummaryList.actions' | message}}{{:: 'stockCardSummaryList.actions' | message}}
{{summary.stockOnHand}} {{summary.orderable.unitPrice | openlmisCurrency}}{{fulfills.lot ? fulfills.lot.lotCode : ('stockCardSummaryList.noLotDefined' | message)}} {{fulfills.lot ? (fulfills.lot.expirationDate | openlmisDate) : ''}} {{fulfills.occurredDate | openlmisDate}}{{fulfills.stockOnHand}}{{ fulfills.orderable.unit.name }}{{fulfills.stockOnHand}}{{ vm.getSohForPacks(fulfills) }}
- + - + + - - + + - + + @@ -134,14 +130,23 @@

ng-class="{'has-popover is-invalid': vm.validateOnPageChange()}" openlmis-invalid="{{lineItem.unaccountedQuantityInvalid | message}}">{{lineItem.unaccountedQuantity}} +

@@ -73,21 +66,24 @@

{{'stockPhysicalInventoryDraft.expiryDate' | message}} {{'stockPhysicalInventoryDraft.soh' | message}} {{'stockPhysicalInventoryDraft.currentStock' | message}}{{'stockPhysicalInventoryDraft.VVMStatus' | message}} + {{'stockPhysicalInventoryDraft.VVMStatus' | message}} {{'stockPhysicalInventoryDraft.reasons' | message}} {{'stockPhysicalInventoryDraft.unaccountedQuantity' | message}}{{'stockPhysicalInventoryDraft.actions' | message}}{{:: 'stockPhysicalInventoryDraft.unit' | message}}{{'stockPhysicalInventoryDraft.actions' | message}}
{{lineItems[0].orderable.productCode}} {{lineItems[0].orderable | productName}} {{vm.calculate(lineItems, 'stockOnHand')}} {{vm.calculate(lineItems, 'quantity')}} + + - +
- + \ No newline at end of file diff --git a/src/stock-physical-inventory/physical-inventory.factory.js b/src/stock-physical-inventory/physical-inventory.factory.js index a9419d2..bc81afa 100644 --- a/src/stock-physical-inventory/physical-inventory.factory.js +++ b/src/stock-physical-inventory/physical-inventory.factory.js @@ -202,6 +202,9 @@ angular.forEach(draft.lineItems, function(item) { // ANGOLASUP-825: Fixed inventory saving functionality if (!(item.lot && (item.lot.lotCode && !item.lot.id))) { + if (item.unitOfOrderableId) { + console.log(item); + } physicalInventory.lineItems.push({ orderableId: item.orderable.id, lotId: (item.lot && item) ? item.lot.id : null, @@ -209,7 +212,8 @@ extraData: { vvmStatus: item.vvmStatus }, - stockAdjustments: item.stockAdjustments + stockAdjustments: item.stockAdjustments, + unitOfOrderableId: item.unitOfOrderableId }); } // ANGOLASUP-825: Ends here diff --git a/src/stock-product-price-changes/stock-product-price-changes.routes.js b/src/stock-product-price-changes/stock-product-price-changes.routes.js index 99b3a30..d8e80a7 100644 --- a/src/stock-product-price-changes/stock-product-price-changes.routes.js +++ b/src/stock-product-price-changes/stock-product-price-changes.routes.js @@ -24,7 +24,7 @@ function routes($stateProvider, STOCKMANAGEMENT_RIGHTS) { $stateProvider.state('openlmis.stockmanagement.stockPriceChangesForSingleProduct', { - url: '/:singleProductId?facility&program&pricesListPage&pricesListSize', + url: 'singleProduct/:singleProductId?facility&program&pricesListPage&pricesListSize', label: 'stockPriceChanges.title', showInNavigation: false, views: {