Skip to content

Commit

Permalink
improvement(Packaging)
Browse files Browse the repository at this point in the history
- Add popover information in lots entry form
- Add new column in lots registry for get information about package
  • Loading branch information
lomamech committed Oct 11, 2022
1 parent e2e23aa commit 394de7e
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 9 deletions.
6 changes: 5 additions & 1 deletion client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,12 @@
"NO_SOURCE": "No source defined",
"NO_SUPPLIER": "A purchase order must have a supplier before specifying items.",
"NUM_TRANSACTION": "Number of transactions",
"NUMBER_PACKAGE_INFO" : "For products or items that come with packaging, you must enter the total number of packages or boxes, this quantity multiplied by the size of the packaging to obtain the global quantity by the smallest unit.",
"OF": "of",
"OPERATION_SUCCESS": "Operation performed successfully",
"OTHER_ACTIONS": "Other Actions",
"PACKAGE_UNIT_COST_INFO": "The unit cost of the package calculates the unit cost for the smallest unit by dividing by the size of the package",
"PACK_SIZE_INFO": "Corresponds to the size of the packaging, the number of items contained in the package or box, generally we find B10, B20, B50, B100, B500 or B1000",
"PATIENTS": "Patients",
"PATIENT_FOUND": "Patient Found",
"PATIENT_NOT_FOUND": "Patient Not Found",
Expand Down Expand Up @@ -346,6 +349,7 @@
"BEGINNING_VIEW_BALANCE" : "Beginning View Balance",
"BILLING_DATE": "Billing Date",
"BREAK_EVEN": "Break Even",
"BULK_QUANTITY": "Bulk quantity",
"BY": "by",
"BY_ID": "By Id",
"BY_NAME": "By Name",
Expand Down Expand Up @@ -624,7 +628,7 @@
"NOTES": "Note(s)",
"NR": "No",
"NUMBER": "Number",
"NUMBER_PACKAGES": "Number Packages",
"NUMBER_PACKAGES": "Number Package",
"NUMBER_SUBMISSIONS": "Number of submissions",
"OFF_DAYS": "Off Days",
"OF": "Of",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/en/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"INVENTORY_TYPE_INFO" : "inventory_type : the type of the inventory such as Article, Service, Assembly or Other",
"INVENTORY_UNIT_INFO" : "inventory_unit : the units for the inventory such as such as Piece, Tablet, Box, Bottle, etc",
"IS_BROKEN" : "is broken",
"IS_COUNT_PER_CONTAINER" : "Is count per container",
"IS_COUNT_PER_CONTAINER" : "is packaged per package",
"IS_IT_ASSET": "Is it an asset",
"LIST": "Inventory Data List",
"LIST_GROUP": "Inventory Groups",
Expand Down
10 changes: 7 additions & 3 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,12 @@
"NO_SOURCE": "Aucune source définie",
"NO_SUPPLIER": "Un ordre d'achat doit avoir un fournisseur avant de préciser les éléments.",
"NUM_TRANSACTION": "Nombres des transactions",
"NUMBER_PACKAGE_INFO" : "Pour les produits ou articles qui se présentent avec un conditionnement, il faut renseigner le nombre total des paquets ou boites, cette quantité multipliée par la taille de l'emballage pour obtenir la quantité global par la plus petite unitée",
"OF": "de",
"OPERATION_SUCCESS": "Opération effectuée avec succès",
"OTHER_ACTIONS": "Autres actions",
"PACKAGE_UNIT_COST_INFO": "Le coût unitaire du paquet permet de calculer le coût unitaire pour la plus petite unité en divisant par la taille du paquet",
"PACK_SIZE_INFO": "Correspond à la taille du conditionnement, le nombre d'article contenu dans le paquet ou la boite, générelament on trouve de B10, B20, B50, B100, B500 ou B1000",
"PATIENTS": "Patients",
"PATIENT_FOUND": "Patient Trouvé",
"PATIENT_NOT_FOUND": "Patient introuvable",
Expand Down Expand Up @@ -298,7 +301,7 @@
"AMOUNT": "Montant",
"AMOUNT_PAID" : "Montant Payé",
"ARTICLES":"Articles",
"PACKAGE_UNIT_COST": "Coût unitaire du pacquet",
"PACKAGE_UNIT_COST": "Coût unitaire du paquet",
"CASHBOXES": "Caisses",
"NUMBER_OF_TAGS": "Nombre des étiquettes",
"SELECT_ALL_LOTS": "Sélectionner tous les lots",
Expand Down Expand Up @@ -349,6 +352,7 @@
"BEGINNING_VIEW_BALANCE" : "Solde Début du Grid",
"BILLING_DATE": "Date Facturation",
"BREAK_EVEN": "Seuil de rentabilité",
"BULK_QUANTITY": "Quantité en vrac",
"BY_ID": "Par id",
"BY_NAME": "Par nom",
"BY": "Par",
Expand Down Expand Up @@ -626,7 +630,7 @@
"NOTES": "Note(s)",
"NR": "",
"NUMBER": "Nombre",
"NUMBER_PACKAGES": "Nombre des paquets",
"NUMBER_PACKAGES": "Nombre de paquet",
"NUMBER_SUBMISSIONS": "Nombre de soumissions",
"OF": "De",
"OFF_DAYS": "jours fériés",
Expand Down Expand Up @@ -957,7 +961,7 @@
"NAME": "Entrer le nom",
"NOTES": "Commentaire",
"ORIGIN": "Origine",
"PACKAGING": "Entrer le Conditionnement du pacquet",
"PACKAGING": "Entrer le Conditionnement du paquet",
"PASSWORD": "Entrer le mot de passe",
"PATIENT_ID": "Entrer identifiant patient",
"PATIENT_NAME": "Entrer nom patient",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/fr/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"INVENTORY_TYPE_INFO" : "inventory_type : le type d'inventaire tel que Article, Service, Assemblage ou Autre",
"INVENTORY_UNIT_INFO" : "inventory_unit : les unités de l'inventaire telles que Piece, Tablet, Box, Bottle, etc",
"IS_BROKEN" : "est endommagé",
"IS_COUNT_PER_CONTAINER" : "est conditionné par boîte",
"IS_COUNT_PER_CONTAINER" : "est conditionné par paquet",
"IS_IT_ASSET": "Est ce un actif",
"LIST": "Liste des données d'inventaire",
"LIST_GROUP": "Groupes d'inventaires",
Expand Down
21 changes: 21 additions & 0 deletions client/src/modules/stock/entry/modals/lots.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
<div ng-if="$ctrl.enablePackaging" >
<div class="form-group">
<label class="control-label" translate>FORM.LABELS.NUMBER_PACKAGES</label>
<span
uib-popover="{{ 'FORM.INFO.NUMBER_PACKAGE_INFO' | translate }}"
popover-placement="right"
popover-trigger="'mouseenter'"
popover-append-to-body="true">
<i class="text-primary fa fa-info-circle"></i>
</span>

