Auditing refinements.

This commit is contained in:
Patrick Fic
2024-05-09 16:11:45 -07:00
parent 9ab6e511b9
commit 2f77f0fb45
10 changed files with 161 additions and 75 deletions

View File

@@ -1,43 +1,71 @@
import { Card, Col, Divider, Space, Table, Tooltip } from "antd";
import Dinero from "dinero.js";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setSelectedJobTargetPc } from "../../../redux/application/application.actions";
import { selectAuditData } from "../../../redux/reporting/reporting.selectors";
import { setSelectedJobId, setSelectedJobTargetPc } from "../../../redux/application/application.actions";
import { selectAuditData, selectAuditLoading } from "../../../redux/reporting/reporting.selectors";
import { DateFormat } from "../../../util/constants";
import dayjs from "../../../util/day";
import Dinero from "dinero.js";
import { alphaSort, dateSort } from "../../../util/sorters";
import { Link } from "react-router-dom";
const mapStateToProps = createStructuredSelector({
selectAuditData: selectAuditData
selectAuditData: selectAuditData,
auditLoading: selectAuditLoading
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
setSelectedJobId: (id) => dispatch(setSelectedJobId(id)),
setSelectedJobTargetPc: (job) => dispatch(setSelectedJobTargetPc(job))
});
export function AuditResultsOrganism({ selectAuditData }) {
export function AuditResultsOrganism({ auditLoading, setSelectedJobId, selectAuditData }) {
const missingColumns = [
{
key: "clm_no",
width: "20%",
width: "12%",
title: "Claim No.",
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
dataIndex: "clm_no"
dataIndex: "clm_no",
render: (text, record) => (
<Link onClick={() => setSelectedJobId(record.id)} to={"/"}>
<Space>{text}</Space>
</Link>
)
},
{
key: "close_date",
width: "20%",
width: "12%",
title: "[RPS] R4P",
dataIndex: "close_date",
defaultSortOrder: "ascend",
sorter: (a, b) => dateSort(a.close_date, b.close_date),
render: (text, record) => dayjs(record.close_date).format(DateFormat)
},
{ key: "v_model_yr", width: "20%", title: "Model Year", dataIndex: "v_model_yr" },
{ key: "v_model_yr", width: "12%", title: "Model Year", dataIndex: "v_model_yr" },
{ key: "v_makedesc", width: "20%", title: "Make", dataIndex: "v_makedesc" },
{ key: "v_model", width: "20%", title: "Model", dataIndex: "v_model" }
{ key: "v_model", width: "20%", title: "Model", dataIndex: "v_model" },
{
key: "expected_rps",
width: "12%",
title: "Expected RPS ",
dataIndex: ["audit", "expectedRpsDollars"],
render: (text, record) =>
record.expectedRpsDollars
? record?.expectedRpsDollars?.toFormat()
: Dinero({ amount: Math.round((record?.expected_rps_dollars || 0) * 100) }).toFormat()
},
{
key: "actual_rps",
width: "12%",
title: " Actual RPS ",
dataIndex: ["audit", "jobRpsDollars"],
render: (text, record) =>
record?.jobRpsDollars
? record?.jobRpsDollars.toFormat()
: Dinero({ amount: Math.round((record?.actual_rps_dollars || 0) * 100) }).toFormat()
}
];
const mismatchColumns = [
@@ -71,7 +99,7 @@ export function AuditResultsOrganism({ selectAuditData }) {
{
key: "expected_rps",
width: "12%",
title: "Expected RPS",
title: "Expected RPS (RPS/Audit)",
dataIndex: ["audit", "expectedRpsDollars"],
render: (text, record) => (
<Space split={<Divider type="vertical" />}>
@@ -85,7 +113,7 @@ export function AuditResultsOrganism({ selectAuditData }) {
{
key: "actual_rps",
width: "12%",
title: " Actual RPS",
title: " Actual RPS (RPS/Audit)",
dataIndex: ["audit", "jobRpsDollars"],
render: (text, record) => (
<Space split={<Divider type="vertical" />}>
@@ -101,22 +129,46 @@ export function AuditResultsOrganism({ selectAuditData }) {
<>
<Col span={24}>
<Card title="Jobs in RPS, not found in MPI Audit">
<Table columns={missingColumns} dataSource={selectAuditData?.missingFromRps} rowKey="clm_no" />
<Table
loading={auditLoading}
columns={missingColumns}
pagination={false}
dataSource={selectAuditData?.missingFromRps}
rowKey="clm_no"
/>
</Card>
</Col>
<Col span={24}>
<Card title="Jobs in MPI Audit, not in RPS">
<Table columns={missingColumns} dataSource={selectAuditData?.missingFromAudit} rowKey="clm_no" />
<Table
loading={auditLoading}
columns={missingColumns}
pagination={false}
dataSource={selectAuditData?.missingFromAudit}
rowKey="clm_no"
/>
</Card>
</Col>
<Col span={24}>
<Card title="Mismatch - Expected Savings">
<Table columns={mismatchColumns} dataSource={selectAuditData?.expectedMismatch} rowKey="clm_no" />
<Table
loading={auditLoading}
columns={mismatchColumns}
pagination={false}
dataSource={selectAuditData?.expectedMismatch}
rowKey="clm_no"
/>
</Card>
</Col>
<Col span={24}>
<Card title="Mismatch - Actual Savings">
<Table columns={mismatchColumns} dataSource={selectAuditData?.actualMismatch} rowKey="clm_no" />
<Table
loading={auditLoading}
columns={mismatchColumns}
pagination={false}
dataSource={selectAuditData?.actualMismatch}
rowKey="clm_no"
/>
</Card>
</Col>
</>

View File

@@ -1,6 +1,8 @@
import { Alert, Button, Card, Col, DatePicker, Form, Input, Row } from "antd";
import React from "react";
import { PrinterFilled } from "@ant-design/icons";
import { Alert, Button, Card, Col, DatePicker, Form, Input, Row, Space } from "antd";
import React, { useRef } from "react";
import { connect } from "react-redux";
import { useReactToPrint } from "react-to-print";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import { queryReportingData } from "../../../redux/reporting/reporting.actions";
@@ -29,17 +31,25 @@ export function AuditPage({ auditError, queryReportingData }) {
});
ipcRenderer.send(ipcTypes.audit.toMain.browseForFile, { sheetName });
};
const componentRef = useRef();
const handlePrint = useReactToPrint({
content: () => componentRef.current,
bodyClass: "audit-container-print"
});
window.ref = componentRef.current;
if (auditError) console.log("Error when opening audit file.", auditError);
return (
<FeatureWrapper featureName="audit">
<div className="audit-container">
<Row gutter={[16, 16]}>
<div className="audit-container" id="audit-results-container">
<Row gutter={[16, 16]} ref={componentRef}>
<Col span={24}>
<Card>
<Form onFinish={handleBrowseForFile}>
<Form.Item
label="Ready for Payment Date Between"
label="1. Ready for Payment Date Between"
name="dateRange"
tooltip="Select the time period that you would like to audit. This is typically a whole month or quarter."
rules={[
{ type: "array", required: true },
{
@@ -80,15 +90,24 @@ export function AuditPage({ auditError, queryReportingData }) {
}}
/>
</Form.Item>
<Form.Item
label="Sheet Name"
tooltip="The name of the sheet which contains detailed RPS claim data."
name="sheetName"
initialValue="Shop RPS Claim Detail"
>
<Input width="200px" />
</Form.Item>
<Button htmlType="submit">Select MPI Audit XLS File</Button>
<Space align="middle" wrap>
<Form.Item
label="2. Sheet Name"
tooltip="The name of the sheet which contains detailed RPS claim data."
name="sheetName"
initialValue="Shop RPS Claim Detail"
required
>
<Input width="200px" />
</Form.Item>
<Button type="primary" htmlType="submit">
Select MPI Audit XLS File
</Button>
<Button onClick={handlePrint}>
<PrinterFilled />
</Button>
</Space>
</Form>
</Card>
</Col>

View File

@@ -16,7 +16,7 @@ function FeatureWrapper({ bodyshop, featureName, noauth, children, ...restProps
noauth || (
<Alert
message={
"You do not currently have access to this feature. Please reach out to support at support@thinkimex.com or 604-839-3431 to request access."
"You do not currently have access to this feature. Please reach out to support at support@thinkimex.com or 604-839-3431 to subscribe."
}
type="warning"
/>