@kenyaemr/esm-billing-app 5.4.2-pre.2890 → 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.
Files changed (41) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/138.js +1 -1
  3. package/dist/138.js.map +1 -1
  4. package/dist/157.js +1 -1
  5. package/dist/157.js.map +1 -1
  6. package/dist/324.js +1 -1
  7. package/dist/324.js.map +1 -1
  8. package/dist/723.js +1 -1
  9. package/dist/723.js.map +1 -1
  10. package/dist/784.js +1 -1
  11. package/dist/784.js.map +1 -1
  12. package/dist/855.js +1 -1
  13. package/dist/855.js.map +1 -1
  14. package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +21 -21
  15. package/dist/main.js +1 -1
  16. package/dist/main.js.map +1 -1
  17. package/dist/routes.json +1 -1
  18. package/package.json +1 -1
  19. package/src/bill-administration/bill-deposit/components/forms/deposit-transactions/deposit-transaction.workspace.tsx +5 -2
  20. package/src/bill-administration/bill-deposit/components/search/components/transaction-list/transaction-list.component.tsx +3 -2
  21. package/src/bill-administration/patient-billing/bill-line-items.component.tsx +6 -3
  22. package/src/bill-administration/patient-billing/patient-bills.component.tsx +5 -5
  23. package/src/bill-administration/patient-billing/workspaces/cancel-bill/cancel-bill.workspace.tsx +4 -2
  24. package/src/bill-administration/patient-billing/workspaces/create-bill/create-bill.workspace.tsx +5 -3
  25. package/src/bill-administration/patient-billing/workspaces/waive-bill/waive-bill-form.workspace.tsx +5 -3
  26. package/src/bill-administration/payment-history/payment-history-table.component.tsx +5 -3
  27. package/src/bill-administration/payment-history/payment-method-distribution.component.tsx +4 -2
  28. package/src/bill-administration/service-catalog/charge-summary-table.component.tsx +4 -4
  29. package/src/billable-services/billable-orders/drug-order/drug-order.component.tsx +4 -2
  30. package/src/billable-services/billable-orders/test-order/price-info-order.componet.tsx +3 -2
  31. package/src/claims/metrics/metrics.component.tsx +4 -2
  32. package/src/config-schema.ts +1 -0
  33. package/src/helpers/currency.ts +0 -1
  34. package/src/invoice/invoice-actions.component.tsx +4 -2
  35. package/src/invoice/invoice.component.tsx +7 -6
  36. package/src/invoice/payments/payment-history/payment-history.component.tsx +5 -3
  37. package/src/invoice/payments/payments.component.tsx +10 -11
  38. package/src/metrics-cards/metrics.resource.ts +7 -5
  39. package/src/modal/bill-action.modal.tsx +4 -2
  40. package/src/past-patient-bills/patient-bills.component.tsx +4 -2
  41. package/src/prompt-payment/prompt-payment-modal.component.tsx +6 -3
@@ -8,7 +8,6 @@ import { useTranslation } from 'react-i18next';
8
8
  import { mutate } from 'swr';
9
9
  import { z } from 'zod';
10
10
  import { processBillPayment } from '../../billing.resource';
11
- import { convertToCurrency } from '../../helpers';
12
11
  import { useClockInStatus } from '../../bill-administration/payment-points/use-clock-in-status';
13
12
  import { LineItem, PaymentFormValue, PaymentStatus, type MappedBill } from '../../types';
14
13
  import { computeWaivedAmount, extractErrorMessagesFromResponse } from '../../utils';
@@ -18,6 +17,7 @@ import PaymentHistory from './payment-history/payment-history.component';
18
17
  import styles from './payments.scss';
19
18
  import { createPaymentPayload } from './utils';
20
19
  import { usePaymentSchema } from '../../hooks/usePaymentSchema';
20
+ import { useCurrencyFormatting } from '../../helpers/currency';
21
21
 
