WIP RO Closer.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<babeledit_project be_version="2.7.1" version="1.2">
|
||||
<babeledit_project version="1.2" be_version="2.7.1">
|
||||
<!--
|
||||
|
||||
BabelEdit project file
|
||||
@@ -18897,6 +18897,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>media</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>message</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -33199,6 +33220,111 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>outstanding_ar</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>outstanding_credit_memos</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>outstanding_reconciliation_discrep</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>outstanding_sublets</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>outstandinghours</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>override_header</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -34049,6 +34175,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>roguardwarnings</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>rosaletotal</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -34259,6 +34406,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>subletsnotcompleted</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>subletstotal</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
import {Card, Col, Row, Space, Statistic, Tooltip, Typography} from "antd";
|
||||
import { Alert, Card, Col, Row, Space, Statistic, Tooltip, Typography } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import "./job-bills-total.styles.scss";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
export default function JobBillsTotalComponent({
|
||||
loading,
|
||||
bills,
|
||||
partsOrders,
|
||||
jobTotals,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
if (loading) return <LoadingSkeleton/>;
|
||||
if (!!!jobTotals)
|
||||
return (
|
||||
<AlertComponent type="error" message={t("jobs.errors.nofinancial")}/>
|
||||
);
|
||||
if (!!!jobTotals){
|
||||
|
||||
if(showWarning && warningCallback && typeof warningCallback === 'function'){
|
||||
warningCallback(t("jobs.errors.nofinancial"))
|
||||
}
|
||||
return (
|
||||
<AlertComponent type="error" message={t("jobs.errors.nofinancial")}/>
|
||||
);
|
||||
}
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
@@ -99,9 +106,24 @@ export default function JobBillsTotalComponent({
|
||||
const discrepWithCms = discrepWithLbrAdj.add(totalReturns);
|
||||
const calculatedCreditsNotReceived = totalReturns.subtract(billCms); //billCms is tracked as a negative number.
|
||||
|
||||
|
||||
if (showWarning && warningCallback && typeof warningCallback === 'function') {
|
||||
if (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) {
|
||||
warningCallback(t('jobs.labels.outstanding_reconciliation_discrep'));
|
||||
}
|
||||
if (calculatedCreditsNotReceived.getAmount() > 0) {
|
||||
warningCallback(t('jobs.labels.outstanding_credit_memos'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Row gutter={16}>
|
||||
<Col span={18}>
|
||||
<Row gutter={[16,16]}>
|
||||
<Col md={24} lg={18}>
|
||||
<Card title={t("jobs.labels.jobtotals")} style={{height: "100%"}}>
|
||||
<Space wrap size="large">
|
||||
<Tooltip
|
||||
@@ -218,9 +240,15 @@ export default function JobBillsTotalComponent({
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
|
||||
{showWarning && (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_reconciliation_discrep")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Col md={24} lg={6} >
|
||||
<Card title={t("jobs.labels.returntotals")} style={{height: "100%"}}>
|
||||
<Space wrap>
|
||||
<Tooltip
|
||||
@@ -288,6 +316,9 @@ export default function JobBillsTotalComponent({
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{showWarning && (
|
||||
calculatedCreditsNotReceived.getAmount() > 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_credit_memos")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -21,7 +21,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardLabor);
|
||||
|
||||
export function JobCloseRoGuardLabor({ job, jobRO, bodyshop, form }) {
|
||||
export function JobCloseRoGuardLabor({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: { id: job.id },
|
||||
fetchPolicy: 'network-only',
|
||||
@@ -44,6 +44,8 @@ export function JobCloseRoGuardLabor({ job, jobRO, bodyshop, form }) {
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
/>
|
||||
) : (
|
||||
<LaborAllocationsTableComponent
|
||||
@@ -52,6 +54,8 @@ export function JobCloseRoGuardLabor({ job, jobRO, bodyshop, form }) {
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Alert, Card } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import { useMemo } from 'react';
|
||||
import Dinero from 'dinero.js';
|
||||
import DataLabel from '../data-label/data-label.component';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardProfit);
|
||||
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const total = useMemo(() => {
|
||||
return (
|
||||
job.payments &&
|
||||
job.payments.reduce((acc, val) => {
|
||||
acc = acc.add(Dinero({ amount: Math.round(val.amount * 100) }));
|
||||
return acc;
|
||||
}, Dinero())
|
||||
);
|
||||
}, [job.payments]);
|
||||
|
||||
const balance = useMemo(() => {
|
||||
if (job && job.job_totals && job.job_totals.totals.total_repairs)
|
||||
return Dinero(job.job_totals.totals.total_repairs).subtract(total);
|
||||
return Dinero({ amount: 0 }).subtract(total);
|
||||
}, [job, total]);
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.accountsreceivable')} style={{ height: '100%' }}>
|
||||
<DataLabel label={t('payments.labels.totalpayments')}>{total.toFormat()}</DataLabel>
|
||||
<DataLabel
|
||||
valueStyle={{ color: balance.getAmount() !== 0 ? 'red' : 'green' }}
|
||||
label={t('payments.labels.balance')}
|
||||
>
|
||||
{balance.toFormat()}
|
||||
</DataLabel>
|
||||
{balance.getAmount !== 0 && (
|
||||
<Alert style={{margin: "8px 0px"}} type="warning" message={t('jobs.labels.outstanding_ar')} />
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardBills);
|
||||
|
||||
export function JobCloseRoGuardBills({ job, jobRO, bodyshop, form }) {
|
||||
export function JobCloseRoGuardBills({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { loading, error, data } = useQuery(QUERY_BILLS_BY_JOBID, {
|
||||
variables: { jobid: job.id },
|
||||
fetchPolicy: 'network-only',
|
||||
@@ -33,6 +33,8 @@ export function JobCloseRoGuardBills({ job, jobRO, bodyshop, form }) {
|
||||
bills={data ? data.bills : []}
|
||||
partsOrders={data ? data.parts_orders : []}
|
||||
jobTotals={job.job_totals}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import React from 'react';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import { Col, Row } from 'antd';
|
||||
import { Badge, Card, Col, Collapse, Row, Space } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobCloseRoGuardBills from './job-close-ro-guard.bills';
|
||||
import JobCloseRoGuardTotals from './job-close-ro-guard.totals';
|
||||
import JobCloseRoGuardLabor from './job-close-ro-gaurd.labor';
|
||||
import JobCloseRoGuardTtLifecycle from './job-close-ro-guard.tt-lifecycle';
|
||||
import JobCloseRoGuardAr from './job-close-ro-guard.ar';
|
||||
import JobCloseRoGuardBills from './job-close-ro-guard.bills';
|
||||
import JobCloseRoGuardPpd from './job-close-ro-guard.ppd';
|
||||
import JobCloseRoGuardProfit from './job-close-ro-guard.profit';
|
||||
import './job-close-ro-guard.styles.scss';
|
||||
import JobCloseRoGuardSublet from './job-close-ro-guard.sublet';
|
||||
import JobCloseRoGuardTtLifecycle from './job-close-ro-guard.tt-lifecycle';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -26,26 +31,67 @@ const colSpans = {
|
||||
xl: 8,
|
||||
};
|
||||
export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const [warnings, setWarnings] = useState([]);
|
||||
|
||||
const warningCallback = useCallback((warning) => setWarnings((state) => [...state, warning]), []);
|
||||
|
||||
return (
|
||||
<Row gutter={[32,32]}>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardBills job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardProfit job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardTotals job={job} />
|
||||
</Col>
|
||||
<Col {...colSpans}>AR Balance</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardLabor job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>Sublet Manager</Col>
|
||||
<Col {...colSpans}>PPD Check</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardTtLifecycle job={job} />
|
||||
</Col>
|
||||
</Row>
|
||||
<>
|
||||
{warnings.length > 0 && (
|
||||
<Card
|
||||
title={
|
||||
<Space size="small">
|
||||
<Badge count={warnings.length} />
|
||||
{t('jobs.labels.roguardwarnings')}
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<ul>
|
||||
{warnings.map((warning, index) => (
|
||||
<li key={index}>{warning}</li>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Collapse>
|
||||
<Collapse.Panel forceRender key="roguard" header={t('jobs.labels.roguard')}>
|
||||
<Row gutter={[32, 32]}>
|
||||
<JobCloseRoGuardBills job={job} form={form} warningCallback={warningCallback} />
|
||||
<Col className="ro-guard-col-multiple" md={24} lg={6}>
|
||||
<Row gutter={[32, 32]} style={{ height: '100%' }}>
|
||||
<Col span={24}>
|
||||
<JobCloseRoGuardProfit
|
||||
job={job}
|
||||
form={form} //warningCallback={warningCallback}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<JobCloseRoGuardAr job={job} form={form} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Col className="ro-guard-col" md={24} lg={8}>
|
||||
<JobCloseRoGuardSublet job={job} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
<Col className="ro-guard-col" md={24} lg={10}>
|
||||
<JobCloseRoGuardLabor job={job} form={form} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
<Col className="ro-guard-col" {...colSpans}>
|
||||
<JobCloseRoGuardPpd job={job} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Collapse.Panel>
|
||||
|
||||
<Collapse.Panel header={t('jobs.labels.performance')}>
|
||||
<Row gutter={[32, 32]}>
|
||||
<Col className="ro-guard-col" span={24}>
|
||||
<JobCloseRoGuardTtLifecycle job={job} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Card, Table } from 'antd';
|
||||
import { t } from 'i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import CurrencyFormatter from '../../utils/CurrencyFormatter';
|
||||
import { alphaSort } from '../../utils/sorters';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardPpd);
|
||||
|
||||
export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form }) {
|
||||
const subletsNotDone = job?.joblines.filter(
|
||||
(j) => j.act_price_before_ppc !== 0 && j.act_price_before_ppc !== null
|
||||
);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('joblines.fields.line_desc'),
|
||||
dataIndex: 'line_desc',
|
||||
fixed: 'left',
|
||||
key: 'line_desc',
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && 'job-line-manual',
|
||||
style: {
|
||||
...(record.critical ? { boxShadow: ' -.5em 0 0 #FFC107' } : {}),
|
||||
},
|
||||
}),
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.act_price'),
|
||||
dataIndex: 'act_price',
|
||||
key: 'act_price',
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => <CurrencyFormatter>{record.act_price}</CurrencyFormatter>,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.act_price_before_ppc'),
|
||||
dataIndex: 'act_price_before_ppc',
|
||||
key: 'act_price_before_ppc',
|
||||
sorter: (a, b) => a.act_price_before_ppc - b.act_price_before_ppc,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatter>{record.act_price_before_ppc}</CurrencyFormatter>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.part_qty'),
|
||||
dataIndex: 'part_qty',
|
||||
key: 'part_qty',
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.notes'),
|
||||
dataIndex: 'notes',
|
||||
key: 'notes',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.subletsnotcompleted')}>
|
||||
<Table
|
||||
dataSource={subletsNotDone}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
rowKey="id"
|
||||
bordered
|
||||
size="small"
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
import { Card, Form, Input } from 'antd';
|
||||
import axios from 'axios';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobCostingStatistics from '../job-costing-statistics/job-costing-statistics.component';
|
||||
import LoadingSkeleton from '../loading-skeleton/loading-skeleton.component';
|
||||
import { Card, Form, Input, Space } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -21,7 +21,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardProfit);
|
||||
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const [costingData, setCostingData] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
@@ -41,14 +41,21 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
getData();
|
||||
}, [job.id]);
|
||||
|
||||
const enforceProfitPassword =
|
||||
parseFloat(costingData?.summaryData.gppercent) < bodyshop?.md_ro_guard?.totalgppercent_minimum; //TODO Add bodyshop related values.
|
||||
|
||||
useEffect(() => {
|
||||
if (enforceProfitPassword && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.profitbypassrequired'));
|
||||
}
|
||||
}, [enforceProfitPassword, t, warningCallback]);
|
||||
|
||||
if (loading || !costingData) return <LoadingSkeleton />;
|
||||
|
||||
const enforceProfitPassword = parseFloat(costingData?.summaryData.gppercent) < 90;
|
||||
return (
|
||||
<Card title={t('jobs.labels.profits')}>
|
||||
<Space direction="horizontal">
|
||||
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
|
||||
</Space>{' '}
|
||||
<Card title={t('jobs.labels.profits')} style={{ height: '100%' }}>
|
||||
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
|
||||
|
||||
{enforceProfitPassword && (
|
||||
<Form.Item
|
||||
name="profitbypasspassword"
|
||||
@@ -61,10 +68,9 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
validator(_, value) {
|
||||
if (
|
||||
parseFloat(costingData?.summaryData.gppercent) <
|
||||
bodyshop.md_ro_guard.totalgppercent_minimum &&
|
||||
bodyshop?.md_ro_guard?.totalgppercent_minimum &&
|
||||
value !== bodyshop.md_ro_guard.profitbypasspassword
|
||||
) {
|
||||
console.log('We shoudl enforce it.');
|
||||
return Promise.reject(t('jobs.labels.profitbypassrequired'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.ro-guard-col {
|
||||
.ant-card {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import { Alert, Card, Table } from 'antd';
|
||||
import { t } from 'i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import CurrencyFormatter from '../../utils/CurrencyFormatter';
|
||||
import { alphaSort } from '../../utils/sorters';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardSublet);
|
||||
|
||||
export function JobCloseRGuardSublet({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const subletsNotDone = job?.joblines.filter(
|
||||
(j) =>
|
||||
(j.part_type === 'PAS' || j.part_type === 'PASL') &&
|
||||
(!j.sublet_completed || !j.sublet_ignored)
|
||||
);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('joblines.fields.line_desc'),
|
||||
dataIndex: 'line_desc',
|
||||
fixed: 'left',
|
||||
key: 'line_desc',
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && 'job-line-manual',
|
||||
style: {
|
||||
...(record.critical ? { boxShadow: ' -.5em 0 0 #FFC107' } : {}),
|
||||
},
|
||||
}),
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.act_price'),
|
||||
dataIndex: 'act_price',
|
||||
key: 'act_price',
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => <CurrencyFormatter>{record.act_price}</CurrencyFormatter>,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.part_qty'),
|
||||
dataIndex: 'part_qty',
|
||||
key: 'part_qty',
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.notes'),
|
||||
dataIndex: 'notes',
|
||||
key: 'notes',
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
if (subletsNotDone.length > 0) {
|
||||
warningCallback(t('jobs.labels.outstanding_sublets'));
|
||||
}
|
||||
}, [subletsNotDone.length, warningCallback]);
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.subletsnotcompleted')}>
|
||||
<Table
|
||||
dataSource={subletsNotDone}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
rowKey="id"
|
||||
bordered
|
||||
size="small"
|
||||
/>
|
||||
{subletsNotDone.length > 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_sublets')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardTTLif
|
||||
export function JobCloseRoGuardTTLifeCycle({ job, jobRO, bodyshop, form }) {
|
||||
return (
|
||||
<div>
|
||||
Add Touch Time
|
||||
//TODO Add Touch Time
|
||||
<JobLifecycleComponent job={job} statuses={bodyshop.md_ro_statuses} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -8,13 +8,26 @@ export default function JobCostingStatistics({ summaryData, onlyGP }) {
|
||||
|
||||
const gpTotals = (
|
||||
<>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.gpdollars).toFormat()}
|
||||
title={t('jobs.labels.gpdollars')}
|
||||
/>
|
||||
<Statistic value={summaryData.gppercentFormatted} title={t('jobs.labels.gppercent')} />
|
||||
<Space wrap direction="horizontal" size={'large'}>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalSales).toFormat()}
|
||||
title={t('jobs.labels.total_sales')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalCost).toFormat()}
|
||||
title={t('jobs.labels.total_cost')}
|
||||
/>
|
||||
</Space>{' '}
|
||||
<Space wrap direction="horizontal" size={'large'}>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.gpdollars).toFormat()}
|
||||
title={t('jobs.labels.gpdollars')}
|
||||
/>
|
||||
<Statistic value={summaryData.gppercentFormatted} title={t('jobs.labels.gppercent')} />
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
|
||||
if (onlyGP) return gpTotals;
|
||||
|
||||
return (
|
||||
|
||||
@@ -227,7 +227,7 @@ export function JobLifecycleComponent({job, statuses, ...rest}) {
|
||||
<Table style={{
|
||||
overflow: 'auto',
|
||||
width: '100%',
|
||||
}} columns={columns} dataSource={lifecycleData.lifecycle}/>
|
||||
}} columns={columns} dataSource={lifecycleData.lifecycle} rowKey={"start"}/>
|
||||
</Card>
|
||||
</Space>
|
||||
) : (
|
||||
|
||||
@@ -143,6 +143,7 @@ export function JobPayments({
|
||||
},
|
||||
];
|
||||
|
||||
//Same as in RO guard. If changed, update in both.
|
||||
const total = useMemo(() => {
|
||||
return (
|
||||
job.payments &&
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {EditFilled} from "@ant-design/icons";
|
||||
import {Card, Col, Row, Space, Table, Typography} from "antd";
|
||||
import {Alert, Card, Col, Row, Space, Table, Typography} from "antd";
|
||||
import _ from "lodash";
|
||||
import React, {useEffect, useMemo, useState} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
@@ -26,6 +26,8 @@ export function LaborAllocationsTable({
|
||||
bodyshop,
|
||||
adjustments,
|
||||
technician,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
const [totals, setTotals] = useState([]);
|
||||
@@ -202,6 +204,11 @@ export function LaborAllocationsTable({
|
||||
{hrs_total: 0, hrs_claimed: 0, adjustments: 0, difference: 0}
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.outstandinghours'));
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -261,6 +268,14 @@ export function LaborAllocationsTable({
|
||||
</Card>
|
||||
</Col>
|
||||
)}
|
||||
{
|
||||
showWarning && summary.difference !== 0 &&
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstandinghours')}
|
||||
/>
|
||||
}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Button, Card, Col, notification, Row, Space, Table, Typography,} from "antd";
|
||||
import {Alert, Button, Card, Col, notification, Row, Space, Table, Typography,} from "antd";
|
||||
import {SyncOutlined} from "@ant-design/icons";
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
@@ -24,6 +24,8 @@ export function PayrollLaborAllocationsTable({
|
||||
adjustments,
|
||||
technician,
|
||||
refetch,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
const [totals, setTotals] = useState([]);
|
||||
@@ -216,6 +218,10 @@ export function PayrollLaborAllocationsTable({
|
||||
{hrs_total: 0, hrs_claimed: 0, adjustments: 0, difference: 0}
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.outstandinghours'));
|
||||
}
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -318,6 +324,14 @@ export function PayrollLaborAllocationsTable({
|
||||
</Card>
|
||||
</Col>
|
||||
)}
|
||||
{
|
||||
showWarning && summary.difference !== 0 &&
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstandinghours')}
|
||||
/>
|
||||
}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2030,6 +2030,19 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
kmout
|
||||
qb_multiple_payers
|
||||
lbr_adjustments
|
||||
payments {
|
||||
amount
|
||||
created_at
|
||||
date
|
||||
exportedat
|
||||
id
|
||||
jobid
|
||||
memo
|
||||
payer
|
||||
paymentnum
|
||||
transactionid
|
||||
type
|
||||
}
|
||||
joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
|
||||
id
|
||||
removed
|
||||
@@ -2042,6 +2055,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
db_price
|
||||
act_price
|
||||
part_qty
|
||||
notes
|
||||
mod_lbr_ty
|
||||
db_hrs
|
||||
mod_lb_hrs
|
||||
@@ -2053,6 +2067,9 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
prt_dsmk_p
|
||||
convertedtolbr
|
||||
convertedtolbr_data
|
||||
act_price_before_ppc
|
||||
sublet_ignored
|
||||
sublet_completed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1951,6 +1951,11 @@
|
||||
"net_repairs": "Net Repairs",
|
||||
"notes": "Notes",
|
||||
"othertotal": "Other Totals",
|
||||
"outstanding_ar": "A balance is outstanding on this RO. Payments can still be entered when the job is closed. ",
|
||||
"outstanding_credit_memos": "Outstanding credit memos have not been entered against this job. Credit Memos may still be posted once the job is closed.",
|
||||
"outstanding_reconciliation_discrep": "At least one discrepancy is not 0. This may indicate that this job is not properly reconciled and should not be closed.",
|
||||
"outstanding_sublets": "There are sublet lines on the job which have not been marked as completed. ",
|
||||
"outstandinghours": "There are outstanding hours on the job that have not been paid or have been overpaid.",
|
||||
"override_header": "Override estimate header on import?",
|
||||
"ownerassociation": "Owner Association",
|
||||
"parts": "Parts",
|
||||
@@ -1995,6 +2000,7 @@
|
||||
"relatedros": "Related ROs",
|
||||
"remove_from_ar": "Remove from AR",
|
||||
"returntotals": "Return Totals",
|
||||
"roguardwarnings": "RO Guard Warnings",
|
||||
"rosaletotal": "RO Parts Total",
|
||||
"sale_additional": "Sales - Additional",
|
||||
"sale_labor": "Sales - Labor",
|
||||
@@ -2005,6 +2011,7 @@
|
||||
"scheduledinchange": "The scheduled in is based off the latest appointment. To change this date, please schedule or reschedule the Job. ",
|
||||
"specialcoveragepolicy": "Special Coverage Policy Applies",
|
||||
"state_tax_amt": "Provincial/State Taxes",
|
||||
"subletsnotcompleted": "Outstanding Sublets",
|
||||
"subletstotal": "Sublets Total",
|
||||
"subtotal": "Subtotal",
|
||||
"supplementnote": "The Job had a supplement imported.",
|
||||
|
||||
@@ -1165,6 +1165,7 @@
|
||||
"loadingshop": "Cargando datos de la tienda ...",
|
||||
"loggingin": "Iniciando sesión ...",
|
||||
"markedexported": "",
|
||||
"media": "",
|
||||
"message": "",
|
||||
"monday": "",
|
||||
"na": "N / A",
|
||||
@@ -1950,6 +1951,11 @@
|
||||
"net_repairs": "",
|
||||
"notes": "Notas",
|
||||
"othertotal": "",
|
||||
"outstanding_ar": "",
|
||||
"outstanding_credit_memos": "",
|
||||
"outstanding_reconciliation_discrep": "",
|
||||
"outstanding_sublets": "",
|
||||
"outstandinghours": "",
|
||||
"override_header": "¿Anular encabezado estimado al importar?",
|
||||
"ownerassociation": "",
|
||||
"parts": "Partes",
|
||||
@@ -1994,6 +2000,7 @@
|
||||
"relatedros": "",
|
||||
"remove_from_ar": "",
|
||||
"returntotals": "",
|
||||
"roguardwarnings": "",
|
||||
"rosaletotal": "",
|
||||
"sale_additional": "",
|
||||
"sale_labor": "",
|
||||
@@ -2004,6 +2011,7 @@
|
||||
"scheduledinchange": "",
|
||||
"specialcoveragepolicy": "",
|
||||
"state_tax_amt": "",
|
||||
"subletsnotcompleted": "",
|
||||
"subletstotal": "",
|
||||
"subtotal": "",
|
||||
"supplementnote": "",
|
||||
|
||||
@@ -1165,6 +1165,7 @@
|
||||
"loadingshop": "Chargement des données de la boutique ...",
|
||||
"loggingin": "Vous connecter ...",
|
||||
"markedexported": "",
|
||||
"media": "",
|
||||
"message": "",
|
||||
"monday": "",
|
||||
"na": "N / A",
|
||||
@@ -1950,6 +1951,11 @@
|
||||
"net_repairs": "",
|
||||
"notes": "Remarques",
|
||||
"othertotal": "",
|
||||
"outstanding_ar": "",
|
||||
"outstanding_credit_memos": "",
|
||||
"outstanding_reconciliation_discrep": "",
|
||||
"outstanding_sublets": "",
|
||||
"outstandinghours": "",
|
||||
"override_header": "Remplacer l'en-tête d'estimation à l'importation?",
|
||||
"ownerassociation": "",
|
||||
"parts": "les pièces",
|
||||
@@ -1994,6 +2000,7 @@
|
||||
"relatedros": "",
|
||||
"remove_from_ar": "",
|
||||
"returntotals": "",
|
||||
"roguardwarnings": "",
|
||||
"rosaletotal": "",
|
||||
"sale_additional": "",
|
||||
"sale_labor": "",
|
||||
@@ -2004,6 +2011,7 @@
|
||||
"scheduledinchange": "",
|
||||
"specialcoveragepolicy": "",
|
||||
"state_tax_amt": "",
|
||||
"subletsnotcompleted": "",
|
||||
"subletstotal": "",
|
||||
"subtotal": "",
|
||||
"supplementnote": "",
|
||||
|
||||
Reference in New Issue
Block a user