@kenyaemr/esm-billing-app 5.3.10-pre.1665 → 5.3.10-pre.1667
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 +62 -62
- package/dist/300.js +1 -1
- package/dist/492.js +1 -0
- package/dist/492.js.map +1 -0
- package/dist/kenyaemr-esm-billing-app.js +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +34 -34
- package/dist/kenyaemr-esm-billing-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/billable-services/payment-history/payment-history-table.component.tsx +1 -0
- package/src/billable-services/payment-history/usePaymentTransactionHistory.tsx +16 -1
- package/src/invoice/invoice.component.tsx +2 -2
- package/src/invoice/print-bill-receipt/receipt-print-button.component.tsx +55 -0
- package/translations/en.json +0 -1
- package/dist/49.js +0 -1
- package/dist/49.js.map +0 -1
- package/src/invoice/print-bill-receipt/print-receipt-action.component.tsx +0 -34
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-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"},{"name":"clock-in-modal","component":"clockIn"}],"version":"5.3.10-pre.
|
|
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-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"},{"name":"clock-in-modal","component":"clockIn"}],"version":"5.3.10-pre.1667"}
|
package/package.json
CHANGED
|
@@ -58,6 +58,7 @@ export const PaymentHistoryTable = ({
|
|
|
58
58
|
const transformedRows = results.map((row) => {
|
|
59
59
|
return {
|
|
60
60
|
...row,
|
|
61
|
+
billingService: row.lineItems.map((item) => item.billableService).join(', '),
|
|
61
62
|
totalAmount: convertToCurrency(row.payments.reduce((acc, payment) => acc + payment.amountTendered, 0)),
|
|
62
63
|
referenceCodes: row.payments
|
|
63
64
|
.map(({ attributes }) => attributes.map(({ value }) => value).join(', '))
|
|
@@ -4,6 +4,15 @@ import { PaymentStatus, Filter } from '../../types';
|
|
|
4
4
|
import { filterBills } from './filters/bill-filter';
|
|
5
5
|
import { usePaymentFilterContext } from './usePaymentFilterContext';
|
|
6
6
|
|
|
7
|
+
function extractServiceName(billableService: string): string {
|
|
8
|
+
const parts = billableService.split(':');
|
|
9
|
+
if (parts.length === 1) {
|
|
10
|
+
return billableService.trim();
|
|
11
|
+
}
|
|
12
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
13
|
+
return parts[0].trim().match(uuidPattern) ? parts[1].trim() : parts[0].trim();
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
export const usePaymentTransactionHistory = (filters: Filter) => {
|
|
8
17
|
const { dateRange } = usePaymentFilterContext();
|
|
9
18
|
const { bills, isLoading, isValidating, error } = useBills(
|
|
@@ -13,7 +22,13 @@ export const usePaymentTransactionHistory = (filters: Filter) => {
|
|
|
13
22
|
dayjs(dateRange[1]).toDate(),
|
|
14
23
|
);
|
|
15
24
|
|
|
16
|
-
const filteredBills = filterBills(bills ?? [], filters)
|
|
25
|
+
const filteredBills = filterBills(bills ?? [], filters).map((bill) => ({
|
|
26
|
+
...bill,
|
|
27
|
+
lineItems: bill.lineItems.map((item) => ({
|
|
28
|
+
...item,
|
|
29
|
+
billableService: extractServiceName(item.billableService),
|
|
30
|
+
})),
|
|
31
|
+
}));
|
|
17
32
|
|
|
18
33
|
return { bills: filteredBills, isLoading, isValidating, error };
|
|
19
34
|
};
|
|
@@ -23,7 +23,7 @@ import { LineItem } from '../types';
|
|
|
23
23
|
import InvoiceTable from './invoice-table.component';
|
|
24
24
|
import styles from './invoice.scss';
|
|
25
25
|
import Payments from './payments/payments.component';
|
|
26
|
-
import
|
|
26
|
+
import ReceiptPrintButton from './print-bill-receipt/receipt-print-button.component';
|
|
27
27
|
import PrintableInvoice from './printable-invoice/printable-invoice.component';
|
|
28
28
|
|
|
29
29
|
interface InvoiceDetailsProps {
|
|
@@ -130,7 +130,7 @@ const Invoice: React.FC = () => {
|
|
|
130
130
|
</section>
|
|
131
131
|
</div>
|
|
132
132
|
<div className={styles.actionArea}>
|
|
133
|
-
<
|
|
133
|
+
<ReceiptPrintButton bill={bill} />
|
|
134
134
|
<Button
|
|
135
135
|
onClick={handlePrint}
|
|
136
136
|
kind="tertiary"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Button } from '@carbon/react';
|
|
2
|
+
import { Printer } from '@carbon/react/icons';
|
|
3
|
+
import { showModal } from '@openmrs/esm-framework';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { MappedBill, PaymentStatus } from '../../types';
|
|
7
|
+
|
|
8
|
+
interface ReceiptPrintButtonProps {
|
|
9
|
+
bill: MappedBill;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ReceiptPrintButton: React.FC<ReceiptPrintButtonProps> = ({ bill }) => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
|
|
15
|
+
const isPrintingDisabled = shouldDisablePrinting(bill);
|
|
16
|
+
|
|
17
|
+
const handlePrintClick = () => {
|
|
18
|
+
const dispose = showModal('paid-bill-receipt-print-preview-modal', {
|
|
19
|
+
onClose: () => dispose(),
|
|
20
|
+
bill,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Button
|
|
26
|
+
kind="secondary"
|
|
27
|
+
size="sm"
|
|
28
|
+
disabled={isPrintingDisabled}
|
|
29
|
+
onClick={handlePrintClick}
|
|
30
|
+
renderIcon={Printer}
|
|
31
|
+
iconDescription={t('printReceipt', 'Print receipt')}>
|
|
32
|
+
{t('printReceipt', 'Print receipt')}
|
|
33
|
+
</Button>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Determines if receipt printing should be disabled based on bill status
|
|
39
|
+
* @param bill - The bill to check
|
|
40
|
+
* @returns true if printing should be disabled, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
function shouldDisablePrinting(bill: MappedBill): boolean {
|
|
43
|
+
const hasPayments = bill.payments.length > 0;
|
|
44
|
+
const hasExemptedItems = bill.lineItems.some((item) => item.paymentStatus === PaymentStatus.EXEMPTED);
|
|
45
|
+
|
|
46
|
+
// If there are exempted items, we need special handling
|
|
47
|
+
if (hasExemptedItems) {
|
|
48
|
+
return !hasExemptedItems;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// For regular bills, disable if there are no payments
|
|
52
|
+
return !hasPayments;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default ReceiptPrintButton;
|
package/translations/en.json
CHANGED
|
@@ -234,7 +234,6 @@
|
|
|
234
234
|
"printingInvoice": "Printing invoice...",
|
|
235
235
|
"printInvoice": "Print invoice",
|
|
236
236
|
"printReceipt": "Print receipt",
|
|
237
|
-
"printRecept": "Print receipt",
|
|
238
237
|
"proceedToCare": "Proceed to care",
|
|
239
238
|
"processClaim": "Process Claim",
|
|
240
239
|
"processing": "Processing...",
|