<input
class="form-control"
Expand All @@ -38,6 +45,13 @@

<div class="form-group">
<label class="control-label" translate>FORM.LABELS.PACK_SIZE</label>
<span
uib-popover="{{ 'FORM.INFO.PACK_SIZE_INFO' | translate }}"
popover-placement="right"
popover-trigger="'mouseenter'"
popover-append-to-body="true">
<i class="text-primary fa fa-info-circle"></i>
</span>
<input
class="form-control"
type="number"
Expand All @@ -51,6 +65,13 @@

<div class="form-group">
<label translate>FORM.LABELS.PACKAGE_UNIT_COST</label>
<span
uib-popover="{{ 'FORM.INFO.PACKAGE_UNIT_COST_INFO' | translate }}"
popover-placement="right"
popover-trigger="'mouseenter'"
popover-append-to-body="true">
<i class="text-primary fa fa-info-circle"></i>
</span>
<div ng-if="$ctrl.isCostEditable" class="input-group">
<input
class="form-control"
Expand Down
18 changes: 16 additions & 2 deletions client/src/modules/stock/lots/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ angular.module('bhima.controllers')
StockLotsController.$inject = [
'StockService', 'NotifyService', 'uiGridConstants', 'StockModalService', 'LanguageService',
'GridGroupingService', 'GridStateService', 'GridColumnService', '$state', '$httpParamSerializer',
'BarcodeService', 'LotsRegistryService', 'moment', 'bhConstants', 'ReceiptModal',
'BarcodeService', 'LotsRegistryService', 'moment', 'bhConstants', 'ReceiptModal', 'SessionService',
];

