@kenyaemr/esm-billing-app 5.3.8-pre.1581 → 5.3.8-pre.1587

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-in-modal","component":"clockIn"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"}],"version":"5.3.8-pre.1581"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-in-modal","component":"clockIn"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"}],"version":"5.3.8-pre.1587"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.3.8-pre.1581",
3
+ "version": "5.3.8-pre.1587",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -1,15 +1,11 @@
1
1
  import { OpenmrsResource, openmrsFetch } from '@openmrs/esm-framework';
2
2
  import useSWR from 'swr';
3
- import { ServiceConcept } from '../types';
3
+ import { ServiceConcept, ServiceTypesResponse } from '../types';
4
4
 
5
5
  type ResponseObject = {
6
6
  results: Array<OpenmrsResource>;
7
7
  };
8
8
 
9
- type ServiceTypesResponse = {
10
- setMembers: { uuid: string; display: string }[];
11
- };
12
-
13
9
  export const useBillableServices = () => {
14
10
  const url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(uuid,display),servicePrices:(uuid,name,paymentMode,price),concept:(uuid,display))`;
15
11
  const { data, isLoading, isValidating, error, mutate } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {});
@@ -17,7 +13,9 @@ export const useBillableServices = () => {
17
13
  };
18
14
 
19
15
  export function useServiceTypes() {
20
- const url = `/ws/rest/v1/concept/d7bd4cc0-90b1-4f22-90f2-ab7fde936727?v=custom:(setMembers:(uuid,display))`;
16
+ // service concept UUID containing all available services e.g lab, pharmacy, surgical etc
17
+ const serviceConceptUuid = `d7bd4cc0-90b1-4f22-90f2-ab7fde936727`;
18
+ const url = `/ws/rest/v1/concept/${serviceConceptUuid}?v=custom:(setMembers:(uuid,display,id))`;
21
19
  const { data, error, isLoading } = useSWR<{ data: ServiceTypesResponse }>(url, openmrsFetch, {});
22
20
  return { serviceTypes: data?.data.setMembers ?? [], error, isLoading };
23
21
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- Button,
3
2
  ComboButton,
4
3
  DataTable,
5
4
  DataTableSkeleton,
@@ -19,7 +18,7 @@ import {
19
18
  TableToolbarContent,
20
19
  TableToolbarSearch,
21
20
  } from '@carbon/react';
22
- import { Add, CategoryAdd, Download, Upload, WatsonHealthScalpelSelect } from '@carbon/react/icons';
21
+ import { CategoryAdd, Download, Upload, WatsonHealthScalpelSelect } from '@carbon/react/icons';
23
22
  import { ErrorState, launchWorkspace, showModal, useLayoutType, usePagination } from '@openmrs/esm-framework';
24
23
  import { EmptyState, usePaginationInfo } from '@openmrs/esm-patient-common-lib';
25
24
  import React, { useMemo, useState } from 'react';
@@ -1,5 +1,5 @@
1
1
  import * as XLSX from 'xlsx';
2
- import { ExcelFileRow, PaymentMethod } from '../../types';
2
+ import { ExcelFileRow, PaymentMethod, ServiceType } from '../../types';
3
3
  import { ChargeAble } from './charge-summary.resource';
4
4
  import { BillableFormSchema, ServicePriceSchema } from './form-schemas';
5
5
 
@@ -119,6 +119,7 @@ export const getBulkUploadPayloadFromExcelFile = (
119
119
  fileData: Uint8Array,
120
120
  currentlyExistingBillableServices: Array<ChargeAble>,
121
121
  paymentModes: Array<PaymentMethod>,
122
+ serviceTypes: Array<ServiceType>,
122
123
  ) => {
123
124
  const workbook = XLSX.read(fileData, { type: 'array' });
124
125
 
@@ -167,7 +168,7 @@ export const getBulkUploadPayloadFromExcelFile = (
167
168
  return {
168
169
  name: row.name,
169
170
  shortName: row.short_name ?? row.name,
170
- serviceType: row.service_type_id,
171
+ serviceType: serviceTypes.find((type) => type.id === row.service_type_id).uuid,
171
172
  servicePrices: [
172
173
  {
173
174
  paymentMode: paymentModes.find((mode) => mode.name === 'Cash').uuid,
@@ -177,7 +178,6 @@ export const getBulkUploadPayloadFromExcelFile = (
177
178
  ],
178
179
  serviceStatus: row.disable === 'false' ? 'DISABLED' : 'ENABLED',
179
180
  concept: row.concept_id,
180
- stockItem: '',
181
181
  };
182
182
  });
183
183
 
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import { usePaymentModes } from '../billing.resource';
7
7
  import { MAX_ALLOWED_FILE_SIZE } from '../constants';
8
8
  import { ExcelFileRow } from '../types';
9
- import { createBillableService } from './billable-service.resource';
9
+ import { createBillableService, useServiceTypes } from './billable-service.resource';
10
10
  import { useChargeSummaries } from './billables/charge-summary.resource';
11
11
  import { BillableServicePayload, getBulkUploadPayloadFromExcelFile } from './billables/form-helper';
12
12
  import styles from './clinical-charges.scss';
@@ -19,7 +19,7 @@ export const BulkImportBillableServices = ({ closeModal }) => {
19
19
  const [uploadedFile, setUploadedFile] = useState<File | null>(null);
20
20
 
21
21
  const { chargeSummaryItems, mutate } = useChargeSummaries();
22
-
22
+ const { serviceTypes } = useServiceTypes();
23
23
  const { paymentModes } = usePaymentModes();
24
24
 
25
25
  const attachFiles = () => {
@@ -48,7 +48,18 @@ export const BulkImportBillableServices = ({ closeModal }) => {
48
48
  reader.onload = async (e) => {
49
49
  setIsImporting(true);
50
50
  const data = new Uint8Array(e.target.result as ArrayBuffer);
51
- const fileReadResponse = getBulkUploadPayloadFromExcelFile(data, chargeSummaryItems, paymentModes);
51
+ let fileReadResponse: ReturnType<typeof getBulkUploadPayloadFromExcelFile> = [];
52
+
53
+ try {
54
+ fileReadResponse = getBulkUploadPayloadFromExcelFile(data, chargeSummaryItems, paymentModes, serviceTypes);
55
+ } catch (error) {
56
+ setIsImporting(false);
57
+ closeModal();
58
+ showSnackbar({
59
+ title: t('errorOccurred', 'an error occurred'),
60
+ subtitle: t('uploadError', 'an unknown error occurred. Please try reuploading the file'),
61
+ });
62
+ }
52
63
 
53
64
  if (fileReadResponse === 'INVALID_TEMPLATE') {
54
65
  closeModal();
@@ -59,6 +70,7 @@ export const BulkImportBillableServices = ({ closeModal }) => {
59
70
  ),
60
71
  kind: 'error',
61
72
  });
73
+ setIsImporting(false);
62
74
  return;
63
75
  }
64
76
 
@@ -93,20 +105,22 @@ export const BulkImportBillableServices = ({ closeModal }) => {
93
105
  await Promise.all(promises);
94
106
  }
95
107
 
96
- mutate();
97
108
  setIsImporting(false);
98
109
  closeModal();
99
110
 
100
- if (erroredPayloads.length === 0 && correctRowsPayload.length > 1) {
111
+ if (erroredPayloads.length === 0 && correctRowsPayload.length >= 1) {
101
112
  showSnackbar({
102
113
  title: t('success', 'successfully'),
103
114
  subtitle: t(
104
115
  'successFullyUploadedItems',
105
- `Successfully uploaded ${correctRowsPayload.length} billable services.`,
116
+ `Successfully uploaded ${correctRowsPayload.length} billable service${
117
+ correctRowsPayload.length > 1 ? 's' : ''
118
+ }.`,
106
119
  ),
107
120
  kind: 'success',
108
121
  });
109
122
 
123
+ mutate();
110
124
  return;
111
125
  }
112
126
 
@@ -564,3 +564,9 @@ export interface Service {
564
564
  concept: string;
565
565
  description: string;
566
566
  }
567
+
568
+ export type ServiceType = { uuid: string; display: string; id: number };
569
+
570
+ export type ServiceTypesResponse = {
571
+ setMembers: Array<ServiceType>;
572
+ };