Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-743: added information about overdue payments to see which payment were delayed #39

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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}',
];

Expand All @@ -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) => [
Expand Down
15 changes: 15 additions & 0 deletions src/components/payroll/BenefitConsumptionFilterModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ function BenefitConsumptionFilterModal({ filters, onChangeFilters }) {
])}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
<PublishedComponent
pubRef="core.DatePicker"
module="payroll"
label={formatMessage('benefitConsumption.paymentDate')}
value={filterValue('bill_DatePayed_Gte')}
onChange={(v) => onChangeFilters([
{
id: 'bill_DatePayed_Gte',
value: v,
filter: `bill_DatePayed_Gte: "${v}"`,
},
])}
/>
</Grid>
</Grid>
);
}
Expand Down
20 changes: 20 additions & 0 deletions src/components/payroll/BenefitConsumptionPayrollSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions src/components/payroll/BenefitConsumptionSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions src/components/payroll/BenefitConsumptionSearcherModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand All @@ -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) => (
<Button
onClick={() => {}}
Expand Down
3 changes: 3 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"payroll.summary.download": "Download",
"payroll.summary.reject": "Reject",
"payroll.summary.close": "Close",
"payroll.summary.payedOnTime": "Payed On Time",
"payroll.summary.totalAmountReceived": "Total Amount Received",
"payroll.summary.totalAmountDue": "Total Amount Due",
"payroll.summary.totalNumberOfBenefits": "Total Number Of Benefits",
Expand All @@ -118,6 +119,8 @@
"payroll.benefitConsumptionStatusPicker.REJECTED": "REJECTED",
"payroll.benefitConsumptionStatusPicker.DUPLICATE": "DUPLICATE",
"payroll.benefitConsumptionStatusPicker.RECONCILED": "RECONCILED",
"payroll.benefitConsumption.payedOnTime": "Payed On Time",
"payroll.benefitConsumption.paymentDate": "Payment Date",
"payroll.paymentData.upload.label": "Upload Payment Data",

"payroll.route.payrollsApproved": "Approved Payrolls",
Expand Down
Loading