@kenyaemr/esm-billing-app 5.3.8-pre.1608 → 5.3.9-pre.1620
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/.turbo/turbo-build.log +51 -51
- package/dist/571.js +1 -1
- package/dist/571.js.map +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +6 -6
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/invoice/invoice-table.component.tsx +7 -3
- package/src/invoice/payments/payments.test.tsx +54 -11
- package/src/invoice/payments/utils.ts +36 -8
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.
|
|
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.9-pre.1620"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-billing-app",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.9-pre.1620",
|
|
4
4
|
"description": "Billing app for KenyaEMR",
|
|
5
5
|
"browser": "dist/kenyaemr-esm-billing-app.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"webpack": "^5.74.0"
|
|
53
53
|
},
|
|
54
|
-
"stableVersion": "5.3.
|
|
54
|
+
"stableVersion": "5.3.8"
|
|
55
55
|
}
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
type DataTableRow,
|
|
22
22
|
} from '@carbon/react';
|
|
23
23
|
import { isDesktop, useDebounce, useLayoutType } from '@openmrs/esm-framework';
|
|
24
|
-
import { LineItem, MappedBill } from '../types';
|
|
24
|
+
import { LineItem, MappedBill, PaymentStatus } from '../types';
|
|
25
25
|
import styles from './invoice-table.scss';
|
|
26
26
|
|
|
27
27
|
type InvoiceTableProps = {
|
|
@@ -155,10 +155,14 @@ const InvoiceTable: React.FC<InvoiceTableProps> = ({ bill, isSelectable = true,
|
|
|
155
155
|
<TableSelectRow
|
|
156
156
|
aria-label="Select row"
|
|
157
157
|
{...getSelectionProps({ row })}
|
|
158
|
-
disabled={
|
|
158
|
+
disabled={
|
|
159
|
+
tableRows[index].status === PaymentStatus.PAID ||
|
|
160
|
+
tableRows[index].status === PaymentStatus.EXEMPTED
|
|
161
|
+
}
|
|
159
162
|
onChange={(checked: boolean) => handleRowSelection(row, checked)}
|
|
160
163
|
checked={
|
|
161
|
-
tableRows[index].status ===
|
|
164
|
+
tableRows[index].status === PaymentStatus.PAID ||
|
|
165
|
+
tableRows[index].status === PaymentStatus.EXEMPTED ||
|
|
162
166
|
Boolean(selectedLineItems?.find((item) => item?.uuid === row?.id))
|
|
163
167
|
}
|
|
164
168
|
/>
|
|
@@ -64,15 +64,63 @@ describe('Payment', () => {
|
|
|
64
64
|
expect(mockProcessBillPayment).toHaveBeenCalledTimes(1);
|
|
65
65
|
expect(mockProcessBillPayment).toHaveBeenCalledWith(
|
|
66
66
|
{
|
|
67
|
-
cashPoint:
|
|
68
|
-
cashier:
|
|
67
|
+
cashPoint: '65dd568e-4124-4e89-a4f8-0b07c58ec6fe',
|
|
68
|
+
cashier: '48b55692-e061-4ffa-b1f2-fd4aaf506224',
|
|
69
69
|
lineItems: [
|
|
70
70
|
{
|
|
71
|
-
billableService: '
|
|
71
|
+
billableService: 'c15d25b9-12bb-441d-9241-cae541dd4575',
|
|
72
72
|
display: 'BillLineItem',
|
|
73
|
-
item: '
|
|
73
|
+
item: 'c15d25b9-12bb-441d-9241-cae541dd4575',
|
|
74
74
|
lineItemOrder: 0,
|
|
75
|
+
order: null,
|
|
76
|
+
paymentStatus: 'PAID',
|
|
77
|
+
price: 500,
|
|
78
|
+
priceName: 'Default',
|
|
79
|
+
priceUuid: '',
|
|
80
|
+
quantity: 1,
|
|
81
|
+
resourceVersion: '1.8',
|
|
82
|
+
uuid: '314c25fd-2c90-4a7f-9f98-c99cd3f153e8',
|
|
83
|
+
voidReason: null,
|
|
84
|
+
voided: false,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
billableService: '04be5832-5440-44d0-83d2-5c0dfd0ac7de',
|
|
88
|
+
display: 'BillLineItem',
|
|
89
|
+
item: '04be5832-5440-44d0-83d2-5c0dfd0ac7de',
|
|
90
|
+
lineItemOrder: 1,
|
|
91
|
+
order: null,
|
|
92
|
+
paymentStatus: 'PAID',
|
|
93
|
+
price: 100,
|
|
94
|
+
priceName: 'Default',
|
|
95
|
+
priceUuid: '',
|
|
96
|
+
quantity: 1,
|
|
97
|
+
resourceVersion: '1.8',
|
|
98
|
+
uuid: '60365e7e-d29e-4f13-b64b-9aecb5d36031',
|
|
99
|
+
voidReason: null,
|
|
100
|
+
voided: false,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
billableService: '3f5d0684-a280-477e-a67b-2a956a1f6dca',
|
|
104
|
+
display: 'BillLineItem',
|
|
105
|
+
item: '3f5d0684-a280-477e-a67b-2a956a1f6dca',
|
|
106
|
+
lineItemOrder: 2,
|
|
107
|
+
order: null,
|
|
75
108
|
paymentStatus: 'PAID',
|
|
109
|
+
price: 50,
|
|
110
|
+
priceName: 'Default',
|
|
111
|
+
priceUuid: '',
|
|
112
|
+
quantity: 1,
|
|
113
|
+
resourceVersion: '1.8',
|
|
114
|
+
uuid: '006ee634-f1cf-4552-b751-f721679527af',
|
|
115
|
+
voidReason: null,
|
|
116
|
+
voided: false,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
billableService: null,
|
|
120
|
+
display: 'BillLineItem',
|
|
121
|
+
item: 'Hemoglobin',
|
|
122
|
+
lineItemOrder: 0,
|
|
123
|
+
paymentStatus: 'PENDING',
|
|
76
124
|
price: 100,
|
|
77
125
|
priceName: '',
|
|
78
126
|
priceUuid: '',
|
|
@@ -85,14 +133,9 @@ describe('Payment', () => {
|
|
|
85
133
|
],
|
|
86
134
|
patient: 'b2fcf02b-7ee3-4d16-a48f-576be2b103aa',
|
|
87
135
|
payments: [
|
|
88
|
-
{
|
|
89
|
-
amount: 100,
|
|
90
|
-
amountTendered: 100,
|
|
91
|
-
attributes: [],
|
|
92
|
-
instanceType: '63eff7a4-6f82-43c4-a333-dbcc58fe9f74',
|
|
93
|
-
},
|
|
136
|
+
{ amount: 100, amountTendered: 100, attributes: [], instanceType: '63eff7a4-6f82-43c4-a333-dbcc58fe9f74' },
|
|
94
137
|
],
|
|
95
|
-
status: '
|
|
138
|
+
status: 'PENDING',
|
|
96
139
|
},
|
|
97
140
|
'6eb8d678-514d-46ad-9554-51e48d96d567',
|
|
98
141
|
);
|
|
@@ -70,6 +70,10 @@ export const determineBillableItemPaymentStatus = (
|
|
|
70
70
|
return fallbackPaymentStatus;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
if (billableItem.paymentStatus === PaymentStatus.EXEMPTED) {
|
|
74
|
+
return PaymentStatus.EXEMPTED;
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
const itemTotalCost = billableItem.price * billableItem.quantity;
|
|
74
78
|
return totalPaidAmount >= itemTotalCost ? PaymentStatus.PAID : PaymentStatus.PENDING;
|
|
75
79
|
};
|
|
@@ -133,16 +137,40 @@ export const createPaymentPayload = (
|
|
|
133
137
|
const consolidatedPayments = [...currentPayments, ...existingPayments];
|
|
134
138
|
const totalPaidAmount = consolidatedPayments.reduce((sum, payment) => sum + payment.amountTendered, 0);
|
|
135
139
|
|
|
136
|
-
// Process
|
|
137
|
-
const
|
|
138
|
-
...
|
|
139
|
-
billableService: extractServiceIdentifier(
|
|
140
|
-
item: extractServiceIdentifier(
|
|
141
|
-
paymentStatus:
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
// Process selected items and update their payment status
|
|
141
|
+
const processedSelectedBillableItems = selectedBillableItems.map((billableItem) => ({
|
|
142
|
+
...billableItem,
|
|
143
|
+
billableService: extractServiceIdentifier(billableItem),
|
|
144
|
+
item: extractServiceIdentifier(billableItem),
|
|
145
|
+
paymentStatus: determineBillableItemPaymentStatus(
|
|
146
|
+
lineItems.length,
|
|
147
|
+
billableItem,
|
|
148
|
+
totalPaidAmount,
|
|
149
|
+
initialPaymentStatus,
|
|
150
|
+
),
|
|
144
151
|
}));
|
|
145
152
|
|
|
153
|
+
// Handle remaining line items based on whether there are selected items
|
|
154
|
+
const remainingLineItems =
|
|
155
|
+
selectedBillableItems.length > 0
|
|
156
|
+
? // If items were selected, exclude them from the original line items
|
|
157
|
+
lineItems.filter((lineItem) => {
|
|
158
|
+
const isItemSelected = processedSelectedBillableItems.some(
|
|
159
|
+
(selectedItem) => selectedItem.uuid === lineItem.uuid,
|
|
160
|
+
);
|
|
161
|
+
return !isItemSelected;
|
|
162
|
+
})
|
|
163
|
+
: // If no items were selected, update payment status for all line items
|
|
164
|
+
lineItems.map((lineItem) => ({
|
|
165
|
+
...lineItem,
|
|
166
|
+
billableService: extractServiceIdentifier(lineItem),
|
|
167
|
+
item: extractServiceIdentifier(lineItem),
|
|
168
|
+
paymentStatus: isBillableItemFullyPaid(totalPaidAmount, lineItem),
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
// Combine selected and remaining items into final processed list
|
|
172
|
+
const processedLineItems = [...processedSelectedBillableItems, ...remainingLineItems];
|
|
173
|
+
|
|
146
174
|
// Determine final bill status
|
|
147
175
|
const hasUnpaidItems = processedLineItems.some((item) => item.paymentStatus === PaymentStatus.PENDING);
|
|
148
176
|
const overallBillStatus = hasUnpaidItems ? PaymentStatus.PENDING : PaymentStatus.PAID;
|