@kenyaemr/esm-billing-app 5.3.8-pre.1596 → 5.3.8-pre.1599

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/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-in-modal","component":"clockIn"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"}],"version":"5.3.8-pre.1596"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-in-modal","component":"clockIn"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"}],"version":"5.3.8-pre.1599"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.3.8-pre.1596",
3
+ "version": "5.3.8-pre.1599",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import { launchWorkspace } from '@openmrs/esm-framework';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { OverflowMenuItem } from '@carbon/react';
5
- import { LineItem, MappedBill } from '../../../types';
5
+ import { LineItem, MappedBill, PaymentStatus } from '../../../types';
6
+ import Payments from '../../../invoice/payments/payments.component';
6
7
 
7
8
  type CancelLineItemProps = {
8
9
  lineItem: LineItem;
@@ -11,6 +12,10 @@ type CancelLineItemProps = {
11
12
 
12
13
  const CancelLineItem: React.FC<CancelLineItemProps> = ({ lineItem, bill }) => {
13
14
  const { t } = useTranslation();
15
+
16
+ if (lineItem.paymentStatus == PaymentStatus.PAID) {
17
+ return null;
18
+ }
14
19
  const handleCancelLineItemWorkspace = () => {
15
20
  launchWorkspace('cancel-bill-workspace', {
16
21
  workspaceTitle: t('cancelBillForm', 'Cancel Bill Form'),
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Button } from '@carbon/react';
3
3
  import { TrashCan } from '@carbon/react/icons';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { MappedBill } from '../../../types';
5
+ import { MappedBill, PaymentStatus } from '../../../types';
6
6
  import { showModal } from '@openmrs/esm-framework';
7
7
 
8
8
  type DeleteBillActionButtonProps = {
@@ -11,6 +11,10 @@ type DeleteBillActionButtonProps = {
11
11
 
12
12
  const DeleteBillActionButton: React.FC<DeleteBillActionButtonProps> = ({ bill }) => {
13
13
  const { t } = useTranslation();
14
+
15
+ if (bill.status == PaymentStatus.PAID) {
16
+ return null;
17
+ }
14
18
  const handleOpenDeleteBillModal = (bill: MappedBill) => {
15
19
  const dispose = showModal('delete-bill-modal', {
16
20
  bill,
@@ -1,6 +1,6 @@
1
1
  import { launchWorkspace } from '@openmrs/esm-framework';
2
2
  import React from 'react';
3
- import { LineItem, MappedBill } from '../../../types';
3
+ import { LineItem, MappedBill, PaymentStatus } from '../../../types';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { OverflowMenuItem } from '@carbon/react';
6
6
 
@@ -11,6 +11,11 @@ type EditLineItemProps = {
11
11
 
12
12
  const EditLineItem: React.FC<EditLineItemProps> = ({ lineItem, bill }) => {
13
13
  const { t } = useTranslation();
14
+
15
+ if (lineItem.paymentStatus == PaymentStatus.PAID) {
16
+ return null;
17
+ }
18
+
14
19
  const handleOpenEditLineItemWorkspace = (lineItem: LineItem) => {
15
20
  launchWorkspace('edit-bill-form', {
16
21
  workspaceTitle: t('editBillForm', 'Edit Bill Form'),
@@ -1,6 +1,6 @@
1
1
  import { OverflowMenuItem } from '@carbon/react';
2
2
  import React from 'react';
3
- import { LineItem, MappedBill } from '../../../types';
3
+ import { LineItem, MappedBill, PaymentStatus } from '../../../types';
4
4
  import { showModal } from '@openmrs/esm-framework';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
@@ -24,6 +24,10 @@ const RefundLineItem: React.FC<RefundLineItemProps> = ({ lineItem, bill, isRefun
24
24
  return null;
25
25
  }
26
26
 
27
+ if (lineItem.paymentStatus !== PaymentStatus.PAID) {
28
+ return null;
29
+ }
30
+
27
31
  return <OverflowMenuItem itemText={t('refundItem', 'Refund item')} onClick={() => handleOpenRefundLineItemModal()} />;
28
32
  };
29
33
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Button } from '@carbon/react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Scalpel } from '@carbon/react/icons';
5
- import { MappedBill } from '../../../types';
5
+ import { MappedBill, PaymentStatus } from '../../../types';
6
6
  import { launchWorkspace } from '@openmrs/esm-framework';
7
7
 
8
8
  type WaiveBillActionButtonProps = {
@@ -12,6 +12,9 @@ type WaiveBillActionButtonProps = {
12
12
  const WaiveBillActionButton: React.FC<WaiveBillActionButtonProps> = ({ bill }) => {
13
13
  const { t } = useTranslation();
14
14
 
15
+ if (bill.status == PaymentStatus.PAID) {
16
+ return null;
17
+ }
15
18
  const handleOpenWaiveBillWorkspace = (bill: MappedBill) => {
16
19
  launchWorkspace('waive-bill-form', {
17
20
  workspaceTitle: 'Waive Bill Form',
@@ -10,7 +10,7 @@ import {
10
10
  } from '@carbon/react';
11
11
  import { useTranslation } from 'react-i18next';
12
12
  import { convertToCurrency, extractString } from '../../helpers';
13
- import { LineItem, MappedBill } from '../../types';
13
+ import { LineItem, MappedBill, PaymentStatus } from '../../types';
14
14
  import styles from './bill-manager.scss';
15
15
  import { ExtensionSlot } from '@openmrs/esm-framework';
16
16
 
@@ -26,6 +26,7 @@ const BillLineItems: React.FC<{ bill: MappedBill }> = ({ bill }) => {
26
26
  <StructuredListCell head>{t('quantity', 'Quantity')}</StructuredListCell>
27
27
  <StructuredListCell head>{t('unitPrice', 'Unit Price')}</StructuredListCell>
28
28
  <StructuredListCell head>{t('total', 'Total')}</StructuredListCell>
29
+ <StructuredListCell head>{t('status', 'Status')}</StructuredListCell>
29
30
  <StructuredListCell head>{t('actions', 'Actions')}</StructuredListCell>
30
31
  </StructuredListRow>
31
32
  </StructuredListHead>
@@ -52,18 +53,22 @@ const LineItemRow = ({ lineItem, bill }: { lineItem: LineItem; bill: MappedBill
52
53
  lineItem.billableService.split(':').at(0),
53
54
  );
54
55
 
56
+ const extensionHeight = lineItem.paymentStatus === PaymentStatus.PAID ? '3em' : '5em';
57
+
55
58
  return (
56
59
  <StructuredListRow className={isRefundedLineItem && styles.refundedItem}>
57
60
  <StructuredListCell>
58
- {lineItem.item === '' ? extractString(lineItem.billableService) : extractString(lineItem.item)}
61
+ {lineItem.item === '' ? lineItem.billableService.split(':')[1] : extractString(lineItem.item)}
59
62
  </StructuredListCell>
60
63
  <StructuredListCell>{lineItem.quantity}</StructuredListCell>
61
64
  <StructuredListCell>{convertToCurrency(lineItem.price)}</StructuredListCell>
62
65
  <StructuredListCell>{convertToCurrency(lineItem.price * lineItem.quantity)}</StructuredListCell>
66
+ <StructuredListCell>{lineItem.paymentStatus}</StructuredListCell>
67
+
63
68
  <StructuredListCell>
64
69
  <OverflowMenu aria-label="overflow-menu">
65
70
  <ExtensionSlot
66
- style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', height: '7.5rem' }}
71
+ style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', height: extensionHeight }}
67
72
  className="cds--overflow-menu-options__option"
68
73
  name="bill-actions-overflow-menu-slot"
69
74
  state={{ lineItem, bill, isRefundedBillableService }}
@@ -21,9 +21,7 @@ const BillManager: React.FC<BillManagerProps> = () => {
21
21
  const [patientUuid, setPatientUuid] = React.useState<string>(undefined);
22
22
  const { t } = useTranslation();
23
23
  const { patientBills: bills, isLoading } = usePatientBills(patientUuid);
24
- const filteredBills =
25
- bills.filter((bill) => !Boolean(bill.totalAmount === bill.tenderedAmount) && patientUuid === bill.patientUuid) ??
26
- [];
24
+ const filteredBills = bills.filter((bill) => patientUuid === bill.patientUuid) ?? [];
27
25
 
28
26
  return (
29
27
  <>
@@ -32,11 +32,18 @@ export const RefundBillModal: React.FC<RefundBillModalProps> = ({ onClose, bill,
32
32
  ...(billableServiceUuid && { billableService: billableServiceUuid }),
33
33
  };
34
34
 
35
+ const billPayments = bill.payments.map((payment) => ({
36
+ instanceType: payment.instanceType.uuid,
37
+ attributes: [],
38
+ amount: payment.amount,
39
+ amountTendered: payment.amountTendered,
40
+ }));
41
+
35
42
  const billWithRefund = {
36
43
  cashPoint: bill.cashPointUuid,
37
44
  cashier: bill.cashier.uuid,
38
45
  lineItems: [lineItemToBeRefunded],
39
- payments: bill.payments,
46
+ payments: billPayments,
40
47
  patient: bill.patientUuid,
41
48
  status: bill.status,
42
49
  };
@@ -72,22 +79,26 @@ export const RefundBillModal: React.FC<RefundBillModalProps> = ({ onClose, bill,
72
79
  {t('refundBill', 'Refund Bill')}
73
80
  </ModalHeader>
74
81
  <ModalBody className={styles.modalHeaderHeading}>
75
- {t('refundBillDescription', 'Are you sure you want to refund this bill? Proceed cautiously.')}
82
+ {lineItem.paymentStatus === PaymentStatus.PAID
83
+ ? t('refundBillDescription', 'Are you sure you want to refund this bill? Proceed cautiously.')
84
+ : t('refundBillDescription', 'Refund is only allowed for paid bills')}
76
85
  </ModalBody>
77
86
  <ModalFooter>
78
87
  <Button kind="secondary" onClick={onClose}>
79
88
  {t('cancel', 'Cancel')}
80
89
  </Button>
81
- <Button kind="danger" onClick={refundBillItems} disabled={isLoading}>
82
- {isLoading ? (
83
- <div className={styles.loading_wrapper}>
84
- <Loading className={styles.button_spinner} withOverlay={false} small />
85
- {t('processingPayment', 'Processing Payment')}
86
- </div>
87
- ) : (
88
- t('refund', 'Refund')
89
- )}
90
- </Button>
90
+ {lineItem.paymentStatus === PaymentStatus.PAID && (
91
+ <Button kind="danger" onClick={refundBillItems} disabled={isLoading}>
92
+ {isLoading ? (
93
+ <div className={styles.loading_wrapper}>
94
+ <Loading className={styles.button_spinner} withOverlay={false} small />
95
+ {t('processingPayment', 'Processing Payment')}
96
+ </div>
97
+ ) : (
98
+ t('refund', 'Refund')
99
+ )}
100
+ </Button>
101
+ )}
91
102
  </ModalFooter>
92
103
  </>
93
104
  );
@@ -63,7 +63,7 @@ export const PatientBills: React.FC<PatientBillsProps> = ({ bills, onCancel, pat
63
63
  style={{ textDecoration: 'none', maxWidth: '50%' }}
64
64
  to={billingUrl}
65
65
  templateParams={{ patientUuid: bill.patientUuid, uuid: bill.uuid }}>
66
- {bill.lineItems.map((item) => extractString(item.billableService)).join(', ')}
66
+ {bill.lineItems.map((item) => item.billableService.split(':')[1]).join(', ')}
67
67
  </ConfigurableLink>
68
68
  ),
69
69
  totalAmount: convertToCurrency(bill.totalAmount),