/**
Expand All @@ -14,10 +14,12 @@ StockLotsController.$inject = [
function StockLotsController(
Stock, Notify, uiGridConstants, Modal, Languages,
Grouping, GridState, Columns, $state, $httpParamSerializer,
Barcode, LotsRegistry, moment, bhConstants, Receipts,
Barcode, LotsRegistry, moment, bhConstants, Receipts, Session,
) {
const vm = this;
const cacheKey = 'lot-grid';
vm.displayPackaging = false;

const stockLotFilters = Stock.filter.lot;

vm.bhConstants = bhConstants;
Expand All @@ -31,6 +33,8 @@ function StockLotsController(
// show lot barcode
vm.openLotBarcodeModal = openLotBarcodeModal;

vm.stockSettings = Session.stock_settings;

// options for the UI grid
vm.gridOptions = {
appScopeProvider : vm,
Expand All @@ -51,6 +55,13 @@ function StockLotsController(
// expose to the view model
vm.grouping = new Grouping(vm.gridOptions, false, 'depot_text', true, true);

const columnPackaging = vm.gridOptions.columnDefs.find(col => col.field === 'packaging');
if (vm.stockSettings.enable_packaging_pharmaceutical_products) {
vm.displayPackaging = true;
}

columnPackaging.visible = vm.displayPackaging;

vm.getQueryString = Stock.getQueryString;
vm.clearGridState = clearGridState;
vm.search = search;
Expand Down Expand Up @@ -168,6 +179,9 @@ function StockLotsController(
lots.forEach((lot) => {
const delay = moment(new Date(lot.expiration_date)).diff(current);
lot.delay_expiration = moment.duration(delay).humanize(true);
if (lot.package_size > 1) {
lot.numberPackage = Math.floor(lot.quantity / lot.package_size);
}

if (lot.expired) {
totals.expired += 1;
Expand Down
8 changes: 8 additions & 0 deletions client/src/modules/stock/lots/registry.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ function LotsRegistryService(uiGridConstants, Session) {
headerTooltip : 'FORM.LABELS.DESCRIPTION',
headerCellFilter : 'translate',
visible : false,
}, {
field : 'packaging',
displayName : '',
width : 40,
headerCellFilter : 'translate',
cellFilter : 'translate',
visible : false,
cellTemplate : 'modules/stock/lots/templates/packaging.cell.tmpl.html',
}, {
field : 'quantity',
displayName : 'STOCK.QUANTITY',
Expand Down
8 changes: 8 additions & 0 deletions client/src/modules/stock/lots/templates/pack_info.tmpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="text-left">
<strong translate> FORM.LABELS.NUMBER_PACKAGES </strong> : {{ row.entity.numberPackage | number }} <br>
<strong translate> FORM.LABELS.PACK_SIZE </strong> : {{ row.entity.package_size }} <br>
<span ng-if="(row.entity.quantity % row.entity.package_size) > 0">
_______________<br>
<strong translate> FORM.LABELS.BULK_QUANTITY</strong> : {{ (row.entity.quantity % row.entity.package_size) | number }} <em> {{ row.entity.unit_type | translate }} </em>
</span>
</div>
10 changes: 10 additions & 0 deletions client/src/modules/stock/lots/templates/packaging.cell.tmpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="ui-grid-cell-contents text-center">
<span
ng-if="row.entity.package_size > 1"
uib-popover-template="'modules/stock/lots/templates/pack_info.tmpl.html'"
popover-placement="right"
popover-trigger="'mouseenter'"
popover-append-to-body="true">
<i class="fa fa-cube text-info"></i>
</span>
</div>
2 changes: 1 addition & 1 deletion server/controllers/stock/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ async function getLotsDepot(depotUuid, params, finalClause) {
SUM(m.quantity * IF(m.is_exit = 1, -1, 1)) AS quantity,
SUM(m.quantity) AS mvt_quantity,
d.text AS depot_text, l.unit_cost, l.expiration_date,
l.serial_number, l.reference_number,
l.serial_number, l.reference_number, l.package_size,
d.min_months_security_stock, d.default_purchase_interval,
DATEDIFF(l.expiration_date, CURRENT_DATE()) AS lifetime,
BUID(l.inventory_uuid) AS inventory_uuid,
Expand Down

0 comments on commit 394de7e

Please sign in to comment.