@kenyaemr/esm-billing-app 5.4.2-pre.2257 → 5.4.2-pre.2262
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 +16 -16
- package/dist/300.js +1 -1
- package/dist/632.js +1 -0
- package/dist/632.js.map +1 -0
- package/dist/{46.js → 910.js} +3 -3
- package/dist/910.js.map +1 -0
- package/dist/kenyaemr-esm-billing-app.js +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +712 -712
- package/dist/kenyaemr-esm-billing-app.js.map +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/{invoice/print-bill-receipt/print-bill-receipt.resource.ts → hooks/usePrintPreview.tsx} +2 -4
- package/src/index.ts +7 -2
- package/src/invoice/invoice.component.tsx +13 -34
- package/src/invoice/print-bill-receipt/receipt-print-button.component.tsx +5 -3
- package/src/print-preview/print-preview.modal.tsx +45 -0
- package/src/routes.json +4 -4
- package/translations/en.json +1 -3
- package/dist/46.js.map +0 -1
- package/dist/964.js +0 -1
- package/dist/964.js.map +0 -1
- package/src/invoice/print-bill-receipt/receipt-print-preview.modal.tsx +0 -42
- package/src/invoice/printable-invoice/print-invoice.test.tsx +0 -36
- package/src/invoice/printable-invoice/print-receipt.component.tsx +0 -28
- package/src/invoice/printable-invoice/print-receipt.scss +0 -10
- package/src/invoice/printable-invoice/printable-footer.component.tsx +0 -33
- package/src/invoice/printable-invoice/printable-footer.scss +0 -24
- package/src/invoice/printable-invoice/printable-footer.test.tsx +0 -19
- package/src/invoice/printable-invoice/printable-invoice-header.component.tsx +0 -63
- package/src/invoice/printable-invoice/printable-invoice-header.scss +0 -61
- package/src/invoice/printable-invoice/printable-invoice-header.test.tsx +0 -56
- package/src/invoice/printable-invoice/printable-invoice.component.tsx +0 -134
- package/src/invoice/printable-invoice/printable-invoice.scss +0 -60
- /package/dist/{46.js.LICENSE.txt → 910.js.LICENSE.txt} +0 -0
- /package/src/{invoice/print-bill-receipt/print-bill-receipt.scss → print-preview/print-preview.scss} +0 -0
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":"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":"order-action-button","component":"orderActionButton","slots":["prescription-action-button-slot","imaging-orders-action","procedure-orders-action","tests-ordered-actions-slot"],"order":0},{"component":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"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":"create-bill-workspace","component":"createBillWorkspace","title":"Create Bill Workspace","type":"other-form"},{"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"},{"name":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","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":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"
|
|
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":"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":"order-action-button","component":"orderActionButton","slots":["prescription-action-button-slot","imaging-orders-action","procedure-orders-action","tests-ordered-actions-slot"],"order":0},{"component":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"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":"create-bill-workspace","component":"createBillWorkspace","title":"Create Bill Workspace","type":"other-form"},{"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"},{"name":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","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":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"}],"version":"5.4.2-pre.2262"}
|
package/package.json
CHANGED
package/src/{invoice/print-bill-receipt/print-bill-receipt.resource.ts → hooks/usePrintPreview.tsx}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { restBaseUrl } from '@openmrs/esm-framework';
|
|
2
1
|
import useSWR from 'swr';
|
|
3
2
|
|
|
4
3
|
const fetcher = async (url: string) => {
|
|
@@ -12,8 +11,7 @@ const fetcher = async (url: string) => {
|
|
|
12
11
|
return URL.createObjectURL(blob);
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
export const
|
|
16
|
-
const url = `/openmrs${restBaseUrl}/cashier/receipt?billId=${billId}`;
|
|
14
|
+
export const usePrintPreview = (url: string) => {
|
|
17
15
|
const { data, isLoading, error, mutate } = useSWR<String>(url, fetcher);
|
|
18
|
-
return {
|
|
16
|
+
return { data, isLoading, error, mutate };
|
|
19
17
|
};
|
package/src/index.ts
CHANGED
|
@@ -57,7 +57,6 @@ import ClaimsManagementOverview from './claims/claims-management/main/claims-ove
|
|
|
57
57
|
import { ManageClaimRequest } from './claims/claims-management/table/manage-claim-request.modal';
|
|
58
58
|
import InitiatePaymentDialog from './invoice/payments/initiate-payment/initiate-payment.component';
|
|
59
59
|
import VisitAttributeTags from './invoice/payments/visit-tags/visit-attribute.component';
|
|
60
|
-
import ReceiptPrintPreviewModal from './invoice/print-bill-receipt/receipt-print-preview.modal';
|
|
61
60
|
import DeletePaymentModeModal from './payment-modes/delete-payment-mode.modal';
|
|
62
61
|
import PaymentModeWorkspace from './payment-modes/payment-mode.workspace';
|
|
63
62
|
import RequirePaymentModal from './prompt-payment/prompt-payment-modal.component';
|
|
@@ -74,6 +73,9 @@ import DeleteDepositModal from './bill-deposit/components/modal/delete-deposit.m
|
|
|
74
73
|
import ReverseTransactionModal from './bill-deposit/components/modal/reverse-transaction.modal';
|
|
75
74
|
import DepositTransactionWorkspace from './bill-deposit/components/forms/deposit-transactions/deposit-transaction.workspace';
|
|
76
75
|
|
|
76
|
+
// Print Preview Components
|
|
77
|
+
import PrintPreviewModal from './print-preview/print-preview.modal';
|
|
78
|
+
|
|
77
79
|
// Translation
|
|
78
80
|
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
79
81
|
|
|
@@ -212,7 +214,6 @@ export const visitAttributeTags = getSyncLifecycle(VisitAttributeTags, options);
|
|
|
212
214
|
export const initiatePaymentDialog = getSyncLifecycle(InitiatePaymentDialog, options);
|
|
213
215
|
export const paymentModeWorkspace = getSyncLifecycle(PaymentModeWorkspace, options);
|
|
214
216
|
export const deletePaymentModeModal = getSyncLifecycle(DeletePaymentModeModal, options);
|
|
215
|
-
export const paidBillReceiptPrintPreviewModal = getSyncLifecycle(ReceiptPrintPreviewModal, options);
|
|
216
217
|
|
|
217
218
|
// Payment Points Components
|
|
218
219
|
export const createPaymentPoint = getSyncLifecycle(CreatePaymentPoint, options);
|
|
@@ -234,6 +235,10 @@ export const addDepositWorkspace = getSyncLifecycle(AddDepositWorkspace, options
|
|
|
234
235
|
export const deleteDepositModal = getSyncLifecycle(DeleteDepositModal, options);
|
|
235
236
|
export const depositTransactionWorkspace = getSyncLifecycle(DepositTransactionWorkspace, options);
|
|
236
237
|
export const reverseTransactionModal = getSyncLifecycle(ReverseTransactionModal, options);
|
|
238
|
+
|
|
239
|
+
// Print Preview Components
|
|
240
|
+
export const printPreviewModal = getSyncLifecycle(PrintPreviewModal, options);
|
|
241
|
+
|
|
237
242
|
// App Startup
|
|
238
243
|
export function startupApp() {
|
|
239
244
|
defineConfigSchema(moduleName, configSchema);
|
|
@@ -17,11 +17,10 @@ import {
|
|
|
17
17
|
useVisitContextStore,
|
|
18
18
|
} from '@openmrs/esm-framework';
|
|
19
19
|
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
20
|
-
import React, { useEffect,
|
|
20
|
+
import React, { useEffect, useState } from 'react';
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useParams } from 'react-router-dom';
|
|
23
|
-
import {
|
|
24
|
-
import { useBill, useDefaultFacility } from '../billing.resource';
|
|
23
|
+
import { useBill } from '../billing.resource';
|
|
25
24
|
import { spaBasePath } from '../constants';
|
|
26
25
|
import { convertToCurrency } from '../helpers';
|
|
27
26
|
import { usePaymentsReconciler } from '../hooks/use-payments-reconciler';
|
|
@@ -31,16 +30,14 @@ import { useShaFacilityStatus } from './invoice.resource';
|
|
|
31
30
|
import styles from './invoice.scss';
|
|
32
31
|
import Payments from './payments/payments.component';
|
|
33
32
|
import ReceiptPrintButton from './print-bill-receipt/receipt-print-button.component';
|
|
34
|
-
import PrintableInvoice from './printable-invoice/printable-invoice.component';
|
|
35
33
|
import capitalize from 'lodash-es/capitalize';
|
|
36
34
|
import { mutate } from 'swr';
|
|
35
|
+
import startCase from 'lodash-es/startCase';
|
|
37
36
|
|
|
38
37
|
const Invoice: React.FC = () => {
|
|
39
38
|
const { t } = useTranslation();
|
|
40
|
-
const { data: facilityInfo } = useDefaultFacility();
|
|
41
39
|
const { shaFacilityStatus } = useShaFacilityStatus();
|
|
42
40
|
const { billUuid, patientUuid } = useParams();
|
|
43
|
-
const [isPrinting, setIsPrinting] = useState(false);
|
|
44
41
|
const { patient, isLoading: isLoadingPatient, error: patientError } = usePatient(patientUuid);
|
|
45
42
|
const { bill, isLoading: isLoadingBill, error: billingError } = useBill(billUuid);
|
|
46
43
|
const isInsurancePayment = (payments) => {
|
|
@@ -50,7 +47,6 @@ const Invoice: React.FC = () => {
|
|
|
50
47
|
const { activeVisit, isLoading: isVisitLoading, error: visitError } = useVisit(patientUuid);
|
|
51
48
|
const { patientUuid: visitStorePatientUuid, manuallySetVisitUuid } = useVisitContextStore();
|
|
52
49
|
const [selectedLineItems, setSelectedLineItems] = useState([]);
|
|
53
|
-
const componentRef = useRef<HTMLDivElement>(null);
|
|
54
50
|
const isProcessClaimsFormEnabled = useFeatureFlag('healthInformationExchange');
|
|
55
51
|
|
|
56
52
|
const isShaFacilityStatusValid =
|
|
@@ -65,19 +61,13 @@ const Invoice: React.FC = () => {
|
|
|
65
61
|
setSelectedLineItems(uniqueLineItems);
|
|
66
62
|
};
|
|
67
63
|
|
|
68
|
-
const handlePrint =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return Promise.resolve();
|
|
76
|
-
},
|
|
77
|
-
onAfterPrint() {
|
|
78
|
-
setIsPrinting(false);
|
|
79
|
-
},
|
|
80
|
-
});
|
|
64
|
+
const handlePrint = () => {
|
|
65
|
+
const dispose = showModal('print-preview-modal', {
|
|
66
|
+
onClose: () => dispose(),
|
|
67
|
+
title: `${t('invoice', 'Invoice')} ${bill?.receiptNumber} - ${startCase(bill?.patientName)}`,
|
|
68
|
+
documentUrl: `/openmrs${restBaseUrl}/cashier/print?documentType=invoice&billId=${bill?.id}`,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
81
71
|
|
|
82
72
|
const handleBillPayment = () => {
|
|
83
73
|
const dispose = showModal('initiate-payment-modal', {
|
|
@@ -185,11 +175,10 @@ const Invoice: React.FC = () => {
|
|
|
185
175
|
onClick={handlePrint}
|
|
186
176
|
kind="tertiary"
|
|
187
177
|
size="sm"
|
|
188
|
-
disabled={isPrinting}
|
|
189
178
|
renderIcon={Printer}
|
|
190
179
|
iconDescription="Add"
|
|
191
180
|
tooltipPosition="right">
|
|
192
|
-
{
|
|
181
|
+
{t('printInvoice', 'Print invoice')}
|
|
193
182
|
</Button>
|
|
194
183
|
<Button
|
|
195
184
|
onClick={handleBillPayment}
|
|
@@ -217,21 +206,11 @@ const Invoice: React.FC = () => {
|
|
|
217
206
|
|
|
218
207
|
<InvoiceTable bill={bill} isLoadingBill={isLoadingBill} onSelectItem={handleSelectItem} />
|
|
219
208
|
<Payments bill={bill} selectedLineItems={selectedLineItems} />
|
|
220
|
-
|
|
221
|
-
<div className={styles.printContainer}>
|
|
222
|
-
<PrintableInvoice
|
|
223
|
-
ref={componentRef}
|
|
224
|
-
facilityInfo={facilityInfo}
|
|
225
|
-
bill={bill}
|
|
226
|
-
patient={patient}
|
|
227
|
-
isPrinting={isPrinting}
|
|
228
|
-
/>
|
|
229
|
-
</div>
|
|
230
209
|
</div>
|
|
231
210
|
);
|
|
232
211
|
};
|
|
233
212
|
|
|
234
|
-
function InvoiceSummary({ bill }: { readonly bill: MappedBill }) {
|
|
213
|
+
export function InvoiceSummary({ bill }: { readonly bill: MappedBill }) {
|
|
235
214
|
const { t } = useTranslation();
|
|
236
215
|
return (
|
|
237
216
|
<>
|
|
@@ -271,7 +250,7 @@ function InvoiceSummary({ bill }: { readonly bill: MappedBill }) {
|
|
|
271
250
|
);
|
|
272
251
|
}
|
|
273
252
|
|
|
274
|
-
function InvoiceSummaryItem({ label, value }: { readonly label: string; readonly value: string | number }) {
|
|
253
|
+
export function InvoiceSummaryItem({ label, value }: { readonly label: string; readonly value: string | number }) {
|
|
275
254
|
return (
|
|
276
255
|
<div className={styles.invoiceSummaryItem}>
|
|
277
256
|
<span className={styles.label}>{label}</span>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Button } from '@carbon/react';
|
|
2
2
|
import { Printer } from '@carbon/react/icons';
|
|
3
|
-
import { showModal } from '@openmrs/esm-framework';
|
|
3
|
+
import { restBaseUrl, showModal } from '@openmrs/esm-framework';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { MappedBill, PaymentStatus } from '../../types';
|
|
7
|
+
import startCase from 'lodash-es/startCase';
|
|
7
8
|
|
|
8
9
|
interface ReceiptPrintButtonProps {
|
|
9
10
|
bill: MappedBill;
|
|
@@ -15,9 +16,10 @@ const ReceiptPrintButton: React.FC<ReceiptPrintButtonProps> = ({ bill }) => {
|
|
|
15
16
|
const isPrintingDisabled = shouldDisablePrinting(bill);
|
|
16
17
|
|
|
17
18
|
const handlePrintClick = () => {
|
|
18
|
-
const dispose = showModal('
|
|
19
|
+
const dispose = showModal('print-preview-modal', {
|
|
19
20
|
onClose: () => dispose(),
|
|
20
|
-
bill
|
|
21
|
+
title: `${t('receipt', 'Receipt')} ${bill?.receiptNumber} - ${startCase(bill?.patientName)}`,
|
|
22
|
+
documentUrl: `/openmrs${restBaseUrl}/cashier/receipt?billId=${bill.id}`,
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { usePrintPreview } from '../hooks/usePrintPreview';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { ModalBody, ModalHeader, InlineLoading, ModalFooter, Button } from '@carbon/react';
|
|
5
|
+
import { ErrorState } from '@openmrs/esm-framework';
|
|
6
|
+
import styles from './print-preview.scss';
|
|
7
|
+
|
|
8
|
+
type PrintPreviewModalProps = {
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
title?: string;
|
|
11
|
+
documentUrl?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const PrintPreviewModal: React.FC<PrintPreviewModalProps> = ({ onClose, title, documentUrl }) => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
|
|
17
|
+
const { data, isLoading, error } = usePrintPreview(documentUrl);
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<>
|
|
21
|
+
<ModalHeader closeModal={onClose} className={styles.title}>
|
|
22
|
+
{t('printPreview', 'Print Preview {{title}}', { title })}
|
|
23
|
+
</ModalHeader>
|
|
24
|
+
<ModalBody>
|
|
25
|
+
{isLoading && (
|
|
26
|
+
<InlineLoading
|
|
27
|
+
status="active"
|
|
28
|
+
iconDescription="Loading"
|
|
29
|
+
description={t('loadingReceipt', 'Loading Receipt')}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
{error && <ErrorState error={error} headerTitle={t('previewError', 'Preview Error')} />}
|
|
33
|
+
{data && !isLoading && <iframe src={String(data)} title="Receipt Preview" className={styles.previewFrame} />}
|
|
34
|
+
</ModalBody>
|
|
35
|
+
<ModalFooter>
|
|
36
|
+
<Button kind="secondary" onClick={onClose} type="button" className={styles.btn}>
|
|
37
|
+
{t('close', 'Close')}
|
|
38
|
+
</Button>
|
|
39
|
+
</ModalFooter>
|
|
40
|
+
</>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default PrintPreviewModal;
|
package/src/routes.json
CHANGED
|
@@ -302,10 +302,6 @@
|
|
|
302
302
|
"name": "manage-claim-request-modal",
|
|
303
303
|
"component": "manageClaimRequestModal"
|
|
304
304
|
},
|
|
305
|
-
{
|
|
306
|
-
"name": "paid-bill-receipt-print-preview-modal",
|
|
307
|
-
"component": "paidBillReceiptPrintPreviewModal"
|
|
308
|
-
},
|
|
309
305
|
{
|
|
310
306
|
"name": "clock-in-modal",
|
|
311
307
|
"component": "clockIn"
|
|
@@ -321,6 +317,10 @@
|
|
|
321
317
|
{
|
|
322
318
|
"name": "reverse-transaction-modal",
|
|
323
319
|
"component": "reverseTransactionModal"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"name": "print-preview-modal",
|
|
323
|
+
"component": "printPreviewModal"
|
|
324
324
|
}
|
|
325
325
|
]
|
|
326
326
|
}
|
package/translations/en.json
CHANGED
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"billDate": "Date",
|
|
34
34
|
"billDepositForm": "Bill Deposit Form",
|
|
35
35
|
"billedItems": "Billed Items",
|
|
36
|
-
"billedTo": "Billed to",
|
|
37
36
|
"billErrorService": "Bill service error",
|
|
38
37
|
"billing": "Billing",
|
|
39
38
|
"billingForm": "Billing Form",
|
|
@@ -134,7 +133,6 @@
|
|
|
134
133
|
"filterTable": "Filter table",
|
|
135
134
|
"finalDiagnosis": "Final Diagnosis",
|
|
136
135
|
"formTitle": "Fill in the form details",
|
|
137
|
-
"generatedMessage": "The invoice has been electronically generated and is a valid document. It was created by {{userName}} on {{date}} at {{time}}",
|
|
138
136
|
"hieVerificationFailure": "HIE verification failure",
|
|
139
137
|
"home": "Home",
|
|
140
138
|
"identifier": "Identifier",
|
|
@@ -232,7 +230,6 @@
|
|
|
232
230
|
"previousPage": "Previous page",
|
|
233
231
|
"price": "Price",
|
|
234
232
|
"prices": "Prices",
|
|
235
|
-
"printingInvoice": "Printing invoice...",
|
|
236
233
|
"printInvoice": "Print invoice",
|
|
237
234
|
"printReceipt": "Print receipt",
|
|
238
235
|
"proceedToCare": "Proceed to care",
|
|
@@ -244,6 +241,7 @@
|
|
|
244
241
|
"providerMessage": "By clicking Proceed to care, you acknowledge that you have advised the patient to settle the bill.",
|
|
245
242
|
"providerName": "Provider Name",
|
|
246
243
|
"quantity": "Quantity",
|
|
244
|
+
"receipt": "Receipt",
|
|
247
245
|
"referenceCodes": " Reference Codes",
|
|
248
246
|
"referenceNumber": "Reference number",
|
|
249
247
|
"refundItem": "Refund item",
|