@openmrs/esm-stock-management-app 1.0.1-pre.327
Sign up to get free protection for your applications and to get access to all the features.
- package/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +39 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/LICENSE +401 -0
- package/README.md +3 -0
- package/__mocks__/react-i18next.js +55 -0
- package/dist/26.js +2 -0
- package/dist/26.js.LICENSE.txt +32 -0
- package/dist/26.js.map +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/294.js.map +1 -0
- package/dist/375.js +2 -0
- package/dist/375.js.LICENSE.txt +40 -0
- package/dist/375.js.map +1 -0
- package/dist/46.js +1 -0
- package/dist/46.js.map +1 -0
- package/dist/484.js +1 -0
- package/dist/484.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/629.js +1 -0
- package/dist/629.js.map +1 -0
- package/dist/707.js +1 -0
- package/dist/707.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/935.js +2 -0
- package/dist/935.js.LICENSE.txt +19 -0
- package/dist/935.js.map +1 -0
- package/dist/979.js +1 -0
- package/dist/979.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +60 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-stock-management-app.js +1 -0
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +356 -0
- package/dist/openmrs-esm-stock-management-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +25 -0
- package/package.json +116 -0
- package/src/config-schema.ts +18 -0
- package/src/constants.ts +214 -0
- package/src/core/api/api.ts +34 -0
- package/src/core/api/types/Auditable.ts +9 -0
- package/src/core/api/types/BaseOpenmrsData.ts +4 -0
- package/src/core/api/types/BaseOpenmrsMetadata.ts +6 -0
- package/src/core/api/types/BaseOpenmrsObject.ts +3 -0
- package/src/core/api/types/BatchJob.ts +121 -0
- package/src/core/api/types/DashboardExtension.ts +8 -0
- package/src/core/api/types/Location.ts +16 -0
- package/src/core/api/types/LocationTree.ts +7 -0
- package/src/core/api/types/OpenmrsData.ts +5 -0
- package/src/core/api/types/OpenmrsMetadata.ts +8 -0
- package/src/core/api/types/OpenmrsObject.ts +3 -0
- package/src/core/api/types/PageableResult.ts +15 -0
- package/src/core/api/types/Party.ts +8 -0
- package/src/core/api/types/RecordPermission.ts +9 -0
- package/src/core/api/types/Retireable.ts +9 -0
- package/src/core/api/types/Voidable.ts +9 -0
- package/src/core/api/types/concept/Concept.ts +24 -0
- package/src/core/api/types/concept/ConceptName.ts +14 -0
- package/src/core/api/types/concept/Drug.ts +14 -0
- package/src/core/api/types/identity/Credentials.ts +4 -0
- package/src/core/api/types/identity/Patient.ts +3 -0
- package/src/core/api/types/identity/Person.ts +4 -0
- package/src/core/api/types/identity/PriviledgeScope.ts +9 -0
- package/src/core/api/types/identity/Privilege.ts +5 -0
- package/src/core/api/types/identity/Role.ts +5 -0
- package/src/core/api/types/identity/Session.ts +16 -0
- package/src/core/api/types/identity/User.ts +19 -0
- package/src/core/api/types/identity/UserRoleScope.ts +17 -0
- package/src/core/api/types/identity/UserRoleScopeLocation.ts +7 -0
- package/src/core/api/types/identity/UserRoleScopeOperationType.ts +6 -0
- package/src/core/api/types/stockItem/ImportResult.ts +9 -0
- package/src/core/api/types/stockItem/StockBatch.ts +8 -0
- package/src/core/api/types/stockItem/StockBatchDTO.ts +8 -0
- package/src/core/api/types/stockItem/StockItem.ts +63 -0
- package/src/core/api/types/stockItem/StockItemInventory.ts +10 -0
- package/src/core/api/types/stockItem/StockItemPackagingUOM.ts +20 -0
- package/src/core/api/types/stockItem/StockItemTransaction.ts +22 -0
- package/src/core/api/types/stockItem/StockRule.ts +28 -0
- package/src/core/api/types/stockOperation/LocationType.ts +4 -0
- package/src/core/api/types/stockOperation/StockOperation.ts +36 -0
- package/src/core/api/types/stockOperation/StockOperationAction.ts +24 -0
- package/src/core/api/types/stockOperation/StockOperationDTO.ts +64 -0
- package/src/core/api/types/stockOperation/StockOperationItem.ts +13 -0
- package/src/core/api/types/stockOperation/StockOperationItemCost.ts +14 -0
- package/src/core/api/types/stockOperation/StockOperationItemDTO.ts +29 -0
- package/src/core/api/types/stockOperation/StockOperationLinkDTO.ts +13 -0
- package/src/core/api/types/stockOperation/StockOperationStatus.ts +18 -0
- package/src/core/api/types/stockOperation/StockOperationType.ts +162 -0
- package/src/core/api/types/stockOperation/StockSource.ts +8 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.component.tsx +37 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.scss +0 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.test.tsx +8 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.component.tsx +40 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.scss +0 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.test.tsx +8 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +44 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.scss +0 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.test.tsx +8 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.component.tsx +54 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.scss +0 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.test.tsx +8 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.component.tsx +37 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.scss +0 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.test.tsx +11 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.component.tsx +37 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.scss +0 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.test.tsx +8 -0
- package/src/core/components/carbon/types.ts +7 -0
- package/src/core/components/card/metrics-card-component.tsx +102 -0
- package/src/core/components/card/metrics-card.scss +78 -0
- package/src/core/components/overlay/hook.ts +47 -0
- package/src/core/components/overlay/overlay.component.tsx +52 -0
- package/src/core/components/overlay/overlay.scss +97 -0
- package/src/core/components/side-nav/side-nav.component.tsx +62 -0
- package/src/core/components/side-nav/side-nav.scss +126 -0
- package/src/core/components/side-nav/types.ts +6 -0
- package/src/core/components/table/table.component.tsx +239 -0
- package/src/core/components/table/table.scss +173 -0
- package/src/core/components/table/types.ts +8 -0
- package/src/core/components/tabs/types.ts +7 -0
- package/src/core/components/tabs/vertical-tabs.component.tsx +53 -0
- package/src/core/components/tabs/vertical-tabs.scss +126 -0
- package/src/core/hooks/debounce-hook.ts +35 -0
- package/src/core/print/PrintStyles.ts +774 -0
- package/src/core/print/PrintTemplate.ts +65 -0
- package/src/core/print/printUtils.ts +19 -0
- package/src/core/utils/alert.ts +10 -0
- package/src/core/utils/datetimeUtils.ts +84 -0
- package/src/core/utils/debounce.ts +21 -0
- package/src/core/utils/imageUtils.ts +82 -0
- package/src/core/utils/stringUtils.ts +27 -0
- package/src/core/utils/utils.ts +70 -0
- package/src/createDashboardLink.tsx +43 -0
- package/src/dashboard/stock-management-dashboard-side-nav.component.tsx +50 -0
- package/src/dashboard/stock-management-dashboard.component.tsx +41 -0
- package/src/dashboard/stock-management-dashboard.scss +8 -0
- package/src/dashboard.meta.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/index.ts +64 -0
- package/src/root.component.tsx +12 -0
- package/src/root.scss +174 -0
- package/src/routes.json +53 -0
- package/src/setup-tests.ts +1 -0
- package/src/stock-app-menu-item/item.component.tsx +21 -0
- package/src/stock-app-menu-item/item.resource.ts +0 -0
- package/src/stock-app-menu-item/item.scss +17 -0
- package/src/stock-batch/stock-batch.resource.ts +79 -0
- package/src/stock-home/stock-home-detail-card.scss +211 -0
- package/src/stock-home/stock-home-detail-cards.component.tsx +62 -0
- package/src/stock-home/stock-home-inventory-card.component.tsx +80 -0
- package/src/stock-home/stock-home-inventory-expiry.resource.tsx +32 -0
- package/src/stock-home/stock-home-inventory-items.resource.tsx +28 -0
- package/src/stock-home/stock-home-issuing-card.component.tsx +84 -0
- package/src/stock-home/stock-home-issuing.resource.tsx +18 -0
- package/src/stock-home/stock-home-landing-page-component.tsx +14 -0
- package/src/stock-home/stock-home-metrics.tsx +112 -0
- package/src/stock-home/stock-home-receiving-card.component.tsx +66 -0
- package/src/stock-home/stock-home-receiving.resource.tsx +17 -0
- package/src/stock-home/stock-home.scss +13 -0
- package/src/stock-home/useDisposalList.tsx +18 -0
- package/src/stock-home/useStockList.tsx +36 -0
- package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +26 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.component.tsx +109 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +14 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.scss +0 -0
- package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +21 -0
- package/src/stock-items/add-stock-item/add-stock-item.component.tsx +84 -0
- package/src/stock-items/add-stock-item/add-stock-item.resource.tsx +36 -0
- package/src/stock-items/add-stock-item/add-stock-item.scss +5 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.component.tsx +98 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.resource.tsx +71 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.scss +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.component.tsx +79 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.scss +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/dispensing-package-measurement/dispensing-package-measurement.component.tsx +76 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.component.tsx +66 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.scss +0 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.component.tsx +83 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.resource.tsx +50 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.scss +0 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +255 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +38 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +21 -0
- package/src/stock-items/add-stock-item/packaging-units/validationSchema.ts +14 -0
- package/src/stock-items/add-stock-item/packaging-units-concept-selector/packaging-units-concept-selector.component.tsx +95 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.component.tsx +70 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.scss +0 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/quantities/quantities.component.tsx +83 -0
- package/src/stock-items/add-stock-item/quantities/quantities.resource.tsx +69 -0
- package/src/stock-items/add-stock-item/quantities/quantities.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.component.tsx +67 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +239 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.resource.tsx +14 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rule-button.component.tsx +30 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +424 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +18 -0
- package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +47 -0
- package/src/stock-items/add-stock-item/stock-item-rules/edit-stock-rule.component.tsx +37 -0
- package/src/stock-items/add-stock-item/stock-item-rules/edit-stock-rule.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +222 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.resource.tsx +72 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.component.tsx +67 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.component.tsx +38 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules.resource.ts +79 -0
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +132 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.component.tsx +16 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.scss +0 -0
- package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +151 -0
- package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +109 -0
- package/src/stock-items/add-stock-item/transactions/transactions.scss +0 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.component.tsx +28 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.resource.tsx +0 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.scss +3 -0
- package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +30 -0
- package/src/stock-items/stock-item.utils.tsx +62 -0
- package/src/stock-items/stock-items-table.component.tsx +266 -0
- package/src/stock-items/stock-items-table.resource.ts +58 -0
- package/src/stock-items/stock-items-table.scss +66 -0
- package/src/stock-items/stock-items.component.tsx +12 -0
- package/src/stock-items/stock-items.resource.ts +365 -0
- package/src/stock-items/types.ts +8 -0
- package/src/stock-items/validationSchema.ts +67 -0
- package/src/stock-locations/stock-locations-table.component.tsx +69 -0
- package/src/stock-locations/stock-locations-table.resource.tsx +73 -0
- package/src/stock-locations/stock-locations-table.scss +0 -0
- package/src/stock-locations/stock-locations.component.tsx +12 -0
- package/src/stock-locations/stock-locations.resource.ts +0 -0
- package/src/stock-lookups/stock-lookups.resource.ts +306 -0
- package/src/stock-management-admin-card-link.component.tsx +29 -0
- package/src/stock-management-header/stock-management-Illustration.tsx +35 -0
- package/src/stock-management-header/stock-management-header.component.tsx +37 -0
- package/src/stock-management-header/stock-management-header.scss +58 -0
- package/src/stock-management.component.tsx +6 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +491 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +33 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.scss +44 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +241 -0
- package/src/stock-operations/add-stock-operation/add-stock-utils.ts +110 -0
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +352 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +347 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.resource.tsx +0 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.scss +0 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.test.tsx +11 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.scss +5 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.tsx +272 -0
- package/src/stock-operations/add-stock-operation/stock-operation-context/useStockOperationContext.tsx +22 -0
- package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +188 -0
- package/src/stock-operations/add-stock-operation/types.ts +55 -0
- package/src/stock-operations/add-stock-operation/validationSchema.ts +45 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.component.tsx +100 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.resource.tsx +46 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.scss +0 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.test.tsx +11 -0
- package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +73 -0
- package/src/stock-operations/party-selector/party-selector.component.tsx +58 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.component.tsx +65 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.resource.tsx +0 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.scss +0 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.test.tsx +11 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.component.tsx +74 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.resource.tsx +47 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.scss +0 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.test.tsx +11 -0
- package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.component.tsx +27 -0
- package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.scss +13 -0
- package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +65 -0
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.component.tsx +30 -0
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.scss +13 -0
- package/src/stock-operations/stock-operation-statuses-filter/stock-operation-statuses-filter.component.tsx +32 -0
- package/src/stock-operations/stock-operation-statuses-filter/stock-operation-statuses-filter.scss +13 -0
- package/src/stock-operations/stock-operation-types-selector/stock-operation-types-selector.component.tsx +80 -0
- package/src/stock-operations/stock-operation.utils.tsx +106 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-approve-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-approve-dispatch-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-cancel-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-complete-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-completed-dispatch-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +167 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss +14 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +58 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-print-button.component.tsx +160 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-reject-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-return-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-table.component.tsx +524 -0
- package/src/stock-operations/stock-operations-table.resource.tsx +77 -0
- package/src/stock-operations/stock-operations-table.scss +0 -0
- package/src/stock-operations/stock-operations.component.tsx +12 -0
- package/src/stock-operations/stock-operations.resource.ts +238 -0
- package/src/stock-operations/stock-print-reports/GoodsReceivedNote.tsx +147 -0
- package/src/stock-operations/stock-print-reports/RequisitionDocument.tsx +153 -0
- package/src/stock-operations/stock-print-reports/StockOperationReport.tsx +133 -0
- package/src/stock-operations/stock-print-reports/StockTransferDocument.tsx +161 -0
- package/src/stock-operations/swr-revalidation.ts +7 -0
- package/src/stock-operations/users-selector/users-selector.component.tsx +77 -0
- package/src/stock-operations/users-selector/users-selector.resource.tsx +47 -0
- package/src/stock-operations/validation-schema.ts +195 -0
- package/src/stock-reports/ReportType.ts +63 -0
- package/src/stock-reports/stock-reports.component.tsx +0 -0
- package/src/stock-reports/stock-reports.resource.ts +0 -0
- package/src/stock-settings/stock-settings.component.tsx +11 -0
- package/src/stock-settings/stock-settings.resource.ts +0 -0
- package/src/stock-sources/add-stock-source-button.component.tsx +21 -0
- package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +152 -0
- package/src/stock-sources/add-stock-sources/add-stock-sources.scss +18 -0
- package/src/stock-sources/delete-stock-modal.component.tsx +47 -0
- package/src/stock-sources/edit-stock-source/edit-stock-source.component.tsx +35 -0
- package/src/stock-sources/edit-stock-source/edit-stock-source.scss +0 -0
- package/src/stock-sources/stock-sources-delete/stock-sources-delate.scss +0 -0
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +72 -0
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +35 -0
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.scss +13 -0
- package/src/stock-sources/stock-sources-items-table.component.tsx +213 -0
- package/src/stock-sources/stock-sources-items-table.resource.ts +56 -0
- package/src/stock-sources/stock-sources.component.tsx +12 -0
- package/src/stock-sources/stock-sources.resource.ts +80 -0
- package/src/stock-sources/stock-sources.scss +220 -0
- package/src/stock-sources/swr-revalidation.ts +7 -0
- package/src/stock-tabs/commodity-tabs.component.tsx +43 -0
- package/src/stock-tabs/commodity-tabs.scss +0 -0
- package/src/stock-user-role-scopes/add-stock-user-role-scope-button.component.tsx +21 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +525 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +37 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +73 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.scss +0 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +47 -0
- package/src/stock-user-role-scopes/edit-stock-user-scope/edit-stock-user-scope-action-menu.component.tsx +35 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +284 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.resource.ts +31 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.component.tsx +12 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.resource.ts +76 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.scss +61 -0
- package/src/stock-user-role-scopes/swr-revalidation.ts +7 -0
- package/src/utils.ts +10 -0
- package/translations/en.json +24 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +1 -0
@@ -0,0 +1,238 @@
|
|
1
|
+
import { FetchResponse, openmrsFetch } from "@openmrs/esm-framework";
|
2
|
+
import useSWR from "swr";
|
3
|
+
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
4
|
+
import { PageableResult } from "../core/api/types/PageableResult";
|
5
|
+
import { StockOperationDTO } from "../core/api/types/stockOperation/StockOperationDTO";
|
6
|
+
import { StockOperationLinkDTO } from "../core/api/types/stockOperation/StockOperationLinkDTO";
|
7
|
+
import { StopOperationAction } from "../core/api/types/stockOperation/StockOperationAction";
|
8
|
+
import { InventoryGroupBy } from "../core/api/types/stockItem/StockItem";
|
9
|
+
|
10
|
+
export interface StockOperationFilter extends ResourceFilterCriteria {
|
11
|
+
status?: string | null | undefined;
|
12
|
+
operationTypeUuid?: string | null | undefined;
|
13
|
+
locationUuid?: string | null | undefined;
|
14
|
+
isLocationOther?: boolean | null | undefined;
|
15
|
+
stockItemUuid?: string | null | undefined;
|
16
|
+
operationDateMin?: string | null | undefined;
|
17
|
+
operationDateMax?: string | null | undefined;
|
18
|
+
sourceTypeUuid?: string | null | undefined;
|
19
|
+
}
|
20
|
+
|
21
|
+
export interface StockItemInventoryFilter extends ResourceFilterCriteria {
|
22
|
+
stockItemUuid?: string | null;
|
23
|
+
partyUuid?: string | null;
|
24
|
+
locationUuid?: string | null;
|
25
|
+
includeBatchNo?: boolean | null;
|
26
|
+
stockBatchUuid?: string | null;
|
27
|
+
groupBy?: InventoryGroupBy | null;
|
28
|
+
totalBy?: InventoryGroupBy | null;
|
29
|
+
stockOperationUuid?: string | null;
|
30
|
+
date?: string | null;
|
31
|
+
includeStockItemName?: "true" | "false" | "0" | "1";
|
32
|
+
excludeExpired?: boolean | null;
|
33
|
+
}
|
34
|
+
|
35
|
+
// getStockOperations
|
36
|
+
export function useStockOperations(filter: StockOperationFilter) {
|
37
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation${toQueryParams(
|
38
|
+
filter
|
39
|
+
)}`;
|
40
|
+
const { data, error, isLoading } = useSWR<
|
41
|
+
{ data: PageableResult<StockOperationDTO> },
|
42
|
+
Error
|
43
|
+
>(apiUrl, openmrsFetch);
|
44
|
+
|
45
|
+
return {
|
46
|
+
items: data?.data || <PageableResult<StockOperationDTO>>{},
|
47
|
+
isLoading,
|
48
|
+
isError: error,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
// getStockOperationLinks
|
53
|
+
export function useStockOperationLinks(filter: string) {
|
54
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperationlink?v=default&q=${filter}`;
|
55
|
+
const { data, error, isLoading } = useSWR<
|
56
|
+
{ data: PageableResult<StockOperationLinkDTO> },
|
57
|
+
Error
|
58
|
+
>(apiUrl, openmrsFetch);
|
59
|
+
return {
|
60
|
+
items: data.data ? data.data : [],
|
61
|
+
isLoading,
|
62
|
+
isError: error,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
|
66
|
+
// getStockOperation
|
67
|
+
export function useStockOperation(id: string) {
|
68
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation/${id}`;
|
69
|
+
const { data, error, isLoading } = useSWR<{ data: StockOperationDTO }, Error>(
|
70
|
+
apiUrl,
|
71
|
+
openmrsFetch
|
72
|
+
);
|
73
|
+
return {
|
74
|
+
items: data.data ? data.data : {},
|
75
|
+
isLoading,
|
76
|
+
isError: error,
|
77
|
+
};
|
78
|
+
} // getStockOperation
|
79
|
+
export function getStockOperation(
|
80
|
+
id: string
|
81
|
+
): Promise<FetchResponse<StockOperationDTO>> {
|
82
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation/${id}?v=full`;
|
83
|
+
|
84
|
+
return openmrsFetch(apiUrl);
|
85
|
+
}
|
86
|
+
|
87
|
+
// getStockOperationAndItems
|
88
|
+
export function useStockOperationAndItems(id: string) {
|
89
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation/${id}?v=full`;
|
90
|
+
const { data, error, isLoading } = useSWR<{ data: StockOperationDTO }, Error>(
|
91
|
+
apiUrl,
|
92
|
+
openmrsFetch
|
93
|
+
);
|
94
|
+
return {
|
95
|
+
items: data.data ? data.data : {},
|
96
|
+
isLoading,
|
97
|
+
isError: error,
|
98
|
+
};
|
99
|
+
}
|
100
|
+
|
101
|
+
// deleteStockOperations
|
102
|
+
export function deleteStockOperations(ids: string[]) {
|
103
|
+
let otherIds = ids.reduce((p, c, i) => {
|
104
|
+
if (i === 0) return p;
|
105
|
+
p += (p.length > 0 ? "," : "") + encodeURIComponent(c);
|
106
|
+
return p;
|
107
|
+
}, "");
|
108
|
+
if (otherIds.length > 0) {
|
109
|
+
otherIds = "?ids=" + otherIds;
|
110
|
+
}
|
111
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation/${ids[0]}${otherIds}`;
|
112
|
+
const abortController = new AbortController();
|
113
|
+
return openmrsFetch(apiUrl, {
|
114
|
+
method: "DELETE",
|
115
|
+
headers: {
|
116
|
+
"Content-Type": "application/json",
|
117
|
+
},
|
118
|
+
signal: abortController.signal,
|
119
|
+
});
|
120
|
+
}
|
121
|
+
|
122
|
+
// deleteStockOperationItem
|
123
|
+
export function deleteStockOperationItem(id: string) {
|
124
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperationitem/${id}`;
|
125
|
+
const abortController = new AbortController();
|
126
|
+
return openmrsFetch(apiUrl, {
|
127
|
+
method: "DELETE",
|
128
|
+
headers: {
|
129
|
+
"Content-Type": "application/json",
|
130
|
+
},
|
131
|
+
signal: abortController.signal,
|
132
|
+
});
|
133
|
+
}
|
134
|
+
|
135
|
+
// createStockOperation
|
136
|
+
export function createStockOperation(item: StockOperationDTO) {
|
137
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation`;
|
138
|
+
const abortController = new AbortController();
|
139
|
+
return openmrsFetch(apiUrl, {
|
140
|
+
method: "POST",
|
141
|
+
headers: {
|
142
|
+
"Content-Type": "application/json",
|
143
|
+
},
|
144
|
+
signal: abortController.signal,
|
145
|
+
body: item,
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
// updateStockOperation
|
150
|
+
export function updateStockOperation(item: StockOperationDTO) {
|
151
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperation/${item.uuid}`;
|
152
|
+
const abortController = new AbortController();
|
153
|
+
return openmrsFetch(apiUrl, {
|
154
|
+
method: "POST",
|
155
|
+
headers: {
|
156
|
+
"Content-Type": "application/json",
|
157
|
+
},
|
158
|
+
signal: abortController.signal,
|
159
|
+
body: item,
|
160
|
+
});
|
161
|
+
}
|
162
|
+
|
163
|
+
// executeStockOperationAction
|
164
|
+
export function executeStockOperationAction(item: StopOperationAction) {
|
165
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperationaction`;
|
166
|
+
const abortController = new AbortController();
|
167
|
+
return openmrsFetch(apiUrl, {
|
168
|
+
method: "POST",
|
169
|
+
headers: {
|
170
|
+
"Content-Type": "application/json",
|
171
|
+
},
|
172
|
+
signal: abortController.signal,
|
173
|
+
body: item,
|
174
|
+
});
|
175
|
+
}
|
176
|
+
|
177
|
+
// updateStockOperationBatchNumbers
|
178
|
+
export function updateStockOperationBatchNumbers(
|
179
|
+
item: StockOperationDTO,
|
180
|
+
uuid: string
|
181
|
+
) {
|
182
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperationbatchnumbers/${uuid}`;
|
183
|
+
const abortController = new AbortController();
|
184
|
+
return openmrsFetch(apiUrl, {
|
185
|
+
method: "POST",
|
186
|
+
headers: {
|
187
|
+
"Content-Type": "application/json",
|
188
|
+
},
|
189
|
+
signal: abortController.signal,
|
190
|
+
body: item,
|
191
|
+
});
|
192
|
+
}
|
193
|
+
|
194
|
+
// get stock operation itemcosts
|
195
|
+
export function getStockOperationItemsCost(filter: StockOperationFilter) {
|
196
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=${filter}`;
|
197
|
+
const abortController = new AbortController();
|
198
|
+
return openmrsFetch(apiUrl, {
|
199
|
+
method: "GET",
|
200
|
+
headers: {
|
201
|
+
"Content-Type": "application/json",
|
202
|
+
},
|
203
|
+
signal: abortController.signal,
|
204
|
+
});
|
205
|
+
}
|
206
|
+
// get stockiteminvoentory
|
207
|
+
export function getStockItemInventory(filter: StockItemInventoryFilter) {
|
208
|
+
const apiUrl = `ws/rest/v1/stockmanagement/stockiteminventory${toQueryParams(
|
209
|
+
filter
|
210
|
+
)}`;
|
211
|
+
const abortController = new AbortController();
|
212
|
+
return openmrsFetch(apiUrl, {
|
213
|
+
method: "GET",
|
214
|
+
headers: {
|
215
|
+
"Content-Type": "application/json",
|
216
|
+
},
|
217
|
+
signal: abortController.signal,
|
218
|
+
});
|
219
|
+
}
|
220
|
+
|
221
|
+
export const operationStatusColor = (status: string) => {
|
222
|
+
switch (status) {
|
223
|
+
case "NEW":
|
224
|
+
return "#0f62fe";
|
225
|
+
case "SUBMITTED":
|
226
|
+
return "#4589ff";
|
227
|
+
case "DISPATCHED":
|
228
|
+
return "#8a3ffc";
|
229
|
+
case "COMPLETED":
|
230
|
+
return "#24a148";
|
231
|
+
case "CANCELLED":
|
232
|
+
return "#da1e28";
|
233
|
+
case "RETURNED":
|
234
|
+
return "#eb6200";
|
235
|
+
default:
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
};
|
@@ -0,0 +1,147 @@
|
|
1
|
+
import { CLOSE_PRINT_AFTER_PRINT } from "../../constants";
|
2
|
+
import { formatDisplayDate } from "../../core/utils/datetimeUtils";
|
3
|
+
import {
|
4
|
+
GetHeaderSection,
|
5
|
+
GetPrintTemplate,
|
6
|
+
} from "../../core/print/PrintTemplate";
|
7
|
+
import { printDocument } from "../../core/print/printUtils";
|
8
|
+
import { StockOperationPrintData } from "./StockOperationReport";
|
9
|
+
|
10
|
+
export const FormatGoodsReceivedDocument = async (
|
11
|
+
data: StockOperationPrintData
|
12
|
+
): Promise<string> => {
|
13
|
+
const emptyRowCount: number = Math.max(0, 25 - (data?.items?.length ?? 0));
|
14
|
+
const headerSection = await GetHeaderSection();
|
15
|
+
return `
|
16
|
+
<div>
|
17
|
+
${headerSection}
|
18
|
+
<div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">
|
19
|
+
<b>Goods Received Note</b>
|
20
|
+
</div>
|
21
|
+
<div class="heading-row text">
|
22
|
+
<span>Name of Health Unit: </span>
|
23
|
+
<b><span>${data?.organizationName ?? ""}</span></b>
|
24
|
+
</div>
|
25
|
+
<div class="heading-row text">
|
26
|
+
<table style="width:99%" border="0" cellspacing="0" cellpadding="0">
|
27
|
+
<tr>
|
28
|
+
<td style="text-align: left;">
|
29
|
+
<span>Delivered To: </span>
|
30
|
+
<b><span>${data?.location ?? ""}</span></b>
|
31
|
+
</td>
|
32
|
+
<td style="text-align: right;">
|
33
|
+
<span>GRN#: </span>
|
34
|
+
<b><span>${data?.operationNumber}</span></b>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
</table>
|
38
|
+
</div>
|
39
|
+
<div class="heading-row text">
|
40
|
+
<table style="width:99%" border="0" cellspacing="0" cellpadding="0">
|
41
|
+
<tr>
|
42
|
+
<td style="text-align: left;">
|
43
|
+
<span>Received From: </span>
|
44
|
+
<b><span>${data?.source ?? ""}</span></b>
|
45
|
+
</td>
|
46
|
+
<td style="text-align: right;">
|
47
|
+
<span>Date: </span>
|
48
|
+
<b><span>${formatDisplayDate(
|
49
|
+
data?.operationDate
|
50
|
+
)}</span></b>
|
51
|
+
</td>
|
52
|
+
</tr>
|
53
|
+
</table>
|
54
|
+
</div>
|
55
|
+
<table class="table-data" border="0" cellspacing="0" cellpadding="0">
|
56
|
+
<tr>
|
57
|
+
<th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>
|
58
|
+
<th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>
|
59
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>
|
60
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>
|
61
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>
|
62
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>
|
63
|
+
</tr>
|
64
|
+
${
|
65
|
+
data?.items
|
66
|
+
? data?.items
|
67
|
+
.map((p) => {
|
68
|
+
return `
|
69
|
+
<tr class="data-row">
|
70
|
+
<td valign="middle">${p.itemCode ?? ""}</td>
|
71
|
+
<td valign="middle">${
|
72
|
+
p.itemDescription ?? ""
|
73
|
+
}</td>
|
74
|
+
<td valign="middle" class="center">${
|
75
|
+
p.batchNumber ?? ""
|
76
|
+
}</td>
|
77
|
+
<td valign="middle" class="center">${formatDisplayDate(
|
78
|
+
p.expiryDate
|
79
|
+
)}</td>
|
80
|
+
<td valign="middle" class="center">${
|
81
|
+
p.quantityRequired?.toLocaleString() ?? ""
|
82
|
+
} ${p.quantityRequiredUoM ?? ""}</td>
|
83
|
+
<td valign="middle" class="center">${
|
84
|
+
p.purchasePrice?.toLocaleString() ?? ""
|
85
|
+
}</td>
|
86
|
+
</tr>
|
87
|
+
`;
|
88
|
+
})
|
89
|
+
.join("")
|
90
|
+
: ""
|
91
|
+
}
|
92
|
+
${
|
93
|
+
emptyRowCount > 0
|
94
|
+
? Array(emptyRowCount)
|
95
|
+
.fill(0)
|
96
|
+
.map(
|
97
|
+
(p) => `
|
98
|
+
<tr class="data-row">
|
99
|
+
<td valign="middle"> </td>
|
100
|
+
<td valign="middle"> </td>
|
101
|
+
<td valign="middle" class="center"> </td>
|
102
|
+
<td valign="middle" class="center"> </td>
|
103
|
+
<td valign="middle" class="center"> </td>
|
104
|
+
<td valign="middle" class="center"> </td>
|
105
|
+
</tr>`
|
106
|
+
)
|
107
|
+
.join("")
|
108
|
+
: ""
|
109
|
+
}
|
110
|
+
<tr class="footer-field">
|
111
|
+
<td valign="middle" colspan="6" style="border:0;padding-top: 15pt;">
|
112
|
+
Remarks:<br/>
|
113
|
+
${data?.remarks ?? ""}
|
114
|
+
</td>
|
115
|
+
</tr>
|
116
|
+
<tr class="footer-field">
|
117
|
+
<td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">
|
118
|
+
Received By:<br/>
|
119
|
+
<b>${data?.responsiblePerson ?? ""}</b>
|
120
|
+
</td>
|
121
|
+
<td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">
|
122
|
+
Checked By:<br/>
|
123
|
+
|
124
|
+
</td>
|
125
|
+
</tr>
|
126
|
+
<tr class="footer-field">
|
127
|
+
<td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>
|
128
|
+
<td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>
|
129
|
+
</tr>
|
130
|
+
</table>
|
131
|
+
</div>
|
132
|
+
`;
|
133
|
+
};
|
134
|
+
|
135
|
+
export const PrintGoodsReceivedNoteStockOperation = async (
|
136
|
+
data: StockOperationPrintData
|
137
|
+
) => {
|
138
|
+
const printData = await FormatGoodsReceivedDocument(data);
|
139
|
+
printDocument(
|
140
|
+
GetPrintTemplate(
|
141
|
+
printData,
|
142
|
+
data?.documentTitle,
|
143
|
+
true,
|
144
|
+
CLOSE_PRINT_AFTER_PRINT
|
145
|
+
)
|
146
|
+
);
|
147
|
+
};
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import { formatDisplayDate } from "../../core/utils/datetimeUtils";
|
2
|
+
import {
|
3
|
+
GetHeaderSection,
|
4
|
+
GetPrintTemplate,
|
5
|
+
} from "../../core/print/PrintTemplate";
|
6
|
+
import {
|
7
|
+
CLOSE_PRINT_AFTER_PRINT,
|
8
|
+
STOCK_OPERATION_PRINT_DISABLE_BALANCE_ON_HAND,
|
9
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS,
|
10
|
+
} from "../../constants";
|
11
|
+
import { printDocument } from "../../core/print/printUtils";
|
12
|
+
import { StockOperationPrintData } from "./StockOperationReport";
|
13
|
+
|
14
|
+
export const FormatRequisitionDocument = async (
|
15
|
+
data: StockOperationPrintData
|
16
|
+
): Promise<string> => {
|
17
|
+
const emptyRowCount: number = Math.max(0, 28 - (data?.items?.length ?? 0));
|
18
|
+
const headerSection = await GetHeaderSection();
|
19
|
+
return `
|
20
|
+
<div>
|
21
|
+
${headerSection}
|
22
|
+
<div class="heading text">
|
23
|
+
<b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>
|
24
|
+
</div>
|
25
|
+
<div class="heading-row text">
|
26
|
+
<span>Name of Health Unit: </span>
|
27
|
+
<b><span>${data?.organizationName ?? ""}</span></b>
|
28
|
+
</div>
|
29
|
+
<div class="heading-row text">
|
30
|
+
<table style="width:99%" border="0" cellspacing="0" cellpadding="0">
|
31
|
+
<tr>
|
32
|
+
<td style="text-align: left;">
|
33
|
+
<span>Dept/section/ward/dispensary: </span>
|
34
|
+
<b><span>${data?.location ?? ""}</span></b>
|
35
|
+
</td>
|
36
|
+
<td style="text-align: right;">
|
37
|
+
<span>Date: </span>
|
38
|
+
<b><span>${formatDisplayDate(
|
39
|
+
data?.operationDate
|
40
|
+
)}</span></b>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
</table>
|
44
|
+
</div>
|
45
|
+
<table class="table-data" border="0" cellspacing="0" cellpadding="0">
|
46
|
+
<tr>
|
47
|
+
<td colspan="4" valign="top" style='border:solid black 1.0pt;height:40pt'>
|
48
|
+
<div class='text'><b>Ordered by (Name and signature):</b></div>
|
49
|
+
<p class='text' style='margin-top: 1pt;'>${
|
50
|
+
data.orderedBy ?? " "
|
51
|
+
}</p>
|
52
|
+
</td>
|
53
|
+
<td colspan="4" valign="top" style='border:solid black 1.0pt;border-left:none;height:40pt'>
|
54
|
+
<div class='text'><b>Authorized by (Name and Signature):</b></div>
|
55
|
+
<p class='text' style='margin-top: 1pt;'>${
|
56
|
+
data.authorizedBy ?? " "
|
57
|
+
}</p>
|
58
|
+
</td>
|
59
|
+
</tr>
|
60
|
+
<tr>
|
61
|
+
<th valign="middle" class="left"><b>Item Code No.</b></th>
|
62
|
+
<th valign="middle" class="left"><b>Item Description (name, formulation, strength)</b></th>
|
63
|
+
<th valign="middle"><b>Balance on Hand</b></th>
|
64
|
+
<th valign="middle"><b>Quantity Required</b></th>
|
65
|
+
<th valign="middle"><b>Quantity Issued</b></th>
|
66
|
+
<th valign="middle"><b>Unit Cost</b></th>
|
67
|
+
<th valign="middle"><b>Total Cost</b></th>
|
68
|
+
</tr>
|
69
|
+
${
|
70
|
+
data?.items
|
71
|
+
? data?.items
|
72
|
+
.map((p) => {
|
73
|
+
return `
|
74
|
+
<tr class="data-row">
|
75
|
+
<td valign="middle">${p.itemCode ?? ""}</td>
|
76
|
+
<td valign="middle">${p.itemDescription ?? ""}</td>
|
77
|
+
<td valign="middle" class="center">${
|
78
|
+
STOCK_OPERATION_PRINT_DISABLE_BALANCE_ON_HAND ||
|
79
|
+
!p.balanceOnHand
|
80
|
+
? ""
|
81
|
+
: `${p.balanceOnHand?.toLocaleString()} ${
|
82
|
+
p.balanceOnHandUoM ?? ""
|
83
|
+
}`
|
84
|
+
}</td>
|
85
|
+
<td valign="middle" class="center">${
|
86
|
+
p.quantityRequired?.toLocaleString() ?? ""
|
87
|
+
} ${p.quantityRequiredUoM ?? ""}</td>
|
88
|
+
<td valign="middle" class="center">${
|
89
|
+
p.quantityIssued?.toLocaleString() ?? ""
|
90
|
+
} ${p.quantityIssuedUoM ?? ""}</td>
|
91
|
+
<td valign="middle" class="center">${
|
92
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS
|
93
|
+
? ""
|
94
|
+
: `${p.unitCost?.toLocaleString() ?? ""}${
|
95
|
+
p.unitCostUoM ? `/${p.unitCostUoM}` : ""
|
96
|
+
}`
|
97
|
+
}</td>
|
98
|
+
<td valign="middle" class="center">${
|
99
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS
|
100
|
+
? ""
|
101
|
+
: `${p.totalCost?.toLocaleString() ?? ""}`
|
102
|
+
}</td>
|
103
|
+
</tr>
|
104
|
+
`;
|
105
|
+
})
|
106
|
+
.join("")
|
107
|
+
: ""
|
108
|
+
}
|
109
|
+
${
|
110
|
+
emptyRowCount > 0
|
111
|
+
? Array(emptyRowCount)
|
112
|
+
.fill(0)
|
113
|
+
.map(
|
114
|
+
(p) => `
|
115
|
+
<tr class="data-row">
|
116
|
+
<td valign="middle"> </td>
|
117
|
+
<td valign="middle"> </td>
|
118
|
+
<td valign="middle" class="center"> </td>
|
119
|
+
<td valign="middle" class="center"> </td>
|
120
|
+
<td valign="middle" class="center"> </td>
|
121
|
+
<td valign="middle" class="center"> </td>
|
122
|
+
<td valign="middle" class="center"> </td>
|
123
|
+
</tr>`
|
124
|
+
)
|
125
|
+
.join("")
|
126
|
+
: ""
|
127
|
+
}
|
128
|
+
<tr class="footer-field">
|
129
|
+
<td valign="middle" colspan="3">Issue date:</td>
|
130
|
+
<td valign="middle" colspan="4">Receipt date:</td>
|
131
|
+
</tr>
|
132
|
+
<tr class="footer-field">
|
133
|
+
<td valign="middle" colspan="3">Name & Signature receiver:</td>
|
134
|
+
<td valign="middle" colspan="4">Name & Signature issuer:</td>
|
135
|
+
</tr>
|
136
|
+
</table>
|
137
|
+
</div>
|
138
|
+
`;
|
139
|
+
};
|
140
|
+
|
141
|
+
export const PrintRequisitionStockOperation = async (
|
142
|
+
data: StockOperationPrintData
|
143
|
+
) => {
|
144
|
+
const printData = await FormatRequisitionDocument(data);
|
145
|
+
printDocument(
|
146
|
+
GetPrintTemplate(
|
147
|
+
printData,
|
148
|
+
data?.documentTitle,
|
149
|
+
true,
|
150
|
+
CLOSE_PRINT_AFTER_PRINT
|
151
|
+
)
|
152
|
+
);
|
153
|
+
};
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import { StockItemInventory } from "../../core/api/types/stockItem/StockItemInventory";
|
2
|
+
import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOperationDTO";
|
3
|
+
import { StockOperationItemCost } from "../../core/api/types/stockOperation/StockOperationItemCost";
|
4
|
+
import { StockOperationItemDTO } from "../../core/api/types/stockOperation/StockOperationItemDTO";
|
5
|
+
import { HEALTH_CENTER_NAME } from "../../constants";
|
6
|
+
import { OperationType } from "../../core/api/types/stockOperation/StockOperationType";
|
7
|
+
|
8
|
+
export interface StockOperationPrintData {
|
9
|
+
operationNumber?: string;
|
10
|
+
organizationName?: string;
|
11
|
+
location?: string;
|
12
|
+
operationDate?: Date;
|
13
|
+
orderedBy?: string;
|
14
|
+
responsiblePerson?: string;
|
15
|
+
authorizedBy?: string;
|
16
|
+
items?: StockOperationItemData[];
|
17
|
+
issueDate?: Date;
|
18
|
+
receiptDate?: Date;
|
19
|
+
receiverName?: string;
|
20
|
+
issuerName?: string;
|
21
|
+
documentTitle?: string;
|
22
|
+
source?: string;
|
23
|
+
destination?: string;
|
24
|
+
remarks?: string;
|
25
|
+
}
|
26
|
+
|
27
|
+
export interface StockOperationItemData {
|
28
|
+
itemCode?: string;
|
29
|
+
itemDescription?: string;
|
30
|
+
batchNumber?: string;
|
31
|
+
expiryDate?: Date;
|
32
|
+
balanceOnHand?: number;
|
33
|
+
balanceOnHandUoM?: string;
|
34
|
+
quantityRequired?: number;
|
35
|
+
quantityRequiredUoM?: string;
|
36
|
+
quantityIssued?: number;
|
37
|
+
quantityIssuedUoM?: string;
|
38
|
+
unitCost?: number;
|
39
|
+
unitCostUoM?: string;
|
40
|
+
totalCost?: number;
|
41
|
+
purchasePrice?: number;
|
42
|
+
}
|
43
|
+
|
44
|
+
export const BuildStockOperationData = async (
|
45
|
+
currentOperation: StockOperationDTO,
|
46
|
+
stockOperationItems: StockOperationItemDTO[],
|
47
|
+
parentOperation?: StockOperationDTO,
|
48
|
+
operationItemsCost?: StockOperationItemCost[] | null,
|
49
|
+
inventory?: StockItemInventory[] | null
|
50
|
+
): Promise<StockOperationPrintData | null> => {
|
51
|
+
const data: StockOperationPrintData = {};
|
52
|
+
if (
|
53
|
+
OperationType.REQUISITION_OPERATION_TYPE !== currentOperation.operationType
|
54
|
+
) {
|
55
|
+
data.authorizedBy = currentOperation?.dispatchedDate
|
56
|
+
? `${currentOperation.dispatchedByFamilyName ?? ""} ${
|
57
|
+
currentOperation.dispatchedByGivenName ?? ""
|
58
|
+
}`
|
59
|
+
: currentOperation?.completedDate
|
60
|
+
? `${currentOperation.completedByFamilyName ?? ""} ${
|
61
|
+
currentOperation.completedByGivenName ?? ""
|
62
|
+
}`
|
63
|
+
: "";
|
64
|
+
}
|
65
|
+
data.remarks = currentOperation.remarks;
|
66
|
+
data.operationNumber = currentOperation.operationNumber;
|
67
|
+
data.operationDate =
|
68
|
+
parentOperation?.operationDate ?? currentOperation?.operationDate;
|
69
|
+
data.location =
|
70
|
+
parentOperation?.atLocationName ?? currentOperation?.atLocationName;
|
71
|
+
data.source = currentOperation?.sourceName;
|
72
|
+
data.destination = currentOperation?.destinationName;
|
73
|
+
data.responsiblePerson = data.orderedBy =
|
74
|
+
parentOperation?.responsiblePersonFamilyName
|
75
|
+
? `${parentOperation.responsiblePersonFamilyName ?? ""} ${
|
76
|
+
parentOperation?.responsiblePersonGivenName ?? ""
|
77
|
+
}`
|
78
|
+
: `${currentOperation.responsiblePersonFamilyName ?? ""} ${
|
79
|
+
currentOperation.responsiblePersonGivenName ?? ""
|
80
|
+
}`;
|
81
|
+
data.organizationName = HEALTH_CENTER_NAME;
|
82
|
+
data.documentTitle = `${currentOperation.operationTypeName} ${
|
83
|
+
currentOperation.operationNumber
|
84
|
+
}${
|
85
|
+
parentOperation
|
86
|
+
? ` of ${parentOperation.operationTypeName} ${parentOperation.operationNumber}`
|
87
|
+
: ""
|
88
|
+
}`;
|
89
|
+
data.items = stockOperationItems.map((p) => {
|
90
|
+
const item: StockOperationItemData = {};
|
91
|
+
item.itemCode = p?.acronym;
|
92
|
+
item.itemDescription = p?.stockItemName;
|
93
|
+
item.purchasePrice = p?.purchasePrice;
|
94
|
+
item.batchNumber = p?.batchNo;
|
95
|
+
item.expiryDate = p?.expiration;
|
96
|
+
if (parentOperation) {
|
97
|
+
item.quantityRequired = p?.quantityRequested;
|
98
|
+
item.quantityRequiredUoM = p?.quantityRequestedPackagingUOMName;
|
99
|
+
item.quantityIssued = p?.quantity;
|
100
|
+
item.quantityIssuedUoM = p?.stockItemPackagingUOMName;
|
101
|
+
} else if (
|
102
|
+
OperationType.STOCK_ISSUE_OPERATION_TYPE ===
|
103
|
+
currentOperation.operationType
|
104
|
+
) {
|
105
|
+
item.quantityIssued = p?.quantity;
|
106
|
+
item.quantityIssuedUoM = p?.stockItemPackagingUOMName;
|
107
|
+
} else {
|
108
|
+
item.quantityRequired = p?.quantity;
|
109
|
+
item.quantityRequiredUoM = p?.stockItemPackagingUOMName;
|
110
|
+
}
|
111
|
+
if (operationItemsCost) {
|
112
|
+
const operationItemCost = operationItemsCost.find(
|
113
|
+
(x) => x.uuid === p.uuid
|
114
|
+
);
|
115
|
+
if (operationItemCost) {
|
116
|
+
item.unitCost = operationItemCost.unitCost;
|
117
|
+
item.unitCostUoM = operationItemCost.unitCostUOMName;
|
118
|
+
item.totalCost = operationItemCost.totalCost;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
if (inventory) {
|
122
|
+
const itemInventory = inventory.find(
|
123
|
+
(x) => x.stockItemUuid === p.stockItemUuid
|
124
|
+
);
|
125
|
+
if (itemInventory) {
|
126
|
+
item.balanceOnHand = itemInventory.quantity;
|
127
|
+
item.balanceOnHandUoM = itemInventory.quantityUoM;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
return item;
|
131
|
+
});
|
132
|
+
return data;
|
133
|
+
};
|