@kenyaemr/esm-billing-app 5.4.2-pre.2892 → 5.4.2-pre.2898
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 +1 -1
- package/dist/138.js +1 -1
- package/dist/138.js.map +1 -1
- package/dist/157.js +1 -1
- package/dist/157.js.map +1 -1
- package/dist/324.js +1 -1
- package/dist/324.js.map +1 -1
- package/dist/723.js +1 -1
- package/dist/723.js.map +1 -1
- package/dist/784.js +1 -1
- package/dist/784.js.map +1 -1
- package/dist/855.js +1 -1
- package/dist/855.js.map +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +21 -21
- 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/bill-administration/bill-deposit/components/forms/deposit-transactions/deposit-transaction.workspace.tsx +5 -2
- package/src/bill-administration/bill-deposit/components/search/components/transaction-list/transaction-list.component.tsx +3 -2
- package/src/bill-administration/patient-billing/bill-line-items.component.tsx +6 -3
- package/src/bill-administration/patient-billing/patient-bills.component.tsx +5 -5
- package/src/bill-administration/patient-billing/workspaces/cancel-bill/cancel-bill.workspace.tsx +4 -2
- package/src/bill-administration/patient-billing/workspaces/create-bill/create-bill.workspace.tsx +5 -3
- package/src/bill-administration/patient-billing/workspaces/waive-bill/waive-bill-form.workspace.tsx +5 -3
- package/src/bill-administration/payment-history/payment-history-table.component.tsx +5 -3
- package/src/bill-administration/payment-history/payment-method-distribution.component.tsx +4 -2
- package/src/bill-administration/service-catalog/charge-summary-table.component.tsx +4 -4
- package/src/billable-services/billable-orders/drug-order/drug-order.component.tsx +4 -2
- package/src/billable-services/billable-orders/test-order/price-info-order.componet.tsx +3 -2
- package/src/claims/metrics/metrics.component.tsx +4 -2
- package/src/config-schema.ts +1 -0
- package/src/helpers/currency.ts +0 -1
- package/src/invoice/invoice-actions.component.tsx +4 -2
- package/src/invoice/invoice.component.tsx +7 -6
- package/src/invoice/payments/payment-history/payment-history.component.tsx +5 -3
- package/src/invoice/payments/payments.component.tsx +10 -11
- package/src/metrics-cards/metrics.resource.ts +7 -5
- package/src/modal/bill-action.modal.tsx +4 -2
- package/src/past-patient-bills/patient-bills.component.tsx +4 -2
- package/src/prompt-payment/prompt-payment-modal.component.tsx +6 -3
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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","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":"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":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["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"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-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":"commodityForm","title":"Charge Commodity 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"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment 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":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"claim-summary-modal","component":"claimSummaryModal"},{"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"},{"name":"bill-action-modal","component":"billActionModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2-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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","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":"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":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["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"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-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":"commodityForm","title":"Charge Commodity 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"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment 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":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"claim-summary-modal","component":"claimSummaryModal"},{"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"},{"name":"bill-action-modal","component":"billActionModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2-pre.2898"}
|
package/package.json
CHANGED
|
@@ -20,7 +20,8 @@ import { type FormattedDeposit } from '../../../types/bill-deposit.types';
|
|
|
20
20
|
import { addDepositTransaction } from '../../../utils/bill-deposit.utils';
|
|
21
21
|
import { usePatientBills } from '../../../../../prompt-payment/prompt-payment.resource';
|
|
22
22
|
import { LineItem, PaymentStatus } from '../../../../../types';
|
|
23
|
-
import { extractString
|
|
23
|
+
import { extractString } from '../../../../../helpers';
|
|
24
|
+
import { useCurrencyFormatting } from '../../../../../helpers/currency';
|
|
24
25
|
|
|
25
26
|
type DepositTransactionWorkspaceProps = DefaultWorkspaceProps & {
|
|
26
27
|
deposit: FormattedDeposit;
|
|
@@ -35,6 +36,8 @@ const DepositTransactionWorkspace: React.FC<DepositTransactionWorkspaceProps> =
|
|
|
35
36
|
promptBeforeClosing,
|
|
36
37
|
}) => {
|
|
37
38
|
const { t } = useTranslation();
|
|
39
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
40
|
+
|
|
38
41
|
const isTablet = useLayoutType() === 'tablet';
|
|
39
42
|
const { isLoading, patientBills, error } = usePatientBills(patientUuid);
|
|
40
43
|
const pendingLineItems: Array<LineItem> = uniqBy(
|
|
@@ -162,7 +165,7 @@ const DepositTransactionWorkspace: React.FC<DepositTransactionWorkspaceProps> =
|
|
|
162
165
|
<ComboBox
|
|
163
166
|
id="billLineItem"
|
|
164
167
|
itemToString={(item: LineItem) =>
|
|
165
|
-
item ? `${extractString(item.billableService)} - ${
|
|
168
|
+
item ? `${extractString(item.billableService)} - ${formatCurrency(item.price)}` : ''
|
|
166
169
|
}
|
|
167
170
|
items={pendingLineItems ?? []}
|
|
168
171
|
onChange={({ selectedItem }) => field.onChange(selectedItem?.uuid)}
|
|
@@ -3,8 +3,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
3
3
|
import { ContainedList, ContainedListItem, OverflowMenu, OverflowMenuItem, InlineNotification } from '@carbon/react';
|
|
4
4
|
import { BillDepositTransaction } from '../../../../types/bill-deposit.types';
|
|
5
5
|
import { formatDate, parseDate, showModal } from '@openmrs/esm-framework';
|
|
6
|
-
import { convertToCurrency } from '../../../../../../helpers';
|
|
7
6
|
import styles from './transaction-list.scss';
|
|
7
|
+
import { useCurrencyFormatting } from '../../../../../../helpers/currency';
|
|
8
8
|
|
|
9
9
|
type TransactionListProps = {
|
|
10
10
|
transactions: Array<BillDepositTransaction>;
|
|
@@ -13,6 +13,7 @@ type TransactionListProps = {
|
|
|
13
13
|
|
|
14
14
|
const TransactionList: React.FC<TransactionListProps> = ({ transactions, depositUuid }) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
16
17
|
|
|
17
18
|
const handleReverse = (transaction: BillDepositTransaction) => {
|
|
18
19
|
const dispose = showModal('reverse-transaction-modal', {
|
|
@@ -53,7 +54,7 @@ const TransactionList: React.FC<TransactionListProps> = ({ transactions, deposit
|
|
|
53
54
|
<OverflowMenuItem itemText={t('remove', 'Remove')} isDelete hasDivider />
|
|
54
55
|
</OverflowMenu>
|
|
55
56
|
}>
|
|
56
|
-
{`${formatDate(parseDate(transaction.dateCreated))} - ${transaction.transactionType} - ${
|
|
57
|
+
{`${formatDate(parseDate(transaction.dateCreated))} - ${transaction.transactionType} - ${formatCurrency(
|
|
57
58
|
transaction.amount,
|
|
58
59
|
)}${transaction.reason ? ' - ' + transaction.reason : ''}`}
|
|
59
60
|
</ContainedListItem>
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
OverflowMenu,
|
|
10
10
|
} from '@carbon/react';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import {
|
|
12
|
+
import { extractString } from '../../helpers';
|
|
13
13
|
import { LineItem, MappedBill, PaymentStatus } from '../../types';
|
|
14
14
|
import styles from './patient-billing.scss';
|
|
15
15
|
import { ExtensionSlot } from '@openmrs/esm-framework';
|
|
16
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
16
17
|
|
|
17
18
|
const BillLineItems: React.FC<{ bill: MappedBill }> = ({ bill }) => {
|
|
18
19
|
const { t } = useTranslation();
|
|
@@ -42,6 +43,8 @@ const BillLineItems: React.FC<{ bill: MappedBill }> = ({ bill }) => {
|
|
|
42
43
|
|
|
43
44
|
const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill }) => {
|
|
44
45
|
const { t } = useTranslation();
|
|
46
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
47
|
+
|
|
45
48
|
const refundedLineItemUUIDs = bill.lineItems.filter((li) => Math.sign(li.price) === -1).map((li) => li.uuid);
|
|
46
49
|
const isRefundedLineItem = refundedLineItemUUIDs.includes(lineItem.uuid);
|
|
47
50
|
|
|
@@ -61,8 +64,8 @@ const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill
|
|
|
61
64
|
{lineItem.item === '' ? lineItem.billableService.split(':')[1] : extractString(lineItem.item)}
|
|
62
65
|
</StructuredListCell>
|
|
63
66
|
<StructuredListCell>{lineItem.quantity}</StructuredListCell>
|
|
64
|
-
<StructuredListCell>{
|
|
65
|
-
<StructuredListCell>{
|
|
67
|
+
<StructuredListCell>{formatCurrency(lineItem.price)}</StructuredListCell>
|
|
68
|
+
<StructuredListCell>{formatCurrency(lineItem.price * lineItem.quantity)}</StructuredListCell>
|
|
66
69
|
<StructuredListCell>{lineItem.paymentStatus}</StructuredListCell>
|
|
67
70
|
|
|
68
71
|
<StructuredListCell>
|
|
@@ -12,14 +12,13 @@ import {
|
|
|
12
12
|
TableCell,
|
|
13
13
|
TableExpandedRow,
|
|
14
14
|
} from '@carbon/react';
|
|
15
|
-
import { convertToCurrency } from '../../helpers';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { EmptyState } from '@openmrs/esm-patient-common-lib';
|
|
18
16
|
import { MappedBill, PaymentStatus } from '../../types';
|
|
19
17
|
import styles from '../../bills-table/bills-table.scss';
|
|
20
18
|
import BillLineItems from './bill-line-items.component';
|
|
21
19
|
import { ExtensionSlot } from '@openmrs/esm-framework';
|
|
22
20
|
import EmptyPatientBill from '../../past-patient-bills/patient-bills-dashboard/empty-patient-bill.component';
|
|
21
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
23
22
|
|
|
24
23
|
type PatientBillsProps = {
|
|
25
24
|
bills: Array<MappedBill>;
|
|
@@ -27,6 +26,7 @@ type PatientBillsProps = {
|
|
|
27
26
|
|
|
28
27
|
const PatientBills: React.FC<PatientBillsProps> = ({ bills }) => {
|
|
29
28
|
const { t } = useTranslation();
|
|
29
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
30
30
|
|
|
31
31
|
const hasRefundedItems = bills.some((bill) => bill.lineItems.some((li) => Math.sign(li.price) === -1));
|
|
32
32
|
|
|
@@ -44,16 +44,16 @@ const PatientBills: React.FC<PatientBillsProps> = ({ bills }) => {
|
|
|
44
44
|
const tableRows = bills.map((bill) => ({
|
|
45
45
|
id: `${bill.uuid}`,
|
|
46
46
|
date: bill.dateCreated,
|
|
47
|
-
totalAmount:
|
|
47
|
+
totalAmount: formatCurrency(bill.totalAmount),
|
|
48
48
|
status:
|
|
49
49
|
bill.totalAmount === bill.tenderedAmount
|
|
50
50
|
? PaymentStatus.PAID
|
|
51
51
|
: bill.tenderedAmount === 0
|
|
52
52
|
? PaymentStatus.PENDING
|
|
53
53
|
: PaymentStatus.POSTED,
|
|
54
|
-
amountPaid:
|
|
54
|
+
amountPaid: formatCurrency(bill.tenderedAmount),
|
|
55
55
|
...(hasRefundedItems && {
|
|
56
|
-
creditAmount:
|
|
56
|
+
creditAmount: formatCurrency(
|
|
57
57
|
bill.lineItems.filter((li) => Math.sign(li.price) === -1).reduce((acc, curr) => acc + Math.abs(curr.price), 0),
|
|
58
58
|
),
|
|
59
59
|
}),
|
package/src/bill-administration/patient-billing/workspaces/cancel-bill/cancel-bill.workspace.tsx
CHANGED
|
@@ -14,10 +14,10 @@ import { Form, Button, ButtonSet, InlineLoading, TextArea, InlineNotification }
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { z } from 'zod';
|
|
16
16
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
17
|
-
import { convertToCurrency } from '../../../../helpers';
|
|
18
17
|
import { createCancelBillPayload } from './cance-bill.resource';
|
|
19
18
|
import { processBillPayment } from '../../../../billing.resource';
|
|
20
19
|
import { mutate } from 'swr';
|
|
20
|
+
import { useCurrencyFormatting } from '../../../../helpers/currency';
|
|
21
21
|
|
|
22
22
|
type CancelBillWorkspaceProps = DefaultWorkspaceProps & {
|
|
23
23
|
patientUuid: string;
|
|
@@ -33,6 +33,8 @@ const CancelBillWorkspace: React.FC<CancelBillWorkspaceProps> = ({
|
|
|
33
33
|
closeWorkspaceWithSavedChanges,
|
|
34
34
|
}) => {
|
|
35
35
|
const { t } = useTranslation();
|
|
36
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
37
|
+
|
|
36
38
|
const isTablet = useLayoutType() === 'tablet';
|
|
37
39
|
|
|
38
40
|
const cancelSchema = z.object({
|
|
@@ -81,7 +83,7 @@ const CancelBillWorkspace: React.FC<CancelBillWorkspaceProps> = ({
|
|
|
81
83
|
const subtitleText = `${t('currentPriceAndQuantity', 'Current price and quantity')}: ${t(
|
|
82
84
|
'price',
|
|
83
85
|
'Price',
|
|
84
|
-
)}: ${
|
|
86
|
+
)}: ${formatCurrency(lineItem?.price)} ${t('quantity', 'Quantity')}: ${lineItem?.quantity}`;
|
|
85
87
|
|
|
86
88
|
return (
|
|
87
89
|
<Form className={styles.form} onSubmit={handleSubmit(onSubmit)}>
|
package/src/bill-administration/patient-billing/workspaces/create-bill/create-bill.workspace.tsx
CHANGED
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
25
25
|
import { useBillableItem } from '../../../../billable-services/billable-orders/useBillableItem';
|
|
26
26
|
import styles from './create-bill.style.scss';
|
|
27
|
-
import { convertToCurrency } from '../../../../helpers';
|
|
28
27
|
import { BillingConfig } from '../../../../config-schema';
|
|
29
28
|
import { processBillItems } from '../../../../billing.resource';
|
|
30
29
|
import { mutate } from 'swr';
|
|
30
|
+
import { useCurrencyFormatting } from '../../../../helpers/currency';
|
|
31
31
|
|
|
32
32
|
type CreateBillWorkspaceProps = DefaultWorkspaceProps & {
|
|
33
33
|
patientUuid: string;
|
|
@@ -75,6 +75,7 @@ const BillForm: React.FC<BillFormProps> = ({
|
|
|
75
75
|
comboBoxItems,
|
|
76
76
|
}) => {
|
|
77
77
|
const { t } = useTranslation();
|
|
78
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<Stack gap={4}>
|
|
@@ -128,7 +129,7 @@ const BillForm: React.FC<BillFormProps> = ({
|
|
|
128
129
|
<Column>
|
|
129
130
|
<div className={styles.formField}>
|
|
130
131
|
<label className={styles.label}>{t('total', 'Total')}</label>
|
|
131
|
-
<div className={styles.value}>{
|
|
132
|
+
<div className={styles.value}>{formatCurrency(calculateTotal())}</div>
|
|
132
133
|
</div>
|
|
133
134
|
</Column>
|
|
134
135
|
</Stack>
|
|
@@ -153,6 +154,7 @@ const CreateBillWorkspace: React.FC<CreateBillWorkspaceProps> = ({
|
|
|
153
154
|
medicationRequestBundle,
|
|
154
155
|
}) => {
|
|
155
156
|
const { t } = useTranslation();
|
|
157
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
156
158
|
const defaultPaymentStatus = 'PENDING';
|
|
157
159
|
const isTablet = useLayoutType() === 'tablet';
|
|
158
160
|
const { cashPointUuid, cashierUuid } = useConfig<BillingConfig>();
|
|
@@ -162,7 +164,7 @@ const CreateBillWorkspace: React.FC<CreateBillWorkspaceProps> = ({
|
|
|
162
164
|
const comboBoxItems =
|
|
163
165
|
billableItem?.servicePrices?.map((item) => ({
|
|
164
166
|
id: item.uuid,
|
|
165
|
-
text: `${item.paymentMode.name} - ${
|
|
167
|
+
text: `${item.paymentMode.name} - ${formatCurrency(item.price)}`,
|
|
166
168
|
unitPrice: item.price,
|
|
167
169
|
})) ?? [];
|
|
168
170
|
|
package/src/bill-administration/patient-billing/workspaces/waive-bill/waive-bill-form.workspace.tsx
CHANGED
|
@@ -14,7 +14,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import styles from './waive-bill-form.scss';
|
|
15
15
|
import { MappedBill } from '../../../../types';
|
|
16
16
|
import { createBillWaiverPayload, extractErrorMessagesFromResponse } from '../../../../utils';
|
|
17
|
-
import { convertToCurrency, extractString } from '../../../../helpers';
|
|
18
17
|
import { processBillPayment, usePaymentModes } from '../../../../billing.resource';
|
|
19
18
|
import { restBaseUrl, showSnackbar, useLayoutType } from '@openmrs/esm-framework';
|
|
20
19
|
import { mutate } from 'swr';
|
|
@@ -24,6 +23,8 @@ import { Controller, SubmitHandler, useForm } from 'react-hook-form';
|
|
|
24
23
|
import { DefaultPatientWorkspaceProps } from '@openmrs/esm-patient-common-lib';
|
|
25
24
|
import first from 'lodash-es/first';
|
|
26
25
|
import classNames from 'classnames';
|
|
26
|
+
import { useCurrencyFormatting } from '../../../../helpers/currency';
|
|
27
|
+
import { extractString } from '../../../../helpers';
|
|
27
28
|
|
|
28
29
|
type BillWaiverFormProps = DefaultPatientWorkspaceProps & {
|
|
29
30
|
bill: MappedBill;
|
|
@@ -39,6 +40,7 @@ export const WaiveBillForm: React.FC<BillWaiverFormProps> = ({
|
|
|
39
40
|
const isTablet = useLayoutType() === 'tablet';
|
|
40
41
|
|
|
41
42
|
const { t } = useTranslation();
|
|
43
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
42
44
|
|
|
43
45
|
const totalAmount = lineItems.reduce((acc, curr) => acc + curr.price * curr.quantity, 0);
|
|
44
46
|
const { isLoading, paymentModes = [] } = usePaymentModes(false);
|
|
@@ -167,12 +169,12 @@ export const WaiveBillForm: React.FC<BillWaiverFormProps> = ({
|
|
|
167
169
|
</section>
|
|
168
170
|
<section className={styles.billWaiverDescription}>
|
|
169
171
|
<label className={styles.label}>{t('billTotal', 'Bill total')}</label>
|
|
170
|
-
<p className={styles.value}>{
|
|
172
|
+
<p className={styles.value}>{formatCurrency(totalAmount)}</p>
|
|
171
173
|
</section>
|
|
172
174
|
{amountAlreadyWaivedOrPaid > 0 && (
|
|
173
175
|
<section className={styles.billWaiverDescription}>
|
|
174
176
|
<label className={styles.label}>{t('amountAlreadyWaivedOrPaid', 'Total paid / waived')}</label>
|
|
175
|
-
<p className={styles.value}>{
|
|
177
|
+
<p className={styles.value}>{formatCurrency(amountAlreadyWaivedOrPaid)}</p>
|
|
176
178
|
</section>
|
|
177
179
|
)}
|
|
178
180
|
<Controller
|
|
@@ -17,10 +17,10 @@ import { Download } from '@carbon/react/icons';
|
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
18
|
import { useDebounce, useLayoutType, usePagination } from '@openmrs/esm-framework';
|
|
19
19
|
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
20
|
-
import { convertToCurrency } from '../../helpers/functions';
|
|
21
20
|
import { DataTableRow, MappedBill } from '../../types';
|
|
22
21
|
import { exportToExcel } from '../../helpers/excelExport';
|
|
23
22
|
import dayjs from 'dayjs';
|
|
23
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
24
24
|
|
|
25
25
|
export const PaymentHistoryTable = ({
|
|
26
26
|
headers,
|
|
@@ -30,6 +30,8 @@ export const PaymentHistoryTable = ({
|
|
|
30
30
|
rows: Array<MappedBill>;
|
|
31
31
|
}) => {
|
|
32
32
|
const { t } = useTranslation();
|
|
33
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
34
|
+
|
|
33
35
|
const [pageSize, setPageSize] = useState(10);
|
|
34
36
|
const responsiveSize = useLayoutType() !== 'tablet' ? 'sm' : 'md';
|
|
35
37
|
const [searchString, setSearchString] = useState('');
|
|
@@ -61,7 +63,7 @@ export const PaymentHistoryTable = ({
|
|
|
61
63
|
...row,
|
|
62
64
|
id: `${row.id}`,
|
|
63
65
|
billingService: row.lineItems.map((item) => item.billableService).join(', '),
|
|
64
|
-
totalAmount:
|
|
66
|
+
totalAmount: formatCurrency(row.payments.reduce((acc, payment) => acc + payment.amountTendered, 0)),
|
|
65
67
|
referenceCodes: row.payments
|
|
66
68
|
.map(({ attributes }) => attributes.map(({ value }) => value).join(', '))
|
|
67
69
|
.filter((code) => code !== '')
|
|
@@ -73,7 +75,7 @@ export const PaymentHistoryTable = ({
|
|
|
73
75
|
const dataForExport = rows.map((row) => {
|
|
74
76
|
return {
|
|
75
77
|
...row,
|
|
76
|
-
totalAmount:
|
|
78
|
+
totalAmount: formatCurrency(row.payments.reduce((acc, payment) => acc + payment.amountTendered, 0)),
|
|
77
79
|
};
|
|
78
80
|
});
|
|
79
81
|
const data = dataForExport.map((row) => {
|
|
@@ -11,15 +11,17 @@ import {
|
|
|
11
11
|
DataTableSkeleton,
|
|
12
12
|
} from '@carbon/react';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { convertToCurrency } from '../../helpers';
|
|
15
14
|
import { usePaymentModeGroupTotals } from './usePaymentModeGroupTotals';
|
|
16
15
|
import { usePaymentFilterContext } from './usePaymentFilterContext';
|
|
17
16
|
import EmptyPatientBill from '../../past-patient-bills/patient-bills-dashboard/empty-patient-bill.component';
|
|
18
17
|
import { useLayoutType } from '@openmrs/esm-framework';
|
|
19
18
|
import { usePaymentTransactionHistory } from './usePaymentTransactionHistory';
|
|
19
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
20
20
|
|
|
21
21
|
const PaymentMethodDistribution = () => {
|
|
22
22
|
const { t } = useTranslation();
|
|
23
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
24
|
+
|
|
23
25
|
const responsiveSize = useLayoutType() !== 'tablet' ? 'sm' : 'md';
|
|
24
26
|
const { filters } = usePaymentFilterContext();
|
|
25
27
|
const { bills: filteredBills, isLoading } = usePaymentTransactionHistory(filters);
|
|
@@ -28,7 +30,7 @@ const PaymentMethodDistribution = () => {
|
|
|
28
30
|
const rows = paymentModesGroupTotals.map((total, index) => ({
|
|
29
31
|
id: index.toString(),
|
|
30
32
|
paymentMode: total?.type,
|
|
31
|
-
total:
|
|
33
|
+
total: formatCurrency(total?.total as number),
|
|
32
34
|
}));
|
|
33
35
|
|
|
34
36
|
const headers = [
|
|
@@ -23,15 +23,17 @@ import { ErrorState, launchWorkspace, showModal, useLayoutType, usePagination }
|
|
|
23
23
|
import { EmptyState, usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
24
24
|
import React, { ChangeEvent, useMemo, useState } from 'react';
|
|
25
25
|
import { useTranslation } from 'react-i18next';
|
|
26
|
-
import { convertToCurrency } from '../../helpers';
|
|
27
26
|
import styles from './charge-summary-table.scss';
|
|
28
27
|
import { type ChargeAble, useChargeSummaries } from './charge-summary.resource';
|
|
29
28
|
import { downloadExcelTemplateFile, searchTableData } from './form-helper';
|
|
29
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
30
30
|
|
|
31
31
|
const defaultPageSize = 10;
|
|
32
32
|
|
|
33
33
|
const ChargeSummaryTable: React.FC = () => {
|
|
34
34
|
const { t } = useTranslation();
|
|
35
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
36
|
+
|
|
35
37
|
const layout = useLayoutType();
|
|
36
38
|
const size = layout === 'tablet' ? 'lg' : 'md';
|
|
37
39
|
const { isLoading, isValidating, error, mutate, chargeSummaryItems } = useChargeSummaries();
|
|
@@ -76,9 +78,7 @@ const ChargeSummaryTable: React.FC = () => {
|
|
|
76
78
|
shortName: service.shortName,
|
|
77
79
|
serviceStatus: service.serviceStatus,
|
|
78
80
|
serviceType: service?.serviceType?.display ?? t('stockItem', 'Stock Item'),
|
|
79
|
-
servicePrices: service.servicePrices
|
|
80
|
-
.map((price) => `${price.name} : ${convertToCurrency(price.price)}`)
|
|
81
|
-
.join(', '),
|
|
81
|
+
servicePrices: service.servicePrices.map((price) => `${price.name} : ${formatCurrency(price.price)}`).join(', '),
|
|
82
82
|
};
|
|
83
83
|
});
|
|
84
84
|
|
|
@@ -4,7 +4,7 @@ import { DosingUnit, MedicationFrequency, MedicationRoute, QuantityUnit } from '
|
|
|
4
4
|
import { useBillableItem, useSockItemInventory } from '../useBillableItem';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import styles from './drug-order.scss';
|
|
7
|
-
import {
|
|
7
|
+
import { useCurrencyFormatting } from '../../../helpers/currency';
|
|
8
8
|
|
|
9
9
|
type DrugOrderProps = {
|
|
10
10
|
order: {
|
|
@@ -23,6 +23,8 @@ type DrugOrderProps = {
|
|
|
23
23
|
|
|
24
24
|
const DrugOrder: React.FC<DrugOrderProps> = ({ order }) => {
|
|
25
25
|
const { t } = useTranslation();
|
|
26
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
27
|
+
|
|
26
28
|
const { stockItem, isLoading: isLoadingInventory } = useSockItemInventory(order?.drug?.uuid);
|
|
27
29
|
const { billableItem, isLoading } = useBillableItem(order?.drug.concept.uuid, order?.drug.uuid);
|
|
28
30
|
if (isLoading || isLoadingInventory) {
|
|
@@ -52,7 +54,7 @@ const DrugOrder: React.FC<DrugOrderProps> = ({ order }) => {
|
|
|
52
54
|
billableItem?.servicePrices.map((item) => (
|
|
53
55
|
<div key={item.uuid} className={styles.itemContainer}>
|
|
54
56
|
<span className={styles.bold}>{item.paymentMode.name}</span>
|
|
55
|
-
<span>{
|
|
57
|
+
<span>{formatCurrency(item.price)}</span>
|
|
56
58
|
</div>
|
|
57
59
|
))}
|
|
58
60
|
</div>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { convertToCurrency } from '../../../helpers';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import styles from './price-info-order.scss';
|
|
5
4
|
import {
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
Tile,
|
|
12
11
|
InlineNotification,
|
|
13
12
|
} from '@carbon/react';
|
|
13
|
+
import { useCurrencyFormatting } from '../../../helpers/currency';
|
|
14
14
|
|
|
15
15
|
type PriceInfoOrderProps = {
|
|
16
16
|
billableItem: any;
|
|
@@ -19,6 +19,7 @@ type PriceInfoOrderProps = {
|
|
|
19
19
|
|
|
20
20
|
const PriceInfoOrder: React.FC<PriceInfoOrderProps> = ({ billableItem, error }) => {
|
|
21
21
|
const { t } = useTranslation();
|
|
22
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
22
23
|
|
|
23
24
|
const hasPrice = billableItem?.servicePrices?.length > 0;
|
|
24
25
|
|
|
@@ -46,7 +47,7 @@ const PriceInfoOrder: React.FC<PriceInfoOrderProps> = ({ billableItem, error })
|
|
|
46
47
|
{billableItem.servicePrices.map((priceItem: any) => (
|
|
47
48
|
<StructuredListRow key={priceItem.uuid}>
|
|
48
49
|
<StructuredListCell className={styles.cell}>{priceItem.paymentMode.name}</StructuredListCell>
|
|
49
|
-
<StructuredListCell className={styles.cell}>{
|
|
50
|
+
<StructuredListCell className={styles.cell}>{formatCurrency(priceItem.price)}</StructuredListCell>
|
|
50
51
|
</StructuredListRow>
|
|
51
52
|
))}
|
|
52
53
|
</StructuredListBody>
|
|
@@ -5,7 +5,8 @@ import MetricsHeader from './metrics-header.component';
|
|
|
5
5
|
import MetricsCard from './metrics-card.component';
|
|
6
6
|
import { computeTotalPrice } from '../../utils';
|
|
7
7
|
import { LineItem, MappedBill } from '../../types';
|
|
8
|
-
import {
|
|
8
|
+
import { formatDate } from '../../helpers';
|
|
9
|
+
import { useCurrencyFormatting } from '../../helpers/currency';
|
|
9
10
|
|
|
10
11
|
interface MainMetricsProps {
|
|
11
12
|
selectedLineItems: LineItem[];
|
|
@@ -14,6 +15,7 @@ interface MainMetricsProps {
|
|
|
14
15
|
|
|
15
16
|
const MainMetrics: React.FC<MainMetricsProps> = ({ selectedLineItems, bill }) => {
|
|
16
17
|
const { t } = useTranslation();
|
|
18
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
17
19
|
|
|
18
20
|
const numberOfLineItems = selectedLineItems.length;
|
|
19
21
|
|
|
@@ -26,7 +28,7 @@ const MainMetrics: React.FC<MainMetricsProps> = ({ selectedLineItems, bill }) =>
|
|
|
26
28
|
<div className={styles.cardContainer} data-testid="claims-metrics">
|
|
27
29
|
<MetricsCard
|
|
28
30
|
label={t('total', 'Amount')}
|
|
29
|
-
value={
|
|
31
|
+
value={formatCurrency(computedTotal)}
|
|
30
32
|
headerLabel={t('totalAmount', 'Total Amount')}
|
|
31
33
|
/>
|
|
32
34
|
<MetricsCard
|
package/src/config-schema.ts
CHANGED
package/src/helpers/currency.ts
CHANGED
|
@@ -119,7 +119,6 @@ export const useCurrencyFormatting = () => {
|
|
|
119
119
|
const formatSimple = (amount: number, options: Intl.NumberFormatOptions = {}) => {
|
|
120
120
|
const currentLocale = getLocale();
|
|
121
121
|
const currency = getCurrency();
|
|
122
|
-
|
|
123
122
|
const formatter = new Intl.NumberFormat(currentLocale, {
|
|
124
123
|
style: 'currency',
|
|
125
124
|
currency: currency,
|
|
@@ -18,12 +18,12 @@ import React, { useState } from 'react';
|
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
19
|
import { useParams } from 'react-router-dom';
|
|
20
20
|
import { mutate } from 'swr';
|
|
21
|
-
import { convertToCurrency } from '../helpers';
|
|
22
21
|
import { MappedBill, LineItem } from '../types';
|
|
23
22
|
import { spaBasePath } from '../constants';
|
|
24
23
|
import { useCheckShareGnum } from './invoice.resource';
|
|
25
24
|
import styles from './invoice.scss';
|
|
26
25
|
import startCase from 'lodash-es/startCase';
|
|
26
|
+
import { useCurrencyFormatting } from '../helpers/currency';
|
|
27
27
|
|
|
28
28
|
interface InvoiceActionsProps {
|
|
29
29
|
readonly bill: MappedBill;
|
|
@@ -33,6 +33,8 @@ interface InvoiceActionsProps {
|
|
|
33
33
|
|
|
34
34
|
export function InvoiceActions({ bill, selectedLineItems = [], activeVisit }: InvoiceActionsProps) {
|
|
35
35
|
const { t } = useTranslation();
|
|
36
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
37
|
+
|
|
36
38
|
const [isOpen, setIsOpen] = useState(false);
|
|
37
39
|
const { billUuid, patientUuid } = useParams();
|
|
38
40
|
const { checkSHARegNum } = useCheckShareGnum();
|
|
@@ -222,7 +224,7 @@ export function InvoiceActions({ bill, selectedLineItems = [], activeVisit }: In
|
|
|
222
224
|
launchWorkspace('payment-workspace', {
|
|
223
225
|
bill,
|
|
224
226
|
workspaceTitle: t('additionalPayment', 'Additional Payment (Balance {{billBalance}})', {
|
|
225
|
-
billBalance:
|
|
227
|
+
billBalance: formatCurrency(bill.balance),
|
|
226
228
|
}),
|
|
227
229
|
})
|
|
228
230
|
}>
|
|
@@ -5,7 +5,6 @@ import React, { useEffect, useState } from 'react';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useParams } from 'react-router-dom';
|
|
7
7
|
import { useBill } from '../billing.resource';
|
|
8
|
-
import { convertToCurrency } from '../helpers';
|
|
9
8
|
import { usePaymentsReconciler } from '../hooks/use-payments-reconciler';
|
|
10
9
|
import { LineItem, MappedBill } from '../types';
|
|
11
10
|
import InvoiceTable from './invoice-table.component';
|
|
@@ -13,6 +12,7 @@ import styles from './invoice.scss';
|
|
|
13
12
|
import Payments from './payments/payments.component';
|
|
14
13
|
import capitalize from 'lodash-es/capitalize';
|
|
15
14
|
import { InvoiceActions } from './invoice-actions.component';
|
|
15
|
+
import { useCurrencyFormatting } from '../helpers/currency';
|
|
16
16
|
|
|
17
17
|
const Invoice: React.FC = () => {
|
|
18
18
|
const { t } = useTranslation();
|
|
@@ -79,6 +79,7 @@ export function InvoiceSummary({
|
|
|
79
79
|
readonly activeVisit?: any;
|
|
80
80
|
}) {
|
|
81
81
|
const { t } = useTranslation();
|
|
82
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
82
83
|
|
|
83
84
|
return (
|
|
84
85
|
<>
|
|
@@ -99,20 +100,20 @@ export function InvoiceSummary({
|
|
|
99
100
|
</div>
|
|
100
101
|
<div className={styles.divider} />
|
|
101
102
|
<div className={styles.invoiceCard}>
|
|
102
|
-
<InvoiceSummaryItem label={t('totalAmount', 'Total Amount')} value={
|
|
103
|
+
<InvoiceSummaryItem label={t('totalAmount', 'Total Amount')} value={formatCurrency(bill?.totalAmount)} />
|
|
103
104
|
<InvoiceSummaryItem
|
|
104
105
|
label={t('totalExempted', 'Total Exempted')}
|
|
105
|
-
value={
|
|
106
|
+
value={formatCurrency(bill?.totalExempted)}
|
|
106
107
|
/>
|
|
107
108
|
<InvoiceSummaryItem
|
|
108
109
|
label={t('totalPayments', 'Total Payments')}
|
|
109
|
-
value={
|
|
110
|
+
value={formatCurrency(bill?.totalPayments)}
|
|
110
111
|
/>
|
|
111
112
|
<InvoiceSummaryItem
|
|
112
113
|
label={t('totalDeposits', 'Total Deposits')}
|
|
113
|
-
value={
|
|
114
|
+
value={formatCurrency(bill?.totalDeposits)}
|
|
114
115
|
/>
|
|
115
|
-
<InvoiceSummaryItem label={t('balance', 'Balance')} value={
|
|
116
|
+
<InvoiceSummaryItem label={t('balance', 'Balance')} value={formatCurrency(bill?.balance)} />
|
|
116
117
|
</div>
|
|
117
118
|
</div>
|
|
118
119
|
</>
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell } from '@carbon/react';
|
|
3
3
|
import { MappedBill } from '../../../types';
|
|
4
4
|
import { formatDate } from '@openmrs/esm-framework';
|
|
5
|
-
import { convertToCurrency } from '../../../helpers';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useCurrencyFormatting } from '../../../helpers/currency';
|
|
7
7
|
|
|
8
8
|
type PaymentHistoryProps = {
|
|
9
9
|
bill: MappedBill;
|
|
@@ -11,6 +11,8 @@ type PaymentHistoryProps = {
|
|
|
11
11
|
|
|
12
12
|
const PaymentHistory: React.FC<PaymentHistoryProps> = ({ bill }) => {
|
|
13
13
|
const { t } = useTranslation();
|
|
14
|
+
const { format: formatCurrency } = useCurrencyFormatting();
|
|
15
|
+
|
|
14
16
|
const headers = [
|
|
15
17
|
{
|
|
16
18
|
key: 'dateCreated',
|
|
@@ -28,8 +30,8 @@ const PaymentHistory: React.FC<PaymentHistoryProps> = ({ bill }) => {
|
|
|
28
30
|
const rows = bill?.payments?.map((payment) => ({
|
|
29
31
|
id: `${payment.uuid}`,
|
|
30
32
|
dateCreated: formatDate(new Date(payment.dateCreated)),
|
|
31
|
-
amountTendered:
|
|
32
|
-
amount:
|
|
33
|
+
amountTendered: formatCurrency(payment.amountTendered),
|
|
34
|
+
amount: formatCurrency(payment.amount),
|
|
33
35
|
paymentMethod: payment.instanceType.name,
|
|
34
36
|
}));
|
|
35
37
|
|