diff --git a/src/actions.js b/src/actions.js
index 2b1a4ca..109bd97 100644
--- a/src/actions.js
+++ b/src/actions.js
@@ -33,7 +33,7 @@ const BENEFIT_CONSUMPTION_PROJECTION = () => [
'id',
'code',
'individual {firstName, lastName}',
- 'benefitAttachment {bill {id, code, terms}}',
+ 'benefitAttachment {bill {id, code, terms, datePayed}}',
'receipt',
'photo',
'amount',
@@ -45,7 +45,7 @@ const BENEFIT_CONSUMPTION_PROJECTION = () => [
const PAYROLL_BENEFIT_CONSUMPTION_PROJECTION = () => [
'id',
// eslint-disable-next-line max-len
- 'benefit{id,isDeleted,jsonExt,dateCreated,dateUpdated,dateValidFrom,dateValidTo,id,code,individual {firstName, lastName},benefitAttachment {bill {id, code, terms}},receipt,photo,amount,type,status,dateDue}',
+ 'benefit{id,isDeleted,jsonExt,dateCreated,dateUpdated,dateValidFrom,dateValidTo,id,code,individual {firstName, lastName},benefitAttachment {bill {id, code, terms, datePayed}},receipt,photo,amount,type,status,dateDue}',
'payroll {id, name, status, paymentCycle {runMonth, runYear}, paymentMethod, benefitPlanNameCode}',
];
@@ -55,7 +55,7 @@ const BENEFIT_CONSUMPTION_SUMMARY_PROJECTION = () => [
const BENEFIT_ATTACHMENT_PROJECTION = () => [
'benefit{id, status, code, dateDue, receipt, individual {firstName, lastName}}',
- 'bill{id, code, terms, amountTotal}',
+ 'bill{id, code, terms, amountTotal, datePayed}',
];
const PAYROLL_PROJECTION = (modulesManager) => [
diff --git a/src/components/payroll/BenefitConsumptionFilterModal.js b/src/components/payroll/BenefitConsumptionFilterModal.js
index 800994c..de283f4 100644
--- a/src/components/payroll/BenefitConsumptionFilterModal.js
+++ b/src/components/payroll/BenefitConsumptionFilterModal.js
@@ -113,6 +113,21 @@ function BenefitConsumptionFilterModal({ filters, onChangeFilters }) {
])}
/>
+
+ onChangeFilters([
+ {
+ id: 'bill_DatePayed_Gte',
+ value: v,
+ filter: `bill_DatePayed_Gte: "${v}"`,
+ },
+ ])}
+ />
+
);
}
diff --git a/src/components/payroll/BenefitConsumptionPayrollSearcher.js b/src/components/payroll/BenefitConsumptionPayrollSearcher.js
index 16723eb..4684538 100644
--- a/src/components/payroll/BenefitConsumptionPayrollSearcher.js
+++ b/src/components/payroll/BenefitConsumptionPayrollSearcher.js
@@ -44,8 +44,22 @@ function BenefitConsumptionPayrollSearcher({
'benefitConsumption.dateDue',
'benefitConsumption.amount',
'benefitConsumption.type',
+ 'benefitConsumption.payedOnTime',
+ 'benefitConsumption.paymentDate',
];
+ const checkBenefitDueDate = (payrollBenefitConsumption) => {
+ if (!payrollBenefitConsumption.benefit.receipt) {
+ return ''; // return empty string if datePayed is null
+ }
+
+ return (
+ payrollBenefitConsumption.benefit
+ && payrollBenefitConsumption.benefit.dateDue
+ >= payrollBenefitConsumption.benefit.benefitAttachment[0].bill.datePayed)
+ ? 'True' : 'False';
+ };
+
const itemFormatters = () => [
(payrollBenefitConsumption) => payrollBenefitConsumption?.payroll?.name,
(payrollBenefitConsumption) => payrollBenefitConsumption?.payroll?.benefitPlanNameCode,
@@ -58,6 +72,12 @@ function BenefitConsumptionPayrollSearcher({
(payrollBenefitConsumption) => payrollBenefitConsumption?.benefit?.dateDue,
(payrollBenefitConsumption) => payrollBenefitConsumption?.benefit?.amount,
(payrollBenefitConsumption) => payrollBenefitConsumption?.benefit?.type,
+ (payrollBenefitConsumption) => checkBenefitDueDate(payrollBenefitConsumption),
+ (payrollBenefitConsumption) => (
+ !payrollBenefitConsumption.benefit.receipt
+ ? ''
+ : payrollBenefitConsumption?.benefit?.benefitAttachment[0]?.bill?.datePayed
+ ),
];
const rowIdentifier = (benefitConsumption) => benefitConsumption.id;
diff --git a/src/components/payroll/BenefitConsumptionSearcher.js b/src/components/payroll/BenefitConsumptionSearcher.js
index 68e8c75..8f78aec 100644
--- a/src/components/payroll/BenefitConsumptionSearcher.js
+++ b/src/components/payroll/BenefitConsumptionSearcher.js
@@ -37,8 +37,22 @@ function BenefitConsumptionSearcher({
'benefitConsumption.amount',
'benefitConsumption.type',
'benefitConsumption.status',
+ 'benefitConsumption.payedOnTime',
+ 'benefitConsumption.paymentDate',
];
+ const checkBenefitDueDate = (benefitConsumption) => {
+ if (!benefitConsumption.receipt) {
+ return ''; // return empty string if datePayed is null
+ }
+
+ return (
+ benefitConsumption
+ && benefitConsumption.dateDue
+ >= benefitConsumption.benefitAttachment[0].bill.datePayed)
+ ? 'True' : 'False';
+ };
+
const itemFormatters = () => [
(benefitConsumption) => benefitConsumption?.individual?.firstName,
(benefitConsumption) => benefitConsumption?.individual?.lastName,
@@ -54,6 +68,12 @@ function BenefitConsumptionSearcher({
(benefitConsumption) => benefitConsumption?.type,
(benefitConsumption) => (isPayrollFromFailedInvoices
? BENEFIT_CONSUMPTION_STATUS.APPROVE_FOR_PAYMENT : benefitConsumption?.status),
+ (benefitConsumption) => checkBenefitDueDate(benefitConsumption),
+ (benefitConsumption) => (
+ !benefitConsumption.receipt
+ ? ''
+ : benefitConsumption?.benefitAttachment[0]?.bill?.datePayed
+ ),
];
const rowIdentifier = (benefitConsumption) => benefitConsumption.id;
diff --git a/src/components/payroll/BenefitConsumptionSearcherModal.js b/src/components/payroll/BenefitConsumptionSearcherModal.js
index 1e08062..12885ac 100644
--- a/src/components/payroll/BenefitConsumptionSearcherModal.js
+++ b/src/components/payroll/BenefitConsumptionSearcherModal.js
@@ -36,9 +36,21 @@ function BenefitConsumptionSearcherModal({
'benefitConsumption.amount',
'benefitConsumption.receipt',
'benefitConsumption.dateDue',
+ 'benefitConsumption.payedOnTime',
+ 'benefitConsumption.paymentDate',
'',
];
+ const checkBenefitDueDate = (benefitAttachment) => {
+ if (!benefitAttachment.benefit.receipt) {
+ return ''; // return empty string if datePayed is null
+ }
+
+ return (
+ benefitAttachment.benefit && benefitAttachment.benefit.dateDue >= benefitAttachment.bill.datePayed)
+ ? 'True' : 'False';
+ };
+
const itemFormatters = () => [
(benefitAttachment) => (
benefitAttachment.benefit.receipt ? (
@@ -50,6 +62,12 @@ function BenefitConsumptionSearcherModal({
(benefitAttachment) => benefitAttachment?.bill?.amountTotal,
(benefitAttachment) => benefitAttachment?.benefit?.receipt,
(benefitAttachment) => benefitAttachment?.benefit?.dateDue,
+ (benefitAttachment) => checkBenefitDueDate(benefitAttachment),
+ (benefitAttachment) => (
+ !benefitAttachment.benefit.receipt
+ ? ''
+ : benefitAttachment?.bill?.datePayed
+ ),
(benefitAttachment) => (