22
22
  type PaymentProps = {
23
23
  bill: MappedBill;
@@ -26,6 +26,8 @@ type PaymentProps = {
26
26
 
27
27
  const Payments: React.FC<PaymentProps> = ({ bill, selectedLineItems }) => {
28
28
  const { t } = useTranslation();
29
+ const { format: formatCurrency } = useCurrencyFormatting();
30
+
29
31
  const paymentSchema = usePaymentSchema(bill);
30
32
  const { globalActiveSheet } = useClockInStatus();
31
33
 
@@ -118,7 +120,7 @@ const Payments: React.FC<PaymentProps> = ({ bill, selectedLineItems }) => {
118
120
  'incompletePaymentSubtitle',
119
121
  'Please ensure all selected line items are fully paid, Total amount expected is {{selectedLineItemsAmountDue}}',
120
122
  {
121
- selectedLineItemsAmountDue: convertToCurrency(selectedLineItemsAmountDue),
123
+ selectedLineItemsAmountDue: formatCurrency(selectedLineItemsAmountDue),
122
124
  },
123
125
  )}
124
126
  lowContrast
@@ -133,8 +135,8 @@ const Payments: React.FC<PaymentProps> = ({ bill, selectedLineItems }) => {
133
135
  'overPaymentSubtitle',
134
136
  'Amount paid {{totalAmountTendered}} should not be greater than amount due {{selectedLineItemsAmountDue}} for selected line items',
135
137
  {
136
- totalAmountTendered: convertToCurrency(totalAmountTendered),
137
- selectedLineItemsAmountDue: convertToCurrency(selectedLineItemsAmountDue),
138
+ totalAmountTendered: formatCurrency(totalAmountTendered),
139
+ selectedLineItemsAmountDue: formatCurrency(selectedLineItemsAmountDue),
138
140
  },
139
141
  )}
140
142
  lowContrast
@@ -147,20 +149,17 @@ const Payments: React.FC<PaymentProps> = ({ bill, selectedLineItems }) => {
147
149
  </div>
148
150
  <div className={styles.divider} />
149
151
  <div className={styles.paymentTotals}>
150
- <InvoiceBreakDown label={t('totalAmount', 'Total Amount')} value={convertToCurrency(bill.totalAmount)} />
151
- <InvoiceBreakDown
152
- label={t('totalDeposits', 'Total Deposits')}
153
- value={convertToCurrency(bill.totalDeposits)}
154
- />
152
+ <InvoiceBreakDown label={t('totalAmount', 'Total Amount')} value={formatCurrency(bill.totalAmount)} />
153
+ <InvoiceBreakDown label={t('totalDeposits', 'Total Deposits')} value={formatCurrency(bill.totalDeposits)} />
155
154
  <InvoiceBreakDown
156
155
  label={t('totalTendered', 'Total Tendered')}
157
- value={convertToCurrency(bill.tenderedAmount + totalAmountTendered)}
156
+ value={formatCurrency(bill.tenderedAmount + totalAmountTendered)}
158
157
  />
159
158
  <InvoiceBreakDown label={t('discount', 'Discount')} value={'--'} />
160
159
  <InvoiceBreakDown
161
160
  hasBalance={amountDue < 0}
162
161
  label={amountDueDisplay(amountDue)}
163
- value={convertToCurrency(amountDue)}
162
+ value={formatCurrency(amountDue)}
164
163
  />
165
164
  <div className={styles.processPayments}>
166
165
  <Button onClick={handleNavigateToBillingDashboard} kind="secondary">
@@ -1,4 +1,4 @@
1
- import { convertToCurrency } from '../helpers';
1
+ import { useCurrencyFormatting } from '../helpers/currency';
2
2
  import { MappedBill, PaymentStatus } from '../types';
3
3
 
4
4
  /**
@@ -20,11 +20,13 @@ export const useBillMetrics = (
20
20
  exemptedBills: string;
21
21
  } => {
22
22
  const { paidTotal, pendingTotal, cumulativeTotal, exemptedTotal } = calculateBillTotals(bills);
23
+ const { format: formatCurrency } = useCurrencyFormatting();
24
+
23
25
  return {
24
- totalBills: convertToCurrency(cumulativeTotal),
25
- pendingBills: convertToCurrency(pendingTotal),
26
- paidBills: convertToCurrency(paidTotal),
27
- exemptedBills: convertToCurrency(exemptedTotal),
26
+ totalBills: formatCurrency(cumulativeTotal),
27
+ pendingBills: formatCurrency(pendingTotal),
28
+ paidBills: formatCurrency(paidTotal),
29
+ exemptedBills: formatCurrency(exemptedTotal),
28
30
  };
29
31
  };
30
32
 
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { ModalBody, ModalFooter, ModalHeader, Button, TextArea } from '@carbon/react';
3
3
  import { type MappedBill } from '../types';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { convertToCurrency } from '../helpers';
6
5
  import { reOpenOrCloseBill } from '../invoice/invoice.resource';
7
6
  import { showSnackbar } from '@openmrs/esm-framework';
8
7
  import { mutate } from 'swr';
@@ -10,6 +9,7 @@ import { Controller, useForm } from 'react-hook-form';
10
9
  import { z } from 'zod';
11
10
  import { zodResolver } from '@hookform/resolvers/zod';
12
11
  import styles from './bill-action.modal.scss';
12
+ import { useCurrencyFormatting } from '../helpers/currency';
13
13
 
14
14
  type BillActionModalProps = {
15
15
  closeModal: () => void;
@@ -26,6 +26,8 @@ type FormData = z.infer<typeof formSchema>;
26
26
  const BillActionModal: React.FC<BillActionModalProps> = (props) => {
27
27
  const { closeModal, bill, action } = props;
28
28
  const { t } = useTranslation();
29
+ const { format: formatCurrency } = useCurrencyFormatting();
30
+
29
31
  const formMethod = useForm({
30
32
  defaultValues: {
31
33
  reason: '',
@@ -80,7 +82,7 @@ const BillActionModal: React.FC<BillActionModalProps> = (props) => {
80
82
  action: action === 'close' ? t('close', 'Close') : t('reopen', 'Reopen'),
81
83
  receiptNumber: bill?.receiptNumber,
82
84
  status: bill?.status,
83
- amount: bill?.totalAmount ? `${convertToCurrency(bill?.totalAmount)}` : 'N/A',
85
+ amount: bill?.totalAmount ? `${formatCurrency(bill?.totalAmount)}` : 'N/A',
84
86
  })}
85
87
  title={t('billAction', '{{action}} Bill', {
86
88
  action: action === 'close' ? t('close', 'Close') : t('reopen', 'Reopen'),
@@ -17,11 +17,11 @@ import { ConfigurableLink, getPatientName, usePatient, setCurrentVisit } from '@
17
17
  import { getPatientChartStore, useLaunchWorkspaceRequiringVisit } from '@openmrs/esm-patient-common-lib';
18
18
  import capitalize from 'lodash/capitalize';
19
19
 
20
- import { convertToCurrency } from '../helpers';
21
20
  import { type MappedBill } from '../types';
22
21
  import EmptyPatientBill from './patient-bills-dashboard/empty-patient-bill.component';
23
22
 
24
23
  import styles from './patient-bills.scss';
24
+ import { useCurrencyFormatting } from '../helpers/currency';
25
25
 
26
26
  type PatientBillsProps = {
27
27
  patientUuid: string;
@@ -38,6 +38,8 @@ export const patientBillsHeaders = [
38
38
 
39
39
  export const PatientBills: React.FC<PatientBillsProps> = ({ bills, onCancel, patientUuid }) => {
40
40
  const { t } = useTranslation();
41
+ const { format: formatCurrency } = useCurrencyFormatting();
42
+
41
43
  const { patient, isLoading, error } = usePatient(patientUuid);
42
44
  if (isLoading) {
43
45
  return <InlineLoading status="active" description={t('loading', 'Loading...')} />;
@@ -68,7 +70,7 @@ export const PatientBills: React.FC<PatientBillsProps> = ({ bills, onCancel, pat
68
70
  {bill.lineItems.map((item) => item?.billableService?.split(':')[1]).join(', ')}
69
71
  </ConfigurableLink>
70
72
  ),
71
- totalAmount: convertToCurrency(bill.totalAmount),
73
+ totalAmount: formatCurrency(bill.totalAmount),
72
74
  status: bill.status,
73
75
  }));
74
76
 
@@ -14,16 +14,19 @@ import {
14
14
  Heading,
15
15
  } from '@carbon/react';
16
16
  import styles from './prompt-payment.scss';
17
- import { convertToCurrency, extractString } from '../helpers';
17
+ import { extractString } from '../helpers';
18
18
  import { navigate, useConfig } from '@openmrs/esm-framework';
19
19
  import { BillingConfig } from '../config-schema';
20
20
  import { getPatientUuidFromStore } from '@openmrs/esm-patient-common-lib';
21
21
  import { useBillingPrompt } from './prompt-payment.resource';
22
+ import { useCurrencyFormatting } from '../helpers/currency';
22
23
 
23
24
  type PromptPaymentModalProps = {};
24
25
 
25
26
  const PromptPaymentModal: React.FC<PromptPaymentModalProps> = () => {
26
27
  const { t } = useTranslation();
28
+ const { format: formatCurrency } = useCurrencyFormatting();
29
+
27
30
  const patientUuid = getPatientUuidFromStore();
28
31
  const { shouldShowBillingPrompt, isLoading, bills } = useBillingPrompt(patientUuid, 'patient-chart');
29
32
  const [showModal, setShowModal] = useState({ loadingModal: true, billingModal: true });
@@ -82,9 +85,9 @@ const PromptPaymentModal: React.FC<PromptPaymentModalProps> = () => {
82
85
  <StructuredListRow key={lineItem.uuid}>
83
86
  <StructuredListCell>{extractString(lineItem.billableService || lineItem.item)}</StructuredListCell>
84
87
  <StructuredListCell>{lineItem.quantity}</StructuredListCell>
85
- <StructuredListCell>{convertToCurrency(lineItem.price)}</StructuredListCell>
88
+ <StructuredListCell>{formatCurrency(lineItem.price)}</StructuredListCell>
86
89
  <StructuredListCell>{lineItem.paymentStatus}</StructuredListCell>
87
- <StructuredListCell>{convertToCurrency(lineItem.quantity * lineItem.price)}</StructuredListCell>
90
+ <StructuredListCell>{formatCurrency(lineItem.quantity * lineItem.price)}</StructuredListCell>
88
91
  </StructuredListRow>
89
92
  );
90
93
  })}